Package org.mindswap.pellet

Examples of org.mindswap.pellet.Role


    List<ATermAppl> types = subj.getTypes(Node.MAX);
    int size = types.size();
    for (int j = 0; j < size; j++) {
      ATermAppl c = types.get(j);
      ATermAppl max = (ATermAppl) c.getArgument(0);
      Role r = abox.getRole(max.getArgument(0));
      if (pred.isSubRoleOf(r)) {
        QueueElement newElement = new QueueElement(subj, c);
        abox.getCompletionQueue().add(newElement, NodeSelector.MAX_NUMBER);
        abox.getCompletionQueue().add(newElement, NodeSelector.CHOOSE);
      }
    }

    // if the predicate has an inverse or is inversefunctional and the obj
    // is an individual, then add the object to the list.
    if (obj instanceof Individual) {
      types = ((Individual) obj).getTypes(Node.MAX);
      size = types.size();
      for (int j = 0; j < size; j++) {
        ATermAppl c = types.get(j);
        ATermAppl max = (ATermAppl) c.getArgument(0);
        Role r = abox.getRole(max.getArgument(0));

        Role invR = pred.getInverse();

        if (invR != null) {
          if (invR.isSubRoleOf(r)) {
            QueueElement newElement = new QueueElement(obj, c);
            abox.getCompletionQueue().add(newElement, NodeSelector.MAX_NUMBER);
            abox.getCompletionQueue().add(newElement, NodeSelector.CHOOSE);
          }
        }
View Full Code Here


    if (pred.isDatatypeRole() && pred.isInverseFunctional()) {
      applyFunctionalMaxRule((Literal) obj, pred, DependencySet.INDEPENDENT);
    }
    else if (pred.isObjectRole()) {
      Individual val = (Individual) obj;
      Role invR = pred.getInverse();

      maxCardDS = invR.isFunctional() ? invR.getExplainFunctional() : val.hasMax1(invR);

      if (maxCardDS != null) {
        maxRule.applyFunctionalMaxRule(val, invR, ATermUtils.TOP, maxCardDS);
      }
    }
View Full Code Here

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

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

*/
public class Block3 implements BlockingCondition {
  public boolean isBlocked(BlockingContext cxt) {
    for( ATermAppl normMax : cxt.blocker.getTypes( Node.MAX ) ) {
      ATermAppl max = (ATermAppl) normMax.getArgument( 0 );
      Role s = cxt.blocked.getABox().getRole( max.getArgument( 0 ) );
      int n = ((ATermInt) max.getArgument( 1 )).getInt() - 1;
      ATermAppl c = (ATermAppl) max.getArgument( 2 );

      if( s.isDatatypeRole() )
        continue;

      Role invS = s.getInverse();

      if( !cxt.isRSuccessor( invS ) )
        continue;
     
      if( cxt.blocked.getParent().hasType( ATermUtils.negate( c ) ) )
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 );

    if( !nodes.hasNext() )
      return false;

    if( interactsWithInverses( abox.getKB(), r ) ) {
      while( nodes.hasNext() ) {
        CachedNode node = nodes.next();

        if( node.isBottom() )
          return true;
        else if( node.isTop() || !node.isComplete() )
          return false;

        if( !isSafe( abox.getKB(), parent, r.getInverse(), node ) )
          return false;
      }
    }

    return true;
View Full Code Here

    return true;
  }

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

    return true;
  }

  private boolean isParentMaxSafe(KnowledgeBase kb, Role role, ATermAppl max) {
    Role maxR = kb.getRole( max.getArgument( 0 ) );

    return !role.isSubRoleOf( maxR );
  }
View Full Code Here

    return true;
  }

  private boolean isAllValuesSafe(KnowledgeBase kb, Individual parent, Role role, ATermAppl term) {
    Role s = kb.getRole( term.getArgument( 0 ) );
    if( !s.hasComplexSubRole() ) {
      ATermAppl c = (ATermAppl) term.getArgument( 1 );

      if( role.isSubRoleOf( s ) && !parent.hasType( c ) )
        return false;
    }
    else {
      TransitionGraph<Role> tg = s.getFSM();

      for( Transition<Role> t : tg.getInitialState().getTransitions() ) {
        if( role.isSubRoleOf( t.getName() ) )
          return false;
      }
View Full Code Here

  private boolean isFunctionalSafe(Role role, CachedNode node) {
    return !role.isFunctional() || getRNeighbors( node, role ).isEmpty();
  }

  private boolean isMaxSafe(KnowledgeBase kb, Role role, ATermAppl term) {
    Role maxR = kb.getRole( term.getArgument( 0 ) );

    return !role.isSubRoleOf( maxR );
  }
View Full Code Here

TOP

Related Classes of org.mindswap.pellet.Role

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.