Package org.apache.commons.rdf.simple
Class TripleImpl
- java.lang.Object
-
- org.apache.commons.rdf.simple.TripleImpl
-
- All Implemented Interfaces:
Triple,TripleLike
final class TripleImpl extends java.lang.Object implements Triple
A simple implementation of Triple.
-
-
Constructor Summary
Constructors Constructor Description TripleImpl(BlankNodeOrIRI subject, IRI predicate, RDFTerm object)Construct Triple from its constituent parts.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)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.java.lang.StringtoString()
-
-
-
Field Detail
-
subject
private final BlankNodeOrIRI subject
-
predicate
private final IRI predicate
-
object
private final RDFTerm object
-
-
Constructor Detail
-
TripleImpl
public TripleImpl(BlankNodeOrIRI subject, IRI predicate, RDFTerm object)
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 Detail
-
getSubject
public BlankNodeOrIRI getSubject()
Description copied from interface:TripleThe subject of this triple, which may be either aBlankNodeor anIRI, which are represented in Commons RDF by the interfaceBlankNodeOrIRI.- Specified by:
getSubjectin interfaceTriple- Specified by:
getSubjectin interfaceTripleLike- Returns:
- The subject
BlankNodeOrIRIof this triple. - See Also:
- RDF-1.1 Triple subject
-
getPredicate
public IRI getPredicate()
Description copied from interface:TripleThe predicateIRIof this triple.- Specified by:
getPredicatein interfaceTriple- Specified by:
getPredicatein interfaceTripleLike- Returns:
- The predicate
IRIof this triple. - See Also:
- RDF-1.1 Triple predicate
-
getObject
public RDFTerm getObject()
Description copied from interface:TripleThe object of this triple, which may be either aBlankNode, anIRI, or aLiteral, which are represented in Commons RDF by the interfaceRDFTerm.- Specified by:
getObjectin interfaceTriple- Specified by:
getObjectin interfaceTripleLike- Returns:
- The object
RDFTermof this triple. - See Also:
- RDF-1.1 Triple object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
Description copied from interface:TripleCalculate 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 equalTriples produce the same hash code.
-
equals
public boolean equals(java.lang.Object obj)
Description copied from interface:TripleCheck 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.
-
-