Package com.apicatalog.rdf.primitive
Class LangString
- java.lang.Object
-
- com.apicatalog.rdf.primitive.Literal
-
- com.apicatalog.rdf.primitive.LangString
-
- All Implemented Interfaces:
RdfLiteral,RdfTerm
public class LangString extends Literal implements RdfLiteral
Represents an RDF language-tagged string.A
LangStringis an RDF literal that consists of a lexical value (the value of the literal), a datatype, an optional language tag, and an optional direction (left-to-right or right-to-left). It implements theRdfLiteralinterface and provides methods for retrieving the lexical value, datatype, language tag, and direction of the language-tagged string.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.apicatalog.rdf.model.RdfLiteral
RdfLiteral.Direction
-
-
Field Summary
Fields Modifier and Type Field Description (package private) RdfLiteral.Directiondirection(package private) java.lang.StringlangTag-
Fields inherited from class com.apicatalog.rdf.primitive.Literal
datatype, lexicalValue
-
-
Constructor Summary
Constructors Constructor Description LangString(java.lang.String lexicalValue, java.lang.String datatype, java.lang.String langTag, RdfLiteral.Direction direction)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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).booleanequals(java.lang.Object obj)Compares this RDF term to the specified object.inthashCode()Returns a hash code value for this RDF term.java.util.Optional<java.lang.String>language()Returns an optional language tag associated with the literal.static LangStringof(java.lang.String lexicalValue, java.lang.String datatype, java.lang.String langTag)Factory method to create aLangStringwith the specified lexical value, datatype, and language tag.static LangStringof(java.lang.String lexicalValue, java.lang.String datatype, java.lang.String langTag, RdfLiteral.Direction direction)Factory method to create aLangStringwith the specified lexical value, datatype, language tag, and direction.static LangStringof(java.lang.String lexicalValue, java.lang.String datatype, java.lang.String langTag, java.lang.String direction)Factory method to create aLangStringwith the specified lexical value, datatype, language tag, and direction.java.lang.StringtoString()Returns a string representation of this RDF term.-
Methods inherited from class com.apicatalog.rdf.primitive.Literal
datatype, lexicalValue, of
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.apicatalog.rdf.model.RdfLiteral
asLiteral, datatype, isLiteral, lexicalValue
-
Methods inherited from interface com.apicatalog.rdf.model.RdfTerm
asResource, asTriple, isResource, isTriple
-
-
-
-
Field Detail
-
langTag
final java.lang.String langTag
-
direction
final RdfLiteral.Direction direction
-
-
Constructor Detail
-
LangString
LangString(java.lang.String lexicalValue, java.lang.String datatype, java.lang.String langTag, RdfLiteral.Direction direction)
-
-
Method Detail
-
of
public static LangString of(java.lang.String lexicalValue, java.lang.String datatype, java.lang.String langTag)
Factory method to create aLangStringwith the specified lexical value, datatype, and language tag.- Parameters:
lexicalValue- the lexical value of the language-tagged stringdatatype- the datatype of the literal (e.g.,rdf:langString)langTag- the language tag (e.g., "en", "fr")- Returns:
- a new
LangStringinstance
-
of
public static LangString of(java.lang.String lexicalValue, java.lang.String datatype, java.lang.String langTag, java.lang.String direction)
Factory method to create aLangStringwith the specified lexical value, datatype, language tag, and direction.- Parameters:
lexicalValue- the lexical value of the language-tagged stringdatatype- the datatype of the literal (e.g.,rdf:langString)langTag- the language tag (e.g., "en", "fr")direction- the text direction (LTR or RTL)- Returns:
- a new
LangStringinstance
-
of
public static LangString of(java.lang.String lexicalValue, java.lang.String datatype, java.lang.String langTag, RdfLiteral.Direction direction)
Factory method to create aLangStringwith the specified lexical value, datatype, language tag, and direction.- Parameters:
lexicalValue- the lexical value of the language-tagged stringdatatype- the datatype of the literal (e.g.,rdf:langString)langTag- the language tag (e.g., "en", "fr")direction- the text direction (LTR or RTL)- Returns:
- a new
LangStringinstance
-
language
public java.util.Optional<java.lang.String> language()
Description copied from interface:RdfLiteralReturns 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().- Specified by:
languagein interfaceRdfLiteral- Overrides:
languagein classLiteral- Returns:
- an
Optionalcontaining the language tag if present, orOptional.empty()if not set
-
direction
public java.util.Optional<RdfLiteral.Direction> direction()
Description copied from interface:RdfLiteralReturns the direction of the literal, which can be either left-to-right (LTR) or right-to-left (RTL).- Specified by:
directionin interfaceRdfLiteral- Overrides:
directionin classLiteral- Returns:
- an
Optionalcontaining the direction if present, orOptional.empty()if not set
-
hashCode
public int hashCode()
Description copied from interface:RdfTermReturns a hash code value for this RDF term.- Specified by:
hashCodein interfaceRdfTerm- Overrides:
hashCodein classLiteral- Returns:
- a hash code consistent with
RdfTerm.equals(Object).
-
equals
public boolean equals(java.lang.Object obj)
Description copied from interface:RdfTermCompares this RDF term to the specified object. Implementations must override this method to provide equality checks appropriate to the term type.
-
-