From: Adam Dickmeiss Date: Mon, 24 Aug 2015 13:54:38 +0000 (+0200) Subject: Update schema and improve manual page MPSPARQL-29 X-Git-Url: http://git.indexdata.com/?p=mp-sparql-moved-to-github.git;a=commitdiff_plain;h=43063c1e0a4e9d1cf9347d7bdefe8ee99dbb14cb;hp=6f511dbea2b1c332425f7d5c492f0482c72ba9ca Update schema and improve manual page MPSPARQL-29 --- diff --git a/doc/filter_sparql.rnc b/doc/filter_sparql.rnc index 8a644d0..5caa487 100644 --- a/doc/filter_sparql.rnc +++ b/doc/filter_sparql.rnc @@ -7,14 +7,15 @@ filter_sparql = attribute id { xsd:NCName }?, attribute name { xsd:NCName }?, element mp:defaults { - attribute uri { xsd:string } + attribute uri { xsd:string }? }?, element mp:db { attribute path { xsd:string }, - attribute uri { xsd:string }, - attribute schema { xsd:string }, + attribute uri { xsd:string }?, + attribute schema { xsd:string }?, + attribute include { xsd:string }?, element mp:prefix { xsd:string }+, - element mp:field { xsd:string }*, + element mp:form { xsd:string }*, element mp:criteria { xsd:string }*, element mp:index { attribute type { xsd:string }, diff --git a/doc/sparql.xml b/doc/sparql.xml index 9daac58..a43fbae 100644 --- a/doc/sparql.xml +++ b/doc/sparql.xml @@ -26,15 +26,32 @@ HTTP requests that accesses a remote triplestore via HTTP - Configuration consists of one or more db elements. Each db element - describes how to access a specific database. The db element takes - attributes name of Z39.50 database (path) and - HTTP access point of triplestore (uri). - Optionally, the schema for the database may be given with attribute - schema. - Each - db element takes these elements: - Configurable values: + This module only inspects Z39.50. HTTP requests are ignored (passed through). + When this module is in effect, the result is HTTP packages. Use + the http_client module after this module in the + route in order to contact a remote triplestore via HTTP + + + Configuration consists of an optional defaults section and one or more + database sections. + + + The default sections is defined with element defaults + and specifies the URL of the triplestore by attribute + uri. + + + A database section is defined with element db. + The db element must specify attribute + path which is the name of the Z39.50 database. + It should also include attribute uri with the + URL of the triplestore; unless already specified in the detaults + section. + The element-set-name / schema for the database may be given with + attribute schema. + A db configuration may also include settings from another db section - + specified by the include attribute. + Each database section takes these elements: <prefix/> @@ -67,21 +84,22 @@ <index type="attribute"/> - Section used to declare RPN use attribute strings (indexes) and map - them to BIBFRAME graph patterns. - Items in this section are expanded during RPN query processing and - placeholders (%s, %d, - %t) are substituted with query terms. - To map a given CQL index (e.g the default keyword index) into - multiple entity properties, SPARQL constructs like - `OPTIONAL` or `UNION` could be used. + Section used to declare RPN/Type-1 use attribute strings (indices) + and map them to BIBFRAME graph patterns. + Items in this section are constructed during RPN query processing and + placeholders that are prefixed by a percent sign (%) + are expanded. + See EXPANSIONS. + To map a given use attribute (search field) into + multiple entity properties, SPARQL constructs like `OPTIONAL` or + `UNION` can be used. <present type="attribute"/> - Section used to declare retrieval for a given element-set + Section used to declare retrieval for a given element-set-name (SRU schema). The CDATA is SPARQL where %u holds the URI of the record. This can be used to construct the resulting record. @@ -100,9 +118,50 @@ - - SCHEMA - EXPANSIONS + + %t + + + The term verbatim as it appears in the Type-1 query. + + + + %s + + + Like %t but quoted - for general strings. + + + + %d + + + Term - expecting an integer. + + + + %u + + + Like %t, but with prefix < + and suffix > - for URIs. + + + + %v + + + Expands to a SPARQL local variable ?v.... Allows + the use of a local SPARQL variable for each Attribute+Term in the + Type-1 query. + + + + + + SCHEMA + @@ -175,17 +234,18 @@ This returns one row for each work. Titles, authors, and subjects - are all optional. If they repeat, the repeated values are concatenated into - a single field, separated by semicolons. This is done by the GROUP_DIGEST - function that is specific to the Virtuoso back end. + are all optional. If they repeat, the repeated values are concatenated + into a single field, separated by semicolons. This is done by the + GROUP_DIGEST function that is specific to the Virtuoso back end. - This example supports use attributes 4 (title), 1003 (author), 21 (subject), - and 1016 (keyword) which matches any literal in a triplet that refers to the - work, so it works for the titleValue in the workTitle, as well as the label - in the subject, and what ever else there may be. Like the preceding example, - the matching is by a simple substring, case sensitive. A more realistic term - matching could be done with regular expressions, at the cost of some readability + This example supports use attributes 4 (title), 1003 (author), + 21 (subject), and 1016 (keyword) which matches any literal in a + triplet that refers to the work, so it works for the titleValue in + the workTitle, as well as the label in the subject, and what ever + else there may be. Like the preceding example, the matching is by a + simple substring, case sensitive. A more realistic term matching could + be done with regular expressions, at the cost of some readability portability, and performance. @@ -222,9 +282,10 @@ EXAMPLE Configuration for database "instance". Like "work" above this uses SELECT - to return row-based data, this time from the instances. This is not deduplicated, - so if an instance has two titles, we get two rows, and if it also has - two formats, we get four rows. The DISTINCT in the SELECT + to return row-based data, this time from the instances. + This is not deduplicated, so if an instance has two titles, we get two + rows, and if it also has two formats, we get four rows. + The DISTINCT in the SELECT bf: http://bibframe.org/vocab/ @@ -239,7 +300,6 @@ - SEE ALSO