jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1422689 [3/3] - in /jena/trunk: jena-arq/ jena-arq/src-examples/arq/examples/riot/ jena-arq/src/main/java/arq/ jena-arq/src/main/java/arq/cmdline/ jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/binding/ jena-arq/src/main/java/com/hp/...
Date Sun, 16 Dec 2012 21:12:28 GMT
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=1422689&r1=1422302&r2=1422689&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 Sun Dec 16 21:11:51 2012
@@ -16,26 +16,23 @@
  * limitations under the License.
  */
 
-package org.openjena.riot.lang;
+package org.apache.jena.riot.lang;
 
 import java.io.StringReader ;
 
-import org.apache.jena.atlas.lib.SinkCounting ;
 import org.apache.jena.atlas.lib.StrUtils ;
+import org.apache.jena.riot.RDFLanguages ;
+import org.apache.jena.riot.WebReader2 ;
 import org.apache.jena.riot.tokens.Tokenizer ;
 import org.junit.Test ;
-import org.openjena.riot.RiotException ;
-import org.openjena.riot.RiotReader ;
 import org.openjena.riot.ErrorHandlerTestLib.ErrorHandlerEx ;
 import org.openjena.riot.ErrorHandlerTestLib.ExFatal ;
-import org.openjena.riot.system.JenaReaderNTriples2 ;
-import org.openjena.riot.system.RiotLib ;
+import org.openjena.riot.RiotException ;
+import org.openjena.riot.RiotReader ;
 
 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 ;
-import com.hp.hpl.jena.rdf.model.RDFReader ;
 import com.hp.hpl.jena.sparql.sse.SSE ;
 
 /** Test of syntax by a triples parser (does not include node validitiy checking) */ 
@@ -50,8 +47,7 @@ public class TestLangNTriples extends Te
         StringReader r = new StringReader(s) ;
         Model m = ModelFactory.createDefaultModel() ;
         
-        RDFReader reader = new JenaReaderNTriples2() ;
-        reader.read(m, r, null) ;
+        WebReader2.read(m, r, null, RDFLanguages.langNTriples) ;
         assertEquals(1, m.size()) ;
         
         String x = m.listStatements().next().getSubject().getId().getLabelString() ;
@@ -59,7 +55,7 @@ public class TestLangNTriples extends Te
         
         // reset - reread -  new bNode.
         r = new StringReader(s) ;
-        reader.read(m, r, null) ;
+        WebReader2.read(m, r, null, RDFLanguages.langNTriples) ;
         assertEquals(2, m.size()) ;
     }
 
@@ -97,30 +93,24 @@ public class TestLangNTriples extends Te
     {
         String string = StrUtils.strjoin("\n", strings) ;
         Tokenizer tokenizer = tokenizer(string) ;
-        SinkCounting<Triple> sink = new SinkCounting<Triple>() ;
+        RDFParserOutputCounting sink = RDFParserOutputLib.count() ;
         LangNTriples x = RiotReader.createParserNTriples(tokenizer, sink) ;
         x.getProfile().setHandler(new ErrorHandlerEx()) ;
         x.parse() ;
-        return sink.getCount() ;
+        return sink.count() ;
     }
 
     @Override
-    protected void parseCheck(String... strings)
+    protected LangRIOT createParser(Tokenizer tokenizer, RDFParserOutput sink)
     {
-        String string = StrUtils.strjoin("\n", strings) ;
-        Tokenizer tokenizer = tokenizer(string) ;
-        SinkCounting<Triple> sink = new SinkCounting<Triple>() ;
-        LangNTriples x = RiotReader.createParserNTriples(tokenizer, sink) ;
-        x.setProfile(RiotLib.profile(null, false, true, new ErrorHandlerEx())) ;
-        x.parse() ;
-    }
+        return RiotReader.createParserNTriples(tokenizer, sink) ;
+    } 
 
     protected Model parseToModel(String string)
     {
         StringReader r = new StringReader(string) ;
         Model model = ModelFactory.createDefaultModel() ;
-        RDFReader reader = new JenaReaderNTriples2() ;
-        reader.read(model, r, null) ;
+        WebReader2.read(model, r, null, RDFLanguages.langNTriples) ;
         return model ;
     }
 }

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=1422689&r1=1422302&r2=1422689&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 Sun Dec 16 21:11:51 2012
@@ -16,16 +16,23 @@
  * limitations under the License.
  */
 
-package org.openjena.riot.lang;
+package org.apache.jena.riot.lang;
 
 import java.io.ByteArrayInputStream ;
 
 import org.apache.jena.atlas.junit.BaseTest ;
 import org.apache.jena.atlas.lib.StrUtils ;
+import org.apache.jena.riot.lang.LangRIOT ;
+import org.apache.jena.riot.lang.RDFParserOutput ;
+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.tokens.Tokenizer ;
 import org.apache.jena.riot.tokens.TokenizerFactory ;
 import org.junit.Test ;
 import org.openjena.riot.RiotException ;
+import org.openjena.riot.RiotReader ;
+import org.openjena.riot.ErrorHandlerTestLib.ErrorHandlerEx ;
 import org.openjena.riot.ErrorHandlerTestLib.ExError ;
 import org.openjena.riot.ErrorHandlerTestLib.ExFatal ;
 import org.openjena.riot.ErrorHandlerTestLib.ExWarning ;
@@ -160,8 +167,27 @@ abstract public class TestLangNTuples ex
         return tokenizer ;
     }
     
+    protected void parse(RDFParserOutput sink, String... strings ) 
+    {
+        String string = StrUtils.strjoin("\n", strings) ;
+        Tokenizer tokenizer = tokenizer(string) ;
+        LangRIOT parser = createParser(tokenizer(string), sink) ;
+        parser.getProfile().setHandler(new ErrorHandlerEx()) ;
+        parser.parse() ;
+    }
     
-    protected abstract long parseCount(String... strings) ;
+    protected abstract LangRIOT createParser(Tokenizer tokenizer, RDFParserOutput sink) ;
+
+    final protected void parseCheck(String... strings)
+    {
+        String string = StrUtils.strjoin("\n", strings) ;
+        Tokenizer tokenizer = tokenizer(string) ;
+        RDFParserOutputCounting sink = RDFParserOutputLib.count() ;
+        LangRIOT x = RiotReader.createParserNQuads(tokenizer, sink) ;
+        x.setProfile(RiotLib.profile(null, false, true, new ErrorHandlerEx())) ;
+        x.parse() ;
+    }
+
     
-    protected abstract void parseCheck(String... strings) ;
+    protected abstract long parseCount(String... strings) ;
 }

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=1422689&r1=1422302&r2=1422689&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 Sun Dec 16 21:11:51 2012
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package org.openjena.riot.lang;
+package org.apache.jena.riot.lang;
 
 import java.io.ByteArrayInputStream ;
 import java.io.StringReader ;
@@ -24,24 +24,24 @@ import java.io.StringReader ;
 import org.apache.jena.atlas.io.PeekReader ;
 import org.apache.jena.atlas.json.io.parser.TokenizerJSON ;
 import org.apache.jena.atlas.junit.BaseTest ;
-import org.apache.jena.atlas.lib.SinkCounting ;
 import org.apache.jena.atlas.lib.StrUtils ;
+import org.apache.jena.riot.RDFLanguages ;
+import org.apache.jena.riot.WebReader2 ;
+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.tokens.Tokenizer ;
 import org.apache.jena.riot.tokens.TokenizerFactory ;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.junit.AfterClass ;
+import org.junit.BeforeClass ;
 import org.junit.Test ;
+import org.openjena.riot.ErrorHandlerTestLib.ErrorHandlerEx ;
 import org.openjena.riot.ErrorHandlerTestLib.ExFatal ;
 import org.openjena.riot.RiotReader ;
-import org.openjena.riot.ErrorHandlerTestLib.ErrorHandlerEx ;
-import org.openjena.riot.SysRIOT;
-import org.openjena.riot.system.JenaReaderNTriples2 ;
-import org.openjena.riot.system.JenaReaderRdfJson ;
+import org.openjena.riot.SysRIOT ;
 
-import com.hp.hpl.jena.graph.Triple ;
 import com.hp.hpl.jena.rdf.model.Model ;
 import com.hp.hpl.jena.rdf.model.ModelFactory ;
-import com.hp.hpl.jena.rdf.model.RDFReader ;
 
 public class TestLangRdfJson extends BaseTest
 {
@@ -504,25 +504,25 @@ public class TestLangRdfJson extends Bas
 		byte b[] = StrUtils.asUTF8bytes("") ;
 		ByteArrayInputStream in = new ByteArrayInputStream(b);
 		Tokenizer tokenizer = TokenizerFactory.makeTokenizerUTF8(in) ;
-		LangRDFJSON parser = RiotReader.createParserRdfJson(tokenizer, new SinkCounting<Triple>()) ;
+        RDFParserOutputCounting sink = RDFParserOutputLib.count() ;
+		LangRDFJSON parser = RiotReader.createParserRdfJson(tokenizer, sink) ;
 	}
 
     private long parseCount(String string)
     {
         Tokenizer tokenizer = tokenizer(string) ;
-        SinkCounting<Triple> sink = new SinkCounting<Triple>() ;
+        RDFParserOutputCounting sink = RDFParserOutputLib.count() ;
         LangRDFJSON x = RiotReader.createParserRdfJson(tokenizer, sink) ;
         x.getProfile().setHandler(new ErrorHandlerEx()) ;
         x.parse() ;
-        return sink.getCount() ;
+        return sink.count() ;
     }
 
     private Model parseToModelNTriples(String string)
     {
         StringReader r = new StringReader(string) ;
         Model model = ModelFactory.createDefaultModel() ;
-        RDFReader reader = new JenaReaderNTriples2() ;
-        reader.read(model, r, null) ;
+        WebReader2.read(model, r, null, RDFLanguages.langNTriples) ;
         return model ;
     }
 
@@ -530,8 +530,7 @@ public class TestLangRdfJson extends Bas
     {
         StringReader r = new StringReader(string) ;
         Model model = ModelFactory.createDefaultModel() ;
-        RDFReader reader = new JenaReaderRdfJson() ;
-        reader.read(model, r, null) ;
+        WebReader2.read(model, r, null, RDFLanguages.langRDFJSON) ;
         return model ;
     }
 

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=1422689&r1=1422302&r2=1422689&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 Sun Dec 16 21:11:51 2012
@@ -16,22 +16,22 @@
  * limitations under the License.
  */
 
-package org.openjena.riot.lang;
+package org.apache.jena.riot.lang;
 
 import org.apache.jena.atlas.junit.BaseTest ;
-import org.apache.jena.atlas.lib.Sink ;
 import org.apache.jena.atlas.lib.StrUtils ;
+import org.apache.jena.riot.lang.LangTriG ;
+import org.apache.jena.riot.lang.RDFParserOutput ;
+import org.apache.jena.riot.lang.RDFParserOutputLib ;
 import org.apache.jena.riot.tokens.Tokenizer ;
 import org.apache.jena.riot.tokens.TokenizerFactory ;
 import org.junit.Test ;
-import org.openjena.riot.RiotLoader ;
-import org.openjena.riot.RiotReader ;
 import org.openjena.riot.ErrorHandlerTestLib.ErrorHandlerEx ;
 import org.openjena.riot.ErrorHandlerTestLib.ExWarning ;
+import org.openjena.riot.RiotReader ;
 
 import com.hp.hpl.jena.graph.Triple ;
 import com.hp.hpl.jena.sparql.core.DatasetGraph ;
-import com.hp.hpl.jena.sparql.core.Quad ;
 import com.hp.hpl.jena.sparql.lib.DatasetLib ;
 import com.hp.hpl.jena.sparql.sse.SSE ;
 
@@ -88,13 +88,11 @@ public class TestLangTrig extends BaseTe
     {
         String string = StrUtils.strjoin("\n", strings) ;
         DatasetGraph dsg = DatasetLib.createDatasetGraphMem() ;
-        Sink<Quad> sink = RiotLoader.datasetSink(dsg) ;
+        RDFParserOutput sink = RDFParserOutputLib.dataset(dsg) ;
         Tokenizer tokenizer = TokenizerFactory.makeTokenizerString(string) ;
         LangTriG parser = RiotReader.createParserTriG(tokenizer, "http://base/", sink) ;
         parser.getProfile().setHandler(new ErrorHandlerEx()) ;
-        try {
-            parser.parse();
-        } finally { sink.close() ; }
+        parser.parse();
         return dsg ;
     }
     

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=1422689&r1=1422302&r2=1422689&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 Sun Dec 16 21:11:51 2012
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package org.openjena.riot.lang;
+package org.apache.jena.riot.lang;
 
 import static org.openjena.riot.ErrorHandlerFactory.errorHandlerNoLogging ;
 import static org.openjena.riot.ErrorHandlerFactory.getDefaultErrorHandler ;
@@ -26,27 +26,26 @@ import java.io.Reader ;
 import java.io.StringReader ;
 
 import org.apache.jena.atlas.junit.BaseTest ;
-import org.apache.jena.atlas.lib.Sink ;
 import org.apache.jena.atlas.lib.StrUtils ;
+import org.apache.jena.riot.RDFLanguages ;
+import org.apache.jena.riot.WebReader2 ;
+import org.apache.jena.riot.lang.LangTurtle ;
+import org.apache.jena.riot.lang.RDFParserOutput ;
+import org.apache.jena.riot.lang.RDFParserOutputLib ;
 import org.apache.jena.riot.tokens.Tokenizer ;
 import org.apache.jena.riot.tokens.TokenizerFactory ;
 import org.junit.AfterClass ;
 import org.junit.BeforeClass ;
 import org.junit.Test ;
-import org.openjena.riot.ErrorHandler ;
-import org.openjena.riot.ErrorHandlerFactory ;
-import org.openjena.riot.RiotLoader ;
-import org.openjena.riot.RiotReader ;
+import org.openjena.riot.* ;
 import org.openjena.riot.ErrorHandlerTestLib.ErrorHandlerEx ;
 import org.openjena.riot.ErrorHandlerTestLib.ExFatal ;
 import org.openjena.riot.ErrorHandlerTestLib.ExWarning ;
-import org.openjena.riot.system.JenaReaderTurtle2 ;
 
 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 ;
-import com.hp.hpl.jena.rdf.model.RDFReader ;
 import com.hp.hpl.jena.sparql.graph.GraphFactory ;
 import com.hp.hpl.jena.sparql.sse.SSE ;
 
@@ -57,9 +56,7 @@ public class TestLangTurtle extends Base
         String s = "_:a <http://example/p> 'foo' . " ;
         StringReader r = new StringReader(s) ;
         Model m = ModelFactory.createDefaultModel() ;
-        
-        RDFReader reader = new JenaReaderTurtle2() ;
-        readProtected(reader,m, r, null) ;
+        WebReader2.read(m, r, null, RDFLanguages.langTurtle) ;
         assertEquals(1, m.size()) ;
         
         String x = m.listStatements().next().getSubject().getId().getLabelString() ;
@@ -67,7 +64,7 @@ public class TestLangTurtle extends Base
 
         // reset - reread - new bNode.
         r = new StringReader(s) ;
-        reader.read(m, r, null) ;
+        WebReader2.read(m, r, null, RDFLanguages.langTurtle) ;
         assertEquals(2, m.size()) ;
     }
     
@@ -77,18 +74,16 @@ public class TestLangTurtle extends Base
         String s = "_:a <http://example/p> 'foo' . _:a <http://example/p> 'foo' ." ;
         StringReader r = new StringReader(s) ;
         Model m = ModelFactory.createDefaultModel() ;
-        RDFReader reader = new JenaReaderTurtle2() ;
-        readProtected(reader,m, r, null) ;
+        WebReader2.read(m, r, null, RDFLanguages.langTurtle) ;
         assertEquals(1, m.size()) ;
     }
 
     
     @Test public void updatePrefixMapping()
     {
-        JenaReaderTurtle2 parser = new JenaReaderTurtle2() ;
         Model model = ModelFactory.createDefaultModel() ;
-        Reader reader = new StringReader("@prefix x: <http://example/x>.") ;
-        parser.read(model, reader, "http://example/base/") ;
+        StringReader reader = new StringReader("@prefix x: <http://example/x>.") ;
+        WebReader2.read(model, reader, null, RDFLanguages.langTurtle) ;
         assertEquals(1, model.getNsPrefixMap().size()) ;
         assertEquals("http://example/x", model.getNsPrefixURI("x")) ;
     }
@@ -105,15 +100,6 @@ public class TestLangTurtle extends Base
         setDefaultErrorHandler(errorhandler) ;
     }
     
-    private void readProtected(RDFReader reader, Model m, Reader r, String base)
-    {
-        ErrorHandler errorhandler = ErrorHandlerFactory.getDefaultErrorHandler() ;
-        ErrorHandlerFactory.setDefaultErrorHandler(ErrorHandlerFactory.errorHandlerNoLogging) ;
-        try {
-            reader.read(m, r, base) ;
-        } finally { ErrorHandlerFactory.setDefaultErrorHandler(errorhandler) ; }
-    }
-    
     // Call parser directly.
     
     private static Graph parse(String ...strings)
@@ -124,13 +110,10 @@ public class TestLangTurtle extends Base
         Tokenizer tokenizer = TokenizerFactory.makeTokenizer(reader) ;
         
         Graph graph = GraphFactory.createDefaultGraph() ;
-        Sink<Triple> sink = RiotLoader.graphSink(graph) ;
-        
+        RDFParserOutput sink = RDFParserOutputLib.graph(graph) ;
         LangTurtle parser = RiotReader.createParserTurtle(tokenizer, "http://base/", sink) ;
         parser.getProfile().setHandler(new ErrorHandlerEx()) ;
-        try {
-            parser.parse() ; 
-        } finally { sink.close() ; }
+        parser.parse() ; 
         return graph ;
     }
     

Modified: jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestNodeAllocator.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestNodeAllocator.java?rev=1422689&r1=1422302&r2=1422689&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestNodeAllocator.java (original)
+++ jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestNodeAllocator.java Sun Dec 16 21:11:51 2012
@@ -16,9 +16,10 @@
  * limitations under the License.
  */
 
-package org.openjena.riot.lang;
+package org.apache.jena.riot.lang;
 
 import org.apache.jena.atlas.junit.BaseTest ;
+import org.apache.jena.riot.lang.LabelToNode ;
 import org.junit.Test ;
 
 import com.hp.hpl.jena.graph.Node ;

Modified: jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestParserFactory.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestParserFactory.java?rev=1422689&r1=1422302&r2=1422689&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestParserFactory.java (original)
+++ jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestParserFactory.java Sun Dec 16 21:11:51 2012
@@ -16,18 +16,22 @@
  * limitations under the License.
  */
 
-package org.openjena.riot.lang;
+package org.apache.jena.riot.lang;
 
 import java.util.ArrayList ;
 import java.util.List ;
 
 import org.apache.jena.atlas.junit.BaseTest ;
-import org.apache.jena.atlas.lib.Sink ;
+import org.apache.jena.atlas.lib.Pair ;
+import org.apache.jena.atlas.lib.Tuple ;
+import org.apache.jena.riot.lang.LangRIOT ;
+import org.apache.jena.riot.lang.RDFParserOutput ;
 import org.apache.jena.riot.tokens.Tokenizer ;
 import org.apache.jena.riot.tokens.TokenizerFactory ;
 import org.junit.Test ;
 import org.openjena.riot.RiotReader ;
 
+import com.hp.hpl.jena.graph.Node ;
 import com.hp.hpl.jena.graph.Triple ;
 import com.hp.hpl.jena.sparql.core.Quad ;
 import com.hp.hpl.jena.sparql.sse.SSE ;
@@ -35,99 +39,120 @@ import com.hp.hpl.jena.sparql.sse.SSE ;
 /** System-level testing of the parsers - testing the parser plumbing, not the language details */
 public class TestParserFactory extends BaseTest
 {
-    static class CatchSink<T> implements Sink<T>
+    static class CatchParserOutput implements RDFParserOutput
     {
-        List<T> things = new ArrayList<T>() ;
-        int flushCalled = 0 ;
-        int closeCalled = 0 ;
-
-        @Override
-        public void send(T item)
-        { things.add(item) ; }
-
-        @Override
-        public void flush() { flushCalled ++ ; }
-        @Override
-        public void close() { closeCalled++ ; }
-        
-        public T getLast()
-        { 
-            if ( things.size() == 0 ) return null ;
-            return things.get(things.size()-1) ;
-        }
+        List<Triple>      triples     = new ArrayList<Triple>() ;
+        List<Quad>        quads       = new ArrayList<Quad>() ;
+        List<Tuple<Node>> tuples      = new ArrayList<Tuple<Node>>() ;
+        List<Pair<String,String>>     prefixes     = new ArrayList<Pair<String,String>>() ;
+        List<String>     bases       = new ArrayList<String>() ;
+        
+        int startCalled = 0 ;
+        
+        int finishCalled = 0 ;
+        
+        @Override public void start()   { startCalled++ ; }
+        
+        @Override public void triple(Triple triple)     { triples.add(triple) ; }
+        
+        @Override public void quad(Quad quad)           { quads.add(quad) ; }
+        
+        @Override public void tuple(Tuple<Node> tuple)  { tuples.add(tuple) ; }
+        
+        @Override public void base(String base)         { bases.add(base) ; }
+        
+        @Override public void prefix(String prefix, String iri) { prefixes.add(Pair.create(prefix, iri)) ; }
+        
+        @Override public void finish()  { finishCalled++ ; }
     }
     
     @Test public void ntriples_01() 
     {
         Tokenizer tokenizer = TokenizerFactory.makeTokenizerString("<x> <p> <q> .") ;
-        CatchSink<Triple> sink = new CatchSink<Triple>() ;
+        CatchParserOutput sink = new CatchParserOutput() ;
         
         LangRIOT parser = RiotReader.createParserNTriples(tokenizer, sink) ;
         parserSetup(parser) ;
         parser.parse();
-        assertEquals(1, sink.flushCalled) ;
-        assertEquals(0, sink.closeCalled) ;
-        assertEquals(1, sink.things.size()) ;
-        assertEquals(SSE.parseTriple("(<x> <p> <q>)"), sink.getLast()) ;
+        assertEquals(1, sink.startCalled) ;
+        assertEquals(1, sink.finishCalled) ;
+        assertEquals(1, sink.triples.size()) ;
+        assertEquals(0, sink.quads.size()) ;
+        assertEquals(0, sink.tuples.size()) ;
+        assertEquals(SSE.parseTriple("(<x> <p> <q>)"), last(sink.triples)) ;
     }
     
     @Test public void turtle_01() 
     {
         Tokenizer tokenizer = TokenizerFactory.makeTokenizerString("<x> <p> <q> .") ; 
-        CatchSink<Triple> sink = new CatchSink<Triple>() ;
+        CatchParserOutput sink = new CatchParserOutput() ;
         LangRIOT parser = RiotReader.createParserTurtle(tokenizer, "http://base/", sink) ;
         parserSetup(parser) ;
         parser.parse();
-        assertEquals(1, sink.flushCalled) ;
-        assertEquals(0, sink.closeCalled) ;
-        assertEquals(1, sink.things.size()) ;
-        assertEquals(SSE.parseTriple("(<http://base/x> <http://base/p> <http://base/q>)"), sink.getLast()) ;
+        assertEquals(1, sink.startCalled) ;
+        assertEquals(1, sink.finishCalled) ;
+        assertEquals(1, sink.triples.size()) ;
+        assertEquals(0, sink.quads.size()) ;
+        assertEquals(0, sink.tuples.size()) ;
+        assertEquals(SSE.parseTriple("(<http://base/x> <http://base/p> <http://base/q>)"), last(sink.triples)) ;
     }
     
     @Test public void nquads_01() 
     {
         Tokenizer tokenizer = TokenizerFactory.makeTokenizerString("<x> <p> <q> <g>.") ; 
-        CatchSink<Quad> sink = new CatchSink<Quad>() ;
+        CatchParserOutput sink = new CatchParserOutput() ;
         LangRIOT parser = RiotReader.createParserNQuads(tokenizer, sink) ;
         parserSetup(parser) ;
         parser.parse();
-        assertEquals(1, sink.flushCalled) ;
-        assertEquals(0, sink.closeCalled) ;
-        assertEquals(1, sink.things.size()) ;
+        assertEquals(1, sink.startCalled) ;
+        assertEquals(1, sink.finishCalled) ;
+        assertEquals(0, sink.triples.size()) ;
+        assertEquals(1, sink.quads.size()) ;
+        assertEquals(0, sink.tuples.size()) ;
         
         Quad q = SSE.parseQuad("(<g> <x> <p> <q>)") ;
-        assertEquals(q, sink.getLast()) ;
+        assertEquals(q, last(sink.quads)) ;
     }
 
     @Test public void trig_01() 
     {
         Tokenizer tokenizer = TokenizerFactory.makeTokenizerString("{ <x> <p> <q> }") ; 
-        CatchSink<Quad> sink = new CatchSink<Quad>() ;
+        CatchParserOutput sink = new CatchParserOutput() ;
         LangRIOT parser = RiotReader.createParserTriG(tokenizer, "http://base/", sink) ;
         parserSetup(parser) ;
         parser.parse();
-        assertEquals(1, sink.flushCalled) ;
-        assertEquals(0, sink.closeCalled) ;
-        assertEquals(1, sink.things.size()) ;
+        assertEquals(1, sink.startCalled) ;
+        assertEquals(1, sink.finishCalled) ;
+        assertEquals(0, sink.triples.size()) ;
+        assertEquals(1, sink.quads.size()) ;
+        assertEquals(0, sink.tuples.size()) ;
         
         Triple t = SSE.parseTriple("(<http://base/x> <http://base/p> <http://base/q>)") ;
         Quad q = new Quad(Quad.tripleInQuad, t) ;
-        assertEquals(q, sink.getLast()) ;
+        assertEquals(q, last(sink.quads)) ;
     }
     
     @Test public void trig_02() 
     {
         Tokenizer tokenizer = TokenizerFactory.makeTokenizerString("<g> { <x> <p> <q> }") ; 
-        CatchSink<Quad> sink = new CatchSink<Quad>() ;
+        CatchParserOutput sink = new CatchParserOutput() ;
         LangRIOT parser = RiotReader.createParserTriG(tokenizer, "http://base/", sink) ;
         parserSetup(parser) ;
         parser.parse();
-        assertEquals(1, sink.flushCalled) ;
-        assertEquals(0, sink.closeCalled) ;
-        assertEquals(1, sink.things.size()) ;
+        assertEquals(1, sink.startCalled) ;
+        assertEquals(1, sink.finishCalled) ;
+        assertEquals(0, sink.triples.size()) ;
+        assertEquals(1, sink.quads.size()) ;
+        assertEquals(0, sink.tuples.size()) ;
         
         Quad q = SSE.parseQuad("(<http://base/g> <http://base/x> <http://base/p> <http://base/q>)") ;
-        assertEquals(q, sink.getLast()) ;
+        assertEquals(q, last(sink.quads)) ;
+    }
+
+    private static <T> T last(List<T> list) 
+    { 
+        if ( list.isEmpty() ) return null ;
+        return list.get(list.size()-1) ;
     }
     
     private static void parserSetup(LangRIOT parser)

Modified: jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestReaderNTriples.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestReaderNTriples.java?rev=1422689&r1=1422302&r2=1422689&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestReaderNTriples.java (original)
+++ jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestReaderNTriples.java Sun Dec 16 21:11:51 2012
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-package org.openjena.riot.lang;
+package org.apache.jena.riot.lang;
 
 public class TestReaderNTriples
 {

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=1422689&r1=1422302&r2=1422689&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 Sun Dec 16 21:11:51 2012
@@ -16,18 +16,17 @@
  * limitations under the License.
  */
 
-package org.openjena.riot.lang;
+package org.apache.jena.riot.lang;
 
 import org.apache.jena.atlas.junit.BaseTest ;
-import org.apache.jena.atlas.lib.Sink ;
-import org.apache.jena.atlas.lib.SinkNull ;
+import org.apache.jena.riot.lang.LangTurtle ;
+import org.apache.jena.riot.lang.RDFParserOutput ;
+import org.apache.jena.riot.lang.RDFParserOutputLib ;
+import org.apache.jena.riot.system.PrefixMap ;
 import org.apache.jena.riot.tokens.Tokenizer ;
 import org.apache.jena.riot.tokens.TokenizerFactory ;
 import org.junit.Test ;
 import org.openjena.riot.RiotReader ;
-import org.openjena.riot.system.PrefixMap ;
-
-import com.hp.hpl.jena.graph.Triple ;
 
 public class TestTurtleTerms extends BaseTest
 {
@@ -245,8 +244,7 @@ public class TestTurtleTerms extends Bas
 	    // Need to access the prefix mapping.
 	    
 	    Tokenizer tokenizer = TokenizerFactory.makeTokenizerString(testString) ;
-	    Sink<Triple> sink = new SinkNull<Triple>() ;
-
+	    RDFParserOutput sink = RDFParserOutputLib.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/langsuite/UnitTestBadEval.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestBadEval.java?rev=1422689&r1=1422688&r2=1422689&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestBadEval.java (original)
+++ jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestBadEval.java Sun Dec 16 21:11:51 2012
@@ -20,16 +20,15 @@ package org.apache.jena.riot.langsuite;
 
 
 import org.apache.jena.riot.Lang2 ;
+import org.apache.jena.riot.WebReader2 ;
 import org.junit.After ;
 import org.junit.Before ;
 import org.openjena.riot.ErrorHandler ;
 import org.openjena.riot.ErrorHandlerFactory ;
 import org.openjena.riot.RiotException ;
-import org.openjena.riot.system.JenaReaderTurtle2 ;
 
 import com.hp.hpl.jena.rdf.model.Model ;
 import com.hp.hpl.jena.rdf.model.ModelFactory ;
-import com.hp.hpl.jena.rdf.model.RDFReader ;
 import com.hp.hpl.jena.shared.JenaException ;
 import com.hp.hpl.jena.sparql.junit.EarlReport ;
 
@@ -67,9 +66,8 @@ public class UnitTestBadEval extends Lan
     public void runTestForReal()
     {
         Model model = ModelFactory.createDefaultModel() ;
-        RDFReader rdfreader = new JenaReaderTurtle2() ;
         try {
-            rdfreader.read(model, input) ;
+            WebReader2.read(model, input) ;
             fail("Managed to read a bad evaluation test without error") ;
         } 
         catch (RiotException ex) {}

Modified: jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestEval.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestEval.java?rev=1422689&r1=1422688&r2=1422689&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestEval.java (original)
+++ jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestEval.java Sun Dec 16 21:11:51 2012
@@ -18,11 +18,14 @@
 
 package org.apache.jena.riot.langsuite;
 
+import java.io.InputStream ;
+
 import org.apache.jena.riot.Lang2 ;
+import org.apache.jena.riot.RDFLanguages ;
 import org.apache.jena.riot.RDFReaderRIOT ;
 import org.apache.jena.riot.WebReader2 ;
+import org.apache.jena.riot.stream.StreamManager ;
 import org.openjena.riot.RiotException ;
-import org.openjena.riot.system.JenaReaderNTriples2 ;
 
 import com.hp.hpl.jena.rdf.model.Model ;
 import com.hp.hpl.jena.rdf.model.ModelFactory ;
@@ -68,7 +71,8 @@ public class UnitTestEval extends LangTe
             String syntax = FileUtils.guessLang(output, FileUtils.langNTriple) ;
             Model results = ModelFactory.createDefaultModel() ;
             // Directly get an N-triples reader
-            new JenaReaderNTriples2().read(results, output) ;
+            InputStream in = StreamManager.get().open(output).getInput() ;
+            WebReader2.read(results, in, null, RDFLanguages.langNTriples) ;
 
             boolean b = model.isIsomorphicWith(results) ;
             if ( !b )

Modified: jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/tokens/TestTokenForNode.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/tokens/TestTokenForNode.java?rev=1422689&r1=1422688&r2=1422689&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/tokens/TestTokenForNode.java (original)
+++ jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/tokens/TestTokenForNode.java Sun Dec 16 21:11:51 2012
@@ -19,11 +19,11 @@
 package org.apache.jena.riot.tokens;
 
 import org.apache.jena.atlas.junit.BaseTest ;
+import org.apache.jena.riot.system.PrefixMap ;
 import org.apache.jena.riot.tokens.Token ;
 import org.apache.jena.riot.tokens.TokenType ;
 import org.junit.BeforeClass ;
 import org.junit.Test ;
-import org.openjena.riot.system.PrefixMap ;
 
 import com.hp.hpl.jena.graph.Node ;
 import com.hp.hpl.jena.rdf.model.AnonId ;

Modified: jena/trunk/jena-arq/src/test/java/org/openjena/riot/TS_Riot1.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/openjena/riot/TS_Riot1.java?rev=1422689&r1=1422688&r2=1422689&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/org/openjena/riot/TS_Riot1.java (original)
+++ jena/trunk/jena-arq/src/test/java/org/openjena/riot/TS_Riot1.java Sun Dec 16 21:11:51 2012
@@ -19,11 +19,11 @@
 package org.openjena.riot;
 
 import org.apache.jena.atlas.junit.BaseTest ;
+import org.apache.jena.riot.lang.* ;
 import org.junit.AfterClass ;
 import org.junit.BeforeClass ;
 import org.junit.runner.RunWith ;
 import org.junit.runners.Suite ;
-import org.openjena.riot.lang.* ;
 import org.openjena.riot.out.* ;
 import org.openjena.riot.process.TestNormalization ;
 

Modified: jena/trunk/jena-arq/src/test/java/org/openjena/riot/TestChecker.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/openjena/riot/TestChecker.java?rev=1422689&r1=1422688&r2=1422689&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/org/openjena/riot/TestChecker.java (original)
+++ jena/trunk/jena-arq/src/test/java/org/openjena/riot/TestChecker.java Sun Dec 16 21:11:51 2012
@@ -18,12 +18,12 @@
 
 package org.openjena.riot;
 
+import org.apache.jena.riot.system.Checker ;
 import org.junit.After ;
 import org.junit.Before ;
 import org.junit.Test ;
 import org.openjena.riot.ErrorHandlerTestLib.ExError ;
 import org.openjena.riot.ErrorHandlerTestLib.ExWarning ;
-import org.openjena.riot.system.Checker ;
 
 import com.hp.hpl.jena.graph.Node ;
 import com.hp.hpl.jena.shared.impl.JenaParameters ;

Modified: jena/trunk/jena-arq/src/test/java/org/openjena/riot/TestPrefixMap.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/openjena/riot/TestPrefixMap.java?rev=1422689&r1=1422688&r2=1422689&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/org/openjena/riot/TestPrefixMap.java (original)
+++ jena/trunk/jena-arq/src/test/java/org/openjena/riot/TestPrefixMap.java Sun Dec 16 21:11:51 2012
@@ -19,10 +19,10 @@
 package org.openjena.riot;
 
 import org.junit.Test ;
-import org.openjena.riot.system.PrefixMap ;
 
 import org.apache.jena.atlas.junit.BaseTest ;
 import org.apache.jena.iri.IRIFactory ;
+import org.apache.jena.riot.system.PrefixMap ;
 
 public class TestPrefixMap extends BaseTest
 {

Modified: jena/trunk/jena-arq/src/test/java/org/openjena/riot/out/TestNodeFmt.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/openjena/riot/out/TestNodeFmt.java?rev=1422689&r1=1422688&r2=1422689&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/org/openjena/riot/out/TestNodeFmt.java (original)
+++ jena/trunk/jena-arq/src/test/java/org/openjena/riot/out/TestNodeFmt.java Sun Dec 16 21:11:51 2012
@@ -21,8 +21,8 @@ package org.openjena.riot.out;
 import java.io.StringWriter ;
 
 import org.apache.jena.atlas.junit.BaseTest ;
+import org.apache.jena.riot.system.PrefixMap ;
 import org.junit.Test ;
-import org.openjena.riot.system.PrefixMap ;
 
 import com.hp.hpl.jena.graph.Node ;
 import com.hp.hpl.jena.sparql.core.Var ;

Modified: jena/trunk/jena-arq/src/test/java/org/openjena/riot/out/TestOutput.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/openjena/riot/out/TestOutput.java?rev=1422689&r1=1422688&r2=1422689&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/org/openjena/riot/out/TestOutput.java (original)
+++ jena/trunk/jena-arq/src/test/java/org/openjena/riot/out/TestOutput.java Sun Dec 16 21:11:51 2012
@@ -25,8 +25,8 @@ import java.io.UnsupportedEncodingExcept
 import java.io.Writer ;
 
 import org.apache.jena.atlas.junit.BaseTest ;
+import org.apache.jena.riot.system.Prologue ;
 import org.junit.Test ;
-import org.openjena.riot.system.Prologue ;
 
 import com.hp.hpl.jena.graph.Node ;
 import com.hp.hpl.jena.sparql.util.NodeFactory ;

Modified: jena/trunk/jena-arq/src/test/java/org/openjena/riot/out/TestOutputNTriples.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/openjena/riot/out/TestOutputNTriples.java?rev=1422689&r1=1422688&r2=1422689&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/org/openjena/riot/out/TestOutputNTriples.java (original)
+++ jena/trunk/jena-arq/src/test/java/org/openjena/riot/out/TestOutputNTriples.java Sun Dec 16 21:11:51 2012
@@ -22,8 +22,8 @@ import java.io.ByteArrayOutputStream ;
 import java.io.OutputStream ;
 
 import org.apache.jena.atlas.junit.BaseTest ;
+import org.apache.jena.riot.system.JenaWriterNTriples2 ;
 import org.junit.Test ;
-import org.openjena.riot.system.JenaWriterNTriples2 ;
 
 import com.hp.hpl.jena.graph.Triple ;
 import com.hp.hpl.jena.rdf.model.Model ;

Modified: jena/trunk/jena-arq/src/test/java/org/openjena/riot/out/TestOutputRDFJSON.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/openjena/riot/out/TestOutputRDFJSON.java?rev=1422689&r1=1422688&r2=1422689&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/org/openjena/riot/out/TestOutputRDFJSON.java (original)
+++ jena/trunk/jena-arq/src/test/java/org/openjena/riot/out/TestOutputRDFJSON.java Sun Dec 16 21:11:51 2012
@@ -24,12 +24,12 @@ import java.io.ByteArrayOutputStream ;
 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.Sink ;
 import org.apache.jena.atlas.lib.StrUtils ;
+import org.apache.jena.riot.lang.LangRIOT ;
+import org.apache.jena.riot.lang.RDFParserOutput ;
+import org.apache.jena.riot.lang.RDFParserOutputLib ;
 import org.junit.Test ;
 import org.openjena.riot.RiotReader ;
-import org.openjena.riot.lang.LangRIOT ;
-import org.openjena.riot.lang.SinkTriplesToGraph ;
 
 import com.hp.hpl.jena.graph.Graph ;
 import com.hp.hpl.jena.graph.Node ;
@@ -169,8 +169,8 @@ public class TestOutputRDFJSON extends B
     {
         ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()) ;
         Graph graph = GraphFactory.createGraphMem() ;
-        Sink<Triple> sink = new SinkTriplesToGraph(graph) ; 
-        LangRIOT parser = RiotReader.createParserRdfJson(bin, sink) ;
+        RDFParserOutput dest = RDFParserOutputLib.graph(graph) ; 
+        LangRIOT parser = RiotReader.createParserRdfJson(bin, dest) ;
         parser.parse() ;
         return graph ;
     }

Modified: jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiCmd.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiCmd.java?rev=1422689&r1=1422688&r2=1422689&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiCmd.java (original)
+++ jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/FusekiCmd.java Sun Dec 16 21:11:51 2012
@@ -34,12 +34,12 @@ import org.apache.jena.fuseki.mgt.Manage
 import org.apache.jena.fuseki.server.FusekiConfig ;
 import org.apache.jena.fuseki.server.SPARQLServer ;
 import org.apache.jena.fuseki.server.ServerConfig ;
+import org.apache.jena.riot.lang.SinkQuadsToDataset ;
+import org.apache.jena.riot.lang.SinkTriplesToGraph ;
 import org.eclipse.jetty.server.Server ;
 import org.openjena.riot.Lang ;
 import org.openjena.riot.RiotLoader ;
 import org.openjena.riot.SysRIOT ;
-import org.openjena.riot.lang.SinkQuadsToDataset ;
-import org.openjena.riot.lang.SinkTriplesToGraph ;
 import org.slf4j.Logger ;
 import arq.cmd.CmdException ;
 import arq.cmdline.ArgDecl ;

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=1422689&r1=1422688&r2=1422689&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 Sun Dec 16 21:11:51 2012
@@ -37,20 +37,19 @@ import org.apache.http.params.HttpParams
 import org.apache.http.params.HttpProtocolParams ;
 import org.apache.jena.atlas.io.IO ;
 import org.apache.jena.atlas.lib.IRILib ;
-import org.apache.jena.atlas.lib.Sink ;
 import org.apache.jena.atlas.logging.Log ;
 import org.apache.jena.atlas.web.TypedInputStream ;
 import org.apache.jena.fuseki.* ;
 import org.apache.jena.fuseki.migrate.UnmodifiableGraph ;
+import org.apache.jena.riot.lang.LangRIOT ;
+import org.apache.jena.riot.lang.RDFParserOutput ;
+import org.apache.jena.riot.lang.RDFParserOutputLib ;
 import org.openjena.riot.Lang ;
 import org.openjena.riot.RiotReader ;
 import org.openjena.riot.WebContent ;
-import org.openjena.riot.lang.LangRIOT ;
-import org.openjena.riot.lang.SinkTriplesToGraph ;
 
 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.rdf.model.Model ;
 import com.hp.hpl.jena.rdf.model.ModelFactory ;
 import com.hp.hpl.jena.sparql.graph.GraphFactory ;
@@ -295,9 +294,9 @@ public class DatasetGraphAccessorHTTP im
        
         Lang lang = FusekiLib.langFromContentType(ts.getMediaType()) ;
         if ( lang == null )
-            throw new FusekiException("Unknown lang for "+ts.getMediaType()) ;
-        Sink<Triple> sink = new SinkTriplesToGraph(graph) ;
-        LangRIOT parser = RiotReader.createParserTriples(ts, lang, base, sink) ;
+            throw new FusekiException("Unknown lang for "+ts.getMediaType()) ;
+        RDFParserOutput dest = RDFParserOutputLib.graph(graph) ;
+        LangRIOT parser = RiotReader.createParserTriples(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=1422689&r1=1422688&r2=1422689&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 Sun Dec 16 21:11:51 2012
@@ -23,11 +23,13 @@ import java.io.InputStream ;
 
 import org.apache.jena.atlas.lib.Sink ;
 import org.apache.jena.fuseki.Fuseki ;
+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.openjena.riot.Lang ;
 import org.openjena.riot.RiotException ;
 import org.openjena.riot.RiotReader ;
-import org.openjena.riot.lang.LangRIOT ;
-import org.openjena.riot.lang.SinkTriplesToGraph ;
 
 import com.hp.hpl.jena.graph.Factory ;
 import com.hp.hpl.jena.graph.Graph ;
@@ -79,7 +81,8 @@ public class GraphLoadUtils
         // TODO Conneg - awaiting RIOT code upgrade.
         InputStream input = Fuseki.webFileManager.open(uri) ;
         
-        LangRIOT parser = RiotReader.createParserTriples(input, lang, uri, sink) ;
+        RDFParserOutput dest = RDFParserOutputLib.sinkTriples(sink) ;
+        LangRIOT parser = RiotReader.createParserTriples(input, lang, uri, dest) ;
         try {
             parser.parse() ;
         } catch (RiotException ex) { throw ex ; }

Modified: jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/FusekiVocab.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/FusekiVocab.java?rev=1422689&r1=1422688&r2=1422689&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/FusekiVocab.java (original)
+++ jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/FusekiVocab.java Sun Dec 16 21:11:51 2012
@@ -20,7 +20,7 @@ package org.apache.jena.fuseki.server;
 
 import org.apache.jena.fuseki.FusekiException ;
 import org.apache.jena.iri.IRI ;
-import org.openjena.riot.system.IRIResolver ;
+import org.apache.jena.riot.system.IRIResolver ;
 
 import com.hp.hpl.jena.rdf.model.Property ;
 import com.hp.hpl.jena.rdf.model.Resource ;

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=1422689&r1=1422688&r2=1422689&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 Sun Dec 16 21:11:51 2012
@@ -25,21 +25,20 @@ import java.io.IOException ;
 import javax.servlet.ServletOutputStream ;
 import javax.servlet.http.HttpServletRequest ;
 
-import org.apache.jena.atlas.lib.Sink ;
 import org.apache.jena.atlas.web.MediaType ;
 import org.apache.jena.atlas.web.TypedOutputStream ;
 import org.apache.jena.fuseki.Fuseki ;
 import org.apache.jena.fuseki.FusekiLib ;
 import org.apache.jena.fuseki.HttpNames ;
+import org.apache.jena.riot.lang.LangRIOT ;
+import org.apache.jena.riot.lang.RDFParserOutput ;
+import org.apache.jena.riot.lang.RDFParserOutputLib ;
 import org.openjena.riot.Lang ;
 import org.openjena.riot.RiotReader ;
 import org.openjena.riot.RiotWriter ;
-import org.openjena.riot.lang.LangRIOT ;
-import org.openjena.riot.lang.SinkTriplesToGraph ;
 
 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.sparql.core.DatasetGraph ;
 
 /** 
@@ -141,9 +140,8 @@ public class REST_Quads extends SPARQL_R
             name = name+(++counter) ;
             Node gn = Node.createURI(name) ;
             Graph g = dsg.getGraph(gn) ;
-            Sink<Triple> sink = new SinkTriplesToGraph(g) ;
-
-            LangRIOT parser = RiotReader.createParserTriples(action.request.getInputStream(), lang, name , sink) ;
+            RDFParserOutput dest = RDFParserOutputLib.graph(g) ;
+            LangRIOT parser = RiotReader.createParserTriples(action.request.getInputStream(), lang, name , dest) ;
             parser.parse() ;
             log.info(format("[%d] Location: %s", action.id, name)) ;
             action.response.setHeader("Location",  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=1422689&r1=1422688&r2=1422689&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 Sun Dec 16 21:11:51 2012
@@ -38,23 +38,22 @@ import javax.servlet.ServletException ;
 import javax.servlet.http.HttpServletRequest ;
 import javax.servlet.http.HttpServletResponse ;
 
-import org.apache.jena.atlas.lib.Sink ;
 import org.apache.jena.atlas.web.ContentType ;
 import org.apache.jena.fuseki.FusekiLib ;
 import org.apache.jena.fuseki.HttpNames ;
 import org.apache.jena.fuseki.http.HttpSC ;
 import org.apache.jena.fuseki.server.DatasetRef ;
+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.IRIResolver ;
 import org.openjena.riot.* ;
-import org.openjena.riot.lang.LangRIOT ;
-import org.openjena.riot.lang.SinkTriplesToGraph ;
-import org.openjena.riot.system.IRIResolver ;
 import org.slf4j.Logger ;
 import org.slf4j.LoggerFactory ;
 
 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.sparql.core.DatasetGraph ;
 import com.hp.hpl.jena.sparql.core.DatasetGraphFactory ;
 import com.hp.hpl.jena.sparql.graph.GraphFactory ;
@@ -358,16 +357,13 @@ public abstract class SPARQL_REST extend
     private static DatasetGraph parse(HttpActionREST action, Lang lang, String base, InputStream input)
     {
         Graph graphTmp = GraphFactory.createGraphMem() ;
-        Sink<Triple> sink = new SinkTriplesToGraph(graphTmp) ;
-        LangRIOT parser = RiotReader.createParserTriples(input, lang, base, sink) ;
+        
+        RDFParserOutput dest = RDFParserOutputLib.graph(graphTmp) ;
+        LangRIOT parser = RiotReader.createParserTriples(input, lang, base, dest) ;
         parser.getProfile().setHandler(errorHandler) ;
-        try {
-            parser.parse() ;
-        } 
+        try { parser.parse() ; } 
         catch (RiotException ex) { errorBadRequest("Parse error: "+ex.getMessage()) ; }
-        finally { sink.close() ; }
         DatasetGraph dsgTmp = DatasetGraphFactory.create(graphTmp) ;
-        
         return dsgTmp ;
     }
     

Modified: jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Update.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Update.java?rev=1422689&r1=1422688&r2=1422689&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Update.java (original)
+++ jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Update.java Sun Dec 16 21:11:51 2012
@@ -43,8 +43,8 @@ import org.apache.jena.fuseki.HttpNames 
 import org.apache.jena.fuseki.http.HttpSC ;
 import org.apache.jena.fuseki.server.DatasetRef ;
 import org.apache.jena.iri.IRI ;
+import org.apache.jena.riot.system.IRIResolver ;
 import org.openjena.riot.WebContent ;
-import org.openjena.riot.system.IRIResolver ;
 
 import com.hp.hpl.jena.graph.Node ;
 import com.hp.hpl.jena.query.QueryParseException ;

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=1422689&r1=1422688&r2=1422689&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 Sun Dec 16 21:11:51 2012
@@ -31,22 +31,21 @@ import org.apache.commons.fileupload.Fil
 import org.apache.commons.fileupload.FileItemStream ;
 import org.apache.commons.fileupload.servlet.ServletFileUpload ;
 import org.apache.commons.fileupload.util.Streams ;
-import org.apache.jena.atlas.lib.Sink ;
 import org.apache.jena.atlas.web.ContentType ;
 import org.apache.jena.fuseki.FusekiLib ;
 import org.apache.jena.fuseki.HttpNames ;
 import org.apache.jena.fuseki.http.HttpSC ;
 import org.apache.jena.fuseki.server.DatasetRef ;
 import org.apache.jena.iri.IRI ;
+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.IRIResolver ;
 import org.openjena.riot.* ;
-import org.openjena.riot.lang.LangRIOT ;
-import org.openjena.riot.lang.SinkTriplesToGraph ;
-import org.openjena.riot.system.IRIResolver ;
 
 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.sparql.graph.GraphFactory ;
 
 public class SPARQL_Upload extends SPARQL_ServletBase 
@@ -204,16 +203,13 @@ public class SPARQL_Upload extends SPARQ
 
                     // We read into a in-memory graph, then (if successful) update the dataset.
                     // This isolates errors.
-                    Sink<Triple> sink = new SinkTriplesToGraph(graphDst) ;
-                    LangRIOT parser = RiotReader.createParserTriples(stream, lang, base, sink) ;
+                    RDFParserOutput dest = RDFParserOutputLib.graph(graphDst) ;
+                    LangRIOT parser = RiotReader.createParserTriples(stream, lang, base, dest) ;
                     parser.getProfile().setHandler(errorHandler) ;
                     log.info(format("[%d] Upload: Filename: %s, Content-Type=%s, Charset=%s => %s", 
                                     action.id, name,  ct.getContentType(), ct.getCharset(), lang.getName())) ;
-                    try {
-                        parser.parse() ;
-                    } 
+                    try { parser.parse() ; }
                     catch (RiotException ex) { errorBadRequest("Parse error: "+ex.getMessage()) ; }
-                    finally { sink.close() ; }
                 }
             }    
 

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=1422689&r1=1422688&r2=1422689&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 Sun Dec 16 21:11:51 2012
@@ -31,16 +31,17 @@ import javax.servlet.http.HttpServletRes
 
 import org.apache.jena.atlas.io.IO ;
 import org.apache.jena.atlas.lib.Sink ;
-import org.apache.jena.atlas.lib.SinkWrapper ;
 import org.apache.jena.fuseki.FusekiLib ;
+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.RiotLib ;
 import org.apache.jena.riot.tokens.Tokenizer ;
 import org.apache.jena.riot.tokens.TokenizerFactory ;
 import org.openjena.riot.ErrorHandler ;
 import org.openjena.riot.Lang ;
 import org.openjena.riot.RiotException ;
 import org.openjena.riot.RiotReader ;
-import org.openjena.riot.lang.LangRIOT ;
-import org.openjena.riot.system.RiotLib ;
 
 import com.hp.hpl.jena.graph.Node ;
 import com.hp.hpl.jena.sparql.core.Quad ;
@@ -163,22 +164,9 @@ public class DataValidator extends Valid
             public void flush() {}
             String formatNode(Node n) { return FmtUtils.stringForNode(n, sCxt) ; }
         } ;
-        
-        Sink<Quad> sink2 = new SinkWrapper<Quad>(sink){
-            long count = 0 ;
-            @Override public void close() {}
-            @Override public void flush() {}
-            @Override 
-            public void send(Quad quad)
-            { 
-                super.send(quad) ;
-                count++ ;
-                if ( count > LIMIT )
-                    throw new RiotException("Limit exceeded") ;
-            }
-        } ;
-        // Language?
-        LangRIOT parser = RiotReader.createParserQuads(tokenizer, language, null, sink) ;
+
+        RDFParserOutput dest = RDFParserOutputLib.sinkQuads(sink) ;
+        LangRIOT parser = RiotReader.createParserQuads(tokenizer, language, null, dest) ;
         // Don't resolve IRIs.  Do checking.
         parser.setProfile(RiotLib.profile(null, false, true, errorHandler)) ;
         return parser ;

Modified: jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/IRIValidator.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/IRIValidator.java?rev=1422689&r1=1422688&r2=1422689&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/IRIValidator.java (original)
+++ jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/validation/IRIValidator.java Sun Dec 16 21:11:51 2012
@@ -29,7 +29,7 @@ import javax.servlet.http.HttpServletRes
 import org.apache.jena.iri.IRI ;
 import org.apache.jena.iri.IRIFactory ;
 import org.apache.jena.iri.Violation ;
-import org.openjena.riot.system.IRIResolver ;
+import org.apache.jena.riot.system.IRIResolver ;
 
 public class IRIValidator extends ValidatorBase
 {

Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/TDB.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/TDB.java?rev=1422689&r1=1422688&r2=1422689&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/TDB.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/TDB.java Sun Dec 16 21:11:51 2012
@@ -22,8 +22,8 @@ import java.util.Iterator ;
 
 import org.apache.jena.atlas.iterator.Iter ;
 import org.apache.jena.atlas.lib.Sync ;
+import org.apache.jena.riot.lang.LangRDFXML ;
 import org.openjena.riot.SysRIOT ;
-import org.openjena.riot.lang.LangRDFXML ;
 import org.slf4j.Logger ;
 import org.slf4j.LoggerFactory ;
 

Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/lib/NodeFmtLib.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/lib/NodeFmtLib.java?rev=1422689&r1=1422688&r2=1422689&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/lib/NodeFmtLib.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/lib/NodeFmtLib.java Sun Dec 16 21:11:51 2012
@@ -19,9 +19,9 @@
 package com.hp.hpl.jena.tdb.lib;
 
 import org.apache.jena.atlas.lib.Chars ;
-import org.openjena.riot.system.PrefixMap ;
-import org.openjena.riot.system.Prologue ;
-import org.openjena.riot.system.RiotChars ;
+import org.apache.jena.riot.system.PrefixMap ;
+import org.apache.jena.riot.system.Prologue ;
+import org.apache.jena.riot.system.RiotChars ;
 
 import com.hp.hpl.jena.graph.Node ;
 import com.hp.hpl.jena.graph.Node_Literal ;

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=1422689&r1=1422688&r2=1422689&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 Sun Dec 16 21:11:51 2012
@@ -33,9 +33,9 @@ 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.logging.Log ;
+import org.apache.jena.riot.system.SinkExtendTriplesToQuads ;
 import org.openjena.riot.Lang ;
 import org.openjena.riot.RiotLoader ;
-import org.openjena.riot.system.SinkExtendTriplesToQuads ;
 import org.slf4j.Logger ;
 import tdb.cmdline.CmdTDB ;
 import arq.cmd.CmdException ;



Mime
View raw message