Package com.apicatalog.rdf.model
Interface RdfTerm
-
- All Known Subinterfaces:
RdfLiteral,RdfQuad,RdfResource,RdfTriple
- All Known Implementing Classes:
LangString,Literal,Quad,Resource,Triple
public interface RdfTermRepresents the value of an RDF statement.An
RdfTermcan be one of the following:- An absolute IRI or a blank node identifier (
RdfResource) - An RDF literal (
RdfLiteral) - An RDF triple, representing RDF-star (RDF 1.2) embedded triples
(
RdfTriple)
This interface provides type-checking methods to determine the specific kind of RDF term, as well as casting methods that allow safe access to the underlying representation.
- See Also:
- RDF 1.1 Term, RDF 1.2 (RDF-star)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default RdfLiteralasLiteral()Returns this term as anRdfLiteral.default RdfResourceasResource()Returns this term as anRdfResource.default RdfTripleasTriple()Returns this term as anRdfTriple.booleanequals(java.lang.Object o)Compares this RDF term to the specified object.inthashCode()Returns a hash code value for this RDF term.default booleanisLiteral()Indicates whether this term is an RDF literal.default booleanisResource()Indicates whether this term is a resource, which includes absolute IRIs and blank node identifiers.default booleanisTriple()Indicates whether this term is an RDF triple.java.lang.StringtoString()Returns a string representation of this RDF term.
-
-
-
Method Detail
-
isLiteral
default boolean isLiteral()
Indicates whether this term is an RDF literal.- Returns:
trueif the term is anRdfLiteral;falseotherwise.
-
isResource
default boolean isResource()
Indicates whether this term is a resource, which includes absolute IRIs and blank node identifiers.- Returns:
trueif the term is anRdfResource;falseotherwise.
-
isTriple
default boolean isTriple()
Indicates whether this term is an RDF triple.RDF triples are supported for RDF-star (RDF 1.2) compatibility.
- Returns:
trueif the term is anRdfTriple;falseotherwise.
-
asLiteral
default RdfLiteral asLiteral()
Returns this term as anRdfLiteral.- Returns:
- the
RdfLiteralrepresentation of this term. - Throws:
java.lang.ClassCastException- if this term is not anRdfLiteral.
-
asResource
default RdfResource asResource()
Returns this term as anRdfResource.- Returns:
- the
RdfResourcerepresentation of this term. - Throws:
java.lang.ClassCastException- if this term is not anRdfResource.
-
equals
boolean equals(java.lang.Object o)
Compares this RDF term to the specified object. Implementations must override this method to provide equality checks appropriate to the term type.- Overrides:
equalsin classjava.lang.Object- Parameters:
o- the object to compare with this term.- Returns:
trueif the specified object is equal to this term;falseotherwise.
-
hashCode
int hashCode()
Returns a hash code value for this RDF term.- Overrides:
hashCodein classjava.lang.Object- Returns:
- a hash code consistent with
equals(Object).
-
toString
java.lang.String toString()
Returns a string representation of this RDF term.- Overrides:
toStringin classjava.lang.Object- Returns:
- a string describing this RDF term.
-
-