# `DCATR.Graph`
[🔗](https://github.com/dcat-r/dcatr-ex/blob/v0.1.0/lib/dcatr/model/graph.ex#L1)

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:

- `DCATR.DataGraph` (user data)
- `DCATR.WorkingGraph` (temporary working areas)
- `DCATR.ManifestGraph` (DCAT-R configuration)
- `DCATR.SystemGraph` (system mechanisms)

## 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](https://rdf-elixir.dev/grax/api.html#mapping-between-schemas)
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"

# `t`

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

# `build`

# `build`

# `build!`

# `build!`

# `build_id`

# `from`

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

# `from!`

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

# `load`

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

# `load!`

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

# `new`

# `new!`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
