OWL API hasKey problem

OWL doesn't allow datatype properties to be inverse functional one. One can assume an inverse functional property as a unique key in database. OWL2 comes with the concept of hasKeys.

Few days ago I tried to parse the owl file having hasKey using Jena. Unfortunately, I found that Jena doesn't have the parser for OWL2 yet. Next, I found that The OWL API supports OWL2. Today, I spent my whole day to use the hasKey feature of OWL2 specification. I tried to parse the owl file using this parser. It parses the owl. But when I print the hasKey axioms after parsing, I get only output in forms of genid* i.e. no property names that are used in hasKey are obtained.  To me it seems like a bug of the parser ... couldn't manage to get the keys :(. If anyone of you let me know how we get the properties specified in hasKey, I will give you a BIG thank you.

The portion of the owl is given below:
<owl:class rdf:about="#Conference">
<rdfs:subclassof rdf:resource="&amp;owl;Thing">
<owl:haskey rdf:parsetype="Collection">
<owl:datatypeproperty rdf:resource="#confName">
<owl:datatypeproperty rdf:resource="#confYear">
<owl:datatypeproperty rdf:resource="#confType">
</owl:datatypeproperty></owl:datatypeproperty>
</owl:datatypeproperty></owl:haskey>
</rdfs:subclassof></owl:class>

Code to print the hasKey :
private void printHasKeyAxioms(OWLOntology ontology, OWLClass cls) {
Set keySet=ontology.getHasKeyAxioms(cls);
System.out.println("\t Total hasKey: "+keySet.size());
if(keySet.size()>0)
{
Iterator
keyIter=keySet.iterator();
while(keyIter.hasNext()){
OWLHasKeyAxiom key=keyIter.next();
Set
exp=key.getPropertyExpressions();
for(OWLPropertyExpression p:exp){
System.out.println("\t - "+p+" ");
}
}
}


Output (for cls=Conference): (Some info. is correct: Conference class has a key which has has three properties ) 
Total hasKey: 1
- <http://leo.inria.fr/publication.owl#genid7>
- <http://leo.inria.fr/publication.owl#genid9>
- <http://leo.inria.fr/publication.owl#genid11>


However, I expect names of properties instead of genid* in the output ...

0 comments:

Post a Comment