SRU (Search/Retrieval Using URL)

SRU VERSION 1.1 ARCHIVE

Diagnostics

Sometimes things go wrong. In these cases the server is obliged to report that something went wrong, by sending a diagnostic record explaining what happened. A list of currently supported diagnostics is available and more may be identified in the future.

Diagnostics fall into two categories, 'fatal' and 'non-fatal'. A fatal diagnostic is one in which the execution of the request cannot procede and no records are available to return. For example, if the client supplied an invalid query there is nothing that the server can do. A non-fatal diagnostic on the other hand is one where processing may be affected but the server can continue. For example if a particular record is not available in the requested schema but others are, the server may return the ones which are available rather than failing the entire request.

Non-fatal diagnostics are also divided into two categories 'surrogate' and 'non-surrogate'. Surrogate diagnostics take the place of a record. For example if the second of three records was not available in the requested schema, then the response would include the first record, a surrogate diagnostic explaining that the second record is not available, and then the final record. Non-surrogate, non-fatal diagnostics are diagnostics saying that while some or all the records are available, something else went wrong. For example the requested sorting algorithm might not be available.

Surrogate diagnostics take the place of the record for which they are a surrogate in the 'records' parameter of the response. Non-surrogate records, both fatal and non-fatal, are returned in the 'diagnostics' parameter.

Diagnostic Schema

Diagnostics are returned in a very simple schema which has only three elements, 'uri', 'details' and 'message'. The required 'uri' field is a URI, identifying the particular diagnostic. When the URI begins with "info:srw/diagnostic/1/" (for example, 'info:srw/diagnostic/1/7') then the diagnostic is from the standard SRU diagnostic list. The 'details' part contains information specific to the diagnostic, format as specified by the individual diagnostic definition. The 'message' field contains a human readable message to be displayed. Only the uri field is required, the other two are optional.

It is recommended that whatever the URI path (for example if an extension needs to define its own diagnostics), the final section should be a distinguishing integer (for example 'http://srw.cheshire3.org/diagnostics/1')

The identifier for the diagnostic schema is: info:srw/schema/1/diagnostics-v1.1

Schema Element Summary

Name

Type

Mandatory or Optional

Description

uri

xsd:anyURI

Mandatory

The diagnostic URI.

details

xsd:string

Optional

Any supplementary explanation available.

message

xsd:string

Optional

A human readable message to display to the end user.

Examples

Non-surrogate, fatal diagnostic:

<diagnostics>
      <diagnostic xmlns="http://www.loc.gov/zing/srw/diagnostic/">
             <uri>info:srw/diagnostic/1/38</uri>
             <details>10</details>
             < message>
                Too many boolean operators, the maximum is 10.
                Please try a less complex query.</message>
     < /diagnostic>
< /diagnostics>

Surrogate, non-fatal diagnostic:

<records>

    < record>
        <recordSchema> info:srw/schema/1/diagnostics-v1.1</recordSchema>              <recordData>
             <diagnostic xmlns="http://www.loc.gov/zing/srw/diagnostic/">                                <uri>info:srw/diagnostic/1/65</uri>
             <message>Record deleted by another user.</details> </diagnostic>
       < /recordData>
   < /record>
...
< /records>