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

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


        //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


    for (int j = 0; j < size; j++) {
      ATermAppl c = types.get(j);
      ATermAppl max = (ATermAppl) c.getArgument(0);
      Role r = abox.getRole(max.getArgument(0));
      if (pred.isSubRoleOf(r)) {
        QueueElement newElement = new QueueElement(subj, c);
        abox.getCompletionQueue().add(newElement, NodeSelector.MAX_NUMBER);
        abox.getCompletionQueue().add(newElement, NodeSelector.CHOOSE);
      }
    }

    // if the predicate has an inverse or is inversefunctional and the obj
    // is an individual, then add the object to the list.
    if (obj instanceof Individual) {
      types = ((Individual) obj).getTypes(Node.MAX);
      size = types.size();
      for (int j = 0; j < size; j++) {
        ATermAppl c = types.get(j);
        ATermAppl max = (ATermAppl) c.getArgument(0);
        Role r = abox.getRole(max.getArgument(0));

        Role invR = pred.getInverse();

        if (invR != null) {
          if (invR.isSubRoleOf(r)) {
            QueueElement newElement = new QueueElement(obj, c);
            abox.getCompletionQueue().add(newElement, NodeSelector.MAX_NUMBER);
            abox.getCompletionQueue().add(newElement, NodeSelector.CHOOSE);
          }
        }
      }
View Full Code Here

    ATermAppl maxCon = ATermUtils.makeMax(this.r.getName(), this.n, this.qualification);
    //normalize the label
    maxCon = ATermUtils.normalize(maxCon);
   
    if( PelletOptions.USE_COMPLETION_QUEUE ) {
      QueueElement qElement = new QueueElement( ind, maxCon );
      abox.getCompletionQueue().add( qElement, NodeSelector.MAX_NUMBER );
      abox.getCompletionQueue().add( qElement, 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

    if( node != null ) {
      if( node instanceof Literal ) {

        if( ((Literal) node).getValue() == null && PelletOptions.USE_COMPLETION_QUEUE ) {
          // added for completion queue
          QueueElement newElement = new QueueElement( node );
          this.completionQueue.add( newElement, NodeSelector.LITERAL );
        }

        if( getBranch() >= 0 && PelletOptions.TRACK_BRANCH_EFFECTS ) {
                  branchEffects.add( getBranch(), node.getName() );
                }

        return (Literal) node;
      }
            else {
              throw new InternalReasonerException(
            "Same term refers to both a literal and an individual: " + name );
            }
    }

    int remember = branch;
    setBranch( DependencySet.NO_BRANCH );
   
    /*
     * TODO Investigate the effects of storing asserted value
     * The input version of the literal is not discarded, only the canonical
     * versions are stored in the literal. This may cause problems in cases
     * where the same value space object is presented in the data in multiple
     * forms.
     */
    Literal lit = new Literal( name, dataValue, this, ds );
    lit.addType( ATermUtils.TOP_LIT, ds );
   
    setBranch( remember );
   
    nodes.put( name, lit );
    nodeList.add( name );

    if( lit.getValue() == null && PelletOptions.USE_COMPLETION_QUEUE ) {
      // added for completion queue
      QueueElement newElement = new QueueElement( lit );
      this.completionQueue.add( newElement, NodeSelector.LITERAL );
    }

    if( getBranch() >= 0 && PelletOptions.TRACK_BRANCH_EFFECTS ) {
          branchEffects.add( getBranch(), lit.getName() );
View Full Code Here

    for (int j = 0; j < size; j++) {
      ATermAppl c = types.get(j);
      ATermAppl max = (ATermAppl) c.getArgument(0);
      Role r = abox.getRole(max.getArgument(0));
      if (pred.isSubRoleOf(r)) {
        QueueElement newElement = new QueueElement(subj, c);
        abox.getCompletionQueue().add(newElement, NodeSelector.MAX_NUMBER);
        abox.getCompletionQueue().add(newElement, NodeSelector.CHOOSE);
      }
    }

    // if the predicate has an inverse or is inversefunctional and the obj
    // is an individual, then add the object to the list.
    if (obj instanceof Individual) {
      types = ((Individual) obj).getTypes(Node.MAX);
      size = types.size();
      for (int j = 0; j < size; j++) {
        ATermAppl c = types.get(j);
        ATermAppl max = (ATermAppl) c.getArgument(0);
        Role r = abox.getRole(max.getArgument(0));

        Role invR = pred.getInverse();

        if (invR != null) {
          if (invR.isSubRoleOf(r)) {
            QueueElement newElement = new QueueElement(obj, c);
            abox.getCompletionQueue().add(newElement, NodeSelector.MAX_NUMBER);
            abox.getCompletionQueue().add(newElement, NodeSelector.CHOOSE);
          }
        }
      }
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.