Skip to content
Ethan Gruber edited this page Jun 13, 2017 · 6 revisions

The Check web service is located at /admin/check.

The first step in the check API is to query the SPARQL endpoint to see if the set has already been harvested into the system with a target system (doap:audience) of either 'primo' or 'dpla'. If the SPARQL response yields 'false', then it proceeds to the next step: the service iterates through one or more OAI-PMH sets (including paginations via resumptionToken) to return a total count of matching CHOs. This web service can be used for validation in the NWDA Tools before initiating the ingestion process.

There are two mandatory request parameters and one optional:

  1. set : URL-encoded OAI-PMH set URL
  2. ark : Optional Must conform to the format, 'ark:/80444/xv43658', for example.

XML Response Model

The root element of the XML response is <set>, which contains the <url> and, if successful, the <count> of CHOs that match the provided ARK parameter OR contain any ARK whatsoever, if the ARK parameter is not supplied. If there is an error, there will be an <error> element instead of <count>.

Errors

There are three types of errors, distinguished by the @type attribute on the error element.

  1. use-harvester: The SPARQL response yields 'true' for a target of Primo or DPLA. The set should therefore be ingested through the Harvester back-end for additional required validation.
  2. http : An HTTP error (such as a 404 Not Found) or a the URL does not response well-formed XML. The exception is caught by the Orbeon Exception Catcher processor, which is built on Java exception mechanisms.
  3. oai-pmh : If an XML response is received from the set URL, but it contains an <oai:error>, the OAI-PMH error message is outputted in the Check API response. This error might occur if the verb or other required URL parameter is not provided, according to the OAI-PMH protocol.
  4. other : If an XML response is received from the set URL, but the root element is not in the OAI namespace, the set URL is presumed not to be valid OAI-PMH, and therefore a count of matching CHOs would be inaccurate.

Example Responses

    <set>
        <url>http://digital.boisestate.edu/oai/oai.php?verb=ListRecords&amp;metadataPrefix=oai_qdc&amp;set=roach</url>
        <count>81</count>
    </set>
    <set>
        <url>http://digital.boisestate.edu/oai/oai.php?verb=ListRecords</url>
        <error type="oai-pmh">The request includes illegal arguments, repeated arguments, or is missing required arguments. "metadataPrefix"</error>
    </set>
    <set>
        <url>http://nomisma.org/id/rome.rdf</url>
        <error type="other">The response is XML, but not OAI-PMH.</error>
    </set>
    <set>
        <url>http://content.libraries.wsu.edu/oai/oai.php?verb=ListRecords&metadataPrefix=oai_dc&set=matsura</url>
        <error type="use-harvester">This set has been published with a doap:audience of 'primo' and/or 'dpla' already. Please resubmit through the Harvester backend.</error>
    </set>
    <set>
        <url>http://www.google.com</url>
        <error type="http">Fatal error: The markup in the document preceding the root element must be well-formed.</error>
    </set>

More Information

This workflow is controlled by xpl/controllers/check.xpl.

An underlying SPARQL query example can be seen here: https://gist.github.com/ewg118/2961831c21c82ba0789cc75288761643.

Clone this wiki locally