eRqlEngine API documentation - http://www.wleklinski.de/rdf/

eworks.RDF.model
Class Statement

java.lang.Object
  extended byeworks.RDF.model.StaticCollection
      extended byeworks.RDF.model.Statement
All Implemented Interfaces:
Collection, Tuple, Tuples

public class Statement
extends StaticCollection
implements Tuple

Represents a RDF statement.

Version:
1.00 (2003-11-03)
Author:
Fabian Wleklinski (fabian@wleklinski.de)

Constructor Summary
Statement()
          Creates a new and empty statement.
Statement(LiteralValue subject, LiteralValue predicat, LiteralValue object)
          Creates a new statement with the given subject, predicate and object.
 
Method Summary
 boolean add(Tuple t)
          Do not call this method, as it throws an UnsupportedOperationException.
 boolean addAll(Collection c, boolean distinct)
          Do not call this method, as it throws an UnsupportedOperationException.
 Object clone()
          Clones this statement and returns a new instance containing the same subject, predicate and object.
 boolean equals(Object o)
          Checks if the given object o is equal to this statement.
 Value get(int index)
          Returns the statement's component with the given index, 0 will return it's subject, 1 it's predicate and 2 it's object.
 int getNumberOfGroups()
          Returns the number of tuple goups, always 1 in this implementation.
 LiteralValue getObject()
          Returns this statement's object.
 LiteralValue getPredicat()
          Returns this statement's predicate.
 int getSize()
          Returns the statement's number of components (always 3).
 LiteralValue getSubject()
          Returns this statement's subject.
 Tuple getTuple(int index)
          Returns a certain tuple specified by it's numerical index.
 Tuples getTuplesByGroup(int groupIndex)
          Returns all tuples of a certain tuple group.
 void set(int index, LiteralValue value)
          Sets the statement's component with the given index to the given value.
 
Methods inherited from class eworks.RDF.model.StaticCollection
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Constructor Detail

Statement

public Statement()
Creates a new and empty statement.


Statement

public Statement(LiteralValue subject,
                 LiteralValue predicat,
                 LiteralValue object)
Creates a new statement with the given subject, predicate and object.

Parameters:
subject - The statement's subject.
predicat - The statement's predicat.
object - The statement's object.
Method Detail

getSubject

public LiteralValue getSubject()
Returns this statement's subject.

Returns:
this statement's subject.

getPredicat

public LiteralValue getPredicat()
Returns this statement's predicate.

Returns:
this statement's predicate.

getObject

public LiteralValue getObject()
Returns this statement's object.

Returns:
this statement's object.

add

public boolean add(Tuple t)
Do not call this method, as it throws an UnsupportedOperationException. This method is implemented due to the contract with StaticCollection, but cannot be applied on instances of this class.

Specified by:
add in interface Tuples
Parameters:
t - The tuple to add.
Returns:
true if and only if the set of tuples has changed.
Throws:
UnsupportedOperationException - always.

getNumberOfGroups

public int getNumberOfGroups()
Returns the number of tuple goups, always 1 in this implementation.

Specified by:
getNumberOfGroups in interface Tuples
Returns:
The number of tuple groups, always 1.

clone

public Object clone()
Clones this statement and returns a new instance containing the same subject, predicate and object.

Specified by:
clone in interface Tuples
Returns:
A clone of this statement.

getTuplesByGroup

public Tuples getTuplesByGroup(int groupIndex)
Returns all tuples of a certain tuple group.

Specified by:
getTuplesByGroup in interface Tuples
Parameters:
groupIndex - The group's numerical index, has to be the value 1 in this implementation.
Returns:
All tuples of the tuple group, that are all tuples that are enclosed.
Throws:
ArrayIndexOutOfBoundsException - if the groupIndex is unequal to 1.

addAll

public boolean addAll(Collection c,
                      boolean distinct)
Do not call this method, as it throws an UnsupportedOperationException. This method is implemented due to the contract with StaticCollection, but cannot be applied on instances of this class.

Specified by:
addAll in interface Tuples
Parameters:
c - The tuples to add.
distinct - If set to true, there will no duplicates be added.
Returns:
true if and only if at least one tuple was added.
Throws:
UnsupportedOperationException - always.

getTuple

public Tuple getTuple(int index)
Returns a certain tuple specified by it's numerical index.

Specified by:
getTuple in interface Tuples
Parameters:
index - The numerical index of the tuple to return, must be 0 in this implementation.
Returns:
This tuple.
Throws:
ArrayIndexOutOfBoundsException - if index is unequal to 0.

get

public Value get(int index)
          throws ArrayIndexOutOfBoundsException
Returns the statement's component with the given index, 0 will return it's subject, 1 it's predicate and 2 it's object.

Specified by:
get in interface Tuple
Parameters:
index - The index of the component to return.
Returns:
The statement's component with the given index.
Throws:
ArrayIndexOutOfBoundsException - if the index is not a value between 0 and StaticCollection.size().

set

public void set(int index,
                LiteralValue value)
Sets the statement's component with the given index to the given value. The index 0 will set it's subject, 1 it's predicate and 2 it's object.

Specified by:
set in interface Tuple
Parameters:
index - The index of the component to set.
value - The value to set.
Throws:
ArrayIndexOutOfBoundsException - if the index is not a value between 0 and StaticCollection.size().

getSize

public int getSize()
Returns the statement's number of components (always 3).

Specified by:
getSize in interface Tuple
Returns:
The statement's number of components (always 3).

equals

public boolean equals(Object o)
Checks if the given object o is equal to this statement. To do so, it is checked if o is an instance of the class Statement, too, and if it isn't, the result of Object.equals(java.lang.Object) is returned. Otherwise the subject, predicate and object of the given statement are compared with subject, predicate and obect of this statement, and if all of them are equal, true is returned, false otherwise.

Specified by:
equals in interface Tuple

eRqlEngine API documentation - http://www.wleklinski.de/rdf/