[Yazlist] baffled by cql, or maybe rec.id

Enrico Silterra es287 at cornell.edu
Fri Mar 25 19:57:33 CET 2011


Larry, I am sure I would not even know to use attribute 12 if it wasn't for you.

i have been asked to set this up so we can query for bunches of data this way.

so, to get around URL size limitations, I am posting the query using SOAP --
so my query is in the SRW:query element:
<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP:Body>
    <SRW:searchRetrieveRequest xmlns:SRW="http://www.loc.gov/zing/srw/">
      <SRW:version>1.1</SRW:version>
      <SRW:query>rec.id=1001</SRW:query>
      <SRW:startRecord>1</SRW:startRecord>
      <SRW:maximumRecords>10</SRW:maximumRecords>
      <SRW:recordSchema>info:srw/schema/1/opacxml-v1.0</SRW:recordSchema>
    </SRW:searchRetrieveRequest>
  </SOAP:Body>
</SOAP:Envelope>

with yaz-client, this works fine:

Z> querytype cql
Z> f rec.id=1001
Sent searchRequest.
Received SearchResponse.
Search was a success.
Number of hits: 1
records returned: 0
Elapsed: 0.013109

however,

 f rec.id=1001 or rec.id=1002
Sent searchRequest.
Received SearchResponse.
Search was a success.
Number of hits: 10000
records returned: 0
Elapsed: 7.358608

this should have been 2 records; instead, it's 10,000
huh?

thanks for your help, Larry!
I am baffled.

Rick





On Fri, Mar 25, 2011 at 1:29 PM, Larry E. Dixson <ldix at loc.gov> wrote:
> Enrico,
> What results do you receive when you search your database using Z39.50
> and @attr 1=12?
>
> When using CQL and SRU (or SRW), I tend to use either rec.id=1234 or
> query=rec.id=1234.
>
> Below are excerpts from an SRW session (against LCDB) keyed manually
> using the YAZ client and the resulting Soap envelopes that were
> generated.
>
> Hope the comparison is somewhat helpful.
> Larry
>
> --------------------------------------------------
> Z> open http://lx2.loc.gov:210/LCDB
> Connecting...OK.
>
> Z> f rec.id=13411323
> Received SRW SearchRetrieve Response
> Number of hits: 1
>
> Z> f query=rec.id=13411323
> Received SRW SearchRetrieve Response
> Number of hits: 1
>
> Z> schema dc
>
> Z> s 1
> Received SRW SearchRetrieve Response
> Number of hits: 1
> pos=1 schema=dc
>
>    . . . [etc.] . . .
>
>
> --------------------------------------------------
> --
> -- HTTP request:
> POST /LCDB HTTP/1.1
> Content-Length: 392
> User-Agent: YAZ/3.0.14
> Host: lx2.loc.gov:210
> Content-Type: text/xml
> SOAPAction: ""
>
> <?xml version="1.0"?>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
>  <SOAP-ENV:Body>
>    <zs:searchRetrieveRequest xmlns:zs="http://www.loc.gov/zing/srw/">
>      <zs:version>1.2</zs:version>
>      <zs:query>query=rec.id=13411323</zs:query>
>      <zs:maximumRecords>0</zs:maximumRecords>
>      <zs:recordSchema>dc</zs:recordSchema>
>    </zs:searchRetrieveRequest>
>  </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> --
> -- HTTP response:
> HTTP/1.1 200 OK
> Content-Length: 317
> Server: YAZ/4.0.11
> Connection: Keep-Alive
> Content-Type: text/xml
>
> <?xml version="1.0"?>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
>  <SOAP-ENV:Body>
>    <zs:searchRetrieveResponse xmlns:zs="http://www.loc.gov/zing/srw/">
>      <zs:version>1.1</zs:version>
>      <zs:numberOfRecords>1</zs:numberOfRecords>
>    </zs:searchRetrieveResponse>
>  </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
>
>
>
> On Fri, 25 Mar 2011, Enrico Silterra wrote:
>
>> I just don't understand how to use CQL, or if CQL works with yaz proxy or what.
>>
>> here is some xml i am submitting with SOAP --
>> SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
>>   SOAP:Body>
>>     SRW:searchRetrieveRequest xmlns:SRW="http://www.loc.gov/zing/srw/">
>>       SRW:version>1.1</SRW:version>
>>       SRW:query>rec.id=1001</SRW:query>
>>       SRW:startRecord>1</SRW:startRecord>
>>       SRW:maximumRecords>10</SRW:maximumRecords>
>>       SRW:recordSchema>info:srw/schema/1/opacxml-v1.0</SRW:recordSchema>
>>     <SRW:searchRetrieveRequest>
>>   /SOAP:Body>
>> /SOAP:Envelope>
>>
>> i removed less than signs to make this readable.
>> how can i specify that I want to retrieve various rec.id values
>>
>> a) rec.id = 1001 OR rec.id = 1002  gives nonsense results, 10,000 records ??
>>
>> b) OR ( = rec.id 1001) = (rec.id  1002)  syntax error.
>>
>> c) rec.id any 1001 or rec.id any 1002
>>
>> for what  it's worth, i am simply trying to retrieve records by bib id
>> with yaz proxy,
>> so i need a bunch of alternative that match on the 001 marc field.
>>
>> is the default format for these queries CQL, or something else?
>>
>> i either get nonsense results, or syntax errors on what seem like
>> perfectly sensible queries.
>>
>>  for what it's worth:
>> i have this
>>
>> index.rec.id                            = 1=12
>>
>> in pqf.properties.
>>
>> and this in the config file used by yaz proxy.
>>
>> <!-- use attributes -->
>>     <attribute type="1" value="1-12,13-1010,1013-1023,1025-1030"/>
>>
>> 12 is the attribute that describes the 'record id', or local identifier.
>>
>> i no longer remember how i know that.  I think maybe Larry Dixon at
>> LOC clued me into
>> that.
>>
>>
>> help!
>>
>> rick
>>
>>
>>
>>
>>
>> --
>> Enrico Silterra Software Engineer
>> 501 Olin Library Cornell University Ithaca NY 14853
>> Voice: 607-255-6851 Fax:     607-255-6110 E-mail: es287 at cornell.edu
>> http://www.library.cornell.edu/dlit
>> "Out of the crooked timber of humanity no straight thing was ever made"
>> CONFIDENTIALITY NOTE
>> The information transmitted, including attachments, is intended only
>> for the person or entity to which it is addressed and may contain
>> confidential and/or privileged material. Any review, retransmission,
>> dissemination or other use of, or taking of any action in reliance
>> upon, this information by persons or entities other than the intended
>> recipient is prohibited. If you received this in error, please contact
>> the sender and destroy any copies of this document.
>>
>> _______________________________________________
>> Yazlist mailing list
>> Yazlist at lists.indexdata.dk
>> http://lists.indexdata.dk/cgi-bin/mailman/listinfo/yazlist
>>
>
> ------------------------------------------------------------
> Larry E. Dixson                    Internet:    ldix at loc.gov
> Network Development and MARC
>   Standards Office, LA327
> Library of Congress                Telephone: (202) 707-5807
> Washington, D.C.  20540-4402       Fax:       (202) 707-0115
>
>
>
> _______________________________________________
> Yazlist mailing list
> Yazlist at lists.indexdata.dk
> http://lists.indexdata.dk/cgi-bin/mailman/listinfo/yazlist
>
>



-- 
Enrico Silterra Software Engineer
501 Olin Library Cornell University Ithaca NY 14853
Voice: 607-255-6851 Fax:     607-255-6110 E-mail: es287 at cornell.edu
http://www.library.cornell.edu/dlit
"Out of the crooked timber of humanity no straight thing was ever made"
CONFIDENTIALITY NOTE
The information transmitted, including attachments, is intended only
for the person or entity to which it is addressed and may contain
confidential and/or privileged material. Any review, retransmission,
dissemination or other use of, or taking of any action in reliance
upon, this information by persons or entities other than the intended
recipient is prohibited. If you received this in error, please contact
the sender and destroy any copies of this document.



More information about the Yazlist mailing list