jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1426294 - in /jena/trunk: jena-arq/src-examples/arq/examples/riot/ jena-arq/src/main/java/org/apache/jena/riot/ jena-arq/src/main/java/org/apache/jena/riot/lang/ jena-arq/src/main/java/org/apache/jena/riot/system/ jena-arq/src/main/java/or...
Date Thu, 27 Dec 2012 19:03:18 GMT
Author: andy
Date: Thu Dec 27 19:03:17 2012
New Revision: 1426294

URL: http://svn.apache.org/viewvc?rev=1426294&view=rev
Log:
Rename RDFParserOutput as SinkRDF.
Ripple the changes through dependent models.

Added:
    jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/SinkRDFLib.java
      - copied, changed from r1426285, jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/RDFParserOutputLib.java
    jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/SinkRDFLimited.java
      - copied, changed from r1425327, jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/SinkLimited.java
    jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader/BulkSinkRDF.java
Removed:
    jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/RDFParserOutputLib.java
    jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/SinkLimited.java
Modified:
    jena/trunk/jena-arq/src-examples/arq/examples/riot/ExRIOT_2.java
    jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/RDFDataMgr.java
    jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/RiotReader.java
    jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/SinkQuadsToDataset.java
    jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/SinkTriplesToGraph.java
    jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/SinkRDFWrapper.java
    jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/web/HttpResponseLib.java
    jena/trunk/jena-arq/src/main/java/org/openjena/riot/RiotQuadParsePuller.java
    jena/trunk/jena-arq/src/main/java/org/openjena/riot/RiotReader.java
    jena/trunk/jena-arq/src/main/java/org/openjena/riot/RiotTripleParsePuller.java
    jena/trunk/jena-arq/src/main/java/riotcmd/CmdLangParse.java
    jena/trunk/jena-arq/src/main/java/riotcmd/infer.java
    jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNQuads.java
    jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNTriples.java
    jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNTuples.java
    jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangRdfJson.java
    jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangTrig.java
    jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangTurtle.java
    jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestTurtleTerms.java
    jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/out/TestOutputRDFJSON.java
    jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/http/DatasetGraphAccessorHTTP.java
    jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/GraphLoadUtils.java
    jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/REST_Quads.java
    jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST.java
    jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Upload.java
    jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/DataValidator.java
    jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader/BulkLoader.java
    jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader2/CmdNodeTableBuilder.java

Modified: jena/trunk/jena-arq/src-examples/arq/examples/riot/ExRIOT_2.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src-examples/arq/examples/riot/ExRIOT_2.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-arq/src-examples/arq/examples/riot/ExRIOT_2.java (original)
+++ jena/trunk/jena-arq/src-examples/arq/examples/riot/ExRIOT_2.java Thu Dec 27 19:03:17 2012
@@ -26,7 +26,6 @@ import org.apache.jena.riot.RDFLanguages
 import org.apache.jena.riot.RIOT ;
 import org.apache.jena.riot.RiotReader ;
 import org.apache.jena.riot.lang.LangRIOT ;
-import org.apache.jena.riot.lang.RDFParserOutputLib ;
 import org.apache.jena.riot.system.* ;
 
 /** Example of using RIOT directly.
@@ -46,7 +45,7 @@ public class ExRIOT_2
         RIOT.init() ;
 
         // ---- Parse to a Sink.
-        SinkRDF noWhere = RDFParserOutputLib.sinkNull() ;
+        SinkRDF noWhere = SinkRDFLib.sinkNull() ;
 
         // RIOT controls the conversion from bytes to java chars.
         InputStream in = new FileInputStream("data.trig") ;

Modified: jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/RDFDataMgr.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/RDFDataMgr.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/RDFDataMgr.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/RDFDataMgr.java Thu Dec 27 19:03:17 2012
@@ -29,10 +29,10 @@ import org.apache.jena.atlas.web.Content
 import org.apache.jena.atlas.web.TypedInputStream ;
 import org.apache.jena.riot.lang.LangRDFXML ;
 import org.apache.jena.riot.lang.LangRIOT ;
-import org.apache.jena.riot.lang.RDFParserOutputLib ;
 import org.apache.jena.riot.stream.StreamManager ;
 import org.apache.jena.riot.system.ErrorHandlerFactory ;
 import org.apache.jena.riot.system.SinkRDF ;
+import org.apache.jena.riot.system.SinkRDFLib ;
 import org.apache.jena.riot.tokens.Tokenizer ;
 import org.apache.jena.riot.tokens.TokenizerFactory ;
 import org.slf4j.Logger ;
@@ -198,7 +198,7 @@ public class RDFDataMgr
      */
     public static void read(Graph graph, String uri, String base, Lang hintLang, Context context)
     {
-        SinkRDF dest = RDFParserOutputLib.graph(graph) ;
+        SinkRDF dest = SinkRDFLib.graph(graph) ;
         read(dest, uri, base, hintLang, context) ;
     }
 
@@ -245,8 +245,8 @@ public class RDFDataMgr
      */
     public static void read(Graph graph, InputStream in, String base, Lang lang)
     {
-        SinkRDF dest = RDFParserOutputLib.graph(graph) ;
-        process(dest, base, new TypedInputStream(in), lang, null) ;
+        SinkRDF dest = SinkRDFLib.graph(graph) ;
+        process(dest, new TypedInputStream(in), base, lang, null) ;
     }
 
     /** Read triples into a model with chars from an Reader.
@@ -276,7 +276,7 @@ public class RDFDataMgr
     @Deprecated
     public static void read(Graph graph, Reader in, String base, Lang lang)
     {
-        SinkRDF dest = RDFParserOutputLib.graph(graph) ;
+        SinkRDF dest = SinkRDFLib.graph(graph) ;
         processTriples(dest, base, in, lang, null) ;
     }
 
@@ -289,7 +289,7 @@ public class RDFDataMgr
     public static void read(Model model, StringReader in, String base, Lang lang)
     {
         Graph g = model.getGraph() ;
-        SinkRDF dest = RDFParserOutputLib.graph(g) ;
+        SinkRDF dest = SinkRDFLib.graph(g) ;
         processTriples(dest, base, in, lang, null) ;
     }
 
@@ -301,7 +301,7 @@ public class RDFDataMgr
      */
     public static void read(Graph graph, StringReader in, String base, Lang lang)
     {
-        SinkRDF dest = RDFParserOutputLib.graph(graph) ;
+        SinkRDF dest = SinkRDFLib.graph(graph) ;
         processTriples(dest, base, in, lang, null) ;
     }
     
@@ -497,7 +497,7 @@ public class RDFDataMgr
 
     public static void read(DatasetGraph dataset, String uri, String base, Lang hintLang, Context context)
     {
-        SinkRDF sink = RDFParserOutputLib.dataset(dataset) ;
+        SinkRDF sink = SinkRDFLib.dataset(dataset) ;
         read(sink, uri, base, hintLang, context) ;
     }
 
@@ -540,8 +540,8 @@ public class RDFDataMgr
      */
     public static void read(DatasetGraph dataset, InputStream in, String base, Lang lang)
     {
-        SinkRDF dest = RDFParserOutputLib.dataset(dataset) ;
-        process(dest, base, new TypedInputStream(in), lang, null) ;
+        SinkRDF dest = SinkRDFLib.dataset(dataset) ;
+        process(dest, new TypedInputStream(in), base, lang, null) ;
     }
     
     /** Read quads into a dataset with chars from an Reader.
@@ -571,7 +571,7 @@ public class RDFDataMgr
     @Deprecated
     public static void read(DatasetGraph dataset, Reader in, String base, Lang lang)
     {
-        SinkRDF dest = RDFParserOutputLib.dataset(dataset) ;
+        SinkRDF dest = SinkRDFLib.dataset(dataset) ;
         process(dest, base, in, lang, null) ;
     }
 
@@ -598,7 +598,7 @@ public class RDFDataMgr
      */
     public static void read(DatasetGraph dataset, StringReader in, String base, Lang lang)
     {
-        SinkRDF dest = RDFParserOutputLib.dataset(dataset) ;
+        SinkRDF dest = SinkRDFLib.dataset(dataset) ;
         process(dest, base, in, lang, null) ;
     }
 
@@ -613,7 +613,7 @@ public class RDFDataMgr
         read(sink, uri, uri, hintLang, context) ;
     }
 
-    /** Read quads,.
+    /** Read RDF data.
      * @param sink     Destination for the RDF read.
      * @param uri       URI to read from (includes file: and a plain file name).
      * @param base      Base URI (defaults to uri).
@@ -625,10 +625,23 @@ public class RDFDataMgr
         TypedInputStream in = open(uri, context) ;
         if ( in == null )
             throw new RiotException("Not found: "+uri) ;
-        process(sink, base, in, hintLang, context) ;
+        process(sink, in, base, hintLang, context) ;
         IO.close(in) ;
     }
 
+    /** Read RDF data.
+     * @param sink      Destination for the RDF read.
+     * @param in        Bytes to read.
+     * @param base      Base URI (defaults to uri).
+     * @param hintLang  Hint for the syntax
+     * @param context   Content object to control reading process.
+     */
+    public static void read(SinkRDF sink, InputStream in, String base, Lang hintLang, Context context)
+    {
+        process(sink, new TypedInputStream(in), base, hintLang, context) ;
+    }
+
+
     /** Open a stream to the destination (URI or filename)
      * Performs content negotition, including looking at file extension. 
      */
@@ -679,7 +692,7 @@ public class RDFDataMgr
     // We could have had two step design - ReaderFactory-ReaderInstance
     // no - put the bruden on complicated readers, not everyone. 
     
-    private static void process(SinkRDF destination, String baseUri, TypedInputStream in, Lang hintLang, Context context)
+    private static void process(SinkRDF destination , TypedInputStream in , String baseUri , Lang hintLang , Context context )
     {
         ContentType ct = determineCT(baseUri, in.getContentType(), hintLang ) ;
         if ( ct == null )

Modified: jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/RiotReader.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/RiotReader.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/RiotReader.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/RiotReader.java Thu Dec 27 19:03:17 2012
@@ -30,10 +30,7 @@ import org.apache.jena.atlas.json.io.par
 import org.apache.jena.atlas.lib.IRILib ;
 import org.apache.jena.atlas.lib.Sink ;
 import org.apache.jena.riot.lang.* ;
-import org.apache.jena.riot.system.ErrorHandlerFactory ;
-import org.apache.jena.riot.system.IRIResolver ;
-import org.apache.jena.riot.system.RiotLib ;
-import org.apache.jena.riot.system.SinkRDF ;
+import org.apache.jena.riot.system.* ;
 import org.apache.jena.riot.tokens.Tokenizer ;
 import org.apache.jena.riot.tokens.TokenizerFactory ;
 import org.openjena.riot.RiotQuadParsePuller ;
@@ -165,7 +162,7 @@ public class RiotReader
      */  
     public static void parseTriples(String filename, Lang lang, String baseIRI, Sink<Triple> sink)
     {
-        SinkRDF dest = RDFParserOutputLib.sinkTriples(sink) ;
+        SinkRDF dest = SinkRDFLib.sinkTriples(sink) ;
         parse(filename, lang, baseIRI, dest) ;
     }
 
@@ -178,7 +175,7 @@ public class RiotReader
      */  
     public static void parseTriples(InputStream in, Lang lang, String baseIRI, Sink<Triple> sink)
     {
-        SinkRDF dest = RDFParserOutputLib.sinkTriples(sink) ;
+        SinkRDF dest = SinkRDFLib.sinkTriples(sink) ;
         parse(in, lang, baseIRI, dest) ;
     }
     
@@ -201,7 +198,7 @@ public class RiotReader
      */
     public static void parseQuads(String filename, Lang lang, String baseIRI, Sink<Quad> sink)
     {
-        SinkRDF dest = RDFParserOutputLib.sinkQuads(sink) ;
+        SinkRDF dest = SinkRDFLib.sinkQuads(sink) ;
         parse(filename, lang, baseIRI, dest) ;
     }
 
@@ -214,7 +211,7 @@ public class RiotReader
      */
     public static void parseQuads(InputStream in, Lang lang, String baseIRI, Sink<Quad> sink)
     {
-        SinkRDF dest = RDFParserOutputLib.sinkQuads(sink) ;
+        SinkRDF dest = SinkRDFLib.sinkQuads(sink) ;
         parse(in, lang, baseIRI, dest) ;
     }
 

Modified: jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/SinkQuadsToDataset.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/SinkQuadsToDataset.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/SinkQuadsToDataset.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/SinkQuadsToDataset.java Thu Dec 27 19:03:17 2012
@@ -31,7 +31,7 @@ public class SinkQuadsToDataset implemen
 {
     private final DatasetGraph dataset ;
 
-    public SinkQuadsToDataset(DatasetGraph dataset)
+    public SinkQuadsToDataset(boolean x , DatasetGraph dataset)
     {
         this.dataset = dataset ;
     }

Modified: jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/SinkTriplesToGraph.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/SinkTriplesToGraph.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/SinkTriplesToGraph.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/SinkTriplesToGraph.java Thu Dec 27 19:03:17 2012
@@ -42,7 +42,7 @@ public class SinkTriplesToGraph implemen
     private EventListener el1 ;
     private EventListener el2 ;
 
-    public SinkTriplesToGraph(Graph g)
+    public SinkTriplesToGraph(boolean x , Graph g)
     { 
         this.graph = g ;
         // Convert between the new global event system (EventManager)

Copied: jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/SinkRDFLib.java (from r1426285, jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/RDFParserOutputLib.java)
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/SinkRDFLib.java?p2=jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/SinkRDFLib.java&p1=jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/RDFParserOutputLib.java&r1=1426285&r2=1426294&rev=1426294&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/RDFParserOutputLib.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/SinkRDFLib.java Thu Dec 27 19:03:17 2012
@@ -16,11 +16,11 @@
  * limitations under the License.
  */
 
-package org.apache.jena.riot.lang;
+package org.apache.jena.riot.system;
 
 import org.apache.jena.atlas.lib.Sink ;
 import org.apache.jena.atlas.lib.Tuple ;
-import org.apache.jena.riot.system.SinkRDF ;
+import org.apache.jena.riot.lang.RDFParserOutputCounting ;
 
 import com.hp.hpl.jena.graph.Graph ;
 import com.hp.hpl.jena.graph.Node ;
@@ -29,7 +29,7 @@ import com.hp.hpl.jena.sparql.core.Datas
 import com.hp.hpl.jena.sparql.core.Quad ;
 
 /** Various Common RDFParserOutput set ups */
-public class RDFParserOutputLib
+public class SinkRDFLib
 {
     /** Send everything to nowhere ... efficiently */
     public static SinkRDF sinkNull()                       { return new ParserOutputSink() ; }
@@ -37,7 +37,6 @@ public class RDFParserOutputLib
     public static SinkRDF graph(Graph graph)               { return new ParserOutputGraph(graph) ; }
     
     public static SinkRDF dataset(DatasetGraph dataset)    { return new ParserOutputDataset(dataset) ; }
-
     
     /** 
      * Outpout to a sink; prefix and base handled only within the parser.

Modified: jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/SinkRDFWrapper.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/SinkRDFWrapper.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/SinkRDFWrapper.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/SinkRDFWrapper.java Thu Dec 27 19:03:17 2012
@@ -24,35 +24,37 @@ import com.hp.hpl.jena.graph.Node ;
 import com.hp.hpl.jena.graph.Triple ;
 import com.hp.hpl.jena.sparql.core.Quad ;
 
-/** The interface for the output of RDF, such as the RIOT parsers.
- *  The parser event model is that items are emitted for signficant events.
- *  The events are start/finish, emitting triples/quads/tuples as necessary, prefixes and base directives.
- *  Tuples are generalized triples or quads.  A triple language will call triple(),
- *  quad language quad() in preference.    
- * 
- * @see ParserProfile for the lower level machinary for creation of nodes triples and quads. 
- */
-public interface SinkRDFWrapper
+public class SinkRDFWrapper implements SinkRDF
 {
-    /** Start parsing */
-    public void start() ;
-    
-    /** Triple emitted */
-    public void triple(Triple triple) ;
-
-    /** Quad emitted */
-    public void quad(Quad quad) ;
-
-    /** Generalized emitted */
-    public void tuple(Tuple<Node> tuple) ;
-
-    /** base declaration seen */
-    public void base(String base) ;
-
-    /** prefix declaration seen */
-    public void prefix(String prefix, String iri) ;
-
-    /** Finish parsing */
-    public void finish() ;
+    protected final SinkRDF sink ;
 
+    public SinkRDFWrapper(SinkRDF sink) { this.sink = sink ; }
+    
+    @Override
+    public void start()
+    { sink.start() ; }
+
+    @Override
+    public void triple(Triple triple)
+    { sink.triple(triple) ; }
+
+    @Override
+    public void quad(Quad quad)
+    { sink.quad(quad) ; }
+
+    @Override
+    public void tuple(Tuple<Node> tuple)
+    { sink.tuple(tuple) ; }
+
+    @Override
+    public void base(String base)
+    { sink.base(base) ; }
+
+    @Override
+    public void prefix(String prefix, String iri)
+    { sink.prefix(prefix, iri) ; }
+
+    @Override
+    public void finish()
+    { sink.finish() ; }
 }

Modified: jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/web/HttpResponseLib.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/web/HttpResponseLib.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/web/HttpResponseLib.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/web/HttpResponseLib.java Thu Dec 27 19:03:17 2012
@@ -30,8 +30,8 @@ import org.apache.jena.atlas.web.MediaTy
 import org.apache.jena.riot.RiotReader ;
 import org.apache.jena.riot.WebContent ;
 import org.apache.jena.riot.lang.LangRIOT ;
-import org.apache.jena.riot.lang.RDFParserOutputLib ;
 import org.apache.jena.riot.system.SinkRDF ;
+import org.apache.jena.riot.system.SinkRDFLib ;
 
 import com.hp.hpl.jena.graph.Graph ;
 import com.hp.hpl.jena.query.ResultSet ;
@@ -57,7 +57,7 @@ public class HttpResponseLib
                 HttpEntity entity = response.getEntity() ;
                 MediaType mt = MediaType.create(response.getFirstHeader(HttpNames.hContentType).getValue()) ;
                 mt.getCharset() ;
-                SinkRDF dest = RDFParserOutputLib.graph(g) ; 
+                SinkRDF dest = SinkRDFLib.graph(g) ; 
                 InputStream in = entity.getContent() ;
                 LangRIOT parser = createParser(in, baseIRI, dest) ;
                 parser.parse() ;

Modified: jena/trunk/jena-arq/src/main/java/org/openjena/riot/RiotQuadParsePuller.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/openjena/riot/RiotQuadParsePuller.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/openjena/riot/RiotQuadParsePuller.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/openjena/riot/RiotQuadParsePuller.java Thu Dec 27 19:03:17 2012
@@ -24,8 +24,8 @@ import org.apache.jena.atlas.lib.Sink ;
 import org.apache.jena.riot.Lang ;
 import org.apache.jena.riot.RiotReader ;
 import org.apache.jena.riot.lang.LangRIOT ;
-import org.apache.jena.riot.lang.RDFParserOutputLib ;
 import org.apache.jena.riot.system.SinkRDF ;
+import org.apache.jena.riot.system.SinkRDFLib ;
 
 import com.hp.hpl.jena.sparql.core.Quad ;
 
@@ -44,7 +44,7 @@ public class RiotQuadParsePuller extends
     @Override
     protected LangRIOT createParser(Sink<Quad> sink)
     {
-        SinkRDF dest = RDFParserOutputLib.sinkQuads(sink) ;
+        SinkRDF dest = SinkRDFLib.sinkQuads(sink) ;
         return RiotReader.createParser(in, lang, baseIRI, dest) ;
     }
 }

Modified: jena/trunk/jena-arq/src/main/java/org/openjena/riot/RiotReader.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/openjena/riot/RiotReader.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/openjena/riot/RiotReader.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/openjena/riot/RiotReader.java Thu Dec 27 19:03:17 2012
@@ -33,10 +33,7 @@ import org.apache.jena.riot.Lang ;
 import org.apache.jena.riot.RDFDataMgr ;
 import org.apache.jena.riot.RDFLanguages ;
 import org.apache.jena.riot.lang.* ;
-import org.apache.jena.riot.system.ErrorHandlerFactory ;
-import org.apache.jena.riot.system.IRIResolver ;
-import org.apache.jena.riot.system.RiotLib ;
-import org.apache.jena.riot.system.SinkRDF ;
+import org.apache.jena.riot.system.* ;
 import org.apache.jena.riot.tokens.Tokenizer ;
 import org.apache.jena.riot.tokens.TokenizerFactory ;
 
@@ -72,7 +69,7 @@ public class RiotReader
      */
     public static void parseTriples(String filename, Lang lang, String baseIRI, Sink<Triple> sink)
     {
-        SinkRDF dest = RDFParserOutputLib.sinkTriples(sink) ;
+        SinkRDF dest = SinkRDFLib.sinkTriples(sink) ;
         parseTriples(filename, lang, baseIRI, dest) ;
     }
 
@@ -85,7 +82,7 @@ public class RiotReader
      */  
     public static void parseTriples(InputStream in, Lang lang, String baseIRI, Sink<Triple> sink)
     {
-        SinkRDF dest = RDFParserOutputLib.sinkTriples(sink) ;
+        SinkRDF dest = SinkRDFLib.sinkTriples(sink) ;
         parseTriples(in, lang, baseIRI, dest) ;
     }
     
@@ -108,7 +105,7 @@ public class RiotReader
      */
     public static void parseQuads(String filename, Lang lang, String baseIRI, Sink<Quad> sink)
     {
-        SinkRDF dest = RDFParserOutputLib.sinkQuads(sink) ;
+        SinkRDF dest = SinkRDFLib.sinkQuads(sink) ;
         parseQuads(filename, lang, baseIRI, dest) ;
     }
 
@@ -121,7 +118,7 @@ public class RiotReader
      */
     public static void parseQuads(InputStream in, Lang lang, String baseIRI, Sink<Quad> sink)
     {
-        SinkRDF dest = RDFParserOutputLib.sinkQuads(sink) ;
+        SinkRDF dest = SinkRDFLib.sinkQuads(sink) ;
         parseQuads(in, lang, baseIRI, dest) ;
     }
 
@@ -234,7 +231,7 @@ public class RiotReader
             return createParserTriG(tokenizer, baseIRI, dest) ;
 
         // try to do via triples to quads extension. 
-        dest = RDFParserOutputLib.extendTriplesToQuads(dest) ;
+        dest = SinkRDFLib.extendTriplesToQuads(dest) ;
         return createParserTriples(tokenizer, lang, baseIRI, dest) ;
     }
     

Modified: jena/trunk/jena-arq/src/main/java/org/openjena/riot/RiotTripleParsePuller.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/openjena/riot/RiotTripleParsePuller.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/openjena/riot/RiotTripleParsePuller.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/openjena/riot/RiotTripleParsePuller.java Thu Dec 27 19:03:17 2012
@@ -24,8 +24,8 @@ import org.apache.jena.atlas.lib.Sink ;
 import org.apache.jena.riot.Lang ;
 import org.apache.jena.riot.RiotReader ;
 import org.apache.jena.riot.lang.LangRIOT ;
-import org.apache.jena.riot.lang.RDFParserOutputLib ;
 import org.apache.jena.riot.system.SinkRDF ;
+import org.apache.jena.riot.system.SinkRDFLib ;
 
 import com.hp.hpl.jena.graph.Triple ;
 
@@ -44,7 +44,7 @@ public class RiotTripleParsePuller exten
     @Override
     protected LangRIOT createParser(Sink<Triple> sink)
     {
-        SinkRDF dest = RDFParserOutputLib.sinkTriples(sink) ;
+        SinkRDF dest = SinkRDFLib.sinkTriples(sink) ;
         return RiotReader.createParser(in, lang, baseIRI, dest) ;
     }
 }

Modified: jena/trunk/jena-arq/src/main/java/riotcmd/CmdLangParse.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/riotcmd/CmdLangParse.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/riotcmd/CmdLangParse.java (original)
+++ jena/trunk/jena-arq/src/main/java/riotcmd/CmdLangParse.java Thu Dec 27 19:03:17 2012
@@ -34,7 +34,6 @@ import org.apache.jena.atlas.lib.StrUtil
 import org.apache.jena.riot.* ;
 import org.apache.jena.riot.lang.LabelToNode ;
 import org.apache.jena.riot.lang.LangRIOT ;
-import org.apache.jena.riot.lang.RDFParserOutputLib ;
 import org.apache.jena.riot.out.NodeToLabel ;
 import org.apache.jena.riot.out.SinkQuadOutput ;
 import org.apache.jena.riot.out.SinkTripleOutput ;
@@ -291,7 +290,7 @@ public abstract class CmdLangParse exten
                 s = InfFactory.infTriples(s, setup) ;
             
             SinkCounting<Triple> sink2 = new SinkCounting<Triple>(s) ;
-            SinkRDF dest = RDFParserOutputLib.sinkTriples(sink2) ;
+            SinkRDF dest = SinkRDFLib.sinkTriples(sink2) ;
             parser = RiotReader.createParser(in, lang, baseURI, dest) ;
             
             sink = sink2 ;
@@ -305,7 +304,7 @@ public abstract class CmdLangParse exten
                 s = InfFactory.infQuads(s, setup) ;
             
             SinkCounting<Quad> sink2 = new SinkCounting<Quad>(s) ;
-            SinkRDF dest = RDFParserOutputLib.sinkQuads(sink2) ;
+            SinkRDF dest = SinkRDFLib.sinkQuads(sink2) ;
             parser = RiotReader.createParser(in, lang, baseURI, dest) ;
             sink = sink2 ;
         }

Modified: jena/trunk/jena-arq/src/main/java/riotcmd/infer.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/riotcmd/infer.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/riotcmd/infer.java (original)
+++ jena/trunk/jena-arq/src/main/java/riotcmd/infer.java Thu Dec 27 19:03:17 2012
@@ -28,10 +28,10 @@ import org.apache.jena.riot.Lang ;
 import org.apache.jena.riot.RDFLanguages ;
 import org.apache.jena.riot.RiotReader ;
 import org.apache.jena.riot.lang.LangRIOT ;
-import org.apache.jena.riot.lang.RDFParserOutputLib ;
 import org.apache.jena.riot.out.SinkQuadOutput ;
 import org.apache.jena.riot.process.inf.InfFactory ;
 import org.apache.jena.riot.system.SinkRDF ;
+import org.apache.jena.riot.system.SinkRDFLib ;
 import arq.cmd.CmdException ;
 import arq.cmdline.ArgDecl ;
 import arq.cmdline.CmdGeneral ;
@@ -146,12 +146,12 @@ public class infer extends CmdGeneral
     {
         Lang lang = filename.equals("-") ? RDFLanguages.NQuads : RDFLanguages.filenameToLang(filename, RDFLanguages.NQuads) ;
         String baseURI = IRILib.filenameToIRI(filename) ;
-        SinkRDF sink = RDFParserOutputLib.sinkQuads(qsink) ;
+        SinkRDF sink = SinkRDFLib.sinkQuads(qsink) ;
         
         if ( RDFLanguages.isTriples(lang) )
         {
             InputStream in = IO.openFile(filename) ;
-            sink = RDFParserOutputLib.extendTriplesToQuads(sink) ;
+            sink = SinkRDFLib.extendTriplesToQuads(sink) ;
             LangRIOT parser = RiotReader.createParser(in, lang, baseURI, sink) ;
             parser.parse() ;
             return ;

Modified: jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNQuads.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNQuads.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNQuads.java (original)
+++ jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNQuads.java Thu Dec 27 19:03:17 2012
@@ -22,8 +22,8 @@ import org.apache.jena.riot.RiotReader ;
 import org.apache.jena.riot.ErrorHandlerTestLib.ExFatal ;
 import org.apache.jena.riot.lang.LangRIOT ;
 import org.apache.jena.riot.lang.RDFParserOutputCounting ;
-import org.apache.jena.riot.lang.RDFParserOutputLib ;
 import org.apache.jena.riot.system.SinkRDF ;
+import org.apache.jena.riot.system.SinkRDFLib ;
 import org.apache.jena.riot.tokens.Tokenizer ;
 import org.junit.Test ;
 
@@ -75,7 +75,7 @@ public class TestLangNQuads extends Test
     @Override
     protected long parseCount(String... strings)
     {
-        RDFParserOutputCounting sink = RDFParserOutputLib.count() ;
+        RDFParserOutputCounting sink = SinkRDFLib.count() ;
         parse(sink, strings) ;
         return sink.count() ;
     }
@@ -83,7 +83,7 @@ public class TestLangNQuads extends Test
     private DatasetGraph parseToDataset(String string)
     {
         DatasetGraph dsg = DatasetLib.createDatasetGraphMem() ;
-        SinkRDF dest = RDFParserOutputLib.dataset(dsg) ;
+        SinkRDF dest = SinkRDFLib.dataset(dsg) ;
         parse(dest, string) ;
         return dsg ;
     }

Modified: jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNTriples.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNTriples.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNTriples.java (original)
+++ jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNTriples.java Thu Dec 27 19:03:17 2012
@@ -28,6 +28,7 @@ import org.apache.jena.riot.RiotReader ;
 import org.apache.jena.riot.ErrorHandlerTestLib.ErrorHandlerEx ;
 import org.apache.jena.riot.ErrorHandlerTestLib.ExFatal ;
 import org.apache.jena.riot.system.SinkRDF ;
+import org.apache.jena.riot.system.SinkRDFLib ;
 import org.apache.jena.riot.tokens.Tokenizer ;
 import org.junit.Test ;
 
@@ -94,7 +95,7 @@ public class TestLangNTriples extends Te
     {
         String string = StrUtils.strjoin("\n", strings) ;
         Tokenizer tokenizer = tokenizer(string) ;
-        RDFParserOutputCounting sink = RDFParserOutputLib.count() ;
+        RDFParserOutputCounting sink = SinkRDFLib.count() ;
         LangNTriples x = RiotReader.createParserNTriples(tokenizer, sink) ;
         x.getProfile().setHandler(new ErrorHandlerEx()) ;
         x.parse() ;

Modified: jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNTuples.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNTuples.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNTuples.java (original)
+++ jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNTuples.java Thu Dec 27 19:03:17 2012
@@ -30,9 +30,9 @@ import org.apache.jena.riot.ErrorHandler
 import org.apache.jena.riot.ErrorHandlerTestLib.ExWarning ;
 import org.apache.jena.riot.lang.LangRIOT ;
 import org.apache.jena.riot.lang.RDFParserOutputCounting ;
-import org.apache.jena.riot.lang.RDFParserOutputLib ;
 import org.apache.jena.riot.system.RiotLib ;
 import org.apache.jena.riot.system.SinkRDF ;
+import org.apache.jena.riot.system.SinkRDFLib ;
 import org.apache.jena.riot.tokens.Tokenizer ;
 import org.apache.jena.riot.tokens.TokenizerFactory ;
 import org.junit.Test ;
@@ -182,7 +182,7 @@ abstract public class TestLangNTuples ex
     {
         String string = StrUtils.strjoin("\n", strings) ;
         Tokenizer tokenizer = tokenizer(string) ;
-        RDFParserOutputCounting sink = RDFParserOutputLib.count() ;
+        RDFParserOutputCounting sink = SinkRDFLib.count() ;
         LangRIOT x = RiotReader.createParserNQuads(tokenizer, sink) ;
         x.setProfile(RiotLib.profile(null, false, true, new ErrorHandlerEx())) ;
         x.parse() ;

Modified: jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangRdfJson.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangRdfJson.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangRdfJson.java (original)
+++ jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangRdfJson.java Thu Dec 27 19:03:17 2012
@@ -30,7 +30,7 @@ import org.apache.jena.riot.ErrorHandler
 import org.apache.jena.riot.ErrorHandlerTestLib.ExFatal ;
 import org.apache.jena.riot.lang.LangRDFJSON ;
 import org.apache.jena.riot.lang.RDFParserOutputCounting ;
-import org.apache.jena.riot.lang.RDFParserOutputLib ;
+import org.apache.jena.riot.system.SinkRDFLib ;
 import org.apache.jena.riot.tokens.Tokenizer ;
 import org.apache.jena.riot.tokens.TokenizerFactory ;
 import org.junit.AfterClass ;
@@ -501,14 +501,14 @@ public class TestLangRdfJson extends Bas
 		byte b[] = StrUtils.asUTF8bytes("") ;
 		ByteArrayInputStream in = new ByteArrayInputStream(b);
 		Tokenizer tokenizer = TokenizerFactory.makeTokenizerUTF8(in) ;
-        RDFParserOutputCounting sink = RDFParserOutputLib.count() ;
+        RDFParserOutputCounting sink = SinkRDFLib.count() ;
 		LangRDFJSON parser = RiotReader.createParserRdfJson(tokenizer, sink) ;
 	}
 
     private long parseCount(String string)
     {
         Tokenizer tokenizer = tokenizer(string) ;
-        RDFParserOutputCounting sink = RDFParserOutputLib.count() ;
+        RDFParserOutputCounting sink = SinkRDFLib.count() ;
         LangRDFJSON x = RiotReader.createParserRdfJson(tokenizer, sink) ;
         x.getProfile().setHandler(new ErrorHandlerEx()) ;
         x.parse() ;

Modified: jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangTrig.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangTrig.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangTrig.java (original)
+++ jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangTrig.java Thu Dec 27 19:03:17 2012
@@ -24,8 +24,8 @@ import org.apache.jena.riot.RiotReader ;
 import org.apache.jena.riot.ErrorHandlerTestLib.ErrorHandlerEx ;
 import org.apache.jena.riot.ErrorHandlerTestLib.ExWarning ;
 import org.apache.jena.riot.lang.LangTriG ;
-import org.apache.jena.riot.lang.RDFParserOutputLib ;
 import org.apache.jena.riot.system.SinkRDF ;
+import org.apache.jena.riot.system.SinkRDFLib ;
 import org.apache.jena.riot.tokens.Tokenizer ;
 import org.apache.jena.riot.tokens.TokenizerFactory ;
 import org.junit.Test ;
@@ -88,7 +88,7 @@ public class TestLangTrig extends BaseTe
     {
         String string = StrUtils.strjoin("\n", strings) ;
         DatasetGraph dsg = DatasetLib.createDatasetGraphMem() ;
-        SinkRDF sink = RDFParserOutputLib.dataset(dsg) ;
+        SinkRDF sink = SinkRDFLib.dataset(dsg) ;
         Tokenizer tokenizer = TokenizerFactory.makeTokenizerString(string) ;
         LangTriG parser = RiotReader.createParserTriG(tokenizer, "http://base/", sink) ;
         parser.getProfile().setHandler(new ErrorHandlerEx()) ;

Modified: jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangTurtle.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangTurtle.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangTurtle.java (original)
+++ jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangTurtle.java Thu Dec 27 19:03:17 2012
@@ -33,6 +33,7 @@ import org.apache.jena.riot.ErrorHandler
 import org.apache.jena.riot.* ;
 import org.apache.jena.riot.system.ErrorHandler ;
 import org.apache.jena.riot.system.SinkRDF ;
+import org.apache.jena.riot.system.SinkRDFLib ;
 import org.apache.jena.riot.tokens.Tokenizer ;
 import org.apache.jena.riot.tokens.TokenizerFactory ;
 import org.junit.AfterClass ;
@@ -107,7 +108,7 @@ public class TestLangTurtle extends Base
         Tokenizer tokenizer = TokenizerFactory.makeTokenizer(reader) ;
         
         Graph graph = GraphFactory.createDefaultGraph() ;
-        SinkRDF sink = RDFParserOutputLib.graph(graph) ;
+        SinkRDF sink = SinkRDFLib.graph(graph) ;
         LangTurtle parser = RiotReader.createParserTurtle(tokenizer, "http://base/", sink) ;
         parser.getProfile().setHandler(new ErrorHandlerEx()) ;
         parser.parse() ; 

Modified: jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestTurtleTerms.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestTurtleTerms.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestTurtleTerms.java (original)
+++ jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestTurtleTerms.java Thu Dec 27 19:03:17 2012
@@ -21,9 +21,9 @@ package org.apache.jena.riot.lang;
 import org.apache.jena.atlas.junit.BaseTest ;
 import org.apache.jena.riot.RiotReader ;
 import org.apache.jena.riot.lang.LangTurtle ;
-import org.apache.jena.riot.lang.RDFParserOutputLib ;
 import org.apache.jena.riot.system.PrefixMap ;
 import org.apache.jena.riot.system.SinkRDF ;
+import org.apache.jena.riot.system.SinkRDFLib ;
 import org.apache.jena.riot.tokens.Tokenizer ;
 import org.apache.jena.riot.tokens.TokenizerFactory ;
 import org.junit.Test ;
@@ -244,7 +244,7 @@ public class TestTurtleTerms extends Bas
 	    // Need to access the prefix mapping.
 	    
 	    Tokenizer tokenizer = TokenizerFactory.makeTokenizerString(testString) ;
-	    SinkRDF sink = RDFParserOutputLib.sinkNull() ;
+	    SinkRDF sink = SinkRDFLib.sinkNull() ;
 	    LangTurtle parser = RiotReader.createParserTurtle(tokenizer, "http://base/", sink) ;
 	    PrefixMap prefixMap = parser.getProfile().getPrologue().getPrefixMap() ;
 

Modified: jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/out/TestOutputRDFJSON.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/out/TestOutputRDFJSON.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/out/TestOutputRDFJSON.java (original)
+++ jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/out/TestOutputRDFJSON.java Thu Dec 27 19:03:17 2012
@@ -27,9 +27,9 @@ import org.apache.jena.atlas.junit.BaseT
 import org.apache.jena.atlas.lib.StrUtils ;
 import org.apache.jena.riot.RiotReader ;
 import org.apache.jena.riot.lang.LangRIOT ;
-import org.apache.jena.riot.lang.RDFParserOutputLib ;
 import org.apache.jena.riot.out.RDFJSONWriter ;
 import org.apache.jena.riot.system.SinkRDF ;
+import org.apache.jena.riot.system.SinkRDFLib ;
 import org.junit.Test ;
 
 import com.hp.hpl.jena.graph.Graph ;
@@ -170,7 +170,7 @@ public class TestOutputRDFJSON extends B
     {
         ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()) ;
         Graph graph = GraphFactory.createGraphMem() ;
-        SinkRDF dest = RDFParserOutputLib.graph(graph) ; 
+        SinkRDF dest = SinkRDFLib.graph(graph) ; 
         LangRIOT parser = RiotReader.createParserRdfJson(bin, dest) ;
         parser.parse() ;
         return graph ;

Modified: jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/http/DatasetGraphAccessorHTTP.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/http/DatasetGraphAccessorHTTP.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/http/DatasetGraphAccessorHTTP.java (original)
+++ jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/http/DatasetGraphAccessorHTTP.java Thu Dec 27 19:03:17 2012
@@ -45,8 +45,8 @@ import org.apache.jena.riot.Lang ;
 import org.apache.jena.riot.RiotReader ;
 import org.apache.jena.riot.WebContent ;
 import org.apache.jena.riot.lang.LangRIOT ;
-import org.apache.jena.riot.lang.RDFParserOutput ;
-import org.apache.jena.riot.lang.RDFParserOutputLib ;
+import org.apache.jena.riot.system.SinkRDF ;
+import org.apache.jena.riot.system.SinkRDFLib ;
 
 import com.hp.hpl.jena.graph.Graph ;
 import com.hp.hpl.jena.graph.Node ;
@@ -295,7 +295,7 @@ public class DatasetGraphAccessorHTTP im
         Lang lang = FusekiLib.langFromContentType(ts.getContentType()) ;
         if ( lang == null )
             throw new FusekiException("Unknown lang for "+ts.getMediaType()) ;
-        RDFParserOutput dest = RDFParserOutputLib.graph(graph) ;
+        SinkRDF dest = SinkRDFLib.graph(graph) ;
         LangRIOT parser = RiotReader.createParser(ts, lang, base, dest) ;
         parser.parse() ;
         IO.close(ts) ;

Modified: jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/GraphLoadUtils.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/GraphLoadUtils.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/GraphLoadUtils.java (original)
+++ jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/GraphLoadUtils.java Thu Dec 27 19:03:17 2012
@@ -21,20 +21,15 @@ package org.apache.jena.fuseki.migrate;
 
 import java.io.InputStream ;
 
-import org.apache.jena.atlas.lib.Sink ;
 import org.apache.jena.fuseki.Fuseki ;
 import org.apache.jena.riot.Lang ;
+import org.apache.jena.riot.RDFDataMgr ;
 import org.apache.jena.riot.RDFLanguages ;
-import org.apache.jena.riot.RiotException ;
-import org.apache.jena.riot.RiotReader ;
-import org.apache.jena.riot.lang.LangRIOT ;
-import org.apache.jena.riot.lang.RDFParserOutput ;
-import org.apache.jena.riot.lang.RDFParserOutputLib ;
-import org.apache.jena.riot.lang.SinkTriplesToGraph ;
+import org.apache.jena.riot.system.SinkRDF ;
+import org.apache.jena.riot.system.SinkRDFLib ;
 
 import com.hp.hpl.jena.graph.Factory ;
 import com.hp.hpl.jena.graph.Graph ;
-import com.hp.hpl.jena.graph.Triple ;
 import com.hp.hpl.jena.rdf.model.Model ;
 import com.hp.hpl.jena.rdf.model.ModelFactory ;
 
@@ -75,17 +70,10 @@ public class GraphLoadUtils
     private static void readUtil(Graph graph, String uri, int limit)
     {
         Lang lang = RDFLanguages.filenameToLang(uri, RDFLanguages.RDFXML) ;
-        
-        Sink<Triple> sink = new SinkTriplesToGraph(graph) ;
-        sink = new SinkLimited<Triple>(sink, limit) ;
-        
-        // TODO Conneg - awaiting RIOT code upgrade.
+        SinkRDF sink = SinkRDFLib.graph(graph) ;
+        sink = new SinkRDFLimited(sink, limit) ;
+
         InputStream input = Fuseki.webFileManager.open(uri) ;
-        
-        RDFParserOutput dest = RDFParserOutputLib.sinkTriples(sink) ;
-        LangRIOT parser = RiotReader.createParser(input, lang, uri, dest) ;
-        try {
-            parser.parse() ;
-        } catch (RiotException ex) { throw ex ; }
+        RDFDataMgr.read(sink, input, uri, lang, null) ;
     }
 }

Copied: jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/SinkRDFLimited.java (from r1425327, jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/SinkLimited.java)
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/SinkRDFLimited.java?p2=jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/SinkRDFLimited.java&p1=jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/SinkLimited.java&r1=1425327&r2=1426294&rev=1426294&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/SinkLimited.java (original)
+++ jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/migrate/SinkRDFLimited.java Thu Dec 27 19:03:17 2012
@@ -18,29 +18,46 @@
 
 package org.apache.jena.fuseki.migrate;
 
-import org.apache.jena.atlas.lib.Sink ;
-import org.apache.jena.atlas.lib.SinkWrapper ;
-import org.apache.jena.riot.RiotException ;
+import org.apache.jena.atlas.lib.Tuple ;
+import org.apache.jena.riot.system.SinkRDF ;
+import org.apache.jena.riot.system.SinkRDFWrapper ;
 
-public class SinkLimited<T> extends SinkWrapper<T>
+import com.hp.hpl.jena.graph.Node ;
+import com.hp.hpl.jena.graph.Triple ;
+import com.hp.hpl.jena.sparql.core.Quad ;
+
+public class SinkRDFLimited extends SinkRDFWrapper
 {
    private long count = 0 ;
    private final long limit ;
     
-    public SinkLimited(Sink<T> output, long limit)
+    public SinkRDFLimited(SinkRDF output, long limit)
     {
         super(output) ;
         this.limit = limit ;
     }
 
     @Override
-    public void send(T thing)
-    {
+    public void triple(Triple triple)
+    { 
+        count++ ;
+        super.triple(triple) ;
+    }
+
+    @Override
+    public void quad(Quad quad)
+    { 
         count++ ;
-        if ( count > limit )
-            throw new RiotException("Limit "+limit+" exceeded") ; 
-        super.send(thing) ;
+        super.quad(quad) ;
     }
+
+    @Override
+    public void tuple(Tuple<Node> tuple)
+    { 
+        count++ ;
+        super.tuple(tuple) ;
+    }
+
     
     public long getCount() { return count ; } 
     public long getLimit() { return limit ; }

Modified: jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/REST_Quads.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/REST_Quads.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/REST_Quads.java (original)
+++ jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/REST_Quads.java Thu Dec 27 19:03:17 2012
@@ -35,8 +35,8 @@ import org.apache.jena.riot.RDFLanguages
 import org.apache.jena.riot.RiotReader ;
 import org.apache.jena.riot.RiotWriter ;
 import org.apache.jena.riot.lang.LangRIOT ;
-import org.apache.jena.riot.lang.RDFParserOutput ;
-import org.apache.jena.riot.lang.RDFParserOutputLib ;
+import org.apache.jena.riot.system.SinkRDF ;
+import org.apache.jena.riot.system.SinkRDFLib ;
 
 import com.hp.hpl.jena.graph.Graph ;
 import com.hp.hpl.jena.graph.Node ;
@@ -141,7 +141,7 @@ public class REST_Quads extends SPARQL_R
             name = name+(++counter) ;
             Node gn = Node.createURI(name) ;
             Graph g = dsg.getGraph(gn) ;
-            RDFParserOutput dest = RDFParserOutputLib.graph(g) ;
+            SinkRDF dest = SinkRDFLib.graph(g) ;
             LangRIOT parser = RiotReader.createParser(action.request.getInputStream(), lang, name , dest) ;
             parser.parse() ;
             log.info(format("[%d] Location: %s", action.id, name)) ;

Modified: jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST.java (original)
+++ jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_REST.java Thu Dec 27 19:03:17 2012
@@ -48,11 +48,7 @@ import org.apache.jena.riot.RiotExceptio
 import org.apache.jena.riot.RiotReader ;
 import org.apache.jena.riot.WebContent ;
 import org.apache.jena.riot.lang.LangRIOT ;
-import org.apache.jena.riot.lang.RDFParserOutput ;
-import org.apache.jena.riot.lang.RDFParserOutputLib ;
-import org.apache.jena.riot.system.ErrorHandler ;
-import org.apache.jena.riot.system.ErrorHandlerFactory ;
-import org.apache.jena.riot.system.IRIResolver ;
+import org.apache.jena.riot.system.* ;
 import org.slf4j.Logger ;
 import org.slf4j.LoggerFactory ;
 
@@ -363,7 +359,7 @@ public abstract class SPARQL_REST extend
     {
         Graph graphTmp = GraphFactory.createGraphMem() ;
         
-        RDFParserOutput dest = RDFParserOutputLib.graph(graphTmp) ;
+        SinkRDF dest = SinkRDFLib.graph(graphTmp) ;
         LangRIOT parser = RiotReader.createParser(input, lang, base, dest) ;
         parser.getProfile().setHandler(errorHandler) ;
         try { parser.parse() ; } 

Modified: jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Upload.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Upload.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Upload.java (original)
+++ jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Upload.java Thu Dec 27 19:03:17 2012
@@ -42,11 +42,7 @@ import org.apache.jena.riot.RDFLanguages
 import org.apache.jena.riot.RiotException ;
 import org.apache.jena.riot.RiotReader ;
 import org.apache.jena.riot.lang.LangRIOT ;
-import org.apache.jena.riot.lang.RDFParserOutput ;
-import org.apache.jena.riot.lang.RDFParserOutputLib ;
-import org.apache.jena.riot.system.ErrorHandler ;
-import org.apache.jena.riot.system.ErrorHandlerFactory ;
-import org.apache.jena.riot.system.IRIResolver ;
+import org.apache.jena.riot.system.* ;
 
 import com.hp.hpl.jena.graph.Graph ;
 import com.hp.hpl.jena.graph.GraphUtil ;
@@ -208,7 +204,7 @@ public class SPARQL_Upload extends SPARQ
 
                     // We read into a in-memory graph, then (if successful) update the dataset.
                     // This isolates errors.
-                    RDFParserOutput dest = RDFParserOutputLib.graph(graphDst) ;
+                    SinkRDF dest = SinkRDFLib.graph(graphDst) ;
                     LangRIOT parser = RiotReader.createParser(stream, lang, base, dest) ;
                     parser.getProfile().setHandler(errorHandler) ;
                     log.info(format("[%d] Upload: Filename: %s, Content-Type=%s, Charset=%s => %s", 

Modified: jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/DataValidator.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/DataValidator.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/DataValidator.java (original)
+++ jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/DataValidator.java Thu Dec 27 19:03:17 2012
@@ -37,10 +37,10 @@ import org.apache.jena.riot.RDFLanguages
 import org.apache.jena.riot.RiotException ;
 import org.apache.jena.riot.RiotReader ;
 import org.apache.jena.riot.lang.LangRIOT ;
-import org.apache.jena.riot.lang.RDFParserOutput ;
-import org.apache.jena.riot.lang.RDFParserOutputLib ;
 import org.apache.jena.riot.system.ErrorHandler ;
 import org.apache.jena.riot.system.RiotLib ;
+import org.apache.jena.riot.system.SinkRDF ;
+import org.apache.jena.riot.system.SinkRDFLib ;
 import org.apache.jena.riot.tokens.Tokenizer ;
 import org.apache.jena.riot.tokens.TokenizerFactory ;
 
@@ -166,7 +166,7 @@ public class DataValidator extends Valid
             String formatNode(Node n) { return FmtUtils.stringForNode(n, sCxt) ; }
         } ;
 
-        RDFParserOutput dest = RDFParserOutputLib.sinkQuads(sink) ;
+        SinkRDF dest = SinkRDFLib.sinkQuads(sink) ;
         LangRIOT parser = RiotReader.createParser(tokenizer, language, null, dest) ;
         // Don't resolve IRIs.  Do checking.
         parser.setProfile(RiotLib.profile(null, false, true, errorHandler)) ;

Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader/BulkLoader.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader/BulkLoader.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader/BulkLoader.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader/BulkLoader.java Thu Dec 27 19:03:17 2012
@@ -25,7 +25,6 @@ import org.apache.jena.atlas.event.Event
 import org.apache.jena.atlas.lib.Tuple ;
 import org.apache.jena.riot.RDFLanguages ;
 import org.apache.jena.riot.RiotReader ;
-import org.apache.jena.riot.lang.RDFParserOutput ;
 import org.slf4j.Logger ;
 
 import com.hp.hpl.jena.graph.Node ;
@@ -84,18 +83,18 @@ public class BulkLoader
     /** Load into default graph */
     public static void loadDefaultGraph(DatasetGraphTDB dsg, List<String> urls, boolean showProgress)
     {
-        Destination dest = destinationDefaultGraph(dsg, showProgress) ;
+        BulkSinkRDF dest = destinationDefaultGraph(dsg, showProgress) ;
         loadTriples$(dest, urls) ;
     }
 
     /** Load into default graph */
     public static void loadDefaultGraph(DatasetGraphTDB dsg, InputStream input, boolean showProgress)
     {
-        Destination dest = destinationDefaultGraph(dsg, showProgress) ;
+        BulkSinkRDF dest = destinationDefaultGraph(dsg, showProgress) ;
         loadTriples$(dest, input) ;
     }
 
-    private static Destination destinationDefaultGraph(DatasetGraphTDB dsg, boolean showProgress)
+    private static BulkSinkRDF destinationDefaultGraph(DatasetGraphTDB dsg, boolean showProgress)
     {
         NodeTupleTable ntt = dsg.getTripleTable().getNodeTupleTable() ;
         return destinationGraph(dsg, ntt, showProgress) ;
@@ -104,34 +103,34 @@ public class BulkLoader
     /** Load into named graph */
     public static void loadNamedGraph(DatasetGraphTDB dsg, Node graphNode, List<String> urls, boolean showProgress)
     {
-        Destination dest = destinationNamedGraph(dsg, graphNode, showProgress) ;
+        BulkSinkRDF dest = destinationNamedGraph(dsg, graphNode, showProgress) ;
         loadTriples$(dest, urls) ;
     }
     
     /** Load into named graph */
     public static void loadNamedGraph(DatasetGraphTDB dsg, Node graphNode, InputStream input, boolean showProgress)
     {
-        Destination dest = destinationNamedGraph(dsg, graphNode, showProgress) ;
+        BulkSinkRDF dest = destinationNamedGraph(dsg, graphNode, showProgress) ;
         loadTriples$(dest, input) ;
     }
 
     /** Load into a dataset */
     public static void loadDataset(DatasetGraphTDB dsg, List<String> urls, boolean showProgress)
     {
-        Destination dest = destinationDataset(dsg, showProgress) ;
+        BulkSinkRDF dest = destinationDataset(dsg, showProgress) ;
         loadQuads$(dest, urls) ;
     }
     
     /** Load into a dataset */
     public static void loadDataset(DatasetGraphTDB dsg, InputStream input, boolean showProgress)
     {
-        Destination dest = destinationDataset(dsg, showProgress) ;
+        BulkSinkRDF dest = destinationDataset(dsg, showProgress) ;
         loadQuads$(dest, input) ;
     }
     
 
     /** Load into a graph */
-    private static void loadTriples$(Destination dest, List<String> urls)
+    private static void loadTriples$(BulkSinkRDF dest, List<String> urls)
     {
         dest.startBulk() ;
         for ( String url : urls )
@@ -143,7 +142,7 @@ public class BulkLoader
     }
 
     /** Load into a graph */
-    private static void loadTriples$(Destination dest, InputStream input)
+    private static void loadTriples$(BulkSinkRDF dest, InputStream input)
     {
         loadLogger.info("Load: from input stream -- "+Utils.nowAsString()) ;
         dest.startBulk() ;
@@ -152,7 +151,7 @@ public class BulkLoader
     }
     
     /** Load quads into a dataset */
-    private static void loadQuads$(Destination dest, List<String> urls)
+    private static void loadQuads$(BulkSinkRDF dest, List<String> urls)
     {
         dest.startBulk() ;
         for ( String url : urls )
@@ -164,7 +163,7 @@ public class BulkLoader
     }
 
     /** Load quads into a dataset */
-    private static void loadQuads$(Destination dest, InputStream input)
+    private static void loadQuads$(BulkSinkRDF dest, InputStream input)
     {
         loadLogger.info("Load: from input stream -- "+Utils.nowAsString()) ;
         dest.startBulk() ;
@@ -172,7 +171,7 @@ public class BulkLoader
         dest.finishBulk() ;
     }
     
-    private static Destination destinationNamedGraph(DatasetGraphTDB dsg, Node graphName, boolean showProgress)
+    private static BulkSinkRDF destinationNamedGraph(DatasetGraphTDB dsg, Node graphName, boolean showProgress)
     {
         if ( graphName == null )
             return destinationDefaultGraph(dsg,showProgress) ;
@@ -190,24 +189,18 @@ public class BulkLoader
             return new LoadMonitor(dsg, null, itemName, DataTickPoint, IndexTickPoint) ; 
     }
 
-    interface Destination extends RDFParserOutput
-    {
-        public void startBulk() ;
-        public void finishBulk() ;
-    }
-
-    private static Destination destinationDataset(DatasetGraphTDB dsg, boolean showProgress)
+    private static BulkSinkRDF destinationDataset(DatasetGraphTDB dsg, boolean showProgress)
     {
         return new DestinationDSG(dsg, showProgress) ;
     }
     
-    private static Destination destinationGraph(DatasetGraphTDB dsg, NodeTupleTable nodeTupleTable, boolean showProgress)
+    private static BulkSinkRDF destinationGraph(DatasetGraphTDB dsg, NodeTupleTable nodeTupleTable, boolean showProgress)
     {
         return new DestinationGraph(dsg, nodeTupleTable, showProgress) ;
     }
 
     // Load triples and quads into a dataset.
-    private static final class DestinationDSG implements Destination
+    private static final class DestinationDSG implements BulkSinkRDF
     {
         final private DatasetGraphTDB dsg ; 
         final private boolean startedEmpty ;
@@ -309,7 +302,7 @@ public class BulkLoader
     }
 
     // Load triples into a specific NodeTupleTable
-    private static final class DestinationGraph implements Destination
+    private static final class DestinationGraph implements BulkSinkRDF
     {
         final private DatasetGraphTDB dsg ;
         final private LoadMonitor monitor ;

Added: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader/BulkSinkRDF.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader/BulkSinkRDF.java?rev=1426294&view=auto
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader/BulkSinkRDF.java (added)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader/BulkSinkRDF.java Thu Dec 27 19:03:17 2012
@@ -0,0 +1,27 @@
+/**
+ * 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 com.hp.hpl.jena.tdb.store.bulkloader;
+
+import org.apache.jena.riot.system.SinkRDF ;
+
+public interface BulkSinkRDF extends SinkRDF
+{
+    public void startBulk() ;
+    public void finishBulk() ;
+}

Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader2/CmdNodeTableBuilder.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader2/CmdNodeTableBuilder.java?rev=1426294&r1=1426293&r2=1426294&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader2/CmdNodeTableBuilder.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader2/CmdNodeTableBuilder.java Thu Dec 27 19:03:17 2012
@@ -22,7 +22,6 @@ import static com.hp.hpl.jena.sparql.uti
 
 import java.io.FileNotFoundException ;
 import java.io.FileOutputStream ;
-import java.io.InputStream ;
 import java.io.OutputStream ;
 import java.util.Arrays ;
 import java.util.List ;
@@ -31,12 +30,11 @@ import org.apache.jena.atlas.AtlasExcept
 import org.apache.jena.atlas.io.IO ;
 import org.apache.jena.atlas.lib.FileOps ;
 import org.apache.jena.atlas.lib.Lib ;
-import org.apache.jena.atlas.lib.Sink ;
+import org.apache.jena.atlas.lib.Tuple ;
 import org.apache.jena.atlas.logging.Log ;
 import org.apache.jena.riot.Lang ;
 import org.apache.jena.riot.RDFLanguages ;
 import org.apache.jena.riot.RiotReader ;
-import org.apache.jena.riot.system.SinkExtendTriplesToQuads ;
 import org.slf4j.Logger ;
 import tdb.cmdline.CmdTDB ;
 import arq.cmd.CmdException ;
@@ -48,6 +46,7 @@ import com.hp.hpl.jena.graph.Triple ;
 import com.hp.hpl.jena.sparql.core.Quad ;
 import com.hp.hpl.jena.sparql.util.Utils ;
 import com.hp.hpl.jena.tdb.TDB ;
+import com.hp.hpl.jena.tdb.TDBException ;
 import com.hp.hpl.jena.tdb.base.file.Location ;
 import com.hp.hpl.jena.tdb.nodetable.NodeTable ;
 import com.hp.hpl.jena.tdb.nodetable.NodeTupleTable ;
@@ -57,6 +56,7 @@ import com.hp.hpl.jena.tdb.solver.stats.
 import com.hp.hpl.jena.tdb.store.DatasetGraphTDB ;
 import com.hp.hpl.jena.tdb.store.NodeId ;
 import com.hp.hpl.jena.tdb.store.bulkloader.BulkLoader ;
+import com.hp.hpl.jena.tdb.store.bulkloader.BulkSinkRDF ;
 
 /** Build node table - write triples/quads as text file */
 public class CmdNodeTableBuilder extends CmdGeneral
@@ -153,22 +153,15 @@ public class CmdNodeTableBuilder extends
         catch (FileNotFoundException e) { throw new AtlasException(e) ; }
         
         NodeTableBuilder sink = new NodeTableBuilder(dsg, monitor, outputTriples, outputQuads) ; 
-        Sink<Triple> sink2 = new SinkExtendTriplesToQuads(sink) ;
-        
         monitor.start() ;
+        sink.startBulk() ;
         for( String filename : datafiles)
         {
             if ( datafiles.size() > 0 )
                 cmdLog.info("Load: "+filename+" -- "+Utils.nowAsString()) ;
-            
-            InputStream in = IO.openFile(filename) ;
-            Lang lang = RDFLanguages.filenameToLang(filename, RDFLanguages.NQuads) ;
-            if ( RDFLanguages.isTriples(lang) )
-                RiotReader.parseTriples(in, lang, null, sink2) ;
-            else
-                RiotReader.parseQuads(in, lang, null, sink) ;
+            RiotReader.parse(filename, sink) ;
         }
-        sink.close() ;
+        sink.finishBulk() ;
         IO.close(outputTriples) ;
         IO.close(outputQuads) ;
         
@@ -188,7 +181,7 @@ public class CmdNodeTableBuilder extends
         cmdLog.info(str) ;
     }
 
-    static class NodeTableBuilder implements Sink<Quad>
+    static class NodeTableBuilder implements BulkSinkRDF
     {
         private DatasetGraphTDB dsg ;
         private NodeTable nodeTable ;
@@ -209,7 +202,36 @@ public class CmdNodeTableBuilder extends
         }
         
         @Override
-        public void send(Quad quad)
+        public void startBulk()
+        {}
+
+        @Override
+        public void start()
+        {}
+
+        @Override
+        public void finish()
+        {}
+
+        @Override
+        public void finishBulk()
+        {
+            writerTriples.flush() ;
+            writerQuads.flush() ;
+            nodeTable.sync() ;
+        }
+            
+        @Override
+        public void triple(Triple triple)
+        {
+            Node s = triple.getSubject() ;
+            Node p = triple.getPredicate() ;
+            Node o = triple.getObject() ;
+            process(Quad.tripleInQuad,s,p,o);
+        }
+
+        @Override
+        public void quad(Quad quad)
         {
             Node s = quad.getSubject() ;
             Node p = quad.getPredicate() ;
@@ -218,7 +240,12 @@ public class CmdNodeTableBuilder extends
             // Union graph?!
             if ( ! quad.isTriple() && ! quad.isDefaultGraph() )
                 g = quad.getGraph() ;
-            
+            process(g,s,p,o);
+        }
+
+       
+        private void process(Node g, Node s, Node p, Node o)
+        {
             NodeId sId = nodeTable.getAllocateNodeId(s) ; 
             NodeId pId = nodeTable.getAllocateNodeId(p) ;
             NodeId oId = nodeTable.getAllocateNodeId(o) ;
@@ -244,19 +271,19 @@ public class CmdNodeTableBuilder extends
             monitor.tick() ;
         }
 
+        public StatsCollectorNodeId getCollector() { return stats ; }
+
         @Override
-        public void flush()
-        {
-            writerTriples.flush() ;
-            writerQuads.flush() ;
-            nodeTable.sync() ;
-        }
+        public void tuple(Tuple<Node> tuple)
+        { throw new TDBException("Unexpected: tuple in bulk load (expected quads or triples)") ; }
 
         @Override
-        public void close()
-        { flush() ; }
-        
-        public StatsCollectorNodeId getCollector() { return stats ; }
+        public void base(String base)
+        {}
+
+        @Override
+        public void prefix(String prefix, String iri)
+        {}
     }
 
     @Override



Mime
View raw message