Package org.apache.commons.rdf.simple
Class TripleImpl
java.lang.Object
org.apache.commons.rdf.simple.TripleImpl
- All Implemented Interfaces:
Triple
,TripleLike
A simple implementation of Triple.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTripleImpl
(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) Construct Triple from its constituent parts. -
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.toString()
-
Field Details
-
subject
-
predicate
-
object
-
-
Constructor Details
-
TripleImpl
Construct Triple from its constituent parts.The objects are not changed. All mapping of BNode objects is done in
SimpleRDF.createTriple(BlankNodeOrIRI, IRI, RDFTerm)
.- Parameters:
subject
- subject of triplepredicate
- predicate of tripleobject
- object of triple
-
-
Method Details
-
getSubject
Description copied from interface:Triple
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 interfaceTriple
- Specified by:
getSubject
in interfaceTripleLike
- Returns:
- The subject
BlankNodeOrIRI
of this triple. - See Also:
-
getPredicate
Description copied from interface:Triple
The predicateIRI
of this triple.- Specified by:
getPredicate
in interfaceTriple
- Specified by:
getPredicate
in interfaceTripleLike
- Returns:
- The predicate
IRI
of this triple. - See Also:
-
getObject
Description copied from interface:Triple
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 interfaceTriple
- Specified by:
getObject
in interfaceTripleLike
- Returns:
- The object
RDFTerm
of this triple. - See Also:
-
toString
-
hashCode
public int hashCode()Description copied from interface:Triple
Calculate a hash code for this Triple.The returned hash code MUST be equal to the result of
Objects.hash(Object...)
with the argumentsTriple.getSubject()
,Triple.getPredicate()
,Triple.getObject()
.This method MUST be implemented in conjunction with
Triple.equals(Object)
so that two equalTriple
s produce the same hash code. -
equals
Description copied from interface:Triple
Check it this Triple is equal to another Triple.Two Triples are equal if and only if their
Triple.getSubject()
,Triple.getPredicate()
andTriple.getObject()
are equal.Implementations MUST also override
Triple.hashCode()
so that two equal Triples produce the same hash code.
-