5826b16f2ea75f883a9ccd1841937e2291e037a0
[mp-sparql-moved-to-github.git] / doc / book.xml
1 <?xml version="1.0" standalone="no"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
3     "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd"
4 [
5      <!ENTITY % local SYSTEM "local.ent">
6      %local;
7      <!ENTITY manref SYSTEM "manref.xml">
8      <!ENTITY gpl2 SYSTEM "gpl-2.0.xml">
9      <!ENTITY % idcommon SYSTEM "common/common.ent">
10      %idcommon;
11 ]>
12 <book>
13  <bookinfo>
14   <title>MP-SPARQL - User's Guide and Reference</title>
15   <authorgroup>
16    <author>
17     <firstname>Adam</firstname><surname>Dickmeiss</surname>
18    </author>
19    <author>
20     <firstname>Heikki</firstname><surname>Levanto</surname>
21    </author>
22    <author>
23     <firstname>Jakub</firstname><surname>Skoczen</surname>
24    </author>
25   </authorgroup>
26   <releaseinfo>&version;</releaseinfo>
27   <copyright>
28    <year>2014-2015</year>
29    <holder>Index Data</holder>
30   </copyright>
31   <abstract>
32    <simpara>
33     This manual is part of MP-SPARQL version &version;.
34     </simpara>
35    <simpara>
36     MP-XQuery is a Metaproxy module that converts Type-1/RPN Queries
37     to SPARQL.
38    </simpara>
39    <simpara>
40     MP-SPARQL is covered by the GNU General Public License version 2.
41    </simpara>
42    <simpara>
43     <inlinemediaobject>
44      <imageobject>
45       <imagedata fileref="common/id.png" format="PNG"/>
46      </imageobject>
47      <imageobject>
48       <imagedata fileref="common/id.eps" format="EPS"/>
49      </imageobject>
50     </inlinemediaobject>
51    </simpara>
52   </abstract>
53  </bookinfo>
54  <chapter id="introduction">
55   <title>Introduction</title>
56   <para>
57    MP-SPARQL is a <ulink url="&url.metaproxy;">Metaproxy</ulink> module
58    that converts Type-1/RPN queries to <ulink url="http://www.w3.org/TR/rdf-sparql-query/">SPARQL</ulink>.
59   </para>
60  </chapter>
61  <chapter id="installation">
62   <title>Installation</title>
63   <para>
64    MP-SPARQL is available as packages for CentOS/RHEL 5+6 and most
65    recent Ubuntu/Debian versions. For other systems, the module must be build
66    from source.
67   </para>
68   <sect1 id="installation.packages">
69    <title>Installing packages</title>
70    <para>
71     You need to enable the relevant software repositories.
72     For setting up refer to one of:
73     <ulink
74         url="http://ftp.indexdata.dk/pub/mp-sparql/redhat/centos/5.5/README">CentOS 5</ulink>,
75     <ulink
76         url="http://ftp.indexdata.dk/pub/mp-sparql/redhat/centos/6/README">CentOS 6</ulink>
77     ,
78     <ulink
79         url="http://ftp.indexdata.dk/pub/mp-sparql/ubuntu/README">Ubuntu</ulink>
80     and
81     <ulink
82         url="http://ftp.indexdata.dk/pub/mp-sparql/debian/README">Debian</ulink>
83    </para>
84    <para>
85     The package is called <literal>mp-sparql</literal> on RHEL/Debian systems.
86     Install that package and you are ready to use filter "sparql" in your
87     setup.
88    </para>
89    <para>
90     mp-sparql depends on a number of packages created by Index Data and
91     system-provided ones, such as Libxml2. For external software Zorba, no
92     system package exist so Index Data has packaged that separately. This
93     package is called <literal>idzorba</literal>. All these dependences should
94     be automatically installed when the Index Data software repository is
95     set up.
96    </para>
97   </sect1>
98   <sect1 id="installation.source">
99    <title>Installing from source</title>
100    <para>
101     To build from source, you need metaproxy development
102     packages. Metaproxy can be installed as follows:
103     <screen>
104      ./configure
105      make
106      sudo make install
107     </screen>
108     Refer to the Metaproxy documentation for requirements and options.
109    </para>
110    <para>
111     We are now ready to build the MP-SPARQL module with:
112     <screen>
113      cd mp-sparql-version
114      make MP_CONFIG=/usr/local/bin/mp-config
115     </screen>
116     Adjust <literal>MP_CONFIG</literal> value
117     above for the correct location of installed
118     Metaproxy's mp-config. <literal>MP_CONFIG</literal> can be omitted
119     if Metaproxy was installed in the system <filename>PATH</filename>.
120    </para>
121    <para>
122     You can now install the <filename>metaproxy_filter_sparql.so</filename>
123     in a directory searched by Metaproxy daemon.
124     Specifically, that's the directories
125     given by the <literal>dlpath</literal> configuration.
126    </para>
127    <para>
128     If dlpath includes <filename>/usr/lib/metaproxy6/modules</filename>,
129     the module can be installed with:
130     <screen>
131      cp src/metaproxy_filter_sparql.so /usr/lib/metaproxy6/modules
132     </screen>
133    </para>
134    <note>
135     <para>
136      For RHEL/CentOS systems on 64-bit architectures, the correct paths is:
137      <filename>/usr/lib64/metaproxy6/modules</filename>.
138     </para>
139    </note>
140   </sect1>
141   <sect1 id="configuration">
142    <title>Configuration</title>
143    <para>
144     If you have installed mp-sparql as a package or have executed
145     <literal>make install</literal> from source, sample configuration
146     can be found in <filename>/usr/share/mp-sparql/bibframe</filename> or
147     <filename>/usr/local/share/mp-sparql/bibframe</filename>. In the
148     the following /usr/share prefix assumed. Adjust accordingly.
149     The directory contains these files:
150     <variablelist>
151      <varlistentry>
152       <term><filename>triplestore.xml</filename></term>
153       <listitem>
154        <para>
155         A mature PQF to SPARQL configuration illustrating a lot of the
156         configuration facilities that are described in the manual
157         page of <xref linkend="sparql"/>.
158        </para>
159       </listitem>
160      </varlistentry>
161      <varlistentry>
162       <term><filename>config-sparql.xml</filename></term>
163       <listitem>
164        <para>
165         A full metaproxy configuration file that includes
166         <filename>triplestore.xml</filename> cofiguration for the
167         mp-sparql filter, enables SRU and CQL to PQF conversion.
168        </para>
169       </listitem>
170      </varlistentry>
171      <varlistentry>
172       <term><filename>filter-sparql.xml</filename></term>
173       <listitem>
174        <para>
175         A partial metaproxy configuration suitable to be enabled in
176         <filename>/etc/metaproxy/filters-enabled</filename>.
177         This includes <filename>triplestore.xml</filename> as well.
178        </para>
179       </listitem>
180      </varlistentry>
181     </variablelist>
182    </para>
183    <para>
184     If you want to use the package layout and modular configuration we
185     suggest you use filter-sparql.xml and perform something along the lines of:
186     <screen>
187      cp /usr/share/mp-sparql/bibframe/filter-sparql.xml /etc/metaproxy/filters-available
188      cp /usr/share/mp-sparql/bibframe/triplestore.xml /etc/metaproxy
189      vi /etc/metaproxy/triplestore.xml
190      ln -s ../filters-available/filter-sparql.xml /etc/metaproxy/filters-enabled
191      service metaproxy restart
192     </screen>
193     A copy of triplestore.xml is made. Adjust the
194     <literal>&lt;defaults uri=.. </literal> value to the URI of your
195     triplestore.
196    </para>
197    <para>
198     If you want to create your own top-level configuration, you can copy
199     <filename>config-sparql.xml</filename> to any location you like and
200     run metaproxy with that. Something like this:
201     <screen>
202      mkdir /etc/myconfig
203      cp /usr/share/mp-sparql/bibframe/* /etc/myconfig
204      sudo vi /etc/myconfig/triplestore.xml
205      metaproxy -c /etc/myconfig/config-sparql.xml
206     </screen>
207     Again, a copy of triplestore.xml is made. Adjust the
208     <literal>&lt;defaults uri=.. </literal> value to the URI of your
209     triplestore.
210    </para>
211    <note>
212     <para>
213      Do not edit files in <filename>/usr/share/mp-sparql/bibframe</filename>.
214      They are only samples and will be overwritten by a package update.
215      Instead copy the files away from there if you need to modify them.
216     </para>
217    </note>
218   </sect1>
219   <sect1 id="using">
220    <title>Using the service</title>
221    <para>
222     Either way, unless you have adjusted the metaproxy configuration,
223     Metaproxy can be reached on port 9000. Example using yaz-client and
224     PQF/Type-1:
225     <screen><![CDATA[
226 adam@tuna:~$ yaz-client localhost:9000/work
227 Connecting...OK.
228 Sent initrequest.
229 Connection accepted by v3 target.
230 ID     : 81
231 Name   : sparql
232 Version: 1.9.0/5.14.6 87faebe8ef5cab8f6df86f387e8b919b7b9897a8
233 Options: search present namedResultSets
234 Elapsed: 0.000961
235 Z> f @attr 1=bf.anytitle water
236 Sent searchRequest.
237 Received SearchResponse.
238 Search was a success.
239 Number of hits: 1, setno 1
240 records returned: 0
241 Elapsed: 0.279441
242 Z> s
243 Sent presentRequest (1+1).
244 Records: 1
245 [work]Record type: XML
246 <?xml version="1.0" encoding="utf-8" ?>
247 <rdf:RDF
248         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
249         xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
250         xmlns:ns2="http://bibframe.org/vocab/" >
251   <rdf:Description rdf:about="http://bibframe.org/resources/sample-lc-2/15513351">
252   ...
253   </rdf:Description>
254 </rdf:RDF>nextResultSetPosition = 0
255 Elapsed: 0.256142
256 ]]></screen>
257    </para>
258    <para>
259    Example using SRU:
260    <ulink url="http://localhost:9000/work?query=bf.anytitle%3Dwater&amp;maximumRecords=1"/>
261    </para>
262   </sect1>
263  </chapter>
264  <reference id="reference">
265   <title>Reference</title>
266    <partintro id="reference-introduction">
267     <para>
268      The material in this chapter is drawn directly from the individual
269      manual entries.
270     </para>
271    </partintro>
272    &manref;
273  </reference>
274
275  <appendix id="license">
276   <title>License</title>
277   <para>
278    Copyright (C) 2014-2015 Index Data
279   </para>
280
281   <para>
282    Metaproxy is free software; you can redistribute it and/or modify it under
283    the terms of the GNU General Public License as published by the Free
284    Software Foundation; either version 2, or (at your option) any later
285    version.
286    </para>
287
288   <para>
289    Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
290    WARRANTY; without even the implied warranty of MERCHANTABILITY or
291    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
292    for more details.
293   </para>
294
295   <para>
296    You should have received a copy of the GNU General Public License
297    along with Metaproxy; see the file LICENSE.  If not, write to the
298    Free Software Foundation,
299    51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
300   </para>
301
302  </appendix>
303
304  &gpl2;
305 </book>
306
307 <!-- Keep this comment at the end of the file
308 Local variables:
309 mode: nxml
310 nxml-child-indent: 1
311 End:
312 -->