Gno.Manifest (Gno v0.1.0)

Copy Markdown View Source

RDF-based configuration for Gno.Services.

Extends DCATR.Manifest with a Gno.Service link. Manifest files are Turtle files loaded from a DCATR.Manifest.LoadPath. All files in the environment-specific subdirectory are loaded and merged into a single graph.

Custom manifest types can be defined via Gno.Manifest.Type, and manifest files can be generated with Gno.Manifest.Generator.

Application Configuration

Gno's manifest system is configured through the :dcatr application:

config :dcatr,
  env: Mix.env(),
  load_path: ["config/gno"],
  manifest_type: Gno.Manifest,
  manifest_base: "http://example.com/"
  • :env - the current environment, used to select the environment-specific subdirectory (e.g. config/gno/dev/, config/gno/test/)
  • :load_path - directory paths for manifest file discovery (see DCATR.Manifest.LoadPath)
  • :manifest_type - the manifest module to use (always Gno.Manifest for plain Gno, or a custom module implementing Gno.Manifest.Type)
  • :manifest_base - base URI for resolving relative URIs in manifest files

Additionally, an HTTP adapter must be configured for Tesla:

config :tesla, adapter: Tesla.Adapter.Hackney

Directory Structure

Manifest files are organized by environment:

config/gno/
 dev/
    service.ttl
    repository.ttl
    fuseki.ttl
 test/
     service.ttl
     repository.ttl
     oxigraph.ttl

Loading

The manifest and its components can be loaded programmatically:

{:ok, manifest} = Gno.manifest()
{:ok, service}  = Gno.service()
{:ok, store}    = Gno.store()

Summary

Functions

Loads the dataset from the cached manifest's repository.

Loads the dataset or raises on error.

Loads the complete manifest with caching support.

Loads the manifest or raises on error.

Loads the repository from the cached manifest's service.

Loads the repository or raises on error.

Loads the service from the cached manifest.

Loads the service or raises on error.

Returns the service type module used by this manifest type.

Types

t()

@type t() :: %Gno.Manifest{
  __additional_statements__: term(),
  __id__: term(),
  dataset: term(),
  load_path: term(),
  service: term()
}

Functions

build(id)

build(id, initial)

build!(id)

build!(id, initial)

build_id(attributes)

dataset(opts \\ [])

Loads the dataset from the cached manifest's repository.

dataset!(opts \\ [])

Loads the dataset or raises on error.

from(value)

@spec from(Grax.Schema.t()) :: {:ok, t()} | {:error, any()}

from!(value)

@spec from!(Grax.Schema.t()) :: t()

load(graph, id, opts \\ [])

@spec load(
  RDF.Graph.t() | RDF.Description.t(),
  RDF.IRI.coercible() | RDF.BlankNode.t(),
  opts :: keyword()
) :: {:ok, t()} | {:error, any()}

load!(graph, id, opts \\ [])

@spec load!(
  RDF.Graph.t() | RDF.Description.t(),
  RDF.IRI.coercible() | RDF.BlankNode.t(),
  opts :: keyword()
) :: t()

manifest(opts \\ [])

@spec manifest(keyword()) :: {:ok, t()} | {:error, DCATR.ManifestError.t()}

Loads the complete manifest with caching support.

Options

  • :load_path - Override default load path
  • :service_id - Explicit service ID for loading
  • :reload - Force cache reload (bypass cache)
  • Additional options passed to load_dataset/1 and load_manifest/2

manifest!(opts \\ [])

Loads the manifest or raises on error.

repository(opts \\ [])

Loads the repository from the cached manifest's service.

repository!(opts \\ [])

Loads the repository or raises on error.

service(opts \\ [])

Loads the service from the cached manifest.

service!(opts \\ [])

Loads the service or raises on error.

service_type()

Returns the service type module used by this manifest type.

Extracts the service type from the :service link property definition in the manifest's Grax schema. Used for type introspection and validation.

store(opts \\ [])

store!(opts \\ [])