Create a SERVICE that permits developers to register and execute stored queries.
A stored query could be any of:
- A simple SPARQL query;
- Java procedural code that can execute multiple queries with arbitrary application logic.
- A groovy script.
See the wiki page for more detail: http://wiki.bigdata.com/wiki/index.php/StoredQuery
Here is an example stored query SERVICE invocation. The SERVICE URI is whatever URI you used when you registered your stored query.
The result of a stored query are a solution multi-set. The top-level query may use that multi-set to project out a SPARQL result set, CONSTRUCT triples or quads, etc.
The parameters passed into the stored query are declared by:
This produces a set containing the distinct predicates (which are the keys) to the LIST of values for each key (the Objects). This is a general purpose mechanism for passing in arguments to the stored query.
The main implementation class is StoredQueryService. This can be used for arbitrary application logic.
There is also a SimpleStoredQueryService that runs a parameterized SPARQL query.
Note: For HA, the application will need to register the stored query against each HAJournalServer instance. This is easy enough if it is done at compile time by hooking the BigdataRDFServletContextListener using ConfigParams.SERVLET_CONTEXT_LISTENER_CLASS
See http://wiki.bigdata.com/wiki/index.php/StoredQuery (Wiki page for stored queries)