com.hp.hpl.mesa.rdf.jena.common
Class StatementImpl

java.lang.Object
  |
  +--com.hp.hpl.mesa.rdf.jena.common.ResourceImpl
        |
        +--com.hp.hpl.mesa.rdf.jena.common.StatementImpl
All Implemented Interfaces:
RDFNode, Resource, ResourceI, Statement

public class StatementImpl
extends ResourceImpl
implements Statement

An implementation of Statement.

Version:
$Name: $ $Revision: 1.8 $ $Date: 2002/01/05 11:00:57 $
Author:
bwm

Constructor Summary
StatementImpl(Resource subject, Property predicate, RDFNode object)
           
StatementImpl(Resource subject, Property predicate, RDFNode object, AnonId id, Model model)
          Creates new StatementImpl
StatementImpl(Resource subject, Property predicate, RDFNode object, Model model)
          Creates new StatementImpl
StatementImpl(Resource subject, Property predicate, RDFNode object, java.lang.String URI, Model model)
          Creates new StatementImpl
 
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.
 long getLong()
          Return the object of the statement.
 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()
           
 boolean isReified()
          Determine if this statement is the subject of any statements its associated model.
 Resource port(Model m)
          For internal use only
 Statement remove()
          Remove this statement from its associated model.
 Resource removeProperties()
          Delete all the properties for this resource from the 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.
 java.lang.String toString()
          Return a string representation of the resource.
 
Methods inherited from class com.hp.hpl.mesa.rdf.jena.common.ResourceImpl
abort, addProperty, addProperty, addProperty, addProperty, addProperty, addProperty, addProperty, addProperty, addProperty, begin, commit, getEmbeddedResource, getId, getLocalName, getModel, getNameSpace, getURI, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, isAnon, listProperties, listProperties
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
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
 

Constructor Detail

StatementImpl

public StatementImpl(Resource subject,
                     Property predicate,
                     RDFNode object)

StatementImpl

public StatementImpl(Resource subject,
                     Property predicate,
                     RDFNode object,
                     Model model)
              throws RDFException
Creates new StatementImpl

StatementImpl

public StatementImpl(Resource subject,
                     Property predicate,
                     RDFNode object,
                     AnonId id,
                     Model model)
              throws RDFException
Creates new StatementImpl

StatementImpl

public StatementImpl(Resource subject,
                     Property predicate,
                     RDFNode object,
                     java.lang.String URI,
                     Model model)
              throws RDFException
Creates new StatementImpl
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class ResourceImpl

getSubject

public Resource getSubject()
Description copied from interface: Statement
An accessor method to return the subject of the statements.
Specified by:
getSubject in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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 interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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 interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
Returns:
Return the object of the statement.

getProperty

public Statement getProperty(Property p)
                      throws RDFException
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 interface Statement
Overrides:
getProperty in class ResourceImpl
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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
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 interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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
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 interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
Returns:
The Resource which is the object of the statement.
Throws:
RDFException - Generuc RDF exception.

getLiteral

public Literal getLiteral()
                   throws RDFException
Description copied from interface: Statement
Return the object of the statement.

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

Specified by:
getLiteral in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
Returns:
The Literal which is the object of the statement.
Throws:
RDFException - Generuc RDF exception.

getBoolean

public boolean getBoolean()
                   throws RDFException
Description copied from interface: Statement
Return the object of the statement.

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

Specified by:
getBoolean in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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
Description copied from interface: Statement
Return the object of the statement.

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

Specified by:
getByte in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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
Description copied from interface: Statement
Return the object of the statement.

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

Specified by:
getShort in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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
Description copied from interface: Statement
Return the object of the statement.

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

Specified by:
getInt in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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
Description copied from interface: Statement
Return the object of the statement.

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

Specified by:
getLong in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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
Description copied from interface: Statement
Return the object of the statement.

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

Specified by:
getChar in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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
Description copied from interface: Statement
Return the object of the statement.

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

Specified by:
getFloat in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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
Description copied from interface: Statement
Return the object of the statement.

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

Specified by:
getDouble in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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
Description copied from interface: Statement
Return the object of the statement.

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

Specified by:
getString in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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
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 interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
Returns:
The object of the statement.
Throws:
RDFException - Generuc RDF exception.

getObject

public java.lang.Object getObject(ObjectF f)
                           throws RDFException
Description copied from interface: Statement
Return the object of the statement.

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

Specified by:
getObject in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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
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:
getBag in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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
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:
getAlt in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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
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:
getSeq in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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
Description copied from interface: Statement
Return the language of the object of the statement

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

Specified by:
getLanguage in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
Returns:
the language of the object of the statement
Throws:
RDFException - Generuc RDF exception.

getWellFormed

public boolean getWellFormed()
                      throws RDFException
Description copied from interface: Statement
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.

Specified by:
getWellFormed in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
Returns:
true if the Literal object is well formed
Throws:
RDFException - Generuc RDF exception.

set

public Statement set(boolean o)
              throws RDFException
Description copied from interface: Statement
Set the object of the statement.
Specified by:
set in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.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)
              throws RDFException
Description copied from interface: Statement
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.

Specified by:
set in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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
Description copied from interface: Statement
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.

Specified by:
set in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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
Description copied from interface: Statement
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.

Specified by:
set in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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
Description copied from interface: Statement
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.

Specified by:
set in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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
Description copied from interface: Statement
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.

Specified by:
set in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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
Description copied from interface: Statement
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.

Specified by:
set in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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
Description copied from interface: Statement
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.

Specified by:
set in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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
Description copied from interface: Statement
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.

Specified by:
set in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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
Description copied from interface: Statement
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.

Specified by:
set in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
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.Object o)
              throws RDFException
Description copied from interface: Statement
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.
Specified by:
set in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
Parameters:
o - The value to be set.
Returns:
this object to enable cascading of method calls.
Throws:
RDFException - Generic RDF exception.

toString

public java.lang.String toString()
Description copied from interface: Resource
Return a string representation of the resource. Returns the URI of the resource unless the resource is anonymous in which case it returns the id of the resource enclosed in square brackets.
Specified by:
toString in interface Resource
Overrides:
toString in class ResourceImpl
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Resource
Returns:
Return a string representation of the resource. if it is anonymous.

equals

public boolean equals(java.lang.Object o)
Description copied from interface: Statement
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 Statement
Overrides:
equals in class ResourceImpl
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
Parameters:
o - the object to be compared
Returns:
true if and only if the equality condition is met.

removeProperties

public Resource removeProperties()
                          throws RDFException
Description copied from interface: Resource
Delete all the properties for this resource from the associated model.
Specified by:
removeProperties in interface Resource
Overrides:
removeProperties in class ResourceImpl
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Resource
Returns:
This resource to permit cascading.
Throws:
RDFException - Generic RDF exception.

remove

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

Specified by:
remove in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
Returns:
this statement.
Throws:
RDFException - Generic RDF exception.

isReified

public boolean isReified()
                  throws RDFException
Description copied from interface: Statement
Determine if this statement is the subject of any statements its associated model.
Specified by:
isReified in interface Statement
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.Statement
Parameters:
s - The statement tested.
Returns:
true if the statement s is the subject of a statement in the model, false otherwise
Throws:
RDFException - Generic RDF Exception

port

public Resource port(Model m)
              throws RDFException
Description copied from interface: ResourceI
For internal use only
Overrides:
port in class ResourceImpl


Copyright © 2001 Hewlett-Packard. All Rights Reserved.