Class SimpleTripleTerm
java.lang.Object
org.eclipse.rdf4j.model.base.AbstractTripleTerm
org.eclipse.rdf4j.model.impl.SimpleTripleTerm
- All Implemented Interfaces:
Serializable, TripleTerm, Value
A simple default implementation of the
TripleTerm interface.- Author:
- Pavel Mihaylov
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface Value
Value.Type -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSimpleTripleTerm(Resource subject, IRI predicate, Value object) Creates a new TripleTerm with the supplied subject, predicate and object. -
Method Summary
Methods inherited from interface TripleTerm
getType, isTripleTermModifier and TypeMethodDescriptiondefault Value.TypegetType()default booleanCheck if the object is an instance of the given type.Methods inherited from interface Value
isBNode, isIRI, isLiteral, isResourceModifier and TypeMethodDescriptiondefault booleanisBNode()Check if the object is an instance of the given type.default booleanisIRI()Check if the object is an instance of the given type.default booleanCheck if the object is an instance of the given type.default booleanCheck if the object is an instance of the given type.
-
Constructor Details
-
SimpleTripleTerm
Creates a new TripleTerm with the supplied subject, predicate and object.Note that creating SimpleStatement objects directly via this constructor is not the recommended approach. Instead, use an instance of
ValueFactoryto create new TripleTerm objects.- Parameters:
subject- The triple's subject, must not be null.predicate- The triple's predicate, must not be null.object- The triple's object, must not be null.- See Also:
-
-
Method Details
-
getSubject
Description copied from interface:TripleTermGets the subject of this triple.- Returns:
- The triple's subject.
-
getPredicate
Description copied from interface:TripleTermGets the predicate of this triple.- Returns:
- The triple's predicate.
-
getObject
Description copied from interface:TripleTermGets the object of this triple.- Returns:
- The triple's object.
-
stringValue
Description copied from interface:ValueReturns the String-value of a Value object. This returns either aLiteral's label, aIRI's URI or aBNode's ID.- Specified by:
stringValuein interfaceValue- Overrides:
stringValuein classAbstractTripleTerm
-
toString
- Overrides:
toStringin classAbstractTripleTerm
-
equals
Description copied from interface:TripleTermCompares this triple to another object.- Specified by:
equalsin interfaceTripleTerm- Overrides:
equalsin classAbstractTripleTerm- Parameters:
o- the object to compare this triple to- Returns:
trueif theotherobject is an instance ofTripleTermand if their subjects, predicates and objects are equal;falseotherwise
-
hashCode
public int hashCode()Description copied from interface:TripleTermComputes the hash code of this triple.- Specified by:
hashCodein interfaceTripleTerm- Overrides:
hashCodein classAbstractTripleTerm- Returns:
- a hash code for this triple computed as
Objects.hash(TripleTerm.getSubject(),TripleTerm.getPredicate(),TripleTerm.getObject())
-