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

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

Callbacks

Resolves a term to a RDF.IRI.

All terms of a RDF.Namespace.

Functions

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

Resolves a qualified term to a RDF.IRI.

Link to this section Callbacks

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

Resolves a term to a RDF.IRI.

@callback __terms__() :: [atom()]

All terms of a RDF.Namespace.

Link to this section Functions

@spec 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.

@spec 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.