jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [1/2] jena git commit: [JENA-1392] Add DynamicDatasets support to QueryEngineSDB for FROM and FROM NAMED queries
Date Wed, 20 Sep 2017 17:41:43 GMT
Repository: jena
Updated Branches:
  refs/heads/master 10748f7c7 -> 01f9b6f01


[JENA-1392] Add DynamicDatasets support to QueryEngineSDB for FROM and FROM NAMED queries


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/b8064844
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/b8064844
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/b8064844

Branch: refs/heads/master
Commit: b80648446f6dc3f0a0dd23394c8bc4bc8b09eeab
Parents: 10748f7
Author: Graham Triggs <gtriggs@duraspace.org>
Authored: Sun Sep 17 11:32:42 2017 +0100
Committer: Graham Triggs <gtriggs@duraspace.org>
Committed: Sun Sep 17 11:32:42 2017 +0100

----------------------------------------------------------------------
 .../apache/jena/sdb/engine/QueryEngineSDB.java  | 23 +++++++++++---------
 1 file changed, 13 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/b8064844/jena-sdb/src/main/java/org/apache/jena/sdb/engine/QueryEngineSDB.java
----------------------------------------------------------------------
diff --git a/jena-sdb/src/main/java/org/apache/jena/sdb/engine/QueryEngineSDB.java b/jena-sdb/src/main/java/org/apache/jena/sdb/engine/QueryEngineSDB.java
index 8f3e826..ed7f0ce 100644
--- a/jena-sdb/src/main/java/org/apache/jena/sdb/engine/QueryEngineSDB.java
+++ b/jena-sdb/src/main/java/org/apache/jena/sdb/engine/QueryEngineSDB.java
@@ -33,7 +33,9 @@ import org.apache.jena.sparql.algebra.Op ;
 import org.apache.jena.sparql.algebra.Transformer ;
 import org.apache.jena.sparql.algebra.optimize.TransformFilterEquality ;
 import org.apache.jena.sparql.algebra.optimize.TransformPropertyFunction ;
+import org.apache.jena.sparql.core.DatasetDescription;
 import org.apache.jena.sparql.core.DatasetGraph ;
+import org.apache.jena.sparql.core.DynamicDatasets;
 import org.apache.jena.sparql.engine.* ;
 import org.apache.jena.sparql.engine.binding.Binding ;
 import org.apache.jena.sparql.engine.binding.BindingRoot ;
@@ -80,12 +82,11 @@ public class QueryEngineSDB extends QueryEngineBase
     {
         if ( context == null )
             context = ARQ.getContext().copy() ;
-        // See "DynamicDatasets" -- this could be enabled.
-        if ( query != null )
-        {
-            if ( query.hasDatasetDescription() )
-                throw new SDBException("Queries with dataset descriptions (FROM/FROM NAMED)
not supported" ) ;   
-        }
+
+        DatasetDescription dsDesc = DatasetDescription.create(query, context) ;
+        if ( dsDesc != null )
+            super.dataset = DynamicDatasets.dynamicDataset(dsDesc, dataset, context.isTrue(SDB.unionDefaultGraph)
) ;
+
         if ( context.isDefined(ARQConstants.sysDatasetDescription) )
             throw new SDBException("Queries with dataset descriptions set in the context
not supported" ) ;
         
@@ -100,9 +101,11 @@ public class QueryEngineSDB extends QueryEngineBase
         // Do property functions.
         op = Transformer.transform(new TransformPropertyFunction(context), op) ;
         op = Transformer.transform(new TransformFilterEquality(), op) ;
-        
+
         // Quad it now so it can be passed to Compile.compile
-        op = Algebra.toQuadForm(op) ;
+        // Only apply if not a rewritten DynamicDataset
+        if ( dsDesc == null )
+            op = Algebra.toQuadForm(op) ;
         
         // Compile to SQL / extract parts to execute as SQL.
         op = SDBCompile.compile(store, op, initialBinding, context, request) ;
@@ -122,8 +125,8 @@ public class QueryEngineSDB extends QueryEngineBase
     public QueryIterator eval(Op op, DatasetGraph dsg, Binding binding, Context context)
     {
         ExecutionContext execCxt = new ExecutionContext(context, dsg.getDefaultGraph(), dsg,
QC.getFactory(context)) ;
-        
-        // This pattern is common to QueryEngineMain - find a sharing pattern 
+
+        // This pattern is common to QueryEngineMain - find a sharing pattern
         if ( ! ( op instanceof OpSQL ) )
         {
             // Not top - invoke the main query engine as a framework to


Mime
View raw message