Class JsonLdLiteralImpl
- All Implemented Interfaces:
Literal
,RDFTerm
,JsonLdLiteral
,JsonLdTerm
-
Field Summary
Fields inherited from class org.apache.commons.rdf.jsonldjava.JsonLdTermImpl
node
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Check it this RDFTerm is equal to another RDFTerm.The IRI identifying the datatype that determines how the lexical form maps to a literal value.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()
.The lexical form of this literal, represented by a Unicode string.int
hashCode()
Calculate a hash code for this RDFTerm.private static String
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
-
Constructor Details
-
JsonLdLiteralImpl
JsonLdLiteralImpl(com.github.jsonldjava.core.RDFDataset.Node node)
-
-
Method Details
-
lowerCase
-
ntriplesString
Description copied from interface:RDFTerm
Return the term serialised as specified by the RDF-1.1 N-Triples Canonical form.- Specified by:
ntriplesString
in interfaceRDFTerm
- Returns:
- The term serialised as RDF-1.1 N-Triples.
- See Also:
-
getLexicalForm
Description copied from interface:Literal
The lexical form of this literal, represented by a Unicode string.- Specified by:
getLexicalForm
in interfaceLiteral
- Returns:
- The lexical form of this literal.
- See Also:
-
getDatatype
Description copied from interface:Literal
The 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:
getDatatype
in interfaceLiteral
- Returns:
- The datatype IRI for this literal.
- See Also:
-
getLanguageTag
Description copied from interface:Literal
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()
.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
Serializable
objects, it is best not to store anOptional
in a field. It is recommended to useOptional.ofNullable(Object)
to create the return value for this method.- Specified by:
getLanguageTag
in interfaceLiteral
- Returns:
- The
Optional
language 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:
-
hashCode
public int hashCode()Description copied from interface:RDFTerm
Calculate a hash code for this RDFTerm.As an
RDFTerm
is 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. -
equals
Description copied from interface:RDFTerm
Check 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.
-