RDF.ex v0.4.0 RDF.Quad View Source

Helper functions for RDF quads.

A RDF Quad is represented as a plain Elixir tuple consisting of four valid RDF values for subject, predicate, object and a graph context.

Link to this section Summary

Functions

Creates a RDF.Quad with proper RDF values

Creates a RDF.Quad with proper RDF values

Link to this section Functions

Creates a RDF.Quad with proper RDF values.

An error is raised when the given elements are not coercible to RDF values.

Note: The RDF.quad function is a shortcut to this function.

Examples

iex> RDF.Quad.new {"http://example.com/S", "http://example.com/p", 42, "http://example.com/Graph"}
{~I<http://example.com/S>, ~I<http://example.com/p>, RDF.literal(42), ~I<http://example.com/Graph>}
iex> RDF.Quad.new {EX.S, EX.p, 42, EX.Graph}
{RDF.iri("http://example.com/S"), RDF.iri("http://example.com/p"), RDF.literal(42), RDF.iri("http://example.com/Graph")}
Link to this function new(subject, predicate, object, graph_context) View Source

Creates a RDF.Quad with proper RDF values.

An error is raised when the given elements are not coercible to RDF values.

Note: The RDF.quad function is a shortcut to this function.

Examples

iex> RDF.Quad.new("http://example.com/S", "http://example.com/p", 42, "http://example.com/Graph")
{~I<http://example.com/S>, ~I<http://example.com/p>, RDF.literal(42), ~I<http://example.com/Graph>}
iex> RDF.Quad.new(EX.S, EX.p, 42, EX.Graph)
{RDF.iri("http://example.com/S"), RDF.iri("http://example.com/p"), RDF.literal(42), RDF.iri("http://example.com/Graph")}