Interface Triple
-
- All Superinterfaces:
TripleLike
- All Known Subinterfaces:
JsonLdTriple,RDF4JTriple
- All Known Implementing Classes:
JsonLdTripleImpl,TripleImpl,TripleImpl
public interface Triple extends TripleLike
An RDF-1.1 Triple, as defined by RDF-1.1 Concepts and Abstract Syntax, a W3C Recommendation published on 25 February 2014.A
Tripleobject in Commons RDF is considered immutable, that is, over its life time it will have consistent behaviour for itsequals(Object), and theRDFTerminstances returned fromgetSubject(),getPredicate()andgetObject()will have consistentRDFTerm.equals(Object)behaviour.Note that
Triplemethods are not required to return object identical (==) instances as long as they are equivalent according toRDFTerm.equals(Object). Specialisations ofTriplemay provide additional methods that are documented to be mutable.Triplemethods 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 likeHashSetandHashMap.Any
Triplecan be used interchangeably across Commons RDF implementations.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanequals(java.lang.Object other)Check it this Triple is equal to another Triple.RDFTermgetObject()IRIgetPredicate()The predicateIRIof this triple.BlankNodeOrIRIgetSubject()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 Detail
-
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:
- RDF-1.1 Triple subject
-
getPredicate
IRI getPredicate()
The predicateIRIof this triple.- Specified by:
getPredicatein interfaceTripleLike- Returns:
- The predicate
IRIof this triple. - See Also:
- RDF-1.1 Triple predicate
-
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:
getObjectin interfaceTripleLike- Returns:
- The object
RDFTermof this triple. - See Also:
- RDF-1.1 Triple object
-
equals
boolean equals(java.lang.Object other)
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.- Overrides:
equalsin classjava.lang.Object- Parameters:
other- Another object- Returns:
- true if other is a Triple and is equal to this
- See Also:
Object.equals(Object)
-
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.- Overrides:
hashCodein classjava.lang.Object- Returns:
- a hash code value for this Triple.
- See Also:
Object.hashCode(),Objects.hash(Object...)
-
-