org.weblab_project.core.helper.impl
Class ComplexTripleSelector

java.lang.Object
  extended by org.weblab_project.utils.BackEndJenaHelper
      extended by org.weblab_project.core.helper.impl.TripleSelectors
          extended by org.weblab_project.core.helper.impl.ComplexTripleSelector
All Implemented Interfaces:
RDFRulesSelector, RDFSelector

public class ComplexTripleSelector
extends TripleSelectors
implements RDFRulesSelector, RDFSelector


Nested Class Summary
 
Nested classes/interfaces inherited from class org.weblab_project.utils.BackEndJenaHelper
org.weblab_project.utils.BackEndJenaHelper.RDFNodeTypes, org.weblab_project.utils.BackEndJenaHelper.ResourceTypes
 
Field Summary
protected  java.util.List<Rule> rules
           
 
Fields inherited from class org.weblab_project.core.helper.impl.TripleSelectors
debug, limit, supportNullData, uris
 
Constructor Summary
ComplexTripleSelector()
           
ComplexTripleSelector(boolean supportNullData, java.lang.String... namespaces)
           
 
Method Summary
 void addPORule(java.lang.String predicat, java.lang.String object)
          Add a filter on an association predicat/object
 void addRule(Rule rule)
           
 void addSORule(java.lang.String subject, java.lang.String object)
          Add a filter on an association subject/object
 void addSPRule(java.lang.String subject, java.lang.String predicat)
          Add a filter on an association subject/predicat
protected  java.util.List<WTriple> applySelection(java.lang.String data, com.hp.hpl.jena.graph.Node s, com.hp.hpl.jena.graph.Node p, com.hp.hpl.jena.graph.Node o, java.lang.String text, org.weblab_project.core.model.Resource annotated, java.util.List<org.weblab_project.core.model.Resource> resources, org.weblab_project.core.model.PieceOfKnowledge annotation)
          Faster
 java.util.List<WTriple> findIn(org.weblab_project.core.model.Resource resource)
          TODO: A tester
 java.util.List<WTriple> findInResource(org.weblab_project.core.model.Resource resource, Filter filter)
          Select WTriple in the resource according to constrains in a filter.
 java.util.List<WTriple> findInResource(org.weblab_project.core.model.Resource resource, java.lang.String subject, java.lang.String predicate, java.lang.String object)
          Select Triplet (Subject, Predicate, Object) in the resource and its sub elements (Segments, Annotations, sub-MediaUnit ...).
 java.util.List<WTriple> findInResource(org.weblab_project.core.model.Resource resource, java.lang.String subject, java.lang.String predicate, java.lang.String object, boolean reif)
          Select WTriple in resource according to given subject, predicate and object.
protected  boolean matches(Rule rule, com.hp.hpl.jena.graph.Triple t)
           
 WTripleMap searchFor(org.weblab_project.core.model.Resource resource, java.lang.String... predicates)
          Uses rules
 
Methods inherited from class org.weblab_project.core.helper.impl.TripleSelectors
copyAndAdd, find, limitToFirstLevelAnnotation
 
Methods inherited from class org.weblab_project.utils.BackEndJenaHelper
addToModel, addToModel, close, containsResource, containsStatement, convertReifMap, createAnonResStat, createAnonResStatOnAnonSubj, createAnonResStatReif, createAnonResStatReif, createAnonResStatReifOnAnonSubj, createAnonResStatReifOnAnonSubj, createLitStat, createLitStat, createLitStatOnAnonSubj, createLitStatReif, createLitStatReif, createLitStatReifOnAnonSubj, createLitStatReifOnAnonSubj, createReifiedStatement, createResStat, createResStatOnAnonSubj, createResStatReif, createResStatReif, createResStatReifOnAnonSubj, createResStatReifOnAnonSubj, createStatement, createStatement, createTempLit, createTempLit, createTempProp, createTempRes, finalize, getAnonReifStats, getAnonResOfAnonReifStat, getAnonResOnPredAnonResStatReif, getAnonResOnPredAnonResStatReifOnAnonSubj, getAnonResOnPredAnonStatReif, getAnonResOnPredAnonSubj, getAnonResOnPredLitStatReif, getAnonResOnPredLitStatReifOnAnonSubj, getAnonResOnPredResStatReif, getAnonResOnPredResStatReifOnAnonSubj, getAnonResOnPredStatReif, getAnonResOnPredSubj, getAnonResOnReifStat, getAnonSubj, getAnonSubjOfAnonReifStat, getAnonSubjOfReifStat, getAnonSubjOnPred, getAnonSubjOnPredAnonRes, getAnonSubjOnPredLit, getAnonSubjOnPredRes, getLitOfAnonReifStat, getLitOfReifStat, getLitOnPredAnonResStatReif, getLitOnPredAnonResStatReifOnAnonSubj, getLitOnPredAnonStatReif, getLitOnPredAnonSubj, getLitOnPredLitStatReif, getLitOnPredLitStatReifOnAnonSubj, getLitOnPredResStatReif, getLitsOnPredResStatReifOnAnonSubj, getLitsOnPredStatReif, getLitsOnPredSubj, getLitsOnPredSubj, getModel, getNSPrefixes, getObjects, getObjects, getPredicates, getPredOfAnonReifStat, getPredOfReifStat, getPredOnAnonResStatReif, getPredOnAnonResStatReifOnAnonSubj, getPredOnAnonStatReif, getPredOnAnonSubj, getPredOnLitStatReif, getPredOnLitStatReifOnAnonSubj, getPredOnResStatReif, getPredOnResStatReifOnAnonSubj, getPredOnStatReif, getPreds, getPredsOnSubj, getRdfXml, getReifiedStatementObject, getReifiedStatementPredicate, getReifiedStatementSubject, getReifStats, getReifStats, getResOfAnonReifStat, getResOfReifStat, getResOnPredAnonResStatReif, getResOnPredAnonResStatReifOnAnonSubj, getResOnPredAnonStatReif, getResOnPredAnonSubj, getResOnPredLitStatReif, getResOnPredLitStatReifOnAnonSubj, getResOnPredResStatReif, getResOnPredResStatReifOnAnonSubj, getResOnPredStatReif, getRessOnPredSubj, getSpecifiedReifStat, getSubjects, getSubjects, getSubjOfAnonReifStat, getSubjOfReifStat, getSubjOnPredAnonRes, getSubjs, getSubjsOnPred, getSubjsOnPredLit, getSubjsOnPredRes, hasAnonResStat, hasAnonResStatOnAnonSubj, hasLitStat, hasLitStatOnAnonSubj, hasResStat, hasResStatOnAnonSubj, isAnonResStatReif, isAnonResStatReifOnAnonSubj, isDefinedAnonRes, isDefinedResource, isLitStatReif, isLitStatReifOnAnonSubj, isReified, isResStatReif, isResStatReifOnAnonSubj, listReifiedStatements, listStatements, modelFromFile, removeAnonReifStat, removeAnonResStat, removeAnonResStatOnAnonSubj, removeLitStat, removeLitStatOnAnonSubj, removeReification, removeReifStat, removeResStat, removeResStatOnAnonSubj, removeStatement, removeStatsOnAnonSubj, removeStatsOnSubj, removeStatsWithLit, removeStatsWithPred, removeStatsWithRes, removeStatWithAnonRes, setNSPrefix
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.weblab_project.core.helper.impl.RDFRulesSelector
limitToFirstLevelAnnotation
 
Methods inherited from interface org.weblab_project.core.helper.impl.RDFSelector
limitToFirstLevelAnnotation
 

Field Detail

rules

protected transient java.util.List<Rule> rules
Constructor Detail

ComplexTripleSelector

public ComplexTripleSelector()

ComplexTripleSelector

public ComplexTripleSelector(boolean supportNullData,
                             java.lang.String... namespaces)
Method Detail

addSPRule

public void addSPRule(java.lang.String subject,
                      java.lang.String predicat)
Add a filter on an association subject/predicat

Specified by:
addSPRule in interface RDFRulesSelector
Parameters:
subject -
predicat -

addSORule

public void addSORule(java.lang.String subject,
                      java.lang.String object)
Add a filter on an association subject/object

Specified by:
addSORule in interface RDFRulesSelector
Parameters:
subject -
object -

addPORule

public void addPORule(java.lang.String predicat,
                      java.lang.String object)
Add a filter on an association predicat/object

Specified by:
addPORule in interface RDFRulesSelector
Parameters:
predicat -
object -

findIn

public java.util.List<WTriple> findIn(org.weblab_project.core.model.Resource resource)
TODO: A tester

Specified by:
findIn in interface RDFRulesSelector
Parameters:
resource -
Returns:

applySelection

protected java.util.List<WTriple> applySelection(java.lang.String data,
                                                 com.hp.hpl.jena.graph.Node s,
                                                 com.hp.hpl.jena.graph.Node p,
                                                 com.hp.hpl.jena.graph.Node o,
                                                 java.lang.String text,
                                                 org.weblab_project.core.model.Resource annotated,
                                                 java.util.List<org.weblab_project.core.model.Resource> resources,
                                                 org.weblab_project.core.model.PieceOfKnowledge annotation)
Faster

Overrides:
applySelection in class TripleSelectors

searchFor

public WTripleMap searchFor(org.weblab_project.core.model.Resource resource,
                            java.lang.String... predicates)
Uses rules

Specified by:
searchFor in interface RDFSelector
Parameters:
resource - an annotated Resource
predicates - the list of searched predicates
Returns:
an easy and fast access structure collection of triples

findInResource

public java.util.List<WTriple> findInResource(org.weblab_project.core.model.Resource resource,
                                              Filter filter)
Description copied from class: TripleSelectors
Select WTriple in the resource according to constrains in a filter.

Specified by:
findInResource in interface RDFSelector
Overrides:
findInResource in class TripleSelectors
Parameters:
resource - a WebLab Resource on which there are annotations containing RDF
filter - a set of constrains
Returns:
a list of triples

findInResource

public java.util.List<WTriple> findInResource(org.weblab_project.core.model.Resource resource,
                                              java.lang.String subject,
                                              java.lang.String predicate,
                                              java.lang.String object)
Description copied from class: TripleSelectors
Select Triplet (Subject, Predicate, Object) in the resource and its sub elements (Segments, Annotations, sub-MediaUnit ...). If subject, predicate or object is null, it acts as a wildcard parameter. Here is an example how to retrieve all Triplets which match the property "http://www.weblab-project.org/gld-country"

List<WTriple> results: findInResource(myResource, null, "http://www.weblab-project.org/gld-country", null);

Specified by:
findInResource in interface RDFSelector
Overrides:
findInResource in class TripleSelectors
subject - the subject that should match in the triplet (can be null)
predicate - the predicate that should match in the triplet (can be null)
object - the object that should match in the triplet (can be null)
Returns:
a list of WTriple that match the subject, predicate and object.

findInResource

public java.util.List<WTriple> findInResource(org.weblab_project.core.model.Resource resource,
                                              java.lang.String subject,
                                              java.lang.String predicate,
                                              java.lang.String object,
                                              boolean reif)
Description copied from class: TripleSelectors
Select WTriple in resource according to given subject, predicate and object. Null parameters act as wildcard. It will recursively loop through Resource structure (children and their annotations) to retrieve RDF in annotations.

Specified by:
findInResource in interface RDFSelector
Overrides:
findInResource in class TripleSelectors
Parameters:
resource - a WebLab Resource on which there are annotations containing RDF
subject - the subject that should match in the triplet (can be null)
predicate - the predicate that should match in the triplet (can be null)
object - the object that should match in the triplet (can be null)
reif - if true, reified triple will not be aggregated
Returns:
a list of WTriple that match the subject, predicate and object.

addRule

public void addRule(Rule rule)

matches

protected boolean matches(Rule rule,
                          com.hp.hpl.jena.graph.Triple t)


Copyright © 2004-2009. All Rights Reserved.