jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1341532 - in /jena/Scratch/AFS/Dev/trunk/src/main/java/projects/viewgraph: DatasetPrefixStorageMem.java TestDatasetPrefixes.java
Date Tue, 22 May 2012 15:30:14 GMT
Author: andy
Date: Tue May 22 15:30:14 2012
New Revision: 1341532

URL: http://svn.apache.org/viewvc?rev=1341532&view=rev
Log: (empty)

Modified:
    jena/Scratch/AFS/Dev/trunk/src/main/java/projects/viewgraph/DatasetPrefixStorageMem.java
    jena/Scratch/AFS/Dev/trunk/src/main/java/projects/viewgraph/TestDatasetPrefixes.java

Modified: jena/Scratch/AFS/Dev/trunk/src/main/java/projects/viewgraph/DatasetPrefixStorageMem.java
URL: http://svn.apache.org/viewvc/jena/Scratch/AFS/Dev/trunk/src/main/java/projects/viewgraph/DatasetPrefixStorageMem.java?rev=1341532&r1=1341531&r2=1341532&view=diff
==============================================================================
--- jena/Scratch/AFS/Dev/trunk/src/main/java/projects/viewgraph/DatasetPrefixStorageMem.java
(original)
+++ jena/Scratch/AFS/Dev/trunk/src/main/java/projects/viewgraph/DatasetPrefixStorageMem.java
Tue May 22 15:30:14 2012
@@ -31,6 +31,9 @@ import com.hp.hpl.jena.sparql.graph.Grap
 
 public class DatasetPrefixStorageMem implements DatasetPrefixStorage
 {
+    // DatasetPrefixStorage ==> DatasetPrefixes ??
+    // Need remove whole per-graph mapping.? 
+    
     // The default graph : preferred name
     static final String dftGraph =  Quad.defaultGraphIRI.getURI() ;
     // Also seen as:
@@ -41,7 +44,6 @@ public class DatasetPrefixStorageMem imp
     
     public DatasetPrefixStorageMem() {}
     
-    
     @Override
     public Set<String> graphNames()
     {

Modified: jena/Scratch/AFS/Dev/trunk/src/main/java/projects/viewgraph/TestDatasetPrefixes.java
URL: http://svn.apache.org/viewvc/jena/Scratch/AFS/Dev/trunk/src/main/java/projects/viewgraph/TestDatasetPrefixes.java?rev=1341532&r1=1341531&r2=1341532&view=diff
==============================================================================
--- jena/Scratch/AFS/Dev/trunk/src/main/java/projects/viewgraph/TestDatasetPrefixes.java (original)
+++ jena/Scratch/AFS/Dev/trunk/src/main/java/projects/viewgraph/TestDatasetPrefixes.java Tue
May 22 15:30:14 2012
@@ -39,13 +39,9 @@ public class TestDatasetPrefixes extends
     private static final String ns1 = "http://example/ns1" ; 
     private static final String ns2 = "http://example/ns2" ; 
 
-    
-    DatasetPrefixStorage prefixes = new DatasetPrefixStorageMem() ;
-    
-    //@Before public void setup()  
-    
-    @Test public void pref_01()
+    @Test public void dsg_prefixes_01()
     {
+        DatasetPrefixStorage prefixes = new DatasetPrefixStorageMem() ;
         prefixes.insertPrefix(graph0, prefix1, ns1 ) ;
         Set<String> x = prefixes.graphNames() ;
         // Default graph
@@ -60,8 +56,9 @@ public class TestDatasetPrefixes extends
         }
     }
 
-    @Test public void pref_02()
+    @Test public void dsg_prefixes_02()
     {
+        DatasetPrefixStorage prefixes = new DatasetPrefixStorageMem() ;
         prefixes.insertPrefix(graph1, prefix1, ns1 ) ;
         Set<String> x = prefixes.graphNames() ;
         assertEquals(1, x.size()) ;
@@ -70,5 +67,54 @@ public class TestDatasetPrefixes extends
         PrefixMapping pm = prefixes.getPrefixMapping(graph1) ;
         assertEquals(1 , pm.getNsPrefixMap().size()) ;
     }
+    
+    @Test public void dsg_prefixes_03()
+    {
+        DatasetPrefixStorage prefixes = new DatasetPrefixStorageMem() ;
+        prefixes.insertPrefix(graph1, prefix1, ns1 ) ;
+        assertEquals(1 , prefixes.getPrefixMapping(graph1).getNsPrefixMap().size()) ;
+        prefixes.removeFromPrefixMap(graph1, prefix1) ;
+        assertEquals(0 , prefixes.getPrefixMapping(graph1).getNsPrefixMap().size()) ;
+    }
+    
+    // Add/remove via the PrefixMapping
+    
+    @Test public void dsg_prefixes_04()
+    {
+        DatasetPrefixStorage prefixes = new DatasetPrefixStorageMem() ;
+        prefixes.insertPrefix(graph1, prefix1, ns1 ) ;
+        assertEquals(1 , prefixes.getPrefixMapping(graph1).getNsPrefixMap().size()) ;
+        PrefixMapping pm = prefixes.getPrefixMapping(graph1) ;
+        pm.setNsPrefix(prefix1, ns1) ;
+        assertEquals(1 , prefixes.getPrefixMapping(graph1).getNsPrefixMap().size()) ;
+    }
+    
+    @Test public void dsg_prefixes_05()
+    {
+        DatasetPrefixStorage prefixes = new DatasetPrefixStorageMem() ;
+        PrefixMapping pm = prefixes.getPrefixMapping(graph1) ;
+
+        pm.setNsPrefix(prefix1, ns1) ;
+        pm.removeNsPrefix(prefix1) ;
+        assertNull(pm.getNsPrefixURI(prefix1)) ;
+        assertEquals(0 , pm.getNsPrefixMap().size()) ;
+        assertEquals(0 , prefixes.getPrefixMapping(graph1).getNsPrefixMap().size()) ;
+    }
+    
+    @Test public void dsg_prefixes_06()
+    {
+        DatasetPrefixStorage prefixes = new DatasetPrefixStorageMem() ;
+        prefixes.insertPrefix(graph1, prefix1, ns1 ) ;
+
+        PrefixMapping pm = prefixes.getPrefixMapping(graph1) ;
+        assertEquals(1 , pm.getNsPrefixMap().size()) ;
+
+        pm.removeNsPrefix(prefix1) ;
+        assertNull(pm.getNsPrefixURI(prefix1)) ;
+
+        assertEquals(0 , pm.getNsPrefixMap().size()) ;
+        assertEquals(0 , prefixes.getPrefixMapping(graph1).getNsPrefixMap().size()) ;
+    }
+
 }
 



Mime
View raw message