SRU
Contents
- 1 Accessing the SRU-Service
- 2 SRU interface standards
- 3 SRU functions
- 4 Retrieve a lot of records with a cursor
- 5 Examples
- 6 (Logical) Databases
- 7 Available search fields SRU
- 8 Supported CQL relations and how to use them
- 9 Record schemas
- 10 Additional options
- 11 Further requirements
- 12 Miscellaneous
Accessing the SRU-Service
The service is openly accessible under the following general URL:
- The service is provided openly as long as the usage is fair.
- Abuses of the service will result in restriction of usage.
- Please inform us if you plan to access the SRU interface regularly as part of your search interface.
- We can configure a logical database for your institution or project.
- The impementation of the swissbib SRU server is freely available as Open Source.
SRU interface standards
The swissbib SRU service supports the SRU protocol: Version 1.1
Supported retrieval language is CQL: Version 1.1, Level 2
SRU functions
SRU incorporates the basic functions:
- Explain: Self-description in XML standard format, including information about:
- Database
- Indices
- Data formats
- Search / Retrieve: Search query
- Retrieval language: CQL (Common / Contextual Query Language)
- Boolean operators (and, or, not) are supported
- swissbib SRU is implemented as a REST service. Therefore the basic functions as described above are accessible as REST resources.
- Beside the standard SRU functions swissbib provides an additional user interface function which enables users to explore the service and its content interactively.
Mandatory and additional parameters of the SRU functions (resources)
- The SRU standard defines mandatory and additional parameters for the search and explain operation which has to be supported by a REST resource
- Explain
- mandatory
- operation = explain
- example http://sru.swissbib.ch/sru/explain?operation=explain
- mandatory
- Search
- mandatory
- query = CQL Query
- operation = searchRetrieve
- additional
- recordSchema = see explain operation and interactive form If omitted info:srw/schema/1/dc-v1.1 is used as default
- maximumRecords = [0 - 100] If omitted 10 is default
- startRecord = [positive integer value] If omitted 0 is default
- recordPacking = only XML at the moment
- example http://sru.swissbib.ch/sru/search/defaultdb?query=+dc.anywhere+%3D+hello+world&operation=searchRetrieve&recordSchema=info%3Asrw%2Fschema%2F1%2Fmarcxml-v1.1-light&maximumRecords=10&startRecord=0&recordPacking=XML
- mandatory
Retrieve a lot of records with a cursor
See here https://github.com/swissbib/sruServer/wiki/sru-cursor-model (based on SOLR cursors)
Examples
All books about creativity from the EPFL Library (code E02) which were published after 2010, result in Dublin Core Format :
All maps from libraries of the IDS Basel Bern network which are related to Biel, result in Marc Xml Format :
All documents which match "done allen" in all fields, result in JSON marc :
(Logical) Databases
- swissbib SRU now provides the possibility to restrict the search on predefined databases
- At the moment the following databases are supported:
- defaultdb http://sru.swissbib.ch/sru/search/defaultdb the complete content of swissbib.ch. This content is also freely available via the Search Engine interface of swissbib - example query One of the biggest adavantages of SRU compared to a native Search engine interface is standardization. The CQL query language is a world wide standard while the API of a Search Server is propietary. On the other hand, the currently available Search Servers are widely used and one could argue they create a de-facto standard. At the moment swissbib is using the SOLR Search server. An alternative could be ElasticSearch. If swissbib would change the infrastructure a client using the SearchServer API would have to change its implementation.
- Seach index used by the Basel / Bern interface service http://sru.swissbib.ch/sru/search/bbdb
- Logical database of law-related content http://sru.swissbib.ch/sru/search/jusdb used by the swissbib JUS Portal
- Special tailored databases for the KVK service
- Accademia di Architettura, Mendrisio http://sru.swissbib.ch/sru/search/MEAA
- Kunstmuseum Basel http://sru.swissbib.ch/sru/search/A300
- Special databases are available using the REST style.
- If you have special needs for your application let us know. Additional logical databases are easily implemented on the server side. Clients are released to consider such restrictions in the client code.
- If the database specification is omitted in the request, the defaultdb is used
Available search fields SRU
- The range of search fields is mostly according to: http://www.loc.gov/standards/sru/resources/bath-profile.html
- More detailed information about the available search fields can be found via the SRU explain operations (see above)
- A few additional explanations for some of the supported index fields (for the rest use the e SRU explain function)
Access Point | Context Set | Index | Description |
---|---|---|---|
Format/Type of Material | Dublin Core | format | swissbib-format code |
Language | Dublin Core | language | this means ISO 639-2 codes. |
Possessing Institution | Bath | possessingInstitution | Local Library code on a nice page and for download in json:
|
Possessing library network / union | swissbib | xNetwork | Library codes of Swiss networks (see list) |
Filter (for online ressources) | swissbib | xfilter | Filter: Use value 'ONL' to get online resources. Example. |
Filter (for CC0 metadata) | swissbib | xfilter | Filter: the metadata of 85% of the records is in the public domain. However, 15% of the records are not in the public domain. To exclude these records, you need to exclude the value MDRR (metadata rights reserved) in the xfilter field (NOT MDRR in field dc.xfilter). Example |
Supported CQL relations and how to use them
- More information is available via the SRU explain operation.
- Comparison relations such as < or <= or > or >= > are only useful for special indices with numeric values such as dc.date for the published date. If such relations are used in the context of non-numeric indices the default relation = is used
- How to use the CQL relations
- For simple term searches use the = relation.
- Multiple terms within a subclause in combination with a = relation will be implicitly combined with the boolean AND operator.
- To express the combination of terms in subclause with the AND operator, the ALL relation should be used.
- Exact phrase searches will be defined by using the EXACT relation. Double quotes in terms are not necessary and will be filtered out by the parser.
- To combine the search terms of a subclause with the logical OR operator use the ANY relation for a subclause.
- Subclauses of a complete query can be combined with the boolean operators AND / OR or NOT.
- the interactive form is thought as a guide for the use of the supported CQL queries
Record schemas
- see explain operation for the special databases and the interactive form to play around with them
Additional options
- Get Holdings: This allows detailed holding information per record to be retrieved (only for the MARC schema).
Further requirements
- If your requirements need more functionality - please let us know. In general the functionality of Search Servers could be transformed into the SRU standard using the CQL query syntax. If such an effort is justified we could implement it. But as said above: The Search Server interface used by swissbib is also freely available so it could be used by any client for more complex queries and additional features such as facets, more like this, highlighting and much, much more .....
- You can use directly the github issues list of the repository for notification
Miscellaneous
Recently I stumbled upon an alternative and nice SRU server implementation realized by Jörg Prante It's implemented as an Elasticsearch plugin. It is using JFlex for the parsing process instead of the cql-java library as it is done in our current implementation