module Rdf_sparql:sig
..end
type
error =
| |
Parse_error of |
| |
Value_error of |
| |
Eval_error of |
| |
Algebra_error of |
| |
Not_select |
| |
Not_ask |
| |
Not_construct |
| |
Not_describe |
exception Error of error
val string_of_error : error -> string
typequery =
Rdf_sparql_types.query
val parse_from_string : string -> query
val parse_from_file : string -> query
val string_of_query : query -> string
type
solution
val get_term : solution -> string -> Rdf_node.node
get_term solution varname
returns the Rdf_node.node
bound to
varname
in the solution.Not_found
if the variable is not bound.val is_bound : solution -> string -> bool
is_bound solution varname
returns whether the given variable name
is bound in the solution.val solution_fold : (string -> Rdf_node.node -> 'a -> 'a) -> solution -> 'a -> 'a
solution_fold f sol acc
is
f var1 term1 (f var2 term2 (...) acc)
, folding over the bindings
of the solution.val solution_iter : (string -> Rdf_node.node -> unit) -> solution -> unit
solution_iter f solution
calls f
on each pair (varname, term)
of the solution
.type
query_result =
| |
Bool of |
| |
Solutions of |
| |
Graph of |
val execute : ?graph:Rdf_graph.graph ->
base:Rdf_uri.uri ->
Rdf_ds.dataset -> query -> query_result
execute ~base dataset q
executes the sparql query q
on dataset
, using
base
as base uri. The form of the result depends on the kind of query:Solution solutions
Bool bool
Graph g
.Construct
and Describe
queries, if a graph is provided, it is filled
and the same graph is returned; else a new graph (in memory) is created,
filled and returned. If the graph is created, it uri is the base
uri provided.
Warning: Describe queries are not implemented yet.
Raises Error
in case of error.
val select : base:Rdf_uri.uri ->
Rdf_ds.dataset -> query -> solution list
Not_select
is the query is not a SELECT.val construct : ?graph:Rdf_graph.graph ->
base:Rdf_uri.uri -> Rdf_ds.dataset -> query -> Rdf_graph.graph
Not_construct
is the query is not a CONSTRUCT.val ask : base:Rdf_uri.uri -> Rdf_ds.dataset -> query -> bool
Not_ask
is the query is not a ASK.val describe : ?graph:Rdf_graph.graph ->
base:Rdf_uri.uri -> Rdf_ds.dataset -> query -> Rdf_graph.graph
Not_describe
is the query is not a DESCRIBE.
These are the functions named by an URI,
see details here.
typeuri_fun =
Rdf_dt.value list -> Rdf_dt.value
val uri_funs : unit -> uri_fun Rdf_uri.Urimap.t
val add_uri_fun : Rdf_uri.uri -> uri_fun -> unit