RDF.List (RDF.ex v0.9.0) View Source
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.
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
Specs
t() :: %RDF.List{graph: RDF.Graph.t(), head: RDF.IRI.t()}
Link to this section Functions
Specs
Checks if a list is the empty list.
Specs
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.
Specs
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:firstandrdf:reststatement each - does not contain cycles, i.e.
rdf:reststatements don't refer to preceding list nodes
Checks if the given RDF.Description describes a RDF list node.
Specs
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.
Specs
nodes(t()) :: [RDF.BlankNode.t()]
The RDF nodes constituting a RDF.List as an Elixir list.
Specs
Checks if the given list consists of list nodes which are all blank nodes.
Specs
values(t()) :: Enumerable.t()
The values of a RDF.List as an Elixir list.
Nested lists are converted recursively.