You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by bu...@apache.org on 2013/01/24 12:06:29 UTC

svn commit: r847768 - in /websites/staging/jena/trunk/content: ./ documentation/io/index.html

Author: buildbot
Date: Thu Jan 24 11:06:29 2013
New Revision: 847768

Log:
Staging update by buildbot for jena

Modified:
    websites/staging/jena/trunk/content/   (props changed)
    websites/staging/jena/trunk/content/documentation/io/index.html

Propchange: websites/staging/jena/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Thu Jan 24 11:06:29 2013
@@ -1 +1 @@
-1437111
+1437954

Modified: websites/staging/jena/trunk/content/documentation/io/index.html
==============================================================================
--- websites/staging/jena/trunk/content/documentation/io/index.html (original)
+++ websites/staging/jena/trunk/content/documentation/io/index.html Thu Jan 24 11:06:29 2013
@@ -168,6 +168,7 @@
 <li><a href="#configuring-a-streammanager">Configuring a <code>StreamManager</code></a></li>
 <li><a href="#configuring-a-locationmapper">Configuring a <code>LocationMapper</code></a></li>
 <li><a href="#advanced-examples">Advanced examples</a></li>
+<li><a href="#iterating-over-parser-output">Iterating over parser output</a></li>
 <li><a href="#filter-the-output-of-parsing">Filtering the output of parsing</a></li>
 <li><a href="#add-a-new-language">Add a new language</a></li>
 </ul>
@@ -428,6 +429,20 @@ configuration file is necessary.</p>
 <li>org.apache.jena.riot.stream.LocationMapper</li>
 </ul>
 <h2 id="advanced-examples">Advanced examples</h2>
+<h3 id="iterating-over-parser-output">Iterating over parser output</h3>
+<p>One of the capabilities of the RIOT API is the ability to treat parser output as an iterator, 
+this is useful when you don't want to go to the trouble of writing a full sink implementation and can easily express your
+logic in normal iterator style.</p>
+<p>To do this you use one of the subclasses of <a href="http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/StreamedRDFIterator.java?view=markup">StreamedRDFIterator</a>
+which is an abstract class that implements the <a href="http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/RDFParserOutputIterator.java?view=markup">RDFParserOutputIterator</a> interface.
+This interface provides an implementation of StreamRDF which allows it to consume parser output and an implementation
+of a standard Java iterator allowing it to provide output in the normal iterator paradigm.  This has some advantages
+over a direct StreamRDF implementation since it allows the parser production of data to run
+ahead of your consumption of data which may result in better overall throughput.</p>
+<p>The only complication is that you need to ensure that the parser and the consumer of the iterator are on different threads
+as otherwise you can run into a deadlock situation where one is waiting on data from the other which is never started.</p>
+<p>See <a href="https://svn.apache.org/repos/asf/jena/trunk/jena-arq/src-examples/arq/examples/riot/ExRIOT_6.java">RIOT example 6</a> 
+which shows an example usage including a simple way to push the parser onto a different thread to avoid the possible deadlock.</p>
 <h3 id="filter-the-output-of-parsing">Filter the output of parsing</h3>
 <p>When working with very large files, it can be useful to process the stream of triples or quads produced
 by the parser so as to work in a streaming fashion.</p>