Package org.mindswap.pellet.tableau.completion.queue

Examples of org.mindswap.pellet.tableau.completion.queue.QueueElement


      throw new AssertionError();
    }
  }
 
  protected void addQueueElement(Node node) {
    strategy.getABox().getCompletionQueue().add( new QueueElement( node ), nodeSelector );
  }
View Full Code Here


      // add to effected list
      if( abox.getBranch() >= 0 && PelletOptions.TRACK_BRANCH_EFFECTS )
      abox.getBranchEffectTracker().add( abox.getBranch(), this.getName() );   
   
    //create new queue element
    QueueElement qElement = new QueueElement(this, c);
   
    ATermAppl notC = ATermUtils.negate( c );
    DependencySet clashDepends = depends.get( notC );
    if( clashDepends != null ) {
      ATermAppl positive = ATermUtils.isNot( notC )
View Full Code Here

      }     
    }   
       
    //if we removed an edge the update the queue
    if( removed && PelletOptions.USE_COMPLETION_QUEUE ) {
      abox.getCompletionQueue().add( new QueueElement( this ), NodeSelector.EXISTENTIAL );
      abox.getCompletionQueue().add( new QueueElement( this ), NodeSelector.MIN_NUMBER );
    }
   
    if( modifiedAfterMerge && restored ) {
      for( Entry<ATermAppl, DependencySet> entry : depends.entrySet() ) {
        ATermAppl c = entry.getKey();
View Full Code Here

                        added = true;

                        if( succ instanceof Individual ){
                        Individual succInd = (Individual)succ;
                        succInd.applyNext[Node.MAX] = 0;
                        QueueElement qe =new QueueElement( succInd );
                    abox.getCompletionQueue().add( qe, NodeSelector.MAX_NUMBER );
                    abox.getCompletionQueue().add( qe, NodeSelector.GUESS );
                    abox.getCompletionQueue().add( qe, NodeSelector.CHOOSE );
                      }
                    }
                  }
              }
        }
       
       
        if( added ) {
      applyNext[Node.MAX] = 0;
      QueueElement qe = new QueueElement( this );
      abox.getCompletionQueue().add( qe, NodeSelector.MAX_NUMBER );
      abox.getCompletionQueue().add( qe, NodeSelector.GUESS );
      abox.getCompletionQueue().add( qe, NodeSelector.CHOOSE );
        }
    }
View Full Code Here

   * @param type type of concepts that need to be rechecked
   */
  public void setChanged(int type) {   
    //Check if we need to updated the completion queue
    //Currently we only updated the changed lists for checkDatatypeCount()
    QueueElement newElement = new QueueElement(this);

    //update the datatype queue
    if( (type == Node.ALL || type == Node.MIN) && PelletOptions.USE_COMPLETION_QUEUE )
      abox.getCompletionQueue().add( newElement, NodeSelector.DATATYPE );   

View Full Code Here

    public void reset(boolean onlyApplyTypes) {
      assert onlyApplyTypes || isRootNominal() : "Only asserted individuals can be reset: " + this;
     
    if( PelletOptions.USE_COMPLETION_QUEUE )
      abox.getCompletionQueue().add( new QueueElement( this ) );
   
    if( onlyApplyTypes )
      return;
   
    if( pruned != null )
View Full Code Here

        if( this instanceof Individual ) {
          final Individual ind = (Individual) this;

          if( PelletOptions.USE_COMPLETION_QUEUE ) {
            ind.applyNext[Node.NOM] = 0;
            abox.getCompletionQueue().add( new QueueElement( this ),
                NodeSelector.NOMINAL );
          }

        }
View Full Code Here

    if( removed && PelletOptions.USE_COMPLETION_QUEUE && this instanceof Individual ) {
      Individual ind = (Individual)this;
      ind.applyNext[Node.ATOM] = 0;
      ind.applyNext[Node.OR] = 0;
     
      QueueElement qe = new QueueElement( this );
      abox.getCompletionQueue().add( qe, NodeSelector.DISJUNCTION );
      abox.getCompletionQueue().add( qe, NodeSelector.ATOM );
    }

   
    // with smart restore there is a possibility that we remove a conjunct
    // but not the conjunction. this is the case if conjunct was added before
    // the conjunction but depended on an earlier branch. so we need to make
    // sure all conjunctions are actually applied
    if( PelletOptions.USE_SMART_RESTORE ) {
      for( Iterator<ATermAppl> i = conjunctions.iterator(); i.hasNext(); ) {
        ATermAppl c = i.next();
        DependencySet d = getDepends(c);
        for(ATermList cs = (ATermList) c.getArgument(0); !cs.isEmpty(); cs = cs.getNext()) {
          ATermAppl conj = (ATermAppl) cs.getFirst();
         
          addType(conj, d);
        }           
          }
    }       
       
    for( Iterator<Entry<Node,DependencySet>> i = differents.entrySet().iterator(); i.hasNext(); ) {
      Entry<Node,DependencySet> entry = i.next();
      Node node = entry.getKey();
      DependencySet d = entry.getValue();

      if( d.getBranch() > branch ) {     
        if( log.isLoggable( Level.FINE ) )
          log.fine("RESTORE: " + name + " delete difference " + node);
        i.remove();
        restored = true;
      }     
    }
   
    removed = false;
    for( Iterator<Edge> i = inEdges.iterator(); i.hasNext(); ) {
      Edge e = i.next();
      DependencySet d = e.getDepends();
           
      if( d.getBranch() > branch ) {          
        if( log.isLoggable( Level.FINE ) )
          log.fine("RESTORE: " + name + " delete reverse edge " + e);
               
        if( PelletOptions.USE_INCREMENTAL_CONSISTENCY )
          abox.getIncrementalChangeTracker().addDeletedEdge( e );

        i.remove();
        restored = true;
        removed = true;
      }          
    }
   
    if( removed && PelletOptions.USE_COMPLETION_QUEUE ) {
      QueueElement qe = new QueueElement( this );
      abox.getCompletionQueue().add( qe, NodeSelector.EXISTENTIAL );
      abox.getCompletionQueue().add( qe, NodeSelector.MIN_NUMBER );
    }

    return restored;
View Full Code Here

                   
                    if( PelletOptions.USE_COMPLETION_QUEUE ){
                        added = true;
                        pred.applyNext[Node.MAX] = 0;
                       
                        QueueElement qe = new QueueElement( pred );
                      abox.getCompletionQueue().add( qe, NodeSelector.MAX_NUMBER );
                      abox.getCompletionQueue().add( qe, NodeSelector.GUESS );
                      abox.getCompletionQueue().add( qe, NodeSelector.CHOOSE );
                      abox.getCompletionQueue().add( qe, NodeSelector.UNIVERSAL );      
                    }
                   
                    if( log.isLoggable( Level.FINE ) )
                        log.fine( "RESTORE: " + name + " ADD reverse edge " + edge );
                }
            }
        }
       
        if( added ){
          if( this instanceof Individual ){
            Individual ind = (Individual)this;
            ind.applyNext[Node.MAX] = 0;
            QueueElement qe = new QueueElement( ind );
            abox.getCompletionQueue().add( qe, NodeSelector.MAX_NUMBER );
            abox.getCompletionQueue().add( qe, NodeSelector.GUESS );
            abox.getCompletionQueue().add( qe, NodeSelector.CHOOSE );
            abox.getCompletionQueue().add( qe, NodeSelector.UNIVERSAL );      
          }
View Full Code Here

     
      subj = subj.getSame();
     
      subj.applyNext[Node.SOME] = 0;
      subj.applyNext[Node.MIN] = 0;
      QueueElement qe = new QueueElement( subj );
      abox.getCompletionQueue().add( qe, NodeSelector.EXISTENTIAL );
      abox.getCompletionQueue().add( qe, NodeSelector.MIN_NUMBER );
     
     
      obj = obj.getSame();
      if(obj instanceof Individual){
        Individual objInd = (Individual)obj;
        objInd.applyNext[Node.SOME] = 0;
        objInd.applyNext[Node.MIN] = 0;
        qe = new QueueElement( objInd );
        abox.getCompletionQueue().add( qe, NodeSelector.EXISTENTIAL );
        abox.getCompletionQueue().add( qe, NodeSelector.MIN_NUMBER );
      }               
    }

   
   
   
    //Handle removed types
    Iterator<Map.Entry<Node,Set<ATermAppl>>> it = getRemovedTypeIterator();
    while( it.hasNext() ){
      Node node = it.next().getKey();
     
      if( node.isIndividual() ){
        Individual ind = (Individual)node;

        //readd the conjunctions
        readdConjunctions( ind );
       
        //it could be the case that the type can be added from unfolding, a forAll application on a self loop, or the disjunction rule
        ind.applyNext[Node.ATOM] = 0;
        ind.applyNext[Node.ALL] = 0;
        ind.applyNext[Node.OR] = 0;

        QueueElement qe = new QueueElement( ind );
        abox.getCompletionQueue().add( qe, NodeSelector.ATOM );
        abox.getCompletionQueue().add( qe, NodeSelector.DISJUNCTION );

        //fire the all rule as the is no explicit call to it
        allValuesRule.apply( ind );
       
        //get out edges and check domains, some values and min values
        for( int j = 0; j < ind.getOutEdges().size(); j++ ){
          Edge e = ind.getOutEdges().edgeAt( j );
                       
          if( e.getFrom().isPruned() || e.getTo().isPruned() )
            continue;
                       
              Role pred = e.getRole();
              Node obj = e.getTo();
              DependencySet ds = e.getDepends();
         
              for( ATermAppl domain : pred.getDomains() ) {             
                if( requiredAddType( ind, domain ) ) {
              if( !PelletOptions.USE_TRACING )
                addType( ind, domain, ds.union( DependencySet.EMPTY, abox.doExplanation() ) );
              else        
                addType( ind, domain, ds.union( pred.getExplainDomain( domain ), abox.doExplanation() ) );
                }
              }

              //it could be the case that this label prevented the firing of the all values, some, or min rules of the neighbor
          if( obj instanceof Individual ){
            Individual objInd = (Individual)obj;
            objInd.applyNext[Node.ALL] = 0;
            objInd.applyNext[Node.SOME] = 0;
            objInd.applyNext[Node.MIN] = 0;
            QueueElement qeObj = new QueueElement( objInd );
            abox.getCompletionQueue().add( qeObj, NodeSelector.EXISTENTIAL );
            abox.getCompletionQueue().add( qeObj, NodeSelector.MIN_NUMBER );
           
            //apply the all values rule
            allValuesRule.apply( ind );
          }
        }
      }
       
     
      //get out edges
      for( int j = 0; j < node.getInEdges().size(); j++ ){
        Edge e = node.getInEdges().edgeAt( j );
                     
        if( e.getFrom().isPruned() || e.getTo().isPruned() )
          continue;
       
        Individual subj = e.getFrom();
              Role pred = e.getRole();              
              DependencySet ds = e.getDepends();
       
            for( ATermAppl range : pred.getRanges() ) {
              if( requiredAddType( node, range ) ) {
            if( !PelletOptions.USE_TRACING )
              addType( node, range, ds.union( DependencySet.EMPTY, abox.doExplanation() ) );
            else        
              addType( node, range, ds.union( pred.getExplainRange( range ), abox.doExplanation() ) );
              }
            }

            //it could be the case that this label prevented the firing of the all values, some, or min rules of the neighbor
        subj.applyNext[Node.ALL] = 0;
        subj.applyNext[Node.SOME] = 0;
        subj.applyNext[Node.MIN] = 0;
        QueueElement qe = new QueueElement( subj );
        abox.getCompletionQueue().add( qe, NodeSelector.EXISTENTIAL );
        abox.getCompletionQueue().add( qe, NodeSelector.MIN_NUMBER );

        allValuesRule.apply( subj );
      }
    }
   
   
    //due to unmerging nodes, edges can actually be added
    i = getNewEdgeIterator();
    while( i.hasNext() ){       
      applyPropertyRestrictions( i.next() );       
    }
   
   
    //due to unmerging any node that was pruned could need rules applied to it. This is because these rules
    //would have been originally applied to the node that the pruned node was merged into. 
    for(Iterator<Node> nodeIt = getUnPrunedIterator(); nodeIt.hasNext(); ) {
      Node n = nodeIt.next();
     
      if( n.isIndividual() ) {
        Individual ind = (Individual) n;
       
        //reset type pointers
        for( int j = 0; j < Node.TYPES; j++ )
          ind.applyNext[j] = 0;
       
        //add to all queues
        abox.getCompletionQueue().add( new QueueElement( ind ) );
       
        allValuesRule.apply( ind );
       
        //get out edges
        for( int j = 0; j < ind.getOutEdges().size(); j++ ){
View Full Code Here

TOP

Related Classes of org.mindswap.pellet.tableau.completion.queue.QueueElement

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.