ARK (Archival Resource Key) scheme.
See https://datatracker.ietf.org/doc/html/draft-kunze-ark-44
Summary
Functions
Builds a URI for the given ARK.
Builds a URI for the given ARK and NMA.
Check whether a string can be matched as an ARK.
Normalizes an ARK.
Functions
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}}
Builds a URI for the given ARK and NMA.
Parameters
ark- The ARK to build aURI.t/0for.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}}
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
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"}