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.

see http://www.w3.org/TR/rdf-concepts/#dfn-typed-literal

Returns if a literal is a language-tagged literal.

see http://www.w3.org/TR/rdf-concepts/#dfn-plain-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 datatypeXSD datatype
stringxsd:string
booleanxsd:boolean
integerxsd:integer
floatxsd:double
Timexsd:time
Datexsd:date
DateTimexsd:dateTime
NaiveDateTimexsd: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.

see http://www.w3.org/TR/rdf-concepts/#dfn-plain-literal

Returns if a literal is a simple literal.

A simple literal has no datatype or language.

see http://www.w3.org/TR/sparql11-query/#simple_literal

Returns if the value of the given literal is a valid according to its datatype.