com.hp.hpl.jena.rdf.model
Interface Statement

All Known Subinterfaces:
Axiom, ClassAxiom, DifferentFromFact, DisjointClassesAxiom, DistinctMembersFact, EquivalentClassAxiom, EquivalentPropertyAxiom, Fact, PropertyAxiom, SameAsFact, SubClassAxiom, SubPropertyAxiom

public interface Statement

An RDF Statement.

A Statement is not a Resource, but can produce a ReifiedStatement that represents it and from which the Statement can be recovered.

A statement instance tracks which model it is associated with.

This interface provides methods supporting typed literals. This means that methods are provided which will translate a built in type, or an object to an RDF Literal. This translation is done by invoking the toString() method of the object, or its built in equivalent. The reverse translation is also supported. This is built in for built in types. Factory objects, provided by the application, are used for application objects.

Version:
$Name: $ $Revision: 1.8 $ $Date: 2003/07/15 14:44:17 $
Author:
bwm; additions by kers

Method Summary
 Resource asResource()
          Returns a resource representing the reification of this statement.
 Triple asTriple()
          answer the Triple containing the appropriate Nodes corrsponding to the subject, predicate, and object fields.
 Statement changeObject(boolean o)
          change the object of the statement (S, P, X) to (S, P, o).
 Statement changeObject(char o)
          change the object of the statement (S, P, X) to (S, P, o).
 Statement changeObject(double o)
          change the object of the statement (S, P, X) to (S, P, o).
 Statement changeObject(float o)
          change the object of the statement (S, P, X) to (S, P, o).
 Statement changeObject(long o)
          change the object of the statement (S, P, X) to (S, P, o).
 Statement changeObject(java.lang.Object o)
          change the object of the statement (S, P, X) to o.
 Statement changeObject(RDFNode o)
          change the object of the statement (S, P, X) to (S, P, o).
 Statement changeObject(java.lang.String o)
          change the object of the statement (S, P, X) to (S, P, o).
 Statement changeObject(java.lang.String o, boolean wellFormed)
          change the object of the statement (S, P, X) to (S, P, o).
 Statement changeObject(java.lang.String o, java.lang.String l)
          change the object of the statement (S, P, X) to (S, P, o).
 Statement changeObject(java.lang.String o, java.lang.String l, boolean wellFormed)
          change the object of the statement (S, P, X) to (S, P, o).
 ReifiedStatement createReifiedStatement()
          answer a ReifiedStatement object that embodies this Statement and is in the same Model (if any).
 ReifiedStatement createReifiedStatement(java.lang.String uri)
          answer a ReifiedStatement object that embodies this Statement, has the same Model, and has the given uri.
 boolean equals(java.lang.Object o)
          determine whether two statements are equal.
 Alt getAlt()
          Return the object of the statement.
 Bag getBag()
          Return the object of the statement.
 boolean getBoolean()
          Return the object of the statement.
 byte getByte()
          Return the object of the statement.
 char getChar()
          Return the object of the statement.
 double getDouble()
          Return the object of the statement.
 float getFloat()
          Return the object of the statement.
 int getInt()
          Return the object of the statement.
 java.lang.String getLanguage()
          Return the language of the object of the statement.
 Literal getLiteral()
          Return the object of the statement.
 long getLong()
          Return the object of the statement.
 Model getModel()
          get the Model this Statement was created in.
 RDFNode getObject()
          An accessor funtion to return the object of the statement.
 java.lang.Object getObject(ObjectF f)
          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)
          Return the object of the statement.
 Seq getSeq()
          Return the object of the statement.
 short getShort()
          Return the object of the statement.
 Statement getStatementProperty(Property p)
          Return a property of this statement.
 java.lang.String getString()
          Return the object of the statement.
 Resource getSubject()
          An accessor method to return the subject of the statements.
 boolean getWellFormed()
          Return whether the Literal object is well formed XML as would result from parsing a property element with parseType="Literal".
 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.
 

Method Detail

equals

public boolean equals(java.lang.Object o)
determine whether two statements are equal.

Two statements are considered to be equal if they have the the same subject, predicate and object. A statement can only be equal to another statement object.

Parameters:
o - the object to be compared
Returns:
true if and only if the equality condition is met.

hashCode

public int hashCode()
Returns asTriple().hashCode()


getSubject

public Resource getSubject()
An accessor method to return the subject of the statements.

Returns:
The subject of the statement.

getPredicate

public Property getPredicate()
An accessor function to return the predicate of the statement.

Returns:
The predicate of the statement.

getObject

public RDFNode getObject()
An accessor funtion to return the object of the statement.

Returns:
Return the object of the statement.

getProperty

public Statement getProperty(Property p)
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.

Parameters:
p - the property sought
Returns:
a statement representing an instance of the required property

getStatementProperty

public Statement getStatementProperty(Property p)
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.

Parameters:
p - the property sought
Returns:
a statement representing an instance of the specified property.

getResource

public Resource getResource()
Return the object of the statement.

An exception will be thrown if the object is not a resource.

Returns:
The Resource which is the object of the statement.

getLiteral

public Literal getLiteral()
Return the object of the statement.

An exception will be thrown if the object is not a Literal.

Returns:
The Literal which is the object of the statement.

getBoolean

public boolean getBoolean()
Return the object of the statement.

An exception will be thrown if the object is not a Literal.

Returns:
The object of the statement interpreted as a value of the the specified type.

getByte

public byte getByte()
Return the object of the statement.

An exception will be thrown if the object is not a Literal.

Returns:
The object of the statement interpreted as a value of the the specified type.

getShort

public short getShort()
Return the object of the statement.

An exception will be thrown if the object is not a Literal.

Returns:
The object of the statement interpreted as a value of the the specified type.

getInt

public int getInt()
Return the object of the statement.

An exception will be thrown if the object is not a Literal.

Returns:
The object of the statement interpreted as a value of the the specified type.

getLong

public long getLong()
Return the object of the statement.

An exception will be thrown iof the object is not a Literal.

Returns:
The object of the statement interpreted as a value of the the specified type.

getChar

public char getChar()
Return the object of the statement.

An exception will be thrown if the object is not a Literal.

Returns:
The object of the statement interpreted as a value of the the specified type.

getFloat

public float getFloat()
Return the object of the statement.

An exception will be thrown if the object is not a Literal.

Returns:
The object of the statement interpreted as a value of the the specified type.

getDouble

public double getDouble()
Return the object of the statement.

An exception will be thrown if the object is not a Literal.

Returns:
The object of the statement interpreted as a value of the the specified type.

getString

public java.lang.String getString()
Return the object of the statement.

An exception will be thrown if the object is not a Literal.

Returns:
The object of the statement interpreted as a value of the the specified type.

getResource

public Resource getResource(ResourceF f)
Return the object of the statement.

An exception will be thrown if the object is not a Resource.

Returns:
The object of the statement.

getObject

public java.lang.Object getObject(ObjectF f)
Return the object of the statement.

An exception will be thrown if the object is not a Literal.

Parameters:
f - A factory used to create the returned object.
Returns:
The object of the statement.

getBag

public Bag getBag()
Return the object of the statement.

An exception will be thrown if the object is not a Resource.

Returns:
The object of the statement interpreted as a value of the the specified type.

getAlt

public Alt getAlt()
Return the object of the statement.

An exception will be thrown if the object is not a Resource.

Returns:
The object of the statement interpreted as a value of the the specified type.

getSeq

public Seq getSeq()
Return the object of the statement.

An exception will be thrown if the object is not a Resource.

Returns:
The object of the statement interpreted as a value of the the specified type.

getLanguage

public java.lang.String getLanguage()
Return the language of the object of the statement.

An exception will be thrown if the object is not a Literal.

Returns:
the language of the object of the statement

getWellFormed

public boolean getWellFormed()
Return whether the Literal object is well formed XML as would result from parsing a property element with parseType="Literal".

An exception will be thrown if the object is not a Literal.

Returns:
true if the Literal object is well formed

changeObject

public Statement changeObject(boolean o)
change the object of the statement (S, P, X) to (S, P, o).

Parameters:
o - The new value to be set.
Returns:
this object to enable cascading of method calls.

changeObject

public Statement changeObject(long o)
change the object of the statement (S, P, X) to (S, P, o).

The statement with the old value is removed from the model and a new statement with the new value added and returned.

Parameters:
o - The value to be set.
Returns:
the new (S, P, o) statement.

changeObject

public Statement changeObject(char o)
change the object of the statement (S, P, X) to (S, P, o).

The statement with the old value is removed from the model and a new statement with the new value added and returned.

Parameters:
o - The value to be set.
Returns:
the new (S, P, o) statement.

changeObject

public Statement changeObject(float o)
change the object of the statement (S, P, X) to (S, P, o).

The statement with the old value is removed from the model and a new statement with the new value added and returned.

Parameters:
o - The value to be set.
Returns:
the new (S, P, o) statement.

changeObject

public Statement changeObject(double o)
change the object of the statement (S, P, X) to (S, P, o).

The statement with the old value is removed from the model and a new statement with the new value added and returned.

Parameters:
o - The value to be set.
Returns:
the new (S, P, o) statement.

changeObject

public Statement changeObject(java.lang.String o)
change the object of the statement (S, P, X) to (S, P, o).

The statement with the old value is removed from the model and a new statement with the new value added and returned.

Parameters:
o - The value to be set.
Returns:
the new (S, P, o) statement.

changeObject

public Statement changeObject(java.lang.String o,
                              boolean wellFormed)
change the object of the statement (S, P, X) to (S, P, o).

The statement with the old value is removed from the model and a new statement with the new value added and returned.

Parameters:
o - The value to be set.
wellFormed - true if o is well formed XML
Returns:
the new (S, P, o) statement.

changeObject

public Statement changeObject(java.lang.String o,
                              java.lang.String l)
change the object of the statement (S, P, X) to (S, P, o).

The statement with the old value is removed from the model and a new statement with the new value added.

Parameters:
o - The value to be set.
l - the language of the String
Returns:
the new (S, P, o) statement..

changeObject

public Statement changeObject(java.lang.String o,
                              java.lang.String l,
                              boolean wellFormed)
change the object of the statement (S, P, X) to (S, P, o).

The statement with the old value is removed from the model and a new statement with the new value added.

Parameters:
o - The value to be set.
l - the language of the String
Returns:
the new (S, P, o) statement.

changeObject

public Statement changeObject(RDFNode o)
change the object of the statement (S, P, X) to (S, P, o).

The statement with the old value is removed from the model and a new statement with the new value added.

Parameters:
o - The value to be set
Returns:
the new (S, P, o) statement.

changeObject

public Statement changeObject(java.lang.Object o)
change the object of the statement (S, P, X) to o.

The statement with the old value is removed from the model and a new statement with the new value added.

The Object o is converted to a string representation by calling its toString() method.

Parameters:
o - The value to be set.
Returns:
the new (S, P, o) statement.

remove

public Statement remove()
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.

Returns:
this statement.

isReified

public boolean isReified()
Determine if this statement is the subject of any statements its associated model.

Returns:
true iff this statement is the subject of a statement in the model.

createReifiedStatement

public ReifiedStatement createReifiedStatement()
answer a ReifiedStatement object that embodies this Statement and is in the same Model (if any).


createReifiedStatement

public ReifiedStatement createReifiedStatement(java.lang.String uri)
answer a ReifiedStatement object that embodies this Statement, has the same Model, and has the given uri.


listReifiedStatements

public RSIterator listReifiedStatements()
answer an iterator which delivers all the reified statements in the model this Statement belongs to that match this Statement.


asTriple

public Triple asTriple()
answer the Triple containing the appropriate Nodes corrsponding to the subject, predicate, and object fields.


asResource

public Resource asResource()
Returns a resource representing the reification of this statement. Such a resoruce is created and added to the model if necessary.


getModel

public Model getModel()
get the Model this Statement was created in.


removeReification

public void removeReification()
Finds all possible resources which are the reification of this statement, and for each removes all four triples of the reification quad.



Copyright © 2001-2003 Hewlett-Packard. All Rights Reserved.