Examples of EdgeList


Examples of org.mindswap.pellet.EdgeList

    return result;
  }

  private Bool checkNominalEdges(KnowledgeBase kb, CachedNode pNode, CachedNode cNode,
      boolean checkInverses) {
    EdgeList edges = checkInverses
      ? cNode.getInEdges()
      : cNode.getOutEdges();
    for( Edge edge : edges ) {
      Role role = checkInverses
        ? edge.getRole().getInverse()
View Full Code Here

Examples of org.mindswap.pellet.EdgeList

      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 ) ) {
View Full Code Here

Examples of org.mindswap.pellet.EdgeList

  public void addEdge(Individual subj, Role pred, Node obj, DependencySet ds) {
    super.addEdge( subj, pred, obj, ds );

    if( !merging && !abox.isClosed() && subj.isRootNominal() && obj.isRootNominal() ) {
      if( interpreter != null ) {
        EdgeList edges = subj.getRNeighborEdges( pred, obj );
        for( Edge edge : edges ) {
          if( edge.getFrom().isRootNominal() && edge.getTo().isRootNominal() )
            runRules |= interpreter.rete.addFact( edge );
        }
View Full Code Here

Examples of org.mindswap.pellet.EdgeList

      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;
        }
      }
    }

    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() )
View Full Code Here

Examples of org.mindswap.pellet.EdgeList

    return result;
  }

  private Bool checkNominalEdges(KnowledgeBase kb, CachedNode pNode, CachedNode cNode,
      boolean checkInverses) {
    EdgeList edges = checkInverses
      ? cNode.getInEdges()
      : cNode.getOutEdges();
    for( Edge edge : edges ) {
      Role role = checkInverses
        ? edge.getRole().getInverse()
View Full Code Here

Examples of org.mindswap.pellet.EdgeList

      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 ) ) {
View Full Code Here

Examples of org.mindswap.pellet.EdgeList

          continue;
        }
        selfRule.apply(n);

        // CHW-added for inc. queue must see if this is bad
        EdgeList allEdges = n.getOutEdges();
        for (int e = 0; e < allEdges.size(); e++) {
          Edge edge = allEdges.edgeAt(e);
          if (edge.getTo().isPruned()) {
            continue;
          }

          applyPropertyRestrictions(edge);
          if (n.isMerged()) {
            break;
          }
        }

      }

      return;
    }

    if (log.isLoggable(Level.FINE)) {
      log.fine("Initialize started");
    }

    abox.setBranch(0);

    mergeList.addAll(abox.getToBeMerged());

    if (!mergeList.isEmpty()) {
      mergeAll();
    }

    Role topRole = abox.getRole(TOP_OBJECT_PROPERTY);
    Iterator<Individual> i = getInitializeIterator();
    while (i.hasNext()) {
      Individual n = i.next();

      if (n.isMerged()) {
        continue;
      }

      applyUniversalRestrictions(n);
      if (n.isMerged()) {
        continue;
      }

      selfRule.apply(n);
      if (n.isMerged()) {
        continue;
      }

      EdgeList allEdges = n.getOutEdges();
      for (int e = 0; e < allEdges.size(); e++) {
        Edge edge = allEdges.edgeAt(e);

        if (edge.getTo().isPruned()) {
          continue;
        }
View Full Code Here

Examples of org.mindswap.pellet.EdgeList

    // TODO improve this check
    Set<Role> disjoints = pred.getDisjointRoles();
    if (disjoints.isEmpty()) {
      return;
    }
    EdgeList edges = subj.getEdgesTo(obj);
    for (int i = 0, n = edges.size(); i < n; i++) {
      Edge otherEdge = edges.edgeAt(i);

      if (disjoints.contains(otherEdge.getRole())) {
        ds = ds.union(otherEdge.getDepends(), abox.doExplanation());
        ds = ds.union(pred.getExplainDisjointRole(otherEdge.getRole()), abox.doExplanation());
        abox.setClash(Clash.disjointProps(subj, ds, pred.getName(), otherEdge.getRole().getName()));
View Full Code Here

Examples of org.mindswap.pellet.EdgeList

  }

  void checkReflexivitySymmetry(Individual subj, Role pred, Individual obj, DependencySet ds) {
    if (pred.isAsymmetric() && obj.hasRSuccessor(pred, subj)) {
      EdgeList edges = obj.getEdgesTo(subj, pred);
      ds = ds.union(edges.edgeAt(0).getDepends(), abox.doExplanation());
      if (PelletOptions.USE_TRACING) {
        ds = ds.union(pred.getExplainAsymmetric(), abox.doExplanation());
      }
      abox.setClash(Clash.unexplained(subj, ds, "Antisymmetric property " + pred));
    }
View Full Code Here

Examples of org.mindswap.pellet.EdgeList

      }
    }
  }

  protected void applyFunctionalMaxRule(Literal x, Role r, DependencySet ds) {
    EdgeList edges = x.getInEdges().getEdges(r);

    // if there is not more than one edge then func max rule won't be triggered
    if (edges.size() <= 1) {
      return;// continue;
    }

    // find all distinct R-neighbors of x
    Set<Node> neighbors = edges.getNeighbors(x);

    // if there is not more than one neighbor then func max rule won't be triggered
    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();

      if (ind.isNominal() && (head == null || ind.getNominalLevel() < head.getNominalLevel())) {
        head = ind;
        headDS = edge.getDepends();
      }
    }

    // if there is no nominal in the merge list we need to create one
    if (head == null) {
      head = abox.addFreshIndividual(null, ds);
    }
    else {
      ds = ds.union(headDS, abox.doExplanation());
    }

    for (int i = 0; i < edges.size(); i++) {
      Edge edge = edges.edgeAt(i);
      Individual next = edge.getFrom();

      if (next.isPruned()) {
        continue;
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.