csse-uoft / owlready2

GNU Lesser General Public License v3.0
0 stars 0 forks source link

Inconsistent URL in the imported ontologies #1

Closed LesterLyu closed 2 years ago

LesterLyu commented 2 years ago

Link to owlready2 forum

Issue description:

When creating a new ontology via owlready2 and set the imported ontologies:

from owlready2 import *

onto = default_world.get_ontology("http://test#")

cwrc_onto = default_world.get_ontology("http://sparql.cwrc.ca/ontologies/cwrc.owl").load()
onto.imported_ontologies.append(cwrc_onto)
onto.save('./test.owl')

The import section in the owl file does not contain the ".owl" extension:

<owl:Ontology rdf:about="http://test">
  <owl:imports rdf:resource="http://sparql.cwrc.ca/ontologies/cwrc"/>  <b><-- missing .owl</b>
</owl:Ontology>

This will make Protege unable to read the imported ontology file. Manually add the ".owl" makes it work.

What's the expected result?

<owl:Ontology rdf:about="http://test">
  <owl:imports rdf:resource="http://sparql.cwrc.ca/ontologies/cwrc.owl"/>
</owl:Ontology>

Additional Information:

If I don't call load(), the ".owl" extension won't be removed.

LesterLyu commented 2 years ago

Fixed in https://github.com/csse-uoft/owlready2/commit/6df52c4520fe649c1abe0ab28f7a1ce51ee3152e