org.nsdl.mptstore.rdf
Class Triple

java.lang.Object
  extended by org.nsdl.mptstore.rdf.Triple

public class Triple
extends java.lang.Object

An RDF triple, also known as a statement. A triple consists of exactly one subject, predicate, and object.

Author:
cwilper@cs.cornell.edu

Constructor Summary
Triple(SubjectNode subject, PredicateNode predicate, ObjectNode object)
          Construct a Triple with the given components.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Tell whether the given object is equal to this triple.
 ObjectNode getObject()
          Get the object of this triple.
 PredicateNode getPredicate()
          Get the predicate of this triple.
 SubjectNode getSubject()
          Get the subject of this triple.
 int hashCode()
          Return a hash code for this triple.
 java.lang.String toString()
          Get a string representation of this Triple, in N-Triples format.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Triple

public Triple(SubjectNode subject,
              PredicateNode predicate,
              ObjectNode object)
Construct a Triple with the given components.

Parameters:
subject - The subject.
predicate - The predicate.
object - The object.
Method Detail

getSubject

public SubjectNode getSubject()
Get the subject of this triple.

Returns:
the subject.

getPredicate

public PredicateNode getPredicate()
Get the predicate of this triple.

Returns:
the predicate.

getObject

public ObjectNode getObject()
Get the object of this triple.

Returns:
the object.

toString

public java.lang.String toString()
Get a string representation of this Triple, in N-Triples format.

Overrides:
toString in class java.lang.Object
Returns:
a space-delimited string consisting of the subject, predicate, and object strings, and ending with space dot.

equals

public boolean equals(java.lang.Object obj)
Tell whether the given object is equal to this triple.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare with this one.
Returns:
true if it's a Triple and the subject, predicate, and object all compare the same.

hashCode

public int hashCode()
Return a hash code for this triple. The hash code of a Triple is the sum of the subject, predicate, and object components.

Overrides:
hashCode in class java.lang.Object
Returns:
the hashcode.