emmo-repo / EMMO

Elementary Multiperspective Material Ontology (EMMO)
Other
61 stars 16 forks source link

Correctly load base_iri and iri #267

Closed jesper-friis closed 4 months ago

jesper-friis commented 4 months ago

Owlready2 doesn't distinguish between iri (the IRI of the ontology) and base_iri (the prefix of all entities in the ontology). When Owlready2 loads an ontology, it assigns base_iri to the ontology IRI, which creates a lot of confusion. That said, Owlready2 does this for good reasons, since it is only iri that is explicitly defined in the triples (as long as the source only contain one ontology), while base_iri has to be inferred from the IRIs of the entities in the ontology.

However, we can do better. When loading a turtle file, the base_iri can be obtained from the @prefix : <...> . line. When loading other formats, we can try to infer the base_iri from the class IRIs. If the IRIs of all classes starts with the same base, that is the base_iri.

jesper-friis commented 4 months ago

Moved to EMMOntoPy issue 723