com.franz.ag
Class Node

java.lang.Object
  extended bycom.franz.ag.ValueObject
      extended bycom.franz.ag.ValueNode
          extended bycom.franz.ag.ResourceNode
              extended bycom.franz.ag.Node
All Implemented Interfaces:
java.lang.Comparable, Resource, java.io.Serializable, URI, Value

public class Node
extends ResourceNode
implements URI

This class represents an instance of a labelled resource node in AllegroGraph.

The AllegroGraph object defines two slots, id and uri. Both slots are copied to the Java instance.

The URI member may be a lazy value in the Java instance. If queryURI returns null, getURI() will need a round-trip to the triple store to fetch the actual value.

There is no public constructor. Node instances are created by calls to AllegroGraph methods.

See Also:
Serialized Form

Field Summary
static Node nullContext
           
 
Method Summary
 void add()
          Add this node to the AllegroGraph triple store.
 boolean equals(java.lang.Object other)
          Implement equality for Node instances.
 UPI getAGId()
          Retrieve the AllegroGraph ID number of the Node.
 java.lang.String getLocalName()
          Retrieve the local name component of the URI string associated with the node instance.
 java.lang.String getNamespace()
          Retrieve the namespace component of the URI string associated with the node instance.
 StatementIterator getPredicateStatements()
          Gets all statements from the RDF graph for which this URI is the predicate.
 java.lang.String getURI()
          Returns the String-representation of this URI.
 int hashCode()
          Compute the hashcode of a Node instance.
 java.lang.String queryURI()
          Retrieve the URI string associated with the node instance.
 java.lang.String toString()
          Retrieve the URI string associated with the node instance.
 
Methods inherited from class com.franz.ag.ResourceNode
addProperty, getSubjectStatements
 
Methods inherited from class com.franz.ag.ValueNode
compareTo, getObjectStatements, queryAGId
 
Methods inherited from class com.franz.ag.ValueObject
compareTo
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.openrdf.model.Resource
addProperty, getSubjectStatements
 
Methods inherited from interface org.openrdf.model.Value
getObjectStatements
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

nullContext

public static final Node nullContext
Method Detail

getAGId

public UPI getAGId()
            throws AllegroGraphException
Retrieve the AllegroGraph ID number of the Node.

Returns:
the ID number

If the Node is already registered in the AG triple store, return the locally cached value of the ID number. Otherwise, register the Node in the AG triple store and return the new ID number.

Throws:
AllegroGraphException

queryURI

public java.lang.String queryURI()
Retrieve the URI string associated with the node instance.

Returns:
A string or null. If the returned value is null, the actual value must be obtained by calling getURI().

getLocalName

public java.lang.String getLocalName()
Retrieve the local name component of the URI string associated with the node instance.

Specified by:
getLocalName in interface URI
Returns:
A string. If the value is not in the Java cache, retrieve it from the triple store.

getNamespace

public java.lang.String getNamespace()
Retrieve the namespace component of the URI string associated with the node instance.

Specified by:
getNamespace in interface URI
Returns:
A string or null if the URI does not have a namespace component. If the value is not in the Java cache, retrieve it from the triple store.

toString

public java.lang.String toString()
Retrieve the URI string associated with the node instance.

Returns:
A string. If the value is not in the Java cache, retrieve it from the triple store.

Defined in interface org.openrdf.model.URI


equals

public boolean equals(java.lang.Object other)
Implement equality for Node instances.

Two Node instances are equal if both are registered in the AllegroGraph triple store and they have identical AllegroGraph part id numbers.

Otherwise, the string representations are compared.


hashCode

public int hashCode()
Compute the hashcode of a Node instance.

The hashcode of a Node instance is the hashcode of its string representation.


getPredicateStatements

public StatementIterator getPredicateStatements()
                                         throws GraphException
Description copied from interface: URI
Gets all statements from the RDF graph for which this URI is the predicate.

Specified by:
getPredicateStatements in interface URI
Throws:
GraphException

getURI

public java.lang.String getURI()
Description copied from interface: URI
Returns the String-representation of this URI. The String-representation consists of the concatenation of the namespace and the local name.

Specified by:
getURI in interface URI
Returns:
The String-representation of this URI.

add

public void add()
         throws AllegroGraphException
Add this node to the AllegroGraph triple store. If the node already is in the triple store, do nothing.

A Node instance is in the triple store if queryAGId() returns a non-negative value.

Throws:
AllegroGraphException