|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PoKHelper
API to manipulate a unique PieceOfKnowledge
object.
In this new version of helpers, a lots of method have been added. They shall be easier to understand and use. No more boolean in parameters, and only the
much simpler part of RDF will be used (i.e. no anonymous resources and no reified statements).
Some former methods gone Deprecated.
In this class a lot of abbreviation are used to reduce the length of the methods. Those convention are commons with PoKHelperExtended
,
ResourceHelper
and ResourceHelperExtended
.
If you are performing a lots of changes on the same PieceOfKnowledge
. Best practice is to first call setAutoCommitMode(boolean)
with
false
parameter, and then at the end of your process to call the commit()
method. It will enable to win a lot of time, preventing from
serialising and writing the RDF/XML into the data
field the PieceOfKnowledge
at each writing method call.
PoKHelperExtended
,
ResourceHelper
,
ResourceHelperExtended
Method Summary | |
---|---|
void |
commit()
A call to commit is needed when PoKHelper do not works in "autoCommitMode". |
void |
createLitStat(java.lang.String uriSubj,
java.lang.String uriPred,
java.lang.String litObj)
Creates a statement having uriSubj as subject, uriPred as predicate and litObj as literal value of the object. |
void |
createLitStat(java.lang.String uriSubj,
java.lang.String uriPred,
java.lang.String litObj,
java.lang.String language)
Creates a statement having uriSubj as subject, uriPred as predicate and litObj as literal value of the object. |
void |
createResStat(java.lang.String uriSubj,
java.lang.String uriPred,
java.lang.String uriObj)
Creates a statement having uriSubj as subject, uriPred as predicate and uriObj as URI of the object. |
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)
|
PieceOfKnowledge |
getPoK()
Retrieve the current PieceOfKnowledge which is manipulated. |
java.util.Set<java.lang.String> |
getPreds()
|
java.util.Set<java.lang.String> |
getPredsOnSubj(java.lang.String uriSubj)
|
java.lang.String |
getRdfXml()
|
java.util.List<java.lang.String> |
getRessOnPredSubj(java.lang.String uriSubj,
java.lang.String uriPred)
|
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)
|
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 . |
void |
loadFromRdfXml(java.lang.String rdfXml)
Loads an RDF/XML String , to be queried. |
void |
removeLitStat(java.lang.String uriSubj,
java.lang.String uriPred,
java.lang.String litObj)
Removes every statements having uriSubj as subject, uriPred as predicate and litObj as literal value of the
object. |
void |
removeResStat(java.lang.String uriSubj,
java.lang.String uriPred,
java.lang.String uriObj)
Removes every statements having uriSubj as subject, uriPred as predicate and uriObj as URI of the object. |
void |
removeStatsOnSubj(java.lang.String uriSubj)
Removes every statements having uriSubj as subject whatever are predicate and object. |
void |
removeStatsWithLit(java.lang.String litObj)
Removes every statements having litObj as object literal value whatever are subject and predicate. |
void |
removeStatsWithPred(java.lang.String uriPred)
Removes every statements having uriPred as predicate whatever are subject and object. |
void |
removeStatsWithRes(java.lang.String uriObj)
Removes every statements having uriObj as object named resource URI value whatever are subject and predicate. |
void |
setAutoCommitMode(boolean autoCommitMode)
In auto commit mode, remove and create operations are writing into the PieceOfKnowledge each time they are called. |
void |
setPoK(PieceOfKnowledge pok)
Fixes the current PieceOfKnowledge which is manipulated by the helper. |
Method Detail |
---|
void commit()
PoKHelper
do not works in "autoCommitMode". Other with this call is not needed.
setAutoCommitMode(boolean)
PieceOfKnowledge getPoK()
PieceOfKnowledge
which is manipulated. Please not that this will not commit any changes made into the RDF/XML if
PoKHelper
do not works in "autoCommitMode" and if you did not call commit()
method.
PieceOfKnowledge
.void setPoK(PieceOfKnowledge pok)
PieceOfKnowledge
which is manipulated by the helper. Note that using an PoKHelper
without
PieceOfKnowledge
will throw RuntimeException
.
pok
- An existing PieceOfKnowledge
void setAutoCommitMode(boolean autoCommitMode)
PieceOfKnowledge
each time they are called. When performing a lot's
of actions on the RDF, best practice is to set auto commit mode to false
and to commit at the end of the process.
autoCommitMode
- Whether or not to commit any changes (made by create and remove operations) on the PieceOfKnowledge
.java.lang.String getRdfXml()
String
of the current changed made.void loadFromRdfXml(java.lang.String rdfXml) throws WebLabCheckedException
String
, to be queried.
rdfXml
- A RDF/XML content to be loaded.
WebLabCheckedException
- If the rdfXml
is not an RDF/XML valid String
.java.util.List<java.lang.String> getLitsOnPredSubj(java.lang.String uriSubj, java.lang.String uriPred)
uriSubj
- The URI of the subject resource.uriPred
- The URI of the predicate resource.
List
containing values of every literal that are object of statements having uriPred
as predicate and
uriSubj
as subject in the PieceOfKnowledge
.java.util.List<java.lang.String> getLitsOnPredSubj(java.lang.String uriSubj, java.lang.String uriPred, java.lang.String language)
uriSubj
- The URI of the subject resource.uriPred
- The URI of the predicate resource.language
- The xml:lang attribute for this literal.
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.java.util.Set<java.lang.String> getPredsOnSubj(java.lang.String uriSubj)
uriSubj
- The URI of the subject resource.
Set
containing URIs of every named resources that are predicate of any statement having uriSubj
as subject in the
PieceOfKnowledge
.java.util.List<java.lang.String> getRessOnPredSubj(java.lang.String uriSubj, java.lang.String uriPred)
uriSubj
- The URI of the subject resource.uriPred
- The URI of the predicate resource.
List
containing URIs of every named resources that are object of statements having uriPred
as predicate and
uriSubj
as subject in the PieceOfKnowledge
.java.util.Set<java.lang.String> getSubjs()
Set
containing URIs of every named resources that are subject of any statement in the PieceOfKnowledge
.java.util.Set<java.lang.String> getSubjsOnPred(java.lang.String uriPred)
uriPred
- The URI of the predicate resource.
Set
containing URIs of every named resources that are subject of statements having uriPred
as predicate in the
PieceOfKnowledge
.java.util.Set<java.lang.String> getSubjsOnPredLit(java.lang.String uriPred, java.lang.String litObj)
uriPred
- The URI of the predicate resource.litObj
- The literal value of the object.
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
.java.util.Set<java.lang.String> getSubjsOnPredRes(java.lang.String uriPred, java.lang.String uriObj)
uriPred
- The URI of the predicate resource.uriObj
- The URI of the object resource.
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
.boolean hasLitStat(java.lang.String uriSubj, java.lang.String uriPred, java.lang.String litObj)
uriSubj
- The URI of the subject resource.uriPred
- The URI of the predicate resource.litObj
- The literal value of the object.
PieceOfKnowledge
contains at least one statement having uriSubj
as subject, uriPred
as
predicate and litObj
as literal value of the object.boolean hasResStat(java.lang.String uriSubj, java.lang.String uriPred, java.lang.String uriObj)
uriSubj
- The URI of the subject resource.uriPred
- The URI of the predicate resource.uriObj
- The URI of the object resource.
PieceOfKnowledge
contains at least one statement having uriSubj
as subject, uriPred
as
predicate and uriObj
as URI of the object.boolean isDefinedResource(java.lang.String uri)
PieceOfKnowledge
.
uri
- The URI to test existence in the PieceOfKnowledge
.
true
if the URI is defined as a named resource URI in the PieceOfKnowledge
.java.util.Set<java.lang.String> getPreds()
Set
containing URIs of properties that are predicate of any statement in the PieceOfKnowledge
.void createLitStat(java.lang.String uriSubj, java.lang.String uriPred, java.lang.String litObj, java.lang.String language)
uriSubj
as subject, uriPred
as predicate and litObj
as literal value of the object.
uriSubj
- The URI of the subject resource.uriPred
- The URI of the predicate resource.litObj
- The literal value of the object.language
- The language of the literal value. See http://www.w3.org/TR/REC-xml/#sec-lang-tag for more information.void createLitStat(java.lang.String uriSubj, java.lang.String uriPred, java.lang.String litObj)
uriSubj
as subject, uriPred
as predicate and litObj
as literal value of the object.
uriSubj
- The URI of the subject resource.uriPred
- The URI of the predicate resource.litObj
- The literal value of the object.void createResStat(java.lang.String uriSubj, java.lang.String uriPred, java.lang.String uriObj)
uriSubj
as subject, uriPred
as predicate and uriObj
as URI of the object.
uriSubj
- The URI of the subject resource.uriPred
- The URI of the predicate resource.uriObj
- The URI of the object resource.void removeLitStat(java.lang.String uriSubj, java.lang.String uriPred, java.lang.String litObj)
uriSubj
as subject, uriPred
as predicate and litObj
as literal value of the
object.
uriSubj
- The URI of the subject resource.uriPred
- The URI of the predicate resource.litObj
- The literal value of the object.void removeResStat(java.lang.String uriSubj, java.lang.String uriPred, java.lang.String uriObj)
uriSubj
as subject, uriPred
as predicate and uriObj
as URI of the object.
uriSubj
- The URI of the subject resource.uriPred
- The URI of the predicate resource.uriObj
- The URI of the object resource.void removeStatsOnSubj(java.lang.String uriSubj)
uriSubj
as subject whatever are predicate and object.
uriSubj
- The URI of the subject resource.void removeStatsWithLit(java.lang.String litObj)
litObj
as object literal value whatever are subject and predicate.
litObj
- The literal value of the object.void removeStatsWithPred(java.lang.String uriPred)
uriPred
as predicate whatever are subject and object.
uriPred
- The URI of the predicate resource.void removeStatsWithRes(java.lang.String uriObj)
uriObj
as object named resource URI value whatever are subject and predicate.
uriObj
- The URI of the object resource. The URI of the object resource.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |