RDF.ex v0.4.0 RDF.Literal View Source
RDF literals are leaf nodes of a RDF graph containing raw data, like strings and numbers.
Link to this section Summary
Functions
Returns the given literal in its canonical lexical representation
Returns if the given literal is in its canonical lexical representation
Returns if a literal is a datatyped literal
Returns if a literal is a language-tagged literal
Returns the given literal with the canonical lexical representation according to its datatype
Creates a new RDF.Literal
of the given value and tries to infer an appropriate XSD datatype
Returns if a literal is a plain literal
Returns if a literal is a simple literal
Returns if the value of the given literal is a valid according to its datatype
Link to this section Types
Link to this section Functions
Returns the given literal in its canonical lexical representation.
Returns if the given literal is in its canonical lexical representation.
Returns if a literal is a datatyped literal.
For historical reasons, this excludes xsd:string
and rdf:langString
.
Returns if a literal is a language-tagged literal.
Returns the given literal with the canonical lexical representation according to its datatype.
Creates a new RDF.Literal
of the given value and tries to infer an appropriate XSD datatype.
Note: The RDF.literal
function is a shortcut to this function.
The following mapping of Elixir types to XSD datatypes is applied:
Elixir datatype | XSD datatype |
---|---|
string | xsd:string |
boolean | xsd:boolean |
integer | xsd:integer |
float | xsd:double |
Time | xsd:time |
Date | xsd:date |
DateTime | xsd:dateTime |
NaiveDateTime | xsd:dateTime |
Examples
iex> RDF.Literal.new(42)
%RDF.Literal{value: 42, datatype: XSD.integer}
Returns if a literal is a plain literal.
A plain literal may have a language, but may not have a datatype.
For all practical purposes, this includes xsd:string
literals too.
Returns if a literal is a simple literal.
A simple literal has no datatype or language.
Returns if the value of the given literal is a valid according to its datatype.