jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1496493 - in /jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql: core/DatasetGraphMonitor.java core/DatasetGraphWrapper.java core/QueryEngineFactoryWrapper.java engine/QueryEngineFactoryWrapper.java engine/QueryEngineRegistry.java
Date Tue, 25 Jun 2013 14:41:58 GMT
Author: andy
Date: Tue Jun 25 14:41:58 2013
New Revision: 1496493

URL: http://svn.apache.org/r1496493
Log:
DatasetGraphWrapper by default uses the query engine factory as determined by the wrapped
DatasetGraph.

Added:
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QueryEngineFactoryWrapper.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/QueryEngineFactoryWrapper.java
Modified:
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetGraphMonitor.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetGraphWrapper.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/QueryEngineRegistry.java

Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetGraphMonitor.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetGraphMonitor.java?rev=1496493&r1=1496492&r2=1496493&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetGraphMonitor.java
(original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetGraphMonitor.java
Tue Jun 25 14:41:58 2013
@@ -40,7 +40,7 @@ public class DatasetGraphMonitor extends
     private boolean CheckFirst = true ;
     /** Whether to record a no-op (maybe as a comment) */   
     private boolean RecordNoAction = true ;
-    /** Whgere to send the notifications */  
+    /** Where to send the notifications */  
     private final DatasetChanges monitor ;
 
     public DatasetGraphMonitor(DatasetGraph dsg, DatasetChanges monitor) 

Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetGraphWrapper.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetGraphWrapper.java?rev=1496493&r1=1496492&r2=1496493&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetGraphWrapper.java
(original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetGraphWrapper.java
Tue Jun 25 14:41:58 2013
@@ -28,7 +28,7 @@ import com.hp.hpl.jena.sparql.util.Conte
 public class DatasetGraphWrapper implements DatasetGraph
 {
     private final DatasetGraph dsg ;
-    protected final DatasetGraph getWrapped() { return dsg ; }
+    public final DatasetGraph getWrapped() { return dsg ; }
 
     public DatasetGraphWrapper(DatasetGraph dsg)
     {

Added: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QueryEngineFactoryWrapper.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QueryEngineFactoryWrapper.java?rev=1496493&view=auto
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QueryEngineFactoryWrapper.java
(added)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/QueryEngineFactoryWrapper.java
Tue Jun 25 14:41:58 2013
@@ -0,0 +1,70 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.hp.hpl.jena.sparql.core;
+
+import com.hp.hpl.jena.query.Query ;
+import com.hp.hpl.jena.sparql.algebra.Op ;
+import com.hp.hpl.jena.sparql.core.DatasetGraph ;
+import com.hp.hpl.jena.sparql.core.DatasetGraphWrapper ;
+import com.hp.hpl.jena.sparql.engine.Plan ;
+import com.hp.hpl.jena.sparql.engine.QueryEngineFactory ;
+import com.hp.hpl.jena.sparql.engine.QueryEngineRegistry ;
+import com.hp.hpl.jena.sparql.engine.binding.Binding ;
+import com.hp.hpl.jena.sparql.util.Context ;
+
+/** Default processing for a DatasetGraphWrapper - unwrap and repeat */ 
+public class QueryEngineFactoryWrapper implements QueryEngineFactory
+{
+    public static void init() { 
+        QueryEngineRegistry.addFactory(new QueryEngineFactoryWrapper()) ;
+    }
+    
+    @Override
+    public boolean accept(Query query, DatasetGraph dsg, Context context) {
+        if ( !(  dsg instanceof DatasetGraphWrapper ) )
+            return false ;    
+        DatasetGraph dsg2 = ((DatasetGraphWrapper)dsg).getWrapped() ;
+        return QueryEngineRegistry.findFactory(query, dsg2, context).accept(query, dsg2,
context) ;
+    }
+
+    @Override
+    public Plan create(Query query, DatasetGraph dsg, Binding inputBinding, Context context)
{
+        if ( !(  dsg instanceof DatasetGraphWrapper ) )
+            return null ;    
+        DatasetGraph dsg2 = ((DatasetGraphWrapper)dsg).getWrapped() ;
+        return QueryEngineRegistry.findFactory(query, dsg2, context).create(query, dsg2,
inputBinding, context) ;
+    }
+
+    @Override
+    public boolean accept(Op op, DatasetGraph dsg, Context context) {
+        if ( !(  dsg instanceof DatasetGraphWrapper ) )
+            return false ;    
+        DatasetGraph dsg2 = ((DatasetGraphWrapper)dsg).getWrapped() ;
+        return QueryEngineRegistry.findFactory(op, dsg2, context).accept(op, dsg2, context)
;
+    }
+
+    @Override
+    public Plan create(Op op, DatasetGraph dsg, Binding inputBinding, Context context) {
+        if ( !(  dsg instanceof DatasetGraphWrapper ) )
+            return null ;    
+        DatasetGraph dsg2 = ((DatasetGraphWrapper)dsg).getWrapped() ;
+        return QueryEngineRegistry.findFactory(op, dsg2, context).create(op, dsg2, inputBinding,
context) ;
+    }
+}
+

Added: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/QueryEngineFactoryWrapper.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/QueryEngineFactoryWrapper.java?rev=1496493&view=auto
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/QueryEngineFactoryWrapper.java
(added)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/QueryEngineFactoryWrapper.java
Tue Jun 25 14:41:58 2013
@@ -0,0 +1,69 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.hp.hpl.jena.sparql.engine;
+
+import com.hp.hpl.jena.query.Query ;
+import com.hp.hpl.jena.sparql.algebra.Op ;
+import com.hp.hpl.jena.sparql.core.DatasetGraph ;
+import com.hp.hpl.jena.sparql.core.DatasetGraphWrapper ;
+import com.hp.hpl.jena.sparql.engine.Plan ;
+import com.hp.hpl.jena.sparql.engine.QueryEngineFactory ;
+import com.hp.hpl.jena.sparql.engine.QueryEngineRegistry ;
+import com.hp.hpl.jena.sparql.engine.binding.Binding ;
+import com.hp.hpl.jena.sparql.util.Context ;
+
+/** Default processing for a DatasetGraphWrapper - unwrap and repeat */ 
+public class QueryEngineFactoryWrapper implements QueryEngineFactory
+{
+    private static QueryEngineFactory instance = new QueryEngineFactoryWrapper() ;
+    public static QueryEngineFactory get() { return instance ; }
+    
+    @Override
+    public boolean accept(Query query, DatasetGraph dsg, Context context) {
+        if ( !(  dsg instanceof DatasetGraphWrapper ) )
+            return false ;    
+        DatasetGraph dsg2 = ((DatasetGraphWrapper)dsg).getWrapped() ;
+        return QueryEngineRegistry.findFactory(query, dsg2, context).accept(query, dsg2,
context) ;
+    }
+
+    @Override
+    public Plan create(Query query, DatasetGraph dsg, Binding inputBinding, Context context)
{
+        if ( !(  dsg instanceof DatasetGraphWrapper ) )
+            return null ;    
+        DatasetGraph dsg2 = ((DatasetGraphWrapper)dsg).getWrapped() ;
+        return QueryEngineRegistry.findFactory(query, dsg2, context).create(query, dsg2,
inputBinding, context) ;
+    }
+
+    @Override
+    public boolean accept(Op op, DatasetGraph dsg, Context context) {
+        if ( !(  dsg instanceof DatasetGraphWrapper ) )
+            return false ;    
+        DatasetGraph dsg2 = ((DatasetGraphWrapper)dsg).getWrapped() ;
+        return QueryEngineRegistry.findFactory(op, dsg2, context).accept(op, dsg2, context)
;
+    }
+
+    @Override
+    public Plan create(Op op, DatasetGraph dsg, Binding inputBinding, Context context) {
+        if ( !(  dsg instanceof DatasetGraphWrapper ) )
+            return null ;    
+        DatasetGraph dsg2 = ((DatasetGraphWrapper)dsg).getWrapped() ;
+        return QueryEngineRegistry.findFactory(op, dsg2, context).create(op, dsg2, inputBinding,
context) ;
+    }
+}
+

Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/QueryEngineRegistry.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/QueryEngineRegistry.java?rev=1496493&r1=1496492&r2=1496493&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/QueryEngineRegistry.java
(original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/QueryEngineRegistry.java
Tue Jun 25 14:41:58 2013
@@ -49,6 +49,7 @@ public class QueryEngineRegistry
     {
         registry = new QueryEngineRegistry() ;
         registry.add(QueryEngineMain.getFactory()) ;
+        registry.add(QueryEngineFactoryWrapper.get()) ;
     }
     
     /** Locate a suitable factory for this query and dataset from the default registry



Mime
View raw message