RDF.Literal.Datatype.update
You're seeing just the callback
update
, go back to RDF.Literal.Datatype module for more information.
Specs
update(RDF.Literal.t() | literal(), (... -> any())) :: RDF.Literal.t()
Updates the value of a RDF.Literal
without changing everything else.
Example
iex> RDF.XSD.integer(42) |> RDF.XSD.Integer.update(fn value -> value + 1 end)
RDF.XSD.integer(43)
iex> ~L"foo"de |> RDF.LangString.update(fn _ -> "bar" end)
~L"bar"de
iex> RDF.literal("foo", datatype: "http://example.com/dt") |> RDF.Literal.Generic.update(fn _ -> "bar" end)
RDF.literal("bar", datatype: "http://example.com/dt")
Specs
update(RDF.Literal.t() | literal(), (... -> any()), keyword()) :: RDF.Literal.t()
Updates the value of a RDF.Literal
without changing anything else.
This variant of update/2
allows with the :as
option to specify what will
be passed to fun
, eg. with as: :lexical
the lexical is passed to the function.
Example
iex> RDF.XSD.integer(42) |> RDF.XSD.Integer.update(
...> fn value -> value <> "1" end, as: :lexical)
RDF.XSD.integer(421)