Interface Triple
- All Superinterfaces:
TripleLike
- All Known Subinterfaces:
JsonLdTriple
,RDF4JTriple
- All Known Implementing Classes:
JsonLdTripleImpl
,TripleImpl
,TripleImpl
A Triple
object in Commons RDF is considered
immutable, that is, over its life time it will have
consistent behaviour for its equals(Object)
, and the RDFTerm
instances returned from getSubject()
, getPredicate()
and
getObject()
will have consistent RDFTerm.equals(Object)
behaviour.
Note that Triple
methods are not required to return object
identical (==
) instances as long as they are equivalent
according to RDFTerm.equals(Object)
. Specialisations of
Triple
may provide additional methods that are documented to be
mutable.
Triple
methods are thread-safe, however
specialisations may provide additional methods that are documented to not be
thread-safe.
Triple
s can be safely used in hashing collections like
HashSet
and HashMap
.
Any Triple
can be used interchangeably across Commons RDF
implementations.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Check it this Triple is equal to another Triple.The predicateIRI
of this triple.The subject of this triple, which may be either aBlankNode
or anIRI
, which are represented in Commons RDF by the interfaceBlankNodeOrIRI
.int
hashCode()
Calculate a hash code for this Triple.
-
Method Details
-
getSubject
BlankNodeOrIRI getSubject()The subject of this triple, which may be either aBlankNode
or anIRI
, which are represented in Commons RDF by the interfaceBlankNodeOrIRI
.- Specified by:
getSubject
in interfaceTripleLike
- Returns:
- The subject
BlankNodeOrIRI
of this triple. - See Also:
-
getPredicate
IRI getPredicate()The predicateIRI
of this triple.- Specified by:
getPredicate
in interfaceTripleLike
- Returns:
- The predicate
IRI
of this triple. - See Also:
-
getObject
RDFTerm getObject()The object of this triple, which may be either aBlankNode
, anIRI
, or aLiteral
, which are represented in Commons RDF by the interfaceRDFTerm
.- Specified by:
getObject
in interfaceTripleLike
- Returns:
- The object
RDFTerm
of this triple. - See Also:
-
equals
Check it this Triple is equal to another Triple.Two Triples are equal if and only if their
getSubject()
,getPredicate()
andgetObject()
are equal.Implementations MUST also override
hashCode()
so that two equal Triples produce the same hash code. -
hashCode
int hashCode()Calculate a hash code for this Triple.The returned hash code MUST be equal to the result of
Objects.hash(Object...)
with the argumentsgetSubject()
,getPredicate()
,getObject()
.This method MUST be implemented in conjunction with
equals(Object)
so that two equalTriple
s produce the same hash code.
-