package rdf

  1. Overview
  2. Docs

Datasets.

A dataset is composed of:

  • a default graph,
  • a set of named graphs,
  • a function to get a graph by its IRI.
exception Could_not_retrieve_graph of Iri.t * string

This exception indicates that a graph could not be retrieved. It can be raised by functions retrieving graphs, in a dataset structure. The URI of the graph and an error message must be provided.

val could_not_retrieve_graph : Iri.t -> string -> 'a

This function raises the Could_not_retrieve_graph exception.

type dataset = {
  1. default : Graph.graph;
    (*

    The default graph.

    *)
  2. named : Iri.Set.t;
    (*

    The set of named graphs.

    *)
  3. get_named : Iri.t -> Graph.graph;
    (*

    The function to get a graph by its name (URI). The function must raise Could_not_retrieve_graph in case of error.

    *)
}

A dataset.

val simple_dataset : ?named:(Iri.t * Graph.graph) list -> Graph.graph -> dataset

simple_dataset graph returns a dataset with graph as default graph.

  • parameter named

    can be used to specify named graphs. The get_named function is created from this closed list of named graphs and raise Could_not_retrieve_graph in case a required graph is not part of the list.

val dataset : ?get_named:(Iri.t -> Graph.graph) -> ?named:Iri.Set.t -> Graph.graph -> dataset

dataset graph returns a dataset with graph as default graph.

  • parameter named

    is used to specify the sef of named graphs, but it does not create a get_named function.

  • parameter get_named

    is the function to retrieve graph by name (URI). If it is not provided, the default function always raises Could_not_retrieve_graph.