Class QuadImpl
- java.lang.Object
-
- org.apache.commons.rdf.rdf4j.impl.QuadImpl
-
- All Implemented Interfaces:
Quad,QuadLike<BlankNodeOrIRI>,TripleLike,RDF4JQuad,RDF4JTripleLike
final class QuadImpl extends java.lang.Object implements RDF4JQuad
-
-
Constructor Summary
Constructors Constructor Description QuadImpl(org.eclipse.rdf4j.model.Statement statement, java.util.UUID salt)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.eclipse.rdf4j.model.StatementasStatement()Return the corresponding RDF4JStatement.TripleasTriple()Adapt this Quad to a Triple.booleanequals(java.lang.Object obj)Check it this Quad is equal to another Quad.java.util.Optional<BlankNodeOrIRI>getGraphName()The graph name (graph label) of this quad, if present.RDFTermgetObject()IRIgetPredicate()The predicateIRIof this quad.BlankNodeOrIRIgetSubject()The subject of this quad, which may be either aBlankNodeor anIRI, which are represented in Commons RDF by the interfaceBlankNodeOrIRI.inthashCode()Calculate a hash code for this Quad.java.lang.StringtoString()
-
-
-
Method Detail
-
asStatement
public org.eclipse.rdf4j.model.Statement asStatement()
Description copied from interface:RDF4JTripleLikeReturn the corresponding RDF4JStatement.- Specified by:
asStatementin interfaceRDF4JTripleLike- Returns:
- The corresponding RDF4J Statement.
-
asTriple
public Triple asTriple()
Description copied from interface:QuadAdapt this Quad to a Triple.The returned
Triplewill have equivalent values returned from the methodsTripleLike.getSubject(),TripleLike.getPredicate()andTripleLike.getObject().The returned
TripleMUST NOT beQuad.equals(Object)to thisQuad, even if this quad has a default graphQuad.getGraphName()value ofOptional.empty(), but MUST follow theTriple.equals(Object)semantics. This means that the following MUST be true:Quad q1, q2; if (q1.equals(q2)) { assert (q1.asTriple().equals(q2.asTriple())); } else if (q1.asTriple().equals(q2.asTriple())) { assert (q1.getSubject().equals(q2.getSubject())); assert (q1.getPredicate().equals(q2.getPredicate())); assert (q1.getObject().equals(q2.getObject())); assert (!q1.getGraphName().equals(q2.getGraphName())); }Thedefaultimplementation of this method return a proxyTripleinstance that keeps a reference to thisQuadto call the underlyingTripleLikemethods, but supplies aTriplecompatible implementation ofTriple.equals(Object)andTriple.hashCode(). Implementations may override this method, e.g. for a more efficient solution.- Specified by:
asTriplein interfaceQuad- Returns:
- A
Triplethat contains the sameTripleLikeproperties as this Quad.
-
equals
public boolean equals(java.lang.Object obj)
Description copied from interface:QuadCheck it this Quad is equal to another Quad.Two Quads are equal if and only if their
Quad.getGraphName(),Quad.getSubject(),Quad.getPredicate()andQuad.getObject()are equal.Implementations MUST also override
Quad.hashCode()so that two equal Quads produce the same hash code.Note that a
QuadMUST NOT be equal to aTriple, even if this Quad'sQuad.getGraphName()isOptional.empty(). To test triple-like equivalence, callers can use:Quad q1; Triple t2; q1.asTriple().equals(t2));
-
getGraphName
public java.util.Optional<BlankNodeOrIRI> getGraphName()
Description copied from interface:QuadThe graph name (graph label) of this quad, if present. IfOptional.isPresent(), then theOptional.get()is either aBlankNodeor anIRI, indicating the graph name of this Quad. If the graph name is not present, e.g. the value isOptional.empty(), it indicates that this Quad is in the default graph.- Specified by:
getGraphNamein interfaceQuad- Specified by:
getGraphNamein interfaceQuadLike<BlankNodeOrIRI>- Returns:
- If
Optional.isPresent(), the graph nameBlankNodeOrIRIof this quad, otherwiseOptional.empty(), indicating the default graph. - See Also:
- RDF- 1.1 Dataset
-
getObject
public RDFTerm getObject()
Description copied from interface:QuadThe object of this quad, which may be either aBlankNode, anIRI, or aLiteral, which are represented in Commons RDF by the interfaceRDFTerm.- Specified by:
getObjectin interfaceQuad- Specified by:
getObjectin interfaceTripleLike- Returns:
- The object
RDFTermof this quad. - See Also:
- RDF-1.1 Triple object
-
getPredicate
public IRI getPredicate()
Description copied from interface:QuadThe predicateIRIof this quad.- Specified by:
getPredicatein interfaceQuad- Specified by:
getPredicatein interfaceTripleLike- Returns:
- The predicate
IRIof this quad. - See Also:
- RDF-1.1 Triple predicate
-
getSubject
public BlankNodeOrIRI getSubject()
Description copied from interface:QuadThe subject of this quad, which may be either aBlankNodeor anIRI, which are represented in Commons RDF by the interfaceBlankNodeOrIRI.- Specified by:
getSubjectin interfaceQuad- Specified by:
getSubjectin interfaceTripleLike- Returns:
- The subject
BlankNodeOrIRIof this quad. - See Also:
- RDF-1.1 Triple subject
-
hashCode
public int hashCode()
Description copied from interface:QuadCalculate a hash code for this Quad.The returned hash code MUST be equal to the result of
Objects.hash(Object...)with the argumentsQuad.getSubject(),Quad.getPredicate(),Quad.getObject(),Quad.getGraphName().This method MUST be implemented in conjunction with
Quad.equals(Object)so that two equalQuads produce the same hash code.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-