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

Fix template handling of full IRIs #783

Merged
merged 10 commits into from
Dec 10, 2020
Merged

Fix template handling of full IRIs #783

merged 10 commits into from
Dec 10, 2020

Conversation

beckyjackson
Copy link
Contributor

@beckyjackson beckyjackson commented Dec 2, 2020

Resolves #782

  • docs/ have been added/updated
  • tests have been added/updated
  • mvn verify says all tests pass
  • mvn site says all JavaDocs correct
  • CHANGELOG.md has been updated

In the issue, http://example.com/resource/1 is not a technically a valid QName, and we updated the processing of IDs/IRIs in templates last May to make sure all IRIs were also valid QNames. This is because the writer would fail on invalid QNames, but it seems like it's only certain invalid QNames... Even though it's not valid, OWLAPI seems to still handle it OK as opposed to the CURIEs that were never expanded to IRIs (see #688).

The QName check in OWLAPI fails every time for http://example.com/resource/1 so I made a hack around it with a new isQName method in IOHelper. It will still fail for CURIEs with undefined namespaces, as we expect.

@jamesaoverton
Copy link
Member

The code looks good, but you know what I'm going to say! 😄 We need some unit tests, please.

@beckyjackson
Copy link
Contributor Author

Done!

* @param iri IRI to check
* @return true if no invalid characters found
*/
public static boolean shortFormIsValid(IRI iri) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is valid what? CURIE? QName? String?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It validates that the short form does not contain invalid characters. I guess shortFormContainsInvalidCharacters (returns true on invalid) or something like that sounded too long to me but I can change it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point is that there are no invalid characters in general, without saying what the standard is. There are invalid characters for a CURIE, or a QName, or an IRI, or a Python function name.

I'll think about it a little more and make changes myself.

@jamesaoverton
Copy link
Member

I asked for three different error messages, but when I went to review this closely only two made sense to me, so I removed one.

@jamesaoverton jamesaoverton merged commit f2b0de7 into master Dec 10, 2020
@jamesaoverton jamesaoverton deleted the 782-fix branch June 16, 2022 15:53
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.

Template: IRIs, used as IDs, can't end with digits?
2 participants