jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject jena git commit: Updates for DatasetChange.reset()
Date Fri, 17 Jul 2015 13:32:25 GMT
Repository: jena
Updated Branches:
  refs/heads/master 5e0894224 -> fab8f42e6


Updates for DatasetChange.reset()


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

Branch: refs/heads/master
Commit: fab8f42e6ccad80117cb62ba4c36c089063b348d
Parents: 5e08942
Author: Andy Seaborne <andy@apache.org>
Authored: Fri Jul 17 14:32:17 2015 +0100
Committer: Andy Seaborne <andy@apache.org>
Committed: Fri Jul 17 14:32:17 2015 +0100

----------------------------------------------------------------------
 .../jena/sparql/core/DatasetChangesBatched.java | 76 +++++++++-----------
 .../spatial/SpatialDocProducerTriples.java      |  3 +
 .../jena/query/text/TextDocProducerTriples.java |  3 +
 .../assembler/TestTextDatasetAssembler.java     |  6 ++
 4 files changed, 47 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/fab8f42e/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetChangesBatched.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetChangesBatched.java
b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetChangesBatched.java
index 5e71afd..7dcdff6 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetChangesBatched.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetChangesBatched.java
@@ -16,81 +16,76 @@
  * limitations under the License.
  */
 
-package org.apache.jena.sparql.core;
+package org.apache.jena.sparql.core ;
 
 import java.util.ArrayList ;
 import java.util.List ;
-import java.util.Objects;
+import java.util.Objects ;
 
 import org.apache.jena.graph.Node ;
 
-/** Collect a stream of DatasetChanges into batches.
- *  A batch is adjacent quads changes with  
- *  (same graph, same subject, same action).  
+/**
+ * Collect a stream of DatasetChanges into batches. A batch is adjacent quads
+ * changes with (same graph, same subject, same action).
  */
-public abstract class DatasetChangesBatched implements DatasetChanges
-{
-    private QuadAction currentAction    = null ;
-    private Node currentSubject         = null ;
-    private Node currentGraph           = null ;
-    private List<Quad>   batchQuads     = null ;
-    private boolean mergeBlankNodes     = false ;
-
-    protected DatasetChangesBatched()
-    {
+public abstract class DatasetChangesBatched implements DatasetChanges {
+    private QuadAction currentAction   = null ;
+    private Node       currentSubject  = null ;
+    private Node       currentGraph    = null ;
+    private List<Quad> batchQuads      = null ;
+    private boolean    mergeBlankNodes = false ;
+
+    protected DatasetChangesBatched() {
         this(false) ;
     }
-    
-    /* Merge bNodes in a batch - i.e. include them in the current batch, not as new entities
*/ 
-    protected DatasetChangesBatched(boolean mergeBNodes)
-    {
+
+    /*
+     * Merge bNodes in a batch - i.e. include them in the current batch, not as
+     * new entities
+     */
+    protected DatasetChangesBatched(boolean mergeBNodes) {
         this.mergeBlankNodes = mergeBNodes ;
     }
-    
-    @Override public final void start()
-    {
+
+    @Override
+    public final void start() {
         startBatched() ;
         startBatch() ;
     }
 
-    @Override public final void finish()
-    {
+    @Override
+    public final void finish() {
         finishBatch() ;
         finishBatched() ;
     }
 
     @Override
-    public void change(QuadAction qaction, Node g, Node s, Node p, Node o)
-    {
-        if ( mergeBlankNodes && s.isBlank() )
-        {
+    public final void reset() { }
+
+    @Override
+    public void change(QuadAction qaction, Node g, Node s, Node p, Node o) {
+        if ( mergeBlankNodes && s.isBlank() ) {
             if ( batchQuads == null )
                 // No active batch.
                 startBatch() ;
             // Drop and through and include in the current batch.
-        }
-        else if ( ! Objects.equals(currentAction, qaction) ||
-                  ! Objects.equals(currentGraph, g) ||
-                  ! Objects.equals(currentSubject, s) )
-        {
+        } else if ( !Objects.equals(currentAction, qaction) || !Objects.equals(currentGraph,
g) || !Objects.equals(currentSubject, s) ) {
             finishBatch() ;
             startBatch() ;
             currentAction = qaction ;
             currentGraph = g ;
             currentSubject = s ;
         }
-        
-        batchQuads.add(new Quad(g,s,p,o)) ;
+
+        batchQuads.add(new Quad(g, s, p, o)) ;
     }
-    
-    private void startBatch()
-    {
+
+    private void startBatch() {
         if ( batchQuads == null )
             batchQuads = new ArrayList<>() ;
     }
 
-    protected void finishBatch()
-    {
+    protected void finishBatch() {
         if ( batchQuads == null || batchQuads.size() == 0 )
             return ;
         dispatch(currentAction, batchQuads) ;
@@ -104,4 +99,3 @@ public abstract class DatasetChangesBatched implements DatasetChanges
     protected abstract void finishBatched() ;
 
 }
-

http://git-wip-us.apache.org/repos/asf/jena/blob/fab8f42e/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialDocProducerTriples.java
----------------------------------------------------------------------
diff --git a/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialDocProducerTriples.java
b/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialDocProducerTriples.java
index e3f0b73..28f8a3e 100644
--- a/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialDocProducerTriples.java
+++ b/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialDocProducerTriples.java
@@ -56,4 +56,7 @@ public class SpatialDocProducerTriples implements SpatialDocProducer {
 			return;
 		context.index(g, s, p, o);
 	}
+
+    @Override
+    public void reset() {}
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/fab8f42e/jena-text/src/main/java/org/apache/jena/query/text/TextDocProducerTriples.java
----------------------------------------------------------------------
diff --git a/jena-text/src/main/java/org/apache/jena/query/text/TextDocProducerTriples.java
b/jena-text/src/main/java/org/apache/jena/query/text/TextDocProducerTriples.java
index 51f5480..f641924 100644
--- a/jena-text/src/main/java/org/apache/jena/query/text/TextDocProducerTriples.java
+++ b/jena-text/src/main/java/org/apache/jena/query/text/TextDocProducerTriples.java
@@ -53,6 +53,9 @@ public class TextDocProducerTriples implements TextDocProducer {
     }
 
     @Override
+    public void reset() { }
+
+    @Override
     public void change(QuadAction qaction, Node g, Node s, Node p, Node o) {
         // One document per triple/quad
 

http://git-wip-us.apache.org/repos/asf/jena/blob/fab8f42e/jena-text/src/test/java/org/apache/jena/query/text/assembler/TestTextDatasetAssembler.java
----------------------------------------------------------------------
diff --git a/jena-text/src/test/java/org/apache/jena/query/text/assembler/TestTextDatasetAssembler.java
b/jena-text/src/test/java/org/apache/jena/query/text/assembler/TestTextDatasetAssembler.java
index 9826118..dbef4df 100644
--- a/jena-text/src/test/java/org/apache/jena/query/text/assembler/TestTextDatasetAssembler.java
+++ b/jena-text/src/test/java/org/apache/jena/query/text/assembler/TestTextDatasetAssembler.java
@@ -135,6 +135,9 @@ public class TestTextDatasetAssembler extends AbstractTestTextAssembler
{
 
         @Override
         public void change(QuadAction qaction, Node g, Node s, Node p, Node o) { }
+
+        @Override
+        public void reset() {}
     }
 
 
@@ -160,6 +163,9 @@ public class TestTextDatasetAssembler extends AbstractTestTextAssembler
{
         public void change(QuadAction qaction, Node g, Node s, Node p, Node o) { 
             lastSubject = s;
         }
+
+        @Override
+        public void reset() {}
     }
 
 }


Mime
View raw message