Dmn.Model.Reference (dmn v0.1.0)

Copy Markdown View Source

A reference to an element: href="#id" is an element of the same model, href="namespace#id" one of the model with that namespace, which a model imports (DMN 1.6, 6.3.3). An id is an xsd:ID, which has no #, and a namespace may have one (https://example.org/m#v2), so the id is what follows the last #.

Summary

Functions

Reads the value of an href. nil for one that names nothing.

Types

t()

@type t() :: %Dmn.Model.Reference{id: String.t(), namespace: String.t() | nil}

Functions

parse(href)

@spec parse(String.t()) :: t() | nil

Reads the value of an href. nil for one that names nothing.

iex> Dmn.Model.Reference.parse("#_a1")
%Dmn.Model.Reference{namespace: nil, id: "_a1"}
iex> Dmn.Model.Reference.parse("https://example.org/m#_b2")
%Dmn.Model.Reference{namespace: "https://example.org/m", id: "_b2"}
iex> Dmn.Model.Reference.parse("https://example.org/m#v2#_b2")
%Dmn.Model.Reference{namespace: "https://example.org/m#v2", id: "_b2"}
iex> Dmn.Model.Reference.parse("no-fragment")
nil