Package laas.openrobots.ontology
Class PartialStatement
- java.lang.Object
-
- laas.openrobots.ontology.PartialStatement
-
- All Implemented Interfaces:
com.hp.hpl.jena.graph.FrontsTriple
,com.hp.hpl.jena.rdf.model.Statement
public class PartialStatement extends java.lang.Object implements com.hp.hpl.jena.rdf.model.Statement
A partial statement is a statement whose at least one element (subject, predicate or object) is unknown. To be valid, a partial statement must have at least one variable, prepended with a "?". For instance:"?mysterious oro:objProperty oro:individual"
-
-
Constructor Summary
Constructors Constructor Description PartialStatement(com.hp.hpl.jena.rdf.model.Resource subject, com.hp.hpl.jena.rdf.model.Property predicate, com.hp.hpl.jena.rdf.model.RDFNode object, com.hp.hpl.jena.rdf.model.impl.ModelCom model)
Creates a partial statement from a partial triplet (subject, predicate, object).PartialStatement(java.lang.String partialStatement, com.hp.hpl.jena.rdf.model.impl.ModelCom model)
Create a new partial statement from its string representation.
Works asOpenRobotsOntology.createStatement(String)
except at least one variable, prepended with a "?", is expected. This class implementsStatement
, but thegetSubject()
,getPredicate()
andgetObject()
method will returnnull
if the corresponding part of the statement is unbounded.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
asSparqlRow()
Formats a partial statement for inclusion in a SPARQL query. Unbounded resources of the statement are rendered with "?" as prefixes, other parts are rendered as resources with their full URIs.com.hp.hpl.jena.graph.Triple
asTriple()
com.hp.hpl.jena.rdf.model.Statement
changeLiteralObject(boolean o)
com.hp.hpl.jena.rdf.model.Statement
changeLiteralObject(char o)
com.hp.hpl.jena.rdf.model.Statement
changeLiteralObject(double o)
com.hp.hpl.jena.rdf.model.Statement
changeLiteralObject(float o)
com.hp.hpl.jena.rdf.model.Statement
changeLiteralObject(int o)
com.hp.hpl.jena.rdf.model.Statement
changeLiteralObject(long o)
com.hp.hpl.jena.rdf.model.Statement
changeObject(com.hp.hpl.jena.rdf.model.RDFNode o)
com.hp.hpl.jena.rdf.model.Statement
changeObject(java.lang.String o)
com.hp.hpl.jena.rdf.model.Statement
changeObject(java.lang.String o, boolean wellFormed)
com.hp.hpl.jena.rdf.model.Statement
changeObject(java.lang.String o, java.lang.String l)
com.hp.hpl.jena.rdf.model.Statement
changeObject(java.lang.String o, java.lang.String l, boolean wellFormed)
com.hp.hpl.jena.rdf.model.ReifiedStatement
createReifiedStatement()
com.hp.hpl.jena.rdf.model.ReifiedStatement
createReifiedStatement(java.lang.String uri)
com.hp.hpl.jena.rdf.model.Alt
getAlt()
com.hp.hpl.jena.rdf.model.Bag
getBag()
boolean
getBoolean()
byte
getByte()
char
getChar()
double
getDouble()
float
getFloat()
int
getInt()
java.lang.String
getLanguage()
com.hp.hpl.jena.rdf.model.Literal
getLiteral()
long
getLong()
com.hp.hpl.jena.rdf.model.Model
getModel()
com.hp.hpl.jena.rdf.model.RDFNode
getObject()
com.hp.hpl.jena.rdf.model.Property
getPredicate()
com.hp.hpl.jena.rdf.model.Statement
getProperty(com.hp.hpl.jena.rdf.model.Property p)
com.hp.hpl.jena.rdf.model.Resource
getResource()
com.hp.hpl.jena.rdf.model.Resource
getResource(com.hp.hpl.jena.rdf.model.ResourceF f)
com.hp.hpl.jena.rdf.model.Seq
getSeq()
short
getShort()
com.hp.hpl.jena.rdf.model.Statement
getStatementProperty(com.hp.hpl.jena.rdf.model.Property p)
java.lang.String
getString()
com.hp.hpl.jena.rdf.model.Resource
getSubject()
boolean
hasWellFormedXML()
static boolean
isPartialStatement(java.lang.String lex)
Performs basic tests to determine if a statement is a partial statement, ie if the given string contains three tokens and at least one token starting with ?.boolean
isReified()
com.hp.hpl.jena.rdf.model.RSIterator
listReifiedStatements()
com.hp.hpl.jena.rdf.model.Statement
remove()
void
removeReification()
java.lang.String
toString()
-
-
-
Constructor Detail
-
PartialStatement
public PartialStatement(com.hp.hpl.jena.rdf.model.Resource subject, com.hp.hpl.jena.rdf.model.Property predicate, com.hp.hpl.jena.rdf.model.RDFNode object, com.hp.hpl.jena.rdf.model.impl.ModelCom model)
Creates a partial statement from a partial triplet (subject, predicate, object). At least one of the parameter is assumed to be null.- Parameters:
subject
- The subject of the statementpredicate
- The predicate of the statementobject
- The object of the statementmodel
- The ontology this partial statement refers to.
-
PartialStatement
public PartialStatement(java.lang.String partialStatement, com.hp.hpl.jena.rdf.model.impl.ModelCom model) throws IllegalStatementException
Create a new partial statement from its string representation.
Works asOpenRobotsOntology.createStatement(String)
except at least one variable, prepended with a "?", is expected. This class implementsStatement
, but thegetSubject()
,getPredicate()
andgetObject()
method will returnnull
if the corresponding part of the statement is unbounded.- Parameters:
partialStatement
- The string representing the partial statement. For example,"?mysterious oro:objProperty2 ?object"
or"?subject oro:dataProperty1 true"
are valid.model
- The ontology this partial statement refers to.- Throws:
IllegalStatementException
- Currently thrown only if the statement doesn't contain three tokens.- See Also:
Syntax details
-
-
Method Detail
-
asSparqlRow
public java.lang.String asSparqlRow()
Formats a partial statement for inclusion in a SPARQL query. Unbounded resources of the statement are rendered with "?" as prefixes, other parts are rendered as resources with their full URIs.- Returns:
- the formatted partial statement.
-
isPartialStatement
public static boolean isPartialStatement(java.lang.String lex)
Performs basic tests to determine if a statement is a partial statement, ie if the given string contains three tokens and at least one token starting with ?.- Parameters:
lex
- a string to test- Returns:
- whether the statement is a partial statement or not.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getSubject
public com.hp.hpl.jena.rdf.model.Resource getSubject()
- Specified by:
getSubject
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
getPredicate
public com.hp.hpl.jena.rdf.model.Property getPredicate()
- Specified by:
getPredicate
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
getObject
public com.hp.hpl.jena.rdf.model.RDFNode getObject()
- Specified by:
getObject
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
changeLiteralObject
public com.hp.hpl.jena.rdf.model.Statement changeLiteralObject(boolean o)
- Specified by:
changeLiteralObject
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
changeLiteralObject
public com.hp.hpl.jena.rdf.model.Statement changeLiteralObject(long o)
- Specified by:
changeLiteralObject
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
changeLiteralObject
public com.hp.hpl.jena.rdf.model.Statement changeLiteralObject(int o)
- Specified by:
changeLiteralObject
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
changeLiteralObject
public com.hp.hpl.jena.rdf.model.Statement changeLiteralObject(char o)
- Specified by:
changeLiteralObject
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
changeLiteralObject
public com.hp.hpl.jena.rdf.model.Statement changeLiteralObject(float o)
- Specified by:
changeLiteralObject
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
changeLiteralObject
public com.hp.hpl.jena.rdf.model.Statement changeLiteralObject(double o)
- Specified by:
changeLiteralObject
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
changeObject
public com.hp.hpl.jena.rdf.model.Statement changeObject(java.lang.String o)
- Specified by:
changeObject
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
changeObject
public com.hp.hpl.jena.rdf.model.Statement changeObject(com.hp.hpl.jena.rdf.model.RDFNode o)
- Specified by:
changeObject
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
changeObject
public com.hp.hpl.jena.rdf.model.Statement changeObject(java.lang.String o, boolean wellFormed)
- Specified by:
changeObject
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
changeObject
public com.hp.hpl.jena.rdf.model.Statement changeObject(java.lang.String o, java.lang.String l)
- Specified by:
changeObject
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
changeObject
public com.hp.hpl.jena.rdf.model.Statement changeObject(java.lang.String o, java.lang.String l, boolean wellFormed)
- Specified by:
changeObject
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
createReifiedStatement
public com.hp.hpl.jena.rdf.model.ReifiedStatement createReifiedStatement()
- Specified by:
createReifiedStatement
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
createReifiedStatement
public com.hp.hpl.jena.rdf.model.ReifiedStatement createReifiedStatement(java.lang.String uri)
- Specified by:
createReifiedStatement
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
getAlt
public com.hp.hpl.jena.rdf.model.Alt getAlt()
- Specified by:
getAlt
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
getBag
public com.hp.hpl.jena.rdf.model.Bag getBag()
- Specified by:
getBag
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
getBoolean
public boolean getBoolean()
- Specified by:
getBoolean
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
getByte
public byte getByte()
- Specified by:
getByte
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
getChar
public char getChar()
- Specified by:
getChar
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
getDouble
public double getDouble()
- Specified by:
getDouble
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
getFloat
public float getFloat()
- Specified by:
getFloat
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
getInt
public int getInt()
- Specified by:
getInt
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
getLanguage
public java.lang.String getLanguage()
- Specified by:
getLanguage
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
getLiteral
public com.hp.hpl.jena.rdf.model.Literal getLiteral()
- Specified by:
getLiteral
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
getLong
public long getLong()
- Specified by:
getLong
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
getModel
public com.hp.hpl.jena.rdf.model.Model getModel()
- Specified by:
getModel
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
getProperty
public com.hp.hpl.jena.rdf.model.Statement getProperty(com.hp.hpl.jena.rdf.model.Property p)
- Specified by:
getProperty
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
getResource
public com.hp.hpl.jena.rdf.model.Resource getResource()
- Specified by:
getResource
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
getSeq
public com.hp.hpl.jena.rdf.model.Seq getSeq()
- Specified by:
getSeq
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
getShort
public short getShort()
- Specified by:
getShort
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
getStatementProperty
public com.hp.hpl.jena.rdf.model.Statement getStatementProperty(com.hp.hpl.jena.rdf.model.Property p)
- Specified by:
getStatementProperty
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
getString
public java.lang.String getString()
- Specified by:
getString
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
hasWellFormedXML
public boolean hasWellFormedXML()
- Specified by:
hasWellFormedXML
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
isReified
public boolean isReified()
- Specified by:
isReified
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
listReifiedStatements
public com.hp.hpl.jena.rdf.model.RSIterator listReifiedStatements()
- Specified by:
listReifiedStatements
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
remove
public com.hp.hpl.jena.rdf.model.Statement remove()
- Specified by:
remove
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
removeReification
public void removeReification()
- Specified by:
removeReification
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
asTriple
public com.hp.hpl.jena.graph.Triple asTriple()
- Specified by:
asTriple
in interfacecom.hp.hpl.jena.graph.FrontsTriple
-
getResource
public com.hp.hpl.jena.rdf.model.Resource getResource(com.hp.hpl.jena.rdf.model.ResourceF f)
- Specified by:
getResource
in interfacecom.hp.hpl.jena.rdf.model.Statement
-
-