Package org.mindswap.pellet

Examples of org.mindswap.pellet.Individual


    // get all the individuals
    interpreter.addFact( EMPTY_FACT );
    for( Iterator<Individual> i = abox.getIndIterator(); i.hasNext(); ) {

      Individual ind = i.next();
      processIndividual( ind );

    }
    return;
  }
View Full Code Here


    monitor.setProgressLength( kb.getIndividuals().size() );
    monitor.taskStarted();

    Iterator<Individual> i = kb.getABox().getIndIterator();
    for( int count = 0; i.hasNext(); count++ ) {
      Individual x = i.next();

      monitor.incrementProgress();
     
      kb.timers.getTimer( "realize" ).check();
     
      if( monitor.isCanceled() ) {
              return false;
            }

      if( log.isLoggable( Level.FINER ) ) {
              log.finer( count + ") Realizing " + format( x.getName() ) + " " );
            }

      Map<ATermAppl, Boolean> marked = new HashMap<ATermAppl, Boolean>();

      List<ATermAppl> obviousTypes = new ArrayList<ATermAppl>();
      List<ATermAppl> obviousNonTypes = new ArrayList<ATermAppl>();

      kb.getABox().getObviousTypes( x.getName(), obviousTypes, obviousNonTypes );

      for( ATermAppl c : obviousTypes ) {
        // since nominals can be returned by getObviousTypes
        // we need the following check
        if( !taxonomy.contains( c ) ) {
                  continue;
                }

        mark( taxonomy.getAllEquivalents( c ), marked, Boolean.TRUE );
        mark( taxonomy.getFlattenedSupers( c, /* direct = */true ), marked, Boolean.TRUE );

        // FIXME: markToldDisjoints operates on a map key'd with
        // TaxonomyNodes, not ATermAppls
        // markToldDisjoints( c, false );
      }

      for( ATermAppl c : obviousNonTypes ) {
        mark( taxonomy.getAllEquivalents( c ), marked, Boolean.FALSE );
        mark( taxonomy.getFlattenedSubs( c, /* direct = */true ), marked, Boolean.FALSE );
      }

      realizeByIndividual( x.getName(), ATermUtils.TOP, marked );
    }

    monitor.taskFinished();

    return true;
View Full Code Here

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

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

          neighbors = new HashSet<ATermAppl>();
          kb.getABox().getObjectPropertyValues( pNode.getName(), role, neighbors,
              neighbors, false );
        }
       
        Individual ind = kb.getABox().getIndividual( val ).getSame();
        Set<ATermAppl> samesAndMaybes = new HashSet<ATermAppl>();
        kb.getABox().getSames( ind, samesAndMaybes, samesAndMaybes );
       
        found = SetUtils.intersects( samesAndMaybes, neighbors );
      }
View Full Code Here

  /**
   * @param val
   * @return
   */
  private boolean isRootNominal(KnowledgeBase kb, ATermAppl val) {
    Individual ind = kb.getABox().getIndividual( val );
   
    return ind != null && ind.isRootNominal();
  }
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

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.