|
Hello,
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
Joseph
code:
def dynamically_add_attributes(iri, output, input_list, class_one_column, class_two_column):
"""dynamically add axioms between classes"""
onto = get_ontology(iri).load()
with onto:
for i in input_list[1:]:
i[class_one_column].is_a.append(has_attribute.some(i[class_two_column]))
onto.save(file=output)
|