Package org.mindswap.pellet

Examples of org.mindswap.pellet.Individual


      t.stop();
    }
  }
 
  protected boolean isDirectlyBlockedInt(Individual blocked) {
    Individual parentBlocked = blocked.getParent();
    if( blocked.isRoot() || parentBlocked.isRoot() )
      return false;
   
    BlockingContext cxt = new BlockingContext( blocked );   
    while( cxt.moveBlockerUp() ) {     
        if( isDirectlyBlockedBy( cxt ) )  {
View Full Code Here


        if( log.isLoggable( Level.FINER ) )
          log.finer( cxt.blocked +  " blocked by " + cxt.blocker );
      return true;
    }
   
    Individual blocker = cxt.blocker;
    for( Edge e : blocker.getOutEdges() ) {
      Node child = e.getTo();

      if( cxt.moveBlockerDown( child ) ) {
        if( isDirectlyBlockedByDescendant( cxt ) ) {     
          return true;
View Full Code Here

 
  private DoubleBlocking() {   
  }

  public boolean isDirectlyBlockedBy(BlockingContext cxt) {
    Individual parentBlocked = cxt.blocked.getParent();
    Individual parentBlocker = cxt.blocker.getParent();
   
    if( SetUtils.equals( cxt.blocked.getTypes(), cxt.blocker.getTypes() )
        && SetUtils.equals( parentBlocked.getTypes(), parentBlocker.getTypes() ) ) {
      if( SetUtils.equals( cxt.getIncomingRoles(), BlockingContext.getIncomingRoles( cxt.blocker ) ) )
        return true;         
    }
   
    return false;
View Full Code Here

    addType( ind, cls );
  }

  private void addType(ATermAppl ind, ATermAppl cls) {
    Individual node = abox.getIndividual( ind ).getSame();
    if( negated )
      cls = ATermUtils.negate( cls );

    strategy.addType( node, cls, ds );
  }
View Full Code Here

    strategy.addType( node, cls, ds );
  }

  private void addEdge(ATermAppl p, ATermAppl s, ATermAppl o) {
    Individual node1 = abox.getIndividual( s ).getSame();

    if( negated ) {
      ATermAppl cls = all( p, not( value( o ) ) );
      strategy.addType( node1, cls, ds );
    }
View Full Code Here

        ATermAppl subj = f.getElements().get( Compiler.SUBJ );
        ATermAppl obj =  f.getElements().get( Compiler.OBJ );
       
        if( pred.equals( Compiler.TYPE ) ) {
          // add a type assertion for the individual
          Individual ind = abox.getIndividual( subj );
          ATermAppl type = obj;
          ind.addType( type, ds );
        } else if ( pred.equals( Compiler.SAME_AS ) ) {
          Individual ind1 = abox.getIndividual( subj );
          Individual ind2 = abox.getIndividual( obj );
         
          ind1.setSame( ind2, DependencySet.INDEPENDENT );
        } else if ( pred.equals( Compiler.DIFF_FROM ) ) {
          Individual ind1 = abox.getIndividual( subj );
          Individual ind2 = abox.getIndividual( obj );
         
          ind1.setDifferent( ind2, DependencySet.INDEPENDENT );
        } else {
          // add code for inferring roles, too
          Role r = abox.getRole( pred );
          Individual from = abox.getIndividual( subj );
          Node to;
          if ( r != null && r.isObjectRole()) {
            to = abox.getIndividual( obj );
          } else if ( r != null && r.isDatatypeRole()) {
            to = abox.getLiteral( obj );
View Full Code Here

      result = ATermUtils.makeVar(variable.getName());
    }

    public void visit(AtomIConstant constant) {
      abox.copyOnWrite();
      Individual individual = abox.getIndividual(constant.getValue());
      if (individual.isMerged()) {
        dependency = individual.getMergeDependency(true);
        individual = individual.getSame();
      }

      result = individual.getName();
    }
View Full Code Here

  public void addType(Node node, ATermAppl c, DependencySet ds) {
    super.addType( node, c, ds );

    if( !merging && !abox.isClosed() && node.isRootNominal() ) {
      if( interpreter != null && node.isIndividual() ) {
        Individual ind = (Individual) node;
        runRules |= interpreter.rete.addFact( ind, c, ind.getDepends( c ) );
        runRules |= interpreter.rete.addDifferents( (Individual) node );
      }
    }

  }
View Full Code Here

     
      if( log.isLoggable( Level.FINE ) )
        log.fine( "RULE: " + fact + " " + ds );

      ATermAppl pred = fact.getElements().get( Compiler.PRED );
      Individual subj = abox.getIndividual( fact.getElements().get( Compiler.SUBJ ) );
      if( subj.isMerged() ) {
        ds = ds.union( subj.getMergeDependency( true ), abox.doExplanation() );
        subj = subj.getSame();
      }

      ATermAppl objTerm = fact.getElements().get( Compiler.OBJ );

      if( pred.equals( Compiler.TYPE ) ) {
        // add a type assertion for the individual
        ATermAppl type = objTerm;
        addType( subj, type, ds );
      }
      else {
        Node obj = abox.getNode( objTerm );
        if( obj != null && obj.isMerged() ) {
//          ds = ds.union( ds, abox.doExplanation() );
          obj = obj.getSame();
        }

        if( pred.equals( Compiler.SAME_AS ) ) {
          Individual ind2 = (Individual) obj;
          mergeTo( ind2, subj, ds );
        }
        else if( pred.equals( Compiler.DIFF_FROM ) ) {
          Individual ind2 = (Individual) obj;
          subj.setDifferent( ind2, ds );
        }
        else {
          // add code for inferring roles, too
          Role r = abox.getRole( pred );
View Full Code Here

   * @param edge
   *            the {@code Edge}
   * @return boolean {@code true} if added, {@code false} else
   */
  public boolean addFact(Edge edge) {
    final Individual from = edge.getFrom();
    final org.mindswap.pellet.Node to = edge.getTo().getSame();
    if( !to.isRootNominal() || to.isPruned() )
      return false;
    final DependencySet ds = edge.getDepends();
    Role role = edge.getRole();
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.