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.
Triples 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 TypeMethodDescriptionbooleanCheck it this Triple is equal to another Triple.The predicateIRIof this triple.The subject of this triple, which may be either aBlankNodeor anIRI, which are represented in Commons RDF by the interfaceBlankNodeOrIRI.inthashCode()Calculate a hash code for this Triple.
-
Method Details
-
getSubject
BlankNodeOrIRI getSubject()The subject of this triple, which may be either aBlankNodeor anIRI, which are represented in Commons RDF by the interfaceBlankNodeOrIRI.- Specified by:
getSubjectin interfaceTripleLike- Returns:
- The subject
BlankNodeOrIRIof this triple. - See Also:
-
getPredicate
IRI getPredicate()The predicateIRIof this triple.- Specified by:
getPredicatein interfaceTripleLike- Returns:
- The predicate
IRIof this triple. - See Also:
-
getObject
-
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 equalTriples produce the same hash code.
-