org.jrdf.graph
Class AbstractTriple

java.lang.Object
  extended byorg.jrdf.graph.AbstractTriple
All Implemented Interfaces:
Serializable, Triple
Direct Known Subclasses:
TripleImpl

public abstract class AbstractTriple
extends Object
implements Triple, Serializable

A base implementation of an RDF Triple.

Version:
$Revision: 1.1 $
Author:
Andrew Newman
See Also:
Serialized Form

Field Summary
protected  ObjectNode objectNode
          Object of this statement.
protected  PredicateNode predicateNode
          Predicate of this statement.
protected  SubjectNode subjectNode
          Subject of this statement.
 
Constructor Summary
AbstractTriple()
           
 
Method Summary
 boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
 ObjectNode getObject()
          Obtains the object of this statement.
 PredicateNode getPredicate()
          Obtains the predicate of this statement.
 SubjectNode getSubject()
          Obtains the subject of this statement.
 int hashCode()
          Returns a hash-code value for this triple.
 String toString()
          Provide a legible representation of a triple.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

subjectNode

protected SubjectNode subjectNode
Subject of this statement.


predicateNode

protected PredicateNode predicateNode
Predicate of this statement.


objectNode

protected ObjectNode objectNode
Object of this statement.

Constructor Detail

AbstractTriple

public AbstractTriple()
Method Detail

getSubject

public SubjectNode getSubject()
Obtains the subject of this statement.

Specified by:
getSubject in interface Triple
Returns:
an SubjectNode which is either a BlankNode or URIReference

getPredicate

public PredicateNode getPredicate()
Obtains the predicate of this statement.

Specified by:
getPredicate in interface Triple
Returns:
a PredicateNode which is a URIReference

getObject

public ObjectNode getObject()
Obtains the object of this statement.

Specified by:
getObject in interface Triple
Returns:
a ObjectNode which is either a BlankNode, URIReference or Literal

equals

public boolean equals(Object obj)
Description copied from interface: Triple
Indicates whether some other object is "equal to" this one. A triple is equal to another triple if the subject, predicate and object are all equal.

Specified by:
equals in interface Triple

hashCode

public int hashCode()
Description copied from interface: Triple
Returns a hash-code value for this triple. The hash code is based upon XORing all of the components of a triple i.e. the subject, predicate and object.

Specified by:
hashCode in interface Triple

toString

public String toString()
Provide a legible representation of a triple. Currently, square brackets with toString values of the parts of the triple.

Returns:
the string value of the subject, predicate and object in square brackets.