Package com.apicatalog.rdf.model
Interface RdfLiteral
-
- All Superinterfaces:
RdfTerm
- All Known Implementing Classes:
LangString,Literal
public interface RdfLiteral extends RdfTerm
TheRdfLiteralinterface represents an immutable RDF literal.RDF literals are values in the RDF data model that can have an optional language tag and/or datatype. They are often used to represent strings, numbers, dates, or other literal values in RDF.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classRdfLiteral.DirectionEnumeration representing the direction of text.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default RdfLiteralasLiteral()Returns this term as anRdfLiteral.java.lang.Stringdatatype()Returns the absolute IRI denoting the datatype of the literal.java.util.Optional<RdfLiteral.Direction>direction()Returns the direction of the literal, which can be either left-to-right (LTR) or right-to-left (RTL).default booleanisLiteral()Indicates whether this term is an RDF literal.java.util.Optional<java.lang.String>language()Returns an optional language tag associated with the literal.java.lang.StringlexicalValue()Returns the lexical value of the literal.-
Methods inherited from interface com.apicatalog.rdf.model.RdfTerm
asResource, asTriple, equals, hashCode, isResource, isTriple, toString
-
-
-
-
Method Detail
-
lexicalValue
java.lang.String lexicalValue()
Returns the lexical value of the literal.The lexical value is the actual content or value of the literal as a string.
- Returns:
- the lexical value of the literal, never
null
-
datatype
java.lang.String datatype()
Returns the absolute IRI denoting the datatype of the literal.- Returns:
- the datatype IRI of the literal, never
null
-
language
java.util.Optional<java.lang.String> language()
Returns an optional language tag associated with the literal.If the literal is a language-tagged string (e.g. rdf:langString), this method returns the language tag; otherwise, it returns
Optional.empty().- Returns:
- an
Optionalcontaining the language tag if present, orOptional.empty()if not set
-
direction
java.util.Optional<RdfLiteral.Direction> direction()
Returns the direction of the literal, which can be either left-to-right (LTR) or right-to-left (RTL).- Returns:
- an
Optionalcontaining the direction if present, orOptional.empty()if not set
-
isLiteral
default boolean isLiteral()
Description copied from interface:RdfTermIndicates whether this term is an RDF literal.- Specified by:
isLiteralin interfaceRdfTerm- Returns:
trueif the term is anRdfLiteral;falseotherwise.
-
asLiteral
default RdfLiteral asLiteral()
Description copied from interface:RdfTermReturns this term as anRdfLiteral.- Specified by:
asLiteralin interfaceRdfTerm- Returns:
- the
RdfLiteralrepresentation of this term.
-
-