ShEx.ex v0.1.1 ShEx.ShapeMap View Source

A finite set of ShEx.ShapeMap.Associations used to specify the nodes on which validations should be performed and for the result of validations.

A ShapeMap can be either created with ShEx.ShapeMap.new/1 or loaded from a string representation in the standard ShapeMap format with ShEx.ShapeMap.decode/2 or a JSON-based format ShEx.ShapeMap.from_json/2.

The set of associations can be accessed with the associations/1 function as a list. ShEx.ShapeMap also implements the Enumerable protocol over this set of associations, so you can use it with all of Elixir's Enum functions.

After the validation the associations get partitioned into two fields on the ShEx.ShapeMap struct: conformant and nonconformant.

see https://shexspec.github.io/shape-map/

Link to this section Summary

Functions

Adds a single or list of ShapeMap associations to shape_map.

Returns all associations in shape_map as a list.

Returns if all association in shape_map were conformant after a validation.

Loads a ShapeMap from the standard representation format.

Loads a ShapeMap from the standard representation format and fails in the error case.

Return true if shape_map is a fixed ShapeMap, i.e. doesn't contain triple patterns (query ShapeMap) or results (result ShapeMap).

Loads a ShapeMap from a JSON representation.

Creates an empty ShapeMap.

Creates an ShapeMap with the associations given as an enumerable.

Return true if shape_map is a query ShapeMap, i.e. does not contain results (result ShapeMap).

Return true if shape_map is a result ShapeMap.

Converts a query ShapeMap into a fixed ShapeMap by resolving all triple patterns against the given graph.

Link to this section Types

Link to this type

type()

View Source
type() :: :fixed | :query | :result

Link to this section Functions

Link to this function

add(shape_map, associations)

View Source

Adds a single or list of ShapeMap associations to shape_map.

Returns all associations in shape_map as a list.

Returns if all association in shape_map were conformant after a validation.

Note: A non-result ShapeMap is always conformant.

Link to this function

decode(content, opts \\ [])

View Source

Loads a ShapeMap from the standard representation format.

Returns an ok resp. error tuple.

See https://shexspec.github.io/shape-map/

Link to this function

decode!(content, opts \\ [])

View Source

Loads a ShapeMap from the standard representation format and fails in the error case.

Same as decode/2 but returns the ShapeMap directly (not in an ok tuple).

Return true if shape_map is a fixed ShapeMap, i.e. doesn't contain triple patterns (query ShapeMap) or results (result ShapeMap).

Link to this function

from_json(content, options \\ [])

View Source

Loads a ShapeMap from a JSON representation.

This format is not clearly specified. It's currently used only to make test suite pass, where this format is used.

Creates an empty ShapeMap.

Creates an ShapeMap with the associations given as an enumerable.

Return true if shape_map is a query ShapeMap, i.e. does not contain results (result ShapeMap).

Note: Every fixed ShapeMap is also a query ShapeMap.

Return true if shape_map is a result ShapeMap.

Link to this function

to_fixed(shape_map, graph)

View Source

Converts a query ShapeMap into a fixed ShapeMap by resolving all triple patterns against the given graph.