Add man page and pdate RPM to install it MPSPARQL-3 v0.1
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 9 Jan 2015 13:23:27 +0000 (14:23 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 9 Jan 2015 13:23:27 +0000 (14:23 +0100)
Makefile
doc/Makefile [new file with mode: 0644]
doc/filter_sparql.rnc [new file with mode: 0644]
doc/id.htmlhelp.xsl [new file with mode: 0644]
doc/id.man.xsl [new file with mode: 0644]
doc/sparql.xml [new file with mode: 0644]
doc/stripref.xsl [new file with mode: 0644]
mp-sparql.spec

index a966b17..a3fb177 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-SUBDIRS = src
+SUBDIRS = src doc
 .PHONY: $(SUBDIRS) all
 
 all: $(SUBDIRS)
diff --git a/doc/Makefile b/doc/Makefile
new file mode 100644 (file)
index 0000000..a044d6d
--- /dev/null
@@ -0,0 +1,39 @@
+
+.PHONY: check all
+.SUFFIXES: .3mp .xml .1
+
+prefix = /usr
+
+XSLTPROC_COMPILE = xsltproc --xinclude -path "."
+HTML_COMPILE = $(XSLTPROC_COMPILE) id.htmlhelp.xsl
+MAN_COMPILE = $(XSLTPROC_COMPILE) id.man.xsl
+REFFILES = sparql.xml
+MANFILES=sparql.3mp
+
+XMLFILES=book.xml manref.xml
+
+all: $(MANFILES)
+
+index.html: $(XMLFILES)
+       $(HTML_COMPILE) book.xml
+
+manref.xml: $(REFFILES)
+       rm -f manref.xml
+       for i in $(REFFILES); do \
+               xsltproc stripref.xsl $$i | sed 1d >>manref.xml; \
+        done
+
+.xml.3mp:
+       $(MAN_COMPILE) $<
+
+clean:
+       rm -f *.html *.pdf manref.xml *.hhp *.hhc $(MANFILES)
+
+distclean: clean
+
+check: all
+
+install:
+       mkdir -p $(DESTDIR)$(prefix)/share/man/man3
+       cp *.3mp $(DESTDIR)$(prefix)/share/man/man3/
+
diff --git a/doc/filter_sparql.rnc b/doc/filter_sparql.rnc
new file mode 100644 (file)
index 0000000..263214d
--- /dev/null
@@ -0,0 +1,20 @@
+# Metaproxy XML config file schema
+
+namespace mp = "http://indexdata.com/metaproxy"
+
+filter_sparql =
+  attribute type { "xquery" },
+  attribute id { xsd:NCName }?,
+  attribute name { xsd:NCName }?,
+  element mp:db {
+    attribute path { xsd:string },
+    attribute uri { xsd:string },
+    element mp:prefix { xsd:string }+,
+    element mp:field { xsd:string }*,
+    element mp:criteria { xsd:string }*,
+    element mp:index {
+      attribute type { xsd:string },
+      xsd:string
+    }*
+  }+
+
diff --git a/doc/id.htmlhelp.xsl b/doc/id.htmlhelp.xsl
new file mode 100644 (file)
index 0000000..c31b7ee
--- /dev/null
@@ -0,0 +1,18 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+               version="1.0">
+
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl" />
+
+<xsl:template name="body.attributes">
+   <link rel="stylesheet" type="text/css" href="style.css"/>
+</xsl:template>
+<xsl:variable name="suppress.navigation">0</xsl:variable>
+<xsl:variable name="use.id.as.filename">1</xsl:variable>
+<xsl:variable name="generate.book.toc">1</xsl:variable>
+<xsl:variable name="toc.section.depth">3</xsl:variable>
+<xsl:variable name="generate.toc.section.depth">3</xsl:variable>
+<xsl:variable name="section.autolabel">1</xsl:variable>
+
+</xsl:stylesheet>
+
+
diff --git a/doc/id.man.xsl b/doc/id.man.xsl
new file mode 100644 (file)
index 0000000..6cea265
--- /dev/null
@@ -0,0 +1,7 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+               version="1.0">
+
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"/>
+</xsl:stylesheet>
+
+
diff --git a/doc/sparql.xml b/doc/sparql.xml
new file mode 100644 (file)
index 0000000..838dce1
--- /dev/null
@@ -0,0 +1,127 @@
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.4//EN"
+    "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
+]>
+<refentry id="sparql">
+ <refentryinfo>
+  <productname>Metaproxy SPARQL module</productname>
+  <info><orgname>Index Data</orgname></info>
+ </refentryinfo>
+
+ <refmeta>
+  <refentrytitle>sparql</refentrytitle>
+  <manvolnum>3mp</manvolnum>
+  <refmiscinfo class="manual">Metaproxy Module</refmiscinfo>
+ </refmeta>
+
+ <refnamediv>
+  <refname>sparql</refname>
+  <refpurpose>
+   Metaproxy Module for accessing a triplestore
+  </refpurpose>
+ </refnamediv>
+
+ <refsect1><title>DESCRIPTION</title>
+  <para>
+   This module translates Z39.50 operations init, search, present to
+   HTTP requests that accesses a remote triplestore via HTTP
+  </para>
+  <para>
+   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 (<literal>path</literal>) and
+   HTTP access point of triplestore (<literal>uri</literal>). Each
+   db element takes these elements:
+   Configurable values:
+   <variablelist>
+    <varlistentry><term>&lt;prefix/&gt;</term>
+     <listitem>
+      <para>
+       Section that maps prefixes and namespaces for RDF vocabularies.
+       The format is prefix followed by colon, followed by value.
+      </para>
+     </listitem>
+    </varlistentry>
+    <varlistentry><term>&lt;field/&gt;</term>
+     <listitem>
+      <para>
+       Optional section for controlling what data rows are selected in the
+       SPARQL statement and how they are mapped to the output document, all
+       variables (\*) are selected when none is provided.
+      </para>
+     </listitem>
+    </varlistentry>
+    <varlistentry><term>&lt;criteria/&gt;</term>
+     <listitem>
+      <para>
+       section that allows to map static graph patterns for binding
+       variables, narrowing types, etc, or any other WHERE clause criteria
+       static to the Z39.50/SRU database. The final query conversion logic
+       should be able to deduce which optional criteria should be included
+       in the generated SPARQL by analyzing variables required in the query
+       matching and display fields.
+      </para>
+     </listitem>
+    </varlistentry>
+    <varlistentry><term>&lt;index type="attribute"/&gt;</term>
+     <listitem>
+      <para>
+       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) 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.
+      </para>
+     </listitem>
+    </varlistentry>
+   </variablelist>
+  </para>
+ </refsect1>
+
+ <refsect1><title>SCHEMA</title>
+   <literallayout><xi:include
+                    xi:href="filter_sparql.rnc"
+                    xi:parse="text"
+                    xmlns:xi="http://www.w3.org/2001/XInclude" />
+   </literallayout>
+ </refsect1>
+
+ <refsect1><title>EXAMPLES</title>
+  <para>
+   Configuration for database "Default" that allows searching works. Only
+   the field (use attribute) "bf.wtitle" is supported.
+   <screen><![CDATA[
+  <filter type="sparql">
+    <db path="Default" uri="http://bibframe.indexdata.com/sparql/">
+      <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
+      <prefix>bf: http://bibframe.org/vocab/</prefix>
+      <field>?work ?wtitle</field>
+      <criteria>?work a bf:Work</criteria>
+      <criteria>?work bf:workTitle ?wt</criteria>
+      <criteria>?wt bf:titleValue ?wtitle</criteria>
+      <index type="bf.wtitle">?wt bf:titleValue %v FILTER(contains(%v, %s))</index>
+    </db>
+  </filter>
+]]>
+   </screen>
+  </para>
+ </refsect1>
+
+ <refsect1><title>SEE ALSO</title>
+  <para>
+   <citerefentry>
+    <refentrytitle>metaproxy</refentrytitle>
+    <manvolnum>1</manvolnum>
+   </citerefentry>
+  </para>
+ </refsect1>
+
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: nxml
+nxml-child-indent: 1
+End:
+-->
diff --git a/doc/stripref.xsl b/doc/stripref.xsl
new file mode 100644 (file)
index 0000000..b39f24a
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<xsl:stylesheet
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  version="1.0">
+
+    <xsl:output method="xml" encoding="UTF-8"/>
+
+<xsl:template match="/">
+  <xsl:comment>Generated by stripref.xsl . Do not edit</xsl:comment>
+  <xsl:copy-of select="*"/>
+</xsl:template>
+
+</xsl:stylesheet>
+
index d368db0..4d2c5d8 100644 (file)
@@ -56,4 +56,4 @@ rm -fr ${RPM_BUILD_ROOT}
 %files
 %defattr(-,root,root)
 %{_libdir}/mp-sparql/*
-# %{_mandir}/man3/sparql.*
+%{_mandir}/man3/sparql.*