// load new KB
KnowledgeBaseFactory factory = new MyOWLDatabaseKnowledgeBaseFactory();
Project project = Project.createBuildProject(factory, errors);
if(!errors.isEmpty())
throw new IOntologyException(""+errors);
loadNewSources(project, factory);
// load data
project.createDomainKnowledgeBase(factory, errors, true);
if(!errors.isEmpty())
throw new IOntologyException(""+errors);
model = (OWLModel) project.getKnowledgeBase();
// make sure it is named correctly
model.getNamespaceManager().setDefaultNamespace(path+"#");
OWLUtil.renameOntology(model,model.getDefaultOWLOntology(),""+path);
}else{
// load regular ontology
String u = ""+info.get("location");
File f = new File(u);
URI path = (f.exists())?f.toURI():URI.create(u);
// check URI path, if doesn't exist simply use URI as location
if("file".equals(path.getScheme()) && !(new File(path)).exists())
path = getURI();
if(path.toString().endsWith(".pprj")){
Project project = Project.loadProjectFromURI(path,errors);
if(!errors.isEmpty()){
throw new IOntologyException("Problem loading PPRJ file "+path+"\n",getException(errors));
}
model = (OWLModel) project.getKnowledgeBase();
}else {
try{
model = ProtegeOWL.createJenaOWLModelFromURI(""+path);
}catch(Exception ex){
throw new IOntologyException("Problem loading OWL file "+path,ex);
}
}
// set saved location if available
if(info.containsKey("project.file.path"))