public interface Triple extends TripleLike
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.
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other)
Check it this Triple is equal to another Triple.
|
RDFTerm |
getObject()
|
IRI |
getPredicate()
The predicate
IRI of this triple. |
BlankNodeOrIRI |
getSubject()
The subject of this triple, which may be either a
BlankNode or an
IRI , which are represented in Commons RDF by the interface
BlankNodeOrIRI . |
int |
hashCode()
Calculate a hash code for this Triple.
|
BlankNodeOrIRI getSubject()
BlankNode
or an
IRI
, which are represented in Commons RDF by the interface
BlankNodeOrIRI
.getSubject
in interface TripleLike
BlankNodeOrIRI
of this triple.IRI getPredicate()
IRI
of this triple.getPredicate
in interface TripleLike
IRI
of this triple.RDFTerm getObject()
BlankNode
, an
IRI
, or a Literal
, which are represented in Commons RDF
by the interface RDFTerm
.getObject
in interface TripleLike
RDFTerm
of this triple.boolean equals(Object other)
Two Triples are equal if and only if their getSubject()
,
getPredicate()
and getObject()
are equal.
Implementations MUST also override hashCode()
so that two equal
Triples produce the same hash code.
equals
in class Object
other
- Another objectObject.equals(Object)
int hashCode()
The returned hash code MUST be equal to the result of
Objects.hash(Object...)
with the arguments getSubject()
,
getPredicate()
, getObject()
.
This method MUST be implemented in conjunction with
equals(Object)
so that two equal Triple
s produce the
same hash code.
hashCode
in class Object
Object.hashCode()
,
Objects.hash(Object...)
Copyright © 2015–2018 The Apache Software Foundation. All rights reserved.