I have a .owl file generated by Protege. (rdf/xml) I have some individuals and I want to get the value of the DataProperty "hasAge".
<owl:NamedIndividual rdf:about="&untitled-ontology-23;a1a">
<untitled-ontology-23:hasAge rdf:datatype="&xsd;int">12</untitled-ontology-23:hasAge>
<untitled-ontology-23:isPartOf rdf:resource="&untitled-ontology-23;A123" />
<rdf:type rdf:resource="&untitled-ontology-23;a1" />
<rdfs:comment>张三</rdfs:comment>
<rdfs:comment>like</rdfs:comment>
<rdfs:isDefinedBy>mike</rdfs:isDefinedBy>
<rdfs:label>gaga</rdfs:label>
<rdfs:label>zeze</rdfs:label>
</owl:NamedIndividual>
How can I get the value "12" (the value of hasAge) by using Ontology API or other ways?
Thanks for answering!!!
With the Ontology API only a small number of generic properties are directly exposed for individuals. To access your ontology-specific properties you need to access the triples in the graph more directly.
If you don't have the Individual instance for the resource already then it might be simplest to use the lower-level IGraph operations instead like this:
If you do already have the Individual, you can use its Resource property rather than having to create a UriNode for the first parameter:
NOTE As your sample snippet doesn't show what namespace your ontology uses, I have used
http://example.org/as the namespace in the example above - you will need to replace this with the current namespace URI.