You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2018/02/22 15:04:28 UTC

[1/2] jena git commit: JENA-1482: tests for null NodeIds at the TDB level

Repository: jena
Updated Branches:
  refs/heads/master 592ebd4d7 -> c6e13b7a4


JENA-1482: tests for null NodeIds at the TDB level


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

Branch: refs/heads/master
Commit: a850230c6b883adcf469e20b6ae761a536c29379
Parents: 592ebd4
Author: Andy Seaborne <an...@apache.org>
Authored: Wed Feb 21 14:12:48 2018 +0000
Committer: Andy Seaborne <an...@apache.org>
Committed: Wed Feb 21 15:00:25 2018 +0000

----------------------------------------------------------------------
 .../java/org/apache/jena/tdb2/solver/BindingTDB.java   | 13 +++++++++----
 .../java/org/apache/jena/tdb2/solver/SolverLib.java    |  3 +++
 .../java/org/apache/jena/tdb/solver/BindingTDB.java    |  8 ++++++--
 .../java/org/apache/jena/tdb/solver/SolverLib.java     |  4 +++-
 4 files changed, 21 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/a850230c/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/solver/BindingTDB.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/solver/BindingTDB.java b/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/solver/BindingTDB.java
index 25e0534..194cb44 100644
--- a/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/solver/BindingTDB.java
+++ b/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/solver/BindingTDB.java
@@ -26,6 +26,7 @@ import org.apache.jena.riot.out.NodeFmtLib ;
 import org.apache.jena.sparql.core.Var ;
 import org.apache.jena.sparql.engine.binding.Binding ;
 import org.apache.jena.sparql.engine.binding.BindingBase ;
+import org.apache.jena.tdb2.TDBException;
 import org.apache.jena.tdb2.store.NodeId;
 import org.apache.jena.tdb2.store.nodetable.NodeTable;
 
@@ -98,11 +99,12 @@ public class BindingTDB extends BindingBase
         NodeId id = idBinding.get(var) ;
         if ( id != null )
             return id ;
-        
-        if ( parent == null )
-            return null ; 
+        // In case we are inserting known missing nodes. 
+        if ( NodeId.isDoesNotExist(id) )
+            return null ;
 
-        // Maybe in the parent.
+        if ( parent == null )
+            return null ;
         if ( parent instanceof BindingTDB )
             return ((BindingTDB)parent).getNodeId(var) ;
         return null ;
@@ -120,6 +122,9 @@ public class BindingTDB extends BindingBase
             if ( id == null )
                 return null ; 
             n = nodeTable.getNodeForNodeId(id) ;
+            if ( n == null )
+                // But there was to put it in the BindingNodeId. 
+                throw new TDBException("No node in NodeTable for NodeId "+id);
             // Update cache.
             cachePut(var, n) ;
             return n ;

http://git-wip-us.apache.org/repos/asf/jena/blob/a850230c/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/solver/SolverLib.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/solver/SolverLib.java b/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/solver/SolverLib.java
index 3f0cc3c..160c8be 100644
--- a/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/solver/SolverLib.java
+++ b/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/solver/SolverLib.java
@@ -255,6 +255,9 @@ public class SolverLib
             // repeatedly looking up the same node in different bindings.
             NodeId id = nodeTable.getNodeIdForNode(n) ;
             // Even put in "does not exist" for a node now known not to be in the DB.
+            // Optional: whether to put in "known missing"
+            // Currently, we do. The rest of the code should work with either choice.
+            //if ( ! NodeId.isDoesNotExist(id) )
             b.put(v, id) ;
         }
         return b ;

http://git-wip-us.apache.org/repos/asf/jena/blob/a850230c/jena-tdb/src/main/java/org/apache/jena/tdb/solver/BindingTDB.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/solver/BindingTDB.java b/jena-tdb/src/main/java/org/apache/jena/tdb/solver/BindingTDB.java
index 2f363ed..26a36c9 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/solver/BindingTDB.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/solver/BindingTDB.java
@@ -99,11 +99,12 @@ public class BindingTDB extends BindingBase
         NodeId id = idBinding.get(var) ;
         if ( id != null )
             return id ;
+        // In case we are inserting known missing nodes. 
+        if ( NodeId.isDoesNotExist(id) )
+            return null ;
         
         if ( parent == null )
             return null ; 
-
-        // Maybe in the parent.
         if ( parent instanceof BindingTDB )
             return ((BindingTDB)parent).getNodeId(var) ;
         return null ;
@@ -120,8 +121,11 @@ public class BindingTDB extends BindingBase
             NodeId id = idBinding.get(var) ;
             if ( id == null )
                 return null ; 
+            if ( NodeId.isDoesNotExist(id) )
+                return null;
             n = nodeTable.getNodeForNodeId(id) ;
             if ( n == null )
+                // But there was to put it in the BindingNodeId. 
                 throw new TDBException("No node in NodeTable for NodeId "+id);
             // Update cache.
             cachePut(var, n) ;

http://git-wip-us.apache.org/repos/asf/jena/blob/a850230c/jena-tdb/src/main/java/org/apache/jena/tdb/solver/SolverLib.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/solver/SolverLib.java b/jena-tdb/src/main/java/org/apache/jena/tdb/solver/SolverLib.java
index d9d469d..912f1e9 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/solver/SolverLib.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/solver/SolverLib.java
@@ -257,7 +257,9 @@ public class SolverLib
             // Rely on the node table cache for efficency - we will likely be
             // repeatedly looking up the same node in different bindings.
             NodeId id = nodeTable.getNodeIdForNode(n) ;
-            // Even put in "does not exist" for a node now known not to be in the DB.
+            // Optional: whether to put in "known missing"
+            // Currently, we do. The rest of the code should work with either choice.
+            //if ( ! NodeId.isDoesNotExist(id) )
             b.put(v, id) ;
         }
         return b ;


[2/2] jena git commit: JENA-1482: Merge commit 'refs/pull/364/head' of https://github.com/apache/jena

Posted by an...@apache.org.
JENA-1482: Merge commit 'refs/pull/364/head' of https://github.com/apache/jena

This closes #364.


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

Branch: refs/heads/master
Commit: c6e13b7a454c6c0f8e09015a8509724503100234
Parents: 592ebd4 a850230
Author: Andy Seaborne <an...@apache.org>
Authored: Thu Feb 22 13:38:05 2018 +0000
Committer: Andy Seaborne <an...@apache.org>
Committed: Thu Feb 22 13:38:05 2018 +0000

----------------------------------------------------------------------
 .../java/org/apache/jena/tdb2/solver/BindingTDB.java   | 13 +++++++++----
 .../java/org/apache/jena/tdb2/solver/SolverLib.java    |  3 +++
 .../java/org/apache/jena/tdb/solver/BindingTDB.java    |  8 ++++++--
 .../java/org/apache/jena/tdb/solver/SolverLib.java     |  4 +++-
 4 files changed, 21 insertions(+), 7 deletions(-)
----------------------------------------------------------------------