7. Searching the OAI database by Z39.50 protocol
Prev | Chapter 3. Tutorial | Next

## 7. Searching the OAI database by Z39.50 protocol

In this section we repeat the searches and presents we have done so far using the binary Z39.50 protocol, you can use any Z39.50 client. For instance, you can use the demo command-line client that comes with YAZ.

Connecting to the server is done by the command

         yaz-client localhost:9999

When the client has connected, you can type:

         Z> format xml
         Z> querytype prefix
         Z> elements oai
         Z> find the
         Z> show 1+1

Z39.50 presents using presentation stylesheets:

         Z> elements dc
         Z> show 2+1

         Z> elements zebra
         Z> show 3+1

Z39.50 buildin Zebra presents (in this configuration only if started without yaz-frontendserver):

         Z> elements zebra::meta
         Z> show 4+1

         Z> elements zebra::meta::sysno
         Z> show 5+1

         Z> format sutrs
         Z> show 5+1
         Z> format xml

         Z> elements zebra::index
         Z> show 6+1

         Z> elements zebra::snippet
         Z> show 7+1

         Z> elements zebra::facet::any:w
         Z> show 1+1

         Z> elements zebra::facet::publisher:p,title:p
         Z> show 1+1

Z39.50 searches targeted at specific indexes and boolean combinations of these can be issued as well.

         Z> elements dc
         Z> find @attr 1=oai_identifier @attr 4=3 oai:caltechcstr.library.caltech.edu:4
         Z> show 1+1

         Z> find @attr 1=oai_datestamp @attr 4=3 2001-04-20
         Z> show 1+1

         Z> find @attr 1=oai_setspec @attr 4=3 7374617475733D756E707562
         Z> show 1+1

         Z> find @attr 1=title communication
         Z> show 1+1

         Z> find @attr 1=identifier @attr 4=3
         http://resolver.caltech.edu/CaltechCSTR:1986.5228-tr-86
         Z> show 1+1

etc, etc.

Z39.50 scan:

         yaz-client localhost:9999
         Z> format xml
         Z> querytype prefix
         Z> scan @attr 1=oai_identifier @attr 4=3 oai
         Z> scan @attr 1=oai_datestamp @attr 4=3 1
         Z> scan @attr 1=oai_setspec @attr 4=3 2000
         Z>
         Z> scan @attr 1=title communication
         Z> scan @attr 1=identifier @attr 4=3 a

Z39.50 search using server-side CQL conversion:

         Z> format xml
         Z> querytype cql
         Z> elements dc
         Z>
         Z> find harry
         Z>
         Z> find dc.creator = the
         Z> find dc.creator = the
         Z> find dc.title = the
         Z>
         Z> find dc.description < the
         Z> find dc.title > some
         Z>
         Z> find dc.identifier="http://resolver.caltech.edu/CaltechCSTR:1978.2276-tr-78"
         Z> find dc.relation = something

### Tip

Z39.50 scan using server side CQL conversion - unfortunately, this will _never_ work as it is not supported by the Z39.50 standard. If you want to use scan using server side CQL conversion, you need to make an SRW connection using yaz-client, or a SRU connection using REST Web Services - any browser will do.

### Tip

All indexes defined by 'type="0"' in the indexing style sheet must be searched using the '@attr 4=3' structure attribute instruction.

Notice that searching and scan on indexes `contributor`, `language`, `rights`, and `source` might fail, simply because none of the records in the small example set have these fields set, and consequently, these indexes might not been created.

Prev | Up | Next
6. Setting up a correct SRU web service | Home | Chapter 4. Overview of Zebra Architecture