IDUtils.Schemes.GND (id_utils v0.1.0)

Copy Markdown View Source

GND (Gemeinsame Normdatei) scheme.

See https://www.wikidata.org/wiki/Property:P227

Summary

Functions

Builds a URI for the given GND.

Checks whether a string is a GND.

Normalizes a GND.

Checks whether a string starts with a GND prefix.

Functions

build_uri(gnd)

Builds a URI for the given GND.

Examples

iex> IDUtils.Schemes.GND.build_uri("118823574")
{:ok, %URI{scheme: "https", host: "d-nb.info", path: "/gnd/118823574", port: 443}}

match?(string)

Checks whether a string is a GND.

Examples

iex> IDUtils.Schemes.GND.match?("118634313")
true

iex> IDUtils.Schemes.GND.match?("4028557-1")
true

normalize(string)

Normalizes a GND.

Examples

iex> IDUtils.Schemes.GND.normalize("http://d-nb.info/gnd/119404923")
{:ok, "119404923"}

iex> IDUtils.Schemes.GND.normalize("gnd:4030318-4")
{:ok, "4030318-4"}

iex> IDUtils.Schemes.GND.normalize("40303184")
{:error, :invalid_identifier}

prefix?(string)

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

Checks whether a string starts with a GND prefix.

Examples

iex> IDUtils.Schemes.GND.prefix?("https://d-nb.info/gnd/118634313")
true

iex> IDUtils.Schemes.GND.prefix?("gnd:118634313")
true

iex> IDUtils.Schemes.GND.prefix?("118634313")
false