jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1568836 - in /jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer: TriGWriter.java TriGWriterBase.java TriGWriterBlocks.java TriGWriterFlat.java TurtleWriter.java TurtleWriterBase.java TurtleWriterBlocks.java TurtleWriterFlat.java
Date Sun, 16 Feb 2014 21:23:29 GMT
Author: andy
Date: Sun Feb 16 21:23:29 2014
New Revision: 1568836

URL: http://svn.apache.org/r1568836
Log:
Resolve the base URI.
Refactor and reformat.

Modified:
    jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TriGWriter.java
    jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TriGWriterBase.java
    jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TriGWriterBlocks.java
    jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TriGWriterFlat.java
    jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TurtleWriter.java
    jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TurtleWriterBase.java
    jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TurtleWriterBlocks.java
    jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TurtleWriterFlat.java

Modified: jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TriGWriter.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TriGWriter.java?rev=1568836&r1=1568835&r2=1568836&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TriGWriter.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TriGWriter.java Sun Feb
16 21:23:29 2014
@@ -34,7 +34,7 @@ import com.hp.hpl.jena.sparql.core.Quad 
 public class TriGWriter extends TriGWriterBase
 {
     @Override
-    protected void output$(IndentedWriter iOut, DatasetGraph dsg, PrefixMap prefixMap, String
baseURI)
+    protected void output(IndentedWriter iOut, DatasetGraph dsg, PrefixMap prefixMap, String
baseURI)
     {
         TriGWriter$ w = new TriGWriter$(iOut, prefixMap, baseURI) ;
         w.write(dsg) ;

Modified: jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TriGWriterBase.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TriGWriterBase.java?rev=1568836&r1=1568835&r2=1568836&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TriGWriterBase.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TriGWriterBase.java Sun
Feb 16 21:23:29 2014
@@ -16,13 +16,14 @@
  * limitations under the License.
  */
 
-package org.apache.jena.riot.writer;
+package org.apache.jena.riot.writer ;
 
 import java.io.OutputStream ;
 import java.io.Writer ;
 
 import org.apache.jena.atlas.io.IndentedWriter ;
 import org.apache.jena.riot.Lang ;
+import org.apache.jena.riot.system.IRIResolver ;
 import org.apache.jena.riot.system.PrefixMap ;
 import org.apache.jena.riot.system.RiotLib ;
 
@@ -33,27 +34,28 @@ import com.hp.hpl.jena.sparql.util.Conte
 public abstract class TriGWriterBase extends WriterDatasetRIOTBase
 {
     @Override
-    public Lang getLang()
-    {
+    public Lang getLang() {
         return Lang.TRIG ;
     }
 
     @Override
-    public void write(Writer out, DatasetGraph dsg, PrefixMap prefixMap, String baseURI,
Context context)
-    {
+    public void write(Writer out, DatasetGraph dsg, PrefixMap prefixMap, String baseURI,
Context context) {
         IndentedWriter iOut = RiotLib.create(out) ;
         output$(iOut, dsg, prefixMap, baseURI) ;
-        iOut.flush() ;
     }
 
     @Override
-    public void write(OutputStream out, DatasetGraph dsg, PrefixMap prefixMap, String baseURI,
Context context)
-    {
+    public void write(OutputStream out, DatasetGraph dsg, PrefixMap prefixMap, String baseURI,
Context context) {
         IndentedWriter iOut = new IndentedWriter(out) ;
         output$(iOut, dsg, prefixMap, baseURI) ;
+    }
+
+    private void output$(IndentedWriter iOut, DatasetGraph dsg, PrefixMap prefixMap, String
baseURI) {
+        if ( baseURI != null )
+            baseURI = IRIResolver.resolveString(baseURI) ;
+        output(iOut, dsg, prefixMap, baseURI) ;
         iOut.flush() ;
     }
-    
-    protected abstract void output$(IndentedWriter iOut, DatasetGraph dsg, PrefixMap prefixMap,
String baseURI) ;
-}
 
+    protected abstract void output(IndentedWriter iOut, DatasetGraph dsg, PrefixMap prefixMap,
String baseURI) ;
+}

Modified: jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TriGWriterBlocks.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TriGWriterBlocks.java?rev=1568836&r1=1568835&r2=1568836&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TriGWriterBlocks.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TriGWriterBlocks.java Sun
Feb 16 21:23:29 2014
@@ -30,7 +30,7 @@ import com.hp.hpl.jena.sparql.core.Datas
 public class TriGWriterBlocks extends TriGWriterBase
 {
     @Override
-    protected void output$(IndentedWriter iOut, DatasetGraph dsg, PrefixMap prefixMap, String
baseURI)
+    protected void output(IndentedWriter iOut, DatasetGraph dsg, PrefixMap prefixMap, String
baseURI)
     {
         StreamRDF dest = new WriterStreamRDFBlocks(iOut) ;
         WriterStream.write(dest, dsg, prefixMap, baseURI) ;

Modified: jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TriGWriterFlat.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TriGWriterFlat.java?rev=1568836&r1=1568835&r2=1568836&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TriGWriterFlat.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TriGWriterFlat.java Sun
Feb 16 21:23:29 2014
@@ -31,7 +31,7 @@ import com.hp.hpl.jena.sparql.core.Datas
 public class TriGWriterFlat extends TriGWriterBase
 {
     @Override
-    protected void output$(IndentedWriter iOut, DatasetGraph datasetGraph, PrefixMap prefixMap,
String baseURI)
+    protected void output(IndentedWriter iOut, DatasetGraph datasetGraph, PrefixMap prefixMap,
String baseURI)
     {
         StreamRDF dest = new WriterStreamRDFFlat(iOut) ;
         WriterStream.write(dest, datasetGraph, prefixMap, baseURI) ;

Modified: jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TurtleWriter.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TurtleWriter.java?rev=1568836&r1=1568835&r2=1568836&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TurtleWriter.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TurtleWriter.java Sun Feb
16 21:23:29 2014
@@ -26,7 +26,7 @@ import com.hp.hpl.jena.graph.Graph ;
 public class TurtleWriter extends TurtleWriterBase
 {
     @Override
-    protected void output$(IndentedWriter iOut, Graph graph, PrefixMap prefixMap, String
baseURI)
+    protected void output(IndentedWriter iOut, Graph graph, PrefixMap prefixMap, String baseURI)
     {
           TurtleWriter$ w = new TurtleWriter$(iOut, prefixMap, baseURI) ;
           w.write(graph) ;

Modified: jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TurtleWriterBase.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TurtleWriterBase.java?rev=1568836&r1=1568835&r2=1568836&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TurtleWriterBase.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TurtleWriterBase.java Sun
Feb 16 21:23:29 2014
@@ -16,13 +16,14 @@
  * limitations under the License.
  */
 
-package org.apache.jena.riot.writer;
+package org.apache.jena.riot.writer ;
 
 import java.io.OutputStream ;
 import java.io.Writer ;
 
 import org.apache.jena.atlas.io.IndentedWriter ;
 import org.apache.jena.riot.Lang ;
+import org.apache.jena.riot.system.IRIResolver ;
 import org.apache.jena.riot.system.PrefixMap ;
 import org.apache.jena.riot.system.RiotLib ;
 
@@ -32,26 +33,28 @@ import com.hp.hpl.jena.sparql.util.Conte
 public abstract class TurtleWriterBase extends WriterGraphRIOTBase
 {
     @Override
-    public Lang getLang()
-    {
+    public Lang getLang() {
         return Lang.TURTLE ;
     }
 
     @Override
-    public void write(Writer out, Graph graph, PrefixMap prefixMap, String baseURI, Context
context)
-    {
+    public void write(Writer out, Graph graph, PrefixMap prefixMap, String baseURI, Context
context) {
         IndentedWriter iOut = RiotLib.create(out) ;
         output$(iOut, graph, prefixMap, baseURI) ;
-        iOut.flush() ;
     }
 
     @Override
-    public void write(OutputStream out, Graph graph, PrefixMap prefixMap, String baseURI,
Context context)
-    {
+    public void write(OutputStream out, Graph graph, PrefixMap prefixMap, String baseURI,
Context context) {
         IndentedWriter iOut = new IndentedWriter(out) ;
         output$(iOut, graph, prefixMap, baseURI) ;
+    }
+
+    private void output$(IndentedWriter iOut, Graph graph, PrefixMap prefixMap, String baseURI)
{
+        if ( baseURI != null )
+            baseURI = IRIResolver.resolveString(baseURI) ;
+        output(iOut, graph, prefixMap, baseURI) ;
         iOut.flush() ;
     }
-    
-    protected abstract void output$(IndentedWriter iOut, Graph graph, PrefixMap prefixMap,
String baseURI) ;
+
+    protected abstract void output(IndentedWriter iOut, Graph graph, PrefixMap prefixMap,
String baseURI) ;
 }

Modified: jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TurtleWriterBlocks.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TurtleWriterBlocks.java?rev=1568836&r1=1568835&r2=1568836&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TurtleWriterBlocks.java
(original)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TurtleWriterBlocks.java
Sun Feb 16 21:23:29 2014
@@ -30,7 +30,7 @@ import com.hp.hpl.jena.graph.Graph ;
 public class TurtleWriterBlocks extends TurtleWriterBase
 {
     @Override
-    protected void output$(IndentedWriter out, Graph graph, PrefixMap prefixMap, String baseURI)
+    protected void output(IndentedWriter out, Graph graph, PrefixMap prefixMap, String baseURI)
     {
         StreamRDF dest = new WriterStreamRDFBlocks(out) ;
         WriterStream.write(dest, graph, prefixMap, baseURI) ;

Modified: jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TurtleWriterFlat.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TurtleWriterFlat.java?rev=1568836&r1=1568835&r2=1568836&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TurtleWriterFlat.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/writer/TurtleWriterFlat.java Sun
Feb 16 21:23:29 2014
@@ -28,7 +28,7 @@ import com.hp.hpl.jena.graph.Graph ;
 public class TurtleWriterFlat extends TurtleWriterBase
 {
     @Override
-    protected void output$(IndentedWriter out, Graph graph, PrefixMap prefixMap, String baseURI)
+    protected void output(IndentedWriter out, Graph graph, PrefixMap prefixMap, String baseURI)
     {
         StreamRDF dest = new WriterStreamRDFFlat(out) ;
         WriterStream.write(dest, graph, prefixMap, baseURI) ;



Mime
View raw message