dice-group / Ontolearn

Ontolearn is an open-source software library for explainable structured machine learning in Python. It learns OWL class expressions from positive and negative examples.
https://ontolearn-docs-dice-group.netlify.app/index.html
MIT License
39 stars 9 forks source link

owl imports differ #78

Closed renespeck closed 3 years ago

renespeck commented 3 years ago

Hi all, I run this file: examples/learning_problem_generator.py

with, for example, path = '/home/rspeck/Desktop/OntoPy/data/biopax/owl/data/biopax.owl' it results in a file (line 10):

...
<owl:imports rdf:resource="file:///home/rspeck/Desktop/OntoPy/data/biopax/owl/data/biopax.owl"/>
...

with, for example, path = '/home/rspeck/Desktop/OntoPy/data/suramin/owl/data/suramin.owl' it results in a file (line 10):

...
<owl:imports rdf:resource="http://dl-learner.org/suramin"/>
...

Would be really good to have the used file in path imported in the resulting file like it is in the first example.

heindorf commented 3 years ago

I believe this happens because suramin.owl has the statement

<owl:Ontology rdf:about="http://dl-learner.org/suramin"/>

while biopax.owl does not have such a statement.

So this behavior might actually be expected and correct. If you think otherwise, can you provide a link to the specification?

Overall, these imports seem to be a controversial topic: https://protegewiki.stanford.edu/wiki/How_Owl_Imports_Work

renespeck commented 3 years ago

Please read the section "What Can Go Wrong" of the link you provided. In the section "Import By Name" the example imports an ontology in the correct way, it points to the imported ontology with this link: http://protege.stanford.edu/plugins/owl/protege but this link: http://dl-learner.org/suramin doesn't point to the imported ontology. It is just a link.

https://www.w3.org/TR/owl2-syntax/#Imports "An OWL 2 ontology can import other ontologies in order to gain access to their entities, expressions, and axioms, thus providing the basic facility for ontology modularization."

Given a link that doesn't point to another ontology, will obviously not gain access to their entities, expressions, and axioms.

Besides that, what is the semantics of imports in xml,latex,cpp,....?

SimonBin commented 3 years ago

Perfect linked data will have dereferenceable IRIs. Nevertheless it is desirable even for unpublished data-sets to have unique IRIs. I recommend code to be flexible and have a way to load the base ontologies even if their IRIs are not dereferenceable. This should be possible by simply loading them, or possibly with a SimpleIRIMapper

If an ontology document is unnamed, Protége would assign it an IRI of semweb:user/ontologies/.../untitled-ontology-X

If you load an ontology document with an unnamed ontology using Owlready2, it will use the same argument as supplied to .load as the Ontology IRI

If you load an ontology document with a named ontology, the correct ontology IRI will be replicated

Hence the behaviour you see is correct