mjordan / metadata_reporter

Script to report on various aspects of metadata retrieved via OAI-PMH
The Unlicense
2 stars 0 forks source link

Sample ini file? #1

Open bondjimbond opened 6 years ago

bondjimbond commented 6 years ago

I tried using the sample config from the README, but can't get any results. See attached. test.ini.txt

Error messages different depending on the set ID:

Brandons-MacBook-Pro:metadata_reporter brandon$ ./reporter test.ini Fetching records from http://arcabc.ca/oai2...

Fatal error: Uncaught Phpoaipmh\Exception\HttpException: HTTP Request Failed (code 302): in /Users/brandon/metadata_reporter/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/HttpAdapter/CurlAdapter.php:89 Stack trace:

0 /Users/brandon/metadata_reporter/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/Client.php(95): Phpoaipmh\HttpAdapter\CurlAdapter->request('http://arcabc.c...')

1 /Users/brandon/metadata_reporter/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/RecordIterator.php(224): Phpoaipmh\Client->request('ListRecords', Array)

2 /Users/brandon/metadata_reporter/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/RecordIterator.php(190): Phpoaipmh\RecordIterator->retrieveBatch()

3 /Users/brandon/metadata_reporter/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/RecordIterator.php(317): Phpoaipmh\RecordIterator->nextItem()

4 /Users/brandon/metadata_reporter/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/RecordIterator.php(172): Phpoaipmh\RecordIterator->next()

5 /Users/brandon/metadata_reporter/reporter(43): Phpoaipmh\RecordIterator->getTotalRecordCount()

6 in /Users/brandon/metadata_reporter/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/HttpAdapter/CurlAdapter.php on line 89

or with a different set:

Brandons-MacBook-Pro:metadata_reporter brandon$ ./reporter test.ini Fetching records from https://arcabc.ca/oai2...

Fatal error: Uncaught OaipmhException: [0]: (noRecordsMatch) The combination of the given values results in an empty list. thrown in /Users/brandon/metadata_reporter/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/Client.php on line 145

The second error crops up if the collection is XACML-restricted. The first error crops up on a normal, populated collection: https://arcabc.ca/islandora/object/unbc:nbcdcbooks

Am I doing something wrong in my .ini file? Could you perhaps make a usable sample file available as part of the repo?

mjordan commented 6 years ago

@bondjimbond the configuration provided in the "Usage" section of the README can be used as a sample .ini file, but yes, I will provide a separate one.

In the first error, the OAI-PMH client is getting back an HTTP 302 response code, which is a redirect. I don't know why your Islandora is returning a 302, I just tried this script against digital.lib.sfu.ca and it is not. We'll need to look into that one.

In the second error, I'm not surprised the set is empty if the collection has XACML policy on it. Since the reporter script runs as anonymous, if that policy blocks anonymous access, the set should be empty. We'd need to figure out how to make the OAI-PMH client run with specific user credentials (probably not impossible, I just never thought of doing that).

bondjimbond commented 6 years ago

Thanks... The error is not always a redirect, apparently. It's different collection to collection, strangely enough. Here's what I get with tru:routley and also for arms:photographs...

Brandons-MacBook-Pro:metadata_reporter brandon$ ./reporter test.ini Fetching records from https://arcabc.ca/oai2...

Fatal error: Uncaught Phpoaipmh\Exception\HttpException: HTTP Request Failed (code 0): in /Users/brandon/metadata_reporter/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/HttpAdapter/CurlAdapter.php:89 Stack trace:

0 /Users/brandon/metadata_reporter/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/Client.php(95): Phpoaipmh\HttpAdapter\CurlAdapter->request('https://arcabc....')

1 /Users/brandon/metadata_reporter/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/RecordIterator.php(224): Phpoaipmh\Client->request('ListRecords', Array)

2 /Users/brandon/metadata_reporter/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/RecordIterator.php(190): Phpoaipmh\RecordIterator->retrieveBatch()

3 /Users/brandon/metadata_reporter/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/RecordIterator.php(317): Phpoaipmh\RecordIterator->nextItem()

4 /Users/brandon/metadata_reporter/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/RecordIterator.php(172): Phpoaipmh\RecordIterator->next()

5 /Users/brandon/metadata_reporter/reporter(43): Phpoaipmh\RecordIterator->getTotalRecordCount()

6 { in /Users/brandon/metadata_reporter/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/HttpAdapter/CurlAdapter.php on line 89

mjordan commented 6 years ago

I think the best thing to do is to wrap the request by the OAI-PMH client in a try/catch so we can trap the exceptions and output a useful error message to the user. I'm at a conference right now and can't dig into this deeply, but I also wonder if this entire tool should be redeveloped as a drush script. That would let us avoid the XAMCML issue. We could still look at the DC or MODS datastreams, or even the raw Solr document. Making it a drush script would remove the OAI-PMH client altogether.

Another possibility is to add this functionality to Islandora Datastream CRUD.