This is an automated email from the ASF dual-hosted git repository. andy pushed a commit to branch main5 in repository https://gitbox.apache.org/repos/asf/jena-site.git
commit 06e8207b2d3f0819d6236a7fcc5e87cf5d8a6e1f Author: Andy Seaborne <[email protected]> AuthorDate: Sun Mar 17 17:45:17 2024 +0000 Updates for use of PREFIX, not @prefix --- source/documentation/io/__index.md | 12 ++--- source/documentation/io/rdf-input.md | 2 +- source/documentation/io/rdf-output.md | 69 +++++++++++++-------------- source/documentation/notes/sse.md | 15 ------ source/documentation/notes/stream-manager.md | 2 +- source/documentation/permissions/assembler.md | 2 +- source/documentation/permissions/example.md | 16 +++---- source/documentation/query/text-query.md | 14 +++--- source/documentation/rdf/__index.md | 4 +- source/documentation/rdf/datasets.md | 4 +- 10 files changed, 59 insertions(+), 81 deletions(-) diff --git a/source/documentation/io/__index.md b/source/documentation/io/__index.md index 7a19f6ba9..9c9637da6 100644 --- a/source/documentation/io/__index.md +++ b/source/documentation/io/__index.md @@ -10,7 +10,6 @@ This page details the setup of RDF I/O technology (RIOT). * [Reading RDF in Jena](rdf-input.html) * [Writing RDF in Jena](rdf-output.html) * [Working with RDF Streams](streaming-io.html) -* [Additional details on working with RDF/XML](rdfxml-io.html) ## Formats @@ -18,20 +17,18 @@ The following RDF formats are supported by Jena. In addition, other syntaxes can be integrated into both the parser and writer registries. - Turtle -- RDF/XML -- N-Triples - JSON-LD -- RDF/JSON -- TriG +- N-Triples - N-Quads +- TriG +- RDF/XML - TriX +- RDF/JSON - RDF Binary RDF/JSON is different from JSON-LD - it is a direct encoding of RDF triples in JSON. See the [description of RDF/JSON](rdf-json.html). -From Jena 4.5.0, JSON-LD 1.1 is the main supported version of JSON-LD. - RDF Binary is a binary encoding of RDF (graphs and datasets) that can be useful for fast parsing. See [RDF Binary](rdf-binary.html). @@ -97,7 +94,6 @@ get command line reminders): - `--formatted=FORMAT`: Output in a given syntax, using pretty printing. - `--stream=FORMAT`: Output in a given syntax, streaming (not all syntaxes can be streamed). - To aid in checking for errors in UTF8-encoded files, there is a utility which reads a file of bytes as UTF8 and checks the encoding. diff --git a/source/documentation/io/rdf-input.md b/source/documentation/io/rdf-input.md index 265fa3d1e..e6ce450ab 100644 --- a/source/documentation/io/rdf-input.md +++ b/source/documentation/io/rdf-input.md @@ -184,7 +184,7 @@ copies of import http resources). Location mapping files are RDF, usually written in Turtle although an RDF syntax can be used. - @prefix lm: <http://jena.hpl.hp.com/2004/08/location-mapping#> . + PREFIX lm: <http://jena.hpl.hp.com/2004/08/location-mapping#> [] lm:mapping [ lm:name "file:foo.ttl" ; lm:altName "file:etc/foo.ttl" ] , diff --git a/source/documentation/io/rdf-output.md b/source/documentation/io/rdf-output.md index 32f4030bb..17e4e15f5 100644 --- a/source/documentation/io/rdf-output.md +++ b/source/documentation/io/rdf-output.md @@ -22,9 +22,6 @@ See [Reading RDF](rdf-input.html) for details of the RIOT Reader system. - [Examples](#examples) - [Notes](#notes) -See [Advanced RDF/XML Output](rdfxml_howto.html#advanced-rdfxml-output) -for details of the Jena RDF/XML writer. - ## API {#api} There are two ways to write RDF data using Apache Jena RIOT, @@ -136,10 +133,10 @@ or write N-triples/N-Quads. Example: - @prefix : <http://example/> . - @prefix dc: <http://purl.org/dc/elements/1.1/> . - @prefix foaf: <http://xmlns.com/foaf/0.1/> . - @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . + PREFIX : <http://example/> + PREFIX dc: <http://purl.org/dc/elements/1.1/> + PREFIX foaf: <http://xmlns.com/foaf/0.1/> + PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> :book dc:author ( :a :b ) . @@ -183,10 +180,10 @@ to use the short label form. Example: - @prefix : <http://example/> . - @prefix dc: <http://purl.org/dc/elements/1.1/> . - @prefix foaf: <http://xmlns.com/foaf/0.1/> . - @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . + PREFIX dc: <http://purl.org/dc/elements/1.1/> + PREFIX : <http://example/> + PREFIX foaf: <http://xmlns.com/foaf/0.1/> + PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> :book dc:author _:b0 . @@ -225,10 +222,10 @@ Example: The FLAT writers abbreviates IRIs, literals and blank node labels but always writes one complete triple on one line (no use of `;`). - @prefix : <http://example/> . - @prefix dc: <http://purl.org/dc/elements/1.1/> . - @prefix foaf: <http://xmlns.com/foaf/0.1/> . - @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . + PREFIX : <http://example/> + PREFIX dc: <http://purl.org/dc/elements/1.1/> + PREFIX foaf: <http://xmlns.com/foaf/0.1/> + PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> _:b0 foaf:name "Bob" . :book dc:author _:b1 . _:b2 rdf:rest rdf:nil . @@ -263,8 +260,8 @@ otherwise noted, the setting applies to both Turtle and TriG. | 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. | +| "at", "rdf10 | Use `@prefix` and `@base` in output. | +| unset | Use `PREFIX` and `BASE` in output. | <p> </b> @@ -272,7 +269,7 @@ otherwise noted, the setting applies to both Turtle and TriG. ##### _Setting directive style_ ``` - riot --set ttl:directiveStyle=sparql --pretty Turtle file1.rdf file2.nt ... + riot --set ttl:directiveStyle=rdf11 --pretty Turtle file1.rdf file2.nt ... ``` and in code: ``` @@ -288,7 +285,7 @@ and in code: ``` and in code: ``` -RDFWriter.source(model) + RDFWriter.source(model) .format(RDFFormat.TURTLE_LONG) .output(System.out); ``` @@ -438,6 +435,8 @@ while the jena writer name defaults to a streaming plain output. | RDFXML | RDFXML_PRETTY, RDF_XML_ABBREV | "RDF/XML-ABBREV" | | RDFXML_PLAIN | | "RDF/XML" | +More details [RDF/XML Output](rdfxml-io.html#rdfxml-output). + ## Examples {#examples} Example code may be found in [jena-examples:arq/examples](https://github.com/apache/jena/tree/main/jena-examples/src/main/java/arq/examples/riot/). @@ -446,27 +445,27 @@ Example code may be found in [jena-examples:arq/examples](https://github.com/apa The follow ways are different ways to write a model in Turtle: - Model model = ... ; + Model model = ... ; - // Write a model in Turtle syntax, default style (pretty printed) - RDFDataMgr.write(System.out, model, Lang.TURTLE) ; + // Write a model in Turtle syntax, default style (pretty printed) + RDFDataMgr.write(System.out, model, Lang.TURTLE) ; - // Write Turtle to the blocks variant - RDFDataMgr.write(System.out, model, RDFFormat.TURTLE_BLOCKS) ; + // Write Turtle to the blocks variant + RDFDataMgr.write(System.out, model, RDFFormat.TURTLE_BLOCKS) ; - // Write as Turtle via model.write - model.write(System.out, "TTL") ; + // Write as Turtle via model.write + model.write(System.out, "TTL") ; ### Ways to write a dataset The preferred style is to use `RDFDataMgr`: - Dataset ds = .... ; - // Write as TriG - RDFDataMgr.write(System.out, ds, Lang.TRIG) ; + Dataset ds = .... ; + // Write as TriG + RDFDataMgr.write(System.out, ds, Lang.TRIG) ; - // Write as N-Quads - RDFDataMgr.write(System.out, dataset, Lang.NQUADS) ; + // Write as N-Quads + RDFDataMgr.write(System.out, dataset, Lang.NQUADS) ; Additionally, a single model can be written in a dataset format - it becomes the default graph of the dataset. @@ -476,10 +475,10 @@ the default graph of the dataset. might give: - @prefix : <http://example/> . - @prefix dc: <http://purl.org/dc/elements/1.1/> . - @prefix foaf: <http://xmlns.com/foaf/0.1/> . - @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . + PREFIX : <http://example/> + PREFIX dc: <http://purl.org/dc/elements/1.1/> + PREFIX foaf: <http://xmlns.com/foaf/0.1/> + PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> { :book dc:author ( :a :b ) . diff --git a/source/documentation/notes/sse.md b/source/documentation/notes/sse.md index 7f806ca35..5930da6e8 100644 --- a/source/documentation/notes/sse.md +++ b/source/documentation/notes/sse.md @@ -295,21 +295,6 @@ There is a default prefix mapping with a few common prefixes: `rdf`, `rdfs`, `owl`, `xsd` and `fn` (the XPath/XQuery functions and operators namespace). -## Mapping to RDF - -The syntax of SSE is very close to Turtle lists because the syntax for -IRIs and literals are the same.: to produce Turtle (outline): - -1. Replace symbols by IRIs: prepend a common URI and %-encode any - characters necessary. -2. Replace variables by IRIs: prepend a common URI. -3. Move prefixes to be `@prefix` directives. -4. Put a dot at the end of the file. - -The result is an RDF model using only the properties `rdf:first` and -`rdf:rest` so it records the data structure, but not what the data -structure represents. - ## SSE Files The file extension is `.sse` and all files are UTF-8. diff --git a/source/documentation/notes/stream-manager.md b/source/documentation/notes/stream-manager.md index d404e41e4..5527bdd6e 100644 --- a/source/documentation/notes/stream-manager.md +++ b/source/documentation/notes/stream-manager.md @@ -35,7 +35,7 @@ Location mapping files are RDF - they may be written in RDF/XML, Turtle (file suffix `.ttl`) or N-Triples (file suffix `.nt`). The default is RDF/XML unless one of these suffices is found. - @prefix lm: <http://jena.hpl.hp.com/2004/08/location-mapping#> . + PREFIX lm: <http://jena.hpl.hp.com/2004/08/location-mapping#> [] lm:mapping [ lm:name "file:foo.ttl" ; lm:altName "file:etc/foo.ttl" ] , diff --git a/source/documentation/permissions/assembler.md b/source/documentation/permissions/assembler.md index 8071b5e70..ae534a9a5 100644 --- a/source/documentation/permissions/assembler.md +++ b/source/documentation/permissions/assembler.md @@ -11,7 +11,7 @@ The secured assembler provides XXXXXXXXXXXx properties for the assembler files. Assuming we define: - @prefix sec: <http://apache.org/jena/permissions/Assembler#> . + PREFIX sec: <http://apache.org/jena/permissions/Assembler#> Then the following resources are defined: diff --git a/source/documentation/permissions/example.md b/source/documentation/permissions/example.md index decb311e5..0d09cde7f 100644 --- a/source/documentation/permissions/example.md +++ b/source/documentation/permissions/example.md @@ -10,8 +10,6 @@ To do this you will need a Fuseki installation, the Permissions Packages and a S ## Set up -This example uses Fuseki 2.3.0 or higher, Permissions 3.1.0 or higher and Apache Commons Collections v4. - Fuseki can be downloaded from: <https://repository.apache.org/content/repositories/releases/org/apache/jena/apache-jena-fuseki/> @@ -74,13 +72,13 @@ graph. Define all the prefixes. - @prefix fuseki: <http://jena.apache.org/fuseki#> . - @prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> . - @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . - @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . - @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . - @prefix perm: <http://apache.org/jena/permissions/Assembler#> . - @prefix my: <http://example.org/#> . + PREFIX fuseki: <http://jena.apache.org/fuseki#> + PREFIX tdb: <http://jena.hpl.hp.com/2008/tdb#> + PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + PREFIX ja: <http://jena.hpl.hp.com/2005/11/Assembler#> + PREFIX perm: <http://apache.org/jena/permissions/Assembler#> + PREFIX my: <http://example.org/#> Load the SecuredAssembler class from the permissions library and define the perm:Model as a subclass of ja:NamedModel. diff --git a/source/documentation/query/text-query.md b/source/documentation/query/text-query.md index 3c5ef4713..46395d47d 100644 --- a/source/documentation/query/text-query.md +++ b/source/documentation/query/text-query.md @@ -719,13 +719,13 @@ The following is an example of an assembler file defining a TDB dataset with a L # See https://jena.apache.org/documentation/fuseki2/fuseki-layout.html for the destination of this file. ######################################################################### - @prefix : <http://localhost/jena_example/#> . - @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . - @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . - @prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> . - @prefix text: <http://jena.apache.org/text#> . - @prefix skos: <http://www.w3.org/2004/02/skos/core#> - @prefix fuseki: <http://jena.apache.org/fuseki#> . + PREFIX : <http://localhost/jena_example/#> + PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + PREFIX tdb: <http://jena.hpl.hp.com/2008/tdb#> + PREFIX text: <http://jena.apache.org/text#> + PREFIX skos: <http://www.w3.org/2004/02/skos/core#> + PREFIX fuseki: <http://jena.apache.org/fuseki#> [] rdf:type fuseki:Server ; fuseki:services ( diff --git a/source/documentation/rdf/__index.md b/source/documentation/rdf/__index.md index afbb57d6f..1d174043b 100644 --- a/source/documentation/rdf/__index.md +++ b/source/documentation/rdf/__index.md @@ -160,12 +160,12 @@ where `acme-product` is defined to be `http://acme.example/schema/products#`. Th for example, in Turtle: ```turtle -@prefix acme-product: <http://acme.example/schema/products#>. +PREFIX acme-product: <http://acme.example/schema/products#> acme-product:widget acme-product:price "44.99"^^xsd:decimal. ``` -The datatype `xsd:decimal` is another example of an abbreviated URI. Note that no `@prefix` rules +The datatype `xsd:decimal` is another example of an abbreviated URI. Note that no `PREFIX` rules are defined by RDF or Turtle: authors of RDF content should ensure that all prefixes used in curies are defined before use. diff --git a/source/documentation/rdf/datasets.md b/source/documentation/rdf/datasets.md index af11e2a66..1bf6516c6 100644 --- a/source/documentation/rdf/datasets.md +++ b/source/documentation/rdf/datasets.md @@ -57,8 +57,8 @@ with data read from URLs (files or from any other URL). The examples use the following prefixes: - @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . - @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . + PREFIX ja: <http://jena.hpl.hp.com/2005/11/ASSEMBLER#> + PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> To create an empty in-memory dataset, all that is required is the line:
