Package org.mindswap.pellet

Examples of org.mindswap.pellet.Individual


    // 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());

      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
      if (abox.getBranch() >= 0 && PelletOptions.TRACK_BRANCH_EFFECTS) {
        abox.getBranchEffectTracker().add(abox.getBranch(), z.getName());
      }
    }

    x.inheritDifferents(y, ds);
View Full Code Here


          restoreLocal(((Individual) succ), branch, visited);
        }
      }

      for (Edge edge : ind.getInEdges()) {
        Individual pred = edge.getFrom();
        if (visited.containsKey(pred)) {
          continue;
        }
        restoreLocal(pred, branch, visited);
      }
View Full Code Here

  void printBlocked() {
    int blockedCount = 0;
    StringBuffer blockedNodes = new StringBuffer();
    Iterator<Individual> n = abox.getIndIterator();
    while (n.hasNext()) {
      Individual node = n.next();
      ATermAppl x = node.getName();

      if (blocking.isBlocked(node)) {
        blockedCount++;
        blockedNodes.append(x).append(" ");
      }
View Full Code Here

    return name.substring(lastIndex + 1);
  }

  protected void restoreAllValues() {
    for (Iterator<Individual> i = new IndividualIterator(abox); i.hasNext();) {
      Individual ind = i.next();
      allValuesRule.apply(ind);
    }
  }
View Full Code Here

   * @return
   */
  public Individual next() {
    //get the next index
    findNext(-1);
    Individual ind = abox.getIndividual(queue.get(current));
    ind = ind.getSame();
    current++;
    return ind;
   
  }
View Full Code Here

   * @return
   */
  public Individual next() {
    //get the next index
    findNext(currentType);
    Individual ind = (Individual)abox.getNode(queue[currentType].get(current[currentType]));
    ind = ( Individual ) ind.getSame();
    current[currentType]++;
    return ind;   
  }
View Full Code Here

   * {@inheritDoc}
   */
  public boolean isSafe(ATermAppl c, Individual ind) {
    Edge parentEdge = getParentEdge( ind );
    Role r = parentEdge.getRole();
    Individual parent = parentEdge.getFrom();
   
    ABox abox = parent.getABox();

    if( !isParentSafe( abox.getKB(), r, parent ) )
      return false;

    Iterator<CachedNode> nodes = getCachedNodes( abox, c );
View Full Code Here

  }

  protected Edge getParentEdge(Individual ind) {
    Edge result = null;
    Role role = null;
    Individual parent = ind.getParent();
    for( Edge e : ind.getInEdges() ) {
      if( e.getFrom().equals( parent ) ) {
        if( role == null ) {
          role = e.getRole();
          result = e;
View Full Code Here

    if (abox.isInitialized()) {

      Iterator<Individual> i = getInitializeIterator();
      while (i.hasNext()) {
        Individual n = i.next();

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

        if (n.isConceptRoot()) {
          applyUniversalRestrictions(n);
        }

        allValuesRule.apply(n);
        if (n.isMerged()) {
          continue;
        }
        nominalRule.apply(n);
        if (n.isMerged()) {
          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;
        }

        applyPropertyRestrictions(edge);

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

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

      // The top object role isn't in the edge list, so pretend it exists
      applyPropertyRestrictions(n, topRole, n, DependencySet.INDEPENDENT);
View Full Code Here

   *
   */
  public abstract void complete(Expressivity expr);

  public Individual createFreshIndividual(Individual parent, DependencySet ds) {
    Individual ind = abox.addFreshIndividual(parent, ds);

    applyUniversalRestrictions(ind);

    return ind;
  }
View Full Code Here

TOP

Related Classes of org.mindswap.pellet.Individual

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.