Skout.Document (Skout v0.1.5) View Source

A structure for Skout documents for terse descriptions of SKOS concept schemes.

A Skout document consists of a graph with the description of the SKOS concept scheme and its concepts and a manifest with general settings for the YAML serialization.

Link to this section Summary

Functions

Adds triples to the SKOS graph of document.

Adds triples to the SKOS graph of document.

Reads a document from an RDF.Graph.

Reads a document from an RDF.Graph.

Reads a document from a YAML string.

Reads a document from a YAML string.

Creates a new document with the given settings.

Creates a new document with the given settings.

Returns the RDF graph of the SKOS concept scheme of document.

Returns the YAML serialization of document.

Returns the YAML serialization of document.

Link to this section Functions

Adds triples to the SKOS graph of document.

Note, that this might materialize some forward chained statements.

Returns the updated document in an :ok tuple in success case, otherwise an :error tuple.

Adds triples to the SKOS graph of document.

As opposed to add/2 this returns the updated document directly or raises an exception in the error case.

Link to this function

from_rdf(graph, opts \\ [])

View Source

Reads a document from an RDF.Graph.

You can pass in all the options mentioned in new/1 overwriting the values in the preamble.

Returns the document in an :ok tuple in success case, otherwise an :error tuple.

Link to this function

from_rdf!(graph, opts \\ [])

View Source

Reads a document from an RDF.Graph.

As opposed to from_rdf/2 this returns the document directly or raises an exception in an error case.

Link to this function

from_yaml(yaml, opts \\ [])

View Source

Reads a document from a YAML string.

You can pass in all the options mentioned in new/1 overwriting the values in the preamble.

Returns the document in an :ok tuple in success case, otherwise an :error tuple.

Link to this function

from_yaml!(yaml, opts \\ [])

View Source

Reads a document from a YAML string.

You can pass in all the options mentioned in new/1 overwriting the values in the preamble.

As opposed to from_yaml/2 this returns the document directly or raises an exception in the error case.

Creates a new document with the given settings.

The following settings for the manifest are available:

  • base_iri: The base IRI to be used for the concepts. This is the only required setting.
  • iri_normalization: The normalization method which is applied to the labels before they are concatenated to the base_iri. Must be one of :camelize or underscore and defaults to camelize.
  • label_type: The SKOS label property to be used for produced labeling statements.
  • default_language: The language-tag used for the produced labeling statements.
  • materialization: Another struct with flag settings controlling which statements should be materialized. The following flags are available: :rdf_type, :in_scheme, :inverse_hierarchy, :inverse_related.

Return the constructed document in an :ok tuple in success case, otherwise an :error tuple.

Creates a new document with the given settings.

As opposed to new/1 this returns the document directly or raises an exception in the error case.

Returns the RDF graph of the SKOS concept scheme of document.

Note that other than the other conversion functions this one doesn't return the result in an :ok tuple, since it can't fail.

Link to this function

to_yaml(document, opts \\ [])

View Source

Returns the YAML serialization of document.

Returns the YAML string in an :ok tuple in success case, otherwise an :error tuple.

Link to this function

to_yaml!(document, opts \\ [])

View Source

Returns the YAML serialization of document.

As opposed to to_yaml/2 this returns the YAML string directly or raises an exception in an error case.