View Source Ontogen.Store.Adapter behaviour (Ontogen v0.1.1)

A behaviour for SPARQL triple stores hosting an Ontogen.Repository.

Summary

Functions

Returns the Ontogen.Store.Adapter module for the given string.

Checks if the given module is a Ontogen.Store.Adapter module.

Returns the store adapter name for the given store adapter module.

Types

@type endpoint_url() :: String.t() | nil
@type graph_name() :: RDF.IRI.t() | nil
@type result() :: SPARQL.Query.Result.t() | RDF.Data.t() | nil
@type t() :: struct()
@type type() :: module()

Callbacks

Link to this callback

dataset_endpoint_segment(t)

View Source
@callback dataset_endpoint_segment(t()) :: {:ok, binary()} | {:error, any()}
Link to this callback

determine_graph_store_endpoint(t)

View Source
@callback determine_graph_store_endpoint(t()) :: {:ok, endpoint_url()} | {:error, any()}
Link to this callback

determine_query_endpoint(t)

View Source
@callback determine_query_endpoint(t()) :: {:ok, endpoint_url()} | {:error, any()}
Link to this callback

determine_update_endpoint(t)

View Source
@callback determine_update_endpoint(t()) :: {:ok, endpoint_url()} | {:error, any()}
Link to this callback

handle_sparql(t, t, graph_name, keyword)

View Source
@callback handle_sparql(Ontogen.Store.SPARQL.Operation.t(), t(), graph_name(), keyword()) ::
  {:ok, result()} | :ok | {:error, any()}

Functions

@spec type(type()) :: binary()
@spec type(binary()) :: type() | nil

Returns the Ontogen.Store.Adapter module for the given string.

Example

iex> Ontogen.Store.Adapter.type("Oxigraph")
Ontogen.Store.Adapters.Oxigraph

iex> Ontogen.Store.Adapter.type("Commit")
nil

iex> Ontogen.Store.Adapter.type("NonExisting")
nil
@spec type?(module()) :: boolean()

Checks if the given module is a Ontogen.Store.Adapter module.

Returns the store adapter name for the given store adapter module.

Example

iex> Ontogen.Store.Adapter.type_name(Ontogen.Store.Adapters.Fuseki)
"Fuseki"

iex> Ontogen.Store.Adapter.type_name(Ontogen.Store.Adapters.Oxigraph)
"Oxigraph"

iex> Ontogen.Store.Adapter.type_name(Ontogen.Repository)
** (RuntimeError) Invalid Ontogen.Store.Adapter type: Ontogen.Repository

iex> Ontogen.Store.Adapter.type_name(NonExisting)
** (RuntimeError) Invalid Ontogen.Store.Adapter type: NonExisting