org.nsdl.mptstore.rdf
Class URIReference

java.lang.Object
  extended by org.nsdl.mptstore.rdf.URIReference
All Implemented Interfaces:
Node, ObjectNode, PredicateNode, SubjectNode

public class URIReference
extends java.lang.Object
implements SubjectNode, PredicateNode, ObjectNode

An RDF URI reference. This is an absolute URI with an optional fragment identifier. A URIReference can play the part of a subject, predicate, or object in an RDF triple.

Author:
cwilper@cs.cornell.edu

Constructor Summary
URIReference(java.lang.String uri)
          Construct a URIReference given a URI string.
URIReference(java.net.URI uri)
          Construct a URIReference given an existing URI.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Tell whether this Node should be considered equivalent to the given object.
 java.net.URI getURI()
          Get the URI.
 java.lang.String getValue()
          Get the lexical value of the node.
 int hashCode()
          Return a hash code for this node.
 java.lang.String toString()
          Get an N-Triples string representing this node.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

URIReference

public URIReference(java.net.URI uri)
             throws java.net.URISyntaxException
Construct a URIReference given an existing URI.

Parameters:
uri - The existing URI.
Throws:
java.net.URISyntaxException - if the URI is not absolute.

URIReference

public URIReference(java.lang.String uri)
             throws java.net.URISyntaxException
Construct a URIReference given a URI string.

Parameters:
uri - The URI string.
Throws:
java.net.URISyntaxException - if the given string is not a valid URI or is not absolute.
Method Detail

getURI

public java.net.URI getURI()
Get the URI.

Returns:
the URI.

getValue

public java.lang.String getValue()
Get the lexical value of the node.

The lexical value of a URIReference node is the URI as a string.

The lexical value of a Literal node is a string representation of the value, and does not include the language or data type, if any.

Specified by:
getValue in interface Node
Returns:
the lexical value, never null.

toString

public java.lang.String toString()
Get an N-Triples string representing this node.

For URIReference nodes, this is <$uri>.

For Literal nodes, this is one of the following:

Note:

Specified by:
toString in interface Node
Overrides:
toString in class java.lang.Object
Returns:
the N-Triples representation of the node.
See Also:
RDF Test Cases, Section 3: N-Triples

equals

public boolean equals(java.lang.Object obj)
Tell whether this Node should be considered equivalent to the given object.

A URIReference node is equal to the given object if all of the following conditions are met:

A Literal node is equal to the given object if all of the following conditions are met:

Specified by:
equals in interface Node
Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare to this one.
Returns:
true if the objects are equal according to the rules above.

hashCode

public int hashCode()
Return a hash code for this node.

The hash code of a URIReference is the hash code of getURI(). The hash code of a Literal is the hash code of getValue().

Specified by:
hashCode in interface Node
Overrides:
hashCode in class java.lang.Object
Returns:
the hash code.