From: <tho...@us...> - 2014-07-10 19:33:32
|
Revision: 8535 http://sourceforge.net/p/bigdata/code/8535 Author: thompsonbry Date: 2014-07-10 19:33:29 +0000 (Thu, 10 Jul 2014) Log Message: ----------- Added a generalized case for arbitrary application logic for stored queries. There is also a special case for a parameterized SPARQL query. See #989 (Stored query service) Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/service/storedquery/StoredQueryService.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/store/BD.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/stored-query-002.rq branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/service/storedquery/TestStoredQueryService.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/service/storedquery/StoredQueryService.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/service/storedquery/StoredQueryService.java 2014-07-10 18:35:39 UTC (rev 8534) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/service/storedquery/StoredQueryService.java 2014-07-10 19:33:29 UTC (rev 8535) @@ -54,15 +54,16 @@ * a SPARQL query or arbitrary procedural application logic, but it must * evaluate to a solution multi-set. The service interface is written to the * openrdf interfaces in order to remove the burden of dealing with bigdata - * {@link IV}s from the application. The effective value of the baseURI during - * query evaluation will be the SERVICE URI. + * {@link IV}s from the application. * <p> * In order to use a stored query, a concrete instance of this class must be - * registered against the {@link ServiceRegistry}: + * registered against the {@link ServiceRegistry}. The choice of the SERVICE URI + * is up to the application. The effective value of the baseURI during query + * evaluation will be the SERVICE URI. * * <pre> - * final URI serviceURI = new URIImpl(StoredQueryService.Options.NAMESPACE - * + "my-service"); + * final URI serviceURI = new URIImpl( + * "http://www.bigdata.com/rdf/stored-query#my-stored-query"); * * ServiceRegistry.getInstance().add(serviceURI, new MyStoredQueryService()); * </pre> @@ -72,7 +73,7 @@ * * <pre> * SELECT * { - * SERVICE <http://www.bigdata.com/rdf/stored-query#my-service> { } + * SERVICE <http://www.bigdata.com/rdf/stored-query#my-stored-query> { } * } * </pre> * @@ -82,7 +83,7 @@ * * <pre> * SELECT * { - * SERVICE <http://www.bigdata.com/rdf/stored-query#my-service> { + * SERVICE <http://www.bigdata.com/rdf/stored-query#my-stored-query> { * bd:serviceParam :color :"blue" . * bd:serviceParam :color :"green" . * bd:serviceParam :size :"large" . @@ -101,48 +102,24 @@ * * @see <a href="http://trac.bigdata.com/ticket/989">Stored Query Service</a> * - * TODO Wiki page. + * FIXME Wiki page. * - * TODO Implicit prefix declaration for bsq. + * FIXME Generalize to support groovy scripting. * - * TODO Why does this work? - * - * <pre> - * SELECT ?book ?title ?price - * { - * SERVICE <http://www.bigdata.com/rdf/stored-query#test_stored_query_001> { - * } - * } - * </pre> - * - * while this does not work - * - * <pre> - * PREFIX bsq: <http://www.bigdata.com/rdf/stored-query#> - * - * SELECT ?book ?title ?price - * { - * SERVICE <bsq#test_stored_query_001> { - * } - * } - * </pre> - * * TODO We could use {@link ASTEvalHelper} to evaluate at the bigdata level * without forcing the materialization of any variable bindings from the * lexicon indices. This would be faster for some purposes, especially if * the stored procedure is only used to JOIN into an outer query as in * <code>SELECT * { SERVICE bsq:my-service {} }</code> - * - * FIXME Generalize to support groovy scripting. */ abstract public class StoredQueryService implements ServiceFactory { public interface Options { - /** - * The namespace used for stored query service. - */ - String NAMESPACE = "http://www.bigdata.com/rdf/stored-query#"; +// /** +// * The namespace used for stored query service. +// */ +// String NAMESPACE = "http://www.bigdata.com/rdf/stored-query#"; } @@ -207,7 +184,7 @@ * * @param cxn * The connection that should be used to read on the SPARQL - * database. + * database. The connection will be closed by the caller. * @param createParams * The SERVICE creation parameters. * @param serviceParams Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/store/BD.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/store/BD.java 2014-07-10 18:35:39 UTC (rev 8534) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/store/BD.java 2014-07-10 19:33:29 UTC (rev 8535) @@ -42,7 +42,6 @@ * A vocabulary for bigdata specific extensions. * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ */ public interface BD { Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/stored-query-002.rq =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/stored-query-002.rq 2014-07-10 18:35:39 UTC (rev 8534) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/stored-query-002.rq 2014-07-10 19:33:29 UTC (rev 8535) @@ -1,4 +1,3 @@ -PREFIX bsq: <http://www.bigdata.com/rdf/stored-query#> PREFIX : <http://example.org/book/> SELECT ?book ?title ?price Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/service/storedquery/TestStoredQueryService.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/service/storedquery/TestStoredQueryService.java 2014-07-10 18:35:39 UTC (rev 8534) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/service/storedquery/TestStoredQueryService.java 2014-07-10 19:33:29 UTC (rev 8535) @@ -60,6 +60,8 @@ super(name); } + static private final String NAMESPACE = "http://www.bigdata.com/rdf/stored-query#"; + /** * Simple stored query test. Note that this test also verifies that the * BINDINGS flow into the stored query. @@ -100,7 +102,7 @@ } - final URI serviceURI = new URIImpl(StoredQueryService.Options.NAMESPACE + getName()); + final URI serviceURI = new URIImpl( NAMESPACE + getName()); try { // register the service. @@ -167,7 +169,7 @@ } - final URI serviceURI = new URIImpl(StoredQueryService.Options.NAMESPACE + getName()); + final URI serviceURI = new URIImpl(NAMESPACE+ getName()); try { // register the service. @@ -244,7 +246,7 @@ } - final URI serviceURI = new URIImpl(StoredQueryService.Options.NAMESPACE + getName()); + final URI serviceURI = new URIImpl(NAMESPACE+ getName()); try { // register the service. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |