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

Copy Markdown View Source

Abstract base schema for all graphs in a DCAT-R repository.

Represents a graph as a dcat:Dataset. Every graph must belong to exactly one of the four concrete subclasses:

Schema Mapping

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

graph = %DCATR.DataGraph{
  __id__: ~I<http://example.org/graph1>,
  __additional_statements__: %{
    ~I<http://purl.org/dc/terms/title> => %{
      ~L"My Graph" => nil
    }
  }
}

dataset = DCAT.Dataset.from(graph)
dataset.title
# => "My Graph"

Summary

Types

t()

@type t() :: %DCATR.Graph{__additional_statements__: term(), __id__: term()}

Functions

build(id)

build(id, initial)

build!(id)

build!(id, initial)

build_id(attributes)

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

new(id, attrs \\ [])

new!(id, attrs \\ [])