RDF.Triple.map

You're seeing just the function map, go back to RDF.Triple module for more information.

Specs

map(t(), RDF.Statement.term_mapping()) :: t_values() | nil

Returns a triple where each element from a RDF.Triple is mapped with the given function.

Returns nil if one of the components of the given tuple is not convertible via RDF.Term.value/1.

The function fun will receive a tuple {statement_position, rdf_term} where statement_position is one of the atoms :subject, :predicate or :object, while rdf_term is the RDF term to be mapped. When the given function returns nil this will be interpreted as an error and will become the overhaul result of the map/2 call.

Examples

iex> {~I<http://example.com/S>, ~I<http://example.com/p>, RDF.literal(42)}
...> |> RDF.Triple.map(fn
...>      {:object, object} -> RDF.Term.value(object)
...>      {_, term}         -> term |> to_string() |> String.last()
...>    end)
{"S", "p", 42}