Package org.mindswap.pellet

Examples of org.mindswap.pellet.DependencySet


    // copy the types
    Map<ATermAppl, DependencySet> types = y.getDepends();
    for (Map.Entry<ATermAppl, DependencySet> entry : types.entrySet()) {
      ATermAppl yType = entry.getKey();
      DependencySet finalDS = ds.union(entry.getValue(), abox.doExplanation());
      addType(x, yType, finalDS);
    }

    // for all edges (z, r, y) add an edge (z, r, x)
    EdgeList inEdges = y.getInEdges();
    for (int e = 0; e < inEdges.size(); e++) {
      Edge edge = inEdges.edgeAt(e);

      Individual z = edge.getFrom();
      Role r = edge.getRole();
      DependencySet finalDS = ds.union(edge.getDepends(), abox.doExplanation());

      // if y has a self edge then x should have the same self edge
      if (y.equals(z)) {
        addEdge(x, r, x, finalDS);
      }
      // if z is already a successor of x add the reverse edge
      else if (x.hasSuccessor(z)) {
        // FIXME what if there were no inverses in this expressitivity
        addEdge(x, r.getInverse(), z, finalDS);
      }
      else {
        addEdge(z, r, x, finalDS);
      }

      // only remove the edge from z and keep a copy in y for a
      // possible restore operation in the future
      z.removeEdge(edge);

      // add to effected list of queue
      // if( abox.getBranch() >= 0 && PelletOptions.USE_COMPLETION_QUEUE ) {
      // abox.getCompletionQueue().addEffected( abox.getBranch(), z.getName() );
      // }
      if (abox.getBranch() >= 0 && PelletOptions.TRACK_BRANCH_EFFECTS) {
        abox.getBranchEffectTracker().add(abox.getBranch(), z.getName());
      }

    }

    // for all z such that y != z set x != z
    x.inheritDifferents(y, ds);

    // we want to prune y early due to an implementation issue about literals
    // if y has an outgoing edge to a literal with concrete value
    y.prune(ds);

    // for all edges (y, r, z) where z is a nominal add an edge (x, r, z)
    EdgeList outEdges = y.getOutEdges();
    for (int e = 0; e < outEdges.size(); e++) {
      Edge edge = outEdges.edgeAt(e);
      Node z = edge.getTo();

      if (z.isNominal() && !y.equals(z)) {
        Role r = edge.getRole();
        DependencySet finalDS = ds.union(edge.getDepends(), abox.doExplanation());

        addEdge(x, r, z, finalDS);

        // add to effected list
        if (abox.getBranch() >= 0 && PelletOptions.TRACK_BRANCH_EFFECTS) {
View Full Code Here


    for (int e = 0; e < inEdges.size(); e++) {
      Edge edge = inEdges.edgeAt(e);

      Individual z = edge.getFrom();
      Role r = edge.getRole();
      DependencySet finalDS = ds.union(edge.getDepends(), abox.doExplanation());

      addEdge(z, r, x, finalDS);

      // only remove the edge from z and keep a copy in y for a
      // possible restore operation in the future
View Full Code Here

        obj.getSame();
      if(obj.isPruned())
        continue;

      Role pred = edge.getRole();       
      DependencySet ds = edge.getDepends();

      applyDomainRange(subj, pred, obj, ds);
      if (subj.isPruned() || obj.isPruned()) {
        return;
      }
      applyFunctionality(subj, pred, obj);
      if (subj.isPruned() || obj.isPruned()) {
        return;
      }

      if (pred.isObjectRole()) {
        Individual o = (Individual) obj;
        checkReflexivitySymmetry(subj, pred, o, ds);
        checkReflexivitySymmetry(o, pred.getInverse(), subj, ds);
      }
     
      //if the KB has cardinality restrictions, then we need to apply the guessing rule
          if(abox.getKB().getExpressivity().hasCardinality()){
            //update the queue so the max rule will be fired
              updateQueueAddEdge(subj, pred, obj);
          }
    }
   
    
    //merge again if necessary
    if (!mergeList.isEmpty())
      mergeAll();
   
    //set appropriate branch
    abox.setBranch(abox.getBranches().size() + 1);

    // we will also need to add stuff to the queue in the event of a
    // deletion   
     
    //Handle removed edges
    Iterator<Edge> i = getRemovedEdgeIterator();
    while( i.hasNext() ){       
      Edge e = i.next();
      Individual subj = e.getFrom();
      Node obj = e.getTo();
     
      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;
View Full Code Here

  }
 
  protected void tryBranch() {   
    abox.incrementBranch();
   
    DependencySet ds = getTermDepends();     
    for(; getTryNext() < getTryCount(); tryNext++) {       
         // start with max possibility and decrement at each try 
        int n = minGuess + getTryCount() - getTryNext() - 1;
     
      if( log.isLoggable( Level.FINE ) )
                log.fine(
            "GUES: (" + (getTryNext()+1) + "/" + getTryCount() +
            ") at branch (" + getBranch() + ") to  " + ind +
                    " -> " + r + " -> anon" + (n == 1 ? "" :
                    (abox.getAnonCount() + 1) + " - anon") +
                    (abox.getAnonCount() + n) + " " + ds);           

      ds = ds.union( new DependencySet( getBranch() ), abox.doExplanation() );

            // add the min cardinality restriction just to make early clash detection easier
      strategy.addType( ind, ATermUtils.makeMin(r.getName(), n, qualification), ds);
     
      // add the max cardinality for guess
      strategy.addType( ind, ATermUtils.makeNormalizedMax(r.getName(), n, qualification), ds);
     
      // create n distinct nominal successors
            Individual[] y = new Individual[n];
            for(int c1 = 0; c1 < n; c1++) {
                y[c1] = strategy.createFreshIndividual( null, ds );               

                strategy.addEdge( ind, r, y[c1], ds );
                y[c1] = y[c1].getSame();
                strategy.addType( y[c1], qualification, ds );
                y[c1] = y[c1].getSame();
                for(int c2 = 0; c2 < c1; c2++)
                    y[c1].setDifferent( y[c2], ds );
            }
     
      boolean earlyClash = abox.isClosed();
      if(earlyClash) {
        if( log.isLoggable( Level.FINE ) )
                    log.fine("CLASH: Branch " + getBranch() + " " + abox.getClash() + "!");

        DependencySet clashDepends = abox.getClash().getDepends();
       
        if(clashDepends.contains(getBranch())) {
          // we need a global restore here because the merge operation modified three
          // different nodes and possibly other global variables
          strategy.restore(this);
         
          // global restore sets the branch number to previous value so we need to
View Full Code Here

//        for( int m = 0; m < tryNext; m++ )
//          ruleAtomAsserter
//              .assertAtom( atoms.get( m ), binding, prevDS[m], m >= bodyAtomCount );
//      }

      DependencySet ds = null;
      if( tryNext == tryCount - 1 && !PelletOptions.SATURATE_TABLEAU ) {
        ds = getTermDepends();

        for( int m = 0; m < tryNext; m++ )
          ds = ds.union( prevDS[m], abox.doExplanation() );

        // CHW - added for incremental reasoning and rollback through
        // deletions
        if( PelletOptions.USE_INCREMENTAL_DELETION )
          ds.setExplain( getTermDepends().getExplain() );
        else
          ds.remove( getBranch() );
      }
      else {
        // CHW - Changed for tracing purposes
        if( PelletOptions.USE_INCREMENTAL_DELETION )
          ds = getTermDepends().union( new DependencySet( getBranch() ),
              abox.doExplanation() );
        else
          ds = new DependencySet( getBranch() );
      }

      if( log.isLoggable( Level.FINE ) )
        log.fine( "RULE: Branch (" + getBranch() + ") try (" + (tryNext + 1) + "/"
            + tryCount + ") " + atom + " " + binding + " " + atoms + " " + ds );

      ruleAtomAsserter.assertAtom( atom, binding, ds, tryNext < bodyAtomCount, abox, strategy );

      // if there is a clash
      if( abox.isClosed() ) {
        DependencySet clashDepends = abox.getClash().getDepends();

        if( log.isLoggable( Level.FINE ) )
          log.fine( "CLASH: Branch " + getBranch() + " "
              + Clash.unexplained( null, clashDepends ) + "!" );

        // if( PelletOptions.USE_DISJUNCT_SORTING ) {
        // if( stats == null ) {
        // stats = new int[disj.length];
        // for( int i = 0; i < disj.length; i++ )
        // stats[i] = 0;
        // abox.getDisjBranchStats().put( atoms, stats );
        // }
        // stats[order[tryNext]]++;
        // }

        // do not restore if we do not have any more branches to try.
        // after
        // backtrack the correct branch will restore it anyway. more
        // importantly restore clears the clash info causing exceptions
        if( tryNext < tryCount - 1 && clashDepends.contains( getBranch() ) ) {
          AtomIObject obj = (AtomIObject) (atom instanceof UnaryAtom
            ? ((UnaryAtom) atom).getArgument()
            : ((BinaryAtom) atom).getArgument1());
          Individual ind = binding.get( obj );

          strategy.restoreLocal( ind, this );

          // global restore sets the branch number to previous
          // value so we need to
          // increment it again
          abox.incrementBranch();

          setLastClash( clashDepends );
        }
        else {

          abox.setClash( Clash.unexplained( null, clashDepends.union( ds, abox
              .doExplanation() ) ) );

          // CHW - added for inc reasoning
          if( PelletOptions.USE_INCREMENTAL_DELETION )
            abox.getKB().getDependencyIndex().addCloseBranchDependency( this,
View Full Code Here

    int otherRoot = 1 - root;
    for( Entry<ATermAppl, DependencySet> entry : roots[root].getDepends().entrySet() ) {
      ATermAppl c = entry.getKey();
      ATermAppl notC = ATermUtils.negate( c );

      DependencySet ds2 = roots[otherRoot].getDepends().get( notC );
      if( ds2 != null ) {
        DependencySet ds1 = entry.getValue();
        boolean allIndependent = isIndependent && ds1.isIndependent() && ds2.isIndependent();
        if( allIndependent ) {
          if( log.isLoggable( Level.FINE ) )
            log.fine( roots[root] + " has " + c + " " + roots[otherRoot]
                + " has negation " + ds1.max() + " " + ds2.max() );
          return Bool.FALSE;
        }
        else {
          if( log.isLoggable( Level.FINE ) )
            log.fine( roots[root] + " has " + c + " " + roots[otherRoot]
                + " has negation " + ds1.max() + " " + ds2.max() );
          result = Bool.UNKNOWN;
        }
      }
    }

    // if there is a suspicion there is no way to fix it later so return now
    if( result != null )
      return result;

    for( root = 0; root < 2; root++ ) {
      otherRoot = 1 - root;

      for( ATermAppl c : roots[root].getDepends().keySet() ) {
        if( ATermUtils.isPrimitive( c ) ) {
          result = checkBinaryClash( kb, c, roots[root], roots[otherRoot] );
        }
        else if( ATermUtils.isAllValues( c ) ) {
          result = checkAllValuesClash( kb, c, roots[root], roots[otherRoot] );
        }
        else if( ATermUtils.isNot( c ) ) {
          ATermAppl arg = (ATermAppl) c.getArgument( 0 );
          if( ATermUtils.isMin( arg ) ) {       
            result = checkMaxClash( kb, c, roots[root], roots[otherRoot] );
          }
          else if( ATermUtils.isSelf( arg ) ) {
            result = checkSelfClash( kb, arg, roots[root], roots[otherRoot] );
          }
        }

        if( result != null )
          return result;
      }
    }
   
    boolean bothNamedIndividuals = (root1 instanceof Individual && root2 instanceof Individual);

    if( kb.getExpressivity().hasFunctionality() || kb.getExpressivity().hasFunctionalityD() ) {
      root = (roots[0].getOutEdges().size() + roots[0].getInEdges().size()) < (roots[1]
          .getOutEdges().size() + roots[1].getInEdges().size())
        ? 0
        : 1;
      otherRoot = 1 - root;

      if( bothNamedIndividuals )
        result = checkFunctionalityClashWithDifferents( (Individual) roots[root],
            (Individual) roots[otherRoot] );
      else
        result = checkFunctionalityClash( roots[root], roots[otherRoot] );
      if( result != null )
        return result;
    }

    if( bothNamedIndividuals ) {
      Individual ind1 = (Individual) root1;
      Individual ind2 = (Individual) root2;
      DependencySet ds = ind1.getDifferenceDependency( ind2 );
      if( ds != null ) {
        return ds.isIndependent()
          ? Bool.FALSE
          : Bool.UNKNOWN;
      }
     
      for (Edge edge : ind1.getOutEdges()) {
View Full Code Here

      for( Iterator<Role> j = functionalSupers.iterator(); j.hasNext(); ) {
        Role supRole = j.next();

        EdgeList otherEdges = otherRoot.getRNeighborEdges( supRole );
        for( Edge otherEdge : otherEdges ) {
          DependencySet ds = edge.getTo().getDifferenceDependency( otherEdge.getNeighbor( otherRoot ) );
          if( log.isLoggable( Level.FINE ) )
            log.fine( root + " and " + otherRoot + " has " + supRole + " " + edge + " " + otherEdge );
          if( ds != null && ds.isIndependent() )
            return Bool.FALSE;
          result = Bool.UNKNOWN;
        }
      }
    }

    for( Edge edge : root.getInEdges() ) {
      Role role = edge.getRole().getInverse();

      if( role == null || !role.isFunctional() )
        continue;

      Set<Role> functionalSupers = role.getFunctionalSupers();
      for( Iterator<Role> j = functionalSupers.iterator(); j.hasNext(); ) {
        Role supRole = j.next();

        EdgeList otherEdges = otherRoot.getRNeighborEdges( supRole );
        for( Edge otherEdge : otherEdges ) {
          DependencySet ds = edge.getTo().getDifferenceDependency( otherEdge.getNeighbor( otherRoot ) );
          if( log.isLoggable( Level.FINE ) )
            log.fine( root + " and " + otherRoot + " has " + supRole + " " + edge + " " + otherEdge );
          if( ds != null && ds.isIndependent() )
            return Bool.FALSE;
          result = Bool.UNKNOWN;
        }
      }
    }
View Full Code Here

      abox.getCompletionQueue().add( qElement, NodeSelector.MAX_NUMBER );
      abox.getCompletionQueue().add( qElement, NodeSelector.CHOOSE );
    }
   
   
    DependencySet ds = getTermDepends();     
    for(; getTryNext() < getTryCount(); tryNext++) {   
      this.abox.getKB().timers.mainTimer.check();
      if(PelletOptions.USE_SEMANTIC_BRANCHING) {
        for(int m = 0; m < getTryNext(); m++) {
          NodeMerge nm = mergePairs.get(m);     
          Node y = abox.getNode(nm.getSource()).getSame();
          Node z = abox.getNode(nm.getTarget()).getSame();
          strategy.setDifferent(y, z, prevDS[m]);
          //strategy.addType( y, ATermUtils.makeNot( ATermUtils.makeValue( z.getName() ) ), prevDS[m] );
        }
      }
     
      NodeMerge nm = mergePairs.get(getTryNext());     
      Node y = abox.getNode(nm.getSource()).getSame();
      Node z = abox.getNode(nm.getTarget()).getSame();
           
      if( log.isLoggable( Level.FINE ) )
                log.fine(
            "MAX : (" + (getTryNext()+1) + "/" + mergePairs.size() +
            ") at branch (" + getBranch() + ") to  " + ind +
            " for prop " + r + " qualification " + qualification +
            " merge " + y + " -> " + z + " " + ds);           
     
      ds = ds.union(new DependencySet(getBranch()), abox.doExplanation());
     
      // max cardinality merge also depends on all the edges
      // between the individual that has the cardinality and
      // nodes that are going to be merged
      EdgeList rNeighbors = ind.getRNeighborEdges(r);
      boolean yEdge = false, zEdge = false;
      for( Edge edge : rNeighbors ) {
        Node neighbor = edge.getNeighbor( ind );
       
        if( neighbor.equals( y ) ) {
          ds = ds.union( edge.getDepends(), abox.doExplanation() );
          yEdge = true;
        }
        else if( neighbor.equals( z ) ) {
          ds = ds.union( edge.getDepends(), abox.doExplanation() );
          zEdge = true;
        }
      }
     
      // if there is no edge coming into the node that is
      // going to be merged then it is not possible that
      // they are affected by the cardinality restriction
      // just die instead of possibly unsound results
      if(!yEdge || !zEdge)
          throw new InternalReasonerException(
              "An error occurred related to the max cardinality restriction about "  + r);
     
      // if the neighbor nodes did not have the qualification
      // in their type list they would have not been affected
      // by the cardinality restriction. so this merges depends
      // on their types
      ds = ds.union( y.getDepends( qualification ), abox.doExplanation() );
      ds = ds.union( z.getDepends( qualification ), abox.doExplanation() );
     
            // if there were other merges based on the exact same cardinality
      // restriction then this merge depends on them, too (we wouldn't
      // have to merge these two nodes if the previous merge did not
      // eliminate some other possibilities)
          for( int b = abox.getBranches().size() -2; b >=0; b-- ) {
            Branch branch = abox.getBranches().get( b );
            if( branch instanceof MaxBranch ) {
              MaxBranch prevBranch = (MaxBranch) branch;
              if( prevBranch.ind.equals( ind )
                && prevBranch.r.equals( r )
                && prevBranch.qualification.equals( qualification ) ) {
                ds.add( prevBranch.getBranch() );
              }
              else {
                break;
              }
            }
            else
              break;
          }
     
      strategy.mergeTo(y, z, ds);

//      abox.validate();
     
      boolean earlyClash = abox.isClosed();
      if(earlyClash) {
        if( log.isLoggable( Level.FINE ) )
                    log.fine("CLASH: Branch " + getBranch() + " " + abox.getClash() + "!");

        DependencySet clashDepends = abox.getClash().getDepends();
       
        if(clashDepends.contains(getBranch())) {
          // we need a global restore here because the merge operation modified three
          // different nodes and possibly other global variables
          strategy.restore(this);
         
          // global restore sets the branch number to previous value so we need to
View Full Code Here

      : cNode.getOutEdges();
    for( Edge edge : edges ) {
      Role role = checkInverses
        ? edge.getRole().getInverse()
        : edge.getRole();
      DependencySet ds = edge.getDepends();

      if( !ds.isIndependent() )
        continue;

      boolean found = false;
      ATermAppl val = checkInverses
        ? edge.getFromName()
View Full Code Here

      if(PelletOptions.USE_SEMANTIC_BRANCHING) {
        for(int m = 0; m < getTryNext(); m++)
          strategy.addType(node, ATermUtils.negate( disj[m] ), prevDS[m]);
      }

      DependencySet ds = null;
      if(getTryNext() == getTryCount() - 1 && !PelletOptions.SATURATE_TABLEAU) {
        ds = getTermDepends();
        for(int m = 0; m < getTryNext(); m++)
          ds = ds.union(prevDS[m], abox.doExplanation());

        //CHW - added for incremental reasoning and rollback through deletions
        if(PelletOptions.USE_INCREMENTAL_DELETION)
          ds.setExplain( getTermDepends().getExplain() );
        else
          ds.remove(getBranch());
      }
      else {
        //CHW - Changed for tracing purposes
        if(PelletOptions.USE_INCREMENTAL_DELETION)
          ds = getTermDepends().union(new DependencySet(getBranch()), abox.doExplanation());
        else{
          ds = new DependencySet(getBranch());
          //added for tracing
          Set<ATermAppl> explain = new HashSet<ATermAppl>();
          explain.addAll(getTermDepends().getExplain());
          ds.setExplain( explain );                     
        }
            }
           
      if( log.isLoggable( Level.FINE ) )
                log.fine( getDebugMsg() );   
     
      ATermAppl notD = ATermUtils.negate(d);
      DependencySet clashDepends = PelletOptions.SATURATE_TABLEAU ? null : node.getDepends(notD);
      if(clashDepends == null) {
          strategy.addType(node, d, ds);
        // we may still find a clash if concept is allValuesFrom
        // and there are some conflicting edges
        if(abox.isClosed())
          clashDepends = abox.getClash().getDepends();
      }
      else {
          clashDepends = clashDepends.union(ds, abox.doExplanation());
      }
     
      // if there is a clash
      if(clashDepends != null) {       
        if( log.isLoggable( Level.FINE ) ) {
          Clash clash = abox.isClosed() ? abox.getClash() : Clash.atomic(node, clashDepends, d);
                    log.fine("CLASH: Branch " + getBranch() + " " + clash + "!" + " " + clashDepends.getExplain());
        }
       
        if( PelletOptions.USE_DISJUNCT_SORTING ) {
            if(stats == null) {
                stats = new int[disj.length];
                for(int i = 0; i < disj.length; i++)
                    stats[i] = 0;
                abox.getDisjBranchStats().put(disjunction, stats);
            }
          stats[order[getTryNext()]]++;
        }
       
        // do not restore if we do not have any more branches to try. after
        // backtrack the correct branch will restore it anyway. more
        // importantly restore clears the clash info causing exceptions
        if(getTryNext() < getTryCount() - 1 && clashDepends.contains(getBranch())) {
            // do not restore if we find the problem without adding the concepts
            if(abox.isClosed()) {
              if( node.isLiteral() ) {
                abox.setClash( null );
               
                node.restore( branch );                             
              }
              else {
              // restoring a single node is not enough here because one of the disjuncts could be an
                // all(r,C) that changed the r-neighbors
                  strategy.restoreLocal((Individual) node, this);
             
              // global restore sets the branch number to previous value so we need to
              // increment it again
              abox.incrementBranch();
              }
            }
         
                    setLastClash( clashDepends );
        }
        else {
            // set the clash only if we are returning from the function
          if(abox.doExplanation()) {
              ATermAppl positive = (ATermUtils.isNot(notD) ? d : notD);
              abox.setClash(Clash.atomic(node, clashDepends.union(ds, abox.doExplanation()), positive));
          }
          else
              abox.setClash(Clash.atomic(node, clashDepends.union(ds, abox.doExplanation())));

          //CHW - added for inc reasoning
          if(PelletOptions.USE_INCREMENTAL_DELETION)
            abox.getKB().getDependencyIndex().addCloseBranchDependency(this, abox.getClash().getDepends());
View Full Code Here

TOP

Related Classes of org.mindswap.pellet.DependencySet

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.