Package org.mindswap.pellet

Examples of org.mindswap.pellet.Role


      kb.addClass( A );
      kb.addObjectProperty( p );
     
      kb.addSubClass( TOP, all( p, A ) );
     
      Role r = kb.getRole( p );

      assertTrue( kb.isConsistent() );
      assertTrue( r.getRanges().contains( A ) );
     
      assertFalse( kb.removeAxiom( ATermUtils.makeSub( TOP, all( p, A ) ) ) );     
    } finally {
      PelletOptions.setOptions( savedOptions );
    }
View Full Code Here


  private Bool checkAllValuesClash(KnowledgeBase kb, ATermAppl av, CachedNode root,
      CachedNode otherRoot) {
    ATerm r = av.getArgument( 0 );
    if( r.getType() == ATerm.LIST )
      r = ((ATermList) r).getFirst();
    Role role = kb.getRole( r );

    if( !role.hasComplexSubRole() ) {
      if( otherRoot.hasRNeighbor( role ) ) {
        if( log.isLoggable( Level.FINE ) )
          log
              .fine( root + " has " + av + " " + otherRoot + " has " + role
                  + " neighbor" );

        return Bool.UNKNOWN;
      }
    }
    else {
      TransitionGraph<Role> tg = role.getFSM();
      for( Transition<Role> t : tg.getInitialState().getTransitions() ) {
        if( otherRoot.hasRNeighbor( t.getName() ) ) {
          if( log.isLoggable( Level.FINE ) )
            log.fine( root + " has " + av + " " + otherRoot + " has " + t.getName()
                + " neighbor" );
View Full Code Here

  }

  private Bool checkMaxClash(KnowledgeBase kb, ATermAppl mc, CachedNode root, CachedNode otherRoot) {
    ATermAppl maxCard = (ATermAppl) mc.getArgument( 0 );

    Role maxR = kb.getRole( maxCard.getArgument( 0 ) );
    int max = ((ATermInt) maxCard.getArgument( 1 )).getInt() - 1;

    int n1 = getRNeighbors( root, maxR ).size();
    int n2 = getRNeighbors( otherRoot, maxR ).size();
View Full Code Here

    return null;
  }

  private Bool checkSelfClash(KnowledgeBase kb, ATermAppl self, CachedNode root, CachedNode otherRoot) {
    Role r = kb.getRole( self.getArgument( 0 ) );
   
    for( Edge e : otherRoot.getOutEdges() ) {
      if( e.getRole().isSubRoleOf( r ) && e.getToName().equals( otherRoot.getName() ) ) {
        if( log.isLoggable( Level.FINE ) )
          log.fine( root + " has not(" + self + ") " + otherRoot + " has self edge" );
View Full Code Here

  }
 
  private Bool checkFunctionalityClash(CachedNode root, CachedNode otherRoot) {
    Set<Role> checked = new HashSet<Role>();
    for( Edge edge : root.getOutEdges() ) {
      Role role = edge.getRole();

      if( !role.isFunctional() )
        continue;

      Set<Role> functionalSupers = role.getFunctionalSupers();
      for( Iterator<Role> j = functionalSupers.iterator(); j.hasNext(); ) {
        Role supRole = j.next();

        if( checked.contains( supRole ) )
          continue;

        checked.add( supRole );

        if( otherRoot.hasRNeighbor( supRole ) ) {
          if( log.isLoggable( Level.FINE ) )
            log.fine( root + " and " + otherRoot + " has " + supRole );
          return Bool.UNKNOWN;
        }
      }
    }

    for( Edge edge : root.getInEdges() ) {
      Role role = edge.getRole().getInverse();

      if( role == null || !role.isFunctional() )
        continue;

      Set<Role> functionalSupers = role.getFunctionalSupers();
      for( Iterator<Role> j = functionalSupers.iterator(); j.hasNext(); ) {
        Role supRole = j.next();

        if( checked.contains( supRole ) )
          continue;

        checked.add( supRole );
View Full Code Here

  }
 
  private Bool checkFunctionalityClashWithDifferents(Individual root, Individual otherRoot) {
    Bool result = null;
    for( Edge edge : root.getOutEdges() ) {
      Role role = edge.getRole();

      if( !role.isFunctional() )
        continue;

      Set<Role> functionalSupers = role.getFunctionalSupers();
      for( Iterator<Role> j = functionalSupers.iterator(); j.hasNext(); ) {
        Role supRole = j.next();

        EdgeList otherEdges = otherRoot.getRNeighborEdges( supRole );
        for( Edge otherEdge : otherEdges ) {
          DependencySet ds = edge.getTo().getDifferenceDependency( otherEdge.getNeighbor( otherRoot ) );
          if( log.isLoggable( Level.FINE ) )
            log.fine( root + " and " + otherRoot + " has " + supRole + " " + edge + " " + otherEdge );
          if( ds != null && ds.isIndependent() )
            return Bool.FALSE;
          result = Bool.UNKNOWN;
        }
      }
    }

    for( Edge edge : root.getInEdges() ) {
      Role role = edge.getRole().getInverse();

      if( role == null || !role.isFunctional() )
        continue;

      Set<Role> functionalSupers = role.getFunctionalSupers();
      for( Iterator<Role> j = functionalSupers.iterator(); j.hasNext(); ) {
        Role supRole = j.next();

        EdgeList otherEdges = otherRoot.getRNeighborEdges( supRole );
        for( Edge otherEdge : otherEdges ) {
          DependencySet ds = edge.getTo().getDifferenceDependency( otherEdge.getNeighbor( otherRoot ) );
          if( log.isLoggable( Level.FINE ) )
View Full Code Here

  }
 
  private MultiValueMap<ATermAppl, Role> collectNeighbors(CachedNode ind) {
    MultiValueMap<ATermAppl, Role> neighbors = new MultiValueMap<ATermAppl, Role>();
    for( Edge edge : ind.getInEdges() ) {
      Role role = edge.getRole();
      ATermAppl neighbor = edge.getFromName();

      if( !ATermUtils.isBnode( neighbor ) )
        neighbors.put( neighbor, role );
    }
   
    for( Edge edge : ind.getOutEdges() ) {
      Role role = edge.getRole();
      ATermAppl neighbor = edge.getToName();
      if( role.isObjectRole() && !ATermUtils.isBnode( neighbor ) )
        neighbors.put( neighbor, role.getInverse() );
    }
    return neighbors;
  }
View Full Code Here

      boolean checkInverses) {
    EdgeList edges = checkInverses
      ? cNode.getInEdges()
      : cNode.getOutEdges();
    for( Edge edge : edges ) {
      Role role = checkInverses
        ? edge.getRole().getInverse()
        : edge.getRole();
      DependencySet ds = edge.getDepends();

      if( !ds.isIndependent() )
        continue;

      boolean found = false;
      ATermAppl val = checkInverses
        ? edge.getFromName()
        : edge.getToName();

      if( !role.isObjectRole() ) {
        found = pNode.hasRNeighbor( role );
      }
      else if( !isRootNominal( kb, val ) ) {
        if( !role.hasComplexSubRole() )
          found = pNode.hasRNeighbor( role );
        else {
          TransitionGraph<Role> tg = role.getFSM();
          Iterator<Transition<Role>> it = tg.getInitialState().getTransitions().iterator();
          while( !found && it.hasNext() ) {
            Transition<Role> tr = it.next();
            found = pNode.hasRNeighbor( tr.getName() );
          }
        }
      }
      else {
        Set<ATermAppl> neighbors = null;

        if( role.isSimple() || !(pNode instanceof Individual) )
          neighbors = getRNeighbors( pNode, role );
        else {
          neighbors = new HashSet<ATermAppl>();
          kb.getABox().getObjectPropertyValues( pNode.getName(), role, neighbors,
              neighbors, false );
View Full Code Here

   */
  private Set<ATermAppl> getRNeighbors(CachedNode node, Role role) {
    Set<ATermAppl> neighbors = new HashSet<ATermAppl>();

    for( Edge edge : node.getOutEdges() ) {
      Role r = edge.getRole();
      if( r.isSubRoleOf( role ) ) {
        neighbors.add( edge.getToName() );
      }
    }

    if( role.isObjectRole() ) {
      role = role.getInverse();
      for( Edge edge : node.getInEdges() ) {
        Role r = edge.getRole();
        if( r.isSubRoleOf( role ) ) {
          neighbors.add( edge.getFromName() );
        }
      }
    }

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

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.