# `IDUtils.Schemes.ARK`
[🔗](https://github.com/moefuerst/id_utils/blob/v0.1.0/lib/id_utils/schemes/ark.ex#L1)

ARK (Archival Resource Key) scheme.

See https://datatracker.ietf.org/doc/html/draft-kunze-ark-44

# `build_uri`

Builds a URI for the given ARK.

For compact ARKs, the N2T resolver is used. If the ARK is passed as a URL string, it is parsed
as-is.

## Examples

    iex> IDUtils.Schemes.ARK.build_uri("ark:12148/btv1b8449691v/f29")
    {:ok, %URI{scheme: "https", host: "n2t.net", path: "/ark:12148/btv1b8449691v/f29", port: 443}}

    iex> IDUtils.Schemes.ARK.build_uri("https://gallica.bnf.fr/ark:/12148/btv1b8449691v/f29")
    {:ok, %URI{scheme: "https", host: "gallica.bnf.fr", path: "/ark:/12148/btv1b8449691v/f29", port: 443}}

# `build_uri`

Builds a URI for the given ARK and NMA.

## Parameters

* `ark` - The ARK to build a `t:URI.t/0` for.
* `resolver` - The NMA resolver URL to use for building the URI.

## Examples

    iex> IDUtils.Schemes.ARK.build_uri("ark:/12148/btv1b8449691v/f29", "https://gallica.bnf.fr")
    {:ok, %URI{scheme: "https", host: "gallica.bnf.fr", path: "/ark:/12148/btv1b8449691v/f29", port: 443}}

# `match?`

Check whether a string can be matched as an ARK.

## Examples

    iex> IDUtils.Schemes.ARK.match?("ark:12345/x6np1wh8k")
    true

    iex> IDUtils.Schemes.ARK.match?("https://gallica.bnf.fr/ark:/12148/btv1b8449691v/f29")
    true

# `normalize`

Normalizes an ARK.

## Examples

    iex> IDUtils.Schemes.ARK.normalize("ark:/12345/x6np1wh8k")
    {:ok, "ark:12345/x6np1wh8k"}

    iex> IDUtils.Schemes.ARK.normalize("ark:12345/x6np1wh8k/ms/971863.pdf")
    {:ok, "ark:12345/x6np1wh8k/ms/971863.pdf"}

    iex> IDUtils.Schemes.ARK.normalize("https://gallica.bnf.fr/ark:/12148/bpt6k1")
    {:ok, "ark:12148/bpt6k1"}

---

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