View Source RDF.List (RDF.ex v1.0.0)

A structure for RDF lists.

see

Link to this section Summary

Functions

Checks if a list is the empty list.

Creates a RDF.List from a native Elixir list or any other Enumerable with coercible RDF values.

Creates a RDF.List for a given RDF list node of a given RDF.Graph.

Checks if the given RDF.Description describes a RDF list node.

Checks if a given resource is a RDF list node in a given RDF.Graph.

The RDF nodes constituting a RDF.List as an Elixir list.

Checks if the given list consists of list nodes which are all blank nodes.

The values of a RDF.List as an Elixir list.

Link to this section Types

@type t() :: %RDF.List{graph: RDF.Graph.t(), head: RDF.IRI.t()}

Link to this section Functions

@spec empty?(t()) :: boolean()

Checks if a list is the empty list.

@spec from(
  Enumerable.t(),
  keyword()
) :: t()

Creates a RDF.List from a native Elixir list or any other Enumerable with coercible RDF values.

By default the statements constituting the Enumerable are added to an empty graph. An already existing graph to which the statements are added can be specified with the graph option.

The name of the head node can be specified with the head option (default: RDF.bnode(), i.e. an arbitrary unique name). Note: When the given Enumerable is empty, the name option will be ignored - the head node of the empty list is always RDF.nil.

@spec new(RDF.IRI.coercible(), RDF.Graph.t()) :: t()

Creates a RDF.List for a given RDF list node of a given RDF.Graph.

If the given node does not refer to a well-formed list in the graph, nil is returned. A well-formed list

  • consists of list nodes which have exactly one rdf:first and rdf:rest statement each
  • does not contain cycles, i.e. rdf:rest statements don't refer to preceding list nodes

Checks if the given RDF.Description describes a RDF list node.

@spec node?(any(), RDF.Graph.t()) :: boolean()

Checks if a given resource is a RDF list node in a given RDF.Graph.

Although, technically a resource is a list, if it uses at least one rdf:first or rdf:rest, we pragmatically require the usage of both.

Note: This function doesn't indicate if the list is valid. See new/2 and valid?/2 for validations.

@spec nodes(t()) :: [RDF.BlankNode.t()]

The RDF nodes constituting a RDF.List as an Elixir list.

@spec valid?(t()) :: boolean()

Checks if the given list consists of list nodes which are all blank nodes.

@spec values(t()) :: Enumerable.t()

The values of a RDF.List as an Elixir list.

Nested lists are converted recursively.