838dce1cb4b52dd1340bdf0c12fe860cdc4a62c7
[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>). Each
33    db element takes these elements:
34    Configurable values:
35    <variablelist>
36     <varlistentry><term>&lt;prefix/&gt;</term>
37      <listitem>
38       <para>
39        Section that maps prefixes and namespaces for RDF vocabularies.
40        The format is prefix followed by colon, followed by value.
41       </para>
42      </listitem>
43     </varlistentry>
44     <varlistentry><term>&lt;field/&gt;</term>
45      <listitem>
46       <para>
47        Optional section for controlling what data rows are selected in the
48        SPARQL statement and how they are mapped to the output document, all
49        variables (\*) are selected when none is provided.
50       </para>
51      </listitem>
52     </varlistentry>
53     <varlistentry><term>&lt;criteria/&gt;</term>
54      <listitem>
55       <para>
56        section that allows to map static graph patterns for binding
57        variables, narrowing types, etc, or any other WHERE clause criteria
58        static to the Z39.50/SRU database. The final query conversion logic
59        should be able to deduce which optional criteria should be included
60        in the generated SPARQL by analyzing variables required in the query
61        matching and display fields.
62       </para>
63      </listitem>
64     </varlistentry>
65     <varlistentry><term>&lt;index type="attribute"/&gt;</term>
66      <listitem>
67       <para>
68        Section used to declare RPN use attribute strings (indexes) and map
69        them to BIBFRAME graph patterns.
70        Items in this section are expanded during RPN query processing and
71        placeholders (%s, %d) are substituted with query terms.
72        To map a given CQL index (e.g the default keyword index) into
73        multiple entity properties, SPARQL constructs like
74        `OPTIONAL` or `UNION` could be used.
75       </para>
76      </listitem>
77     </varlistentry>
78    </variablelist>
79   </para>
80  </refsect1>
81
82  <refsect1><title>SCHEMA</title>
83    <literallayout><xi:include
84                      xi:href="filter_sparql.rnc"
85                      xi:parse="text"
86                      xmlns:xi="http://www.w3.org/2001/XInclude" />
87    </literallayout>
88  </refsect1>
89
90  <refsect1><title>EXAMPLES</title>
91   <para>
92    Configuration for database "Default" that allows searching works. Only
93    the field (use attribute) "bf.wtitle" is supported.
94    <screen><![CDATA[
95   <filter type="sparql">
96     <db path="Default" uri="http://bibframe.indexdata.com/sparql/">
97       <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
98       <prefix>bf: http://bibframe.org/vocab/</prefix>
99       <field>?work ?wtitle</field>
100       <criteria>?work a bf:Work</criteria>
101       <criteria>?work bf:workTitle ?wt</criteria>
102       <criteria>?wt bf:titleValue ?wtitle</criteria>
103       <index type="bf.wtitle">?wt bf:titleValue %v FILTER(contains(%v, %s))</index>
104     </db>
105   </filter>
106 ]]>
107    </screen>
108   </para>
109  </refsect1>
110
111  <refsect1><title>SEE ALSO</title>
112   <para>
113    <citerefentry>
114     <refentrytitle>metaproxy</refentrytitle>
115     <manvolnum>1</manvolnum>
116    </citerefentry>
117   </para>
118  </refsect1>
119
120 </refentry>
121
122 <!-- Keep this comment at the end of the file
123 Local variables:
124 mode: nxml
125 nxml-child-indent: 1
126 End:
127 -->