RDF.Triple.new
You're seeing just the function
new
, go back to RDF.Triple module for more information.
Specs
new(RDF.Statement.coercible_t(), RDF.PropertyMap.t() | nil) :: t()
Creates a RDF.Triple
with proper RDF values.
An error is raised when the given elements are not coercible to RDF values.
Note: The RDF.triple
function is a shortcut to this function.
Examples
iex> RDF.Triple.new {"http://example.com/S", "http://example.com/p", 42}
{~I<http://example.com/S>, ~I<http://example.com/p>, RDF.literal(42)}
iex> RDF.Triple.new {EX.S, EX.p, 42}
{RDF.iri("http://example.com/S"), RDF.iri("http://example.com/p"), RDF.literal(42)}
iex> RDF.Triple.new {EX.S, EX.p, 42, EX.Graph}
{RDF.iri("http://example.com/S"), RDF.iri("http://example.com/p"), RDF.literal(42)}
iex> RDF.Triple.new {EX.S, :p, 42}, RDF.PropertyMap.new(p: EX.p)
{RDF.iri("http://example.com/S"), RDF.iri("http://example.com/p"), RDF.literal(42)}
Specs
new( RDF.Statement.coercible_subject(), RDF.Statement.coercible_predicate(), RDF.Statement.coercible_object(), RDF.PropertyMap.t() | nil ) :: t()
Creates a RDF.Triple
with proper RDF values.
An error is raised when the given elements are not coercible to RDF values.
Note: The RDF.triple
function is a shortcut to this function.
Examples
iex> RDF.Triple.new("http://example.com/S", "http://example.com/p", 42)
{~I<http://example.com/S>, ~I<http://example.com/p>, RDF.literal(42)}
iex> RDF.Triple.new(EX.S, EX.p, 42)
{RDF.iri("http://example.com/S"), RDF.iri("http://example.com/p"), RDF.literal(42)}
iex> RDF.Triple.new(EX.S, :p, 42, RDF.PropertyMap.new(p: EX.p))
{RDF.iri("http://example.com/S"), RDF.iri("http://example.com/p"), RDF.literal(42)}