Class BlankNodeImpl
- java.lang.Object
-
- org.apache.commons.rdf.rdf4j.impl.AbstractRDFTerm<org.eclipse.rdf4j.model.BNode>
-
- org.apache.commons.rdf.rdf4j.impl.BlankNodeImpl
-
- All Implemented Interfaces:
BlankNode
,BlankNodeOrIRI
,RDFTerm
,RDF4JBlankNode
,RDF4JBlankNodeOrIRI
,RDF4JTerm
final class BlankNodeImpl extends AbstractRDFTerm<org.eclipse.rdf4j.model.BNode> implements RDF4JBlankNode
-
-
Field Summary
Fields Modifier and Type Field Description private int
hashCode
private long
saltUUIDleast
private long
saltUUIDmost
-
Fields inherited from class org.apache.commons.rdf.rdf4j.impl.AbstractRDFTerm
value
-
-
Constructor Summary
Constructors Constructor Description BlankNodeImpl(org.eclipse.rdf4j.model.BNode bNode, java.util.UUID salt)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Check it this RDFTerm is equal to another RDFTerm.int
hashCode()
Calculate a hash code for this RDFTerm.private boolean
isValidBlankNodeLabel(java.lang.String id)
java.lang.String
ntriplesString()
Return the term serialised as specified by the RDF-1.1 N-Triples Canonical form.java.lang.String
toString()
java.lang.String
uniqueReference()
Return a reference for uniquely identifying the blank node.-
Methods inherited from class org.apache.commons.rdf.rdf4j.impl.AbstractRDFTerm
asValue
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.commons.rdf.rdf4j.RDF4JBlankNode
asValue
-
-
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object obj)
Description copied from interface:RDFTerm
Check it this RDFTerm is equal to another RDFTerm.If this object is an
IRI
, equality is checked usingIRI.equals(Object)
, or if this object is aBlankNode
, equality is checked usingBlankNode.equals(Object)
, or if this object is aLiteral
, equality is checked usingLiteral.equals(Object)
.Implementations MUST also override
RDFTerm.hashCode()
so that two equal Literals produce the same hash code.- Specified by:
equals
in interfaceBlankNode
- Specified by:
equals
in interfaceRDFTerm
- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- Another object- Returns:
- true if other is a RDFTerm and is equal to this
- See Also:
IRI.equals(Object)
,BlankNode.equals(Object)
,Literal.equals(Object)
-
hashCode
public int hashCode()
Description copied from interface:RDFTerm
Calculate a hash code for this RDFTerm.As an
RDFTerm
is immutable, this method will always return the same hashCode over the lifetime of this object.This method MUST be implemented in conjunction with
RDFTerm.equals(Object)
so that two equal RDFTerm produce the same hash code.- Specified by:
hashCode
in interfaceBlankNode
- Specified by:
hashCode
in interfaceRDFTerm
- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- a hash code value for this RDFTerm.
- See Also:
IRI.hashCode()
,Literal.hashCode()
,BlankNode.hashCode()
-
isValidBlankNodeLabel
private boolean isValidBlankNodeLabel(java.lang.String id)
-
ntriplesString
public java.lang.String ntriplesString()
Description copied from interface:RDFTerm
Return the term serialised as specified by the RDF-1.1 N-Triples Canonical form.- Specified by:
ntriplesString
in interfaceRDFTerm
- Returns:
- The term serialised as RDF-1.1 N-Triples.
- See Also:
- RDF-1.1 N-Triples Canonical form
-
uniqueReference
public java.lang.String uniqueReference()
Description copied from interface:BlankNode
Return 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
RDF
instances MUST NOT have the same reference string.The
BlankNode.uniqueReference()
of twoBlankNode
instances 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:
uniqueReference
in interfaceBlankNode
- Returns:
- A universally unique reference to identify this
BlankNode
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-