Retain root nodes of results (RDF or sparql) MPX-10
[mp-sparql-moved-to-github.git] / doc / sparql.xml
1 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.4//EN"
2     "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
3 ]>
4 <refentry id="sparql">
5  <refentryinfo>
6   <productname>Metaproxy SPARQL module</productname>
7   <info><orgname>Index Data</orgname></info>
8  </refentryinfo>
9
10  <refmeta>
11   <refentrytitle>sparql</refentrytitle>
12   <manvolnum>3mp</manvolnum>
13   <refmiscinfo class="manual">Metaproxy Module</refmiscinfo>
14  </refmeta>
15
16  <refnamediv>
17   <refname>sparql</refname>
18   <refpurpose>
19    Metaproxy Module for accessing a triplestore
20   </refpurpose>
21  </refnamediv>
22
23  <refsect1><title>DESCRIPTION</title>
24   <para>
25    This module translates Z39.50 operations init, search, present to
26    HTTP requests that accesses a remote triplestore via HTTP
27   </para>
28   <para>
29    Configuration consists of one or more db elements. Each db element
30    describes how to access a specific database. The db element takes
31    attributes name of Z39.50 database (<literal>path</literal>) and
32    HTTP access point of triplestore (<literal>uri</literal>).
33    Optionally, the schema for the database may be given with attribute
34    <literal>schema</literal>.
35    Each
36    db element takes these elements:
37    Configurable values:
38    <variablelist>
39     <varlistentry><term>&lt;prefix/&gt;</term>
40      <listitem>
41       <para>
42        Section that maps prefixes and namespaces for RDF vocabularies.
43        The format is prefix followed by colon, followed by value.
44       </para>
45      </listitem>
46     </varlistentry>
47     <varlistentry><term>&lt;form/&gt;</term>
48      <listitem>
49       <para>
50        SPARQL Query formulation selection. SHould start with one of the
51        query forms: SELECT or CONSTRUCT.
52       </para>
53      </listitem>
54     </varlistentry>
55     <varlistentry><term>&lt;criteria/&gt;</term>
56      <listitem>
57       <para>
58        section that allows to map static graph patterns for binding
59        variables, narrowing types, etc, or any other WHERE clause criteria
60        static to the Z39.50/SRU database. The final query conversion logic
61        should be able to deduce which optional criteria should be included
62        in the generated SPARQL by analyzing variables required in the query
63        matching and display fields.
64       </para>
65      </listitem>
66     </varlistentry>
67     <varlistentry><term>&lt;index type="attribute"/&gt;</term>
68      <listitem>
69       <para>
70        Section used to declare RPN use attribute strings (indexes) and map
71        them to BIBFRAME graph patterns.
72        Items in this section are expanded during RPN query processing and
73        placeholders (%s, %d) are substituted with query terms.
74        To map a given CQL index (e.g the default keyword index) into
75        multiple entity properties, SPARQL constructs like
76        `OPTIONAL` or `UNION` could be used.
77       </para>
78      </listitem>
79     </varlistentry>
80    </variablelist>
81   </para>
82  </refsect1>
83
84  <refsect1><title>SCHEMA</title>
85    <literallayout><xi:include
86                      xi:href="filter_sparql.rnc"
87                      xi:parse="text"
88                      xmlns:xi="http://www.w3.org/2001/XInclude" />
89    </literallayout>
90  </refsect1>
91
92  <refsect1><title>EXAMPLES</title>
93   <para>
94    Configuration for database "Default" that allows searching works. Only
95    the field (use attribute) "bf.wtitle" is supported.
96    <screen><![CDATA[
97   <filter type="sparql">
98     <db path="Default"
99         uri="http://bibframe.indexdata.com/sparql/"
100         schema="sparql-results"
101     >
102       <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
103       <prefix>bf: http://bibframe.org/vocab/</prefix>
104       <field>SELECT ?work ?wtitle</field>
105       <criteria>?work a bf:Work</criteria>
106       <criteria>?work bf:workTitle ?wt</criteria>
107       <criteria>?wt bf:titleValue ?wtitle</criteria>
108       <index type="bf.wtitle">?wt bf:titleValue %v FILTER(contains(%v, %s))</index>
109     </db>
110   </filter>
111 ]]>
112    </screen>
113   </para>
114  </refsect1>
115
116  <refsect1><title>SEE ALSO</title>
117   <para>
118    <citerefentry>
119     <refentrytitle>metaproxy</refentrytitle>
120     <manvolnum>1</manvolnum>
121    </citerefentry>
122   </para>
123  </refsect1>
124
125 </refentry>
126
127 <!-- Keep this comment at the end of the file
128 Local variables:
129 mode: nxml
130 nxml-child-indent: 1
131 End:
132 -->