Package org.mindswap.pellet

Examples of org.mindswap.pellet.DependencySet


    EdgeList edges = subj.getEdgesTo( obj, role );
    for( int i = 0; i < edges.size(); i++ ) {
      Edge edge = edges.edgeAt( i );
      if( edge.getRole().equals( role ) ) {
        // get dependency set for the edge
        DependencySet ds = edge.getDepends();
 
        // clean it
        ds.removeExplain( assertion );
 
        // remove if the dependency set is empty
        if( ds.getExplain().isEmpty() ) {
          final IncrementalChangeTracker tracker = kb.getABox().getIncrementalChangeTracker();
          // need to check if the
 
          subj.removeEdge( edge );
          obj.removeInEdge( edge );
View Full Code Here


    if( DependencyIndex.log.isLoggable( Level.FINE ) )
      DependencyIndex.log.fine( "    Removing merge? " + merge.getInd() + " merged to "
          + merge.getmergedIntoInd() );
 
    // get merge dependency
    DependencySet ds = kb.getABox().getNode( merge.getInd() ).getMergeDependency( false );
 
    // remove the dependency
    ds.removeExplain( assertion );
 
    // undo merge if empty
    if( ds.getExplain().isEmpty() ) {
      if( DependencyIndex.log.isLoggable( Level.FINE ) )
        DependencyIndex.log.fine( "           Actually removing merge!" );
 
      // get nodes
      Node ind = kb.getABox().getNode( merge.getInd() );
View Full Code Here

  public void apply(Individual y) {
    List<ATermAppl> types = y.getTypes( Node.NOM );
    int size = types.size();
    for( int j = 0; j < size; j++ ) {
      ATermAppl nc = types.get( j );
      DependencySet ds = y.getDepends( nc );

      if( !PelletOptions.MAINTAIN_COMPLETION_QUEUE && ds == null )
        continue;

      applyNominalRule( y, nc, ds );
View Full Code Here

      else
        DependencyIndex.log.fine( "    Removing type? " + desc + " from " + node );
    }
 
    // get the dependency set - Note: we must normalize the concept
    DependencySet ds = node.getDepends( ATermUtils.normalize( desc ) );
 
    // return if null - this can happen as currently I have dupilicates in
    // the index
    if( ds == null || desc == ATermUtils.TOP )
      return;
 
    // clean it
    ds.removeExplain( assertion );
 
    // remove if the explanation set is empty
    if( ds.getExplain().isEmpty() ) {
      final IncrementalChangeTracker tracker = kb.getABox().getIncrementalChangeTracker();
 
      kb.getABox().removeType( node.getName(), desc );
 
      // update the set of removed types
View Full Code Here

        List<ATermAppl> allValues = x.getTypes( Node.ALL );
        int size = allValues.size();
        Iterator<ATermAppl> i = allValues.iterator();
        while( i.hasNext() ) {
            ATermAppl av = i.next();
            DependencySet avDepends = x.getDepends( av );

            if(!PelletOptions.MAINTAIN_COMPLETION_QUEUE && avDepends == null)
        continue;
           
            applyAllValues( x, av, avDepends );
View Full Code Here

        EdgeList edges = x.getRNeighborEdges( s );
        for( int e = 0; e < edges.size(); e++ ) {
            Edge edgeToY = edges.edgeAt( e );
            Node y = edgeToY.getNeighbor( x );
            DependencySet finalDS = ds.union( edgeToY.getDepends(), strategy.getABox().doExplanation() );
           
            if( roleChain.isEmpty() )
                applyAllValues( x, s, y, c, finalDS );
            else if(y.isIndividual()) {
                ATermAppl allRC = ATermUtils.makeAllValues( roleChain, c );

                strategy.addType( y, allRC, finalDS );
            }

            if( x.isMerged() || strategy.getABox().isClosed() )
                return;
        }

        if( !s.isSimple() ) {
            Set<ATermList> subRoleChains = s.getSubRoleChains();
            for( Iterator<ATermList> it = subRoleChains.iterator(); it.hasNext(); ) {
                ATermList chain = it.next();
                DependencySet subChainDS = ds.union(s.getExplainSub(chain), strategy.getABox().doExplanation() );
        if (!applyAllValuesPropertyChain(x, chain, c, subChainDS))
          return;
            }
        }
       
View Full Code Here

             ATermAppl allRC = ATermUtils.makeAllValues( chain.getNext(), c );

             for( int e = 0; e < edges.size(); e++ ) {
                 Edge edgeToY = edges.edgeAt( e );
                 Node y = edgeToY.getNeighbor( x );
                 DependencySet finalDS = ds.union( edgeToY.getDepends(), strategy.getABox().doExplanation() );
                
                 applyAllValues( x, r, y, allRC, finalDS );

                 if( x.isMerged() || strategy.getABox().isClosed() )
                     return false;
View Full Code Here

                    return;
              continue;
            }

            if( pred.isSubRoleOf( s ) ) {
                DependencySet finalDS = subj.getDepends( av );
        finalDS = finalDS.union( ds, strategy.getABox().doExplanation() );
        finalDS = finalDS.union( s.getExplainSubOrInv( pred ), strategy.getABox().doExplanation() );
                if( roleChain.isEmpty() )
                    applyAllValues( subj, s, obj, c, finalDS );
                else if (obj.isIndividual()) {
                    ATermAppl allRC = ATermUtils.makeAllValues( roleChain, c );

                    strategy.addType( obj, allRC, finalDS );
                }
               
                if( strategy.getABox().isClosed() )
                    return;
            }

            if( !s.isSimple() ) {
                DependencySet finalDS = subj.getDepends( av ).union( ds, strategy.getABox().doExplanation() );
                Set<ATermList> subRoleChains = s.getSubRoleChains();
                for( Iterator<ATermList> it = subRoleChains.iterator(); it.hasNext(); ) {
                    ATermList chain = it.next();
                   
//                    if( !pred.getName().equals( chain.getFirst() ) )
                    Role firstRole = strategy.getABox().getRole(chain.getFirst());
                    if( !pred.isSubRoleOf( firstRole ) )
                        continue;

                    ATermAppl allRC = ATermUtils.makeAllValues( chain.getNext(), c );

                    applyAllValues( subj, pred, obj, allRC, finalDS.union(
                        firstRole.getExplainSub(pred.getName()), strategy.getABox().doExplanation()).union(
                            s.getExplainSub(chain), strategy.getABox().doExplanation() ) );

                    if( subj.isMerged() || strategy.getABox().isClosed() )
                        return;
View Full Code Here

     
      /*
       * Collect the data range and its dependency set
       */
      Collection<ATermAppl> existing = dataranges.get( r );
      DependencySet ds = x.getDepends( allDesc );
      if (existing == null) {
        existing = new ArrayList<ATermAppl>();
        dataranges.put( r, existing );
      } else {
        ds = ds.union( rangeDepends.get( r ), strategy.getABox().doExplanation() );
      }
      existing.add( (ATermAppl) allDesc.getArgument(1) );
      rangeDepends.put( r, ds );

    }

    /*
     * Get the ranges of any data properties that have min cardinality restrictions
     */
    for (ATermAppl minDesc : x.getTypes( Node.MIN )) {
      /*
       * TODO: Verify that minDesc will never have a property chain
       */
      final ATermAppl r = (ATermAppl)minDesc.getArgument( 0 );
      final Role role = strategy.getABox().getRole( r );
     
      /*
       * Skip any roles that are not datatype properties
       */
      if (!role.isDatatypeRole())
        continue;

      final Set<ATermAppl> ranges = role.getRanges();
      if( !ranges.isEmpty() ) {
        Collection<ATermAppl> existing = dataranges.get( r );
        DependencySet ds;
        if( existing == null ) {
          existing = new ArrayList<ATermAppl>();
          dataranges.put( r, existing );
          ds = DependencySet.EMPTY;
        } else
          ds = rangeDepends.get( r );

        for( ATermAppl dataRange : role.getRanges() ) {
          /*
           * TODO: Verify the dependency set handling here. The old
           * implementation just used independent (thus could avoid
           * this loop and call addAll)
           */
          existing.add( dataRange );
          ds = ds.union( role.getExplainRange( dataRange ), strategy.getABox().doExplanation() );
          rangeDepends.put( r, ds );
        }
      }
    }

    /*
     * For each of the min cardinality restrictions, verify that the data range is large enough
     */
    for (ATermAppl minDesc : x.getTypes( Node.MIN )) {
      final ATermAppl r = (ATermAppl)minDesc.getArgument( 0 );
      final Role role = strategy.getABox().getRole( r );

      Set<ATermAppl> drs = new HashSet<ATermAppl>();
      Collection<ATermAppl> direct = dataranges.get( r );
      DependencySet ds;
      if (direct != null) {
        drs.addAll(direct);
        ds = rangeDepends.get( r );
      } else
        ds = DependencySet.EMPTY;
     
      ds = ds.union(x.getDepends(minDesc), strategy.getABox().doExplanation() );

      for (Role superRole : role.getSuperRoles()) {
        final ATermAppl s = superRole.getName();
        Collection<ATermAppl> inherited = dataranges.get( s );
        if( inherited != null ) {
          drs.addAll( inherited );
          ds = ds.union( rangeDepends.get( s ), strategy.getABox().doExplanation() ).union(
              role.getExplainSuper( s ), strategy.getABox().doExplanation() );
        }
      }

      if( !drs.isEmpty() ) {
View Full Code Here

    int guessMin = x.getMinCard(r, c);
    if (guessMin == 0)
      guessMin = 1;

    // TODO not clear what the correct ds is so be pessimistic and include everything
    DependencySet ds = x.getDepends(mc);
    edges = x.getRNeighborEdges(r);
    for (int e = 0; e < edges.size(); e++) {
      Edge edge = edges.edgeAt(e);
      ds = ds.union(edge.getDepends(), strategy.getABox().doExplanation());
    }

    GuessBranch newBranch = new GuessBranch(strategy.getABox(), strategy, x, r, guessMin, n, c, ds);
    strategy.addBranch(newBranch);
View Full Code Here

TOP

Related Classes of org.mindswap.pellet.DependencySet

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.