[Yazlist] Pazpar2 web service requests all work except for "record"

Sebastian Hammer quinn at indexdata.com
Tue Sep 30 00:26:45 CEST 2008


Christopher Morgan wrote:
> Sebastian,
>
> Excellent! I added brief="yes" to the metadata name:
>
> <metadata name="subject-long" brief="yes" rank="3"/>
>
> in the pazpar2.cfg file, and now the brief records include "subject-long"! 
>
> Is there any way to modify the example_client.js file so it will sort and
> display the "subject-long" fields instead of "subject" (or any arbitrary
> field, for that matter)? I tried changing "subject" to "subject-long"
> throughout the on_show function, e.g.:
>   
For sorting, you can use any field, but you need to enable it in the 
pazpar2.cfg using the 'sortfield' attribute to the element definition 
under 'service'. Check the documentation here:

http://www.indexdata.com/pazpar2/doc/pazpar2_conf.tkl

Note that different types of sort fields are supported.
> data.subject[i].name --> data.subject-long[i].name
>
> and so on. But I got an error message saying that: 
>
> "long is not defined
>
> for (var i = 0; i < data.subject-long.length; i++ ) {"
>
> Does it make sense to refer to "data.subject-long"? Perhaps I'm making a
> dumb Javascript error here. 
>
> How do the subject-long fields get formed in pazpar2? Some of them look like
> standard post-coordinated authority records, but others seem to a stringing
> together of the individual subject headings in a record, separated by
> commas. (I couldn't find any references to a "subject-long" field in the
> MARC records format, or anywhere on the web.)
>   
They are generated specifically by the marc21.xsl XSLT stylesheet, which 
is also found in the etc directory. When you profile a target for use in 
pazpar2, you can specify a normalization stylesheet. This stylesheet is 
responsible for going from the data elements found in input records (in 
this case MARCXML -- pazpar2 handles the translation from MARC to 
MARCXML for you) to an internal representation.. how this internal 
representation looks and is handled depends on the pazpar2.cfg... so by 
using different stylesheets for different targets that might return 
radically different record structures, you can bring them all into the 
same fold, so to speak, configured and controlled by pazpar2.cfg.

If you're not familiar with XSLT, I heartily recommend it. It's a 
cross-platform, standard technology useful for all kinds of translations 
of one form of data into another... something we run into all the time 
when working with bibliographic data.

There are plenty of good resources and books out there, but I've always 
been fond of http://www.w3schools.com/xsl/default.asp .

--Sebastian
> Now that I can customize the brief records, I can use pazpar2 in all kinds
> of interesting ways. Thanks again for creating such a superb piece of
> software! 
>
> -- Chris M. 
>
> P.S.: (Regarding this topic, I sent an inaccurate email to you earlier,
> Sebastian -- please ignore it).
>
> -----Original Message-----
>
> From: Sebastian Hammer [mailto:quinn at indexdata.com
> <mailto:quinn at indexdata.com> ] 
>
> Sent: Monday, September 29, 2008 12:57 PM
>
> To: Christopher Morgan
>
> Cc: 'Discussion on the YAZ Z39.50 toolkit'
>
> Subject: Re: [Yazlist] Pazpar2 web service requests all work except for
> "record"
>
> Christopher Morgan wrote:
>
>   
>> Sebastian,
>>     
>
>   
>
>   
>> Ah, that did the trick! Is there a singe GET request that would return 
>>     
>
>   
>> all of the full xml records at once?
>>     
>
>   
>> (If not, I could just loop through the recids).
>>     
>
>   
>
> No, but if you play with the config file (pazpar2.cfg), you can make sure
> that all the information you'd ever want is in the brief record -- there'd
> be no need to use the 'record' command.
>
> --Seb
>
>   
>> - Chris
>>     
>
>   
>
>   
>> -----Original Message-----
>>     
>
>   
>> From: yazlist-bounces at lists.indexdata.dk
>>     
>
>   
>> [mailto:yazlist-bounces at lists.indexdata.dk
>>     
> <mailto:yazlist-bounces at lists.indexdata.dk> ] On Behalf Of Sebastian 
>
>   
>> Hammer
>>     
>
>   
>> Sent: Monday, September 29, 2008 11:40 AM
>>     
>
>   
>> To: Discussion on the YAZ Z39.50 toolkit
>>     
>
>   
>> Subject: Re: [Yazlist] Pazpar2 web service requests all work except 
>>     
>
>   
>> for "record"
>>     
>
>   
>
>   
>> Hi Chris,
>>     
>
>   
>
>   
>> The record ID is actually the string found in the 'recid' field.
>>     
>
>   
>
>   
>> --Sebastian
>>     
>
>   
>
>   
>> Christopher Morgan wrote:
>>     
>
>   
>
>   
>>> The pazpar2 init, search, termlist, and show webservice requests all 
>>>       
>
>   
>>> work
>>>       
>
>   
>
>   
>>> fine in my pazpar2 test setup (I'm working with the jsdemo), but I 
>>>       
>
>   
>>> can't
>>>       
>
>   
>
>   
>>> get "record" to work. For example, after a search, I issued this show
>>>       
>
>   
>>> command:
>>>       
>
>   
>
>   
>>> /search.pz2?command=show&session=1624152321&start=0&num=10&sort=relev
>>>       
>
>   
>>> a
>>>       
>
>   
>>> nce&block=1
>>>       
>
>   
>
>   
>>> and got the following back:
>>>       
>
>   
>
>   
>>> <show>
>>>       
>
>   
>
>   
>>> <status>OK</status>
>>>       
>
>   
>
>   
>>> <activeclients>0</activeclients>
>>>       
>
>   
>
>   
>>> <merged>18</merged>
>>>       
>
>   
>
>   
>>> <total>66</total>
>>>       
>
>   
>
>   
>>> <start>0</start>
>>>       
>
>   
>
>   
>>> <num>10</num>
>>>       
>
>   
>
>   
>>> -
>>>       
>
>   
>
>   
>>> <hit>
>>>       
>
>   
>
>   
>>> <md-author>Keskar, Ravindra</md-author>
>>>       
>
>   
>
>   
>>> <md-date>2000</md-date>
>>>       
>
>   
>
>   
>>> <md-title>Square pegs in round holes</md-title>
>>>       
>
>   
>
>   
>>> <md-title-remainder>mathematics through origami</md-title-remainder>
>>>       
>
>   
>
>   
>>> <md-title-responsibility>Ravindra Keskar</md-title-responsibility>
>>>       
>
>   
>
>   
>>> <md-medium>book</md-medium>
>>>       
>
>   
>
>   
>>> <location id="melvyl.cdlib.org:210/CDL90" name="University of 
>>>       
>
>   
>>> California"/>
>>>       
>
>   
>
>   
>>> <location id="catalog.library.duke.edu:9991/DUK01" name="Duke 
>>>       
>
>   
>>> University"/>
>>>       
>
>   
>
>   
>>> <count>2</count>
>>>       
>
>   
>
>   
>>> -
>>>       
>
>   
>
>   
>>> <recid>
>>>       
>
>   
>
>   
>>> title square pegs in round holes author keskar ravindra medium book
>>>       
>
>   
>
>   
>>> </recid>
>>>       
>
>   
>
>   
>>> </hit>
>>>       
>
>   
>
>   
>>> . . . etc. . .
>>>       
>
>   
>
>   
>>> But if I request an individual record via:
>>>       
>
>   
>
>   
>>> /search.pz2?session=1624152321&command=record&id=1
>>>       
>
>   
>>> <http://bookgenius.org/pazpar2/search.pz2?session=1624152321&command=
>>>       
> <http://bookgenius.org/pazpar2/search.pz2?session=1624152321&command=> 
>
>   
>>> r
>>>       
>
>   
>>> ecord&id=1>
>>>       
>
>   
>
>   
>>> I get this error code:
>>>       
>
>   
>
>   
>>> <error code="7" msg="Record missing">1</error>
>>>       
>
>   
>
>   
>>> Can anyone tell me why I'm getting this error?
>>>       
>
>   
>
>   
>
>   
>>> Thanks!
>>>       
>
>   
>
>   
>>> - Chris Morgan
>>>       
>
>   
>
>   
>>> ---------------------------------------------------------------------
>>>       
>
>   
>>> -
>>>       
>
>   
>>> --
>>>       
>
>   
>
>   
>>> _______________________________________________
>>>       
>
>   
>>> Yazlist mailing list
>>>       
>
>   
>>> Yazlist at lists.indexdata.dk
>>>       
>
>   
>>> http://lists.indexdata.dk/cgi-bin/mailman/listinfo/yazlist
>>>       
> <http://lists.indexdata.dk/cgi-bin/mailman/listinfo/yazlist> 
>
>   
>
>   
>
>   
>
>   
>> --
>>     
>
>   
>> Sebastian Hammer, Index Data
>>     
>
>   
>> quinn at indexdata.com
>>     
>
>   
>> www.indexdata.com <outbind://37/www.indexdata.com> 
>>     
>
>   
>
>   
>
>   
>
>   
>> _______________________________________________
>>     
>
>   
>> Yazlist mailing list
>>     
>
>   
>> Yazlist at lists.indexdata.dk
>>     
>
>   
>> http://lists.indexdata.dk/cgi-bin/mailman/listinfo/yazlist
>>     
> <http://lists.indexdata.dk/cgi-bin/mailman/listinfo/yazlist> 
>
>   
>
>   
>
>   
>
> --
>
> Sebastian Hammer, Index Data
>
> quinn at indexdata.com
>
> www.indexdata.com <outbind://37/www.indexdata.com> 
>
>
>
> _______________________________________________
> Yazlist mailing list
> Yazlist at lists.indexdata.dk
> http://lists.indexdata.dk/cgi-bin/mailman/listinfo/yazlist
>
>   

-- 
Sebastian Hammer, Index Data
quinn at indexdata.com
www.indexdata.com




More information about the Yazlist mailing list