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

Behaviour for graph lookup via symbolic selectors.

This module provides graph access by ID or symbolic selector (e.g., `:primary`,
`:repository_manifest`). Each container type defines its own selectors for
commonly needed graphs.

Structural operations (member enumeration, directory traversal) are in
`DCATR.Directory.Type`, while this behaviour adds named graph access on top.

## Core Callback

- `c:resolve_graph_selector/2` - Resolve symbolic selectors to graphs

## Generated Functions

The `__using__` macro generates:

- `graph/2` — calls `resolve_graph_selector/2`, falls back to `find_graph/2` (from `DCATR.Directory.Type`)
- `has_graph?/2` — `graph/2 != nil`

Both are `defoverridable`.

# `container`

```elixir
@type container() :: Grax.Schema.t()
```

# `id_or_selector`

```elixir
@type id_or_selector() :: selector() | RDF.IRI.coercible()
```

# `selector`

```elixir
@type selector() :: atom()
```

# `t`

```elixir
@type t() :: module()
```

# `resolve_graph_selector`

```elixir
@callback resolve_graph_selector(container(), selector()) ::
  DCATR.Graph.t() | nil | :undefined
```

Resolves a symbolic selector to a graph.

Each container type defines selectors for its commonly needed graphs
(e.g., `:primary` on repositories, `:service_manifest` on service data).

## Return values

- `%DCATR.Graph{}` - Selector resolved successfully to a graph
- `nil` - Selector is recognized but references no graph (e.g., `:primary` when no primary graph is defined)
- `:undefined` - Selector is not recognized by this implementation (enables delegation in hierarchies)

Implementations should only handle their own selectors and return `:undefined` for unknown ones.

---

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