jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1444213 - /jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/StreamRDFLib.java
Date Fri, 08 Feb 2013 20:15:20 GMT
Author: andy
Date: Fri Feb  8 20:15:20 2013
New Revision: 1444213

URL: http://svn.apache.org/r1444213
Log:
Add convenience operations to push iterators to streams.

Modified:
    jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/StreamRDFLib.java

Modified: jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/StreamRDFLib.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/StreamRDFLib.java?rev=1444213&r1=1444212&r2=1444213&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/StreamRDFLib.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/StreamRDFLib.java Fri Feb
 8 20:15:20 2013
@@ -18,6 +18,8 @@
 
 package org.apache.jena.riot.system;
 
+import java.util.Iterator ;
+
 import org.apache.jena.atlas.lib.Sink ;
 import org.apache.jena.atlas.lib.Tuple ;
 import org.apache.jena.riot.lang.RDFParserOutputCounting ;
@@ -38,6 +40,27 @@ public class StreamRDFLib
     
     public static StreamRDF dataset(DatasetGraph dataset)    { return new ParserOutputDataset(dataset)
; }
     
+    /** Set triples to a StreamRDF - does not all .start/.finish */ 
+    public static void triplesToStream(StreamRDF dest, Iterator<Triple> iter)
+    {
+        for ( ; iter.hasNext() ; )
+        {
+            Triple t = iter.next() ;
+            dest.triple(t) ;
+        }
+    }
+
+    /** Set quads to a StreamRDF - does not all .start/.finish */ 
+    public static void quadsToStream(StreamRDF dest, Iterator<Quad> iter)
+    {
+        for ( ; iter.hasNext() ; )
+        {
+            Quad q = iter.next() ;
+            dest.quad(q) ;
+        }
+    }
+
+    
     /** 
      * Output to a sink; prefix and base handled only within the parser.
      * Unfortunately, Java needs different names for the triples and 



Mime
View raw message