Menu

#284 Imports of multiple ont docs containing the same ont fails

closed
None
5
2014-08-17
2011-09-04
No

Some background for this bug can be found in [1,2] and I have
attached the referenced files to this report. If while loading an
ontology the parser finds two distinct ways of importing the same
ontology it will throw an exception indicating that the ontology name
is already in use. I have attached a program showing this issue.

Ideally, if the owl api detected such an issue during processing it
would first check whether the two ontologies were identical before
throwing the exception. I have attached a program demonstrating this
issue.

-Timothy

[1] https://mailman.stanford.edu/pipermail/p4-feedback/2011-September/004084.html
[2] https://mailman.stanford.edu/pipermail/p4-feedback/2011-September/004085.html

Discussion

  • Timothy Redmond

    Timothy Redmond - 2011-09-04

    a file demonstrating this issue

     
  • Timothy Redmond

    Timothy Redmond - 2011-09-04

    a file attached to the original report from Melanie

     
  • Timothy Redmond

    Timothy Redmond - 2011-09-04

    a file attached to the original report from Melanie

     
  • Ignazio Palmisano

    I've turned your code in a junit test to be added to our suite (thanks).

    Looks like the root exception is thrown in here:

    private void checkForOntologyIDChange(OWLOntologyChange change) {
    if (change instanceof SetOntologyID) {
    SetOntologyID setID = (SetOntologyID) change;
    OWLOntology existingOntology = ontologiesByID.get(((SetOntologyID) change).getNewOntologyID());
    if (existingOntology != null && !change.getOntology().equals(existingOntology)) {
    throw new OWLOntologyRenameException(change, ((SetOntologyID) change).getNewOntologyID());
    }
    renameOntology(setID.getOriginalOntologyID(), setID.getNewOntologyID());
    resetImportsClosureCache();
    }
    }

    But this method already implements your equality check; sounds like the equals() on ontologies is broken, or the differently loaded ontologies are not coming up as equals for some reason. Will investigate deeper.

     
  • Ignazio Palmisano

    Ok, so the ontology equals() does not compare the axioms but only the ids - I suppose there is a reason for that although I don't know which one it is. For the current purpose, it is not necessary to alter the equals() but only to replace that call with comparison of the axioms of the two ontologies. The prolem is, what should happen if the ongoing renaming is happening on loading the same ontology from different locations? Which combination of warnings or change would you expect? Warning and change, no warning and no change or one of each? the problem would be with possible other uses of the old ontology id by other ontologies or other code - changes due to a multiple, superficially different import, might have non obvious consequences,

     
  • Timothy Redmond

    Timothy Redmond - 2011-09-05

    I actually am uncertain what the fix should be for this issue. But I can see the argument that during imports processing, if two imports directives actually point to the same file then the second import should succeed and should get the same ontology. Even in the case where the second import is made side by side with the first one, I don't see a general way to see this without parsing both copies and then noticing that they have the same axioms. I will see Matthew on Tuesday and I will be interested in seeing what he thinks about this bug.

     
  • Timothy Redmond

    Timothy Redmond - 2011-09-06

    An alternative approach to this bug is to simply throw away the second parse when the exception is detected. The second import is simply replaced with the first ontology and a warning is logged. When the parser interface includes a hook for dealing with parser problems a hook can be introduced that allows the user to take other actions. Until this hook is implemented, Protege (and other applications) can detect this situation after the parse and perform any desired action.

     
  • Melanie Courtot

    Melanie Courtot - 2011-10-13

    This is creating more and more issues on our side, see http://code.google.com/p/ogms/issues/detail?id=64
    Is there any resolution in sight, or anything we can do to help?
    Thanks,
    Melanie

     
  • Shahim Essaid

    Shahim Essaid - 2011-10-17

    The problem in my case is a little simpler. I get the exception even if the same ontology is loaded from the same document. The problem is that my import chain eventaully loads the same OWL document from two different URLs that are PURLed to the same final document URL. I don't need the API to handle the loading of two documents with the same ontology, I only need it to not throw an exceptions when there are different PURLs for the same document URL.

    It would be good if this scenario is fixed first and then try to fix the real problem of importing the same ontology from two different documents.

     
  • Matthew Horridge

    • summary: loading a file that imports the same file in two ways fails --> Imports of multiple ont docs containing the same ont fails
     
  • Ignazio Palmisano

    • status: open --> closed
     
  • Ignazio Palmisano

    • assigned_to: nobody --> ignazio1977
     

Log in to post a comment.

Auth0 Logo