Setup and teardown of Gno repositories in the SPARQL store of a Gno.Service.
The setup pipeline checks store availability, prepares the store adapter, initializes repository metadata, and validates the result.
Application-specific setup logic can be added via Gno.Service.Setup.Extension.
For command-line usage, see mix gno.setup and mix gno.teardown.
Summary
Functions
Checks if the repository is already set up.
Sets up a new repository for the given service.
Tears down the repository for the given service.
Validates the setup state including basic integrity and extension validations.
Types
Functions
@spec check( Gno.Service.t(), keyword() ) :: :ok | {:error, term()}
Checks if the repository is already set up.
@spec setup(Gno.Service.t(), options()) :: {:ok, Gno.Service.t()} | {:error, term()}
Sets up a new repository for the given service.
Options
:store_options(keyword/0) - Options passed to the store adapter's setup functions The default value is[].:repository_data(RDF.Graph.input/0) - Additional RDF data to merge into the repository before storing The default value is[].:extension- Extension module for application-specific setup logic The default value isnil.:extension_opts(keyword/0) - Options passed to the extension module callbacks The default value is[].:store_repository_metadata(boolean/0) - Iffalse, skips storing repository metadata in the triple store The default value istrue.
Examples
# Simple setup with defaults
{:ok, service} = Gno.Service.Setup.setup(service)
# Setup without storing repository metadata
{:ok, service} = Gno.Service.Setup.setup(service, store_repository_metadata: false)
# Setup with extension
{:ok, service} = Gno.Service.Setup.setup(service,
extension: MyApp.Setup,
extension_opts: [history: true, roles: [:admin, :user]]
)
@spec teardown(Gno.Service.t(), options()) :: :ok | {:error, [term()]}
Tears down the repository for the given service.
DESTRUCTIVE OPERATION
⚠️ This will permanently delete repository data. ⚠️
Only use in development/testing environments.
Options
:store_options(keyword/0) - Options passed to the store adapter's setup functions The default value is[].:repository_data(RDF.Graph.input/0) - Additional RDF data to merge into the repository before storing The default value is[].:extension- Extension module for application-specific setup logic The default value isnil.:extension_opts(keyword/0) - Options passed to the extension module callbacks The default value is[].:store_repository_metadata(boolean/0) - Iffalse, skips storing repository metadata in the triple store The default value istrue.
Examples
# Simple teardown with defaults
:ok = Gno.Service.Setup.teardown(service)
# Teardown with extension
:ok = Gno.Service.Setup.teardown(service,
extension: MyApp.Setup,
extension_opts: [history: true, roles: [:admin, :user]]
)
@spec validate( Gno.Service.t(), keyword() ) :: :ok | {:error, term()}
Validates the setup state including basic integrity and extension validations.