Search code examples
owlowl-api

OWLAPI 4: import or merge ontologies?


I have a situation like follows: I have three core ontologies which have their TBox and ABox descriptions respectively. They need to be imported/merged at runtime. I also need to import/merge other ontologies one at a time which hold only ABox descriptions. The last ones must be loaded and removed dynamically with time passing. My dilemma is whether to use import or merge of OWLAPI 4?

UPDATE: The core ontologies ABox will eventually be modified based on incoming data from dynamical load of "part-time" ontologies.


Solution

  • Import sounds like the best strategy, since you didn't mention modifications to any of the ontologies, but only additions and removals of whole ontologies.

    I would do the following:

    • create a new, empty ontology
    • import all the ontologies that will always be included
    • add/remove imports to the ontologies that you only want to use for part of the time

    Note: OWLAPI does not load ontologies at the point in which the imports declaration is created - this is to avoid long loading times when one is just editing the imports. So for this to work you'll have to load the ontologies you plan to use beforehand:

    • Load ontology X
    • add import declaration to Y: Y imports X

    Most query methods on OWLOntology accept a parameter to tell whether you wish the search to include the imports closure - you're likely to want to set this to Imports. INCLUDED all the time.