Class JsonLdLiteralImpl
- java.lang.Object
-
- org.apache.commons.rdf.jsonldjava.JsonLdTermImpl
-
- org.apache.commons.rdf.jsonldjava.JsonLdLiteralImpl
-
- All Implemented Interfaces:
Literal,RDFTerm,JsonLdLiteral,JsonLdTerm
class JsonLdLiteralImpl extends JsonLdTermImpl implements JsonLdLiteral
-
-
Field Summary
-
Fields inherited from class org.apache.commons.rdf.jsonldjava.JsonLdTermImpl
node
-
-
Constructor Summary
Constructors Constructor Description JsonLdLiteralImpl(com.github.jsonldjava.core.RDFDataset.Node node)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Check it this RDFTerm is equal to another RDFTerm.IRIgetDatatype()The IRI identifying the datatype that determines how the lexical form maps to a literal value.java.util.Optional<java.lang.String>getLanguageTag()If and only if the datatype IRI is http://www.w3.org/1999/02/22-rdf-syntax-ns#langString, the language tag for this Literal is a non-empty language tag as defined by BCP47.
If the datatype IRI is not http://www.w3.org/1999/02/22-rdf-syntax-ns#langString, this method must returnOptional.empty().java.lang.StringgetLexicalForm()The lexical form of this literal, represented by a Unicode string.inthashCode()Calculate a hash code for this RDFTerm.private static java.lang.StringlowerCase(java.lang.String langTag)java.lang.StringntriplesString()Return the term serialised as specified by the RDF-1.1 N-Triples Canonical form.-
Methods inherited from class org.apache.commons.rdf.jsonldjava.JsonLdTermImpl
asJsonLdNode, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.commons.rdf.jsonldjava.JsonLdTerm
asJsonLdNode
-
-
-
-
Method Detail
-
lowerCase
private static java.lang.String lowerCase(java.lang.String langTag)
-
ntriplesString
public java.lang.String ntriplesString()
Description copied from interface:RDFTermReturn the term serialised as specified by the RDF-1.1 N-Triples Canonical form.- Specified by:
ntriplesStringin interfaceRDFTerm- Returns:
- The term serialised as RDF-1.1 N-Triples.
- See Also:
- RDF-1.1 N-Triples Canonical form
-
getLexicalForm
public java.lang.String getLexicalForm()
Description copied from interface:LiteralThe lexical form of this literal, represented by a Unicode string.- Specified by:
getLexicalFormin interfaceLiteral- Returns:
- The lexical form of this literal.
- See Also:
- RDF-1.1 Literal lexical form
-
getDatatype
public IRI getDatatype()
Description copied from interface:LiteralThe IRI identifying the datatype that determines how the lexical form maps to a literal value. If the datatype IRI is http://www.w3.org/1999/02/22-rdf-syntax-ns#langString,Literal.getLanguageTag()must not returnOptional.empty(), and it must return a valid BCP47 language tag.- Specified by:
getDatatypein interfaceLiteral- Returns:
- The datatype IRI for this literal.
- See Also:
- RDF-1.1 Literal datatype IRI
-
getLanguageTag
public java.util.Optional<java.lang.String> getLanguageTag()
Description copied from interface:LiteralIf and only if the datatype IRI is http://www.w3.org/1999/02/22-rdf-syntax-ns#langString, the language tag for this Literal is a non-empty language tag as defined by BCP47.
If the datatype IRI is not http://www.w3.org/1999/02/22-rdf-syntax-ns#langString, this method must returnOptional.empty().The value space of language tags is always in lower case; although RDF implementations MAY convert all language tags to lower case, safe comparisons of language tags should be done using
String.toLowerCase(Locale)with the localeLocale.ROOT.Implementation note: If your application requires
Serializableobjects, it is best not to store anOptionalin a field. It is recommended to useOptional.ofNullable(Object)to create the return value for this method.- Specified by:
getLanguageTagin interfaceLiteral- Returns:
- The
Optionallanguage tag for this literal. IfOptional.isPresent()returns true, the value returned byOptional.get()must be a non-empty language tag string conforming to BCP47. - See Also:
- RDF-1.1 Literal language tag
-
hashCode
public int hashCode()
Description copied from interface:RDFTermCalculate a hash code for this RDFTerm.As an
RDFTermis immutable, this method will always return the same hashCode over the lifetime of this object.This method MUST be implemented in conjunction with
RDFTerm.equals(Object)so that two equal RDFTerm produce the same hash code.- Specified by:
hashCodein interfaceLiteral- Specified by:
hashCodein interfaceRDFTerm- Overrides:
hashCodein classjava.lang.Object- Returns:
- a hash code value for this RDFTerm.
- See Also:
IRI.hashCode(),Literal.hashCode(),BlankNode.hashCode()
-
equals
public boolean equals(java.lang.Object obj)
Description copied from interface:RDFTermCheck it this RDFTerm is equal to another RDFTerm.If this object is an
IRI, equality is checked usingIRI.equals(Object), or if this object is aBlankNode, equality is checked usingBlankNode.equals(Object), or if this object is aLiteral, equality is checked usingLiteral.equals(Object).Implementations MUST also override
RDFTerm.hashCode()so that two equal Literals produce the same hash code.- Specified by:
equalsin interfaceLiteral- Specified by:
equalsin interfaceRDFTerm- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- Another object- Returns:
- true if other is a RDFTerm and is equal to this
- See Also:
IRI.equals(Object),BlankNode.equals(Object),Literal.equals(Object)
-
-