View Source RDF.Sigils (RDF.ex v2.0.1)
Sigils for the most common types of RDF nodes.
Summary
Functions
Handles the sigil ~B
for blank nodes.
Handles the sigil ~b
for blank nodes.
Handles the sigil ~I
for IRIs.
Handles the sigil ~i
for IRIs.
Handles the sigil ~L
for plain Literals.
Handles the sigil ~l
for blank nodes.
Functions
Handles the sigil ~B
for blank nodes.
It returns an RDF.BlankNode
from the given string without interpolations
and without escape characters, except for the escaping of the closing sigil
character itself.
Examples
iex> import RDF.Sigils
iex> ~B<foo>
RDF.bnode("foo")
Handles the sigil ~b
for blank nodes.
It returns an RDF.BlankNode
from the given string as if it was a double-quoted
string, unescaping characters and replacing interpolations.
Examples
iex> import RDF.Sigils
iex> ~b<foo#{String.downcase("Bar")}>
RDF.bnode("foobar")
Handles the sigil ~I
for IRIs.
It returns an RDF.IRI
from the given string without interpolations and
without escape characters, except for the escaping of the closing sigil
character itself.
Examples
iex> import RDF.Sigils
iex> ~I<http://example.com>
RDF.iri("http://example.com")
Handles the sigil ~i
for IRIs.
It returns an RDF.IRI
from the given string as if it was a double-quoted
string, unescaping characters and replacing interpolations.
Examples
iex> import RDF.Sigils
iex> ~i<http://example.com/#{String.downcase("Foo")}>
RDF.iri("http://example.com/foo")
Handles the sigil ~L
for plain Literals.
It returns an RDF.Literal
from the given string without interpolations and without escape characters, except for the escaping of the closing sigil character itself.
The sigil modifier can be used to specify a language tag.
Note: Languages with subtags are not supported.
Examples
iex> import RDF.Sigils
iex> ~L"foo"
RDF.literal("foo")
iex> ~L"foo"en
RDF.literal("foo", language: "en")
Handles the sigil ~l
for blank nodes.
It returns an RDF.Literal
from the given string as if it was a double-quoted
string, unescaping characters and replacing interpolations.
Examples
iex> import RDF.Sigils
iex> ~l"foo #{String.downcase("Bar")}"
RDF.literal("foo bar")
iex> ~l"foo #{String.downcase("Bar")}"en
RDF.literal("foo bar", language: "en")