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

All Superinterfaces:
RDFNode, Resource
All Known Implementing Classes:
StatementImpl

public interface Statement
extends Resource

An RDF Statement.

A statement is also itself a resource and can be both the subject and object of other statements.

Like other resources, 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.

This interface provides methods for supporting enhanced resources. An enhanced resource is a resource to which the application has added behaviour. RDF containers are examples of enhanced resources built in to this package. Enhanced resources are supported by encapsulating a resource created by an implementation in another class which adds the extra behaviour. Factory objects are used to construct such enhanced resources.

Version:
$Name: $ $Revision: 1.5 $ $Date: 2003/01/23 10:04:21 $
Author:
bwm

Method Summary
 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.
 Location getLocation()
          Get the source location information for the statement as set by ARP.
 long getLong()
          Return the object of the statement.
 RDFNode getObject()
          An accessor function 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"
 boolean isReified()
          Determine if this statement is the subject of any statements its associated model.
 Statement remove()
          Remove this statement from its associated model.
 Statement set(boolean o)
          Set the object of the statement.
 Statement set(char o)
          Set the object of the statement.
 Statement set(double o)
          Set the object of the statement.
 Statement set(float o)
          Set the object of the statement.
 Statement set(long o)
          Set the object of the statement.
 Statement set(java.lang.Object o)
          Set the object of the statement.
 Statement set(RDFNode o)
          Set the object of the statement.
 Statement set(java.lang.String o)
          Set the object of the statement.
 Statement set(java.lang.String o, boolean wellFormed)
          Set the object of the statement.
 Statement set(java.lang.String o, java.lang.String l)
          Set the object of the statement.
 Statement set(java.lang.String o, java.lang.String l, boolean wellFormed)
          Set the object of the statement.
 void setLocation(Location l)
          Set the location information for the statement.
 
Methods inherited from interface com.hp.hpl.mesa.rdf.jena.model.Resource
abort, addProperty, addProperty, addProperty, addProperty, addProperty, addProperty, addProperty, addProperty, addProperty, begin, commit, getId, getLocalName, getModel, getNameSpace, getURI, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, isAnon, listProperties, listProperties, removeProperties, toString
 

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.

Specified by:
equals in interface Resource
Overrides:
equals in class java.lang.Object
Parameters:
o - the object to be compared
Returns:
true if and only if the equality condition is met.

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 function to return the object of the statement.

Returns:
Return the object of the statement.

getProperty

public Statement getProperty(Property p)
                      throws RDFException
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 interface Resource
Parameters:
p - the property sought
Returns:
a statement representing an instance of the required property
Throws:
RDFException - Generic RDF Exception

getStatementProperty

public Statement getStatementProperty(Property p)
                               throws RDFException
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.
Throws:
RDFException - Generic RDF exception

getResource

public Resource getResource()
                     throws RDFException
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.
Throws:
RDFException - Generuc RDF exception.

getLiteral

public Literal getLiteral()
                   throws RDFException
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.
Throws:
RDFException - Generuc RDF exception.

getBoolean

public boolean getBoolean()
                   throws RDFException
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.
Throws:
RDFException - Generuc RDF exception.

getByte

public byte getByte()
             throws RDFException
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.
Throws:
RDFException - Generuc RDF exception.

getShort

public short getShort()
               throws RDFException
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.
Throws:
RDFException - Generuc RDF exception.

getInt

public int getInt()
           throws RDFException
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.
Throws:
RDFException - Generuc RDF exception.

getLong

public long getLong()
             throws RDFException
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.
Throws:
RDFException - Generuc RDF exception.

getChar

public char getChar()
             throws RDFException
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.
Throws:
RDFException - Generuc RDF exception.

getFloat

public float getFloat()
               throws RDFException
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.
Throws:
RDFException - Generuc RDF exception.

getDouble

public double getDouble()
                 throws RDFException
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.
Throws:
RDFException - Generuc RDF exception.

getString

public java.lang.String getString()
                           throws RDFException
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.
Throws:
RDFException - Generuc RDF exception.

getResource

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

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

Returns:
The object of the statement.
Throws:
RDFException - Generuc RDF exception.

getObject

public java.lang.Object getObject(ObjectF f)
                           throws RDFException
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.
Throws:
RDFException - Generuc RDF exception.

getBag

public Bag getBag()
           throws RDFException
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.
Throws:
RDFException - Generuc RDF exception.

getAlt

public Alt getAlt()
           throws RDFException
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.
Throws:
RDFException - Generuc RDF exception.

getSeq

public Seq getSeq()
           throws RDFException
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.
Throws:
RDFException - Generuc RDF exception.

getLanguage

public java.lang.String getLanguage()
                             throws RDFException
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
Throws:
RDFException - Generuc RDF exception.

getWellFormed

public boolean getWellFormed()
                      throws RDFException
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
Throws:
RDFException - Generuc RDF exception.

set

public Statement set(boolean o)
              throws RDFException
Set the object of the statement.

Parameters:
o - The new value to be set.
Returns:
this object to enable cascading of method calls.
Throws:
RDFException - Generic RDF exception.

set

public Statement set(long o)
             RDFException
Set the object of the statement.

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:
this object to enable cascading of method calls.
Throws:
RDFException - Generic RDF exception.

set

public Statement set(char o)
              throws RDFException
Set the object of the statement.

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:
this object to enable cascading of method calls.
Throws:
RDFException - Generic RDF exception.

set

public Statement set(float o)
              throws RDFException
Set the object of the statement.

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:
this object to enable cascading of method calls.
Throws:
RDFException - Generic RDF exception.

set

public Statement set(double o)
              throws RDFException
Set the object of the statement.

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:
this object to enable cascading of method calls.
Throws:
RDFException - Generic RDF exception.

set

public Statement set(java.lang.String o)
              throws RDFException
Set the object of the statement.

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:
this object to enable cascading of method calls.
Throws:
RDFException - Generic RDF exception.

set

public Statement set(java.lang.String o,
                     boolean wellFormed)
              throws RDFException
Set the object of the statement.

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.
wellFormed - true if o is well formed XML
Returns:
this object to enable cascading of method calls.
Throws:
RDFException - Generic RDF exception.

set

public Statement set(java.lang.String o,
                     java.lang.String l)
              throws RDFException
Set the object of the statement.

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:
this object to enable cascading of method calls.
Throws:
RDFException - Generic RDF exception.

set

public Statement set(java.lang.String o,
                     java.lang.String l,
                     boolean wellFormed)
              throws RDFException
Set the object of the statement.

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:
this object to enable cascading of method calls.
Throws:
RDFException - Generic RDF exception.

set

public Statement set(RDFNode o)
              throws RDFException
Set the object of the statement.

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:
this object to enable cascading of method calls.
Throws:
RDFException - Generic RDF exception.

set

public Statement set(java.lang.Object o)
              throws RDFException
Set the object of the statement.

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:
this object to enable cascading of method calls.
Throws:
RDFException - Generic RDF exception.

remove

public Statement remove()
                 throws RDFException
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.
Throws:
RDFException - Generic RDF exception.

isReified

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

Returns:
true if the statement s is the subject of a statement in the model, false otherwise
Throws:
RDFException - Generic RDF Exception

getLocation

public Location getLocation()
Get the source location information for the statement as set by ARP. Could be null if no location information is available.

Returns:
the Location of the statement in the source, null if none was stored.

setLocation

public void setLocation(Location l)
Set the location information for the statement.


Copyright © 2001 Hewlett-Packard. All Rights Reserved.