[protege-owl] convert OntModel to OWLModel

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[protege-owl] convert OntModel to OWLModel

Selvanayaki M.

hi
     i have two files schema file and individual file.when i want to
retrieve data it shows error Class cast Exception. i am using the
following method.


        String individualuri = "file:///root/Protege_3.1/location.owl";
        String schemauri="file:///root/Protege_3.1/locationschema";
             
        //get the schema model
        File file = new File("/root/Protege_3.1/location.owl");
         
        FileInputStream fileIS = new FileInputStream(file);
       
        OntModel ontmodel =
(ProtegeOWL.createJenaOWLModelFromURI(schemauri)).getOntModel();
        //get the individual model
       OntModel individualmodel =
(ProtegeOWL.createJenaOWLModelFromInputStream(fileIS)).getOntModel();
        //add the models
         OWLModel owlModel=(OWLModel)ontmodel.add(individualmodel);
        //get the class
        OWLNamedClass locationClass =
owlModel.getOWLNamedClass("Country_1");  

this code shows ClassCast Exception in the following line

 OWLModel owlModel=(OWLModel)ontmodel.add(individualmodel);

how to correct this error.is there any way to bind schema and individual
and get the individuals.plz help



Cheers,
Selva


-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html