org.weblab_project.core.helper
Interface ResourceHelper

All Known Subinterfaces:
ResourceHelperExtended

public interface ResourceHelper

API to manipulate Annotation objects that are present on a Resource and its potential sub-resources.

Note that if the given Resource is it self an PieceOfKnowledge, it will not load its content but the content of every Annotation on this PieceOfKnowledge (and recursively then for each Annotation loaded).

This class replaces RecursiveAnnotationHelper.

Author:
EADS WebLab Team
See Also:
PoKHelper, ResourceHelperExtended
Date:
2008-09-18

Method Summary
 java.util.List<java.lang.String> getLitsOnPredSubj(java.lang.String uriSubj, java.lang.String uriPred)
           
 java.util.List<java.lang.String> getLitsOnPredSubj(java.lang.String uriSubj, java.lang.String uriPred, java.lang.String language)
           
 java.util.Set<java.lang.String> getPreds()
           
 java.util.Set<java.lang.String> getPredsOnSubj(java.lang.String uriSubj)
           
 java.lang.String getRdfXml()
           
 Resource getResource()
           
 Resource getResource(java.lang.String uri)
           
 java.util.List<java.lang.String> getRessOnPredSubj(java.lang.String uriSubj, java.lang.String uriPred)
           
<T extends Resource>
T
getSpecificResource(java.lang.String uri, java.lang.Class<T> resourceType)
           
 java.util.Set<java.lang.String> getSubjs()
           
 java.util.Set<java.lang.String> getSubjsOnPred(java.lang.String uriPred)
           
 java.util.Set<java.lang.String> getSubjsOnPredLit(java.lang.String uriPred, java.lang.String litObj)
           
 java.util.Set<java.lang.String> getSubjsOnPredRes(java.lang.String uriPred, java.lang.String uriObj)
           
 java.lang.Class<? extends Resource> getType(java.lang.String uri)
           
 boolean hasLitStat(java.lang.String uriSubj, java.lang.String uriPred, java.lang.String litObj)
           
 boolean hasResStat(java.lang.String uriSubj, java.lang.String uriPred, java.lang.String uriObj)
           
 boolean isDefinedResource(java.lang.String uri)
          Tests if the given URI is defined as a named resource in the PieceOfKnowledge.
 boolean isFullyDefinedResource(java.lang.String uri)
           
 void loadFromRdfXml(java.lang.String rdfXml)
          Loads an RDF/XML String, to be queried.
 void setResource(Resource resource)
          Fixes the current Resource that is manipulated by the helper.
 

Method Detail

setResource

void setResource(Resource resource)
Fixes the current Resource that is manipulated by the helper.
It also process resource to load every Annotation that are present in its Resource tree.

Parameters:
resource - The Resource to be considered by this helper.

getResource

Resource getResource()
Returns:
The upper level Resource currently handled by the helper.

getResource

Resource getResource(java.lang.String uri)
                     throws WebLabCheckedException
Parameters:
uri - The URI of a Resource that must be defined in RDF statements and in the Resource tree.
Returns:
A Resource, which is a sub-resource of the Resource behind this helper, and that its URI is uri.
Throws:
WebLabCheckedException - If uri is not a valid Resource and a defined URI in RDF.

isFullyDefinedResource

boolean isFullyDefinedResource(java.lang.String uri)
Parameters:
uri - An URI to test existence in RDF and in loaded sub-resources.
Returns:
Whether or not uri represents a WebLab Resource present in Resource tree and an RDF resource.

getSpecificResource

<T extends Resource> T getSpecificResource(java.lang.String uri,
                                           java.lang.Class<T> resourceType)
                                       throws WebLabCheckedException
Type Parameters:
T - The real class of the Resource to load.
Parameters:
uri - The URI of a Resource that must be defined in RDF statements and in the Resource tree.
resourceType - The class of the Resource represented by uri.
Returns:
A Resource, which is a sub-resource of the Resource behind this helper, and that its URI is uri.
Throws:
WebLabCheckedException - If uri is not a valid Resource and a defined URI in RDF.

getType

java.lang.Class<? extends Resource> getType(java.lang.String uri)
                                            throws WebLabCheckedException
Parameters:
uri - The URI of a Resource that must be defined in RDF statements and in the Resource tree.
Returns:
The class of the Resource represented by uri.
Throws:
WebLabCheckedException - If uri is not a valid Resource and a defined URI in RDF.

getRdfXml

java.lang.String getRdfXml()
Returns:
A valid RDF/XML String of the current changed made.

loadFromRdfXml

void loadFromRdfXml(java.lang.String rdfXml)
                    throws WebLabCheckedException
Loads an RDF/XML String, to be queried.

Parameters:
rdfXml - A RDF/XML content to be loaded.
Throws:
WebLabCheckedException - If the rdfXml is not an RDF/XML valid String.

getLitsOnPredSubj

java.util.List<java.lang.String> getLitsOnPredSubj(java.lang.String uriSubj,
                                                   java.lang.String uriPred)
Parameters:
uriSubj - The URI of the subject resource.
uriPred - The URI of the predicate resource.
Returns:
A List containing values of every literal that are object of statements having uriPred as predicate and uriSubj as subject in the PieceOfKnowledge.

getLitsOnPredSubj

java.util.List<java.lang.String> getLitsOnPredSubj(java.lang.String uriSubj,
                                                   java.lang.String uriPred,
                                                   java.lang.String language)
Parameters:
uriSubj - The URI of the subject resource.
uriPred - The URI of the predicate resource.
language - The xml:lang attribute for this literal.
Returns:
A List containing values in language language of every literal that are object of statements having uriPred as predicate and uriSubj as subject in the PieceOfKnowledge. For more information about language attribute, see http://www.w3.org/TR/REC-xml/#sec-lang-tag.

getPredsOnSubj

java.util.Set<java.lang.String> getPredsOnSubj(java.lang.String uriSubj)
Parameters:
uriSubj - The URI of the subject resource.
Returns:
A Set containing URIs of every named resources that are predicate of any statement having uriSubj as subject in the PieceOfKnowledge.

getRessOnPredSubj

java.util.List<java.lang.String> getRessOnPredSubj(java.lang.String uriSubj,
                                                   java.lang.String uriPred)
Parameters:
uriSubj - The URI of the subject resource.
uriPred - The URI of the predicate resource.
Returns:
A List containing URIs of every named resources that are object of statements having uriPred as predicate and uriSubj as subject in the PieceOfKnowledge.

getSubjs

java.util.Set<java.lang.String> getSubjs()
Returns:
A Set containing URIs of every named resources that are subject of any statement in the PieceOfKnowledge.

getSubjsOnPred

java.util.Set<java.lang.String> getSubjsOnPred(java.lang.String uriPred)
Parameters:
uriPred - The URI of the predicate resource.
Returns:
A Set containing URIs of every named resources that are subject of statements having uriPred as predicate in the PieceOfKnowledge.

getSubjsOnPredLit

java.util.Set<java.lang.String> getSubjsOnPredLit(java.lang.String uriPred,
                                                  java.lang.String litObj)
Parameters:
uriPred - The URI of the predicate resource.
litObj - The literal value of the object.
Returns:
A Set containing URIs of every named resources that are subject of statements having uriPred as predicate and litObj as object literal value in the PieceOfKnowledge.

getSubjsOnPredRes

java.util.Set<java.lang.String> getSubjsOnPredRes(java.lang.String uriPred,
                                                  java.lang.String uriObj)
Parameters:
uriPred - The URI of the predicate resource.
uriObj - The URI of the object resource.
Returns:
A Set containing URIs of every named resources that are subject of statements having uriPred as predicate and uriObj as object named resource URI in the PieceOfKnowledge.

hasLitStat

boolean hasLitStat(java.lang.String uriSubj,
                   java.lang.String uriPred,
                   java.lang.String litObj)
Parameters:
uriSubj - The URI of the subject resource.
uriPred - The URI of the predicate resource.
litObj - The literal value of the object.
Returns:
Whether or not the PieceOfKnowledge contains at least one statement having uriSubj as subject, uriPred as predicate and litObj as literal value of the object.

hasResStat

boolean hasResStat(java.lang.String uriSubj,
                   java.lang.String uriPred,
                   java.lang.String uriObj)
Parameters:
uriSubj - The URI of the subject resource.
uriPred - The URI of the predicate resource.
uriObj - The URI of the object resource.
Returns:
Whether or not the PieceOfKnowledge contains at least one statement having uriSubj as subject, uriPred as predicate and uriObj as URI of the object.

isDefinedResource

boolean isDefinedResource(java.lang.String uri)
Tests if the given URI is defined as a named resource in the PieceOfKnowledge.

Parameters:
uri - The URI to test existence in the PieceOfKnowledge.
Returns:
true if the URI is defined as a named resource URI in the PieceOfKnowledge.

getPreds

java.util.Set<java.lang.String> getPreds()
Returns:
A Set containing URIs of properties that are predicate of any statement in the PieceOfKnowledge.


Copyright © 2004-2010. All Rights Reserved.