Reputation: 1
I'm using the python owlready2. In working with object properties, I was successful to get most of the standard annotation via dot attributes, like label, isDefinedBy, deprecated, iri, is_a, domain and range, inverse_property, equivalent_to, etc. with the exception of comments, it always returns an empty list even though the entity does have a rdfs:comment construct. I hope to be able to find a workaround to get the original asserted comment.
>>> print(property.name)
actsFor
>>> print(property.label)
[locstr('acts for', 'en'), locstr('agisce per', 'it')]
>>> print(property.comment)
[]
while the owl snippet for the object property does include a comment:
<!-- http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#actsFor -->
<owl:ObjectProperty rdf:about="http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#actsFor">
<rdfs:subPropertyOf rdf:resource="http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#associatedWith"/>
<owl:inverseOf rdf:resource="http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#actsThrough"/>
<rdfs:domain rdf:resource="http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Agent"/>
<rdfs:range rdf:resource="http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#SocialAgent"/>
<rdfs:comment>The relation holding between any Agent, and a SocialAgent. In principle, a SocialAgent requires at least one PhysicalAgent in order to act, but this dependency can be 'delegated'; e.g. a university can be acted for by a department, which on its turm is acted for by physical agents.</rdfs:comment>
<rdfs:isDefinedBy rdf:resource="http://www.ontologydesignpatterns.org/ont/dul/DUL.owl"/>
<rdfs:label xml:lang="en">acts for</rdfs:label>
<rdfs:label xml:lang="it">agisce per</rdfs:label>
</owl:ObjectProperty>
I tried print(property.comment), and expect to see the originally asserted comment.
Upvotes: 0
Views: 13
Reputation: 1
From what I know, you can use :
print(instance.comment)
-> to have a list of the rdfs:comment
for property in instance.get_properties():
for value in property[instance]:
print(value)
-> to get all the values of all the properties
Upvotes: 0