Class BlankNodeImpl
- java.lang.Object
-
- org.apache.commons.rdf.simple.BlankNodeImpl
-
- All Implemented Interfaces:
BlankNode,BlankNodeOrIRI,RDFTerm,SimpleRDF.SimpleRDFTerm
final class BlankNodeImpl extends java.lang.Object implements BlankNode, SimpleRDF.SimpleRDFTerm
A simple implementation of BlankNode.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.concurrent.atomic.AtomicLongCOUNTERprivate static java.util.UUIDSALTprivate java.lang.StringuniqueReference
-
Constructor Summary
Constructors Constructor Description BlankNodeImpl()BlankNodeImpl(java.util.UUID uuidSalt, java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Check it this BlankNode is equal to another BlankNode.inthashCode()Calculate a hash code for this BlankNode.java.lang.StringntriplesString()Return the term serialised as specified by the RDF-1.1 N-Triples Canonical form.java.lang.StringtoString()java.lang.StringuniqueReference()Return a reference for uniquely identifying the blank node.
-
-
-
Method Detail
-
uniqueReference
public java.lang.String uniqueReference()
Description copied from interface:BlankNodeReturn a reference for uniquely identifying the blank node.The reference string MUST universally and uniquely identify this blank node. That is, different blank nodes created separately in different JVMs or from different
RDFinstances MUST NOT have the same reference string.The
BlankNode.uniqueReference()of twoBlankNodeinstances MUST be equal if and only if the two blank nodes are equal according toBlankNode.equals(Object).Clients should not assume any particular structure of the reference string, however it is recommended that the reference string contain a UUID-derived string, e.g. as returned from
UUID.toString().IMPORTANT: This is not a blank node identifier nor a serialization/syntax label, and there are no guarantees that it is a valid identifier in any concrete RDF syntax. For an N-Triples compatible identifier, use
RDFTerm.ntriplesString().- Specified by:
uniqueReferencein interfaceBlankNode- Returns:
- A universally unique reference to identify this
BlankNode
-
ntriplesString
public java.lang.String ntriplesString()
Description copied from interface:RDFTermReturn the term serialised as specified by the RDF-1.1 N-Triples Canonical form.- Specified by:
ntriplesStringin interfaceRDFTerm- Returns:
- The term serialised as RDF-1.1 N-Triples.
- See Also:
- RDF-1.1 N-Triples Canonical form
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
Description copied from interface:BlankNodeCalculate a hash code for this BlankNode.The returned hash code MUST be equal to the
String.hashCode()of theBlankNode.uniqueReference().This method MUST be implemented in conjunction with
BlankNode.equals(Object)so that two equal BlankNodes produce the same hash code.
-
equals
public boolean equals(java.lang.Object obj)
Description copied from interface:BlankNodeCheck it this BlankNode is equal to another BlankNode. Two BlankNodes MUST be equal if, and only if, they have the sameBlankNode.uniqueReference().Implementations MUST also override
BlankNode.hashCode()so that two equal Literals produce the same hash code.
-
-