jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [3/5] jena git commit: JENA-1225: Add DatasetPrefixStorage.removeAllFromPrefixMap(graphName)
Date Sat, 20 Aug 2016 18:39:14 GMT
JENA-1225: Add DatasetPrefixStorage.removeAllFromPrefixMap(graphName)

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

Branch: refs/heads/master
Commit: 87f1aaa4b9a51a4a72181e6a3cc5dc73dadce29b
Parents: 05a3505
Author: Andy Seaborne <andy@apache.org>
Authored: Sat Aug 20 18:24:45 2016 +0100
Committer: Andy Seaborne <andy@apache.org>
Committed: Sat Aug 20 18:24:45 2016 +0100

----------------------------------------------------------------------
 .../jena/sparql/core/DatasetPrefixStorage.java   |  5 ++++-
 .../core/mem/DatasetPrefixStorageInMemory.java   |  5 +++++
 .../tdb/store/DatasetPrefixStorageLogger.java    |  6 ++++++
 .../jena/tdb/store/DatasetPrefixesTDB.java       | 19 +++++++++++++++----
 4 files changed, 30 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/87f1aaa4/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetPrefixStorage.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetPrefixStorage.java
b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetPrefixStorage.java
index 97515b9..b877f10 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetPrefixStorage.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetPrefixStorage.java
@@ -52,7 +52,10 @@ public interface DatasetPrefixStorage extends Closeable, Sync
     /** Remove the association of a prefix for a specific graph */ 
     public void removeFromPrefixMap(String graphName, String prefix) ;
 
-    /** Return a PrefixMapping for the default (unnamed) graph */ 
+    /** Remove all associations for a specific graph. */ 
+    public void removeAllFromPrefixMap(String graphName) ;
+
+    /** Return a PrefixMapping for the default (unnamed) graph. */ 
     public PrefixMapping getPrefixMapping() ;
 
     /** Return a PrefixMapping for a named graph */ 

http://git-wip-us.apache.org/repos/asf/jena/blob/87f1aaa4/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/DatasetPrefixStorageInMemory.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/DatasetPrefixStorageInMemory.java
b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/DatasetPrefixStorageInMemory.java
index e405c4e..de4a604 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/DatasetPrefixStorageInMemory.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/DatasetPrefixStorageInMemory.java
@@ -88,6 +88,11 @@ public class DatasetPrefixStorageInMemory implements DatasetPrefixStorage
{
     }
 
     @Override
+    public void removeAllFromPrefixMap(String graphName) {
+        getPrefixMapping(graphName).clearNsPrefixMap() ;
+    }
+
+    @Override
     public PrefixMapping getPrefixMapping() {
         return getPrefixMapping(defaultGraphIRI.getURI());
     }

http://git-wip-us.apache.org/repos/asf/jena/blob/87f1aaa4/jena-tdb/src/main/java/org/apache/jena/tdb/store/DatasetPrefixStorageLogger.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/store/DatasetPrefixStorageLogger.java
b/jena-tdb/src/main/java/org/apache/jena/tdb/store/DatasetPrefixStorageLogger.java
index 9f0d511..d0ae862 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/store/DatasetPrefixStorageLogger.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/store/DatasetPrefixStorageLogger.java
@@ -98,6 +98,12 @@ public class DatasetPrefixStorageLogger implements DatasetPrefixStorage
 
     
     @Override
+    public void removeAllFromPrefixMap(String graphName) {
+        info("removeAllFromPrefixMap("+graphName+")") ;
+        other.removeAllFromPrefixMap(graphName) ;
+    }
+
+    @Override
     public PrefixMapping getPrefixMapping()
     {
         PrefixMapping x = other.getPrefixMapping() ;

http://git-wip-us.apache.org/repos/asf/jena/blob/87f1aaa4/jena-tdb/src/main/java/org/apache/jena/tdb/store/DatasetPrefixesTDB.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/store/DatasetPrefixesTDB.java b/jena-tdb/src/main/java/org/apache/jena/tdb/store/DatasetPrefixesTDB.java
index 642f145..e916d19 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/store/DatasetPrefixesTDB.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/store/DatasetPrefixesTDB.java
@@ -142,14 +142,25 @@ public class DatasetPrefixesTDB implements DatasetPrefixStorage
     @Override
     public synchronized void removeFromPrefixMap(String graphName, String prefix) {
         Node g = NodeFactory.createURI(graphName) ; 
-        Node p = NodeFactory.createLiteral(prefix) ; 
-        Iterator<Tuple<Node>> iter = nodeTupleTable.find(g, p, null) ;
+        Node p = NodeFactory.createLiteral(prefix) ;
+        removeAll(g, p, null) ;
+    }
+
+    @Override
+    public void removeAllFromPrefixMap(String graphName) {
+        Node g = NodeFactory.createURI(graphName) ; 
+        removeAll(g, null, null) ;
+    }
+
+    /** Remove by pattern */
+    private void removeAll(Node g, Node p, Node uri) {
+        Iterator<Tuple<Node>> iter = nodeTupleTable.find(g, p, uri) ;
         List<Tuple<Node>> list = Iter.toList(iter) ;    // Materialize.
         Iter.close(iter) ;
         for ( Tuple<Node> tuple : list )
-            nodeTupleTable.deleteRow(g, p, tuple.get(2)) ;
+            nodeTupleTable.deleteRow(tuple.get(0), tuple.get(1), tuple.get(2)) ; 
     }
-
+    
     public NodeTupleTable getNodeTupleTable()  { return nodeTupleTable ; }
     
     /** Return a PrefixMapping for the unamed graph */


Mime
View raw message