org.weblab_project.core.helper.impl
Interface RDFSelector

All Known Implementing Classes:
ComplexTripleSelector

public interface RDFSelector

Selection functions for triples retrieval and WebLab model association.


Method Summary
 java.util.List<WTriple> findInResource(org.weblab_project.core.model.Resource resource, Filter filter)
          Find Triplets Subject, Predicate, Object) in the resource according to 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)
          Find 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)
          Use this function to avoid to aggregate reified annotations If the resource is null, then a NullPointerException is thrown.
 void limitToFirstLevelAnnotation(boolean limit)
          If limit is true, then all the searches made with this RDFSelector will stop after the first level of annotation.
 WTripleMap searchFor(org.weblab_project.core.model.Resource resource, java.lang.String... predicates)
          Build a collection of objects with given properties.
 

Method Detail

findInResource

java.util.List<WTriple> findInResource(org.weblab_project.core.model.Resource resource,
                                       Filter filter)
Find Triplets Subject, Predicate, Object) in the resource according to a filter. If the filter is null then results of findInResource(Resource r, null, null, null) is returned. If the resource is null, then a NullPointerException is thrown.

Parameters:
resource - a resource
gc - a filter (can be null)
Returns:
a list of triples

findInResource

java.util.List<WTriple> findInResource(org.weblab_project.core.model.Resource resource,
                                       java.lang.String subject,
                                       java.lang.String predicate,
                                       java.lang.String object)
Find 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); If the resource is null, then a NullPointerException is thrown.

Parameters:
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

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)
Use this function to avoid to aggregate reified annotations If the resource is null, then a NullPointerException is thrown.

Parameters:
resource - a resource
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.

searchFor

WTripleMap searchFor(org.weblab_project.core.model.Resource resource,
                     java.lang.String... predicates)
Build a collection of objects with given properties.
Let's say you search for : searchFor(myResource, EVENT, NAME, DATE, LOCATION) where name is a type of resource and NAME, DATE and LOCATION are predicates.
Then it will return a map :
{
subject0uri => { NAME => nameObject0, DATE => dateObject0, LOCATION => locationObject0 },
subject1uri => { NAME => nameObject1, DATE => dateObject1, LOCATION => locationObject1 },
subject2uri => { NAME => nameObject2, DATE => dateObject2, LOCATION => locationObject2 }
}
It can access any EVENT in O(1) and any predicate value in O(1).
If the resource is null, then a NullPointerException is thrown. If predicates are null, then all predicates will match the search.

Parameters:
resource - an annotated Resource
predicates - the list of searched predicates
Returns:
an easy and fast access structure collection of triples

limitToFirstLevelAnnotation

void limitToFirstLevelAnnotation(boolean limit)
If limit is true, then all the searches made with this RDFSelector will stop after the first level of annotation.
Else the search will recursively browse all the searched Resource structure. By default limit is false.

Parameters:
limit - if true, it will only search annotation on resource else it will search until the leaf annotations


Copyright © 2004-2009. All Rights Reserved.