RDF.Graph.new

You're seeing just the function new, go back to RDF.Graph module for more information.

Specs

new() :: t()

Creates an empty unnamed RDF.Graph.

Specs

new(input() | keyword()) :: t()

Creates an RDF.Graph.

If a keyword list with options is given an empty graph is created. Otherwise an unnamed graph initialized with the given data is created.

See new/2 for available arguments and the different ways to provide data.

Examples

RDF.Graph.new(name: EX.GraphName)

RDF.Graph.new(init: {EX.S, EX.p, EX.O})

RDF.Graph.new({EX.S, EX.p, EX.O})

Specs

new(input(), keyword()) :: t()

Creates an RDF.Graph initialized with data.

The initial RDF triples can be provided

  • as a single statement tuple
  • a nested subject-predicate-object map
  • a RDF.Description
  • a RDF.Graph
  • or a list with any combination of the former

Available options:

  • name: the name of the graph to be created
  • prefixes: some prefix mappings which should be stored alongside the graph and will be used for example when serializing in a format with prefix support
  • base_iri: a base IRI which should be stored alongside the graph and will be used for example when serializing in a format with base IRI support
  • init: some data with which the graph should be initialized; the data can be provided in any form accepted by add/3 and above that also with a function returning the initialization data in any of these forms

Examples

RDF.Graph.new({EX.S, EX.p, EX.O})
RDF.Graph.new({EX.S, EX.p, EX.O}, name: EX.GraphName)
RDF.Graph.new({EX.S, EX.p, [EX.O1, EX.O2]})
RDF.Graph.new([{EX.S1, EX.p1, EX.O1}, {EX.S2, EX.p2, EX.O2}])
RDF.Graph.new(RDF.Description.new(EX.S, EX.P, EX.O))
RDF.Graph.new([graph, description, triple])
RDF.Graph.new({EX.S, EX.p, EX.O}, name: EX.GraphName, base_iri: EX.base)