Interface RDFTerm
-
- All Known Subinterfaces:
BlankNode
,BlankNodeOrIRI
,IRI
,JsonLdBlankNode
,JsonLdIRI
,JsonLdLiteral
,JsonLdTerm
,Literal
,RDF4JBlankNode
,RDF4JBlankNodeOrIRI
,RDF4JIRI
,RDF4JLiteral
,RDF4JTerm
,SimpleRDF.SimpleRDFTerm
- All Known Implementing Classes:
AbstractRDFTerm
,BlankNodeImpl
,BlankNodeImpl
,IRIImpl
,IRIImpl
,JsonLdBlankNodeImpl
,JsonLdIRIImpl
,JsonLdLiteralImpl
,JsonLdTermImpl
,LiteralImpl
,LiteralImpl
,Types
,W3CRDFSyntax.FormatIRI
public interface RDFTerm
An RDF-1.1 Term, as defined by RDF-1.1 Concepts and Abstract Syntax, a W3C Recommendation published on 25 February 2014.A
RDFTerm
object in Commons RDF is considered immutable, that is, over its life time it will have consistent behaviour for itsequals(Object)
andhashCode()
, and objects returned from its getter methods (e.g.IRI.getIRIString()
andLiteral.getLanguageTag()
) will have consistentequals(Object)
behaviour.Note that methods in
RDFTerm
and its Commons RDF specialisationsIRI
,BlankNode
andLiteral
are not required to return object identical (==
) instances as long as they are equivalent according to theirObject.equals(Object)
. Further specialisations may provide additional methods that are documented to be mutable.Methods in
RDFTerm
and its Commons RDF specialisationsIRI
,BlankNode
andLiteral
are thread-safe, however further specialisations may add additional methods that are documented to not be thread-safe.RDFTerm
s can be safely used in hashing collections likeHashSet
andHashMap
.Any
RDFTerm
can be used interchangeably across Commons RDF implementations.- See Also:
- RDF-1.1 Term
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
equals(java.lang.Object other)
Check it this RDFTerm is equal to another RDFTerm.int
hashCode()
Calculate a hash code for this RDFTerm.java.lang.String
ntriplesString()
Return the term serialised as specified by the RDF-1.1 N-Triples Canonical form.
-
-
-
Method Detail
-
ntriplesString
java.lang.String ntriplesString()
Return the term serialised as specified by the RDF-1.1 N-Triples Canonical form.- Returns:
- The term serialised as RDF-1.1 N-Triples.
- See Also:
- RDF-1.1 N-Triples Canonical form
-
equals
boolean equals(java.lang.Object other)
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
hashCode()
so that two equal Literals produce the same hash code.- Overrides:
equals
in classjava.lang.Object
- Parameters:
other
- 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
int hashCode()
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
equals(Object)
so that two equal RDFTerm produce the same hash code.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- a hash code value for this RDFTerm.
- See Also:
IRI.hashCode()
,Literal.hashCode()
,BlankNode.hashCode()
-
-