from owlready2 import *
onto = get_ontology("https://test.org/onto.owl")
with onto:
class Drug(Thing):
pass
my_drug1 = Drug("my_drug1")
my_drug2 = Drug("my_drug2")
my_drug3 = Drug("my_drug3")
my_drug4 = Drug("my_drug4")
for i in Drug.instances():
print(i)
But after creating the instances for Drug, when I'm trying to print all the available instances under Drug by using the for loop in the above snippet, I'm getting this error.
sqlite3.OperationalError: circular reference: prelim1_objs
CodePudding user response:
I am unable to reproduce your problem. Can you give me the version number of Python, Owlready and SQLite3? You can obtain them as follows in Python:
import sys, owlready2, sqlite3
print("Python", sys.version)
print("Owlready2", owlready2.VERSION)
print("SQLite3", sqlite3.sqlite_version)
Jiba
CodePudding user response:
I finally found the cause of this problem. Some versions of SQLite3 have a bug in the support of recursive queries. Version 3.33 is affected, while version 3.36 is not.
I added a workaround in the development version of Owlready (on BitBucket). I will make a new release soon.