IDUtils.Schemes.RAID (id_utils v0.1.0)

Copy Markdown View Source

RAID (Research Activity Identifier) scheme.

See https://documentation.raid.org/raid

RAID and DOI

RAID registration agencies issue RAIDs as DOIs via DataCite, reusing the DOI 10.xxxx/yyyy namespace. RAID and a DOI are therefore format-identical; the only reliable disambiguator is a possible https://raid.org/ resolver prefix.

Since every RAID is a DOI, but not every DOI is a RAID and DOIs are much more common, IDUtils prefers DOI over RAID when both are detected.

Summary

Functions

Builds a URI for the given RAID.

Checks whether a string can be matched as a RAID.

Normalizes a RAID.

Checks whether a string starts with a RAID prefix.

Functions

build_uri(raid)

Builds a URI for the given RAID.

Examples

iex> IDUtils.Schemes.RAID.build_uri("10.1234/abc123")
{:ok, %URI{scheme: "https", host: "raid.org", path: "/10.1234/abc123", port: 443}}

match?(string)

Checks whether a string can be matched as a RAID.

Examples

iex> IDUtils.Schemes.RAID.match?("10.5281/zenodo.15293455")
true

iex> IDUtils.Schemes.RAID.match?("https://raid.org/10.5281/zenodo.15293455")
true

iex> IDUtils.Schemes.RAID.match?("not-a-raid")
false

normalize(string)

Normalizes a RAID.

Examples

iex> IDUtils.Schemes.RAID.normalize("10.5281/zenodo.15293455")
{:ok, "10.5281/zenodo.15293455"}

iex> IDUtils.Schemes.RAID.normalize("https://raid.org/10.1000.10/foo-bar")
{:ok, "10.1000.10/foo-bar"}

iex> IDUtils.Schemes.RAID.normalize("not-a-raid")
{:error, :invalid_identifier}

prefix?(string)

@spec prefix?(binary()) :: boolean()

Checks whether a string starts with a RAID prefix.

Examples

iex> IDUtils.Schemes.RAID.prefix?("https://raid.org/10.5281/zenodo.15293455")
true

iex> IDUtils.Schemes.RAID.prefix?("10.5281/zenodo.15293455")
false