Package de.fzi.herakles.strategy.impl.anytime

Examples of de.fzi.herakles.strategy.impl.anytime.ResultPool


   * @param unsoundIncompleteReasoner the unsound and incomplete reasoner
   */
  @SuppressWarnings("unchecked")
  private void variant(ReasonerAdapter positiveSoundReasoner, ReasonerAdapter negativeSoundReasoner,
      ReasonerAdapter completeReasoner, ReasonerAdapter soundCompleteReasoner, ReasonerAdapter unsoundIncompleteReasoner){
    ResultPool pool = new ResultPool();
    OWLClassExpression des = (OWLClassExpression) this.query.getParams()[0];
    OWLClassExpression negDes = des.getComplementNNF();
   
    Class<?>[] paramTypes = { OWLClassExpression.class, boolean.class };
    Object[] params = { negDes, false };
    Query negQuery;
        try {
            negQuery = QueryFactory.getQuery( "getIndividuals", paramTypes, params );
            int reasonerNumber = 0;
            if(positiveSoundReasoner != null){
                reasonerNumber++;
                positiveSoundReasoner.getReasonerProperties().setProperty("anytime_name", "SoundPositive");
                IReasonerThread soundPositiveThread = new IReasonerThread(pool, positiveSoundReasoner, query);
                soundPositiveThread.start();
            }
           
            if(negativeSoundReasoner != null){
                reasonerNumber++;
                negativeSoundReasoner.getReasonerProperties().setProperty("anytime_name", "SoundNegative");
                IReasonerThread soundNegativeThread = new IReasonerThread(pool, negativeSoundReasoner, negQuery);
                soundNegativeThread.start();
            }
           
            if(completeReasoner != null){
                reasonerNumber++;
                completeReasoner.getReasonerProperties().setProperty("anytime_name", "Complete");
                IReasonerThread completeThread = new IReasonerThread(pool, completeReasoner, query);
                completeThread.start();
            }
           
            if(soundCompleteReasoner != null){
                reasonerNumber++;
                soundCompleteReasoner.getReasonerProperties().setProperty("anytime_name", "SoundAndComplete");
                IReasonerThread soundCompleteThread = new IReasonerThread(pool, soundCompleteReasoner, query);
                soundCompleteThread.start();
            }
           
            if(unsoundIncompleteReasoner != null){
                reasonerNumber++;
                unsoundIncompleteReasoner.getReasonerProperties().setProperty("anytime_name", "UnsoundAndIncomplete");
                IReasonerThread unsoundIncompleteThread = new IReasonerThread(pool, unsoundIncompleteReasoner, query);
                unsoundIncompleteThread.start();
            }

            if(reasonerNumber == 0){
                this.listener.resultCompleted();
                if(logger.isInfoEnabled()){
                  logger.info("No reasoner is assigned!");
                }
                return;
            }
            ArrayList<Object> results = new ArrayList<Object>();

            while (results.size() < reasonerNumber) {
                AnytimeResult result = pool.readData();
                if (result != null) {
                    results.add(result);
                    setData(result.getReasoner(), (Set<OWLNamedIndividual>) result.getAnswer());
                    if(logger.isInfoEnabled()){
                      logger.info(result.getReasoner() + "finished with "
View Full Code Here


    // soundReasoners.iterator().next();
    // screechSoundNegative.getReasonerProperties().setProperty( "name",
    // "ScreechSoundNegative" );
    // ((PropertyConstraintSelector) this.selector).clearConstraints();

    ResultPool pool = new ResultPool();

    IReasonerThread screechCompleteReasoner = new IReasonerThread(pool,
        screechComplete, query);
    IReasonerThread screechSoundPositiveReasoner = new IReasonerThread(
        pool, screechSoundPositive, query);
    // ScreechThread screechSoundNegativeReasoner = new
    // ScreechThread(pool,screechSoundNegative, negQuery );

    screechSoundPositiveReasoner.start();
    screechCompleteReasoner.start();
    // screechSoundNegativeReasoner.start();

    int reasonerNumber = 2;
    ArrayList<Object> results = new ArrayList<Object>();

    while (results.size() < reasonerNumber) {
      AnytimeResult result = pool.readData();
      if (result != null) {
        results.add(result);
        setData(result.getReasoner(), (Set<OWLNamedIndividual>) result
            .getAnswer());
        System.out.println(result.getReasoner() + ": "
View Full Code Here

    }
    return null;
  }

  private void variant2() {
    ResultPool pool = new ResultPool();
    OWLClassExpression des = (OWLClassExpression) this.params[0];
    OWLClassExpression negDes = des.getComplementNNF();
   
    Class<?>[] paramTypes = { OWLClassExpression.class };
    Object[] params = { negDes };
    try {
            Query negQuery = QueryFactory.getQuery( "getIndividuals", paramTypes, params );
        } catch( IllegalArgumentException e ) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch( ClassCastException e ) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch( NoSuchMethodException e ) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
//    negQuery.serialise();

    Set<ReasonerAdapter> availableReasoners = registry.getAsSet(true, true);


    IReasonerThread screechSoundPositive = getReasoner(availableReasoners,
        "remoteScreechNone1", "ScreechSoundPositive", query, pool);
   
    IReasonerThread screechComplete = getReasoner(availableReasoners,
        "remoteScreechAll", "ScreechComplete", query, pool);

    screechSoundPositive.start();
    screechComplete.start();

    int reasonerNumber = 2;
    ArrayList<Object> results = new ArrayList<Object>();

    while (results.size() < reasonerNumber) {
      AnytimeResult result = pool.readData();
      if (result != null) {
        results.add(result);
        setData(result.getReasoner(), (Set<OWLNamedIndividual>) result
            .getAnswer());
        System.out.println(result.getReasoner() + ": "
View Full Code Here

    }
   
 
    Set<ReasonerAdapter> reasonerPool =  registry.getAsSet( true , true);
    // synchronisation pool
    ResultPool pool = new ResultPool();
   
    int reasonerNumber=0;
    for( ReasonerAdapter reasoner : reasonerPool ){
      if(reasoner.equals("remoteAQA")) {
          reasoner.getReasonerProperties().setProperty("name", "AQA" );
      }
      new IReasonerThread(pool,reasoner, query).start();
      reasonerNumber++;
    }


    ArrayList<Object> results = new ArrayList<Object>();
   
    while (results.size() < reasonerNumber) {
      AnytimeResult result = pool.readData();
      if(result!=null) {
        results.add(result);
        setData(result.getReasoner(),(Set<OWLNamedIndividual>)result.getAnswer());
        System.out.println(result.getReasoner() + ": " + ((HashSet)result.getAnswer()).size()+" finished!");
      }
View Full Code Here

TOP

Related Classes of de.fzi.herakles.strategy.impl.anytime.ResultPool

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.