Package edu.pitt.ontology

Examples of edu.pitt.ontology.IOntologyException


      reasoner.initialize();
      //reasoner.setURL("http://localhost:8081");
      taskListener = new TaskListener();
      reasoner.setReasonerTaskListener(taskListener);
    }catch(Exception ex){
      throw new IOntologyException("Problem Initializing Reasoner ("+reasonerClass+")",ex);
    }
  }
View Full Code Here


    POntology ont = null;
    if(uri.toString().endsWith(".pprj")){
      ArrayList errors = new ArrayList();
      Project project = Project.loadProjectFromURI(uri,errors);
      if(!errors.isEmpty()){
        throw new IOntologyException("Problem loading PPRJ file "+uri,getException(errors));
      }
      ont =  new POntology((OWLModel) project.getKnowledgeBase());
    }else {
      try{
        ont = new POntology(ProtegeOWL.createJenaOWLModelFromURI(""+uri));
      }catch(Exception ex){
        throw new IOntologyException("Problem loading OWL file "+uri,ex);
      }
    }
   
    // set some meta data
    if(ont != null){
View Full Code Here

      // set project save path
      model.getProject().setProjectFilePath((new File(dir,name+".pprj")).getAbsolutePath());
      model.getOWLProject().getSettingsMap().setString("owl_file_name",filePath);
      return new POntology(model);
    }catch(Exception ex){
      throw new IOntologyException("problem creating new ontology "+path,ex);
    }
  }
View Full Code Here

      }
      */
     
      return new POntology(model);
    }catch(Exception ex){
      throw new IOntologyException("problem creating new ontology "+path,ex);
    }
  }
View Full Code Here

    // check if this is an pprj file
    if(uri.getName().endsWith(".pprj")){
      ArrayList errors = new ArrayList();
      Project project = Project.loadProjectFromFile(uri.getAbsolutePath(),errors);
      if(!errors.isEmpty()){
        throw new IOntologyException("Could not open "+uri,getException(errors));
      }
      return new POntology((OWLModel) project.getKnowledgeBase());
    }
    return loadOntology(uri.toURI());
  }
View Full Code Here

      imported.add(o);
     
      // set prefix somewhere????
      prefix = null;
    }catch(Exception ex){
      throw new IOntologyException("failed to import "+o.getURI(),ex);
   
  }
View Full Code Here

    }
    try{
      JenaOWLModel.saveModel(out,model.getOntModel(),lang,getNameSpace(),""+getURI());
      //model.getOntModel().write(out,lang,""+getURI());
    }catch(Exception ex){
      throw new IOntologyException("Problem writing protege",ex);
    }
  }
View Full Code Here

    load();
    model.flushCache();
    ArrayList list = new ArrayList();
    model.getProject().save(list);
    if(!list.isEmpty()){
      throw new IOntologyException("Problem saving "+getURI(),getException(list));
    }
    pcs.firePropertyChange(ONTOLOGY_SAVED_EVENT,null,null);
  }
View Full Code Here

     
      // 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"))
View Full Code Here

        if (currentProject.hasCompleteSources()) {
          ArrayList errors = new ArrayList();
            currentProject.setIsReadonly(false);
            currentProject.save(errors);
            if(!errors.isEmpty())
              throw new IOntologyException("problem saving "+getURI(),getException(errors));      
        }
       
        // save included projects
        /*
    IOntology [] onts = getImportedOntologies();
View Full Code Here

TOP

Related Classes of edu.pitt.ontology.IOntologyException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.