Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force parameter on non-OAI 2 compliant identifiers #26

Closed
netsensei opened this issue May 16, 2019 · 3 comments
Closed

Force parameter on non-OAI 2 compliant identifiers #26

netsensei opened this issue May 16, 2019 · 3 comments

Comments

@netsensei
Copy link
Contributor

I'm confronted with an OAI-PMH endpoint that publishes records that don't have an OAI 2 compliant identifier:

$ catmandu convert OAI --url http://example.org/oai --metadataPrefix oai_dc --getRecord 1 --identifier "foobar:20000099"

Will return me this:

Invalid Request (use 'force' to force a non-conformant request): <?xml version="1.0" encoding="UTF-8"?>
<error xmlns="http://www.openarchives.org/OAI/2.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" code="badArgument">Bad argument (identifier): Identifier not in OAI format, must match regexp ^[[:alpha:]][[:alnum:]\+\-\.]*:.+</error>
 (stopped after 0 retries)

So, Catmandu hands me an error passed on from HTTP::OAI. This library has a force flag which allows one to skip the validate_request subroutine that validates the identifier.

It wasn't implemented in Catmandu::OAI so it's not possible to use this flag from the command line like this:

$ catmandu convert OAI --url http://example.org/oai --metadataPrefix oai_dc --getRecord 1 --identifier "foobar:20000099" --force 1

I'm going to file a PR with a proposed addition that makes this flag available. Of course, there are good design reasons to not implement this in the CLI of Catmandu.

The use case here is harvesters being confronted with OAI-PMH endpoints that are managed by third parties that don't comply to the strict specification nor have any intention to do so in the near future (i.e. due to strategic or operational circumstances that hamper a better implementation on short notice).

@phochste
Copy link
Member

@netsensei I've changed your pull request to a --strict option and have force by default and switching it off optionally. The intent of Catmandu is to be quite liberal what to accept as data

@netsensei
Copy link
Contributor Author

@phochste Looking good! You're right about the acceptance of data per Postel's Law.

I'm okay with merging this and pushing a new release.

@phochste
Copy link
Member

@netsensei Version 0.19 is on its way to CPAN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants