You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2015/03/04 13:13:19 UTC
svn commit: r1663962 -
/jena/site/trunk/content/documentation/io/streaming-io.mdtext
Author: andy
Date: Wed Mar 4 12:13:18 2015
New Revision: 1663962
URL: http://svn.apache.org/r1663962
Log:
Revisions to streaming I/O documentation
Modified:
jena/site/trunk/content/documentation/io/streaming-io.mdtext
Modified: jena/site/trunk/content/documentation/io/streaming-io.mdtext
URL: http://svn.apache.org/viewvc/jena/site/trunk/content/documentation/io/streaming-io.mdtext?rev=1663962&r1=1663961&r2=1663962&view=diff
==============================================================================
--- jena/site/trunk/content/documentation/io/streaming-io.mdtext (original)
+++ jena/site/trunk/content/documentation/io/streaming-io.mdtext Wed Mar 4 12:13:18 2015
@@ -15,12 +15,13 @@ extension. `data.nt.gz` is a parsed as
## `StreamRDF`
-The central abstraction is `StreamRDF` which is an interface for streamed
-RDF data. It covers triples and quads, and also parser events such as
-prefix settings and base URI declarations.
+The central abstraction is
+[`StreamRDF`](/documentation/javadoc/arq/org/apache/jena/riot/system/StreamRDF.html)
+which is an interface for streamed RDF data. It covers triples and quads,
+and also parser events for prefix settings and base URI declarations.
public interface StreamRDF {
- /** Start parsing */
+ /** Start processing */
public void start() ;
/** Triple emitted */
@@ -35,30 +36,32 @@ prefix settings and base URI declaration
/** prefix declaration seen */
public void prefix(String prefix, String iri) ;
- /** Finish parsing */
+ /** Finish processing */
public void finish() ;
}
There are utilities to help:
-* `StreamRDFLib` -- create `StreamRDF` objects
-* `StreamOps` -- helpers for sending RDF data to `StreamRDF` objects
+* [`StreamRDFLib`](/documentation/javadoc/arq/org/apache/jena/riot/system/StreamRDFLib.html) -- create `StreamRDF` objects
+* [`StreamOps`](/documentation/javadoc/arq/org/apache/jena/riot/system/StreamOps.html) -- helpers for sending RDF data to `StreamRDF` objects
## Reading data
-All parses of RDF syntaxes provided by RIOT are streaming with the
+All parsers of RDF syntaxes provided by RIOT are streaming with the
exception of JSON-LD. A JSON object can have members in any order so the
parser may need the whole top-level object in order to have the information
needed for parsing.
-The `parse` functions of `RDFDataMgr` direct the output of the parser to a
-`StreamRDF`. For example:
+The [`parse` functions](/documentation/javadoc/arq/org/apache/jena/riot/RDFDataMgr.html#parse%28org.apache.jena.riot.system.StreamRDF%2C%20java.io.InputStream%2C%20org.apache.jena.riot.Lang%29
+of [RDFDataMgr](/documentation/javadoc/arq/org/apache/jena/riot/RDFDataMgr.html)
- StreamRDF destinination = ...
+`RDFDataMgr` directs the output of the parser to a `StreamRDF`. For example:
+
+ StreamRDF destination = ...
RDFDataMgr.parse(destination, "http://example/data.ttl") ;
-reads the remote URL, with content negotiation, and send the triples to the
-`destination`.
+The above code reads the remote URL, with content negotiation, and send the
+triples to the `destination`.
## Writing data
@@ -73,20 +76,23 @@ that is necessarily "less pretty".
See ["Streamed Block Formats"](rdf-output.html#streamed-block-formats)
for details.
-The `StreamRDFWriter` class has functions that write graphs and datasets
+The [`StreamRDFWriter`](/documentation/javadoc/arq/org/apache/jena/riot/system/StreamRDFWriter.html)
+class has functions that write graphs and datasets
using a streaming writer and also provides for the creation of
-an`StreamRDF` backed by a stream-based writer
+an `StreamRDF` backed by a stream-based writer
- StreamWriter.write(output, model.getGraph(), lang) ;
+ StreamRDFWriter.write(output, model.getGraph(), lang) ;
which can be done as:
- StreamRDF writer = StreamWriter.getWriterStream(output, lang) ;
+ StreamRDF writer = StreamRDFWriter.getWriterStream(output, lang) ;
StreamOps.graphToStream(writer, model.getGraph()) ;
N-Triples and N-Quads are always written as a stream.
-| RDFFormat | Lang shortcut |
+## RDFFormat and Lang
+
+| [RDFFormat](/documentation/javadoc/arq/org/apache/jena/riot/RDFFormat.html) | [Lang](/documentation/javadoc/arq/org/apache/jena/riot/Lang.html) shortcut |
|----------------------------|------------------|
| `RDFFormat.TURTLE_BLOCKS` | `Lang.TURTLE` |
| `RDFFormat.TURTLE_FLAT` | |