You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by ca...@apache.org on 2011/09/12 21:52:42 UTC
svn commit: r1169897 - in /incubator/jena/Jena2/ARQ/trunk:
src-test/com/hp/hpl/jena/sparql/engine/iterator/
src-test/com/hp/hpl/jena/sparql/modify/ src/com/hp/hpl/jena/query/
src/com/hp/hpl/jena/sparql/engine/iterator/
src/com/hp/hpl/jena/sparql/modify/
Author: castagna
Date: Mon Sep 12 19:52:42 2011
New Revision: 1169897
URL: http://svn.apache.org/viewvc?rev=1169897&view=rev
Log:
JENA-44 and JENA-45
Moved spillOnDiskSortingThreshold and spillOnDiskUpdateThreshold symbols to ARQ where all they should be.
Modified:
incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/engine/iterator/TestQueryIterSort.java
incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/modify/TestUpdateGraph.java
incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/query/ARQ.java
incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/engine/iterator/QueryIterSort.java
incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/modify/UpdateEngineWorker.java
Modified: incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/engine/iterator/TestQueryIterSort.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/engine/iterator/TestQueryIterSort.java?rev=1169897&r1=1169896&r2=1169897&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/engine/iterator/TestQueryIterSort.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/engine/iterator/TestQueryIterSort.java Mon Sep 12 19:52:42 2011
@@ -35,6 +35,7 @@ import org.openjena.atlas.io.IndentedWri
import com.hp.hpl.jena.datatypes.xsd.XSDDatatype ;
import com.hp.hpl.jena.graph.Graph ;
import com.hp.hpl.jena.graph.Node ;
+import com.hp.hpl.jena.query.ARQ ;
import com.hp.hpl.jena.query.Query ;
import com.hp.hpl.jena.query.QueryCancelledException ;
import com.hp.hpl.jena.query.SortCondition ;
@@ -113,7 +114,7 @@ public class TestQueryIterSort {
iterator.setCallback(new Callback() { public void call() { /* do nothing */ } });
assertEquals(0, iterator.getReturnedElementCount());
Context context = new Context() ;
- context.set(QueryIterSort.spillOnDiskSortingThreshold, 10L) ;
+ context.set(ARQ.spillOnDiskSortingThreshold, 10L) ;
ExecutionContext executionContext = new ExecutionContext(context, (Graph)null, (DatasetGraph)null, (OpExecutorFactory)null) ;
QueryIterSort qIter = new QueryIterSort(iterator, comparator, executionContext) ;
try
@@ -138,7 +139,7 @@ public class TestQueryIterSort {
iterator.setCallback(new Callback() { public void call() { /* do nothing */ } });
assertEquals(0, iterator.getReturnedElementCount());
Context context = new Context() ;
- context.set(QueryIterSort.spillOnDiskSortingThreshold, 10L) ;
+ context.set(ARQ.spillOnDiskSortingThreshold, 10L) ;
ExecutionContext executionContext = new ExecutionContext(context, (Graph)null, (DatasetGraph)null, (OpExecutorFactory)null) ;
QueryIterSort qIter = new QueryIterSort(iterator, comparator, executionContext) ;
@@ -162,7 +163,7 @@ public class TestQueryIterSort {
assertEquals(0, iterator.getReturnedElementCount());
Context context = new Context() ;
- context.set(QueryIterSort.spillOnDiskSortingThreshold, 10L) ;
+ context.set(ARQ.spillOnDiskSortingThreshold, 10L) ;
ExecutionContext executionContext = new ExecutionContext(context, (Graph)null, (DatasetGraph)null, (OpExecutorFactory)null) ;
QueryIterSort qIter = new QueryIterSort(iterator, comparator, executionContext) ;
try
@@ -188,7 +189,7 @@ public class TestQueryIterSort {
{
assertEquals(0, iterator.getReturnedElementCount());
Context context = new Context() ;
- context.set(QueryIterSort.spillOnDiskSortingThreshold, 10L) ;
+ context.set(ARQ.spillOnDiskSortingThreshold, 10L) ;
ExecutionContext executionContext = new ExecutionContext(context, (Graph)null, (DatasetGraph)null, (OpExecutorFactory)null) ;
QueryIterSort qIter = new QueryIterSort(iterator, comparator, executionContext) ;
try
@@ -221,7 +222,7 @@ public class TestQueryIterSort {
iterator.setCallback(new Callback() { public void call() { /* do nothing */ } });
assertEquals(0, iterator.getReturnedElementCount());
Context context = new Context() ;
- context.set(QueryIterSort.spillOnDiskSortingThreshold, 10L) ;
+ context.set(ARQ.spillOnDiskSortingThreshold, 10L) ;
ExecutionContext executionContext = new ExecutionContext(context, (Graph)null, (DatasetGraph)null, (OpExecutorFactory)null) ;
QueryIterSort qIter = new QueryIterSort(iterator, comparator, executionContext) ;
try
Modified: incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/modify/TestUpdateGraph.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/modify/TestUpdateGraph.java?rev=1169897&r1=1169896&r2=1169897&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/modify/TestUpdateGraph.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/modify/TestUpdateGraph.java Mon Sep 12 19:52:42 2011
@@ -13,6 +13,7 @@ import com.hp.hpl.jena.graph.Factory ;
import com.hp.hpl.jena.graph.Graph ;
import com.hp.hpl.jena.graph.Node ;
import com.hp.hpl.jena.graph.Triple ;
+import com.hp.hpl.jena.query.ARQ ;
import com.hp.hpl.jena.query.QueryFactory ;
import com.hp.hpl.jena.sparql.core.Quad ;
import com.hp.hpl.jena.sparql.core.Var ;
@@ -222,7 +223,7 @@ public abstract class TestUpdateGraph ex
GraphStore gStore = getEmptyGraphStore() ;
// Set the threshold to in order to force spill to disk
- gStore.getContext().set(UpdateEngineWorker.spillOnDiskUpdateThreshold, 0L) ;
+ gStore.getContext().set(ARQ.spillOnDiskUpdateThreshold, 0L) ;
defaultGraphData(gStore, data(t)) ;
namedGraphData(gStore, graphIRI, data(t));
@@ -249,7 +250,7 @@ public abstract class TestUpdateGraph ex
GraphStore gStore = getEmptyGraphStore() ;
// Set the threshold to in order to force spill to disk
- gStore.getContext().set(UpdateEngineWorker.spillOnDiskUpdateThreshold, 0L) ;
+ gStore.getContext().set(ARQ.spillOnDiskUpdateThreshold, 0L) ;
defaultGraphData(gStore, data(triple1, triple2, t)) ;
namedGraphData(gStore, graphIRI, data(t2));
Modified: incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/query/ARQ.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/query/ARQ.java?rev=1169897&r1=1169896&r2=1169897&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/query/ARQ.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/query/ARQ.java Mon Sep 12 19:52:42 2011
@@ -198,6 +198,14 @@ public class ARQ
public static final Symbol javaRegex = ARQConstants.allocSymbol("javaRegex") ;
/** Symbol to name the Xerces-J regular expression engine */
public static final Symbol xercesRegex = ARQConstants.allocSymbol("xercesRegex") ;
+
+ // Spilling controls.
+
+ /** Symbol to set the threshold representing the number of bindings when to use external sorting for queries using ORDER BY */
+ public static final Symbol spillOnDiskSortingThreshold = ARQConstants.allocSymbol("spillOnDiskSortingThreshold") ;
+
+ /** Symbol to set the threshold representing the number of bindings when to spill on disk when an update is received */
+ public static final Symbol spillOnDiskUpdateThreshold = ARQConstants.allocSymbol("spillOnDiskUpdateThreshold") ;
// Optimizer controls.
Modified: incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/engine/iterator/QueryIterSort.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/engine/iterator/QueryIterSort.java?rev=1169897&r1=1169896&r2=1169897&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/engine/iterator/QueryIterSort.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/engine/iterator/QueryIterSort.java Mon Sep 12 19:52:42 2011
@@ -21,14 +21,13 @@ import org.openjena.atlas.iterator.Itera
import org.openjena.atlas.lib.Closeable ;
import org.openjena.riot.SerializationFactoryFinder ;
+import com.hp.hpl.jena.query.ARQ ;
import com.hp.hpl.jena.query.QueryCancelledException ;
import com.hp.hpl.jena.query.SortCondition ;
-import com.hp.hpl.jena.sparql.ARQConstants ;
import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
import com.hp.hpl.jena.sparql.engine.QueryIterator ;
import com.hp.hpl.jena.sparql.engine.binding.Binding ;
import com.hp.hpl.jena.sparql.engine.binding.BindingComparator ;
-import com.hp.hpl.jena.sparql.util.Symbol ;
/**
* Sort a query iterator. The sort will happen in-memory unless the size of the
@@ -39,7 +38,6 @@ import com.hp.hpl.jena.sparql.util.Symbo
public class QueryIterSort extends QueryIterPlainWrapper
{
- public static final Symbol spillOnDiskSortingThreshold = ARQConstants.allocSymbol("spillOnDiskSortingThreshold") ;
private static final long defaultSpillOnDiskSortingThreshold = -1 ; // off by default
private final QueryIterator embeddedIterator; // Keep a record of the underlying source for .cancel.
@@ -55,7 +53,7 @@ public class QueryIterSort extends Query
super(null, context) ;
this.embeddedIterator = qIter ;
- long threshold = (Long)context.getContext().get(spillOnDiskSortingThreshold, defaultSpillOnDiskSortingThreshold) ;
+ long threshold = (Long)context.getContext().get(ARQ.spillOnDiskSortingThreshold, defaultSpillOnDiskSortingThreshold) ;
ThresholdPolicy<Binding> policy = (threshold >= 0) ? new ThresholdPolicyCount<Binding>(threshold) : new ThresholdPolicyNever<Binding>() ;
this.db = BagFactory.newSortedBag(policy, SerializationFactoryFinder.bindingSerializationFactory(), comparator);
Modified: incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/modify/UpdateEngineWorker.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/modify/UpdateEngineWorker.java?rev=1169897&r1=1169896&r2=1169897&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/modify/UpdateEngineWorker.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/modify/UpdateEngineWorker.java Mon Sep 12 19:52:42 2011
@@ -23,11 +23,11 @@ import org.openjena.riot.SerializationFa
import com.hp.hpl.jena.graph.Graph ;
import com.hp.hpl.jena.graph.Node ;
import com.hp.hpl.jena.graph.Triple ;
+import com.hp.hpl.jena.query.ARQ ;
import com.hp.hpl.jena.query.Query ;
import com.hp.hpl.jena.query.QueryExecutionFactory ;
import com.hp.hpl.jena.rdf.model.Model ;
import com.hp.hpl.jena.rdf.model.ModelFactory ;
-import com.hp.hpl.jena.sparql.ARQConstants;
import com.hp.hpl.jena.sparql.ARQInternalErrorException ;
import com.hp.hpl.jena.sparql.core.DatasetGraph ;
import com.hp.hpl.jena.sparql.core.DatasetGraphMap ;
@@ -57,7 +57,6 @@ import com.hp.hpl.jena.sparql.syntax.Ele
import com.hp.hpl.jena.sparql.syntax.ElementGroup ;
import com.hp.hpl.jena.sparql.syntax.ElementNamedGraph ;
import com.hp.hpl.jena.sparql.syntax.ElementTriplesBlock ;
-import com.hp.hpl.jena.sparql.util.Symbol;
import com.hp.hpl.jena.sparql.util.graph.GraphFactory ;
import com.hp.hpl.jena.update.GraphStore ;
import com.hp.hpl.jena.update.UpdateException ;
@@ -67,7 +66,6 @@ import com.hp.hpl.jena.util.FileManager
public class UpdateEngineWorker implements UpdateVisitor
{
static final long defaultSpillOnDiskUpdateThreshold = -1 ;
- public static final Symbol spillOnDiskUpdateThreshold = ARQConstants.allocSymbol("spillOnDiskUpdateThreshold") ;
protected final GraphStore graphStore ;
protected final Binding initialBinding ;
@@ -78,7 +76,7 @@ public class UpdateEngineWorker implemen
{
this.graphStore = graphStore ;
this.initialBinding = initialBinding ;
- this.spillThreshold = (Long)graphStore.getContext().get(spillOnDiskUpdateThreshold, defaultSpillOnDiskUpdateThreshold) ;
+ this.spillThreshold = (Long)graphStore.getContext().get(ARQ.spillOnDiskUpdateThreshold, defaultSpillOnDiskUpdateThreshold) ;
}
public void visit(UpdateDrop update)
@@ -217,7 +215,7 @@ public class UpdateEngineWorker implemen
Graph gDest = graph(gStore, dest) ;
// Avoids concurrency problems by reading fully before writing
- long threshold = (Long)gStore.getContext().get(spillOnDiskUpdateThreshold, defaultSpillOnDiskUpdateThreshold) ;
+ long threshold = (Long)gStore.getContext().get(ARQ.spillOnDiskUpdateThreshold, defaultSpillOnDiskUpdateThreshold) ;
ThresholdPolicy<Triple> policy = (threshold >= 0) ? new ThresholdPolicyCount<Triple>(threshold) : new ThresholdPolicyNever<Triple>();
DataBag<Triple> db = BagFactory.newDefaultBag(policy, SerializationFactoryFinder.tripleSerializationFactory()) ;
try