From: Phoenix Ex <pho...@gm...> - 2009-04-19 22:27:01
|
Hi everyone! I've created with Protege4 an ontology with classes A and B. Also, i have an object property "hasB" with domain A and range B. Class A has the following superclass "hasB some B". Using OWL API that comes with Protege4 (version 2.2.1.1090), i've been trying to create a java code that gets all object properties of a given class. In this code, i open the ontology file that Protege4 had created. Considering the example above, i would like to access the objectProperty "hasB" from class A. The code: OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); URI physicalURI = URI.create("file:/C:/example.owl"); OWLOntology ontology = manager.loadOntologyFromPhysicalURI(physicalURI); OWLDataFactory factory = manager.getOWLDataFactory(); OWLClass classA = factory.getOWLClass(URI.create(ontology.getURI() + "#A")); for(OWLDescription owlDescription: classA.getSuperClasses(ontology)){ //How to retrieve from "classA.getSuperClasses(ontology)" the object property "hasB"??? } I tried to iterate over "classA.getSuperClasses(ontology)", expecting to have access to "hasB" object property... but this method returns a set of OWLDescription. With this interface i can't have access to the property. Does anyone have overcome this problem? Thanks! Vitor |