I created the classes in my ontology dynamically out of a csv-file. Now I want to add a relation between two classes dynamically out of my csv with the "my_class.is_a.append(my_prop.some(other_class))"-syntax.
"has_attribute" is an Object Property I did manually.
I tried the following but only got an error, that the string I got out of the list has no attribute "is_a". I also tried referencing the string to the onto with onto.i[class_one_colum] but only got " 'NoneType' object is not subscriptable"
I hope someone can help me, thanks in advance
def dynamically_add_attributes(iri, output, input_list, class_one_column, class_two_column):
"""dynamically add axioms between classes"""
onto = get_ontology(iri).load()
for i in input_list[1:]:
I think there is some problem in you code example. If the inputs list contains class name, you should use onto[class_one_colum] to obtain the class object, not onto.i[class_one_colum] nor i[class_one_colum].