Bug with .individuals()

Posted by Stefan on
URL: http://owlready.306.s1.nabble.com/Bug-with-individuals-tp886.html

Hi,

I found a bug with the .individuals() method. If you try to list all individuals from an ontology, and you have an individual with the same name as its class, you get a stack overflow.

Python code and ontology to reproduce the issue:

import owlready2 as or2

o = or2.get_ontology("< PATH TO ONTOLOGY >").load()

for ind in o.individuals():
    print(ind.name)


<?xml version="1.0"?>
<rdf:RDF xmlns="http://www.semanticweb.org/stlu/ontologies/2019/1/untitled-ontology-108#"
     xml:base="http://www.semanticweb.org/stlu/ontologies/2019/1/untitled-ontology-108"
     xmlns:owl="http://www.w3.org/2002/07/owl#"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:www="http://www.example.com/#"
     xmlns:xml="http://www.w3.org/XML/1998/namespace"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
     xmlns:untitled-ontology-108="http://www.semanticweb.org/stlu/ontologies/2019/1/untitled-ontology-108#">
    <owl:Ontology rdf:about="http://www.example.com/"/>
   


   

   


   

    <owl:Class rdf:about="http://www.example.com/#A"/>
   


   

    <owl:Class rdf:about="http://www.example.com/#B">
        <rdfs:subClassOf rdf:resource="http://www.example.com/#A"/>
    </owl:Class>
   


   

   


   

    <owl:NamedIndividual rdf:about="http://www.example.com/#B">
        <rdf:type rdf:resource="http://www.example.com/#B"/>
    </owl:NamedIndividual>
   


</rdf:RDF>