Class StatementImpl
- java.lang.Object
-
- org.apache.jena.rdf.model.impl.StatementBase
-
- org.apache.jena.rdf.model.impl.StatementImpl
-
- All Implemented Interfaces:
FrontsTriple
,Statement
public class StatementImpl extends StatementBase implements Statement
An implementation of Statement.
-
-
Constructor Summary
Constructors Constructor Description StatementImpl(Resource subject, Property predicate, RDFNode object)
StatementImpl(Resource subject, Property predicate, RDFNode object, ModelCom model)
Creates new StatementImpl
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Resource
asResource()
Triple
asTriple()
static Triple[]
asTriples(Statement[] statements)
returns an array of triples corresponding to the array of statements; ie the i'th element of the result is the i'th element of the input as a triple.static RDFNode
createObject(Node n, EnhGraph g)
create an RDF node which might be a literal, or not.ReifiedStatement
createReifiedStatement()
create a ReifiedStatement corresponding to this StatementReifiedStatement
createReifiedStatement(java.lang.String uri)
create a ReifiedStatement corresponding to this Statement and with the given _uri_.boolean
equals(java.lang.Object o)
.equals() defers to .sameAs so we only get the complexity of one cast.Alt
getAlt()
Return the object of the statement.Bag
getBag()
Return the object of the statement.RDFList
getList()
Return the object of the statement as an RDF List.Literal
getLiteral()
get the object field of this statement, insisting that it be a Literal.RDFNode
getObject()
An accessor funtion to return the object of the statement.Property
getPredicate()
An accessor function to return the predicate of the statement.Statement
getProperty(Property p)
Get a property of the object of the statement.Resource
getResource()
Return the object of the statement.Resource
getResource(ResourceF f)
Deprecated.Seq
getSeq()
Return the object of the statement.Statement
getStatementProperty(Property p)
Return a property of this statement.Resource
getSubject()
An accessor method to return the subject of the statements.int
hashCode()
Returns asTriple().hashCode()boolean
isReified()
Determine if this statement is the subject of any statements its associated model.RSIterator
listReifiedStatements()
answer an iterator which delivers all the reified statements in the model this Statement belongs to that match this Statement.Statement
remove()
Remove this statement from its associated model.void
removeReification()
Finds all possible resources which are the reification of this statement, and for each removes all four triples of the reification quad.static Statement
toStatement(Triple t, ModelCom eg)
create a Statement from the triple _t_ in the enhanced graph _eg_.-
Methods inherited from class org.apache.jena.rdf.model.impl.StatementBase
changeLiteralObject, changeLiteralObject, changeLiteralObject, changeLiteralObject, changeLiteralObject, changeLiteralObject, changeObject, changeObject, changeObject, changeObject, changeObject, getBoolean, getByte, getChar, getDouble, getFloat, getInt, getLanguage, getLong, getModel, getShort, getString, getWellFormed, hasWellFormedXML, toString
-
Methods inherited from interface org.apache.jena.rdf.model.Statement
changeLiteralObject, changeLiteralObject, changeLiteralObject, changeLiteralObject, changeLiteralObject, changeLiteralObject, changeObject, changeObject, changeObject, changeObject, changeObject, getBoolean, getByte, getChar, getDouble, getFloat, getInt, getLanguage, getLong, getModel, getShort, getString, hasWellFormedXML
-
-
-
-
Method Detail
-
toStatement
public static Statement toStatement(Triple t, ModelCom eg)
create a Statement from the triple _t_ in the enhanced graph _eg_. The Statement has subject, predicate, and object corresponding to those of _t_.
-
getSubject
public Resource getSubject()
Description copied from interface:Statement
An accessor method to return the subject of the statements.- Specified by:
getSubject
in interfaceStatement
- Specified by:
getSubject
in classStatementBase
- Returns:
- The subject of the statement.
-
getPredicate
public Property getPredicate()
Description copied from interface:Statement
An accessor function to return the predicate of the statement.- Specified by:
getPredicate
in interfaceStatement
- Specified by:
getPredicate
in classStatementBase
- Returns:
- The predicate of the statement.
-
getObject
public RDFNode getObject()
Description copied from interface:Statement
An accessor funtion to return the object of the statement.- Specified by:
getObject
in interfaceStatement
- Specified by:
getObject
in classStatementBase
- Returns:
- Return the object of the statement.
-
getStatementProperty
public Statement getStatementProperty(Property p)
Description copied from interface:Statement
Return a property of this statement.The model associated with this statement is searched for a statement with this statement as subject and the specified property as predicate. If such a statement is found it is return. If more than one exists in the model, then it is undefined which is returned. If no such statement exists, an exception is thrown.
- Specified by:
getStatementProperty
in interfaceStatement
- Parameters:
p
- the property sought- Returns:
- a statement representing an instance of the specified property.
-
getResource
public Resource getResource()
Description copied from interface:Statement
Return the object of the statement.An exception will be thrown if the object is not a resource.
- Specified by:
getResource
in interfaceStatement
- Specified by:
getResource
in classStatementBase
- Returns:
- The Resource which is the object of the statement.
-
getResource
@Deprecated public Resource getResource(ResourceF f)
Deprecated.Description copied from interface:Statement
Return the object of the statement.An exception will be thrown if the object is not a Resource.
- Specified by:
getResource
in interfaceStatement
- Returns:
- The object of the statement.
-
getProperty
public Statement getProperty(Property p)
Description copied from interface:Statement
Get a property of the object of the statement.There is an unfortunate ambiguity here. GetProperty would normally treat the statement as a resource, and return a property about this statement. This is not what is wanted in most cases, so getProperty on a statement is defined to call getProperty on its object. If a property of the statement itself is required, getStatementProperty should be used.
If the object of the statement is not a resource, an exception is thrown.
- Specified by:
getProperty
in interfaceStatement
- Parameters:
p
- the property sought- Returns:
- a statement representing an instance of the required property
-
getLiteral
public Literal getLiteral()
get the object field of this statement, insisting that it be a Literal. If it isn't, throw LiteralRequiredException.- Specified by:
getLiteral
in interfaceStatement
- Specified by:
getLiteral
in classStatementBase
- Returns:
- The Literal which is the object of the statement.
-
getBag
public Bag getBag()
Description copied from interface:Statement
Return the object of the statement.An exception will be thrown if the object is not a Resource.
-
getAlt
public Alt getAlt()
Description copied from interface:Statement
Return the object of the statement.An exception will be thrown if the object is not a Resource.
-
getSeq
public Seq getSeq()
Description copied from interface:Statement
Return the object of the statement.An exception will be thrown if the object is not a Resource.
-
getList
public RDFList getList()
Description copied from interface:Statement
Return the object of the statement as an RDF List.An exception will be thrown if the object is not an
RDFList
.
-
equals
public boolean equals(java.lang.Object o)
.equals() defers to .sameAs so we only get the complexity of one cast.
-
hashCode
public int hashCode()
Description copied from interface:Statement
Returns asTriple().hashCode()
-
asResource
public Resource asResource()
-
remove
public Statement remove()
Description copied from interface:Statement
Remove this statement from its associated model.The statement with the same subject, predicate and object as this statement will be removed from the model associated with this statement.
-
removeReification
public void removeReification()
Description copied from interface:Statement
Finds all possible resources which are the reification of this statement, and for each removes all four triples of the reification quad.- Specified by:
removeReification
in interfaceStatement
-
asTriple
public Triple asTriple()
- Specified by:
asTriple
in interfaceFrontsTriple
-
asTriples
public static Triple[] asTriples(Statement[] statements)
returns an array of triples corresponding to the array of statements; ie the i'th element of the result is the i'th element of the input as a triple.- Parameters:
statements
- the array of statements to convert- Returns:
- the corresponding array of triples
-
isReified
public boolean isReified()
Description copied from interface:Statement
Determine if this statement is the subject of any statements its associated model.
-
createReifiedStatement
public ReifiedStatement createReifiedStatement()
create a ReifiedStatement corresponding to this Statement- Specified by:
createReifiedStatement
in interfaceStatement
-
createReifiedStatement
public ReifiedStatement createReifiedStatement(java.lang.String uri)
create a ReifiedStatement corresponding to this Statement and with the given _uri_.- Specified by:
createReifiedStatement
in interfaceStatement
-
listReifiedStatements
public RSIterator listReifiedStatements()
Description copied from interface:Statement
answer an iterator which delivers all the reified statements in the model this Statement belongs to that match this Statement.- Specified by:
listReifiedStatements
in interfaceStatement
-
-