Skip to content

Preserve prefixes from loaded ontology.#1106

Merged
jamesaoverton merged 5 commits intomasterfrom
issue-1101
May 11, 2023
Merged

Preserve prefixes from loaded ontology.#1106
jamesaoverton merged 5 commits intomasterfrom
issue-1101

Conversation

@balhoff
Copy link
Contributor

@balhoff balhoff commented Mar 28, 2023

Resolves #1101.

  • 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

This change gets the document format used to load the ontology, and sets it as the prefix manager for the document format being used to save the ontology.

balhoff and others added 2 commits March 28, 2023 10:32
Add a test to ensure that prefixes initially present in an ontology are
preserved when the ontology is saved through IOHelper.
Add a test case for conservation of prefixes.
Copy link
Contributor

@matentzn matentzn left a comment

Choose a reason for hiding this comment

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

I tested this on 4 different ontologies and 12 different file variants. I am convinced it does what we need it to do.

Thank you @balhoff, @gouttegd!

@jamesaoverton
Copy link
Member

I'm getting some weirdness in the diffs. In some cases the xmlns and xml:base attributes of the root rdf:RDF element use the Ontology IRI of the previousOntology even though I'm setting a new Ontology IRI with robot annotate. So I get diffs like this:

diff views-old/NIAID-GSC-BRC.owl views/NIAID-GSC-BRC.owl
2,3c2,3
< <rdf:RDF xmlns="http://purl.obolibrary.org/obo/obi/NIAID-GSC-BRC.owl#"
<      xml:base="http://purl.obolibrary.org/obo/obi/NIAID-GSC-BRC.owl"
---
> <rdf:RDF xmlns="http://purl.obolibrary.org/obo/obi.owl#"
>      xml:base="http://purl.obolibrary.org/obo/obi.owl"
diff views-old/obi.obo views/obi.obo
3c3
< date: 11:05:2023 11:17
---
> date: 11:05:2023 14:28
diff views-old/obi.owl views/obi.owl
2,3c2,3
< <rdf:RDF xmlns="http://purl.obolibrary.org/obo/obi.owl#"
<      xml:base="http://purl.obolibrary.org/obo/obi.owl"
---
> <rdf:RDF xmlns="http://purl.obolibrary.org/obo/obi/obi_merged.owl#"
>      xml:base="http://purl.obolibrary.org/obo/obi/obi_merged.owl"

@balhoff
Copy link
Contributor Author

balhoff commented May 11, 2023

I think we might want to tweak this a little to not replace the default namespace. See OBOFoundry/COB#234 (review)

@balhoff
Copy link
Contributor Author

balhoff commented May 11, 2023

@jamesaoverton I've pushed a commit which should fix your issue.

@jamesaoverton
Copy link
Member

It does. Thanks!

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.

ROBOT convert is stripping prefixes

4 participants