Re: Classes with ? at the end can be created, but not queried

Posted by maxrosen on
URL: http://owlready.306.s1.nabble.com/Classes-with-at-the-end-can-be-created-but-not-queried-tp3319p3334.html

OK, I succeeded in reproducing it. In the ontology below (icd10cm.owl), H54.415? is a child of H54.415, but H54.415 is returned, leading to a cycle. If unrelated parts of the ontology are deleted (result: untitled.owl), H54.415? is correctly returned.

DOES NOT WORK:

import owlready2 as or2

icd10cm_ontology = or2.get_ontology("/Users/xxx/icd10cm.owl").load()

ontology_prefix = "http://purl.bioontology.org/ontology/ICD10CM/"
class_reference = "H54.415"

hi_owlready = or2.default_world[ontology_prefix + class_reference]

children1 = hi_owlready.subclasses()

print(list(children1))

Output:

[icd10cm.H54.415, icd10cm.H54.415A]
* Owlready2 * Warning: ignoring cyclic subclass of/subproperty of, involving:
  http://purl.bioontology.org/ontology/ICD10CM/H54.415

WORKS:

import owlready2 as or2

icd10cm_ontology = or2.get_ontology("/Users/xxx/untitled.owl").load()

ontology_prefix = "http://purl.bioontology.org/ontology/ICD10CM/"
class_reference = "H54.415"

hi_owlready = or2.default_world[ontology_prefix + class_reference]

children1 = hi_owlready.subclasses()

print(list(children1))

Output: [untitled.H54.415A, untitled.H54.415?]

The ontologies are here: https://uni-bonn.sciebo.de/s/uhj0ZoWMYl4oc2a