package rdf
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=430a2d24537cac2d48b0c5f5a51794b8
sha512=8f6d0416477890716bf7e9179fca971fc55b0f0cb75972d0d485cb8700361f4fba627a512f123615ef722bdaa5e694ccf84d58497d238067b94269ab99c48264
doc/rdf/Rdf/Sparql/index.html
Module Rdf.SparqlSource
Sparql queries.
Error handling
type error = | Parse_error of Loc.loc * string| Value_error of Dt.error| Eval_error of Sparql_eval.error| Algebra_error of Sparql_algebra.error| Not_select| Not_ask| Not_construct| Not_describe| Not_get| Not_update| Not_implemented of string
Parsing and printing Sparql queries
Executing queries
Solutions
get_term solution varname returns the Term.term bound to varname in the solution.
is_bound solution varname returns whether the given variable name is bound in the solution.
solution_fold f sol acc is f var1 term1 (f var2 term2 (...) acc), folding over the bindings of the solution.
solution_iter f solution calls f on each pair (varname, term) of the solution.
Convenient functions to access solution bindings.
All these functions can raise Dt.Error exceptions in case the term bounded to the variable name is not compatible with the asked type.
The functions are just calls to Dt functions. For example, get_int retrieve the bounded term with get_term, then calls Dt.of_term to get a Dt.value, than calls Dt.int to retrieve an Int n value, then return n.
Same as get_string but the associated language tag is kep, if any.
Querying
execute ~base dataset q executes the sparql query q on dataset, using base as base iri. The form of the result depends on the kind of query:
- Select queries return a
Solution solutions - Ask queries return a
Bool bool - Construct queries return
Graph g. - Describe queries return a description graph.
For 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 iri is the base iri provided.
Warning: Describe queries are not implemented yet.
Convenient functions for querying
Execute the given SELECT query.
Execute the given CONSTRUCT query.
Execute the given ASK query.
Execute the given DESCRIBE query.
Predefined functions
These are the functions named by an IRI, see details here.
A function takes a list of values and returns a value.