I have a z39.50 client, that uses CQL language and YAZ to communicate to Z39.50 server. Yaz distribution includes etc/pqf.properties CQL to RPN mapping file, that I’ve used satisfactory without changes.
However one of the servers, that I wanted to search, returned 0 to any query in CQL.
Some debugging showed that the server doesn’t support BIB-1 COMPLETENESS ATTRIBUTES (TYPE = 6) and any query, that included @attr 6, retuned 0. Additionally they didn’t understand support attribute 1=1016 (any).
I had to modify a few lines in pqf.properties to work with the server.
# MNF 16/3/2007 replaced serverChoice,
index.cql.serverChoice = 2=3
# index.cql.serverChoice = 1=1016
# MNF 16/3/2007 excluded 6=1
# position.any = 3=3 6=1
position.any = 3=3
# MNF 16/3/2007 excluded always
# always = 6=1
# 6=1: completeness = incomplete subfield
The Z39.50 server is based on the TeraText Database System, that, as I’ve been informed, doesn’t support bib-1 completeness.
I’ve tried to use MARC21slim2English.xsl to show USMARC in user-friendly form. I found that the xsl doesn’t give a possibility to change order of items, but just copied the order of original MARC21 record.
I had to add a lot of apply-templates to be able to set the order as I want, e.g. show title first, then Authors etc.
The extra XSLT commands were added to modified MARC21slim2English.xsl , but it should be possible to use import command to keep existing MARC21slim2English.xsl and my code in separate files.
The added templates can be viewed here.
I’ve compared a few available XSLT stylesheets from standards/marcxml/xslt .
As it noted in A Repository of Metadata Crosswalks, the transformation from MARC XML to Unqualified Dublin Core 1.1 is realized in three encodings, requiring three separate XSLT scripts: as OAI DC(MARC21slim2OAIDC.xsl) , as SRW DC(MARC21slim2SRWDC.xsl ) , and as RDF DC(MARC21slim2RDFDC.xsl).
I’ve noted that YAZ Proxy download has slightly different (and seems older) versions of the similar stylesheets.
The most notable difference is that MARC21slim2SRWDC.xsl output doesn’t include namespaces,e.g shows <title> instead of <dc:title>.
Also seems that MARC21slim2SRWDC.xsl has more updates and produce nicer output, e.g. uses normalize-space Function.
In C# library I wanted to call c function from YAZ library
YAZ_EXPORT int yaz_marc_decode_buf(yaz_marc_t mt, const char *buf, int bsize, char **result, int *rsize);
The problem was that I didn’t know how to specify char **result in managed declaration. I didn’t find similar samplers in Zoom.NET implementation.
The article Call Unmanaged DLLs from C# recommended to use StringBuilder for LPSTR (char*) but it wasn’t enough.
After some experimentation I found that adding ref will do the trick(which makes sense).
So the c# declaration is the following:
SetLastError = true,
CharSet = CharSet.Ansi,
CallingConvention = CallingConvention.Cdecl,
EntryPoint = “yaz_marc_decode_buf”
public static extern void yaz_marc_decode_buf(IntPtr yaz_marc_t, String marcBuf, int bsize,
ref StringBuilder result, ref int rsize);
and the sample code :
StringBuilder result=new StringBuilder() ; /* for result buf */
int result_len = 0; /* for size of result */
YazExt.yaz_marc_decode_buf (_yazMarc, marc_buf, -1, ref result, ref result_len);
string sXml = result.ToString();
I’ve downloaded and tried Zoom.NET v0.9c with .Net 2.0
I decided to list some issues that I’ve noticed.
should use PrefixQuery, e.g @”@attr 1=4 “”Gong””” , not simple query “isbn=0253333490”
2. It is required to download latest YAZ from http://www.indexdata.com/yaz/
and copy DLLs from YAZBIN to Zoom.Net.YazSharpyaz
to build YazSharp for Windows successfully.
3. In YazSharp for Windows during search I’ve got:
An unhandled exception of type ‘System.InvalidOperationException’ Additional information: Cross-thread operation not valid: Control ‘btnSearch’ accessed from a thread other than the thread it was created on.
I’ve followed suggestion from “How to solve “Cross thread operation not valid“ and added to beginning of PerformSearch