jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1176265 - in /incubator/jena/Jena2/ARQ/trunk: src-test/com/hp/hpl/jena/sparql/engine/ src-test/com/hp/hpl/jena/sparql/engine/binding/ src-test/org/openjena/riot/ src-test/org/openjena/riot/out/ src/org/openjena/riot/out/ src/org/openjena/r...
Date Tue, 27 Sep 2011 08:13:15 GMT
Author: andy
Date: Tue Sep 27 08:13:15 2011
New Revision: 1176265

URL: http://svn.apache.org/viewvc?rev=1176265&view=rev
Log:
JENA-124 Don't restrict to ASCII for lexcial forms for Turtle and Bindings output.

Modified:
    incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/engine/TS_Engine.java
    incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/engine/binding/TestBindingStreams.java
    incubator/jena/Jena2/ARQ/trunk/src-test/org/openjena/riot/TS_Riot.java
    incubator/jena/Jena2/ARQ/trunk/src-test/org/openjena/riot/out/TestNodeFmt.java
    incubator/jena/Jena2/ARQ/trunk/src/org/openjena/riot/out/NodeFormatterNT.java
    incubator/jena/Jena2/ARQ/trunk/src/org/openjena/riot/out/NodeFormatterTTL.java
    incubator/jena/Jena2/ARQ/trunk/src/org/openjena/riot/system/PrefixMap.java

Modified: incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/engine/TS_Engine.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/engine/TS_Engine.java?rev=1176265&r1=1176264&r2=1176265&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/engine/TS_Engine.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/engine/TS_Engine.java Tue
Sep 27 08:13:15 2011
@@ -21,11 +21,13 @@ package com.hp.hpl.jena.sparql.engine;
 import org.junit.runner.RunWith ;
 import org.junit.runners.Suite ;
 
+import com.hp.hpl.jena.sparql.engine.binding.TestBindingStreams ;
 import com.hp.hpl.jena.sparql.engine.iterator.TestQueryIterSort ;
 
 @RunWith(Suite.class)
 @Suite.SuiteClasses( {
-      TestQueryIterSort.class
+        TestBindingStreams.class
+      , TestQueryIterSort.class
 })
 
 public class TS_Engine {}

Modified: incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/engine/binding/TestBindingStreams.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/engine/binding/TestBindingStreams.java?rev=1176265&r1=1176264&r2=1176265&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/engine/binding/TestBindingStreams.java
(original)
+++ incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/engine/binding/TestBindingStreams.java
Tue Sep 27 08:13:15 2011
@@ -68,6 +68,7 @@ public class TestBindingStreams extends 
     static Binding bb1 = build("(?a _:XYZ) (?b 1)");
     
     static Binding bb2 = build("(?a 'a\"b\"c') (?b 1)");
+    static Binding bb3 = build("(?a 'aΩc') (?b 1)");
     
     static PrefixMap pmap = new PrefixMap() ;
     static {
@@ -95,8 +96,7 @@ public class TestBindingStreams extends 
     @Test public void bindingStream_51()        { testWriteRead(b0) ; }
     @Test public void bindingStream_52()        { testWriteRead(pmap, b12,x10,b19) ; }
     
-    @Test
-    public void bindingStream_60()              { testWriteRead(bb1) ; }
+    @Test public void bindingStream_60()              { testWriteRead(bb1) ; }
     
     @Test
     public void bindingStream_61()
@@ -107,8 +107,9 @@ public class TestBindingStreams extends 
         testWriteRead(b) ;
     }
     
-    @Test
-    public void bindingStream_62()              { testWriteRead(bb2) ; }
+    @Test public void bindingStream_62()              { testWriteRead(bb2) ; }
+
+    @Test public void bindingStream_63()              { testWriteRead(bb3) ; }
 
     
     static void testRead(String x, Binding ... bindings)

Modified: incubator/jena/Jena2/ARQ/trunk/src-test/org/openjena/riot/TS_Riot.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src-test/org/openjena/riot/TS_Riot.java?rev=1176265&r1=1176264&r2=1176265&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src-test/org/openjena/riot/TS_Riot.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src-test/org/openjena/riot/TS_Riot.java Tue Sep 27 08:13:15
2011
@@ -33,6 +33,7 @@ import org.openjena.riot.lang.TestParser
 import org.openjena.riot.lang.TestSuiteTrig ;
 import org.openjena.riot.lang.TestSuiteTurtle ;
 import org.openjena.riot.lang.TestTurtleTerms ;
+import org.openjena.riot.out.TestNodeFmt ;
 import org.openjena.riot.out.TestNodeFmtLib ;
 import org.openjena.riot.out.TestOutput ;
 import org.openjena.riot.out.TestOutputNTriples ;
@@ -62,7 +63,8 @@ import org.openjena.riot.tokens.TestToke
     , TestSuiteTrig.class
 
     , TestParserFactory.class
-
+
+    , TestNodeFmt.class
     , TestNodeFmtLib.class
     , TestOutput.class
     , TestOutputNTriples.class

Modified: incubator/jena/Jena2/ARQ/trunk/src-test/org/openjena/riot/out/TestNodeFmt.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src-test/org/openjena/riot/out/TestNodeFmt.java?rev=1176265&r1=1176264&r2=1176265&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src-test/org/openjena/riot/out/TestNodeFmt.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src-test/org/openjena/riot/out/TestNodeFmt.java Tue Sep
27 08:13:15 2011
@@ -30,7 +30,7 @@ import com.hp.hpl.jena.sparql.util.NodeF
 
 public class TestNodeFmt extends BaseTest
 {
-    private static String base = "http://example/base" ;
+    private static String base = "http://example.org/base" ;
     private static PrefixMap prefixMap = new PrefixMap() ;
     static {
         prefixMap.add(":", "http://example/p") ;
@@ -69,6 +69,8 @@ public class TestNodeFmt extends BaseTes
     @Test public void nodefmt_nt_08()  { test(nodeFormatterNT, "\"123\"^^<http://www.w3.org/2001/XMLSchema#integer>"
) ; }
     @Test public void nodefmt_nt_09()  { test(nodeFormatterNT, Node.ANY, "ANY") ; }
     
+    @Test public void nodefmt_nt_10()  { test(nodeFormatterNT, "'Ω'", "\"\\u03A9\"") ;
}
+    
     @Test public void nodefmt_ttl_01()  { test(nodeFormatterTTL, "?x") ; }
     @Test public void nodefmt_ttl_02()  { test(nodeFormatterTTL, "?xyz") ; }
     @Test public void nodefmt_ttl_03()  { test(nodeFormatterTTL, Var.alloc(""), "?") ; }
@@ -79,13 +81,18 @@ public class TestNodeFmt extends BaseTes
     @Test public void nodefmt_ttl_07()  { test(nodeFormatterTTL, "\"abc\"@en") ; }
     @Test public void nodefmt_ttl_08()  { test(nodeFormatterTTL, Node.ANY, "ANY") ; }
     
-    @Test public void nodefmt_ttl_11()  { test(nodeFormatterTTL, "<http://example.org/resources>")
; }    // No match
+    @Test public void nodefmt_ttl_11()  { test(nodeFormatterTTL, "<http://example.com/resources>")
; }    // No match
     @Test public void nodefmt_ttl_12()  { test(nodeFormatterTTL, "<http://example/ex/>",
"ex:") ; }
     @Test public void nodefmt_ttl_13()  { test(nodeFormatterTTL, "<http://example/ex/abc>",
"ex:abc") ; }
     @Test public void nodefmt_ttl_14()  { test(nodeFormatterTTL, "<http://example/ex/ab/c>",
"<http://example/ex/ab/c>") ; }
     @Test public void nodefmt_ttl_15()  { test(nodeFormatterTTL, "<http://example/p>",
":") ; }
     @Test public void nodefmt_ttl_16()  { test(nodeFormatterTTL, "<http://example/p#a>",
"<http://example/p#a>") ; }
+    // Base URI
+    @Test public void nodefmt_ttl_17()  { test(nodeFormatterTTL, "<http://example.org/foo>",
"<foo>") ; }
+    @Test public void nodefmt_ttl_18()  { test(nodeFormatterTTL, "<http://example.org/base#bar>",
"<#bar>") ; }
 
+    @Test public void nodefmt_ttl_20()  { test(nodeFormatterTTL, "'Ω'", "\"Ω\"") ;
}
+    
     @Test public void prefixedname_01() { testPrefix("", "") ; } 
     
     private void testPrefix(String prefix, String local)

Modified: incubator/jena/Jena2/ARQ/trunk/src/org/openjena/riot/out/NodeFormatterNT.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/org/openjena/riot/out/NodeFormatterNT.java?rev=1176265&r1=1176264&r2=1176265&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/org/openjena/riot/out/NodeFormatterNT.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src/org/openjena/riot/out/NodeFormatterNT.java Tue Sep
27 08:13:15 2011
@@ -28,9 +28,11 @@ public class NodeFormatterNT extends Nod
     // Formatting for NTriples 
     // Turtles extends this class to intercept forms it can do better.
 
-    private final EscapeStr escapeProc = new EscapeStr(true) ; 
+    private final EscapeStr escapeProc ; 
     
-    public NodeFormatterNT() {}
+    public NodeFormatterNT() { this(true) ; }
+    
+    protected NodeFormatterNT(boolean asciiOnly) { escapeProc = new EscapeStr(asciiOnly)
;}
     
     //@Override
     public void formatURI(Writer w, String uriStr)

Modified: incubator/jena/Jena2/ARQ/trunk/src/org/openjena/riot/out/NodeFormatterTTL.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/org/openjena/riot/out/NodeFormatterTTL.java?rev=1176265&r1=1176264&r2=1176265&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/org/openjena/riot/out/NodeFormatterTTL.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src/org/openjena/riot/out/NodeFormatterTTL.java Tue Sep
27 08:13:15 2011
@@ -39,13 +39,13 @@ public class NodeFormatterTTL extends No
     private final String baseIRI ; 
     
    public NodeFormatterTTL(String baseIRI , PrefixMap prefixMap) //OutputPolicy outputPolicy)
-    {
+   {
+       super(false) ;
        if ( prefixMap == null )
            prefixMap = new PrefixMap() ;
        this.prefixMap = prefixMap ;
        this.baseIRI = baseIRI ;
-       
-    }
+   }
     
     @Override
     public void formatURI(Writer w, String uriStr)

Modified: incubator/jena/Jena2/ARQ/trunk/src/org/openjena/riot/system/PrefixMap.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/org/openjena/riot/system/PrefixMap.java?rev=1176265&r1=1176264&r2=1176265&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/org/openjena/riot/system/PrefixMap.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src/org/openjena/riot/system/PrefixMap.java Tue Sep 27
08:13:15 2011
@@ -112,10 +112,10 @@ public class PrefixMap
     {
         for ( Entry<String, IRI> e : prefixes.entrySet())
         {
-            String prefix = e.getValue().toString() ;
+            String uriForPrefix = e.getValue().toString() ;
             
-            if ( uriStr.startsWith(prefix) )
-                return Pair.create(e.getKey(), uriStr.substring(prefix.length())) ;
+            if ( uriStr.startsWith(uriForPrefix) )
+                return Pair.create(e.getKey(), uriStr.substring(uriForPrefix.length())) ;
         }
         return null ;
     }
@@ -145,5 +145,27 @@ public class PrefixMap
             return prefix.substring(0, prefix.length()-1) ;
         return prefix ;
     }
-    
+    
+    @Override
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder() ;
+        sb.append("{ ") ;
+        boolean first = true ;
+        
+        for ( Entry<String, IRI> e : prefixes.entrySet())
+        {
+            String prefix = e.getKey() ;
+            IRI iri = e.getValue() ;
+            if ( first )
+                first = false ;
+            else
+                sb.append(" ,") ;
+            sb.append(prefix) ;
+            sb.append(":=") ;
+            sb.append(iri.toString()) ;
+        }
+        sb.append(" }") ;
+        return sb.toString() ; 
+    }
 }



Mime
View raw message