Package org.mindswap.pellet

Examples of org.mindswap.pellet.Role


    }
   
    AlphaNode node = creator.create(atom);
    if (node != null) {
      if (node instanceof AlphaEdgeNode) {
        Role role = ((AlphaEdgeNode) node).getRole();
        addAlphaNodeForSubs(role, node);
        if (role.isObjectRole()) {
          addAlphaNodeForSubs(role.getInverse(), node);
        }
      }
      else {
        nodes.add(node);
      }
View Full Code Here


     
    }
  }

  public void activateEdge(Edge edge) {
    Role r = edge.getRole();
    if (r.isAnon()) {
      r = r.getInverse();
    }
    List<AlphaNode> alphas = map.get(r.getName());
    if (alphas != null) {
      for (AlphaNode alpha : alphas) {
        ((AlphaEdgeNode) alpha).activate(edge);
     
    }
View Full Code Here

    }
  }
 

  private void add(KnowledgeBase kb, ATermAppl r1, ATermAppl r2, ATermAppl superRole) {
    Role role1 = kb.getRole( r1 );
    Role role2 = kb.getRole( r2 );
   
    if( role1 == null ) {
      if( role2 == null ) {
        add( r1, r2, superRole );
      }
      else {
        for( Role sub2 : role2.getSubRoles() ) {
          add( r1, sub2.getName(), superRole );
        }
      }
    }
    else if( role2 == null ) {
      for( Role sub1 : role1.getSubRoles() ) {
        add( sub1.getName(), r2, superRole );
      }
    }
    else {
      for( Role sub1 : role1.getSubRoles() ) {
        for( Role sub2 : role2.getSubRoles() ) {
          add( sub1.getName(), sub2.getName(), superRole );
        }
      }   
    }
  }
View Full Code Here

            addToQueue( pred, concepts.get( some ) );
          }
        }
      }
      else {
        Role role = kb.getRole( prop );
        if( role != null ) {
          Set<Role> superRoles = role.getSuperRoles();
          for( Role superRole : superRoles ) {
            if( existentials.contains( superRole.getName(), sup ) ) {
              ATermAppl some = ATermUtils.makeSomeValues( superRole.getName(), c );
              for( ConceptInfo pred : e.getValue() ) {
                addToQueue( pred, concepts.get( some ) );
View Full Code Here

      if(obj.isMerged())
        obj.getSame();
      if(obj.isPruned())
        continue;

      Role pred = edge.getRole();       
      DependencySet ds = edge.getDepends();

      applyDomainRange(subj, pred, obj, ds);
      if (subj.isPruned() || obj.isPruned()) {
        return;
      }
      applyFunctionality(subj, pred, obj);
      if (subj.isPruned() || obj.isPruned()) {
        return;
      }

      if (pred.isObjectRole()) {
        Individual o = (Individual) obj;
        checkReflexivitySymmetry(subj, pred, o, ds);
        checkReflexivitySymmetry(o, pred.getInverse(), subj, ds);
      }
     
      //if the KB has cardinality restrictions, then we need to apply the guessing rule
          if(abox.getKB().getExpressivity().hasCardinality()){
            //update the queue so the max rule will be fired
              updateQueueAddEdge(subj, pred, obj);
          }
    }
   
    
    //merge again if necessary
    if (!mergeList.isEmpty())
      mergeAll();
   
    //set appropriate branch
    abox.setBranch(abox.getBranches().size() + 1);

    // we will also need to add stuff to the queue in the event of a
    // deletion   
     
    //Handle removed edges
    Iterator<Edge> i = getRemovedEdgeIterator();
    while( i.hasNext() ){       
      Edge e = i.next();
      Individual subj = e.getFrom();
      Node obj = e.getTo();
     
      subj = subj.getSame();
     
      subj.applyNext[Node.SOME] = 0;
      subj.applyNext[Node.MIN] = 0;
      QueueElement qe = new QueueElement( subj );
      abox.getCompletionQueue().add( qe, NodeSelector.EXISTENTIAL );
      abox.getCompletionQueue().add( qe, NodeSelector.MIN_NUMBER );
     
     
      obj = obj.getSame();
      if(obj instanceof Individual){
        Individual objInd = (Individual)obj;
        objInd.applyNext[Node.SOME] = 0;
        objInd.applyNext[Node.MIN] = 0;
        qe = new QueueElement( objInd );
        abox.getCompletionQueue().add( qe, NodeSelector.EXISTENTIAL );
        abox.getCompletionQueue().add( qe, NodeSelector.MIN_NUMBER );
      }               
    }

   
   
   
    //Handle removed types
    Iterator<Map.Entry<Node,Set<ATermAppl>>> it = getRemovedTypeIterator();
    while( it.hasNext() ){
      Node node = it.next().getKey();
     
      if( node.isIndividual() ){
        Individual ind = (Individual)node;

        //readd the conjunctions
        readdConjunctions( ind );
       
        //it could be the case that the type can be added from unfolding, a forAll application on a self loop, or the disjunction rule
        ind.applyNext[Node.ATOM] = 0;
        ind.applyNext[Node.ALL] = 0;
        ind.applyNext[Node.OR] = 0;

        QueueElement qe = new QueueElement( ind );
        abox.getCompletionQueue().add( qe, NodeSelector.ATOM );
        abox.getCompletionQueue().add( qe, NodeSelector.DISJUNCTION );

        //fire the all rule as the is no explicit call to it
        allValuesRule.apply( ind );
       
        //get out edges and check domains, some values and min values
        for( int j = 0; j < ind.getOutEdges().size(); j++ ){
          Edge e = ind.getOutEdges().edgeAt( j );
                       
          if( e.getFrom().isPruned() || e.getTo().isPruned() )
            continue;
                       
              Role pred = e.getRole();
              Node obj = e.getTo();
              DependencySet ds = e.getDepends();
         
              for( ATermAppl domain : pred.getDomains() ) {             
                if( requiredAddType( ind, domain ) ) {
              if( !PelletOptions.USE_TRACING )
                addType( ind, domain, ds.union( DependencySet.EMPTY, abox.doExplanation() ) );
              else        
                addType( ind, domain, ds.union( pred.getExplainDomain( domain ), abox.doExplanation() ) );
                }
              }

              //it could be the case that this label prevented the firing of the all values, some, or min rules of the neighbor
          if( obj instanceof Individual ){
            Individual objInd = (Individual)obj;
            objInd.applyNext[Node.ALL] = 0;
            objInd.applyNext[Node.SOME] = 0;
            objInd.applyNext[Node.MIN] = 0;
            QueueElement qeObj = new QueueElement( objInd );
            abox.getCompletionQueue().add( qeObj, NodeSelector.EXISTENTIAL );
            abox.getCompletionQueue().add( qeObj, NodeSelector.MIN_NUMBER );
           
            //apply the all values rule
            allValuesRule.apply( ind );
          }
        }
      }
       
     
      //get out edges
      for( int j = 0; j < node.getInEdges().size(); j++ ){
        Edge e = node.getInEdges().edgeAt( j );
                     
        if( e.getFrom().isPruned() || e.getTo().isPruned() )
          continue;
       
        Individual subj = e.getFrom();
              Role pred = e.getRole();              
              DependencySet ds = e.getDepends();
       
            for( ATermAppl range : pred.getRanges() ) {
              if( requiredAddType( node, range ) ) {
            if( !PelletOptions.USE_TRACING )
              addType( node, range, ds.union( DependencySet.EMPTY, abox.doExplanation() ) );
            else        
              addType( node, range, ds.union( pred.getExplainRange( range ), abox.doExplanation() ) );
              }
            }

            //it could be the case that this label prevented the firing of the all values, some, or min rules of the neighbor
        subj.applyNext[Node.ALL] = 0;
View Full Code Here

      //handle in edges
      for(int i = 0; i < ind.getOutEdges().size(); i++){
        Edge e = ind.getOutEdges().edgeAt( i );
        Node to = e.getTo();
       
        Role inv = e.getRole().getInverse();
       
        if(inv != null && to instanceof Individual)
          edges.addEdgeList( findAllValues( ind, (Individual)to, removedTypes, new DefaultEdge( inv, (Individual)to, ind, e.getDepends() ) ) ) ;
      }
    }
View Full Code Here

    //two cases depending on input
    if(edge == null){
      //get all edges to this node
      for( int i = 0; i < applicableRoles.size(); i++ ){
        ATerm p = applicableRoles.get( i );
        Role role = abox.getRole( p );

        edges.addEdgeList( neighbor.getRNeighborEdges( role, node ) );
      }     
    }else{
      edges.addEdge( edge );
View Full Code Here

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

  void applyUniversalRestrictions(Individual node) {
    addType(node, ATermUtils.TOP, DependencySet.INDEPENDENT);

    Set<Role> reflexives = abox.getKB().getRBox().getReflexiveRoles();
    for (Iterator<Role> i = reflexives.iterator(); i.hasNext();) {
      Role r = i.next();
      if (log.isLoggable(Level.FINE) && !node.hasRNeighbor(r, node)) {
        log.fine("REF : " + node + " " + r);
      }
      addEdge(node, r, node, r.getExplainReflexive());
      if (node.isMerged()) {
        return;
      }
    }

    Role topObjProp = abox.getKB().getRole(ATermUtils.TOP_OBJECT_PROPERTY);
    for (ATermAppl domain : topObjProp.getDomains()) {
      addType(node, domain, topObjProp.getExplainDomain(domain));
      if (node.isMerged()) {
        continue;
      }
    }
    for (ATermAppl range : topObjProp.getRanges()) {
      addType(node, range, topObjProp.getExplainRange(range));
      if (node.isMerged()) {
        continue;
      }
    }
View Full Code Here

    else if (c.getAFun().equals(ATermUtils.ALLFUN)) {
      allValuesRule.applyAllValues((Individual) node, c, ds);
    }
    else if (c.getAFun().equals(ATermUtils.SELFFUN)) {
      ATermAppl pred = (ATermAppl) c.getArgument(0);
      Role role = abox.getRole(pred);
      if (log.isLoggable(Level.FINE) && !((Individual) node).hasRSuccessor(role, node)) {
        log.fine("SELF: " + node + " " + role + " " + node.getDepends(c));
      }
      addEdge((Individual) node, role, node, ds);
    }
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.