module Rdf_graph:sig..end
The graph provides an abstraction of the storage used (memory, database, ...). The graph is modified in place.
Example of usage:
let options =
[
"storage", "mysql" ;
"database", "mydb";
"user", "john" ;
]
in
let graph = Rdf_graph.open_graph ~options (Rdf_uri.uri "http://hello.fr") in
graph.add_triple
~sub: (Rdf_node.node_of_uri_string "http://john.net")
~pred: (Rdf_node.node_of_uri_string "http://relations.org/hasMailbox")
~obj: (Rdf_node.node_of_literal_string "john@john.net");
...
typeoptions =(string * string) list
val get_option : ?def:string -> string -> options -> stringget_options name options returns the value associated to the
option with the given name, in option list.
If the option name is not found in the list, the function raises
the Failure exception with a message about the missing option.def : can be used to specify a default value; in this case, if
the option name was not found in list, the default value is
returned instead of raising Failure.
This is useful only to create your own storage.
module type Storage =sig..end
exception Storage_error of string * string * exn
Rdf_graph.Make on a storage.
Each call to a Rdf_graph.Storage function is embedded so that the
Rdf_graph.Storage_error exception is raised when an error occurs in
a storage function.
The exception provides the name of the storage, the error message
(obtained with Rdf_graph.Storage.string_of_error) and the original exception.
Refer to the documentation of Rdf_graph.Storage for information about
the functions provided by the resulting module.
module type Graph =sig..end
module Make:
val add_storage : (module Rdf_graph.Storage) -> unittype graph = {
|
name : |
|
add_triple : |
|
rem_triple : |
|
add_triple_t : |
|
rem_triple_t : |
|
subjects_of : |
|
predicates_of : |
|
objects_of : |
|
find : |
|
exists : |
|
exists_t : |
|
subjects : |
|
predicates : |
|
objects : |
|
transaction_start : |
|
transaction_commit : |
|
transaction_rollback : |
|
new_blank_id : |
|
namespaces : |
Rdf_graph.open_graph. It contains
the same functions as in Rdf_graph.Graph, except the graph data is hidden,
like in a class interface.
Refer to the documentation of Rdf_graph.Storage for information about
the functions in the fields.val open_graph : ?options:(string * string) list -> Rdf_uri.uri -> graphopen_graph ~options uri_name creates a new graph. The storage used
is specified by the "storage" option. For example, having ("storage", "mysql")
in the options indicates to use the storage "mysql".
If the specified storage is not registered, the function raises Failure.
Other options may be used by each storage.
To make sure the storage you want to use is registered, beware of linking the
corresponding module in your executable, either by using the -linkall option
or by adding a reference to the module in your code.
val merge : graph -> graph -> unitmerge g1 g2 add triples from g2 to g1.