NAME
rdf/sparql - SPARQL query execution.
SYNOPSIS
from rdf/sparql import sparql_query, sparql_update;
let rows := sparql_query(store, """
SELECT ?s WHERE { ?s ?p ?o }
""");
sparql_update(store, """
INSERT DATA { <s> <p> "o" . }
""");
DESCRIPTION
This module parses, validates, executes, prepares, and diagnoses SPARQL 1.1 Query and Update strings over RDFStore. Query results are returned as dictionaries: select results include variables and results, ask results include boolean, and graph results include quads. Update execution returns a dictionary describing the update operations performed.
EXPORTS
Classes
SPARQLPreparedQueryConstruct with
source. The query is parsed during construction and available fromget_ast.execute(RDFStore store, inherited_dataset := null)Executes the prepared query against
store.
SPARQLPreparedUpdateConstruct with
source. The update is parsed during construction and available fromget_ast.execute(RDFStore store)Executes the prepared update against
store.
Functions
sparql_parse(String query)Parses SPARQL Query or Update syntax and returns an AST dictionary.
sparql_parse_query(String query)Alias for parsing query syntax retained for callers that want a query entry point.
sparql_prepare_query(String query)Returns a
SPARQLPreparedQuery, throwingSPARQLErrorif the source is an update or invalid syntax.sparql_prepare_update(String update)Returns a
SPARQLPreparedUpdate, throwingSPARQLErrorif the source is not an update or has invalid syntax.sparql_validate(String source)Returns a validation dictionary with
ok,type,syntax, anderror.sparql_diagnose(RDFStore store, String source)Validates then executes
source, returning validation information plus aresulton success orerroron failure.sparql_query(RDFStore store, String query, inherited_dataset := null)Executes a SPARQL Query string over
store. Throws if given Update syntax.sparql_update(RDFStore store, String update)Executes a SPARQL Update string over
store. Throws if given Query syntax.
COPYRIGHT AND LICENCE
rdf/sparql is copyright Toby Inkster.
It is free software; you may redistribute it and/or modify it under the terms of either the Artistic License 1.0 or the GNU General Public License version 2.