RDF.Literal.coerce
You're seeing just the function
coerce
, go back to RDF.Literal module for more information.
Coerces a new RDF.Literal
from another value.
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 |
Decimal | xsd:decimal |
Time | xsd:time |
Date | xsd:date |
DateTime | xsd:dateTime |
NaiveDateTime | xsd:dateTime |
URI | xsd:AnyURI |
When an RDF.Literal
can not be coerced, nil
is returned
(as opposed to new/1
which fails in this case).
Examples
iex> RDF.Literal.coerce(42)
%RDF.Literal{literal: %RDF.XSD.Integer{value: 42}}