record_transform — Metaproxy Module that performs record transformations
This filter acts on Z39.50 present requests and Z39.50 search requests, and let all other types of packages and requests pass untouched. Its use is twofold: blocking Z39.50 present/search requests that the backend server does not understand or can not honor, and transforming the present syntax and elementset name according to the rules specified, to fetch only existing record formats, and transform them on-the-fly to requested record syntaxes.
The allowed record present syntax and
element name are described in multiple
<retrieval>
elements inside the
<retrievalinfo>
element. The syntax
attribute is mandatory, but
the name
attribute
may be omitted, in which case any
element name is accepted. An additional
identifier
attribute can be added to explicitly
describe the Z39.50 identifier string.
The <retrieval>
element and the content
is described in the
Retrieval Facility section
of the YAZ manual.
From Metaproxy version 1.3.26 and onwards, the backend conversion may
also use USEMARCON.
If USEMARCON is enabled, the backend
may include
a usemarcon
element with two attributes:
stage1
and stage2
that point to
conversion files as interpreted by USEMARCON. One or both must be given.
The filter operates on Z39.50 packages only. Unlike SRU/SRW services, the
Z39.50 protocol does not have a concept of record schema for each record.
By using specifying the embed_schema="true"
attribute+value for the
retrievalinfo
element, the filter will embed the matched schema
in the descriptor member of the Z39.50 External structure.
This is picked up by the sru_z3950(3mp) filter which will then
store the schema in the recordSchema
member of the
<record>
element.
Schema is in two parts.. One for the filter itself, and one for the retrieval info.
# Metaproxy XML config file schemas
#
# Copyright (C) Index Data
# See the LICENSE file for details.
namespace mp = "http://indexdata.com/metaproxy"
include "retrievalinfo.rnc"
filter_record_transform =
attribute type { "record_transform" },
attribute id { xsd:NCName }?,
attribute name { xsd:NCName }?,
retrievalinfo
# Schema for YAZ retrieval info and USEMARCON extension
#
# Copyright (C) Index Data
# See the LICENSE file for details.
namespace y = "http://indexdata.com/yaz"
start |= retrievalinfo
marc = element y:marc {
attribute inputformat { xsd:string },
attribute outputformat { xsd:string },
attribute inputcharset { xsd:string },
attribute outputcharset { xsd:string }?,
attribute leaderspec { xsd:string }?
}
xslt = element y:xslt {
attribute stylesheet { xsd:string },
element y:param {
attribute name {xsd:string},
attribute value {xsd:string}
}*
}
usemarcon = element y:usemarcon {
attribute stage1 { xsd:string }?,
attribute stage2 { xsd:string }?
}
retrievalinfo =
element y:retrievalinfo {
attribute version { "1.0" },
attribute embed_schema { xsd:boolean }?,
element y:retrieval {
attribute syntax { xsd:string },
attribute name { xsd:string }?,
attribute identifier { xsd:string }?,
element y:backend {
attribute syntax { xsd:string },
attribute name { xsd:string }?,
(marc | xslt | usemarcon)*
}?
}+
}
A typical configuration looks like this:
<filter type="record_transform"> <retrievalinfo xmlns="http://indexdata.com/yaz" version="1.0"> <retrieval syntax="xml" name="dc" identifier="info:srw/schema/1/dc-v1.1"> <backend syntax="usmarc" name="F"> <marc inputformat="marc" outputformat="marcxml" inputcharset="marc-8"/> <xslt stylesheet="../xml/xslt/MARC21slim2DC.xsl"/> </backend> </retrieval> <retrieval syntax="opac"/> <retrieval syntax="xml" name="opac"> <backend syntax="opac" name="F"> <marc inputformat="marc" outputformat="marcxml" inputcharset="marc-8"/> </backend> </retrieval> <retrieval syntax="usmarc"> <backend syntax="usmarc" name="F"> </backend> </retrieval> <retrieval syntax="usmarc" name="C"> <backend syntax="unimarc" name="F"> <usemarcon stage1="/etc/usemarcon/uni2us/uni2us.ini"/> </backend> </retrieval> </retrievalinfo> </filter>