View Source RDF.Sigils (RDF.ex v1.2.0)

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

Link to this macro

sigil_B(arg, list)

View Source (macro)

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")
Link to this macro

sigil_b(arg, list)

View Source (macro)

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")
Link to this macro

sigil_I(arg, list)

View Source (macro)

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")
Link to this macro

sigil_i(arg, list)

View Source (macro)

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")
Link to this macro

sigil_L(value, language)

View Source (macro)

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")
Link to this macro

sigil_l(value, language)

View Source (macro)

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")