Package aterm

Examples of aterm.ATermAppl


       
        Iterator<Unfolding> unfoldingList = strategy.getTBox().unfold( c );

        while( unfoldingList.hasNext() ) {
      Unfolding unfolding = unfoldingList.next();
          ATermAppl unfoldingCondition = unfolding.getCondition();
          DependencySet finalDS = node.getDepends( unfoldingCondition );
         
          if( finalDS == null )
            continue;
         
      Set<ATermAppl> unfoldingDS = unfolding.getExplanation()
          finalDS = finalDS.union( ds, strategy.getABox().doExplanation() );
          finalDS = finalDS.union( unfoldingDS, strategy.getABox().doExplanation() );
         
      ATermAppl unfoldedConcept = unfolding.getResult();           
         
            if( log.isLoggable( Level.FINE ) && !node.hasType( unfoldedConcept ) )
                log.fine( "UNF : " + node + ", " + ATermUtils.toString(c) + " -> " + ATermUtils.toString( unfoldedConcept ) + " - " + finalDS );

            strategy.addType( node, unfoldedConcept, finalDS );
View Full Code Here


    types.subList( node.applyNext[Node.OR], size ).toArray( disjunctions );
    if( PelletOptions.USE_DISJUNCTION_SORTING != PelletOptions.NO_SORTING )
      sortDisjunctions( node, disjunctions );

    for( int j = 0, n = disjunctions.length; j < n; j++ ) {
      ATermAppl disjunction = disjunctions[j];

      applyDisjunctionRule( node, disjunction );

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

   * @param node
   * @param disjunction
   */
  protected void applyDisjunctionRule(Individual node, ATermAppl disjunction) {
    // disjunction is now in the form not(and([not(d1), not(d2), ...]))
    ATermAppl a = (ATermAppl) disjunction.getArgument( 0 );
    ATermList disjuncts = (ATermList) a.getArgument( 0 );
    ATermAppl[] disj = new ATermAppl[disjuncts.getLength()];

    for( int index = 0; !disjuncts.isEmpty(); disjuncts = disjuncts.getNext(), index++ ) {
      disj[index] = ATermUtils.negate( (ATermAppl) disjuncts.getFirst() );
      if( node.hasType( disj[index] ) )
View Full Code Here

      atermConverter.clear();
      atermConverter.setAddAxiom( true );

      object.accept( atermConverter );

      ATermAppl aterm = atermConverter.result();

      // for the ATerm->OWLObject translation to work we need
      // all the entities referred in the ATerm to be defined
      // entities. therefore, we add a dummy axiom to the KB
      // that will add the definitions for each entity.
View Full Code Here

  @Test
  public void testComparator() {
    // test case for #423
   
    // the following two terms are known to have equivalent hascodes with aterm 1.6
    ATermAppl a = term("http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#Carboplatin_Paclitaxel_ZD-6474");
    ATermAppl b = term("http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#Henna");
    // an arbitrary term that is known to have a different hahshcode
    ATermAppl c = term("c");
   
    assertTrue( a.hashCode() == b.hashCode() );
    assertFalse( a.hashCode() == c.hashCode() );
   
    assertTrue( 0 == Comparators.termComparator.compare( a, a ) );
    assertFalse( 0 == Comparators.termComparator.compare( a, b ) );
    assertFalse( 0 == Comparators.termComparator.compare( a, c ) );
  }
View Full Code Here

          return;

        List<ATermAppl> types = x.getTypes( Node.SOME );
        int size = types.size();
        for( int j = x.applyNext[Node.SOME]; j < size; j++ ) {
            ATermAppl sv = types.get( j );

            applySomeValuesRule( x, sv );
           
            if( strategy.getABox().isClosed() || x.isPruned() )
                return;
View Full Code Here

    }

   
    protected void applySomeValuesRule( Individual x, ATermAppl sv ) {
        // someValuesFrom is now in the form not(all(p. not(c)))
        ATermAppl a = (ATermAppl) sv.getArgument( 0 );
        ATermAppl s = (ATermAppl) a.getArgument( 0 );
        ATermAppl c = (ATermAppl) a.getArgument( 1 );

        DependencySet ds = x.getDepends( sv );

       
        if(!PelletOptions.MAINTAIN_COMPLETION_QUEUE && ds == null)
      return;
       
        c = ATermUtils.negate( c );
       
        // Special rule to optimize topObjectProperty
        if ( s.equals( ATermUtils.TOP_OBJECT_PROPERTY ) ) {
          if ( ATermUtils.isNominal( c ) )
            return;
         
          for ( Node node : strategy.getABox().getNodes() ) {
            if ( node.isIndividual() && !node.isPruned() && node.hasType( c ) ) {
              return;
            }
          }
         
          Individual y = strategy.createFreshIndividual( x, ds );
          strategy.addType( y, c, ds );
          return;
        }
       
        Role role = strategy.getABox().getRole( s );


        // Is there a r-neighbor that satisfies the someValuesFrom restriction
        boolean neighborFound = false;
        // Safety condition as defined in the SHOIQ algorithm.
        // An R-neighbor y of a node x is safe if
        // (i) x is blockable or if
        // (ii) x is a nominal node and y is not blocked.
        boolean neighborSafe = x.isBlockable();
        // y is going to be the node we create, and edge its connection to the
        // current node
        Node y = null;
        Edge edge = null;

        // edges contains all the edges going into of coming out from the node
        // And labeled with the role R
        EdgeList edges = x.getRNeighborEdges( role );
        // We examine all those edges one by one and check if the neighbor has
        // type C, in which case we set neighborFound to true
        for( Iterator<Edge> i = edges.iterator(); i.hasNext(); ) {
            edge = i.next();

            y = edge.getNeighbor( x );           
           
            if( PelletOptions.USE_COMPLETION_QUEUE && y.isPruned() ){
                y = null;
                continue;
            }              
           
            if( y.hasType( c ) ) {
              neighborFound = neighborSafe || y.isLiteral() || !strategy.getBlocking().isBlocked( (Individual) y );
                if( neighborFound ) {
                    break;
                }
            }
        }

        // If we have found a R-neighbor with type C, continue, do nothing
        if( neighborFound )
            return;

        // If not, we have to create it
        // If the role is a datatype property...
        if( role.isDatatypeRole() ) {
            Literal literal = (Literal) y;
      if( ATermUtils.isNominal( c ) && !PelletOptions.USE_PSEUDO_NOMINALS ) {
        strategy.getABox().copyOnWrite();

        final ATermAppl input = (ATermAppl) c.getArgument( 0 );
        ATermAppl canonical;
        if( input.getArgument( ATermUtils.LIT_URI_INDEX ).equals( ATermUtils.NO_DATATYPE ) ) {
          canonical = input;
        }
        else {
          try {
            canonical = strategy.getABox().getDatatypeReasoner().getCanonicalRepresentation( input );
          } catch( InvalidLiteralException e ) {
            final String msg = "Invalid literal encountered in nominal when attempting to apply some values rule: "
                + e.getMessage();
            throw new InternalReasonerException( msg, e );
          } catch( UnrecognizedDatatypeException e ) {
            final String msg = "Unrecognized datatype for literal encountered in nominal when attempting to apply some values rule: "
                + e.getMessage();
            throw new InternalReasonerException( msg, e );
          }
        }
        literal = strategy.getABox().addLiteral( canonical );
      }
            else {
                if( !role.isFunctional() || literal == null ) {
                    literal = strategy.getABox().addLiteral( ds );
                }
                else {
                  ds = ds.union( role.getExplainFunctional(), strategy.getABox().doExplanation()  );
                  ds = ds.union( edge.getDepends(), strategy.getABox().doExplanation()  );
                }
                strategy.addType( literal, c, ds );
            }
           
            if( log.isLoggable( Level.FINE ) )
                log.fine( "SOME: " + x + " -> " + s + " -> " + literal + " : " + ATermUtils.toString( c ) + " - " + ds );
           
            strategy. addEdge( x, role, literal, ds );
        }
        // If it is an object property
        else {
            if( ATermUtils.isNominal( c ) && !PelletOptions.USE_PSEUDO_NOMINALS ) {
                strategy.getABox().copyOnWrite();

                ATermAppl value = (ATermAppl) c.getArgument( 0 );
                y = strategy.getABox().getIndividual( value );

                if( log.isLoggable( Level.FINE ) )
                    log.fine( "VAL : " + x + " -> " + ATermUtils.toString( s ) + " -> " + y + " - " + ds );
View Full Code Here

  }
 

    @Override
  public void applyAllValues(Individual x, ATermAppl av, DependencySet ds) {
      ATermAppl p = (ATermAppl) av.getArgument( 0 );
    ATermAppl c = (ATermAppl) av.getArgument( 1 );
   
    Role s = strategy.getABox().getRole( p );
   
    if ( s.isTop() && s.isObjectRole() ) {
          applyAllValuesTop( av, c, ds );
          return;
        }
   
    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( strategy.getABox().doExplanation() ) {
        Role edgeRole = edgeToY.getRole();
        DependencySet subDS = s.getExplainSubOrInv( edgeRole );
        finalDS = finalDS.union( subDS.getExplain(), true );
      }
     
      applyAllValues( x, s, y, c, finalDS );

      if( x.isMerged() )
        return;
    }

    if( !s.isSimple() ) {
      for( Role r : s.getTransitiveSubRoles() ) {
        ATermAppl allRC = ATermUtils.makeAllValues( r.getName(), c );

        edges = x.getRNeighborEdges( r );
        for( int e = 0; e < edges.size(); e++ ) {
          Edge edgeToY = edges.edgeAt( e );
          Node y = edgeToY.getNeighbor( x );
View Full Code Here

     
    List<ATermAppl> allValues = subj.getTypes( Node.ALL );
    int size = allValues.size();
    Iterator<ATermAppl> i = allValues.iterator();
    while( i.hasNext() ) {
      ATermAppl av = i.next();
      ATermAppl p = (ATermAppl) av.getArgument( 0 );
      ATermAppl c = (ATermAppl) av.getArgument( 1 );     
     
      Role s = strategy.getABox().getRole( p );
     
      if ( s.isTop() && s.isObjectRole() ) {
              applyAllValuesTop( av, c, ds );
              continue;
            }
     
      if( pred.isSubRoleOf( s ) ) {
        DependencySet finalDS = ds.unionsubj.getDepends( av ), strategy.getABox().doExplanation() );
        if( strategy.getABox().doExplanation() )
          finalDS = finalDS.union( s.getExplainSubOrInv( pred ).getExplain(), true );
               
        applyAllValues( subj, s, obj, c, finalDS );

        if( s.isTransitive() ) {
          ATermAppl allRC = ATermUtils.makeAllValues( s.getName(), c );
          finalDS = ds.union( subj.getDepends( av ), strategy.getABox().doExplanation() );
          if( strategy.getABox().doExplanation() )
            finalDS = finalDS.unions.getExplainTransitive().getExplain(), true );
         
          applyAllValues( subj, s, obj, allRC, finalDS );
View Full Code Here

      throw new PelletCmdException( "Not an object property: " + propertyName );

    if( !((OWLObjectProperty) entity).isTransitive( loader.getAllOntologies() ) )
      throw new PelletCmdException( "Not a transitive property: " + propertyName );

    ATermAppl p = ATermUtils.makeTermAppl( entity.getIRI().toString() );

    ATermAppl c = null;
    boolean filter = false;

    if(options.getOption( "filter" ).exists())
    {
      String filterName = options.getOption( "filter" ).getValueAsString();     
View Full Code Here

TOP

Related Classes of aterm.ATermAppl

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.