Bugzilla – Attachment 60791 Details for
Bug 12836
Add a script to regenerate Explain files from configs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12836 - Add script to rewrite SRU Explain file
Bug-12836---Add-script-to-rewrite-SRU-Explain-file.patch (text/plain), 80.09 KB, created by
Magnus Enger
on 2017-03-02 12:47:52 UTC
(
hide
)
Description:
Bug 12836 - Add script to rewrite SRU Explain file
Filename:
MIME Type:
Creator:
Magnus Enger
Created:
2017-03-02 12:47:52 UTC
Size:
80.09 KB
patch
obsolete
>From 749c72f6d5f86059d555ac1893c6ed59cc155f18 Mon Sep 17 00:00:00 2001 >From: Magnus Enger <magnus@libriotech.no> >Date: Tue, 28 Feb 2017 13:12:28 +0000 >Subject: [PATCH] Bug 12836 - Add script to rewrite SRU Explain file > >The standard SRU Explain files provided with Koha is static and out of >date. This patch does two things >- Add a script in misc/maintenance/generate_explain.pl that can generate > a new Explain file, based on Koha's config files and an optional extra > config file. See the POD in the script for more details. >- Replace the old Explain files provided with Koha with two new files, > generated by the script described above and based on the standard > Koha/Zebra config. > >To test: >- Have a look at etc/zebradb/explain-authorities.xml and > etc/zebradb/explain-biblios.xml and see if they make sense as example > files. Check that the list of indexes corresponds to the indexes set > up in etc/zebradb/pqf.properties. >- Run "perldoc misc/maintenance/generate_explain.pl" to see available > options and a decription of the config file. >- Run generate_explain.pl with different options and settings in the > config file, and check that the output Explain docs make sense. > >This patch will not break anything. It is more about documentation. >The Explain file documents the SRU server, it does not configure it. >--- > etc/zebradb/explain-authorities.xml | 601 +++++++-------------- > etc/zebradb/explain-biblios.xml | 591 +++++++------------- > .../prog/en/modules/services/explain.tt | 260 +++++++++ > misc/maintenance/generate_explain.pl | 331 ++++++++++++ > 4 files changed, 976 insertions(+), 807 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/services/explain.tt > create mode 100644 misc/maintenance/generate_explain.pl > >diff --git a/etc/zebradb/explain-authorities.xml b/etc/zebradb/explain-authorities.xml >index e8425d8..7fa0716 100644 >--- a/etc/zebradb/explain-authorities.xml >+++ b/etc/zebradb/explain-authorities.xml >@@ -1,621 +1,417 @@ > <?xml version="1.0" encoding="UTF-8"?> >- >-<!-- $Id: explain.xml,v 1.14 2006/09/27 13:35:09 marc Exp $ --> >- > <!-- this file configures the SRU/SRW explain response --> > <!-- see: http://explain.z3950.org/dtd/commentary.html --> > <!-- validate this using zeerex-2.0.xsd --> > <!-- Extensions see: http://explain.z3950.org/dtd/extensions.html --> >- >+<!-- Generated by misc/maintenance/generate_explain.pl on 2017-03-02 07:06:34 --> > <explain xmlns="http://explain.z3950.org/dtd/2.0/"> >- >- <!-- try stylesheet url: http://./?stylesheet=docpath/sru2.xsl --> >- <serverInfo protocol="SRW/SRU/Z39.50"> >- >- <host>__ZEBRA_SRU_HOST__</host> >- >- <port>9999</port> >- <!-- <database numRecs="1314" lastUpdate="2006-03-15 09-05-33"> >- Default</database> --> >+ <serverInfo protocol="SRW/SRU/Z39.50" version="2.0" transport="http"> >+ <!-- If host is set to @ you need to hand edit it, or you can edit the >+ <listen> element for "publicserver" in koha-conf.xml: >+ <listen id="publicserver" >tcp:<host>:<port></listen> >+ and then regenerate the Explain doc. --> >+ <host>library.example.org</host> >+ <!-- The sample and default configs provided with Koha assume that only >+ bibliographic records will be exposed through SRU: There is an >+ available <listen id="publicserver"/> element set up for serving >+ bibliographic records, but no corresponding element for a public >+ authorities server. Since we can't guess at the id of a public >+ authorities server, the port element below is filled with a >+ placeholder which should be replaced manually if a public authorities >+ server is set up. --> >+ <port>__ZEBRA_SRU_AUTHORITIES_PORT__</port> > <database>authorities</database> >- <!--<authentication> >- <user>kohauser</user> >- <group>kohagroup</group> >- <password>zebrastripes</password> >- </authentication>--> > </serverInfo> >- > <databaseInfo> >- >- <title lang="en" primary="true">Koha 3 Authority SRU/SRW/Z39.50 server</title> >- >- <description lang="en" primary="true"> >- Koha 3 Authority Server >- </description> >- >- <author>Joshua Ferraro, LibLime, http://liblime.com, >- Marc Cromme, Mike Taylor, Index Data Aps, >- http://www.indexdata.dk</author> >- >- <contact>Joshua Ferraro, jmf(at)liblime(dot)com</contact> >- >- <!--<langUsage codes="en fr"> >- The records are in English and French. >- </langUsage> --> >- <!-- <extend>Partially crawled web data</extend> --> >- >- <history> >- Created for Koha 3 >- http://koha-community.org >- </history> >- >- <implementation identifier="zebra" version="1.4"> >+ <title lang="en" primary="true">Koha Authorities SRU/SRW/Z39.50 server</title> >+ <description lang="en" primary="true">Koha Authorities Server</description> >+ <author>My library</author> >+ <contact>library@example.org</contact> >+ <implementation identifier="zebra" version="2.0"> > <title>Index Data YAZ/ZEBRA http://www.indexdata.dk/zebra</title> > </implementation> >- >- <links> >- <!--<link type="www">http://foo.indexdata.dk:80</link>--> >- <link type="z39.50">http://__ZEBRA_SRU_HOST__:__ZEBRA_SRU_AUTHORITIES_PORT__</link> >- <link type="srw">http://__ZEBRA_SRU_HOST__:__ZEBRA_SRU_AUTHORITIES_PORT__</link> >- <link type="sru">http://__ZEBRA_SRU_HOST__:__ZEBRA_SRU_AUTHORITIES_PORT__</link> >- <!--<link type="oai"></link> >- <link type="rss"></link> >- <link type="icon"></link> --> >+ <links> >+ <link type="www">http://library.example.org/</link> >+ <link type="z39.50">http://library.example.org:9999</link> >+ <link type="srw">http://library.example.org:9999</link> >+ <link type="sru">http://library.example.org:9999</link> >+ <link type="oai">http://library.example.org/cgi-bin/koha/oai.pl</link> > </links> >- > </databaseInfo> >- >- <!-- > <metaInfo> >- <dateModified>2002-03-29 19:00:00</dateModified> >- <aggregatedFrom> z39.50r://gondolin.hist.liv.ac.uk:210/IR-Explain-1? >- id=ghlau-1;esn=F;rs=XML </aggregatedFrom> >- <dateAggregated>2002-03-30 06:30:00</dateAggregated> >+ <dateModified>2017-03-02 07:06:34</dateModified> > </metaInfo> >- --> >- >- > <indexInfo> >- <set name="cql" identifier="info:srw/cql-context-set/1/cql-v1.1"> >- <title>CQL Standard Set</title> >- </set> >- <set name="rec" identifier="info:srw/cql-context-set/2/rec-1.0"> >- <title>Record Standard Set</title> >- </set> >- <set name="alvis" identifier="http://indexdata.dk/zebra/xslt/1"> >- <title>Alvis Set</title> >- </set> >- <set name="dc" identifier="info:srw/cql-context-set/1/dc-v1.1"> >- <title>Dublin Core Set</title> >- </set> >- <set name="bib1" identifier="1.2.840.10003.3.1"> >- <title>BIB-1 Z39.50 Standard Set</title> >- </set> >- >- >- <!-- CQL standard index --> >+ <set identifier="info:srw/cql-context-set/1/cql-v1.1" name="cql"/> >+ <set identifier="info:srw/cql-context-set/2/rec-1.0" name="rec"/> >+ <set identifier="info:srw/cql-context-set/1/dc-v1.1" name="dc"/> >+ <set identifier="http://zing.z3950.org/cql/bath/2.0/" name="bath"/> > <index search="true" scan="true" sort="false"> >- <title lang="en">CQL Server Choice</title> >- <map><name set="cql">serverChoice</name></map> > <map> >- <attr type="1" set="bib1">text</attr> >+ <name set="cql">serverChoice</name> > </map> >- </index> >- <index search="true" scan="true" sort="false"> >- <title lang="en">CQL All</title> >- <map><name set="cql">all</name></map> >- <map> >- <attr type="1" set="bib1">text</attr> >+ <map primary="true"> >+ <attr type="1">1016</attr> > </map> > </index> >- >- <!-- Record ID index --> > <index search="true" scan="true" sort="false"> >- <title lang="en">Record ID</title> >- <map><name set="rec">id</name></map> > <map> >- <attr type="1" set="bib1">rec:id</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="rec">id</name> > </map> >- </index> >- >- <!-- Alvis indexes --> >- <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis Text Relevance Ranked</title> >- <map><name set="alvis">text</name></map> >- <map> >- <attr type="1" set="bib1">text</attr> >- <attr type="2" set="bib1">102</attr> >+ <map primary="true"> >+ <attr type="1">12</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis Anchor Text</title> >- <map><name set="alvis">anchortext</name></map> > <map> >- <attr type="1" set="bib1">anchortext</attr> >- <attr type="2" set="bib1">102</attr> >+ <name set="dc">identifier</name> > </map> >- </index> >- <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis Date Modified</title> >- <map><name set="alvis">date-modified</name></map> >- <map> >- <attr type="1" set="bib1">ac:date-modified</attr> >- <attr type="4" set="bib1">5</attr> >+ <map primary="true"> >+ <attr type="1">1007</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis Date Checked</title> >- <map><name set="alvis">date-checked</name></map> > <map> >- <attr type="1" set="bib1">ac:date-checked</attr> >- <attr type="4" set="bib1">5</attr> >+ <name set="dc">title</name> > </map> >- </index> >- <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis Identifier Url</title> >- <map><name set="alvis">identifier-url</name></map> >- <map> >- <attr type="1" set="bib1">ac:identifier-url</attr> >- <attr type="4" set="bib1">3</attr> >+ <map primary="true"> >+ <attr type="1">4</attr> > </map> > </index> >- <!--<index search="true" scan="true" sort="false"> >- <title lang="en">Alvis Identifier Server</title> >- <map><name set="alvis">identifier-server</name></map> >- <map> >- <attr type="1" set="bib1">ac:identifier-server</attr> >- <attr type="4" set="bib1">3</attr> >- </map> >- </index> --> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis Topic Class</title> >- <map><name set="alvis">topic-class</name></map> > <map> >- <attr type="1" set="bib1">an:topic-class</attr> >+ <name set="dc">subject</name> > </map> >- </index> >- <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis Language</title> >- <map><name set="alvis">language</name></map> >- <map> >- <attr type="1" set="bib1">an:language</attr> >+ <map primary="true"> >+ <attr type="1">21</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity Date</title> >- <map><name set="alvis">entity-date</name></map> > <map> >- <attr type="1" set="bib1">la:entity-date</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">creator</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1003</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity Disease</title> >- <map><name set="alvis">entity-disease</name></map> > <map> >- <attr type="1" set="bib1">la:entity-disease</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">author</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1003</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity Gene</title> >- <map><name set="alvis">entity-gene</name></map> > <map> >- <attr type="1" set="bib1">la:entity-gene</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">itemtype</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1031</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity Location</title> >- <map><name set="alvis">entity-location</name></map> > <map> >- <attr type="1" set="bib1">la:entity-location</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">barcode</name> > </map> >- </index> >- <!--<index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity Mail</title> >- <map><name set="alvis">entity-mail</name></map> >- <map> >- <attr type="1" set="bib1">la:entity-mail</attr> >- <attr type="4" set="bib1">3</attr> >+ <map primary="true"> >+ <attr type="1">1028</attr> > </map> >- </index>--> >+ </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity Person</title> >- <map><name set="alvis">entity-person</name></map> > <map> >- <attr type="1" set="bib1">la:entity-person</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">branch</name> > </map> >- </index> >- <!-- <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity Protein</title> >- <map><name set="alvis">entity-protein</name></map> >- <map> >- <attr type="1" set="bib1">la:entity-protein</attr> >- <attr type="4" set="bib1">3</attr> >+ <map primary="true"> >+ <attr type="1">1033</attr> > </map> >- </index> --> >+ </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity Species</title> >- <map><name set="alvis">entity-species</name></map> > <map> >- <attr type="1" set="bib1">la:entity-species</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">isbn</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">7</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity URL</title> >- <map><name set="alvis">entity-url</name></map> > <map> >- <attr type="1" set="bib1">la:entity-url</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">issn</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">8</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity Organism</title> >- <map><name set="alvis">entity-organism</name></map> > <map> >- <attr type="1" set="bib1">la:entity-organism</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">any</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1016</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity Symptom</title> >- <map><name set="alvis">entity-symptom</name></map> > <map> >- <attr type="1" set="bib1">la:entity-symptom</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">note</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">63</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity Chemical</title> >- <map><name set="alvis">entity-chemical</name></map> > <map> >- <attr type="1" set="bib1">la:entity-chemical</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">pname</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity Drug</title> >- <map><name set="alvis">entity-drug</name></map> > <map> >- <attr type="1" set="bib1">la:entity-drug</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">editor</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1020</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Lemma Canonical </title> >- <map><name set="alvis">lemma-canonical</name></map> > <map> >- <attr type="1" set="bib1">la:lemma-canonical</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">publisher</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1018</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Syntactic Noun</title> >- <map><name set="alvis">syntactic-noun</name></map> > <map> >- <attr type="1" set="bib1">la:syntactic-noun</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">description</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">62</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Syntactic Verb</title> >- <map><name set="alvis">syntactic-verb</name></map> > <map> >- <attr type="1" set="bib1">la:syntactic-verb</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">date</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">30</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Syntactic Adjective</title> >- <map><name set="alvis">syntactic-adjective</name></map> > <map> >- <attr type="1" set="bib1">la:syntactic-adjective</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">resourceType</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1031</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Word Form</title> >- <map><name set="alvis">word-form</name></map> > <map> >- <attr type="1" set="bib1">la:word-form</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">format</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1034</attr> > </map> > </index> >- <!-- <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Term Form</title> >- <map><name set="alvis">term-form</name></map> >+ <index search="true" scan="true" sort="false"> > <map> >- <attr type="1" set="bib1">la:term-form</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">resourceIdentifier</name> > </map> >- </index> --> >- <!-- <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis Wpcats</title> >- <map><name set="alvis">wpcats</name></map> >- <map> >- <attr type="1" set="bib1">wpcats</attr> >+ <map primary="true"> >+ <attr type="1">12</attr> > </map> >- </index> --> >- >- <!-- Dublin Core Indexes --> >+ </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Title</title> >- <map><name set="dc">title</name></map> > <map> >- <attr type="1" set="bib1">dc:title</attr> >+ <name set="dc">language</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">54</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Creator</title> >- <map><name set="dc">creator</name></map> > <map> >- <attr type="1" set="bib1">dc:creator</attr> >+ <name set="dc">Place-publication</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">59</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Subject</title> >- <map><name set="dc">subject</name></map> > <map> >- <attr type="1" set="bib1">dc:subject</attr> >+ <name set="bath">keyTitle</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">33</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Description</title> >- <map><name set="dc">description</name></map> > <map> >- <attr type="1" set="bib1">dc:description</attr> >+ <name set="bath">possessingInstitution</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1044</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Publisher</title> >- <map><name set="dc">publisher</name></map> > <map> >- <attr type="1" set="bib1">dc:publisher</attr> >+ <name set="bath">name</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1002</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Contributor</title> >- <map><name set="dc">contributor</name></map> > <map> >- <attr type="1" set="bib1">dc:contributor</attr> >+ <name set="bath">personalName</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Date</title> >- <map><name set="dc">date</name></map> > <map> >- <attr type="1" set="bib1">dc:date</attr> >+ <name set="bath">corporateName</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">2</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Type</title> >- <map><name set="dc">type</name></map> > <map> >- <attr type="1" set="bib1">dc:type</attr> >+ <name set="bath">conferenceName</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">3</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Format</title> >- <map><name set="dc">format</name></map> > <map> >- <attr type="1" set="bib1"></attr> >+ <name set="bath">uniformTitle</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">6</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Identifier</title> >- <map><name set="dc">identifier</name></map> > <map> >- <attr type="1" set="bib1">dc:identifier</attr> >+ <name set="bath">isbn</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">7</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Source</title> >- <map><name set="dc">source</name></map> > <map> >- <attr type="1" set="bib1">dc:source</attr> >+ <name set="bath">issn</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">8</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Language</title> >- <map><name set="dc">language</name></map> > <map> >- <attr type="1" set="bib1">dc:language</attr> >+ <name set="bath">geographicName</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">58</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Relation</title> >- <map><name set="dc">relation</name></map> > <map> >- <attr type="1" set="bib1">dc:relation</attr> >+ <name set="bath">notes</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">63</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Coverage</title> >- <map><name set="dc">coverage</name></map> > <map> >- <attr type="1" set="bib1">dc:coverage</attr> >+ <name set="bath">topicalSubject</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1079</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Rights</title> >- <map><name set="dc">rights</name></map> > <map> >- <attr type="1" set="bib1">dc:rights</attr> >+ <name set="bath">genreForm</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1075</attr> > </map> > </index> >- > </indexInfo> >- >- <!-- Z39.50 stuff ... not allowed in one and the same explain together with >- <schemaInfo>, sic .. >- <recordInfo> >- <recordSyntax identifier="1.2.840.10003.5.109.10"> >- <elementSet name="F"> >- <title lang="en" primary="true">Full XML Record</title> >- </elementSet> >- </recordSyntax> >- </recordInfo> >- --> >- >- <schemaInfo> >- >- <schema identifier="http://www.loc.gov/zing/srw/dcschema/v1.0/" >- location="http://www.loc.gov/zing/srw/dc.xsd" >- name="dc" >- retrieve="true"> >- <title lang="en">Dublin Core</title> >- </schema> >- >- <schema identifier="http://indexdata.dk/dc-short" >- location="" >- name="dc-short" >- retrieve="true"> >- <title lang="en">Dublin Core Short Form</title> >- </schema> >- >- <!--<schema identifier="http://indexdata.dk/snippet" >- location="" >- name="snippet" >- retrieve="true"> >- <title lang="en">Snippet - Not Implemented</title> >- </schema> --> >- >- <!--<schema identifier="http://indexdata.dk/help" >- location="" >- name="help" >- retrieve="true"> >- <title lang="en">Help - Not Implemented</title> >- </schema> --> >- >- <schema identifier="http://indexdata.dk/pretty" >- location="" >- name="pretty" >- retrieve="true"> >- <title lang="en">Pretty</title> >- </schema> >- >- <schema identifier="http://indexdata.dk/D9.1" >- location="" >- name="D9.1" >- retrieve="true"> >- <title lang="en">Alvis D9.1 Schema</title> >- </schema> >- >- <schema identifier="http://alvis.info/enriched/" >- location="http://project.alvis.info/alvis_docs/alvis-document.xsd" >- name="alvis" >- retrieve="true"> >- <title lang="en">Alvis Enriched</title> >- </schema> >- >- <schema identifier="http://indexdata.dk/zebra/xslt/1" >- location="" >- name="index" >- retrieve="true"> >- <title lang="en">Zebra Indexing</title> >- </schema> >- >- </schemaInfo> >- > <configInfo> >- > <!-- searchRetrieve settings --> >- > <!-- default context set --> > <default type="contextSet">cql</default> >- > <default type="index">all</default> >- > <!-- default relation --> > <default type="relation">=</default> >- > <!-- relation supported by the server or index --> >- <supports type="relation"><</supports> <!-- 2=1 OK --> >- <supports type="relation"><=</supports> <!-- 2=2 OK --> >- <supports type="relation">=</supports> <!-- 2=3 OK --> >- <supports type="relation">>=</supports> <!-- 2=4 OK --> >- <supports type="relation">></supports> <!-- 2=5 OK --> >- <!-- <supports type="relation"><></supports> --><!-- 2=6 DEAD !!! --> >- <!-- <supports type="relation">all</supports> --><!-- 2=3 OK --> >- <!-- <supports type="relation">any</supports> --><!-- 2=3 OK --> >- >+ <supports type="relation"><</supports> >+ <supports type="relation">le</supports> >+ <supports type="relation">eq</supports> >+ <supports type="relation">exact</supports> >+ <supports type="relation">ge</supports> >+ <supports type="relation">></supports> >+ <supports type="relation"><></supports> >+ <supports type="relation">all</supports> >+ <supports type="relation">any</supports> >+ <supports type="relation">scr</supports> > <!-- relation modifier supported by the server or index --> >- <!-- <supports type="relationModifier">relevant</supports> --><!-- 2=102 OK, makes no difference .. sic --> >- <!-- <supports type="relationModifier">phonetic</supports> --> <!-- 2=100 DEAD --> >- <!-- <supports type="relationModifier">stem</supports> --> <!-- 2=101 DEAD !! --> >- >+ <supports type="relationModifier">relevant</supports> >+ <supports type="relationModifier">fuzzy</supports> >+ <supports type="relationModifier">stem</supports> >+ <supports type="relationModifier">phonetic</supports> > <!-- support proximity (Empty) --> >- <!-- <supports type="proximity"></supports> --> <!-- DEAD, title = (house prox/distance=1/unit=word the) FAILS --> >- >- <!-- proximity modifier supported by the server or index >+ <!-- <supports type="proximity"></supports> --> >+ <!-- DEAD, title = (house prox/distance=1/unit=word the) FAILS --> >+ <!-- proximity modifier supported by the server or index > (relation, distance, unit, ordering) --> > <!-- <supports type="proximityModifier"></supports> --> >- > <!-- boolean modifier supported by the server or index --> > <!-- <supports type="booleanModifier"></supports> --> >- > <!-- masking character supported (* or ?) --> > <supports type="maskingCharacter">*</supports> > <supports type="maskingCharacter">?</supports> >- > <!-- anchoring supported? (^ character) --> > <!-- empty terms supported (Empty) --> >- <supports type="emptyTerm"></supports> >- >+ <supports type="emptyTerm"/> > <!-- sorting settings --> >- > <!-- default schema used in sorting, in short name form --> > <!-- <default type="sortSchema"></default> --> > <!-- MIKE: deprecated --> >- > <!-- server support sort --> >- > <!-- supported sortmodifier (ascending, missingValue, caseSensitive) --> > <!-- <supports type="sortModifier"></supports> --> >- >- <!-- presentation settings --> >- >+ <!-- presentation settings --> > <!-- default number of records that a server will return at once --> > <default type="numberOfRecords">0</default> >- > <!-- default schema used for retrieved records --> > <default type="retrieveSchema">index</default> > <!-- default stylesheet URL, or if stylesheets are supported --> > <setting type="stylesheet">docpath/sru.xsl</setting> >- > <!-- default record packing returned (string or xml) --> > <default type="recordPacking">xml</default> >- > <!-- maximum number of records that a server will return at once --> > <!-- <setting type="maximumRecords">1000</setting> --> >- > <!-- support result sets (Empty) --> >- <!-- <supports type="resultSets"></supports> --> >- >+ <!-- <supports type="resultSets"></supports> --> > <!-- XPath retrieval supported --> > <!-- <supports type="recordXPath"></supports> --> >- > <!-- scan settings --> >- > <!-- scan operation supported --> >- <supports type="scan"></supports> >- >+ <supports type="scan"/> > <!-- default number of terms to be returned in scan --> > <default type="numberOfTerms">20</default> >- > <!-- other server settings --> >- > <!-- older version of the protocol supported --> > <!-- <supports type="version">1.1</supports> --> >- > <!-- number of seconds that a result set will be maintained for --> > <setting type="resultSetTTL">0</setting> >- > <!-- A type of extraRequestData available in the > searchRetrieveRequest. The extra*Data fields are represented as two > space separated words, the first the identifier for the extension and >@@ -623,14 +419,11 @@ > only one word, then it is the extension id and all elements from > within are supported. --> > <!-- <supports type="extraSearchData"></supports> --> >- > <!-- A type of extraRequestData available in the explainRequest --> > <!-- <supports type="extraExplainData"></supports> --> >- > <!-- A type of extraRequestData available in the scanRequest --> > <!-- <supports type="extraScanData"></supports> --> > <!-- The URI identifier of a supported profile --> > <!-- <supports type="profile"></supports> --> > </configInfo> >- > </explain> >diff --git a/etc/zebradb/explain-biblios.xml b/etc/zebradb/explain-biblios.xml >index ff286fd..00bb95f 100644 >--- a/etc/zebradb/explain-biblios.xml >+++ b/etc/zebradb/explain-biblios.xml >@@ -1,621 +1,409 @@ > <?xml version="1.0" encoding="UTF-8"?> >- >-<!-- $Id: explain.xml,v 1.14 2006/09/27 13:35:09 marc Exp $ --> >- > <!-- this file configures the SRU/SRW explain response --> > <!-- see: http://explain.z3950.org/dtd/commentary.html --> > <!-- validate this using zeerex-2.0.xsd --> > <!-- Extensions see: http://explain.z3950.org/dtd/extensions.html --> >- >+<!-- Generated by misc/maintenance/generate_explain.pl on 2017-03-02 07:06:17 --> > <explain xmlns="http://explain.z3950.org/dtd/2.0/"> >- >- <!-- try stylesheet url: http://./?stylesheet=docpath/sru2.xsl --> >- <serverInfo protocol="SRW/SRU/Z39.50"> >- >- <host>__ZEBRA_SRU_HOST__</host> >- >+ <serverInfo protocol="SRW/SRU/Z39.50" version="2.0" transport="http"> >+ <!-- If host is set to @ you need to hand edit it, or you can edit the >+ <listen> element for "publicserver" in koha-conf.xml: >+ <listen id="publicserver" >tcp:<host>:<port></listen> >+ and then regenerate the Explain doc. --> >+ <host>library.example.org</host> > <port>9999</port> >- <!-- <database numRecs="1314" lastUpdate="2006-03-15 09-05-33"> >- Default</database> --> > <database>biblios</database> >- <!--<authentication> >- <user>kohauser</user> >- <group>kohagroup</group> >- <password>zebrastripes</password> >- </authentication>--> > </serverInfo> >- > <databaseInfo> >- >- <title lang="en" primary="true">Koha 3 Bibliographic SRU/SRW/Z39.50 server</title> >- >- <description lang="en" primary="true"> >- Koha 3 Bibliographic Server >- </description> >- >- <author>Joshua Ferraro, LibLime, http://liblime.com, >- Marc Cromme, Mike Taylor, Index Data Aps, >- http://www.indexdata.dk</author> >- >- <contact>Joshua Ferraro, jmf(at)liblime(dot)com</contact> >- >- <!--<langUsage codes="en fr"> >- The records are in English and French. >- </langUsage> --> >- <!-- <extend>Partially crawled web data</extend> --> >- >- <history> >- Created for Koha 3 >- http://koha-community.org >- </history> >- >- <implementation identifier="zebra" version="1.4"> >+ <title lang="en" primary="true">Koha Bibliographic SRU/SRW/Z39.50 server</title> >+ <description lang="en" primary="true">Koha Bibliographic Server</description> >+ <author>My library</author> >+ <contact>library@example.org</contact> >+ <implementation identifier="zebra" version="2.0"> > <title>Index Data YAZ/ZEBRA http://www.indexdata.dk/zebra</title> > </implementation> >- >- <links> >- <!--<link type="www">http://foo.indexdata.dk:80</link>--> >- <link type="z39.50">http://__ZEBRA_SRU_HOST__:__ZEBRA_SRU_BIBLIOS_PORT__</link> >- <link type="srw">http://__ZEBRA_SRU_HOST__:__ZEBRA_SRU_BIBLIOS_PORT__</link> >- <link type="sru">http://__ZEBRA_SRU_HOST__:__ZEBRA_SRU_BIBLIOS_PORT__</link> >- <!--<link type="oai"></link> >- <link type="rss"></link> >- <link type="icon"></link> --> >+ <links> >+ <link type="www">http://library.example.org/</link> >+ <link type="z39.50">http://library.example.org:9999</link> >+ <link type="srw">http://library.example.org:9999</link> >+ <link type="sru">http://library.example.org:9999</link> >+ <link type="oai">http://library.example.org/cgi-bin/koha/oai.pl</link> > </links> >- > </databaseInfo> >- >- <!-- > <metaInfo> >- <dateModified>2002-03-29 19:00:00</dateModified> >- <aggregatedFrom> z39.50r://gondolin.hist.liv.ac.uk:210/IR-Explain-1? >- id=ghlau-1;esn=F;rs=XML </aggregatedFrom> >- <dateAggregated>2002-03-30 06:30:00</dateAggregated> >+ <dateModified>2017-03-02 07:06:17</dateModified> > </metaInfo> >- --> >- >- > <indexInfo> >- <set name="cql" identifier="info:srw/cql-context-set/1/cql-v1.1"> >- <title>CQL Standard Set</title> >- </set> >- <set name="rec" identifier="info:srw/cql-context-set/2/rec-1.0"> >- <title>Record Standard Set</title> >- </set> >- <set name="alvis" identifier="http://indexdata.dk/zebra/xslt/1"> >- <title>Alvis Set</title> >- </set> >- <set name="dc" identifier="info:srw/cql-context-set/1/dc-v1.1"> >- <title>Dublin Core Set</title> >- </set> >- <set name="bib1" identifier="1.2.840.10003.3.1"> >- <title>BIB-1 Z39.50 Standard Set</title> >- </set> >- >- >- <!-- CQL standard index --> >+ <set identifier="info:srw/cql-context-set/1/cql-v1.1" name="cql"/> >+ <set identifier="info:srw/cql-context-set/2/rec-1.0" name="rec"/> >+ <set identifier="info:srw/cql-context-set/1/dc-v1.1" name="dc"/> >+ <set identifier="http://zing.z3950.org/cql/bath/2.0/" name="bath"/> > <index search="true" scan="true" sort="false"> >- <title lang="en">CQL Server Choice</title> >- <map><name set="cql">serverChoice</name></map> > <map> >- <attr type="1" set="bib1">text</attr> >+ <name set="cql">serverChoice</name> > </map> >- </index> >- <index search="true" scan="true" sort="false"> >- <title lang="en">CQL All</title> >- <map><name set="cql">all</name></map> >- <map> >- <attr type="1" set="bib1">text</attr> >+ <map primary="true"> >+ <attr type="1">1016</attr> > </map> > </index> >- >- <!-- Record ID index --> > <index search="true" scan="true" sort="false"> >- <title lang="en">Record ID</title> >- <map><name set="rec">id</name></map> > <map> >- <attr type="1" set="bib1">rec:id</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="rec">id</name> > </map> >- </index> >- >- <!-- Alvis indexes --> >- <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis Text Relevance Ranked</title> >- <map><name set="alvis">text</name></map> >- <map> >- <attr type="1" set="bib1">text</attr> >- <attr type="2" set="bib1">102</attr> >+ <map primary="true"> >+ <attr type="1">12</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis Anchor Text</title> >- <map><name set="alvis">anchortext</name></map> > <map> >- <attr type="1" set="bib1">anchortext</attr> >- <attr type="2" set="bib1">102</attr> >+ <name set="dc">identifier</name> > </map> >- </index> >- <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis Date Modified</title> >- <map><name set="alvis">date-modified</name></map> >- <map> >- <attr type="1" set="bib1">ac:date-modified</attr> >- <attr type="4" set="bib1">5</attr> >+ <map primary="true"> >+ <attr type="1">1007</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis Date Checked</title> >- <map><name set="alvis">date-checked</name></map> > <map> >- <attr type="1" set="bib1">ac:date-checked</attr> >- <attr type="4" set="bib1">5</attr> >+ <name set="dc">title</name> > </map> >- </index> >- <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis Identifier Url</title> >- <map><name set="alvis">identifier-url</name></map> >- <map> >- <attr type="1" set="bib1">ac:identifier-url</attr> >- <attr type="4" set="bib1">3</attr> >+ <map primary="true"> >+ <attr type="1">4</attr> > </map> > </index> >- <!--<index search="true" scan="true" sort="false"> >- <title lang="en">Alvis Identifier Server</title> >- <map><name set="alvis">identifier-server</name></map> >- <map> >- <attr type="1" set="bib1">ac:identifier-server</attr> >- <attr type="4" set="bib1">3</attr> >- </map> >- </index> --> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis Topic Class</title> >- <map><name set="alvis">topic-class</name></map> > <map> >- <attr type="1" set="bib1">an:topic-class</attr> >+ <name set="dc">subject</name> > </map> >- </index> >- <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis Language</title> >- <map><name set="alvis">language</name></map> >- <map> >- <attr type="1" set="bib1">an:language</attr> >+ <map primary="true"> >+ <attr type="1">21</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity Date</title> >- <map><name set="alvis">entity-date</name></map> > <map> >- <attr type="1" set="bib1">la:entity-date</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">creator</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1003</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity Disease</title> >- <map><name set="alvis">entity-disease</name></map> > <map> >- <attr type="1" set="bib1">la:entity-disease</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">author</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1003</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity Gene</title> >- <map><name set="alvis">entity-gene</name></map> > <map> >- <attr type="1" set="bib1">la:entity-gene</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">itemtype</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1031</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity Location</title> >- <map><name set="alvis">entity-location</name></map> > <map> >- <attr type="1" set="bib1">la:entity-location</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">barcode</name> > </map> >- </index> >- <!--<index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity Mail</title> >- <map><name set="alvis">entity-mail</name></map> >- <map> >- <attr type="1" set="bib1">la:entity-mail</attr> >- <attr type="4" set="bib1">3</attr> >+ <map primary="true"> >+ <attr type="1">1028</attr> > </map> >- </index>--> >+ </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity Person</title> >- <map><name set="alvis">entity-person</name></map> > <map> >- <attr type="1" set="bib1">la:entity-person</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">branch</name> > </map> >- </index> >- <!-- <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity Protein</title> >- <map><name set="alvis">entity-protein</name></map> >- <map> >- <attr type="1" set="bib1">la:entity-protein</attr> >- <attr type="4" set="bib1">3</attr> >+ <map primary="true"> >+ <attr type="1">1033</attr> > </map> >- </index> --> >+ </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity Species</title> >- <map><name set="alvis">entity-species</name></map> > <map> >- <attr type="1" set="bib1">la:entity-species</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">isbn</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">7</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity URL</title> >- <map><name set="alvis">entity-url</name></map> > <map> >- <attr type="1" set="bib1">la:entity-url</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">issn</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">8</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity Organism</title> >- <map><name set="alvis">entity-organism</name></map> > <map> >- <attr type="1" set="bib1">la:entity-organism</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">any</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1016</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity Symptom</title> >- <map><name set="alvis">entity-symptom</name></map> > <map> >- <attr type="1" set="bib1">la:entity-symptom</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">note</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">63</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity Chemical</title> >- <map><name set="alvis">entity-chemical</name></map> > <map> >- <attr type="1" set="bib1">la:entity-chemical</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">pname</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Entity Drug</title> >- <map><name set="alvis">entity-drug</name></map> > <map> >- <attr type="1" set="bib1">la:entity-drug</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">editor</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1020</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Lemma Canonical </title> >- <map><name set="alvis">lemma-canonical</name></map> > <map> >- <attr type="1" set="bib1">la:lemma-canonical</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">publisher</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1018</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Syntactic Noun</title> >- <map><name set="alvis">syntactic-noun</name></map> > <map> >- <attr type="1" set="bib1">la:syntactic-noun</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">description</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">62</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Syntactic Verb</title> >- <map><name set="alvis">syntactic-verb</name></map> > <map> >- <attr type="1" set="bib1">la:syntactic-verb</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">date</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">30</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Syntactic Adjective</title> >- <map><name set="alvis">syntactic-adjective</name></map> > <map> >- <attr type="1" set="bib1">la:syntactic-adjective</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">resourceType</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1031</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Word Form</title> >- <map><name set="alvis">word-form</name></map> > <map> >- <attr type="1" set="bib1">la:word-form</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">format</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1034</attr> > </map> > </index> >- <!-- <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis NLP Term Form</title> >- <map><name set="alvis">term-form</name></map> >+ <index search="true" scan="true" sort="false"> > <map> >- <attr type="1" set="bib1">la:term-form</attr> >- <attr type="4" set="bib1">3</attr> >+ <name set="dc">resourceIdentifier</name> > </map> >- </index> --> >- <!-- <index search="true" scan="true" sort="false"> >- <title lang="en">Alvis Wpcats</title> >- <map><name set="alvis">wpcats</name></map> >- <map> >- <attr type="1" set="bib1">wpcats</attr> >+ <map primary="true"> >+ <attr type="1">12</attr> > </map> >- </index> --> >- >- <!-- Dublin Core Indexes --> >+ </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Title</title> >- <map><name set="dc">title</name></map> > <map> >- <attr type="1" set="bib1">dc:title</attr> >+ <name set="dc">language</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">54</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Creator</title> >- <map><name set="dc">creator</name></map> > <map> >- <attr type="1" set="bib1">dc:creator</attr> >+ <name set="dc">Place-publication</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">59</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Subject</title> >- <map><name set="dc">subject</name></map> > <map> >- <attr type="1" set="bib1">dc:subject</attr> >+ <name set="bath">keyTitle</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">33</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Description</title> >- <map><name set="dc">description</name></map> > <map> >- <attr type="1" set="bib1">dc:description</attr> >+ <name set="bath">possessingInstitution</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1044</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Publisher</title> >- <map><name set="dc">publisher</name></map> > <map> >- <attr type="1" set="bib1">dc:publisher</attr> >+ <name set="bath">name</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1002</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Contributor</title> >- <map><name set="dc">contributor</name></map> > <map> >- <attr type="1" set="bib1">dc:contributor</attr> >+ <name set="bath">personalName</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Date</title> >- <map><name set="dc">date</name></map> > <map> >- <attr type="1" set="bib1">dc:date</attr> >+ <name set="bath">corporateName</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">2</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Type</title> >- <map><name set="dc">type</name></map> > <map> >- <attr type="1" set="bib1">dc:type</attr> >+ <name set="bath">conferenceName</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">3</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Format</title> >- <map><name set="dc">format</name></map> > <map> >- <attr type="1" set="bib1"></attr> >+ <name set="bath">uniformTitle</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">6</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Identifier</title> >- <map><name set="dc">identifier</name></map> > <map> >- <attr type="1" set="bib1">dc:identifier</attr> >+ <name set="bath">isbn</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">7</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Source</title> >- <map><name set="dc">source</name></map> > <map> >- <attr type="1" set="bib1">dc:source</attr> >+ <name set="bath">issn</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">8</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Language</title> >- <map><name set="dc">language</name></map> > <map> >- <attr type="1" set="bib1">dc:language</attr> >+ <name set="bath">geographicName</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">58</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Relation</title> >- <map><name set="dc">relation</name></map> > <map> >- <attr type="1" set="bib1">dc:relation</attr> >+ <name set="bath">notes</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">63</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Coverage</title> >- <map><name set="dc">coverage</name></map> > <map> >- <attr type="1" set="bib1">dc:coverage</attr> >+ <name set="bath">topicalSubject</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1079</attr> > </map> > </index> > <index search="true" scan="true" sort="false"> >- <title lang="en">DC Rights</title> >- <map><name set="dc">rights</name></map> > <map> >- <attr type="1" set="bib1">dc:rights</attr> >+ <name set="bath">genreForm</name> >+ </map> >+ <map primary="true"> >+ <attr type="1">1075</attr> > </map> > </index> >- > </indexInfo> >- >- <!-- Z39.50 stuff ... not allowed in one and the same explain together with >- <schemaInfo>, sic .. >- <recordInfo> >- <recordSyntax identifier="1.2.840.10003.5.109.10"> >- <elementSet name="F"> >- <title lang="en" primary="true">Full XML Record</title> >- </elementSet> >- </recordSyntax> >- </recordInfo> >- --> >- >- <schemaInfo> >- >- <schema identifier="http://www.loc.gov/zing/srw/dcschema/v1.0/" >- location="http://www.loc.gov/zing/srw/dc.xsd" >- name="dc" >- retrieve="true"> >- <title lang="en">Dublin Core</title> >- </schema> >- >- <schema identifier="http://indexdata.dk/dc-short" >- location="" >- name="dc-short" >- retrieve="true"> >- <title lang="en">Dublin Core Short Form</title> >- </schema> >- >- <!--<schema identifier="http://indexdata.dk/snippet" >- location="" >- name="snippet" >- retrieve="true"> >- <title lang="en">Snippet - Not Implemented</title> >- </schema> --> >- >- <!--<schema identifier="http://indexdata.dk/help" >- location="" >- name="help" >- retrieve="true"> >- <title lang="en">Help - Not Implemented</title> >- </schema> --> >- >- <schema identifier="http://indexdata.dk/pretty" >- location="" >- name="pretty" >- retrieve="true"> >- <title lang="en">Pretty</title> >- </schema> >- >- <schema identifier="http://indexdata.dk/D9.1" >- location="" >- name="D9.1" >- retrieve="true"> >- <title lang="en">Alvis D9.1 Schema</title> >- </schema> >- >- <schema identifier="http://alvis.info/enriched/" >- location="http://project.alvis.info/alvis_docs/alvis-document.xsd" >- name="alvis" >- retrieve="true"> >- <title lang="en">Alvis Enriched</title> >- </schema> >- >- <schema identifier="http://indexdata.dk/zebra/xslt/1" >- location="" >- name="index" >- retrieve="true"> >- <title lang="en">Zebra Indexing</title> >- </schema> >- >- </schemaInfo> >- > <configInfo> >- > <!-- searchRetrieve settings --> >- > <!-- default context set --> > <default type="contextSet">cql</default> >- > <default type="index">all</default> >- > <!-- default relation --> > <default type="relation">=</default> >- > <!-- relation supported by the server or index --> >- <supports type="relation"><</supports> <!-- 2=1 OK --> >- <supports type="relation"><=</supports> <!-- 2=2 OK --> >- <supports type="relation">=</supports> <!-- 2=3 OK --> >- <supports type="relation">>=</supports> <!-- 2=4 OK --> >- <supports type="relation">></supports> <!-- 2=5 OK --> >- <!-- <supports type="relation"><></supports> --><!-- 2=6 DEAD !!! --> >- <!-- <supports type="relation">all</supports> --><!-- 2=3 OK --> >- <!-- <supports type="relation">any</supports> --><!-- 2=3 OK --> >- >+ <supports type="relation"><</supports> >+ <supports type="relation">le</supports> >+ <supports type="relation">eq</supports> >+ <supports type="relation">exact</supports> >+ <supports type="relation">ge</supports> >+ <supports type="relation">></supports> >+ <supports type="relation"><></supports> >+ <supports type="relation">all</supports> >+ <supports type="relation">any</supports> >+ <supports type="relation">scr</supports> > <!-- relation modifier supported by the server or index --> >- <!-- <supports type="relationModifier">relevant</supports> --><!-- 2=102 OK, makes no difference .. sic --> >- <!-- <supports type="relationModifier">phonetic</supports> --> <!-- 2=100 DEAD --> >- <!-- <supports type="relationModifier">stem</supports> --> <!-- 2=101 DEAD !! --> >- >+ <supports type="relationModifier">relevant</supports> >+ <supports type="relationModifier">fuzzy</supports> >+ <supports type="relationModifier">stem</supports> >+ <supports type="relationModifier">phonetic</supports> > <!-- support proximity (Empty) --> >- <!-- <supports type="proximity"></supports> --> <!-- DEAD, title = (house prox/distance=1/unit=word the) FAILS --> >- >- <!-- proximity modifier supported by the server or index >+ <!-- <supports type="proximity"></supports> --> >+ <!-- DEAD, title = (house prox/distance=1/unit=word the) FAILS --> >+ <!-- proximity modifier supported by the server or index > (relation, distance, unit, ordering) --> > <!-- <supports type="proximityModifier"></supports> --> >- > <!-- boolean modifier supported by the server or index --> > <!-- <supports type="booleanModifier"></supports> --> >- > <!-- masking character supported (* or ?) --> > <supports type="maskingCharacter">*</supports> > <supports type="maskingCharacter">?</supports> >- > <!-- anchoring supported? (^ character) --> > <!-- empty terms supported (Empty) --> >- <supports type="emptyTerm"></supports> >- >+ <supports type="emptyTerm"/> > <!-- sorting settings --> >- > <!-- default schema used in sorting, in short name form --> > <!-- <default type="sortSchema"></default> --> > <!-- MIKE: deprecated --> >- > <!-- server support sort --> >- > <!-- supported sortmodifier (ascending, missingValue, caseSensitive) --> > <!-- <supports type="sortModifier"></supports> --> >- >- <!-- presentation settings --> >- >+ <!-- presentation settings --> > <!-- default number of records that a server will return at once --> > <default type="numberOfRecords">0</default> >- > <!-- default schema used for retrieved records --> > <default type="retrieveSchema">index</default> > <!-- default stylesheet URL, or if stylesheets are supported --> > <setting type="stylesheet">docpath/sru.xsl</setting> >- > <!-- default record packing returned (string or xml) --> > <default type="recordPacking">xml</default> >- > <!-- maximum number of records that a server will return at once --> > <!-- <setting type="maximumRecords">1000</setting> --> >- > <!-- support result sets (Empty) --> >- <!-- <supports type="resultSets"></supports> --> >- >+ <!-- <supports type="resultSets"></supports> --> > <!-- XPath retrieval supported --> > <!-- <supports type="recordXPath"></supports> --> >- > <!-- scan settings --> >- > <!-- scan operation supported --> >- <supports type="scan"></supports> >- >+ <supports type="scan"/> > <!-- default number of terms to be returned in scan --> > <default type="numberOfTerms">20</default> >- > <!-- other server settings --> >- > <!-- older version of the protocol supported --> > <!-- <supports type="version">1.1</supports> --> >- > <!-- number of seconds that a result set will be maintained for --> > <setting type="resultSetTTL">0</setting> >- > <!-- A type of extraRequestData available in the > searchRetrieveRequest. The extra*Data fields are represented as two > space separated words, the first the identifier for the extension and >@@ -623,14 +411,11 @@ > only one word, then it is the extension id and all elements from > within are supported. --> > <!-- <supports type="extraSearchData"></supports> --> >- > <!-- A type of extraRequestData available in the explainRequest --> > <!-- <supports type="extraExplainData"></supports> --> >- > <!-- A type of extraRequestData available in the scanRequest --> > <!-- <supports type="extraScanData"></supports> --> > <!-- The URI identifier of a supported profile --> > <!-- <supports type="profile"></supports> --> > </configInfo> >- > </explain> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/services/explain.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/services/explain.tt >new file mode 100644 >index 0000000..3ed99a2 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/services/explain.tt >@@ -0,0 +1,260 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+ >+[%- USE Koha -%] >+[%- USE date( format = '%Y-%m-%d %H:%M:%S' ) -%] >+ >+<!-- this file configures the SRU/SRW explain response --> >+<!-- see: http://explain.z3950.org/dtd/commentary.html --> >+<!-- validate this using zeerex-2.0.xsd --> >+<!-- Extensions see: http://explain.z3950.org/dtd/extensions.html --> >+<!-- Generated by misc/maintenance/generate_explain.pl on [% date.format %] --> >+ >+<explain xmlns="http://explain.z3950.org/dtd/2.0/"> >+ >+ <serverInfo protocol="[% IF ( config.protocol ) %][% config.protocol %][% ELSE %]SRW/SRU/Z39.50[% END %]" >+ version="2.0" >+ transport="[% IF ( config.transport ) %][% config.transport %][% ELSE %]http[% END %]"> >+ <!-- If host is set to @ you need to hand edit it, or you can edit the >+ <listen> element for "publicserver" in koha-conf.xml: >+ <listen id="publicserver" >tcp:<host>:<port></listen> >+ and then regenerate the Explain doc. --> >+ <host>[% host %]</host> >+ [% IF ( authorities ) %] >+ <!-- The sample and default configs provided with Koha assume that only >+ bibliographic records will be exposed through SRU: There is an >+ available <listen id="publicserver"/> element set up for serving >+ bibliographic records, but no corresponding element for a public >+ authorities server. Since we can't guess at the id of a public >+ authorities server, the port element below is filled with a >+ placeholder which should be replaced manually if a public authorities >+ server is set up. --> >+ <port>__ZEBRA_SRU_AUTHORITIES_PORT__</port> >+ <database>authorities</database> >+ [% ELSE %] >+ <port>[% port %]</port> >+ <database>biblios</database> >+ [% END %] >+ </serverInfo> >+ >+ <databaseInfo> >+ >+ [% IF ( config.title ) -%] >+ [%- FOREACH title IN config.title -%] >+ <title lang="[% title.lang %]"[% IF ( title.primary ) %] primary="true"[% END %]>[% title.text %]</title> >+ [% END -%] >+ [% ELSE -%] >+ [% IF ( authorities ) %] >+ <title lang="en" primary="true">Koha Authorities SRU/SRW/Z39.50 server</title> >+ [% ELSE %] >+ <title lang="en" primary="true">Koha Bibliographic SRU/SRW/Z39.50 server</title> >+ [% END %] >+ [% END -%] >+ >+ [%- IF ( config.description ) -%] >+ [%- FOREACH description IN config.description -%] >+ <description lang="[% description.lang %]"[% IF ( description.primary ) %] primary="true"[% END %]>[% description.text %]</description> >+ [% END -%] >+ [% ELSE -%] >+ [% IF ( authorities ) %] >+ <description lang="en" primary="true">Koha Authorities Server</description> >+ [% ELSE %] >+ <description lang="en" primary="true">Koha Bibliographic Server</description> >+ [% END %] >+ [% END -%] >+ >+ <author> >+ [%- IF ( config.author ) -%] >+ [%- config.author -%] >+ [%- ELSIF ( Koha.Preference( 'LibraryName' ) != '' ) -%] >+ [% Koha.Preference( 'LibraryName' ) -%] >+ [%- ELSE -%] >+ Koha >+ [%- END -%]</author> >+ >+ <contact> >+ [%- IF ( config.contact ) -%] >+ [%- config.contact -%] >+ [%- ELSIF ( Koha.Preference( 'KohaAdminEmailAddress' ) != '' ) -%] >+ [%- Koha.Preference( 'KohaAdminEmailAddress' ) -%] >+ [%- END -%]</contact> >+ >+ [% IF ( config.extent ) -%] >+ [%- FOREACH extent IN config.extent -%] >+ <extent lang="[% extent.lang %]"[% IF ( extent.primary ) %] primary="true"[% END %]>[% extent.text %]</extent> >+ [% END -%] >+ [% END -%] >+ >+ [% IF ( config.history ) -%] >+ [%- FOREACH history IN config.history -%] >+ <history lang="[% history.lang %]"[% IF ( history.primary ) %] primary="true"[% END %]>[% history.text %]</history> >+ [% END -%] >+ [% END -%] >+ >+ [% IF ( config.langUsage ) %] >+ [% FOREACH lang IN config.langUsage %] >+ <langUsage lang="[% lang.lang %]"[% IF ( lang.primary ) %] primary="true"[% END %][% IF ( lang.codes ) %] codes="[% lang.codes %]"[% END %]>[% lang.text %]</langUsage> >+ [% END %] >+ [% END %] >+ >+ [% IF ( config.restrictions ) -%] >+ [%- FOREACH restriction IN config.restrictions -%] >+ <restrictions lang="[% restriction.lang %]"[% IF ( restriction.primary ) %] primary="true"[% END %]>[% restriction.text %]</restrictions> >+ [% END -%] >+ [% END -%] >+ >+ [% IF ( config.subjects ) -%] >+ <subjects> >+ [% FOREACH sub IN config.subjects -%] >+ <subject>[% sub %]</subject> >+ [% END -%] >+ </subjects> >+ [% END %] >+ >+ <implementation identifier="zebra" version="2.0"> >+ <title>Index Data YAZ/ZEBRA http://www.indexdata.dk/zebra</title> >+ </implementation> >+ >+ <links> >+ [% IF ( Koha.Preference( 'OPACBaseURL' ) ) %]<link type="www">[% Koha.Preference( 'OPACBaseURL' ) %]/</link>[% END %] >+ <link type="z39.50">[% IF ( config.transport ) %][% config.transport %][% ELSE %]http[% END %]://[% host %]:[% port %]</link> >+ <link type="srw">[% IF ( config.transport ) %][% config.transport %][% ELSE %]http[% END %]://[% host %]:[% port %]</link> >+ <link type="sru">[% IF ( config.transport ) %][% config.transport %][% ELSE %]http[% END %]://[% host %]:[% port %]</link> >+ [% IF ( Koha.Preference( 'OAI-PMH' ) ) %]<link type="oai">[% Koha.Preference( 'OPACBaseURL' ) %]/cgi-bin/koha/oai.pl</link>[% END %] >+ [% IF ( Koha.Preference( 'OpacFavicon' ) ) %]<link type="icon">[% Koha.Preference( 'OpacFavicon' ) %]</link>[% END %] >+ </links> >+ >+ </databaseInfo> >+ >+ <metaInfo> >+ <dateModified>[% date.format %]</dateModified> >+ </metaInfo> >+ >+ <indexInfo> >+ >+ [% FOREACH set IN pqf.sets -%] >+ <set identifier="[% set.identifier %]" name="[% set.name %]"/> >+ [% END -%] >+ >+ [% FOREACH index IN pqf.indexes %] >+ <index search="true" scan="true" sort="false"> >+ [%- IF config.indexnames.${index.id} -%] >+ [%- FOREACH this IN config.indexnames.${index.id} %] >+ <title lang="[% this.lang %]">[% this.title %]</title> >+ [%- END %] >+ [%- END %] >+ <map><name set="[% index.set %]">[% index.index %]</name></map> >+ <map primary="true"> >+ <attr type="[% index.type %]">[% index.value %]</attr> >+ </map> >+ </index> >+ [% END -%] >+ >+ </indexInfo> >+ >+ <configInfo> >+ >+ <!-- searchRetrieve settings --> >+ >+ <!-- default context set --> >+ <default type="contextSet">cql</default> >+ >+ <default type="index">all</default> >+ >+ <!-- default relation --> >+ <default type="relation">=</default> >+ >+ <!-- relation supported by the server or index --> >+ [% FOREACH rel IN pqf.relations -%] >+ <supports type="relation">[% rel.rel | html %]</supports> >+ [% END %] >+ >+ <!-- relation modifier supported by the server or index --> >+ [% FOREACH relmod IN pqf.relationmodifiers -%] >+ <supports type="relationModifier">[% relmod.relmod | html %]</supports> >+ [% END %] >+ >+ <!-- support proximity (Empty) --> >+ <!-- <supports type="proximity"></supports> --> <!-- DEAD, title = (house prox/distance=1/unit=word the) FAILS --> >+ >+ <!-- proximity modifier supported by the server or index >+ (relation, distance, unit, ordering) --> >+ <!-- <supports type="proximityModifier"></supports> --> >+ >+ <!-- boolean modifier supported by the server or index --> >+ <!-- <supports type="booleanModifier"></supports> --> >+ >+ <!-- masking character supported (* or ?) --> >+ <supports type="maskingCharacter">*</supports> >+ <supports type="maskingCharacter">?</supports> >+ >+ <!-- anchoring supported? (^ character) --> >+ <!-- empty terms supported (Empty) --> >+ <supports type="emptyTerm"></supports> >+ >+ <!-- sorting settings --> >+ >+ <!-- default schema used in sorting, in short name form --> >+ <!-- <default type="sortSchema"></default> --> >+ <!-- MIKE: deprecated --> >+ >+ <!-- server support sort --> >+ >+ <!-- supported sortmodifier (ascending, missingValue, caseSensitive) --> >+ <!-- <supports type="sortModifier"></supports> --> >+ >+ <!-- presentation settings --> >+ >+ <!-- default number of records that a server will return at once --> >+ <default type="numberOfRecords">0</default> >+ >+ <!-- default schema used for retrieved records --> >+ <default type="retrieveSchema">index</default> >+ <!-- default stylesheet URL, or if stylesheets are supported --> >+ <setting type="stylesheet">docpath/sru.xsl</setting> >+ >+ <!-- default record packing returned (string or xml) --> >+ <default type="recordPacking">xml</default> >+ >+ <!-- maximum number of records that a server will return at once --> >+ <!-- <setting type="maximumRecords">1000</setting> --> >+ >+ <!-- support result sets (Empty) --> >+ <!-- <supports type="resultSets"></supports> --> >+ >+ <!-- XPath retrieval supported --> >+ <!-- <supports type="recordXPath"></supports> --> >+ >+ <!-- scan settings --> >+ >+ <!-- scan operation supported --> >+ <supports type="scan"></supports> >+ >+ <!-- default number of terms to be returned in scan --> >+ <default type="numberOfTerms">20</default> >+ >+ <!-- other server settings --> >+ >+ <!-- older version of the protocol supported --> >+ <!-- <supports type="version">1.1</supports> --> >+ >+ <!-- number of seconds that a result set will be maintained for --> >+ <setting type="resultSetTTL">0</setting> >+ >+ <!-- A type of extraRequestData available in the >+ searchRetrieveRequest. The extra*Data fields are represented as two >+ space separated words, the first the identifier for the extension and >+ the second the individual element name from the extension. If there is >+ only one word, then it is the extension id and all elements from >+ within are supported. --> >+ <!-- <supports type="extraSearchData"></supports> --> >+ >+ <!-- A type of extraRequestData available in the explainRequest --> >+ <!-- <supports type="extraExplainData"></supports> --> >+ >+ <!-- A type of extraRequestData available in the scanRequest --> >+ <!-- <supports type="extraScanData"></supports> --> >+ <!-- The URI identifier of a supported profile --> >+ <!-- <supports type="profile"></supports> --> >+ </configInfo> >+ >+</explain> >diff --git a/misc/maintenance/generate_explain.pl b/misc/maintenance/generate_explain.pl >new file mode 100644 >index 0000000..c4fe640 >--- /dev/null >+++ b/misc/maintenance/generate_explain.pl >@@ -0,0 +1,331 @@ >+#!/usr/bin/perl >+ >+# Copyright 2017 Magnus Enger Libriotech >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+=head1 NAME >+ >+generate_explain.pl >+ >+=head1 SYNOPSIS >+ >+sudo koha-shell -c "perl generate_explain.pl -v" mykoha >+ >+sudo PERL5LIB=/usr/share/koha/lib KOHA_CONF=/etc/koha/sites/kohadev/koha-conf.xml perl generate_explain.pl -c /path/to/explain.yaml --overwrite -v >+ >+=head1 DESCRIPTION >+ >+Reads an optional config file, some of Koha's config files and generates an >+Explain document that can be served by the Zebra SRU server. >+ >+By default, the generated Explain document will be written to STDOUT. Specify >+the --overwrite command line option to actually overwrite the existing Explain >+document. >+ >+=cut >+ >+use File::Slurp; >+use YAML::Syck qw( LoadFile ); >+use CGI qw( utf8 ); # NOT a CGI script, this is just to keep C4::Templates::gettemplate happy >+use XML::Simple; >+use Modern::Perl; >+use Getopt::Long; >+use Pod::Usage; >+use Data::Dumper; # Debug >+ >+use C4::Context; >+use C4::Templates; >+ >+=head1 OPTIONS >+ >+=over 8 >+ >+=item B<-c | --configfile> >+ >+Path to a configfile that should be used to generate parts of the Explain >+document. >+ >+=item B<-a | --authorities> >+ >+If this option is not specified, the script will assume we are dealing with >+biblios. >+ >+=item B<-o | --overwrite> >+ >+Actually overwrite the existing explain document. If this is not specified, the >+generated Explain document will be written to STDOUT and no files will be >+overwritten. >+ >+=item B<-h | --help> >+ >+Print this usage statement. >+ >+=item B<-v | --verbose> >+ >+More verbose output. >+ >+=back >+ >+=cut >+ >+my ( $configfile, $authorities, $overwrite, $help, $verbose ); >+GetOptions( >+ 'c|configfile=s' => \$configfile, >+ 'a|authorities' => \$authorities, >+ 'o|overwrite' => \$overwrite, >+ 'h|help' => \$help, >+ 'v|verbose' => \$verbose, >+); >+ >+if ( $help ) { >+ pod2usage( -verbose => 2 ); >+ exit; >+} >+ >+=head1 CONFIG FILE >+ >+The config file should be in YAML format. Here is an example config that shows >+all the available options. See http://zeerex.z3950.org/dtd/commentary.html for >+further details about the options. >+ >+ --- >+ # Protocol >+ # Default: SRW/SRU/Z39.50 >+ protocol: "SRU" >+ >+ # Transport >+ # Default: http >+ transport: "https" >+ >+ # Title >+ # Should have a two letter language code. >+ # One title can be marked as primary >+ title: >+ - text: This is some title >+ lang: en >+ primary: true >+ - text: Dette er en tittel >+ lang: nb >+ >+ # Description >+ # Should have a two letter language code. >+ # One description can be marked as primary >+ description: >+ - text: This is some description >+ lang: en >+ primary: true >+ - text: Dette er en beskrivelse >+ lang: nb >+ >+ # Author >+ # If author is not set in the config, the LibraryName syspref will be used. If >+ # that is not set, the string "Koha" will be used. >+ author: "The librarian" >+ >+ # Contact >+ # If the contact is not set in the config, the KohaAdminEmailAddress syspref >+ # will be used. >+ contact: "librarian@example.org" >+ >+ # Extent >+ extent: >+ - text: "This is the extent of the database." >+ lang: "en" >+ primary: "true" >+ >+ # History >+ history: >+ - text: "This is the history of the database." >+ lang: "en" >+ primary: "true" >+ >+ # langUsage >+ langUsage: >+ - text: "Records are in English and Norwegian" >+ codes: "en nb" >+ lang: "en" >+ primary: "true" >+ >+ # Restrictions >+ restrictions: >+ - text: "Free for all!" >+ lang: "en" >+ primary: "true" >+ >+ # Subjects >+ subjects: >+ - "Subject A" >+ - "Subject B" >+ >+ # Index names >+ # Indexes can be given more explanatory names, but this is optional. >+ indexnames: >+ dc_title: >+ - title: "Title" >+ lang: "en" >+ - title: "Tittel" >+ lang: "nb" >+ dc_subject: >+ - title: "Subject" >+ lang: "en" >+ rec_identifier: >+ - title: "Record identifier" >+ lang: "en" >+ >+=cut >+ >+# Load the config file, if one is specified >+my $config; >+if ( $configfile ) { >+ if ( -e $configfile ) { >+ say "Reading config from $configfile" if $verbose; >+ $config = LoadFile( $configfile ); >+ } else { >+ die "$configfile not found"; >+ } >+} >+ >+# Get the path to he Koha config file from the KOHA_CONF environment variable >+my $koha_conf = $ENV{ 'KOHA_CONF' }; >+say "Looking at $koha_conf" if $verbose; >+ >+# Read the Koha config file >+my $conf = XMLin( >+ $koha_conf, >+ keyattr => ['id'], >+ forcearray => ['listen', 'server', 'serverinfo'], >+ suppressempty => '' >+); >+ >+# Get the SRU host and port from the Koha config file >+my $publicserver = $conf->{'listen'}->{'publicserver'}->{'content'}; >+my ( $tcp, $host, $port ) = split /:/, $publicserver; >+say "SRU is listening on host $host and port $port" if $verbose; >+ >+# Find the path to pqf.properties file >+my $pqf_properties_file = $conf->{'server'}->{'publicserver'}->{'cql2rpn'}; >+say "Looking at $pqf_properties_file" if $verbose; >+ >+# Read the pqf.properties file, and extract the information we need >+my %pqf; >+my @lines = read_file( $pqf_properties_file ); >+foreach my $line ( @lines ) { >+ >+ # Remove trailing whitespace >+ chomp $line; >+ # Skip commented lines - start of line, zero or more spaces, comment sign >+ next if $line =~ m/^ {0,}#/; >+ # Skip empty lines - start of line, zero or more spaces, end of line >+ next if $line =~ m/^ {0,}$/; >+ >+ # Look for lines that start with "set." >+ if ( $line =~ m/^set\.(.*?) {0,}= {0,}(.*)/ ) { >+ push @{ $pqf{'sets'} }, { >+ 'name' => $1, >+ 'identifier' => $2, >+ }; >+ } >+ >+ # Look for lines that start with "index." >+ if ( $line =~ m/^index\.(.*?)\.(.*?) {0,}= (.*?)=(.*?) {0,}$/ ) { >+ push @{ $pqf{'indexes'} }, { >+ 'set' => $1, >+ 'index' => $2, >+ 'id' => "$1_$2", >+ 'type' => $3, >+ 'value' => $4, >+ }; >+ } >+ >+ # Look for lines that start with "relation." >+ if ( $line =~ m/^relation\.(.*?) {0,}=.*$/ ) { >+ push @{ $pqf{'relations'} }, { >+ 'rel' => $1, >+ }; >+ } >+ >+ # Look for lines that start with "relationModifier." >+ if ( $line =~ m/^relationModifier\.(.*?) {0,}=.*$/ ) { >+ push @{ $pqf{'relationmodifiers'} }, { >+ 'relmod' => $1, >+ }; >+ } >+ >+} >+ >+# Set up the template >+my $template = C4::Templates::gettemplate( >+ 'services/explain.tt', >+ 'intranet', >+ new CGI >+); >+ >+# Pass some values to the template >+$template->param( >+ 'config' => $config, >+ 'pqf' => \%pqf, >+ 'host' => $host, >+ 'port' => $port, >+ 'authorities' => $authorities, >+); >+ >+# Get the output from the template >+my $output = $template->output; >+if ( $overwrite ) { >+ # Find the path to the Explain doc >+ my $explain_doc; >+ foreach my $inc ( @{ $conf->{'server'}->{'publicserver'}->{'xi:include'} } ) { >+ my $href = $inc->{'href'}; >+ if ( $href =~ m/explain/ ) { >+ $explain_doc = $href; >+ } >+ } >+ say "Going to write to $explain_doc" if $verbose; >+ # Make a backup of the existing file >+ rename $explain_doc, "$explain_doc-old"; >+ # Do the actual write >+ write_file( $explain_doc, $output ); >+} else { >+ say $output; >+} >+ >+=head1 TIPS AND TRICKS >+ >+=head2 Pretty printing XML >+ >+To have the output of this script look nice, run it through B<xmllint>: >+ >+ perl generate_explain.pl | xmllint --format - >+ >+=head1 AUTHOR >+ >+Magnus Enger, <magnus [at] libriotech.no> >+ >+=head1 LICENSE >+ >+ This program is free software: you can redistribute it and/or modify >+ it under the terms of the GNU General Public License as published by >+ the Free Software Foundation, either version 3 of the License, or >+ (at your option) any later version. >+ This program is distributed in the hope that it will be useful, >+ but WITHOUT ANY WARRANTY; without even the implied warranty of >+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+ GNU General Public License for more details. >+ You should have received a copy of the GNU General Public License >+ along with this program. If not, see <http://www.gnu.org/licenses/>. >+ >+=cut >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12836
:
60732
| 60791