module type Storage = sig
.. end
A storage is a module with this interface.
val name : string
The name of the storage, for example "mysql".
type
g
The type of the graph, abstract. It usually includes
all information needed by the other functions, as various
graphs of the same kind can be used in the same application.
Errors
type
error
A specific type for errors.
exception Error of error
This is the exception raised by the functions of the module
in case of error.
val string_of_error : error -> string
This function returns a message from the given error.
Creation and modification
val open_graph : ?options:(string * string) list -> Rdf_uri.uri -> g
Creationg of the graph. The graph has a name which is a URI.
val graph_name : g -> Rdf_uri.uri
Access to the graph name, as specified at its creation.
val add_triple : g ->
sub:Rdf_node.node -> pred:Rdf_node.node -> obj:Rdf_node.node -> unit
Adding a triple to the graph.
val rem_triple : g ->
sub:Rdf_node.node -> pred:Rdf_node.node -> obj:Rdf_node.node -> unit
Removing a triple from the graph.
val add_triple_t : g -> Rdf_node.triple -> unit
Adding a triple to the graph, curryfied form.
val rem_triple_t : g -> Rdf_node.triple -> unit
Removing a triple from the graph, curryfied form.
Querying the graph
val subjects_of : g ->
pred:Rdf_node.node -> obj:Rdf_node.node -> Rdf_node.node list
subjects_of g ~pred ~obj
returns the list of nodes which are
subjects in triples with the specified predicate and object.
val predicates_of : g ->
sub:Rdf_node.node -> obj:Rdf_node.node -> Rdf_node.node list
predicates_of g ~sub ~obj
returns the list of nodes which are
predicates in triples with the specified subject and object.
val objects_of : g ->
sub:Rdf_node.node -> pred:Rdf_node.node -> Rdf_node.node list
objects_of g ~sub ~pred
returns the list of nodes which are
objects in triples with the specified subject and predicate.
val find : ?sub:Rdf_node.node ->
?pred:Rdf_node.node ->
?obj:Rdf_node.node -> g -> Rdf_node.triple list
find ?sub ?pred ?obj g
returns the list of triples matching the
constraints given by the optional subject, predicate and object.
One can specify, zero, one, two or three of these nodes.
val exists : ?sub:Rdf_node.node ->
?pred:Rdf_node.node -> ?obj:Rdf_node.node -> g -> bool
Same as
Rdf_graph.Storage.find
but only returns
true
if at least one triple
of the graph matches the constraints.
val exists_t : Rdf_node.triple -> g -> bool
val subjects : g -> Rdf_node.node list
Return the list of nodes appearing in subject position.
val predicates : g -> Rdf_node.node list
Return the list of nodes appearing in predicate position.
val objects : g -> Rdf_node.node list
Return the list of nodes appearing in object position.
Transactions
val transaction_start : g -> unit
Start a transaction. All storage may not support transactions.
val transaction_commit : g -> unit
Commit.
val transaction_rollback : g -> unit
Rollback.
val new_blank_id : g -> Rdf_node.blank_id
Forging a new, unique blank node id.