Re: Extracting properties with different namespaces
Posted by
Jiba on
URL: http://owlready.306.s1.nabble.com/Extracting-properties-with-different-namespaces-tp963p973.html
Hi,
The problem is that the "hasRelatedSynonym" property is not defined. You need to define it (as a DataProperty or AnnotationProperty), either in your ontology, in a separate ontology (imported by your ontology or loaded in Python) or directly in Python.
If you don't want to modify the existant ontology, you can create the property directly in Python as follows:
with get_ontology("
http://temporary.org/onto.owl"):
class hasRelatedSynonym(AnnotationProperty): pass
for i in onto.classes():
label1 = i.label[0]
synonyms1 ='; '.join(i.hasRelatedSynonym)
attributes = '; '.join(filter(None, [label1, synonyms1]))
print(attributes)
Jiba