kinow commented on a change in pull request #14: URL: https://github.com/apache/jena-site/pull/14#discussion_r446699985
########## File path: source/documentation/io/rdf-input.md ########## @@ -113,9 +99,20 @@ add data into an existing model or dataset. // Read into an existing Model RDFDataMgr.read(model, "data2.ttl") ; -### Example 3 : Using RDFParser +### Example 2 : Common usage {#model-usage} + +The original Jena Model API operation for reade and write provide another way to the same machinery: Review comment: s/reade/read and s/provide/provides ? ########## File path: source/documentation/notes/stream-manager.md ########## @@ -0,0 +1,105 @@ +--- +title: The Jena StreamManager and LocationMapper +--- + +The StreamManager is a utility to find and read files into models. +There is a standard global StreamManager and applications may also +define specific ones by constructing addition StreamManagers. Review comment: s/addition/additional ########## File path: source/documentation/notes/stream-manager.md ########## @@ -0,0 +1,105 @@ +--- +title: The Jena StreamManager and LocationMapper +--- + +The StreamManager is a utility to find and read files into models. +There is a standard global StreamManager and applications may also +define specific ones by constructing addition StreamManagers. + +The LocationMapper provides alternative locations for RDF data. + +## The Stream Manager + +Files are named by a string, according to the conventions of their +storage system. Typically this is by URI. There are a number of +storage system adapters provided: + +- File locator (with own current directory) +- URL locator (HTTP and FTP) +- Class loader locator +- Zip file locator + +The global stream manager has a file location, a URL locator and a +class loader (tried in that order). + +A StreamManager can have an associated LocationMapper that transforms +names before use. This means local copies of documents can be used +transparently to the rest of the application. + +A StreamManager provides an "open" operation to get an `InputStream` +to the resource. + +## The LocationMapper configuration file + +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#> . + + [] lm:mapping + [ lm:name "file:foo.ttl" ; lm:altName "file:etc/foo.ttl" ] , + [ lm:prefix "file:etc/" ; lm:altPrefix "file:ETC/" ] , + [ lm:name "file:etc/foo.ttl" ; lm:altName "file:DIR/foo.ttl" ] + . + +There are two types of location mapping: exact match renaming and +prefix renaming. When trying to find an alternative location, a +LocationMapper first tries for an exact match; if none is found, +the LocationMapper will search for the longest matching prefix. If +two are the same length, there is no guarantee on order tried; +there is no implied order in a location mapper configuration file +(it sets up two hash tables). + +In the example above, `file:etc/foo.ttl` becomes `file:DIR/foo.ttl` +because that is an exact match. The prefix match of file:etc/ is +ignored. + +All string tests are done case sensitively because the primary use +is for URLs. + +Notes: + +- Property values are not URIs, but strings. This is a system + feature, not an RDF feature. Prefix mapping is name rewriting; + alternate names are not treated as equivalent resources in the rest + of Jena. While application writers are encouraged to use URIs to + identify files, this is not always possible. +- There is no check to see if the alternative system resource is + equivalent to the original. + +A LocationMapper finds its configuration file by looking for the +following files, in order: + +- `location-mapping.ttl` +- `location-mapping.rdf` +- `etc/location-mapping.rdf` +- `etc/location-mapping.ttl`" Review comment: extra " ? ########## File path: source/documentation/io/rdf-input.md ########## @@ -81,24 +80,11 @@ The following is a suggested Apache httpd .htaccess file: AddType application/trix+xml .trix AddType application/rdf+thrift .trdf -### Example 1 : Common usage +### Example 1 : Using the RDFDataMgr {#using-rdfdatamgr} -In this example, a file in the current directory is read as Turtle. +`RDFDataMgr` provide operations to load, read and write models and datasets. Review comment: s/provide/provides ? ########## File path: source/documentation/io/rdf-input.md ########## @@ -137,23 +134,35 @@ The parsers log to a logger called `org.apache.jena.riot`. To avoid `WARN` messages, set this to `ERROR` in the logging system of the application. ## StreamManager and LocationMapper - + +Operations to read RDF data can be redirected to local copies and to other URLs. +This is useful to provide local copies of remote resources. + By default, the `RDFDataMgr` uses the global `StreamManager` to open typed -InputStreams. This is available to applications via `RDFDataMgr.open` as well as directly -using a `StreamManager`. +InputStreams. The `StreamManager` can be set using the `RDFParser` builder: + + // Create a copy of the global default StreamManager. + StreamManager sm = StreamManager.get().clone(); + // Add directory "/tmp" as a place to look for files + sm.addLocator(new LocatorFile("/tmp")); + + RDFParser.create() + .streamManager(sm) + .source("data.ttl") + .parse(...); -The `StreamManager` is chosen based on the `Context` object for the +It can also be set in the chosen based on the `Context` object for the Review comment: I think it's a bit confusing. Should we define what's the chosen thing/subject is here? ########## File path: source/documentation/notes/stream-manager.md ########## @@ -0,0 +1,105 @@ +--- +title: The Jena StreamManager and LocationMapper +--- + +The StreamManager is a utility to find and read files into models. +There is a standard global StreamManager and applications may also +define specific ones by constructing addition StreamManagers. + +The LocationMapper provides alternative locations for RDF data. + +## The Stream Manager + +Files are named by a string, according to the conventions of their +storage system. Typically this is by URI. There are a number of +storage system adapters provided: + +- File locator (with own current directory) +- URL locator (HTTP and FTP) +- Class loader locator +- Zip file locator + +The global stream manager has a file location, a URL locator and a +class loader (tried in that order). + +A StreamManager can have an associated LocationMapper that transforms +names before use. This means local copies of documents can be used +transparently to the rest of the application. + +A StreamManager provides an "open" operation to get an `InputStream` +to the resource. + +## The LocationMapper configuration file + +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#> . + + [] lm:mapping + [ lm:name "file:foo.ttl" ; lm:altName "file:etc/foo.ttl" ] , + [ lm:prefix "file:etc/" ; lm:altPrefix "file:ETC/" ] , + [ lm:name "file:etc/foo.ttl" ; lm:altName "file:DIR/foo.ttl" ] + . + +There are two types of location mapping: exact match renaming and +prefix renaming. When trying to find an alternative location, a +LocationMapper first tries for an exact match; if none is found, +the LocationMapper will search for the longest matching prefix. If +two are the same length, there is no guarantee on order tried; +there is no implied order in a location mapper configuration file +(it sets up two hash tables). + +In the example above, `file:etc/foo.ttl` becomes `file:DIR/foo.ttl` +because that is an exact match. The prefix match of file:etc/ is +ignored. + +All string tests are done case sensitively because the primary use +is for URLs. + +Notes: + +- Property values are not URIs, but strings. This is a system + feature, not an RDF feature. Prefix mapping is name rewriting; + alternate names are not treated as equivalent resources in the rest + of Jena. While application writers are encouraged to use URIs to + identify files, this is not always possible. +- There is no check to see if the alternative system resource is + equivalent to the original. + +A LocationMapper finds its configuration file by looking for the +following files, in order: + +- `location-mapping.ttl` +- `location-mapping.rdf` +- `etc/location-mapping.rdf` +- `etc/location-mapping.ttl`" + +This is a specified as a path - note the path separator is always Review comment: s/This is a specified/This is specified ########## File path: source/documentation/rdfstar/__index.md ########## @@ -70,6 +67,17 @@ is a prefix for `<http://jena.apache.org/ARQ/function#>`. | `afn:triple(?s, ?p, ?o)` | Create a triple term from s/p/o | | `afn:isTriple(?t)` | Return true if the argument value is a triple term | +### SPARQL Property Functions related to triple terms + +`apf:` is a prefix for `<http://jena.apache.org/ARQ/property#>`. + +| Property Function | Description | +| -------- | ----------- | +| `<< s p o >> apf:find t` . | Match the triple term. Any `s`, `p`, `o`, and `t` can be RDF terms or variables.| + +`apf:find` will result in all the variables being are set accorind to the match, Review comment: will result in all the variables being are set accorind to the match will result in all the variables being set according to the match ? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org