DCATR.Dataset (DCAT-R.ex v0.1.0)

Copy Markdown View Source

A catalog of the data graphs within a DCATR.Repository.

Each repository contains exactly one such dataset as its primary data container, modeled as a DCAT catalog of DCATR.DataGraphs. As the root DCATR.Directory of the graph hierarchy, it can also contain nested DCATR.Directorys for hierarchical organization.

Schema Mapping

This schema does not directly inherit from DCAT.Catalog in Grax to avoid bloating the Elixir structs with all DCAT properties. Any DCAT metadata on a dataset is still preserved in the __additional_statements__ field of the struct. When needed, Grax schema mapping allows accessing a dataset as a dcat:Catalog with all DCAT properties mapped to struct fields via the DCAT.Catalog schema from DCAT.ex:

dataset = %DCATR.Dataset{
  __id__: ~I<http://example.org/dataset1>,
  __additional_statements__: %{
    ~I<http://purl.org/dc/terms/title> => %{
      ~L"My Dataset" => nil
    }
  }
}

catalog = DCAT.Catalog.from(dataset)
catalog.title
# => "My Dataset"

entity = PROV.Entity.from(dataset)

Summary

Functions

Returns all graphs through the entire sub-directory tree.

Returns all elements through the entire sub-directory tree.

Finds a graph by ID recursively through the sub-directory tree.

Returns a graph by ID or symbolic selector.

Checks if a graph exists in the container.

Returns all direct element members.

Types

t()

@type t() :: %DCATR.Dataset{
  __additional_statements__: term(),
  __id__: term(),
  directories: term(),
  graphs: term()
}

Functions

all_graphs(container)

@spec all_graphs(DCATR.Directory.Type.schema()) :: [DCATR.Graph.t()]

Returns all graphs through the entire sub-directory tree.

all_members(container)

@spec all_members(DCATR.Directory.Type.schema()) :: [DCATR.Element.t()]

Returns all elements through the entire sub-directory tree.

build(id)

build(id, initial)

build!(id)

build!(id, initial)

build_id(attributes)

find_graph(container, id)

@spec find_graph(DCATR.Directory.Type.schema(), RDF.IRI.coercible()) ::
  DCATR.Graph.t() | nil

Finds a graph by ID recursively through the sub-directory tree.

from(value)

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

from!(value)

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

graph(container, id_or_selector)

Returns a graph by ID or symbolic selector.

Tries resolve_graph_selector/2 first. On :undefined, falls back to find_graph/2 (from DCATR.Directory.Type) for ID-based lookup.

has_graph?(container, id_or_selector)

Checks if a graph exists in the container.

Convenience function based on graph/2 - returns true if the graph exists, false otherwise.

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()

members(container)

Returns all direct element members.

new(id, attrs \\ [])

new!(id, attrs \\ [])