jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1453415 - in /jena/branches/arq-riot-output: src-examples/arq/examples/riot/ src-examples/arq/examples/update/ src/main/java/arq/ src/main/java/org/apache/jena/riot/ src/main/java/org/apache/jena/riot/adapters/ src/main/java/org/apache/jen...
Date Wed, 06 Mar 2013 16:45:37 GMT
Author: andy
Date: Wed Mar  6 16:45:36 2013
New Revision: 1453415

URL: http://svn.apache.org/r1453415
Log:
Merge RDFWriterMgr in RDFDataMgr.
Merge setup into RIOT.init.
Deprecate package "out" NT, NQ, RDFJSON writers - use RDFDataMgr.
Leave IO_Jena in public API for compatibility but 
  put the private contents into system.IO_JenaReader/Writer
  just because its quite long.

Added:
    jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/system/IO_JenaReaders.java
    jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/system/IO_JenaWriters.java
      - copied, changed from r1452591, jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/system/IO_Jena2.java
    jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/writer/TestRDFJSON.java
      - copied, changed from r1452591, jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/out/TestOutputRDFJSON.java
Removed:
    jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/RDFWriterMgr.java
    jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/system/IO_Jena2.java
    jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/system/JenaWriterNTriples2.java
    jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/system/JenaWriterRdfJson.java
    jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/system/RiotWriterLib.java
    jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/out/TestOutputNTriples.java
    jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/out/TestOutputRDFJSON.java
Modified:
    jena/branches/arq-riot-output/src-examples/arq/examples/riot/ExRIOT_out1.java
    jena/branches/arq-riot-output/src-examples/arq/examples/riot/ExRIOT_out2.java
    jena/branches/arq-riot-output/src-examples/arq/examples/riot/ExRIOT_out3.java
    jena/branches/arq-riot-output/src-examples/arq/examples/update/UpdateExecuteOperations.java
    jena/branches/arq-riot-output/src-examples/arq/examples/update/UpdateProgrammatic.java
    jena/branches/arq-riot-output/src-examples/arq/examples/update/UpdateReadFromFile.java
    jena/branches/arq-riot-output/src/main/java/arq/update.java
    jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/IO_Jena.java
    jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/RDFDataMgr.java
    jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/RDFWriterRegistry.java
    jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/RIOT.java
    jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/RiotWriter.java
    jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/adapters/RDFWriterRIOT.java
    jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/out/NQuadsWriter.java
    jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/out/NTriplesWriter.java
    jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/out/RDFJSONWriter.java
    jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/system/RiotLib.java
    jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/TriGWriterBase.java
    jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/TurtleShell.java
    jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/TurtleWriterBase.java
    jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/WriterStreamRDFBase.java
    jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/WriterStreamRDFBlocks.java
    jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/WriterStreamRDFTuples.java
    jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/out/TS_Out.java
    jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/writer/TS_RiotWriter.java
    jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/writer/TestJenaWriters.java
    jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/writer/TestRiotWriterDataset.java
    jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/writer/TestRiotWriterGraph.java

Modified: jena/branches/arq-riot-output/src-examples/arq/examples/riot/ExRIOT_out1.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src-examples/arq/examples/riot/ExRIOT_out1.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src-examples/arq/examples/riot/ExRIOT_out1.java (original)
+++ jena/branches/arq-riot-output/src-examples/arq/examples/riot/ExRIOT_out1.java Wed Mar  6 16:45:36 2013
@@ -35,12 +35,12 @@ public class ExRIOT_out1
         System.out.println() ;
         System.out.println("#### ---- Write as Turtle") ;
         System.out.println() ;
-        RDFWriterMgr.write(System.out, model, Lang.TURTLE) ;
+        RDFDataMgr.write(System.out, model, Lang.TURTLE) ;
         
         System.out.println() ;
         System.out.println("#### ---- Write as Turtle (streaming)") ;
         System.out.println() ;
-        RDFWriterMgr.write(System.out, model, RDFFormat.TURTLE_BLOCKS) ;
+        RDFDataMgr.write(System.out, model, RDFFormat.TURTLE_BLOCKS) ;
         
         System.out.println() ;
         System.out.println("#### ---- Write as Turtle via model.write") ;

Modified: jena/branches/arq-riot-output/src-examples/arq/examples/riot/ExRIOT_out2.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src-examples/arq/examples/riot/ExRIOT_out2.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src-examples/arq/examples/riot/ExRIOT_out2.java (original)
+++ jena/branches/arq-riot-output/src-examples/arq/examples/riot/ExRIOT_out2.java Wed Mar  6 16:45:36 2013
@@ -18,7 +18,10 @@
 
 package arq.examples.riot;
 
-import org.apache.jena.riot.* ;
+import org.apache.jena.riot.Lang ;
+import org.apache.jena.riot.RDFDataMgr ;
+import org.apache.jena.riot.RDFWriterRegistry ;
+import org.apache.jena.riot.RIOT ;
 
 import com.hp.hpl.jena.query.Dataset ;
 import com.hp.hpl.jena.rdf.model.Model ;
@@ -36,14 +39,14 @@ public class ExRIOT_out2
         System.out.println("#### ---- Write as TriG") ;
         System.out.println() ;
         // This wil be the default graph of the dataset written.
-        RDFWriterMgr.write(System.out, model, Lang.TRIG) ;
+        RDFDataMgr.write(System.out, model, Lang.TRIG) ;
         
         // Loading Turtle as Trig reads into the default graph.
         Dataset dataset = RDFDataMgr.loadDataset("D.ttl") ;
         System.out.println() ;
         System.out.println("#### ---- Write as NQuads") ;
         System.out.println() ;
-        RDFWriterMgr.write(System.out, dataset, Lang.NQUADS) ;
+        RDFDataMgr.write(System.out, dataset, Lang.NQUADS) ;
     }
 
 }

Modified: jena/branches/arq-riot-output/src-examples/arq/examples/riot/ExRIOT_out3.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src-examples/arq/examples/riot/ExRIOT_out3.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src-examples/arq/examples/riot/ExRIOT_out3.java (original)
+++ jena/branches/arq-riot-output/src-examples/arq/examples/riot/ExRIOT_out3.java Wed Mar  6 16:45:36 2013
@@ -25,7 +25,7 @@ import org.apache.jena.atlas.io.Indented
 import org.apache.jena.riot.* ;
 import org.apache.jena.riot.adapters.RDFWriterRIOT ;
 import org.apache.jena.riot.system.PrefixMap ;
-import org.apache.jena.riot.system.RiotWriterLib ;
+import org.apache.jena.riot.system.RiotLib ;
 import org.apache.jena.riot.writer.WriterGraphRIOTBase ;
 
 import com.hp.hpl.jena.graph.Graph ;
@@ -62,10 +62,10 @@ public class ExRIOT_out3
         Model model = RDFDataMgr.loadModel("D.ttl") ;
         // Write
         System.out.println("## Write by format") ;
-        RDFWriterMgr.write(System.out, model, format) ;
+        RDFDataMgr.write(System.out, model, format) ;
         System.out.println() ;
         System.out.println("## Write by language") ;
-        RDFWriterMgr.write(System.out, model, lang) ;
+        RDFDataMgr.write(System.out, model, lang) ;
         
         // ---- Register for use with Model.read
         // because naming is explicit, need to register an adapter.  
@@ -100,7 +100,7 @@ public class ExRIOT_out3
         public void write(Writer out, Graph graph, PrefixMap prefixMap, String baseURI, Context context)
         {
             // Writers are discouraged : just hope the charset is UTF-8.
-            IndentedWriter x = RiotWriterLib.create(out) ;
+            IndentedWriter x = RiotLib.create(out) ;
             SSE.write(x, graph) ;
         }
     }

Modified: jena/branches/arq-riot-output/src-examples/arq/examples/update/UpdateExecuteOperations.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src-examples/arq/examples/update/UpdateExecuteOperations.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src-examples/arq/examples/update/UpdateExecuteOperations.java (original)
+++ jena/branches/arq-riot-output/src-examples/arq/examples/update/UpdateExecuteOperations.java Wed Mar  6 16:45:36 2013
@@ -20,7 +20,7 @@ package arq.examples.update;
 
 import org.apache.jena.atlas.lib.StrUtils ;
 import org.apache.jena.riot.Lang ;
-import org.apache.jena.riot.RDFWriterMgr ;
+import org.apache.jena.riot.RDFDataMgr ;
 
 import com.hp.hpl.jena.sparql.sse.SSE ;
 import com.hp.hpl.jena.update.* ;
@@ -82,6 +82,6 @@ public class UpdateExecuteOperations
         System.out.println();
         
         System.out.println("# N-Quads: S P O G") ;
-        RDFWriterMgr.write(System.out, graphStore, Lang.NQUADS) ;
+        RDFDataMgr.write(System.out, graphStore, Lang.NQUADS) ;
     }
 }

Modified: jena/branches/arq-riot-output/src-examples/arq/examples/update/UpdateProgrammatic.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src-examples/arq/examples/update/UpdateProgrammatic.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src-examples/arq/examples/update/UpdateProgrammatic.java (original)
+++ jena/branches/arq-riot-output/src-examples/arq/examples/update/UpdateProgrammatic.java Wed Mar  6 16:45:36 2013
@@ -19,7 +19,7 @@
 package arq.examples.update;
 
 import org.apache.jena.riot.Lang ;
-import org.apache.jena.riot.RDFWriterMgr ;
+import org.apache.jena.riot.RDFDataMgr ;
 
 import com.hp.hpl.jena.sparql.modify.request.Target ;
 import com.hp.hpl.jena.sparql.modify.request.UpdateCreate ;
@@ -53,6 +53,6 @@ public class UpdateProgrammatic
         System.out.println();
         
         System.out.println("# N-Quads: S P O G") ;
-        RDFWriterMgr.write(System.out, graphStore, Lang.NQUADS) ;
+        RDFDataMgr.write(System.out, graphStore, Lang.NQUADS) ;
     }
 }

Modified: jena/branches/arq-riot-output/src-examples/arq/examples/update/UpdateReadFromFile.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src-examples/arq/examples/update/UpdateReadFromFile.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src-examples/arq/examples/update/UpdateReadFromFile.java (original)
+++ jena/branches/arq-riot-output/src-examples/arq/examples/update/UpdateReadFromFile.java Wed Mar  6 16:45:36 2013
@@ -19,7 +19,7 @@
 package arq.examples.update;
 
 import org.apache.jena.riot.Lang ;
-import org.apache.jena.riot.RDFWriterMgr ;
+import org.apache.jena.riot.RDFDataMgr ;
 
 import com.hp.hpl.jena.sparql.sse.SSE ;
 import com.hp.hpl.jena.update.* ;
@@ -49,6 +49,6 @@ public class UpdateReadFromFile
         System.out.println();
         
         System.out.println("# N-Quads: S P O G") ;
-        RDFWriterMgr.write(System.out, graphStore, Lang.NQUADS) ;
+        RDFDataMgr.write(System.out, graphStore, Lang.NQUADS) ;
     }
 }

Modified: jena/branches/arq-riot-output/src/main/java/arq/update.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src/main/java/arq/update.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src/main/java/arq/update.java (original)
+++ jena/branches/arq-riot-output/src/main/java/arq/update.java Wed Mar  6 16:45:36 2013
@@ -21,15 +21,16 @@ package arq;
 import java.util.Iterator ;
 import java.util.List ;
 
-import org.apache.jena.riot.out.NQuadsWriter ;
+import org.apache.jena.riot.Lang ;
+import org.apache.jena.riot.RDFDataMgr ;
 import arq.cmd.CmdException ;
 import arq.cmdline.ArgDecl ;
 import arq.cmdline.CmdUpdate ;
 
 import com.hp.hpl.jena.query.ReadWrite ;
 import com.hp.hpl.jena.sparql.SystemARQ ;
-import com.hp.hpl.jena.sparql.core.TransactionalNull ;
 import com.hp.hpl.jena.sparql.core.Transactional ;
+import com.hp.hpl.jena.sparql.core.TransactionalNull ;
 import com.hp.hpl.jena.sparql.util.Utils ;
 import com.hp.hpl.jena.update.GraphStore ;
 import com.hp.hpl.jena.update.UpdateExecutionFactory ;
@@ -104,8 +105,7 @@ public class update extends CmdUpdate
         SystemARQ.sync(graphStore) ;
 
         if ( dump )
-            //SSE.write(graphStore) ;
-            NQuadsWriter.write(System.out, graphStore) ;
+            RDFDataMgr.write(System.out, graphStore, Lang.NQUADS) ;
     }
 
 

Modified: jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/IO_Jena.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/IO_Jena.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/IO_Jena.java (original)
+++ jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/IO_Jena.java Wed Mar  6 16:45:36 2013
@@ -18,86 +18,39 @@
 
 package org.apache.jena.riot;
 
-import org.apache.jena.riot.adapters.JenaReadersWriters ;
-import org.apache.jena.riot.system.JenaWriterRdfJson ;
-import org.slf4j.Logger ;
-import org.slf4j.LoggerFactory ;
+import org.apache.jena.riot.system.IO_JenaReaders ;
+import org.apache.jena.riot.system.IO_JenaWriters ;
 
-import com.hp.hpl.jena.rdf.model.impl.RDFReaderFImpl ;
-import com.hp.hpl.jena.rdf.model.impl.RDFWriterFImpl ;
 import com.hp.hpl.jena.sparql.util.Symbol ;
 
 public class IO_Jena
 {
-    static Logger log = LoggerFactory.getLogger(IO_Jena.class) ;
-    
     private static String riotBase = "http://jena.apache.org/riot/" ; 
     private static String streamManagerSymbolStr = riotBase+"streammanager" ; 
     public static Symbol streamManagerSymbol = Symbol.create(streamManagerSymbolStr) ; 
 
     public static void wireIntoJena()
     {
-//        // Wire in generic 
-//        Class<?> readerRDF = RDFReaderRIOT.class ;
-//        registerForModelRead("RDF/XML",    readerRDF) ;
-//        registerForModelRead("RDF/XML-ABBREV", readerRDF) ;
-//
-//        registerForModelRead("N-TRIPLES",  readerRDF) ;
-//        registerForModelRead("N-Triples",  readerRDF) ;
-//        registerForModelRead("N-TRIPLE",   readerRDF) ;
-//        registerForModelRead("N3",         readerRDF) ;
-//        registerForModelRead("TURTLE",     readerRDF) ;
-//        registerForModelRead("Turtle",     readerRDF) ;
-//        registerForModelRead("TTL",        readerRDF) ;
-//        registerForModelRead("RDF/JSON",   readerRDF) ;
-        
-      registerForModelRead("RDF/XML",    JenaReadersWriters.RDFReaderRIOT_RDFXML.class) ;           // And default
-      registerForModelRead("RDF/XML-ABBREV", JenaReadersWriters.RDFReaderRIOT_RDFXML.class) ;
-
-      registerForModelRead("N-TRIPLES",  JenaReadersWriters.RDFReaderRIOT_NT.class) ;
-      registerForModelRead("N-Triples",  JenaReadersWriters.RDFReaderRIOT_NT.class) ;
-      registerForModelRead("N-TRIPLE",   JenaReadersWriters.RDFReaderRIOT_NT.class) ;
-      registerForModelRead("N3",         JenaReadersWriters.RDFReaderRIOT_TTL.class) ;
-      registerForModelRead("TURTLE",     JenaReadersWriters.RDFReaderRIOT_TTL.class) ;
-      registerForModelRead("Turtle",     JenaReadersWriters.RDFReaderRIOT_TTL.class) ;
-      registerForModelRead("TTL",        JenaReadersWriters.RDFReaderRIOT_TTL.class) ;
-      registerForModelRead("RDF/JSON",   JenaReadersWriters.RDFReaderRIOT_RDFJSON.class) ;
-      
-      // Old style Jena writers.
-      // TODO Remove when riot-output arrives.
-      String writerRdfJson = JenaWriterRdfJson.class.getName() ;
-      RDFWriterFImpl.setBaseWriterClassName("RDF/JSON", writerRdfJson) ;
+        IO_JenaReaders.wireIntoJena() ;
+        IO_JenaWriters.wireIntoJena() ;
     }
     
-    static String jenaNTriplesReader = "com.hp.hpl.jena.rdf.model.impl.NTripleReader" ; 
-    static String jenaTurtleReader = "com.hp.hpl.jena.n3.turtle.TurtleReader" ; 
-    static String jenaN3Reader = jenaTurtleReader ; 
-    
     public static void resetJenaReaders()
     {
-        RDFReaderFImpl.setBaseReaderClassName("N-TRIPLES", jenaNTriplesReader) ;
-        RDFReaderFImpl.setBaseReaderClassName("N-Triples",  jenaNTriplesReader) ;
-        RDFReaderFImpl.setBaseReaderClassName("N-TRIPLE",  jenaNTriplesReader) ;
-        
-        RDFReaderFImpl.setBaseReaderClassName("N3",     jenaTurtleReader) ;
-        RDFReaderFImpl.setBaseReaderClassName("TURTLE", jenaTurtleReader) ;
-        RDFReaderFImpl.setBaseReaderClassName("Turtle", jenaTurtleReader) ;
-        RDFReaderFImpl.setBaseReaderClassName("TTL",    jenaTurtleReader) ;
-
-        RDFReaderFImpl.setBaseReaderClassName("RDF/JSON", null) ;
-        RDFWriterFImpl.setBaseWriterClassName("RDFJSON",  null) ;
+        IO_JenaReaders.resetJena() ;
+        IO_JenaWriters.resetJena() ;
     }
     
-    /** Register for use with Model.read **/ 
+    /** Register for use with Model.read (old style compatibility) */ 
     public static void registerForModelRead(String name, Class<?> cls)
     {
-        RDFReaderFImpl.setBaseReaderClassName(name, cls.getName()) ;
+        IO_JenaReaders.registerForModelRead(name, cls) ;
     }
     
-    /** Register for use with Model.write **/ 
+    /** Register for use with Model.write  (old style compatibility) */ 
     public static void registerForModelWrite(String name, Class<?> cls)
     {
-        RDFWriterFImpl.setBaseWriterClassName(name, cls.getName()) ;
+        IO_JenaWriters.registerForModelWrite(name, cls) ;
     }
 
 }

Modified: jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/RDFDataMgr.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/RDFDataMgr.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/RDFDataMgr.java (original)
+++ jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/RDFDataMgr.java Wed Mar  6 16:45:36 2013
@@ -18,9 +18,7 @@
 
 package org.apache.jena.riot;
 
-import java.io.InputStream ;
-import java.io.Reader ;
-import java.io.StringReader ;
+import java.io.* ;
 
 import org.apache.jena.atlas.io.IO ;
 import org.apache.jena.atlas.io.PeekReader ;
@@ -30,10 +28,7 @@ import org.apache.jena.atlas.web.TypedIn
 import org.apache.jena.riot.lang.LangRDFXML ;
 import org.apache.jena.riot.lang.LangRIOT ;
 import org.apache.jena.riot.stream.StreamManager ;
-import org.apache.jena.riot.system.ErrorHandlerFactory ;
-import org.apache.jena.riot.system.IRIResolver ;
-import org.apache.jena.riot.system.StreamRDF ;
-import org.apache.jena.riot.system.StreamRDFLib ;
+import org.apache.jena.riot.system.* ;
 import org.apache.jena.riot.tokens.Tokenizer ;
 import org.apache.jena.riot.tokens.TokenizerFactory ;
 import org.slf4j.Logger ;
@@ -812,5 +807,301 @@ public class RDFDataMgr
             ct = hintLang.getContentType() ;
         return ct ;
     }
+    
+    // -------- WRITERS
+    
+    /** Write the model to the output stream in the default serialization for the language.
+     * @param out       OutputStream
+     * @param model     Graph to write
+     * @param lang      Language for the seralization.
+     */
+    public static void write(OutputStream out, Model model, Lang lang)
+    {
+        write(out, model.getGraph(), lang) ;
+    }
+
+    /** Write the model to the output stream in the default serialization for the language.
+     * @param out           OutputStream
+     * @param model         Model to write
+     * @param serialization Serialization format
+     */
+    public static void write(OutputStream out, Model model, RDFFormat serialization)
+    {
+        write(out, model.getGraph(), serialization) ;
+    }
+    
+    /** Write the graph to the output stream in the default serialization for the language.
+     * @param out           OutputStream
+     * @param model         Model to write
+     * @param lang          Serialization format
+     */
+    public static void write(StringWriter out, Model model, Lang lang)
+    {
+        write(out, model.getGraph(), lang) ;
+    }
+    
+    /** Write the graph to the output stream in the default serialization for the language.
+     * @param out           OutputStream
+     * @param model         Model to write
+     * @param serialization Serialization format
+     */
+    public static void write(StringWriter out, Model model, RDFFormat serialization)
+    {
+        write(out, model.getGraph(), serialization) ;
+    }
+
+    /** Write the graph to the output stream in the default serialization for the language.
+     * @param out           OutputStream
+     * @param model         Model to write
+     * @param serialization Serialization format
+     * @deprecated Use of writers is deprecated - use an OutputStream
+     */
+    @Deprecated
+    public static void write(Writer out, Model model, RDFFormat serialization)
+    {
+        write(out, model.getGraph(), serialization) ;
+    }
+
+    /** Write the graph to the output stream in the default serialization for the language.
+     * @param out       OutputStream
+     * @param graph     Graph to write
+     * @param lang      Language for the seralization.
+     */
+    public static void write(OutputStream out, Graph graph, Lang lang)
+    {
+        RDFFormat serialization = RDFWriterRegistry.defaultSerialization(lang) ;
+        write(out, graph, serialization) ;
+    }
+
+    /** Write the graph to the output stream in the default serialization for the language.
+     * @param out           OutputStream
+     * @param graph         Graph to write
+     * @param serialization Serialization format
+     */
+    public static void write(OutputStream out, Graph graph, RDFFormat serialization)
+    {
+        write$(out, graph, serialization) ;
+    }
+
+    /** Write the graph to the output stream in the default serialization for the language.
+     * @param out           OutputStream
+     * @param graph         Graph to write
+     * @param lang          Serialization format
+     */
+    public static void write(StringWriter out, Graph graph, Lang lang)
+    {
+        // Only known reasonable use of a Writer
+        write$(out, graph, RDFWriterRegistry.defaultSerialization(lang)) ;
+    }
+
+    /** Write the graph to the output stream in the default serialization for the language.
+     * @param out           OutputStream
+     * @param graph         Graph to write
+     * @param serialization Serialization format
+     */
+    public static void write(StringWriter out, Graph graph, RDFFormat serialization)
+    {
+        // Only known reasonable use of a Writer
+        write$(out, graph, serialization) ;
+    }
+
+    /** Write the graph to the output stream in the default serialization for the language.
+     * @param out           OutputStream
+     * @param graph         Graph to write
+     * @param serialization Serialization format
+     * @deprecated Use of writers is deprecated - use an OutputStream
+     */
+    @Deprecated
+    public static void write(Writer out, Graph graph, RDFFormat serialization)
+    {
+        write$(out, graph, serialization) ;
+    }
+    
+    /** Write the Dataset to the output stream in the default serialization for the language.
+     * @param out       OutputStream
+     * @param dataset   Dataset to write
+     * @param lang      Language for the seralization.
+     */
+    public static void write(OutputStream out, Dataset dataset, Lang lang)
+    {
+        write(out, dataset.asDatasetGraph(), lang) ;
+    }
+
+    /** Write the graph to the output stream in the default serialization for the language.
+     * @param out           OutputStream
+     * @param dataset       Dataset to write
+     * @param serialization Serialization format
+     */
+    public static void write(OutputStream out, Dataset dataset, RDFFormat serialization)
+    {
+        write(out, dataset.asDatasetGraph(), serialization) ;
+    }
+
+    /** Write the graph to the output stream in the default serialization for the language.
+     * @param out           Writer
+     * @param dataset       Dataset to write
+     * @param serialization Serialization format
+     */
+    public static void write(StringWriter out, Dataset dataset, RDFFormat serialization)
+    {
+        write$(out, dataset.asDatasetGraph(), serialization) ;
+    }
+
+    /** Write the graph to the output stream in the default serialization for the language.
+     * @param out           StringWriter
+     * @param dataset       Dataset to write
+     * @param lang      Language for the seralization.
+     */
+    public static void write(StringWriter out, Dataset dataset, Lang lang)
+    {
+        RDFFormat serialization = RDFWriterRegistry.defaultSerialization(lang) ;
+        write$(out, dataset.asDatasetGraph(), serialization) ;
+    }
+
+    /** Write the graph to the output stream in the default serialization for the language.
+     * @param out           Writer
+     * @param dataset       Dataset to write
+     * @param serialization Serialization format
+     * @deprecated Use of writers is deprecated - use an OutputStream
+     */
+    @Deprecated
+    public static void write(Writer out, Dataset dataset, RDFFormat serialization)
+    {
+        write$(out, dataset.asDatasetGraph(), serialization) ;
+    }
+
+    /** Write the DatasetGraph to the output stream in the default serialization for the language.
+     * @param out       OutputStream
+     * @param dataset   DatasetGraph to write
+     * @param lang      Language for the seralization.
+     */
+    public static void write(OutputStream out, DatasetGraph dataset, Lang lang)
+    {
+        RDFFormat serialization = RDFWriterRegistry.defaultSerialization(lang) ;
+        write(out, dataset, serialization) ;
+    }
+
+    /** Write the graph to the output stream in the default serialization for the language.
+     * @param out           OutputStream
+     * @param dataset       DatasetGraph to write
+     * @param serialization Serialization format
+     */
+    public static void write(OutputStream out, DatasetGraph dataset, RDFFormat serialization)
+    {
+        write$(out, dataset, serialization) ;
+    }
+
+    /** Write the DatasetGraph to the output stream in the default serialization for the language.
+     * @param out       StringWriter
+     * @param dataset   DatasetGraph to write
+     * @param lang      Language for the seralization.
+     */
+    public static void write(StringWriter out, DatasetGraph dataset, Lang lang)
+    {
+        RDFFormat serialization = RDFWriterRegistry.defaultSerialization(lang) ;
+        write(out, dataset, serialization) ;
+    }
+
+    /** Write the graph to the output stream in the default serialization for the language.
+     * @param out           StringWriter
+     * @param dataset       DatasetGraph to write
+     * @param serialization Serialization format
+     */
+    public static void write(StringWriter out, DatasetGraph dataset, RDFFormat serialization)
+    {
+        write$(out, dataset, serialization) ;
+    }
+
+    /** Write the graph to the output stream in the default serialization for the language.
+     * @param out           Writer
+     * @param dataset       DatasetGraph to write
+     * @param serialization Serialization format
+     * @deprecated Use of writers is deprecated - use an OutputStream
+     */
+    @Deprecated
+    public static void write(Writer out, DatasetGraph dataset, RDFFormat serialization)
+    {
+        write$(out, dataset, serialization) ;
+    }
+
+    /** Create a writer for an RDF language
+     * @param lang   Language for the seralization.
+     * @return WriterGraphRIOT
+     */
+    
+    public static WriterGraphRIOT createGraphWriter(Lang lang)
+    {
+        RDFFormat serialization = RDFWriterRegistry.defaultSerialization(lang) ;
+        return createGraphWriter$(serialization) ;    
+    }
+    
+    /** Create a writer for an RDF language
+     * @param serialization Serialization format
+     * @return WriterGraphRIOT
+     */
+    public static WriterGraphRIOT createGraphWriter(RDFFormat serialization)
+    {
+        return createGraphWriter$(serialization) ;    
+    }
+
+    /** Create a writer for an RDF language
+     * @param lang   Language for the seralization.
+     * @return WriterGraphRIOT
+     */
+    
+    public static WriterDatasetRIOT createDatasetWriter(Lang lang)
+    {
+        RDFFormat serialization = RDFWriterRegistry.defaultSerialization(lang) ;
+        return createDatasetWriter$(serialization) ;    
+    }
+    
+    /** Create a writer for an RDF language
+     * @param serialization Serialization format
+     * @return WriterGraphRIOT
+     */
+    public static WriterDatasetRIOT createDatasetWriter(RDFFormat serialization)
+    {
+        return createDatasetWriter$(serialization) ;    
+    }
+    
+    private static WriterGraphRIOT createGraphWriter$(RDFFormat serialization)
+    {
+        WriterGraphRIOTFactory wf = RDFWriterRegistry.getWriterGraphFactory(serialization) ;
+        if ( wf == null )
+            throw new RiotException("No graph writer for "+serialization) ; 
+        return wf.create(serialization) ;
+    }
+
+    private static WriterDatasetRIOT createDatasetWriter$(RDFFormat serialization)
+    {
+        WriterDatasetRIOTFactory wf = RDFWriterRegistry.getWriterDatasetFactory(serialization) ;
+        if ( wf == null )
+            throw new RiotException("No dataset writer for "+serialization) ; 
+        return wf.create(serialization) ;
+    }
+
+    private static void write$(OutputStream out, Graph graph, RDFFormat serialization)
+    {
+        WriterGraphRIOT w = createGraphWriter$(serialization) ;
+        w.write(out, graph, RiotLib.prefixMap(graph), null, null) ;
+    }
+
+    private static void write$(Writer out, Graph graph, RDFFormat serialization)
+    {
+        WriterGraphRIOT w = createGraphWriter$(serialization) ;
+        w.write(out, graph, RiotLib.prefixMap(graph), null, null) ;
+    }
+
+    private static void write$(OutputStream out, DatasetGraph dataset, RDFFormat serialization)
+    {
+        WriterDatasetRIOT w = createDatasetWriter$(serialization) ;
+        w.write(out, dataset, RiotLib.prefixMap(dataset), null, null) ;
+    }
+
+    private static void write$(Writer out, DatasetGraph dataset, RDFFormat serialization)
+    {
+        WriterDatasetRIOT w = createDatasetWriter$(serialization) ;
+        w.write(out, dataset, RiotLib.prefixMap(dataset), null, null) ;
+    }
 }
 

Modified: jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/RDFWriterRegistry.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/RDFWriterRegistry.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/RDFWriterRegistry.java (original)
+++ jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/RDFWriterRegistry.java Wed Mar  6 16:45:36 2013
@@ -27,7 +27,7 @@ import org.apache.jena.atlas.lib.Lib ;
 import org.apache.jena.riot.Lang ;
 import org.apache.jena.riot.RIOT ;
 import org.apache.jena.riot.RiotException ;
-import org.apache.jena.riot.system.RiotWriterLib ;
+import org.apache.jena.riot.system.RiotLib ;
 
 public class RDFWriterRegistry
 {
@@ -65,7 +65,7 @@ public class RDFWriterRegistry
             
             WriterDatasetRIOT dsw = wdsfactory.create(serialization) ;
             if ( dsw != null )
-                return RiotWriterLib.adapter(dsw) ;
+                return RiotLib.adapter(dsw) ;
             return null ;
     }} ;
         

Modified: jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/RIOT.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/RIOT.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/RIOT.java (original)
+++ jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/RIOT.java Wed Mar  6 16:45:36 2013
@@ -19,8 +19,6 @@
 package org.apache.jena.riot;
 
 
-import org.apache.jena.riot.system.IO_Jena2 ;
-
 import com.hp.hpl.jena.query.ARQ ;
 import com.hp.hpl.jena.sparql.SystemARQ ;
 import com.hp.hpl.jena.sparql.mgt.ARQMgt ;
@@ -69,11 +67,9 @@ public class RIOT
             // called RIOT.init.
             RDFLanguages.init() ;
             RDFParserRegistry.init() ;
-            IO_Jena.wireIntoJena() ;
-
-            // Writers
             RDFWriterRegistry.init() ;
-            IO_Jena2.wireIntoJenaW() ;
+
+            IO_Jena.wireIntoJena() ;
             
             // Don't register JMX info with ARQ as it may not be initialized
             // itself and we can get into a circularity.

Modified: jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/RiotWriter.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/RiotWriter.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/RiotWriter.java (original)
+++ jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/RiotWriter.java Wed Mar  6 16:45:36 2013
@@ -30,16 +30,16 @@ import com.hp.hpl.jena.sparql.core.Datas
 import com.hp.hpl.jena.sparql.core.Quad ;
 
 /** Direct call to create writers for specific formats.
- *  The normal way to write is {@linkplain RDFWriterMgr} 
+ *  The normal way to write is {@linkplain RDFDataMgr} 
  */
 public class RiotWriter
 {
     // Compatibility stuff
-    /** @deprecated Use RDFWriterMgr.write(OutputStream, DatasetGraph, Lang.NQUADS) */
+    /** @deprecated Use RDFDataMgr.write(OutputStream, DatasetGraph, Lang.NQUADS) */
     @Deprecated
     public static void writeNQuads(OutputStream out, DatasetGraph dsg)
     {
-        RDFWriterMgr.write(out, dsg, Lang.NQUADS) ;
+        RDFDataMgr.write(out, dsg, Lang.NQUADS) ;
     }
     
     public static void writeNQuads(OutputStream out, Iterator<Quad> it)
@@ -47,11 +47,11 @@ public class RiotWriter
         NQuadsWriter.write(out, it) ;
     }
 
-    /** @deprecated Use RDFWriterMgr.write(OutputStream, Graph, Lang.NTRIPLES) */
+    /** @deprecated Use RDFDataMgr.write(OutputStream, Graph, Lang.NTRIPLES) */
     @Deprecated
     public static void writeTriples(OutputStream out, Graph graph)
     {
-        RDFWriterMgr.write(out, graph, Lang.NTRIPLES) ;
+        RDFDataMgr.write(out, graph, Lang.NTRIPLES) ;
     }
     
     public static void writeTriples(OutputStream out, Iterator<Triple> it)
@@ -59,11 +59,11 @@ public class RiotWriter
         NTriplesWriter.write(out, it) ;
     }
 
-    /** @deprecated Use RDFWriterMgr.write(OutputStream, Graph, Lang.RDFJSON) */
+    /** @deprecated Use RDFDataMgr.write(OutputStream, Graph, Lang.RDFJSON) */
     @Deprecated
     public static void writeRDFJSON(OutputStream out, Graph graph)
     {
-        RDFWriterMgr.write(out, graph, Lang.RDFJSON) ;
+        RDFDataMgr.write(out, graph, Lang.RDFJSON) ;
     }
 
     // Remove after release ... no one should be using this code unless

Modified: jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/adapters/RDFWriterRIOT.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/adapters/RDFWriterRIOT.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/adapters/RDFWriterRIOT.java (original)
+++ jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/adapters/RDFWriterRIOT.java Wed Mar  6 16:45:36 2013
@@ -18,13 +18,12 @@
 
 package org.apache.jena.riot.adapters;
 
-import static org.apache.jena.riot.system.RiotWriterLib.prefixMap ;
-
 import java.io.OutputStream ;
 import java.io.Writer ;
 
 import org.apache.jena.riot.* ;
-import org.apache.jena.riot.system.IO_Jena2 ;
+import org.apache.jena.riot.system.IO_JenaWriters ;
+import org.apache.jena.riot.system.RiotLib ;
 
 import com.hp.hpl.jena.graph.Graph ;
 import com.hp.hpl.jena.rdf.model.Model ;
@@ -46,13 +45,13 @@ public class RDFWriterRIOT implements RD
     //Initial late to avoid confusing exceptions during newInstance. 
     private WriterGraphRIOT writer()
     {
-        RDFFormat format = IO_Jena2.getFormatForJenaWriter(jenaName) ;
+        RDFFormat format = IO_JenaWriters.getFormatForJenaWriter(jenaName) ;
         if ( format != null )
-            return RDFWriterMgr.createGraphWriter(format) ;
+            return RDFDataMgr.createGraphWriter(format) ;
         // Try lang instead.
         Lang lang = RDFLanguages.nameToLang(jenaName) ;
         if ( lang != null )
-            return RDFWriterMgr.createGraphWriter(lang) ;
+            return RDFDataMgr.createGraphWriter(lang) ;
         throw new RiotException("No graph writer for '"+jenaName+"'") ;
     }
     
@@ -62,7 +61,7 @@ public class RDFWriterRIOT implements RD
         if (  base != null && base.equals("") )
             base = null ;
         Graph graph = model.getGraph() ;
-        writer().write(out, graph, prefixMap(graph), base, context) ;
+        writer().write(out, graph, RiotLib.prefixMap(graph), base, context) ;
     }
 
     @Override
@@ -71,7 +70,7 @@ public class RDFWriterRIOT implements RD
         if ( base != null && base.equals("") )
             base = null ;
         Graph graph = model.getGraph() ;
-        writer().write(out, graph, prefixMap(graph), base, context) ;
+        writer().write(out, graph, RiotLib.prefixMap(graph), base, context) ;
     }
 
     @Override

Modified: jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/out/NQuadsWriter.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/out/NQuadsWriter.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/out/NQuadsWriter.java (original)
+++ jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/out/NQuadsWriter.java Wed Mar  6 16:45:36 2013
@@ -23,24 +23,33 @@ import java.util.Iterator ;
 
 import org.apache.jena.atlas.iterator.Iter ;
 import org.apache.jena.atlas.lib.Sink ;
+import org.apache.jena.riot.Lang ;
+import org.apache.jena.riot.RDFDataMgr ;
 import org.apache.jena.riot.system.Prologue ;
 import org.apache.jena.riot.system.SyntaxLabels ;
 
-import com.hp.hpl.jena.graph.Node ;
 import com.hp.hpl.jena.query.Dataset ;
 import com.hp.hpl.jena.sparql.core.DatasetGraph ;
 import com.hp.hpl.jena.sparql.core.Quad ;
 
 public class NQuadsWriter
 {
+    /** @deprecated Use {@link RDFDataMgr#write(OutputStream, DatasetGraph, Lang)}
+     * with {@code Lang.NQUADS}.
+     */  
+    @Deprecated
     public static void write(OutputStream out, DatasetGraph dsg)
     {
-        write(out, dsg.find(Node.ANY, Node.ANY, Node.ANY, Node.ANY)) ;
+        RDFDataMgr.write(out, dsg, Lang.NQUADS) ;
     }
     
+    /** @deprecated Use {@link RDFDataMgr#write(OutputStream, Dataset, Lang)} 
+     * with {@code Lang.NQUADS}.
+     */
+    @Deprecated
     public static void write(OutputStream out, Dataset dsg)
     {
-        write(out, dsg.asDatasetGraph()) ;
+        RDFDataMgr.write(out, dsg, Lang.NQUADS) ;
     }
     
     public static void write(OutputStream out, Iterator<Quad> iter)

Modified: jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/out/NTriplesWriter.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/out/NTriplesWriter.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/out/NTriplesWriter.java (original)
+++ jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/out/NTriplesWriter.java Wed Mar  6 16:45:36 2013
@@ -23,18 +23,24 @@ import java.util.Iterator ;
 
 import org.apache.jena.atlas.iterator.Iter ;
 import org.apache.jena.atlas.lib.Sink ;
+import org.apache.jena.riot.Lang ;
+import org.apache.jena.riot.RDFDataMgr ;
 import org.apache.jena.riot.system.Prologue ;
 import org.apache.jena.riot.system.SyntaxLabels ;
 
 import com.hp.hpl.jena.graph.Graph ;
-import com.hp.hpl.jena.graph.Node ;
 import com.hp.hpl.jena.graph.Triple ;
 
 public class NTriplesWriter
 {
+    /** @deprecated 
+     * Use {@link RDFDataMgr#write(OutputStream, Graph, Lang)}
+     * with {@code Lang.NTRIPLES}
+     */  
+    @Deprecated
     public static void write(OutputStream out, Graph graph)
     {
-        write(out, graph.find(Node.ANY, Node.ANY, Node.ANY)) ;
+        RDFDataMgr.write(out, graph, Lang.NTRIPLES) ;
     }
     
     public static void write(OutputStream out, Iterator<Triple> iter)

Modified: jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/out/RDFJSONWriter.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/out/RDFJSONWriter.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/out/RDFJSONWriter.java (original)
+++ jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/out/RDFJSONWriter.java Wed Mar  6 16:45:36 2013
@@ -20,67 +20,25 @@ package org.apache.jena.riot.out;
 
 import java.io.OutputStream ;
 import java.io.Writer ;
-import java.util.HashMap ;
-import java.util.HashSet ;
-import java.util.Map ;
-import java.util.Set ;
 
-import org.apache.jena.atlas.lib.Pair ;
-import org.apache.jena.atlas.lib.Sink ;
-import org.apache.jena.riot.system.Prologue ;
-import org.apache.jena.riot.system.SyntaxLabels ;
+import org.apache.jena.riot.Lang ;
+import org.apache.jena.riot.RDFDataMgr ;
 
 import com.hp.hpl.jena.graph.Graph ;
-import com.hp.hpl.jena.graph.GraphUtil ;
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.graph.Triple ;
-import com.hp.hpl.jena.util.iterator.ExtendedIterator ;
 
 public class RDFJSONWriter {
 
-    public RDFJSONWriter() {}
+    //public RDFJSONWriter() {}
     
+    /** @deprecated 
+     * Use {@link RDFDataMgr#write(OutputStream, Graph, Lang)}
+     * with {@code Lang.RDFJSON}
+     */  
+    @Deprecated
 	public static void write (OutputStream out, Graph graph) {
-        Prologue prologue = Prologue.create(null, null) ; // (null, graph.getPrefixMapping()) ;
-		Sink<Pair<Node, Map<Node, Set<Node>>>> sink = new SinkEntityOutput(out, prologue, SyntaxLabels.createNodeToLabel()) ;
-		write ( sink, graph ) ;
+	    RDFDataMgr.write(out, graph, Lang.RDFJSON) ;
 	}
 	
 	public static void write (Writer out, Graph graph) {
-        Prologue prologue = Prologue.create(null, null) ; // (null, graph.getPrefixMapping()) ;
-		Sink<Pair<Node, Map<Node, Set<Node>>>> sink = new SinkEntityOutput(out, prologue, SyntaxLabels.createNodeToLabel()) ;
-		write ( sink, graph ) ;
 	}
-
-	private static void write (Sink<Pair<Node, Map<Node, Set<Node>>>> sink, Graph graph) {
-		ExtendedIterator<Node> subjects = GraphUtil.listSubjects(graph, Node.ANY, Node.ANY) ;
-		try {
-			Map<Node, Set<Node>> predicates = new HashMap<Node, Set<Node>>() ;
-			while ( subjects.hasNext() ) {
-				Node subject = subjects.next() ;
-				ExtendedIterator<Triple> triples = graph.find(subject, Node.ANY, Node.ANY) ;
-				try {
-					while ( triples.hasNext() ) {
-						Triple triple = triples.next() ;
-						Node p = triple.getPredicate() ;
-						if ( predicates.containsKey(p) ) {
-							predicates.get(p).add(triple.getObject()) ; 
-						} else {
-							Set<Node> objects = new HashSet<Node>() ;
-							objects.add(triple.getObject()) ;
-							predicates.put(p, objects) ;
-						}
-					}				
-				} finally {
-					if ( triples != null ) triples.close() ;
-				}
-				sink.send(new Pair<Node, Map<Node, Set<Node>>>(subject, predicates)) ;
-				predicates.clear() ;
-			}			
-		} finally {
-			if ( subjects != null ) subjects.close() ;
-			sink.close() ;
-		}
-	}
-	
 }

Added: jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/system/IO_JenaReaders.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/system/IO_JenaReaders.java?rev=1453415&view=auto
==============================================================================
--- jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/system/IO_JenaReaders.java (added)
+++ jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/system/IO_JenaReaders.java Wed Mar  6 16:45:36 2013
@@ -0,0 +1,76 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.riot.system;
+
+import org.apache.jena.riot.adapters.JenaReadersWriters ;
+
+import com.hp.hpl.jena.rdf.model.impl.RDFReaderFImpl ;
+import com.hp.hpl.jena.rdf.model.impl.RDFWriterFImpl ;
+import com.hp.hpl.jena.sparql.util.Symbol ;
+
+public class IO_JenaReaders
+{
+    private static String riotBase = "http://jena.apache.org/riot/" ; 
+    private static String streamManagerSymbolStr = riotBase+"streammanager" ; 
+    public static Symbol streamManagerSymbol = Symbol.create(streamManagerSymbolStr) ; 
+
+    public static void wireIntoJena()
+    {
+//        // Wire in generic 
+//        Class<?> readerRDF = RDFReaderRIOT.class ;
+        
+      registerForModelRead("RDF/XML",    JenaReadersWriters.RDFReaderRIOT_RDFXML.class) ;           // And default
+      registerForModelRead("RDF/XML-ABBREV", JenaReadersWriters.RDFReaderRIOT_RDFXML.class) ;
+
+      registerForModelRead("N-TRIPLES",  JenaReadersWriters.RDFReaderRIOT_NT.class) ;
+      registerForModelRead("N-Triples",  JenaReadersWriters.RDFReaderRIOT_NT.class) ;
+      registerForModelRead("N-TRIPLE",   JenaReadersWriters.RDFReaderRIOT_NT.class) ;
+      registerForModelRead("N3",         JenaReadersWriters.RDFReaderRIOT_TTL.class) ;
+      registerForModelRead("TURTLE",     JenaReadersWriters.RDFReaderRIOT_TTL.class) ;
+      registerForModelRead("Turtle",     JenaReadersWriters.RDFReaderRIOT_TTL.class) ;
+      registerForModelRead("TTL",        JenaReadersWriters.RDFReaderRIOT_TTL.class) ;
+      registerForModelRead("RDF/JSON",   JenaReadersWriters.RDFReaderRIOT_RDFJSON.class) ;
+    }
+    
+    static String jenaNTriplesReader = "com.hp.hpl.jena.rdf.model.impl.NTripleReader" ; 
+    static String jenaTurtleReader = "com.hp.hpl.jena.n3.turtle.TurtleReader" ; 
+    static String jenaN3Reader = jenaTurtleReader ; 
+    
+    public static void resetJena()
+    {
+        RDFReaderFImpl.setBaseReaderClassName("N-TRIPLES", jenaNTriplesReader) ;
+        RDFReaderFImpl.setBaseReaderClassName("N-Triples",  jenaNTriplesReader) ;
+        RDFReaderFImpl.setBaseReaderClassName("N-TRIPLE",  jenaNTriplesReader) ;
+        
+        RDFReaderFImpl.setBaseReaderClassName("N3",     jenaTurtleReader) ;
+        RDFReaderFImpl.setBaseReaderClassName("TURTLE", jenaTurtleReader) ;
+        RDFReaderFImpl.setBaseReaderClassName("Turtle", jenaTurtleReader) ;
+        RDFReaderFImpl.setBaseReaderClassName("TTL",    jenaTurtleReader) ;
+
+        RDFReaderFImpl.setBaseReaderClassName("RDF/JSON", null) ;
+        RDFWriterFImpl.setBaseWriterClassName("RDFJSON",  null) ;
+    }
+    
+    /** Register for use with Model.read (old style compatibility) */ 
+    public static void registerForModelRead(String name, Class<?> cls)
+    {
+        RDFReaderFImpl.setBaseReaderClassName(name, cls.getName()) ;
+    }
+}
+

Copied: jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/system/IO_JenaWriters.java (from r1452591, jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/system/IO_Jena2.java)
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/system/IO_JenaWriters.java?p2=jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/system/IO_JenaWriters.java&p1=jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/system/IO_Jena2.java&r1=1452591&r2=1453415&rev=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/system/IO_Jena2.java (original)
+++ jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/system/IO_JenaWriters.java Wed Mar  6 16:45:36 2013
@@ -29,7 +29,7 @@ import com.hp.hpl.jena.Jena ;
 import com.hp.hpl.jena.n3.N3JenaWriter ;
 import com.hp.hpl.jena.rdf.model.impl.RDFWriterFImpl ;
 
-public class IO_Jena2
+public class IO_JenaWriters
 {
     // Jena writer adapters
     // To adapters.JenaReadersWriters
@@ -57,7 +57,7 @@ public class IO_Jena2
     /** Return a collection of jena writer names */ 
     public static Collection<String> getJenaWriterNames() { return mapJenaNameToFormat.keySet() ; }
     
-    public static void wireIntoJenaW()
+    public static void wireIntoJena()
     {
         setFormatForJenaWriter("RDF/XML",                           RDFFormat.RDFXML_PLAIN) ;
         setFormatForJenaWriter("RDF/XML-ABBREV",                    RDFFormat.RDFXML_ABBREV) ;
@@ -79,28 +79,28 @@ public class IO_Jena2
         
 //        RDFWriterFImpl.LANGS
 //        RDFWriterFImpl.DEFAULTWRITER
-        RDFWriterFImpl.setBaseWriterClassName("RDF/XML",            RDFWriterRIOT_RDFXML.class.getName()) ;
-        RDFWriterFImpl.setBaseWriterClassName("RDF/XML-ABBREV",     RDFWriterRIOT_RDFXMLAbbrev.class.getName()) ;
-        RDFWriterFImpl.setBaseWriterClassName("N-TRIPLE",           RDFWriterRIOT_NTriples.class.getName()) ;
-        RDFWriterFImpl.setBaseWriterClassName("N-TRIPLES",          RDFWriterRIOT_NTriples.class.getName()) ;
-        RDFWriterFImpl.setBaseWriterClassName("N-Triples",          RDFWriterRIOT_NTriples.class.getName()) ;
-        RDFWriterFImpl.setBaseWriterClassName("NT",                 RDFWriterRIOT_NTriples.class.getName()) ;
-        RDFWriterFImpl.setBaseWriterClassName("N3",                 RDFWriterRIOT_N3.class.getName()) ;
-        
-        RDFWriterFImpl.setBaseWriterClassName(N3JenaWriter.n3WriterPrettyPrinter,   RDFWriterRIOT_N3_PP.class.getName()) ;
-        RDFWriterFImpl.setBaseWriterClassName(N3JenaWriter.n3WriterPlain,           RDFWriterRIOT_N3Plain.class.getName()) ;
-        RDFWriterFImpl.setBaseWriterClassName(N3JenaWriter.n3WriterTriples,         RDFWriterRIOT_N3Triples.class.getName()) ;
-        RDFWriterFImpl.setBaseWriterClassName(N3JenaWriter.n3WriterTriplesAlt,      RDFWriterRIOT_N3TriplesAlt.class.getName()) ;
-        
-        RDFWriterFImpl.setBaseWriterClassName(N3JenaWriter.turtleWriter,            RDFWriterRIOT_Turtle.class.getName()) ;
-        RDFWriterFImpl.setBaseWriterClassName(N3JenaWriter.turtleWriterAlt1,        RDFWriterRIOT_Turtle1.class.getName()) ;
-        RDFWriterFImpl.setBaseWriterClassName(N3JenaWriter.turtleWriterAlt2,        RDFWriterRIOT_Turtle2.class.getName()) ;
+        registerForModelWrite("RDF/XML",            RDFWriterRIOT_RDFXML.class) ;
+        registerForModelWrite("RDF/XML-ABBREV",     RDFWriterRIOT_RDFXMLAbbrev.class) ;
+        registerForModelWrite("N-TRIPLE",           RDFWriterRIOT_NTriples.class) ;
+        registerForModelWrite("N-TRIPLES",          RDFWriterRIOT_NTriples.class) ;
+        registerForModelWrite("N-Triples",          RDFWriterRIOT_NTriples.class) ;
+        registerForModelWrite("NT",                 RDFWriterRIOT_NTriples.class) ;
+        registerForModelWrite("N3",                 RDFWriterRIOT_N3.class) ;
+        
+        registerForModelWrite(N3JenaWriter.n3WriterPrettyPrinter,   RDFWriterRIOT_N3_PP.class) ;
+        registerForModelWrite(N3JenaWriter.n3WriterPlain,           RDFWriterRIOT_N3Plain.class) ;
+        registerForModelWrite(N3JenaWriter.n3WriterTriples,         RDFWriterRIOT_N3Triples.class) ;
+        registerForModelWrite(N3JenaWriter.n3WriterTriplesAlt,      RDFWriterRIOT_N3TriplesAlt.class) ;
+        
+        registerForModelWrite(N3JenaWriter.turtleWriter,            RDFWriterRIOT_Turtle.class) ;
+        registerForModelWrite(N3JenaWriter.turtleWriterAlt1,        RDFWriterRIOT_Turtle1.class) ;
+        registerForModelWrite(N3JenaWriter.turtleWriterAlt2,        RDFWriterRIOT_Turtle2.class) ;
         
-        RDFWriterFImpl.setBaseWriterClassName("RDF/JSON",       RDFWriterRIOT_RDFJSON.class.getName()) ;
-        RDFWriterFImpl.setBaseWriterClassName("RDFJSON",        RDFWriterRIOT_RDFJSON.class.getName()) ;
+        registerForModelWrite("RDF/JSON",       RDFWriterRIOT_RDFJSON.class) ;
+        registerForModelWrite("RDFJSON",        RDFWriterRIOT_RDFJSON.class) ;
     }
     
-    public static void resetJenaW()
+    public static void resetJena()
     {
         // This is the old Jena configuration (bugs and all) 
         RDFWriterFImpl.setBaseWriterClassName("RDF/XML",        Jena.PATH + ".xmloutput.impl.Basic") ;
@@ -120,5 +120,11 @@ public class IO_Jena2
         RDFWriterFImpl.setBaseWriterClassName(N3JenaWriter.turtleWriterAlt2,        Jena.PATH + ".n3.N3TurtleJenaWriter") ;
         
     }
+    
+    /** Register for use with Model.write  (old style compatibility) */ 
+    public static void registerForModelWrite(String name, Class<?> cls)
+    {
+        RDFWriterFImpl.setBaseWriterClassName(name, cls.getName()) ;
+    }
 }
 

Modified: jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/system/RiotLib.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/system/RiotLib.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/system/RiotLib.java (original)
+++ jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/system/RiotLib.java Wed Mar  6 16:45:36 2013
@@ -22,23 +22,44 @@ import static org.apache.jena.riot.RDFLa
 import static org.apache.jena.riot.RDFLanguages.NTRIPLES ;
 import static org.apache.jena.riot.RDFLanguages.RDFJSON ;
 import static org.apache.jena.riot.RDFLanguages.sameLang ;
+import static org.apache.jena.riot.writer.WriterConst.PREFIX_IRI ;
+import static org.apache.jena.riot.writer.WriterConst.RDF_type ;
+import static org.apache.jena.riot.writer.WriterConst.rdfNS ;
+
+import java.io.OutputStream ;
+import java.io.Writer ;
+import java.util.ArrayList ;
+import java.util.Collection ;
+import java.util.List ;
+import java.util.Map ;
+
+import org.apache.jena.atlas.io.IndentedWriter ;
+import org.apache.jena.atlas.iterator.Iter ;
 import org.apache.jena.atlas.logging.Log ;
 import org.apache.jena.riot.Lang ;
 import org.apache.jena.riot.RDFLanguages ;
+import org.apache.jena.riot.WriterDatasetRIOT ;
 import org.apache.jena.riot.tokens.Token ;
 import org.apache.jena.riot.tokens.Tokenizer ;
 import org.apache.jena.riot.tokens.TokenizerFactory ;
+import org.apache.jena.riot.writer.WriterGraphRIOTBase ;
 
+import com.hp.hpl.jena.graph.Graph ;
 import com.hp.hpl.jena.graph.Node ;
+import com.hp.hpl.jena.graph.Triple ;
 import com.hp.hpl.jena.query.ARQ ;
 import com.hp.hpl.jena.rdf.model.AnonId ;
 import com.hp.hpl.jena.sparql.ARQConstants ;
+import com.hp.hpl.jena.sparql.core.DatasetGraph ;
+import com.hp.hpl.jena.sparql.core.DatasetGraphFactory ;
+import com.hp.hpl.jena.sparql.util.Context ;
+import com.hp.hpl.jena.util.iterator.ExtendedIterator ;
 
 /** Misc RIOT code */
 public class RiotLib
 {
-    final static String bNodeLabelStart = "_:" ;
-    final static boolean skolomizedBNodes = ARQ.isTrue(ARQ.constantBNodeLabels) ;
+    private final static String bNodeLabelStart = "_:" ;
+    private final static boolean skolomizedBNodes = ARQ.isTrue(ARQ.constantBNodeLabels) ;
     
     /** Implement <_:....> as a 2bNode IRI"
      * that is, use the given label as the BNode internal label.
@@ -62,7 +83,7 @@ public class RiotLib
         return skolomizedBNodes && iri.startsWith(bNodeLabelStart) ;
     }
     
-    static ParserProfile profile = profile(RDFLanguages.TURTLE, null, null) ;
+    private static ParserProfile profile = profile(RDFLanguages.TURTLE, null, null) ;
     static {
         PrefixMap pmap = profile.getPrologue().getPrefixMap() ;
         pmap.add("rdf",  ARQConstants.rdfPrefix) ;
@@ -115,4 +136,173 @@ public class RiotLib
         else
             return new ParserProfileBase(prologue, handler) ;
     }
+
+    public static Collection<Triple> triplesOfSubject(Graph graph, Node subj)
+    {
+        return triples(graph, subj, Node.ANY, Node.ANY) ;
+    }
+
+    /* Get all the triples for the graph.find */
+    public static List<Triple> triples(Graph graph, Node s, Node p, Node o)
+    {
+        List<Triple> acc =  new ArrayList<Triple>() ;
+        accTriples(acc, graph, s, p, o) ;
+        return acc ;
+    }
+
+    /* Get all the triples for the graph.find */
+    public static long countTriples(Graph graph, Node s, Node p, Node o)
+    {
+        ExtendedIterator<Triple> iter = graph.find(s, p, o) ;
+        try { return Iter.count(iter) ; }
+        finally { iter.close() ; }
+    }
+
+    public static void accTriples(Collection<Triple> acc, Graph graph, Node s, Node p, Node o)
+    {
+        ExtendedIterator<Triple> iter = graph.find(s, p, o) ;
+        for ( ; iter.hasNext() ; )
+            acc.add(iter.next()) ;
+        iter.close() ;
+    }
+
+    /* Get a triple or null. */
+    public static Triple triple1(Graph graph, Node s, Node p, Node o)
+    {
+        ExtendedIterator<Triple> iter = graph.find(s, p, o) ;
+        try {
+            if ( ! iter.hasNext() )
+                return null ;
+            Triple t = iter.next() ;
+            if (  iter.hasNext() )
+                return null ;
+            return t ;
+        } finally { iter.close() ; }
+    }
+
+    public static boolean strSafeFor(String str, char ch) { return str.indexOf(ch) == -1 ; }
+
+    public static void writeBase(IndentedWriter out, String base)
+    {
+        if ( base != null )
+        {
+            out.print("@base ") ;
+            out.pad(PREFIX_IRI) ;
+            out.print("<") ;
+            out.print(base) ;
+            out.print(">") ;
+            out.print(" .") ;
+            out.println() ;
+        }
+    }
+
+    public static void writePrefixes(IndentedWriter out, PrefixMap prefixMap)
+    {        
+        if ( prefixMap != null && ! prefixMap.isEmpty() )
+        {
+            for ( Map.Entry <String, String> e : prefixMap.getMappingCopyStr().entrySet() )
+            {
+                out.print("@prefix ") ;
+                out.print(e.getKey()) ;
+                out.print(": ") ;
+                out.pad(PREFIX_IRI) ;
+                out.print("<") ;
+                out.print(e.getValue()) ;
+                out.print(">") ;
+                out.print(" .") ;
+                out.println() ;
+            }
+        }
+    }
+
+    /** Returns dataset that wraps a graph */
+    public static DatasetGraph dataset(Graph graph)
+    {
+        return DatasetGraphFactory.createOneGraph(graph) ;
+    }
+
+    public static PrefixMap prefixMap(DatasetGraph dsg)
+    {
+        return PrefixMapFactory.create(dsg.getDefaultGraph().getPrefixMapping()) ;
+    }
+
+    private static int calcWidth(PrefixMap prefixMap, String baseURI, Node p)
+    {
+        if ( ! prefixMap.contains(rdfNS) && RDF_type.equals(p) )
+            return 1 ;
+        
+        String x = prefixMap.abbreviate(p.getURI()) ;
+        if ( x == null )
+            return p.getURI().length()+2 ;
+        return x.length() ;
+    }
+
+    public static int calcWidth(PrefixMap prefixMap, String baseURI, Collection<Node> nodes, int minWidth, int maxWidth)
+    {
+        Node prev = null ; 
+        int nodeMaxWidth = minWidth ;
+        
+        for ( Node n : nodes )
+        {
+            if ( prev != null && prev.equals(n) )
+                continue ;
+            int len = calcWidth(prefixMap, baseURI, n) ;
+            if ( len > maxWidth )
+                continue ;
+            if ( nodeMaxWidth < len )
+                nodeMaxWidth = len ;
+            prev = n ;
+        }
+        return nodeMaxWidth ; 
+    }
+
+    public static int calcWidthTriples(PrefixMap prefixMap, String baseURI, Collection<Triple> triples, int minWidth, int maxWidth)
+    {
+        Node prev = null ; 
+        int nodeMaxWidth = minWidth ;
+    
+        for ( Triple triple : triples )
+        {
+            Node n = triple.getPredicate() ;
+            if ( prev != null && prev.equals(n) )
+                continue ;
+            int len = calcWidth(prefixMap, baseURI, n) ;
+            if ( len > maxWidth )
+                continue ;
+            if ( nodeMaxWidth < len )
+                nodeMaxWidth = len ;
+            prev = n ;
+        }
+        return nodeMaxWidth ;
+    }
+
+    public static IndentedWriter create(Writer writer)  { return new IndentedWriterWriter(writer) ; }
+
+    public static PrefixMap prefixMap(Graph graph)      { return PrefixMapFactory.create(graph.getPrefixMapping()) ; }
+
+    public static WriterGraphRIOTBase adapter(WriterDatasetRIOT writer)
+    { return new WriterAdapter(writer) ; }
+
+    private static class IndentedWriterWriter extends IndentedWriter
+    {
+        IndentedWriterWriter(Writer w) { super(w) ; }
+    }
+
+    private static class WriterAdapter extends WriterGraphRIOTBase
+    {
+        private WriterDatasetRIOT writer ;
+    
+        WriterAdapter(WriterDatasetRIOT writer) { this.writer = writer ; }
+        @Override
+        public Lang getLang()
+        { return writer.getLang() ; }
+    
+        @Override
+        public void write(OutputStream out, Graph graph, PrefixMap prefixMap, String baseURI, Context context)
+        { writer.write(out, RiotLib.dataset(graph), prefixMap, baseURI, context) ; }
+        
+        @Override
+        public void write(Writer out, Graph graph, PrefixMap prefixMap, String baseURI, Context context)
+        { writer.write(out, RiotLib.dataset(graph), prefixMap, baseURI, context) ; }
+    }
 }

Modified: jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/TriGWriterBase.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/TriGWriterBase.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/TriGWriterBase.java (original)
+++ jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/TriGWriterBase.java Wed Mar  6 16:45:36 2013
@@ -24,7 +24,7 @@ import java.io.Writer ;
 import org.apache.jena.atlas.io.IndentedWriter ;
 import org.apache.jena.riot.Lang ;
 import org.apache.jena.riot.system.PrefixMap ;
-import org.apache.jena.riot.system.RiotWriterLib ;
+import org.apache.jena.riot.system.RiotLib ;
 
 import com.hp.hpl.jena.sparql.core.DatasetGraph ;
 import com.hp.hpl.jena.sparql.util.Context ;
@@ -41,7 +41,7 @@ public abstract class TriGWriterBase ext
     @Override
     public void write(Writer out, DatasetGraph dsg, PrefixMap prefixMap, String baseURI, Context context)
     {
-        IndentedWriter iOut = RiotWriterLib.create(out) ;
+        IndentedWriter iOut = RiotLib.create(out) ;
         output$(iOut, dsg, prefixMap, baseURI) ;
         iOut.flush() ;
     }

Modified: jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/TurtleShell.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/TurtleShell.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/TurtleShell.java (original)
+++ jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/TurtleShell.java Wed Mar  6 16:45:36 2013
@@ -19,7 +19,6 @@
 
 package org.apache.jena.riot.writer;
 
-import static org.apache.jena.riot.system.RiotWriterLib.* ;
 import static org.apache.jena.riot.writer.WriterConst.* ;
 
 import java.util.* ;
@@ -32,7 +31,7 @@ import org.apache.jena.riot.out.NodeForm
 import org.apache.jena.riot.out.NodeToLabel ;
 import org.apache.jena.riot.system.PrefixMap ;
 import org.apache.jena.riot.system.PrefixMapFactory ;
-import org.apache.jena.riot.system.RiotWriterLib ;
+import org.apache.jena.riot.system.RiotLib ;
 
 import com.hp.hpl.jena.graph.Graph ;
 import com.hp.hpl.jena.graph.Node ;
@@ -41,7 +40,7 @@ import com.hp.hpl.jena.util.iterator.Ext
 import com.hp.hpl.jena.vocabulary.RDF ;
 import com.hp.hpl.jena.vocabulary.RDFS ;
 
-/** Base class to support the pretty forms of Turtle-related languages (Turle, TriG) */ 
+/** Base class to support the pretty forms of Turtle-related languages (Turtle, TriG) */ 
 public abstract class TurtleShell
 {
     protected final IndentedWriter out ; 
@@ -61,12 +60,12 @@ public abstract class TurtleShell
 
     protected void writeBase(String base)
     {
-        RiotWriterLib.writeBase(out, base) ;
+        RiotLib.writeBase(out, base) ;
     }
 
     protected void writePrefixes(PrefixMap prefixMap)
     {
-        RiotWriterLib.writePrefixes(out, prefixMap) ;
+        RiotLib.writePrefixes(out, prefixMap) ;
     }
 
     protected void writeGraphTTL(Graph graph)
@@ -157,7 +156,7 @@ public abstract class TurtleShell
          */
         private void findLists()
         {
-            List<Triple> tails = RiotWriterLib.triples(graph, Node.ANY, RDF_Rest, RDF_Nil) ;
+            List<Triple> tails = RiotLib.triples(graph, Node.ANY, RDF_Rest, RDF_Nil) ;
             for ( Triple t : tails )
             {
                 // Returns the elements, reversed.
@@ -168,7 +167,7 @@ public abstract class TurtleShell
                     Node headElt = p.getLeft() ; 
                     // Free standing?private
                     List<Node> elts = p.getRight() ;
-                    long numLinks = RiotWriterLib.countTriples(graph, null, null, headElt) ;
+                    long numLinks = RiotLib.countTriples(graph, null, null, headElt) ;
                     if ( numLinks == 1 )
                         lists.put(headElt, elts) ;
                     else if ( numLinks == 0 )
@@ -202,15 +201,15 @@ public abstract class TurtleShell
                     break ;
                 }
 
-                Triple t = RiotWriterLib.triple1(graph, x, RDF_First, null) ;
+                Triple t = RiotLib.triple1(graph, x, RDF_First, null) ;
                 if ( t == null )
                     return null ;
                 eltsReversed.add(t.getObject()) ;
                 listCells.add(x) ;
 
                 // Try to move up the list.
-                List<Triple> acc2 = RiotWriterLib.triples(graph, null, null, x) ;
-                long numRest = RiotWriterLib.countTriples(graph, null, RDF_Rest, x) ;
+                List<Triple> acc2 = RiotLib.triples(graph, null, null, x) ;
+                long numRest = RiotLib.countTriples(graph, null, RDF_Rest, x) ;
                 if ( numRest != 1 )
                 {
                     // Head of well-formed list.
@@ -236,13 +235,13 @@ public abstract class TurtleShell
         /* Return the triples of the list element, or null if invalid list */
         private boolean validListElement(Node x, List<Triple> acc)
         {
-            Triple t1 = RiotWriterLib.triple1(graph, x, RDF_Rest, null) ; // Which we came up to get here :-(
+            Triple t1 = RiotLib.triple1(graph, x, RDF_Rest, null) ; // Which we came up to get here :-(
             if ( t1 == null )
                 return false ;
-            Triple t2 = RiotWriterLib.triple1(graph, x, RDF_First, null) ;
+            Triple t2 = RiotLib.triple1(graph, x, RDF_First, null) ;
             if ( t2 == null )
                 return false ;
-            long N = RiotWriterLib.countTriples(graph, x, null, null) ;
+            long N = RiotLib.countTriples(graph, x, null, null) ;
             if ( N != 2 )
                 return false ;
             acc.add(t1) ;
@@ -361,7 +360,7 @@ public abstract class TurtleShell
                     continue ;
                 }
 
-                Collection<Triple> cluster = RiotWriterLib.triplesOfSubject(graph, subj) ;
+                Collection<Triple> cluster = RiotLib.triplesOfSubject(graph, subj) ;
                 writeCluster(subj, cluster) ;
             }
             return !first ;
@@ -399,7 +398,7 @@ public abstract class TurtleShell
             Collection<Node> predicates = pGroups.keySet() ;
             
             // Find longest predicate URI
-            int predicateMaxWidth = calcWidth(prefixMap, baseURI, predicates, MIN_PREDICATE, LONG_PREDICATE) ;
+            int predicateMaxWidth = RiotLib.calcWidth(prefixMap, baseURI, predicates, MIN_PREDICATE, LONG_PREDICATE) ;
 
             boolean first = true ;
 
@@ -530,7 +529,7 @@ public abstract class TurtleShell
 
         private void nestedObject(Node node)
         {
-            Collection<Triple> x = RiotWriterLib.triplesOfSubject(graph, node) ;
+            Collection<Triple> x = RiotLib.triplesOfSubject(graph, node) ;
 
             if ( x.isEmpty() )
             {

Modified: jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/TurtleWriterBase.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/TurtleWriterBase.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/TurtleWriterBase.java (original)
+++ jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/TurtleWriterBase.java Wed Mar  6 16:45:36 2013
@@ -24,7 +24,7 @@ import java.io.Writer ;
 import org.apache.jena.atlas.io.IndentedWriter ;
 import org.apache.jena.riot.Lang ;
 import org.apache.jena.riot.system.PrefixMap ;
-import org.apache.jena.riot.system.RiotWriterLib ;
+import org.apache.jena.riot.system.RiotLib ;
 
 import com.hp.hpl.jena.graph.Graph ;
 import com.hp.hpl.jena.sparql.util.Context ;
@@ -40,7 +40,7 @@ public abstract class TurtleWriterBase e
     @Override
     public void write(Writer out, Graph graph, PrefixMap prefixMap, String baseURI, Context context)
     {
-        IndentedWriter iOut = RiotWriterLib.create(out) ;
+        IndentedWriter iOut = RiotLib.create(out) ;
         output$(iOut, graph, prefixMap, baseURI) ;
         iOut.flush() ;
     }

Modified: jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/WriterStreamRDFBase.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/WriterStreamRDFBase.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/WriterStreamRDFBase.java (original)
+++ jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/WriterStreamRDFBase.java Wed Mar  6 16:45:36 2013
@@ -28,7 +28,7 @@ import org.apache.jena.riot.out.NodeForm
 import org.apache.jena.riot.out.NodeToLabel ;
 import org.apache.jena.riot.system.PrefixMap ;
 import org.apache.jena.riot.system.PrefixMapFactory ;
-import org.apache.jena.riot.system.RiotWriterLib ;
+import org.apache.jena.riot.system.RiotLib ;
 import org.apache.jena.riot.system.StreamRDF ;
 
 import com.hp.hpl.jena.graph.Node ;
@@ -81,7 +81,7 @@ public abstract class WriterStreamRDFBas
     {
         if ( ! ( output instanceof BufferedWriter ) )
             output = new BufferedWriter(output, 32*1024) ;
-        return RiotWriterLib.create(output) ;
+        return RiotLib.create(output) ;
     }
     
     private void reset$() 

Modified: jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/WriterStreamRDFBlocks.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/WriterStreamRDFBlocks.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/WriterStreamRDFBlocks.java (original)
+++ jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/WriterStreamRDFBlocks.java Wed Mar  6 16:45:36 2013
@@ -19,7 +19,6 @@
 package org.apache.jena.riot.writer;
 
 import static org.apache.jena.atlas.lib.Lib.equal ;
-import static org.apache.jena.riot.system.RiotWriterLib.calcWidthTriples ;
 
 import java.io.OutputStream ;
 import java.io.Writer ;
@@ -29,6 +28,7 @@ import java.util.List ;
 import org.apache.jena.atlas.io.IndentedWriter ;
 import org.apache.jena.atlas.lib.Lib ;
 import org.apache.jena.riot.other.GLib ;
+import org.apache.jena.riot.system.RiotLib ;
 
 import com.hp.hpl.jena.graph.Node ;
 import com.hp.hpl.jena.graph.Triple ;
@@ -144,7 +144,7 @@ public class WriterStreamRDFBlocks exten
     private void writePredicateObjectList(Collection<Triple> triples)
     {
         // Find width
-        int predicateMaxWidth = calcWidthTriples(pMap, baseURI, triples, MIN_PREDICATE, LONG_PREDICATE) ;
+        int predicateMaxWidth = RiotLib.calcWidthTriples(pMap, baseURI, triples, MIN_PREDICATE, LONG_PREDICATE) ;
         boolean first = true ;
         for ( Triple triple : triples )
         {

Modified: jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/WriterStreamRDFTuples.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/WriterStreamRDFTuples.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/WriterStreamRDFTuples.java (original)
+++ jena/branches/arq-riot-output/src/main/java/org/apache/jena/riot/writer/WriterStreamRDFTuples.java Wed Mar  6 16:45:36 2013
@@ -26,7 +26,7 @@ import org.apache.jena.atlas.io.Indented
 import org.apache.jena.atlas.lib.Tuple ;
 import org.apache.jena.riot.out.NodeFormatter ;
 import org.apache.jena.riot.out.NodeFormatterNT ;
-import org.apache.jena.riot.system.RiotWriterLib ;
+import org.apache.jena.riot.system.RiotLib ;
 import org.apache.jena.riot.system.StreamRDF ;
 
 import com.hp.hpl.jena.graph.Node ;
@@ -48,7 +48,7 @@ public class WriterStreamRDFTuples imple
 
     public WriterStreamRDFTuples(Writer w)
     {
-        this(RiotWriterLib.create(w)) ;
+        this(RiotLib.create(w)) ;
     }
 
     public WriterStreamRDFTuples(IndentedWriter w)

Modified: jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/out/TS_Out.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/out/TS_Out.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/out/TS_Out.java (original)
+++ jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/out/TS_Out.java Wed Mar  6 16:45:36 2013
@@ -27,8 +27,6 @@ import org.junit.runners.Suite ;
       TestNodeFmt.class
     , TestNodeFmtLib.class
     , TestOutput.class
-    , TestOutputNTriples.class
-    , TestOutputRDFJSON.class
 })
 
 public class TS_Out

Modified: jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/writer/TS_RiotWriter.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/writer/TS_RiotWriter.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/writer/TS_RiotWriter.java (original)
+++ jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/writer/TS_RiotWriter.java Wed Mar  6 16:45:36 2013
@@ -18,7 +18,6 @@
 
 package org.apache.jena.riot.writer;
 
-import org.apache.jena.riot.RDFWriterRegistry ;
 import org.apache.jena.riot.RIOT ;
 import org.junit.BeforeClass ;
 import org.junit.runner.RunWith ;
@@ -32,6 +31,7 @@ import org.junit.runners.Suite.SuiteClas
     , TestRiotWriterGraph.class
     , TestRiotWriterDataset.class
     , TestJenaWriters.class
+    , TestRDFJSON.class
 })
 
 public class TS_RiotWriter
@@ -39,6 +39,5 @@ public class TS_RiotWriter
     @BeforeClass public static void beforeClass()
     { 
         RIOT.init() ;
-        RDFWriterRegistry.init() ;
     }
 }

Modified: jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/writer/TestJenaWriters.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/writer/TestJenaWriters.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/writer/TestJenaWriters.java (original)
+++ jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/writer/TestJenaWriters.java Wed Mar  6 16:45:36 2013
@@ -23,8 +23,8 @@ import java.util.ArrayList ;
 import java.util.List ;
 
 import org.apache.jena.atlas.lib.Bytes ;
-import org.apache.jena.riot.RDFWriterMgr ;
-import org.apache.jena.riot.system.IO_Jena2 ;
+import org.apache.jena.riot.RDFDataMgr ;
+import org.apache.jena.riot.system.IO_JenaWriters ;
 import org.junit.Test ;
 import org.junit.runner.RunWith ;
 import org.junit.runners.Parameterized ;
@@ -38,7 +38,7 @@ public class TestJenaWriters extends Abs
     @Parameters(name = "{index}: {0}")
     public static Iterable<Object[]> data() {
         List<Object[]> x = new ArrayList<Object[]>() ;
-        for ( String wname : IO_Jena2.getJenaWriterNames() )
+        for ( String wname : IO_JenaWriters.getJenaWriterNames() )
             x.add(new Object[]{wname}) ;
         return x ; 
     }
@@ -77,7 +77,7 @@ public class TestJenaWriters extends Abs
     private void test(String filename) {
         Model m = readModel(filename) ;
         ByteArrayOutputStream out2 = new ByteArrayOutputStream() ;
-        RDFWriterMgr.write(out2, m, IO_Jena2.getFormatForJenaWriter(jenaFormatName)) ;
+        RDFDataMgr.write(out2, m, IO_JenaWriters.getFormatForJenaWriter(jenaFormatName)) ;
 
         ByteArrayOutputStream out1 = new ByteArrayOutputStream() ;
         m.write(out1, jenaFormatName) ;

Copied: jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/writer/TestRDFJSON.java (from r1452591, jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/out/TestOutputRDFJSON.java)
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/writer/TestRDFJSON.java?p2=jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/writer/TestRDFJSON.java&p1=jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/out/TestOutputRDFJSON.java&r1=1452591&r2=1453415&rev=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/out/TestOutputRDFJSON.java (original)
+++ jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/writer/TestRDFJSON.java Wed Mar  6 16:45:36 2013
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package org.apache.jena.riot.out;
+package org.apache.jena.riot.writer;
 
 import java.io.ByteArrayInputStream ;
 import java.io.ByteArrayOutputStream ;
@@ -25,9 +25,10 @@ import org.apache.jena.atlas.json.JSON ;
 import org.apache.jena.atlas.json.JsonObject ;
 import org.apache.jena.atlas.junit.BaseTest ;
 import org.apache.jena.atlas.lib.StrUtils ;
+import org.apache.jena.riot.Lang ;
+import org.apache.jena.riot.RDFDataMgr ;
 import org.apache.jena.riot.RiotReader ;
 import org.apache.jena.riot.lang.LangRIOT ;
-import org.apache.jena.riot.out.RDFJSONWriter ;
 import org.apache.jena.riot.system.StreamRDF ;
 import org.apache.jena.riot.system.StreamRDFLib ;
 import org.junit.Test ;
@@ -38,7 +39,7 @@ import com.hp.hpl.jena.graph.Triple ;
 import com.hp.hpl.jena.sparql.graph.GraphFactory ;
 import com.hp.hpl.jena.sparql.sse.SSE ;
 
-public class TestOutputRDFJSON extends BaseTest
+public class TestRDFJSON extends BaseTest
 {
     @Test public void rdfjson_00()
     {
@@ -162,7 +163,7 @@ public class TestOutputRDFJSON extends B
     private ByteArrayOutputStream serializeAsJSON (Graph graph) 
     {
         ByteArrayOutputStream bout = new ByteArrayOutputStream() ;
-        RDFJSONWriter.write(bout, graph) ;
+        RDFDataMgr.write(bout, graph, Lang.RDFJSON) ;
         return bout ;
     }
 

Modified: jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/writer/TestRiotWriterDataset.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/writer/TestRiotWriterDataset.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/writer/TestRiotWriterDataset.java (original)
+++ jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/writer/TestRiotWriterDataset.java Wed Mar  6 16:45:36 2013
@@ -69,7 +69,7 @@ public class TestRiotWriterDataset exten
         assertEquals(lang, rs.getLang()) ;
 
         ByteArrayOutputStream out = new ByteArrayOutputStream() ;
-        RDFWriterMgr.write(out, ds, format) ;
+        RDFDataMgr.write(out, ds, format) ;
         
         if ( lang == Lang.RDFNULL )
             return ;

Modified: jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/writer/TestRiotWriterGraph.java
URL: http://svn.apache.org/viewvc/jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/writer/TestRiotWriterGraph.java?rev=1453415&r1=1453414&r2=1453415&view=diff
==============================================================================
--- jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/writer/TestRiotWriterGraph.java (original)
+++ jena/branches/arq-riot-output/src/test/java/org/apache/jena/riot/writer/TestRiotWriterGraph.java Wed Mar  6 16:45:36 2013
@@ -95,7 +95,7 @@ public class TestRiotWriterGraph extends
         assertEquals(lang, rs.getLang()) ;
 
         ByteArrayOutputStream out = new ByteArrayOutputStream() ;
-        RDFWriterMgr.write(out, m, format) ;
+        RDFDataMgr.write(out, m, format) ;
         
         if ( lang == Lang.RDFNULL )
             return ;



Mime
View raw message