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 2020/09/20 10:03:16 UTC

[jena-site] branch ttl-write updated (f469f3a -> 6ce7706)

This is an automated email from the ASF dual-hosted git repository.

andy pushed a change to branch ttl-write
in repository https://gitbox.apache.org/repos/asf/jena-site.git.


 discard f469f3a  Turtle writer options
     new 6ce7706  Turtle writer options

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (f469f3a)
            \
             N -- N -- N   refs/heads/ttl-write (6ce7706)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 source/documentation/io/rdf-output.md | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)


[jena-site] 01/01: Turtle writer options

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

andy pushed a commit to branch ttl-write
in repository https://gitbox.apache.org/repos/asf/jena-site.git

commit 6ce77067c769ddd8c9d74a6a1ae04f78fefa06c4
Author: Andy Seaborne <an...@apache.org>
AuthorDate: Sun Sep 20 11:00:19 2020 +0100

    Turtle writer options
---
 source/documentation/io/rdf-output.md   | 70 ++++++++++++++++++++++++++++-----
 source/documentation/io/streaming-io.md |  2 +-
 2 files changed, 62 insertions(+), 10 deletions(-)

diff --git a/source/documentation/io/rdf-output.md b/source/documentation/io/rdf-output.md
index 21b269c..67e2e6a 100644
--- a/source/documentation/io/rdf-output.md
+++ b/source/documentation/io/rdf-output.md
@@ -14,6 +14,7 @@ See [Reading RDF](rdf-input.html) for details of the RIOT Reader system.
   - [Pretty Printed Languages](#pretty-printed-languages)
   - [Streamed Block Formats](#streamed-block-formats)
   - [Line printed formats](#line-printed-formats)
+  - [Turtle and Trig format options](#opt-turtle-trig)
   - [N-Triples and N-Quads](#n-triples-and-n-quads)
   - [JSON-LD](#json-ld)
   - [RDF Binary](#rdf-thrift)
@@ -24,7 +25,7 @@ See [Reading RDF](rdf-input.html) for details of the RIOT Reader system.
 See [Advanced RDF/XML Output](rdfxml_howto.html#advanced-rdfxml-output) 
 for details of the Jena RDF/XML writer.
 
-## API
+## API {#api}
 
 There are two ways to write RDF data using Apache Jena RIOT, 
 either via the `RDFDataMgr` 
@@ -43,7 +44,7 @@ names Jena has supported before RIOT.
 
 Many variations of these methods exist.  See the full javadoc for details.
 
-## `RDFFormat`
+## `RDFFormat` {#rdfformat}
 
 Output using RIOT depends on the format, which involves both the language (syntax)
 being written and the variant of that syntax. 
@@ -204,7 +205,7 @@ Formats:
 | TURTLE_BLOCKS  |
 | TRIG_BLOCKS    |
 
-### Line printed formats
+### Line printed formats {#line-printed-formats}
 
 There are writers for Turtle and Trig that use the abbreviated formats for
 prefix names and short forms for literals. They write each triple or quad
@@ -240,7 +241,58 @@ but always writes one complete triple on one line (no use of `;`).
 | TURTLE_FLAT |
 | TRIG_FLAT   |
 
-### N-Triples and N-Quads
+### Turtle and Trig format options {#opt-turtle-trig}
+
+Some context settings affect the output of Turtle and TriG writers. Unless
+otherwise noted, the settign applies to both Turtle and TriG.
+
+| Context setting | Cmd line | Values |
+|-----------------|----------|--|
+| RIOT.symTurtleDirectiveStyle | "ttl:directiveStyle" | "sparql", "rdf11", "at", "n3" |
+| RIOT.symTurtleOmitBase       | "ttl:omitBase"       | "true", "false" |
+
+<p>&nbsp;</p>
+
+| Directive Style | Effect |
+|------------------|-------|
+| "sparql", "rdf11"    | Use `PREFIX` and `BASE` in output.   |
+| "at", "n3"           | Use `@prefix` and `@base` in output. |
+| unset                | Use `@prefix` and `@base` in output. |
+
+<p>&nbsp;</b>
+
+#### Format Option Usage
+
+##### _Setting directive style_
+```
+    riot --set ttl:directiveStyle=sparql --pretty Turtle file1.rdf file2.nt ...
+```
+and in code:
+```
+  RDFWriter.create()
+     .set(RIOT.symTurtleDirectiveStyle, "sparql")
+     .lang(Lang.TTL)
+     .source(model)
+     .output(System.out);
+```
+##### _Base URI_
+
+Output can be written with relative URIs and no base. Note: such output is not
+portable; it's meaning depends on the base URI at the time of reading.
+
+Turtle and Trig can be written with relative URIs by
+setting the base URI for writing and switching off output of the base URI.
+
+```
+  RDFWriter.create()
+     .base("http://host/someBase")
+     .set(RIOT.symTurtleOmitBase, true)
+     .lang(Lang.TTL)
+     .source(model)
+     .output(System.out);
+```
+
+### N-Triples and N-Quads {#n-triples-and-n-quads}
 
 These provide the formats that are fastest to write, 
 and data of any size can be output.  They do not use any
@@ -289,7 +341,7 @@ in ASCII (using `\u` escape sequences for non-ASCI characters where necessary).
 | NTRIPLES_ASCII  |
 | NQUADS_ASCII    |
 
-### JSON-LD
+### JSON-LD {#json-ld}
 
 JSON-LD output is supported, in its various flavors 
 ("compacted", "expanded", "flattened", "framed"), 
@@ -317,7 +369,7 @@ cases.
 What can be done, and how it can be, is explained in the 
 [sample code](https://github.com/apache/jena/tree/master/jena-arq/src-examples/arq/examples/riot/Ex_WriteJsonLD.java).
 
-### RDF Binary
+### RDF Binary {#rdf-thrift}
 
 [This is a binary encoding](rdf-binary.html) using 
 [Apache Thrift](https://thrift.apache.org/) for RDF Graphs
@@ -334,7 +386,7 @@ not as lexical format and datatype.  See the
 [description of RDF Thrift](http://afs.github.io/rdf-thrift)
 for discussion.
 
-### RDF/XML
+### RDF/XML {#rdfxml}
 
 RIOT supports output in RDF/XML. RIOT RDFFormats defaults to pretty printed RDF/XML,
 while the jena writer name defaults to a streaming plain output.
@@ -344,7 +396,7 @@ while the jena writer name defaults to a streaming plain output.
 | RDFXML    | RDFXML_PRETTY, RDF_XML_ABBREV | "RDF/XML-ABBREV" |
 | RDFXML_PLAIN |                            | "RDF/XML"        |
 
-## Examples
+## Examples {#examples}
 
 Example code may be found in [jena-arq/src-examples](https://github.com/apache/jena/tree/master/jena-arq/src-examples/arq/examples/riot/).
 
@@ -402,7 +454,7 @@ might give:
 A complete example of adding a new output format is given in the example file: 
 [RIOT Output example 3](https://github.com/apache/jena/tree/master/jena-arq/src-examples/arq/examples/riot/ExRIOT_out3.java)
 
-## Notes
+## Notes {#notes}
 
 Using `OutputStream`s is strongly encouraged.  This allows the writers
 to manage the character encoding using UTF-8.  Using `java.io.Writer` 
diff --git a/source/documentation/io/streaming-io.md b/source/documentation/io/streaming-io.md
index 84c2eb4..c26348f 100644
--- a/source/documentation/io/streaming-io.md
+++ b/source/documentation/io/streaming-io.md
@@ -45,7 +45,7 @@ and also parser events for prefix settings and base URI declarations.
 There are utilities to help:
 
 * [`StreamRDFLib`](/documentation/javadoc/arq/org/apache/jena/riot/system/StreamRDFLib.html) &ndash; create `StreamRDF` objects
-* [`StreamOps`](/documentation/javadoc/arq/org/apache/jena/riot/system/StreamOps.html) &ndash; helpers for sending RDF data to `StreamRDF` objects
+* [`StreamRDFOps`](/documentation/javadoc/arq/org/apache/jena/riot/system/StreamOps.html) &ndash; helpers for sending RDF data to `StreamRDF` objects
 
 ## Reading data