public interface RDFTerm
A RDFTerm object in Commons RDF is considered
immutable, that is, over its life time it will have
consistent behaviour for its equals(Object) and hashCode(),
and objects returned from its getter methods (e.g. IRI.getIRIString()
and Literal.getLanguageTag()) will have consistent
equals(Object) behaviour.
Note that methods in RDFTerm and its Commons RDF specialisations
IRI, BlankNode and Literal are not required to return
object identical (==) instances as long as they are equivalent
according to their Object.equals(Object). Further specialisations may
provide additional methods that are documented to be mutable.
Methods in RDFTerm and its Commons RDF specialisations
IRI, BlankNode and Literal are
thread-safe, however further specialisations may add
additional methods that are documented to not be thread-safe.
RDFTerms can be safely used in hashing collections like
HashSet and HashMap.
Any RDFTerm can be used interchangeably across Commons RDF
implementations.
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object other)
Check it this RDFTerm is equal to another RDFTerm.
|
int |
hashCode()
Calculate a hash code for this RDFTerm.
|
String |
ntriplesString()
Return the term serialised as specified by the RDF-1.1 N-Triples
Canonical form.
|
String ntriplesString()
boolean equals(Object other)
If this object is an IRI, equality is checked using
IRI.equals(Object), or if this object is a BlankNode,
equality is checked using BlankNode.equals(Object), or if this
object is a Literal, equality is checked using
Literal.equals(Object).
Implementations MUST also override hashCode() so that two equal
Literals produce the same hash code.
equals in class Objectother - Another objectIRI.equals(Object),
BlankNode.equals(Object),
Literal.equals(Object)int hashCode()
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
equals(Object) so that two equal RDFTerm produce the same hash
code.
hashCode in class ObjectIRI.hashCode(),
Literal.hashCode(),
BlankNode.hashCode()Copyright © 2015–2018 The Apache Software Foundation. All rights reserved.