Acessing Data Property Values

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Acessing Data Property Values

Gopi
This post was updated on .
Hi,

I am working on  OMIM ontology and I want to print values of all properties for a given class. I tried to print the value of prefLabel and MIMTYPE.In ontology, we have both the values of prefLabel and MIMTYPE. However, MIMTYPE is not getting printed. I would like to know how to access the value of MIMTYPE ?

ps: prefLabel is a property from skos ontology which I loaded.
skos = get_ontology("http://www.w3.org/2004/02/skos/core#").load()

This is my code: (j is class)
>>omim = get_ontology("file:///mnt/c/Users/XX/YY/ZZ/OMIM.nt").load()
>>temp = omim.search(GENESYMBOL = "BRCA1")
>>print(temp)
output>>[OMIM.nt.604370, OMIM.nt.113705, OMIM.nt.617883, OMIM.nt.614320]
>>j = temp[0]
>>print(j,j.__class__,j.get_class_properties(),j.prefLabel,j.MIMTYPE)

output>>OMIM.nt.604370 <class 'owlready2.entity.ThingClass'> {OMIM.nt.GENESYMBOL, OMIM.nt.MIMTYPEMEANING, umls.hasSTY, core.prefLabel, core.notation, OMIM.nt.GENELOCUS, OMIM.nt.has_manifestation, OMIM.nt.MIMTYPEVALUE, OMIM.nt.has_inheritance_type, core.altLabel, OMIM.nt.MIMTYPE} ['BREAST-OVARIAN CANCER, FAMILIAL, SUSCEPTIBILITY TO, 1'] []


Regards,
Gopi
Reply | Threaded
Open this post in threaded view
|

Re: Acessing Data Property Values

Jiba
Administrator
Hi,

If the property is defined on a superclass, rather than on the class itself, it won't be listed by get_class_properties(). Instead, you should use INDIRECT_get_class_properties().

If this does not solve the problem, could you send be a small ontology so as I can reproduce the problem?

Jiba