jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rve...@apache.org
Subject svn commit: r1442671 - /jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/update/UpdateAction.java
Date Tue, 05 Feb 2013 17:32:16 GMT
Author: rvesse
Date: Tue Feb  5 17:32:16 2013
New Revision: 1442671

URL: http://svn.apache.org/viewvc?rev=1442671&view=rev
Log:
Fix UpdateAction.execute() to fallback to non-streaming when a streaming engine is not available

Modified:
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/update/UpdateAction.java

Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/update/UpdateAction.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/update/UpdateAction.java?rev=1442671&r1=1442670&r2=1442671&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/update/UpdateAction.java (original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/update/UpdateAction.java Tue Feb  5
17:32:16 2013
@@ -28,6 +28,7 @@ import com.hp.hpl.jena.query.Dataset ;
 import com.hp.hpl.jena.query.QuerySolution ;
 import com.hp.hpl.jena.query.Syntax ;
 import com.hp.hpl.jena.rdf.model.Model ;
+import com.hp.hpl.jena.sparql.ARQException;
 import com.hp.hpl.jena.sparql.core.DatasetGraph ;
 import com.hp.hpl.jena.sparql.engine.binding.Binding ;
 import com.hp.hpl.jena.sparql.engine.binding.BindingUtils ;
@@ -343,18 +344,23 @@ public class UpdateAction
     {
         UpdateProcessorStreaming uProc = UpdateExecutionFactory.createStreaming(graphStore,
binding) ;
         
-        uProc.startRequest();
-        try
-        {
-            UpdateSink sink = uProc.getUpdateSink();
-            Iter.sendToSink(request, sink);  // Will call close on sink if there are no exceptions
-        }
-        finally
-        {
-            uProc.finishRequest();
+        if (uProc != null) {
+            // Use streaming update
+            uProc.startRequest();
+            try {
+                UpdateSink sink = uProc.getUpdateSink();
+                // Will call close on sink if there are no exceptions
+                Iter.sendToSink(request, sink);
+            } finally {
+                uProc.finishRequest();
+            }
+        } else {
+            // Fallback to non-streaming update
+            UpdateProcessor uProc2 = UpdateExecutionFactory.create(request, graphStore, binding);
+            if (uProc2 == null)
+                throw new ARQException("No suitable update procesors are registered/able
to execute your updates");
+            uProc2.execute();
         }
-        
-        
     }
     
     /** Execute a single SPARQL Update operation.



Mime
View raw message