Hi there,
I have two ontologies in OWL. One is a big picture place holder (main ontology)
and the other is something like a sub-ontology that needs to be appended under
one of the classes in the main ontology (all that exists in that sub-ontology
needs to go under a class in the main ontology, as a subClassOf).
I have access to both ontologies programmatically. My question is: how can I
add the sub-ontology under a class of the main ontology? I have tried this (in
c#.Net):
//ontModel_main comes as a referennce arg. in the function
OntModelSpec oms = new OntModelSpec(OntModelSpec.OWL_MEM);
oms.setDocumentManager(OntDocumentManager.getInstance());
OntModel ontModel_sub = ModelFactory.createOntologyModel(oms);
ontModel_sub = (OntModel)ontModel_sub.read("file:" +
"sub_ont_file.owl");
OntClass ont_sub_class = ontModel_sub.getOntClass(ns + "#" +
"classname");//this is the parent class of all other classes in the sub ontology
ontModel_main.getOntClass(ns + "#" + "classname under which sub
ontology is supposed to be added").addSubClass(ont_sub_class);
This does not seem to work. Any ideas?
Thanks,
B Ofoghi