RDF.Literal.new-exclamation-mark
You're seeing just the function
new-exclamation-mark
, go back to RDF.Literal module for more information.
Specs
Creates a new RDF.Literal
, but fails if it's not valid.
Note: Validation is only possible if an RDF.Datatype
with an implementation of
RDF.Datatype.valid?/1
exists.
Examples
iex> RDF.Literal.new("foo")
%RDF.Literal{literal: %RDF.XSD.String{value: "foo"}}
iex> RDF.Literal.new!("foo", datatype: RDF.NS.XSD.integer)
** (RDF.Literal.InvalidError) invalid RDF.Literal: %RDF.Literal{literal: %RDF.XSD.Integer{value: nil, lexical: "foo"}, valid: false}
iex> RDF.Literal.new!("foo", datatype: RDF.langString)
** (RDF.Literal.InvalidError) invalid RDF.Literal: %RDF.Literal{literal: %RDF.LangString{language: nil, value: "foo"}, valid: false}