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 referencing properties by CURIE in export #722

Merged
merged 3 commits into from
Aug 18, 2020
Merged

Conversation

beckyjackson
Copy link
Contributor

@beckyjackson beckyjackson commented Aug 17, 2020

Resolves #721

  • 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

Change to compare IRI with equals() instead of == in export in order to allow both CURIEs and labels in export headers. I have no idea why two properties with the same IRI would be considered different IRI objects when we pass CURIEs but not labels, but if we change to this comparison, it's resolved.

Previously:

prop1.getIRI() == prop2.getIRI()

Now:

prop1.getIRI().equals(prop2.getIRI())

I also made the process to get the IRI of a header a little bit smarter.

@balhoff
Copy link
Contributor

balhoff commented Aug 17, 2020

@beckyjackson how about prop1.getIRI().equals(prop2.getIRI())? .equals vs. ==

@beckyjackson
Copy link
Contributor Author

I should have thought to try that first. It seems to work just as well.

It's strange that == works for by-label but not by-CURIE, but equals() works for all so... I won't question it.

@balhoff
Copy link
Contributor

balhoff commented Aug 17, 2020

It's strange that == works for by-label but not by-CURIE, but equals() works for all so... I won't question it.

😄 strings may be reused internally I think (interned). Also OWL API uses a cache for the strings in IRI construction: https://github.com/owlcs/owlapi/blob/23593593c2853006bfe3bb61ec03fae2e3736461/api/src/main/java/org/semanticweb/owlapi/model/IRI.java#L63

I would just stick to .equals 99.999% of the time in Java. One of the little benefits of Scala is that the've swapped this and use == as value equality, and eq for object identity.

@jamesaoverton jamesaoverton merged commit 298a2a3 into master Aug 18, 2020
@jamesaoverton jamesaoverton deleted the 721-fix branch June 16, 2022 15:54
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.

prefixes not working with robot export
3 participants