Package org.mindswap.pellet

Examples of org.mindswap.pellet.DependencySet


    if (neighbors.size() <= 1) {
      return;// continue;
    }

    Individual head = null;
    DependencySet headDS = null;
    // find a nominal node to use as the head
    for (int edgeIndex = 0; edgeIndex < edges.size(); edgeIndex++) {
      Edge edge = edges.edgeAt(edgeIndex);
      Individual ind = edge.getFrom();
View Full Code Here


    while (!merging && !mergeList.isEmpty() && !abox.isClosed()) {
      NodeMerge merge = mergeList.remove(0);

      Node y = abox.getNode(merge.getSource());
      Node z = abox.getNode(merge.getTarget());
      DependencySet ds = merge.getDepends();

      if (y.isMerged()) {
        ds = ds.union(y.getMergeDependency(true), abox.doExplanation());
        y = y.getSame();
      }

      if (z.isMerged()) {
        ds = ds.union(z.getMergeDependency(true), abox.doExplanation());
        z = z.getSame();
      }

      if (y.isPruned() || z.isPruned()) {
        continue;
View Full Code Here

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

    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

      : 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

    return isFwd ? isBwd ? EdgeDirection.BOTH : EdgeDirection.FORWARD : isBwd ? EdgeDirection.BACKWARD : null;
  }
 
  protected WME createEdge(Edge edge, EdgeDirection dir) {
    if (doExplanation) {
      DependencySet ds = (dir == EdgeDirection.FORWARD) ? role.getExplainSub(edge.getRole().getName()) : role.getInverse().getExplainSub(edge.getRole().getName());
      if (!ds.getExplain().isEmpty()) {
        return WME.createEdge(new DefaultEdge(edge.getRole(), edge.getFrom(), edge.getTo(), edge.getDepends().union(ds, doExplanation)), dir);
      }
    }
   
    return WME.createEdge(edge, dir);
View Full Code Here

          log.finer( "Absorb into " + ind + " with inverse of " + p + " for " + c );
       
        tbox.getAbsorbedAxioms().addAll( explanation );

        kb.addIndividual( ind );
        kb.addType( ind, allInvPC, new DependencySet( explanation ) );

        return true;
      }
    }
View Full Code Here

    if( log.isLoggable( Level.FINE ) )
      log.fine( "Absorb nominals: " + ATermUtils.toString( c ) + " " +  list );

    tbox.getAbsorbedAxioms().addAll( explain );

    DependencySet ds = new DependencySet( explain );
    while( !list.isEmpty() ) {
      ATermAppl nominal = (ATermAppl) list.getFirst();
      ATermAppl ind = (ATermAppl) nominal.getArgument( 0 );
      kb.addIndividual( ind );
      kb.addType( ind, c, ds );
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.