Hello,
I use you library to create a toll for semantically annotation and search with a web frontend. Since last version 0.9 I get an error. Independent of which database I use, PostgreSQL or SQLite. I create a database using your library from existing ontology, which I create with Protege. Everything's going perfectly. Databases contain all datasets. However, when I try to open it/create a World, I get the following error: Traceback (most recent call last): File "<input>", line 2, in <module> File "C:\Users\...\venv\lib\site-packages\owlready2\namespace.py", line 241, in __init__ self.set_backend(backend, filename, dbname, **kargs) File "C:\Users\...\venv\lib\site-packages\owlready2\namespace.py", line 283, in set_backend self.get_ontology(iri) # Create all possible ontologies if not yet done File "C:\Users\...\venv\lib\site-packages\owlready2\namespace.py", line 315, in get_ontology return Ontology(self, base_iri) File "C:\Users\...\venv\lib\site-packages\owlready2\namespace.py", line 445, in __init__ self._load_properties() File "C:\Users\...\venv\lib\site-packages\owlready2\namespace.py", line 541, in _load_properties Prop = self.world._get_by_storid(prop_storid) File "C:\Users\...\venv\lib\site-packages\owlready2\namespace.py", line 332, in _get_by_storid return self._get_by_storid2(storid, full_iri, main_type, main_onto) File "C:\Users\...\venv\lib\site-packages\owlready2\namespace.py", line 396, in _get_by_storid2 entity = ObjectPropertyClass(name, tuple(types) or (ObjectProperty,), { "namespace" : namespace, "is_a" : is_a_entities, "storid" : storid } ) File "C:\Users\...\venv\lib\site-packages\owlready2\prop.py", line 51, in __new__ return EntityClass.__new__(MetaClass, name, superclasses, obj_dict) File "C:\Users\...\venv\lib\site-packages\owlready2\entity.py", line 120, in __new__ Class = namespace.world._entities[storid] = _is_a._obj = type.__new__(MetaClass, name, superclasses, obj_dict) TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases I didn't have any errors with earlier versions. Do you know what it could be? Many thanks |
Administrator
|
Hello,
This kind of errors may occurs if you have cycle in class inheritance (this is supported by OWL but not by Python), or if you have an entity that belongs to several incompatible types, such as an entity being both a class and an individual and/or a property. If you provide me an ontology that raises this error, I can investigate it further. Best regards, Jiba |
Administrator
|
Hello again,
I tried the ontology you sent me on ResearchGate. Using both Owlready 0.9 and the development version of Owlready, and SQLite3, everything seems OK and I am unable to reproduce the problem. I the problem still persists, could you also send me a small program that shows the error? Best regards, Jiba |
Hello,
I still get an error when I want to load my database into the World. I sent you minimal sample with created database and ontolgogy about ResearchGate. Thank you very much best regards |
Administrator
|
Hello,
I've investigated the problem (I finally get the error with this version!). The problem was caused by a bug in the World class when backend parameters are given at the World's creation, as you did: my_world = World(filename="rdfstore.db") I fixed the problem in the development version; you can also use the following workaround: my_world = World() my_world.set_backend(filename=rdf_store, exclusive=False) Additionally, in your program, you are creating 2 Worlds that uses the same database. Is it intended? Normally, multiple worlds are used when you want several, isolated, quadstore. Best regards, Jiba |
Hello Jiba,
thanks for your help! I'll use your solution for a first time. The program I sent you was just a simple example. Actually I use default_world only once to create the database. In the following I use a database in a software which I build on django. To get data from or to write data into the database I use your package again... Best regards, Alla |
In reply to this post by Jiba
or not...I can't open my database like that.
I need exactly my_world = World(filename="rdfstore.db") because I don't want to create a database, just load it I'm waiting for the next version... :) Best regards |
Administrator
|
You can safely use set_backend() ; it does not create a new database if it already exists.
Best regards, Jiba |
Free forum by Nabble | Edit this page |