Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EMMO extensions: ontology packages with coincident ontology namespaces #593

Open
kysrpex opened this issue Mar 17, 2021 · 0 comments
Open
Labels
pico Issue affecting the PICO ontology installer. 📜 ontology 💬 discussion The idea is not mature enough to result in an implementation, and needs further discussion.

Comments

@kysrpex
Copy link
Contributor

kysrpex commented Mar 17, 2021

Thanks to @JoanaFMorgado, I realized that users of the EMMO ontology are working with "emmo extensions". To understand what this means, look at the following two sample ontology packages.

Package test
test.yml

---
identifier: test
ontology_file: test.owl
format: ttl
reference_by_label: True
namespaces:
    emmo: "http://emmo.info/emmo"
active_relationships: []

test.owl

@prefix : <http://emmo.info/emmo/application/test_ontology#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <http://emmo.info/emmo/application/test_ontology> .

<http://emmo.info/emmo/application/test> rdf:type owl:Ontology .


#################################################################
#    Classes
#################################################################

###  http://emmo.info/emmo#EMMO_1f1b164d_ec6a_4faa_8d5e_88bda62316ak
<http://emmo.info/emmo#EMMO_1f1b164d_ec6a_4faa_8d5e_88bda62316ad> rdf:type owl:Class ;
                                                                  rdfs:label "labeled_thing" .

Package another_test
another_test.yml

---
identifier: another_test
ontology_file: another_test.owl
format: ttl
reference_by_label: True
namespaces:
    another_test: "http://emmo.info/emmo"
active_relationships: []

another_test.owl

@prefix : <http://emmo.info/emmo/application/another_test#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <http://emmo.info/emmo/application/another_test> .

<http://emmo.info/emmo/application/another_test> rdf:type owl:Ontology .


#################################################################
#    Classes
#################################################################

###  http://emmo.info/emmo#EMMO_1f1b164d_ec6a_4faa_8d5e_88bda62316ac
<http://emmo.info/emmo#EMMO_1f1b164d_ec6a_4faa_8d5e_88bda62316ac> rdf:type owl:Class ;
                                                                  rdfs:label "labeled_thing" .

###  http://emmo.info/emmo#EMMO_1f1b164d_ec6a_4faa_8d5e_88bda62316ab
<http://emmo.info/emmo#EMMO_1f1b164d_ec6a_4faa_8d5e_88bda62316ae> rdf:type owl:Class ;
                                                                  rdfs:label "another_labeled_thing" .

The ontology package test contains the namespace emmo. The ontology package another_test contains the namespaces emmo and another_test. Note that among the two packages, there are three classes in total. Two of them are in different packages but labeled the same (this is not a mistake, it is what the user intends to do), and the remaining one belongs to another_test.

The problem is that all the classes in the ontology files belong to the namespace <http://emmo.info/emmo>, and as said, there are two classes with the same label. Therefore, when the user refers to "labeled_thing", there is ambiguity and the following happens.

In [4]: emmo.labeled_thing
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
[...]
KeyError: 'There are multiple elements (EMMO_1f1b164d_ec6a_4faa_8d5e_88bda62316ac, EMMO_1f1b164d_ec6a_4faa_8d5e_88bda62316ad) with label labeled_thing for namespace emmo (http://emmo.info/emmo#).\nPlease refer to a specific element of the list by calling get_from_iri(IRI) for namespace emmo (http://emmo.info/emmo#) for one of the following IRIs: http://emmo.info/emmo#EMMO_1f1b164d_ec6a_4faa_8d5e_88bda62316ac, http://emmo.info/emmo#EMMO_1f1b164d_ec6a_4faa_8d5e_88bda62316ad.'
[...]

In [5]: another_test.labeled_thing
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
[...]
KeyError: 'There are multiple elements (EMMO_1f1b164d_ec6a_4faa_8d5e_88bda62316ac, EMMO_1f1b164d_ec6a_4faa_8d5e_88bda62316ad) with label labeled_thing for namespace another_test (http://emmo.info/emmo#).\nPlease refer to a specific element of the list by calling get_from_iri(IRI) for namespace another_test (http://emmo.info/emmo#) for one of the following IRIs: http://emmo.info/emmo#EMMO_1f1b164d_ec6a_4faa_8d5e_88bda62316ac, http://emmo.info/emmo#EMMO_1f1b164d_ec6a_4faa_8d5e_88bda62316ad.'
[...]

This is good, and guarantees that the user won't be referring to the wrong ontology class. This exception was implemented in pull request #584. An error is also raised when a single ontology package containing two classes with the same label is installed. However, this behavior at installation time is not implemented for the "emmo extensions" case (the example), that is, when the two classes have the same label but are contained in different files. In my opinion, the behavior should also be extended to that case.

@emanueleghedini @JoanaFMorgado This issue is relevant for you, as it relates to the question of whether classes in "emmo extensions" should use the emmo namespace or a different one. If they all use the same namespace, in order to remove this ambiguity, the user would have to uninstall all extensions with conflicting labels except for the one they actually want to use . Another option is to use get_from_iri(IRI) as stated in the exception, but with the emmo IRIs this is very cumbersome.

@kysrpex kysrpex added 💬 discussion The idea is not mature enough to result in an implementation, and needs further discussion. 📜 ontology pico Issue affecting the PICO ontology installer. labels Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pico Issue affecting the PICO ontology installer. 📜 ontology 💬 discussion The idea is not mature enough to result in an implementation, and needs further discussion.
Projects
None yet
Development

No branches or pull requests

1 participant