Package de.fzi.herakles.commons.reasoner

Examples of de.fzi.herakles.commons.reasoner.ReasonerRegistry


        Properties reasonerProperties = reasoner.getReasonerProperties();
//        double aBoxTBoxRatioLowerBound = Double.parseDouble( reasonerProperties.getProperty( "ABoxTBoxRatioLowerBound", "0" ) );
//        double aBoxTBoxRatioUpperBound = Double.parseDouble( reasonerProperties.getProperty( "ABoxTBoxRatioUpperBound", "1" ) );
       
        FunctionConfiguration functionCfg = HeraklesManager.getFunctionConfiguration();
        ReasonerRegistry registry = HeraklesManager.getReasonerRegistry();
        String reasonerID = registry.getReasonerID(reasoner);
        double aBoxTBoxRatioLowerBound = functionCfg.getLowerBound(reasonerID);
        double aBoxTBoxRatioUpperBound = functionCfg.getUpperBound(reasonerID);
       
        if(logger.isDebugEnabled()){
          logger.debug("The lower bound is: " + aBoxTBoxRatioLowerBound);
View Full Code Here


   * @return the {@link ReasonerThread}s created
   */
  protected void startReasonerThreads( ReasonerThread[] reasonerThreads, Query task )
      throws NoReasonerException {

    ReasonerRegistry registry = HeraklesManager.getReasonerRegistry();

    if( reasonerThreads == null )
      throw new NoReasonerException( "Cannot start any threads, set of reasoners was empty." );

    if(logger.isDebugEnabled()){
      logger.debug( "Created " + reasonerThreads.length + " thread(s)." );
    }

    for( int i = 0; i < reasonerThreads.length; i++ ) {

      ReasonerAdapter reasoner = reasonerThreads[i].getReasoner();
     
      // get statistic listener and send start task information
      StatisticListener listener = null;
      if(registry.hasStatisticListener(reasoner)){
        listener = registry.getStatisticListener(reasoner);
        listener.startTask(task);
      }

      // start thread
      reasonerThreads[i].setTask( task );
View Full Code Here

    initial(ontology);
  }
 
  private void initial(OWLOntology ontology){
    strategy = new BenchmarkingStrategy();
    ReasonerRegistry register = ReasonerRegistry.getInstance();
   
    OWLOntologyManager owlOntologyManager = ontology.getOWLOntologyManager();
   
    register.registerReasoner(owlOntologyManager, "Cel", "127.0.0.1", "8090");
    register.registerReasoner(owlOntologyManager, "Fact", "127.0.0.1", "8091");
    register.registerReasoner(owlOntologyManager, "Hermit", "127.0.0.1", "8092");
    register.registerReasoner(owlOntologyManager, "Pellet", "127.0.0.1", "8093");
    register.registerReasoner(owlOntologyManager, "RacerPro", "127.0.0.1", "8094");
    register.registerReasoner(owlOntologyManager, "Trowl", "127.0.0.1", "8095");
   
    for(ReasonerAdapter reasoner: register.getAsSet(true)){
      reasoner.createReasoner(ontology);
    }
   
    strategy.setRegistry(register);
  }
View Full Code Here

   * get all loaded remote reasoner configuration(only name)
   */
  private void getAllLoadedReasoners(){
    config.loadRemoteReasonerConfiguration();
   
    ReasonerRegistry registry = HeraklesManager.getReasonerRegistry();
    ModelManager modelManager = workspace.getEditorKit().getModelManager();
    if(modelManager instanceof OWLModelManager){
      OWLOntologyManager manager = ((OWLModelManager)modelManager).getOWLOntologyManager();
     
      Set<String> types = config.getRemoteReasonerTypes();
     
      reasoners.clear();
      reasonerTypes.clear();
      reasonerIndex.clear();
      reasonerProperties.clear();
      for(String type: types){
        Set<Integer> indexs = config.getRemoteReasonerIndex(type);
        for(int index: indexs){
          String reasonerID = type + "-" + index;
          // if the reasoner properties exists, the connection test will be skipped
          if(reasonerProperties.containsKey(reasonerID)){
            reasoners.add(reasonerID);
            reasonerTypes.put(reasonerID, type);
            reasonerIndex.put(reasonerID, index);
            continue;
          }
         
          // get the host and rmi name of the reasoner
          String name = config.getRemoteReasonerName(type, index);
          String host = config.getRemoteReasonerHost(type, index);
          String port = config.getRemoteReasonerPort(type, index);

          Properties pro = null;
         
//          try {
            ReasonerAdapter adapter = null;
            boolean isNewReasoner = false;
            if(!registry.containsReasoner(name, host, port)){
              isNewReasoner = true;
              adapter = registry.registerReasoner(manager, name, host, port);
            } else {
              adapter = registry.getReasoner(name, host, port);
            }
            pro = adapter.getReasonerProperties();
           
            // test the reasoner types and correct the configuration
            String proType = pro.getProperty("name").toUpperCase();
            if(!proType.equals(type)){
              config.removeRemoteReasoner(type, index);
              int newIndex = config.addRemoteReasoner(proType, name, host, port);
              reasonerID = proType + "-" + newIndex;
             
              reasonerTypes.put(reasonerID, proType);
              reasonerIndex.put(reasonerID, newIndex);
            } else {
              reasonerTypes.put(reasonerID, type);
              reasonerIndex.put(reasonerID, index);
            }
            reasoners.add(reasonerID);
            if(isNewReasoner){
              registry.setReasonerID(reasonerID, adapter);
              registry.createStatisticListener(adapter);
            }
            // load ontology and classify
//            try {
//              adapter.clearOntologies();
//              Set<OWLOntology> ontologies = new HashSet<OWLOntology>(((OWLModelManager)modelManager).getActiveOntologies());
//              adapter.loadOntologies(ontologies);
//              adapter.classify();
//            } catch (OWLReasonerException e) {
//              e.printStackTrace();
//            }
            reasonerProperties.put(reasonerID, pro);
                       
//          } catch (RemoteException e1) {
//           
//            logger.debug("RMI Remote Exception"+ type + ":" + index);
//          } catch (NotBoundException e1) {
//            config.removeRemoteReasoner(type, index);
//            logger.info("Reasoner " + host + ":" + name + " doesn't exist");
//          }
                   
         
        }
      }
      registry.setBound();
    }
   
   
   
  }
View Full Code Here

    extensions.add("xml");
    Window f = (Window) SwingUtilities.getAncestorOfClass(Window.class, this);
    File file = UIUtil.openFile(f, "load the configuration", extensions)
    if(file != null){
      config.reloadRemoteReasonerConfiguration(file);
      ReasonerRegistry registry = HeraklesManager.getReasonerRegistry();
      registry.clear();
      updateAvailableReasonerPanel();
    }
   
  }
View Full Code Here

         Properties pro = null;
//         try {
          ModelManager modelManager = workspace.getEditorKit().getModelManager();
          if(modelManager instanceof OWLModelManager){
            OWLOntologyManager manager = ((OWLModelManager)modelManager).getOWLOntologyManager();
            ReasonerRegistry registry = HeraklesManager.getReasonerRegistry();
            ReasonerAdapter adapter = null;
            boolean isNewReasoner = false;
            if(!registry.containsReasoner(name, host, port)){
              adapter = registry.registerReasoner(manager, name, host, port);
              pro = adapter.getReasonerProperties();
              isNewReasoner = true;
            } else {
              adapter = registry.getReasoner(name, host, port);
              pro = adapter.getReasonerProperties();
            }
           
            String type = pro.getProperty("name").toUpperCase();
            if(isNewReasoner){
              int index = config.addRemoteReasoner(type, name, host, port);
              String id = type + "-" + index;
              registry.setReasonerID(id, adapter);
              registry.createStatisticListener(adapter);
            }
            // load ontology and classify
//            try {
//              adapter.clearOntologies();
//              Set<OWLOntology> ontologies = new HashSet<OWLOntology>(((OWLModelManager)modelManager).getActiveOntologies());
View Full Code Here

    String port = ports.get(index);
    names.remove(index);
    hosts.remove(index);
    ports.remove(index);
   
    ReasonerRegistry register = HeraklesManager.getReasonerRegistry();
    String reasonerID = register.getReasonerID(register.getReasoner(name, host, port));
   
    if(positiveSoundReasonerID.equalsIgnoreCase(reasonerID))
      positiveSoundReasonerID = "";
    if(negativeSoundReasonerID.equalsIgnoreCase(reasonerID))
      negativeSoundReasonerID = "";
View Full Code Here

//  public OWLReasoner createReasoner(OWLOntologyManager manager) {
  public OWLReasoner createReasoner(OWLOntology ontology) {

    this.logger = Logger.getLogger( ReasonerRegistry.class );
       
    ReasonerRegistry registry = HeraklesManager.getReasonerRegistry();
//    registry.bindRemoteReasoners(manager);
   
    if( registry.size() == 0 )
    try {
      throw new NotBoundException( "No reasoner bound." );
    } catch (NotBoundException e) {
      e.printStackTrace();
    }
View Full Code Here

TOP

Related Classes of de.fzi.herakles.commons.reasoner.ReasonerRegistry

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.