Commits

Anonymous committed fbcc054

Fix SPARQL queries for use with remote endpoints

  • Participants
  • Parent commits 827cf23

Comments (0)

Files changed (5)

File chempound-api/src/main/java/net/chempound/datastore/TripleStore.java

 
     boolean containsResource(URI uri);
 
-    QueryExecution createQueryExecution(Query query);
+    QueryExecution createQueryExecution(Query query, QuerySolution initialBindings);
 
     List<ItemInfo> getItems(URI aggregationUri);
 

File chempound-app/src/main/java/net/chempound/datastore/AbstractTripleStore.java

         return createQueryExecution(QueryFactory.create(query)).execAsk();
     }
 
-
-    @Override
-    public abstract QueryExecution createQueryExecution(final Query query);
-
-    protected abstract QueryExecution createQueryExecution(final Query query, final QuerySolution initialBindings);
+    protected abstract QueryExecution createQueryExecution(final Query query);
 
     protected abstract Lock getLock();
 

File chempound-app/src/main/java/net/chempound/datastore/JenaTripleStore.java

     private Dataset initDataset(final ChempoundConfiguration configuration) throws IOException {
         final File dir = new File(configuration.getWorkspace(), "tdb/");
         FileUtils.forceMkdir(dir);
-        final Dataset dataset = TDBFactory.createDataset(dir.getPath());
-        return dataset;
+        return TDBFactory.createDataset(dir.getPath());
     }
 
     private Dataset getDataset() {
     }
 
     @Override
-    public QueryExecution createQueryExecution(final Query query) {
+    protected QueryExecution createQueryExecution(final Query query) {
         final QueryExecution qExec = QueryExecutionFactory.create(query, dataset);
         qExec.getContext().set(TDB.symUnionDefaultGraph, true);
         return qExec;
     }
 
     @Override
-    protected QueryExecution createQueryExecution(final Query query, final QuerySolution initialBindings) {
+    public QueryExecution createQueryExecution(final Query query, final QuerySolution initialBindings) {
         final QueryExecution qExec = createQueryExecution(query);
         qExec.setInitialBinding(initialBindings);
         return qExec;

File chempound-app/src/main/java/net/chempound/datastore/RemoteTripleStore.java

     }
 
     @Override
-    public QueryExecution createQueryExecution(final Query query) {
+    protected QueryExecution createQueryExecution(final Query query) {
         return QueryExecutionFactory.sparqlService(endpoint, query);
     }
 
     @Override
-    protected final QueryExecution createQueryExecution(final Query query, final QuerySolution initialBindings) {
+    public final QueryExecution createQueryExecution(final Query query, final QuerySolution initialBindings) {
         final String queryString = generateQueryString(query, initialBindings);
         return QueryExecutionFactory.sparqlService(endpoint, queryString);
     }

File chempound-webapp/src/main/java/net/chempound/webapp/sparql/SparqlResource.java

             getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST, e);
             return null;
         }
-        final QueryExecution qExec = tripleStore.createQueryExecution(query);
-        qExec.getContext().set(TDB.symUnionDefaultGraph, true);
-
+        final QueryExecution qExec = tripleStore.createQueryExecution(query, null);
 
         return html ? new HTMLRepresentation(qExec, queryString) : new XMLRepresentation(qExec);
     }