com.franz.agbase
Interface Triple

All Superinterfaces:
ValueObject

public interface Triple
extends ValueObject

This interface defines a representation of an AllegroGraph triple.

The AllegroGraph instance has 5 components, id, subject, predicate, object and context. All 5 are copied to the Java instance.

The components are copied when a Triple instance is created. The associated URI or literal strings may or may not be filled at creation time.

Triple instances are not unique. There may be multiple Triple instances associated with one triple in the triple store.


Method Summary
 boolean add()
          Add a triple to the triple store.
 int compareTo(TripleImpl to)
           
 boolean equals(java.lang.Object other)
           
 long getAGId()
          Return the unique integer identifier of the object.
 UPI getC()
           
 ValueNode getContext()
          Create a Resource instance that describes the context component of the triple.
 java.lang.String getContextLabel()
          Retrieve the URI string associated with the context component of this Triple.
 UPI getO()
          Retrieve the object slot of the Triple instance.
 ValueNode getObject()
          Create a Value instance that describes the object component of the triple.
 java.lang.String getObjectLabel()
          Retrieve the URI string associated with the object component of this Triple.
 UPI getP()
          Retrieve the predicate slot of the Triple instance.
 URINode getPredicate()
          Create a URI instance that describes the predicate component of the triple.
 ValueNode getPredicateInstance()
           
 java.lang.String getPredicateLabel()
          Retrieve the URI string associated with the predicate component of this Triple.
 UPI getS()
          Retrieve the subject slot of the Triple instance.
 ResourceNode getSubject()
          Create a Resource instance that describes the subject component of the triple.
 ValueNode getSubjectInstance()
           
 java.lang.String getSubjectLabel()
          Retrieve the URI string associated with the subject component of this Triple.
 int hashCode()
           
 long queryAGId()
          Return the unique integer identifier of the object.
 java.lang.String queryContext()
           
 UPI queryO()
          Retrieve the object slot of the Triple instance.
 java.lang.String queryObject()
          Retrieve the object slot of the Triple instance.
 UPI queryP()
          Retrieve the predicate slot of the Triple instance.
 java.lang.String queryPredicate()
          Retrieve the predicate slot of the Triple instance.
 UPI queryS()
          Retrieve the subject slot of the Triple instance.
 java.lang.String querySubject()
          Retrieve the subject slot of the Triple instance.
 java.lang.String toString()
          This method overrides the generic toString method.
 

Method Detail

queryAGId

long queryAGId()
Return the unique integer identifier of the object.

Returns:
An integer object id. If the value is negative, then the object has not been stored in the triple store and is simply a place holder for a label. If the value is zero, this is an inferred triple that does not exist in the persisitnet triple store.

getAGId

long getAGId()
             throws AllegroGraphException
Return the unique integer identifier of the object.

Returns:
An integer object id. If the value is zero, this is an inferred triple that does not exist in the persistent triple store.
Throws:
AllegroGraphException - If the triple is not yet stored.

add

boolean add()
            throws AllegroGraphException
Add a triple to the triple store. The Triple instance must have been created with AllegroGraph.createStatement(ResourceNode, URINode, ValueNode) or with AllegroGraph.createStatement(ResourceNode, URINode, ValueNode, ResourceNode).

Returns:
true if the triple was added, false if the triple was already added and therefore nothing was done.
Throws:
AllegroGraphException

queryS

UPI queryS()
Retrieve the subject slot of the Triple instance.

Returns:
A UPI instance that identifies the subject node. A null value means that the subject is not in the local cache, and must be obtained from the server with a call to getS();

getS

UPI getS()
Retrieve the subject slot of the Triple instance. If the value is not in the local cache, this call will require a round-trip to the AllegroGraph server.

Returns:
An integer subject node number.

querySubject

java.lang.String querySubject()
Retrieve the subject slot of the Triple instance.

Returns:
A string containing the URI of the subject node. If the returned value is null, the method getSubjectLabel() must be used to get the true value.

getSubjectLabel

java.lang.String getSubjectLabel()
                                 throws AllegroGraphException
Retrieve the URI string associated with the subject component of this Triple.

Returns:
A string containing the URI of the subject node.
Throws:
AllegroGraphException

getSubject

ResourceNode getSubject()
Create a Resource instance that describes the subject component of the triple. This method must return a Resource instance as specified in the openrdf model specification. Since AllegroGraph is more general, the subject slot can be a more general object. In those cases, this method will throw a CLassCastException. Use the more general method getSubjectInstance() to retrieve any type.


getSubjectInstance

ValueNode getSubjectInstance()

queryP

UPI queryP()
Retrieve the predicate slot of the Triple instance.

Returns:
A UPI instance that identifies the predicate node. A null value means that the predicate is not in the local cache, and must be obtained from the server with a call to getP();

getP

UPI getP()
Retrieve the predicate slot of the Triple instance. If the value is not in the local cache, this call will require a round-trip to the AllegroGraph server.

Returns:
A UPI instance that identifies the predicate node.

queryPredicate

java.lang.String queryPredicate()
Retrieve the predicate slot of the Triple instance.

Returns:
The string form of the predicate node or null if the string form is not available. Use getPredicateLabel() to always return a string.

getPredicateLabel

java.lang.String getPredicateLabel()
                                   throws AllegroGraphException
Retrieve the URI string associated with the predicate component of this Triple.

Returns:
A string containing the URI of the predicate node.
Throws:
AllegroGraphException

getPredicate

URINode getPredicate()
Create a URI instance that describes the predicate component of the triple. This method must return a Resource instance as specified in the openrdf model specification. Since AllegroGraph is more general, the subject slot can be a more general object. In those cases, this method will throw a CLassCastException. Use the more general method getPredicateInstance() to retrieve any type.


getPredicateInstance

ValueNode getPredicateInstance()

queryO

UPI queryO()
Retrieve the object slot of the Triple instance.

Returns:
A UPI instance that identifies the object node. A null value means that the subject is not in the local cache, and must be obtained from the server with a call to getS();

getO

UPI getO()
Retrieve the object slot of the Triple instance. If the value is not in the local cache, this call will require a round-trip to the AllegroGraph server.

Returns:
An integer object node number.

queryObject

java.lang.String queryObject()
Retrieve the object slot of the Triple instance.

Returns:
A string or null. Use getObjectLabel() to always return a string.

getObjectLabel

java.lang.String getObjectLabel()
                                throws AllegroGraphException
Retrieve the URI string associated with the object component of this Triple.

Returns:
A string containing the URI of the object node.
Throws:
AllegroGraphException

getObject

ValueNode getObject()
Create a Value instance that describes the object component of the triple.


getC

UPI getC()

queryContext

java.lang.String queryContext()

getContextLabel

java.lang.String getContextLabel()
Retrieve the URI string associated with the context component of this Triple.

Returns:
A string containing the URI of the context node.

getContext

ValueNode getContext()
Create a Resource instance that describes the context component of the triple.


toString

java.lang.String toString()
This method overrides the generic toString method. This method generates a more readable output string.

Overrides:
toString in class java.lang.Object

equals

boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

int hashCode()
Overrides:
hashCode in class java.lang.Object

compareTo

int compareTo(TripleImpl to)
Specified by:
compareTo in interface ValueObject