RDF.Literal.update

You're seeing just the function update, go back to RDF.Literal module for more information.
Link to this function

update(literal, fun, opts \\ [])

View Source

Updates the value of a RDF.Literal without changing everything else.

The optional second argument allows to specify what will be passed to fun with the :as option, eg. with as: :lexical the lexical is passed to the function.

Example

iex> RDF.XSD.integer(42) |> RDF.Literal.update(fn value -> value + 1 end)
RDF.XSD.integer(43)
iex> ~L"foo"de |> RDF.Literal.update(fn _ -> "bar" end)
~L"bar"de
iex> RDF.literal("foo", datatype: "http://example.com/dt") |> RDF.Literal.update(fn _ -> "bar" end)
RDF.literal("bar", datatype: "http://example.com/dt")
iex> RDF.XSD.integer(42) |> RDF.XSD.Integer.update(
...>   fn value -> value <> "1" end, as: :lexical)
RDF.XSD.integer(421)