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

Treat invalid IRIs as errors in conversion to RDF #138

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aucampia
Copy link

Currently invalid (i.e. non absolute) IRIs are ignored and tripples
containing non absolute IRIs are omitted from the RDF resulting from
to_rdf.

This patch changes this behaviour so that non absolute IRIs result in
exceptions instead.

See #137

I am not sure what to do about testing, it seems there are no general unit tests, but rather just some scaffolding to run the w3c tests (which fail).

If you want I can add some general unit tests for you, just need to agree on the framework I guess.

Currently invalid (i.e. non absolute) IRIs are ignored and tripples
containing non absolute IRIs are omitted from the RDF resulting from
`to_rdf`.

This patch changes this behaviour so that non absolute IRIs result in
exceptions instead.
@gkellogg
Copy link
Collaborator

The spec specifically calls for such IRIs to be ignored, so raising an error would cause some tests to fail. I think the best thing to do is issue a warning, but a processor flag could cause an error to be raised.

@aucampia
Copy link
Author

Thanks for the info @gkellogg

I think maybe to keep things clean it is best to add two options: strict and warn. If strict is set to True then raise when encountering an invalid IRI (i.e. not a valid absolute IRI), if warn is set to True then warn in the same case.

strict and warn could then be used for other similar cases in future.

Not sure what you think is best, feedback is appreciated.

@aucampia
Copy link
Author

aucampia commented Sep 14, 2020

The other option is maybe to just have warn and errorOnInvalidIRI - but I worry that this will lead to proliferation of errorOn... options.

@aucampia aucampia marked this pull request as draft September 15, 2020 06:03
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

Successfully merging this pull request may close these issues.

None yet

2 participants