package rdf

  1. Overview
  2. Docs
OCaml library to manipulate RDF graphs; implements SPARQL

Install

Dune Dependency

Authors

Maintainers

Sources

ocaml-rdf-1.0.0.tar.gz
md5=43ce517489f775e6b65fcdef5e713e74
sha512=6130e46d186ca4abf0c44a35ab040f696f8b4d10fd16db9212e8280500f8263626f0ab8d53479b926924b41e45ae4793251727de725c03c409052a96ad2d40bd

doc/rdf/Rdf/Ds/index.html

Module Rdf.DsSource

Datasets.

A dataset is composed of:

  • a default graph,
  • a set of named graphs,
  • a function to get a graph by its name,
  • a function to add a graph.
Sourcetype name = [
  1. | `I of Iri.t
  2. | `B of Term.blank_id
]
Sourceval compare_name : name -> name -> int
Sourceval string_of_name : name -> string
Sourceval pp_name : Format.formatter -> name -> unit
Sourceval term_of_name : name -> Term.term
Sourcemodule NameMap : Map.S with type key = name
Sourcemodule NameSet : Set.S with type elt = name
Sourcetype dataset = {
  1. default : Graph.graph;
    (*

    The default graph.

    *)
  2. named : unit -> NameSet.t;
    (*

    The set of named graphs.

    *)
  3. get_named : ?add:bool -> name -> Graph.graph option;
    (*

    The function to get a graph by its name, if present. It not, then if add is true and the add field provides a function to add a graph, a new graph is created, added to the dataset and returned. If name is a blank id, base IRI of created graph is an empty IRI, else it is the name.

    *)
  4. add : (?name:name -> Graph.graph -> Graph.graph) option;
    (*

    Add a graph to dataset, if dataset allows it. Use the returned graph to add triples in the dataset, because if a graph for the same name already existed in the dataset, triples of the given graph are added to the existing graph. If optional parameter name is not provided, the base IRI of graph is used.

    *)
}

A dataset.

Sourceval simple_dataset : ?named:(name * 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.

Sourceval dataset : ?add:(?name:name -> Graph.graph -> Graph.graph) -> ?get_named:(?add:bool -> name -> Graph.graph option) -> ?named:(unit -> NameSet.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.

  • parameter add

    is a function used to add graph to dataset. If get_named is not provided, add argument is ignored.

Sourceval mem_dataset : Graph.graph -> dataset

mem_dataset g create a new in-memory dataset with given graph g as default graph. named, get_named and add functions are implemented to fulfill dataset API.

Sourceval merge_to_default : dataset -> unit

merge_to_default dataset add triples of all named graphs to dataset.default.

Sourceval graphs : dataset -> (name option * Graph.graph) list

graphs dataset returns the list of (optional name, graph) from dataset.

Sourceval iter : (name option -> Graph.graph -> unit) -> dataset -> unit

iter f dataset calls f for each graph in the dataset, with optional name and graph as argument.

Sourceval fold : ('a -> name option -> Graph.graph -> 'a) -> 'a -> dataset -> 'a

fold f acc dataset folds on dataset's graphs with f called with optional name and graph as argument.

Sourcetype diff =
  1. | Cardinals of int * int
  2. | Missing_graph of name
  3. | Graph_diff of name option * Graph.diff

Differences when checking if two datasets are isomorphic.

Sourceval string_of_diff : diff -> string
Sourceval pp_diff : Format.formatter -> diff -> unit
Sourceval isomorphic_diff : ?ignore_blanks:bool -> dataset -> dataset -> diff option

Return None when the two given datasets are isomorphic or the first difference.

OCaml

Innovation. Community. Security.