RDF.Namespace behaviour (RDF.ex v0.9.1) View Source

A behaviour for resolvers of atoms to RDF.IRIs.

Currently there's only one type of such namespaces: RDF.Vocabulary.Namespace, but other types are thinkable and might be implemented in the future, eg. namespaces for JSON-LD contexts.

Link to this section Summary

Functions

Resolves a qualified term to a RDF.IRI.

Resolves a qualified term to a RDF.IRI or raises an error when that's not possible.

Callbacks

Resolves a term to a RDF.IRI.

All terms of a RDF.Namespace.

Link to this section Functions

Specs

resolve_term(RDF.IRI.t() | module()) ::
  {:ok, RDF.IRI.t()} | {:error, Exception.t()}

Resolves a qualified term to a RDF.IRI.

It determines a RDF.Namespace from the qualifier of the given term and delegates to remaining part of the term to __resolve_term__/1 of this determined namespace.

Specs

resolve_term!(RDF.IRI.t() | module()) :: RDF.IRI.t()

Resolves a qualified term to a RDF.IRI or raises an error when that's not possible.

See resolve_term/1 for more.

Link to this section Callbacks

Specs

__resolve_term__(atom()) :: {:ok, RDF.IRI.t()} | {:error, Exception.t()}

Resolves a term to a RDF.IRI.

Specs

__terms__() :: [atom()]

All terms of a RDF.Namespace.