Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/mp-sparql
[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     <varlistentry><term>&lt;modifier/&gt;</term>
81      <listitem>
82       <para>
83        Optional section that allows you to add solution sequences or
84        modifiers.
85       </para>
86      </listitem>
87     </varlistentry>
88
89    </variablelist>
90   </para>
91  </refsect1>
92
93  <refsect1><title>SCHEMA</title>
94    <literallayout><xi:include
95                      xi:href="filter_sparql.rnc"
96                      xi:parse="text"
97                      xmlns:xi="http://www.w3.org/2001/XInclude" />
98    </literallayout>
99  </refsect1>
100
101  <refsect1><title>EXAMPLES</title>
102   <para>
103    Configuration for database "Default" that allows searching works. Only
104    the field (use attribute) "bf.wtitle" is supported.
105    <screen><![CDATA[
106   <filter type="sparql">
107     <db path="Default"
108         uri="http://bibframe.indexdata.com/sparql/"
109         schema="sparql-results"
110     >
111       <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
112       <prefix>bf: http://bibframe.org/vocab/</prefix>
113       <field>SELECT ?work ?wtitle</field>
114       <criteria>?work a bf:Work</criteria>
115       <criteria>?work bf:workTitle ?wt</criteria>
116       <criteria>?wt bf:titleValue ?wtitle</criteria>
117       <index type="bf.wtitle">?wt bf:titleValue %v FILTER(contains(%v, %s))</index>
118     </db>
119   </filter>
120 ]]>
121    </screen>
122   </para>
123  </refsect1>
124
125  <refsect1><title>SEE ALSO</title>
126   <para>
127    <citerefentry>
128     <refentrytitle>metaproxy</refentrytitle>
129     <manvolnum>1</manvolnum>
130    </citerefentry>
131   </para>
132  </refsect1>
133
134 </refentry>
135
136 <!-- Keep this comment at the end of the file
137 Local variables:
138 mode: nxml
139 nxml-child-indent: 1
140 End:
141 -->