owlready

Owlready2 dynamic class generation

人走茶凉 提交于 2020-01-05 07:10:30
问题 I am trying to dynamically create a class for an owlready2 ontology. The documentation suggests the following line of code: NewClass = types.new_class("NewClassName", (SuperClass,), kwds = { "namespace" : my_ontology }) In my case this equals types.new_class("NewClassName", (onto["ParentClass"],), kwds={'namespace' : onto}) However, when I run the above code, I get the following exception: Traceback (most recent call last): (onto[object.get('owl_dataProperty_parent')],), kwds={'namespace' :

Consistency checking using Hermit reasoner in Python for an Ontology

荒凉一梦 提交于 2019-12-08 10:44:29
问题 I am using owlready2 api for python to load an Ontology and check consistency for that ontology using the sync_reasoner() function. But it seems that it is not checking the consistency for the ontology. Although there is an error, it shows nothing! Any idea how can I check consistency of an ontology in python using owlready2 or any other api. here is my small code: from owlready2 import * onto = get_ontology("test.owl") sync_reasoner() and here is the output I am getting: Owlready2 * Running