try{
load();
// load ontology
o.load();
//model.getDefaultOWLOntology().addImports((OWLOntology)((POntology)o).getResource());
ImportHelper importHelper = new ImportHelper((JenaOWLModel) model);
// get repository from import ontology
OWLModel imodel = ((POntology)o).getModel();
//Repository rep = imodel.getRepositoryManager().getRepository(o.getURI());
String path = getDescriptor(imodel.getOWLProject().getSettingsMap());
// I am tired, for some reason this property may be reset and
// instead of full path URI it stores file name, well in this case
// lets return location instead
if(!path.contains("/"))
path = o.getLocation();
Repository rep = RepositoryFactory.getInstance().createOntRepository(imodel,path);
if (rep != null) {
model.getRepositoryManager().addProjectRepository(rep);
}
/*
for(Repository r : model.getRepositoryManager().getAllRepositories()){
System.out.println(r.getRepositoryDescriptor()+" : "+r.getOntologies());
}
*/
// create custom prefix
model.getNamespaceManager().setPrefix(o.getNameSpace(),PUtils.createOntologyPrefix(o.getURI()));
// import ontologies
importHelper.addImport(o.getURI());
importHelper.importOntologies();
// don't know what is the function of this???
//model.getNamespaceManager().setPrefix(ProtegeNames.NS, ProtegeNames.PROTEGE_PREFIX);
if(imported == null)
imported = new ArrayList<IOntology>();