Package aterm

Examples of aterm.ATermList


        }
      }
      for (ATermList roleChain : invR.getSubRoleChains()) {
        DependencySet subDS = invR.getExplainSub(roleChain);

        ATermList subChain = inverse(roleChain);
        subs.put(subChain, subDS);
      }
    }

    for (Role sub : r.getSubRoles()) {
View Full Code Here


  /**
   * for each role in the list finds an inverse role and returns the new list.
   */
  public ATermList inverse(ATermList roles) {
    ATermList invList = ATermUtils.EMPTY_LIST;

    for (ATermList list = roles; !list.isEmpty(); list = list.getNext()) {
      ATermAppl r = (ATermAppl) list.getFirst();
      Role role = getRole(r);
      Role invR = role.getInverse();
      if (invR == null) {
        System.err.println("Property " + r + " was supposed to be an ObjectProperty but it is not!");
      }
      else {
        invList = invList.insert(invR.getName());
      }
    }

    return invList;
  }
View Full Code Here

  private void translateSub(List<ClauseEntry> outBody, ATermAppl sub, FreeVariableStore freeVar, Node currentVar) {
    AFun fun = sub.getAFun();
    if (ATermUtils.isPrimitive(sub) || ATermUtils.isBottom(sub)) {
      outBody.add(makeSubclassTriple(currentVar, m_Names.get(sub)));
    } else if (fun.equals( ATermUtils.ANDFUN )) {
      ATermList list = (ATermList) sub.getArgument(0);
     
      while( !list.isEmpty() ) {
        ATermAppl conj = (ATermAppl) list.getFirst();
        translateSub(outBody, conj, freeVar, currentVar);
        list = list.getNext();
      }
    } else if (fun.equals( ATermUtils.SOMEFUN )) {
      ATermAppl prop = (ATermAppl) sub.getArgument(0);
      ATermAppl q = (ATermAppl) sub.getArgument(1);
      Node nextVar = freeVar.next();
View Full Code Here

  private void translateSuper(List<ClauseEntry> outHead, ATermAppl sup, FreeVariableStore freeVar, Node currentVar) {
    AFun fun = sup.getAFun();
    if (ATermUtils.isPrimitive(sup) || ATermUtils.isBottom(sup)) {
      outHead.add(makeSubclassTriple(currentVar, m_Names.get(sup)));
    } else if (fun.equals( ATermUtils.ANDFUN )) {
      ATermList list = (ATermList) sup.getArgument(0);
     
      while( !list.isEmpty() ) {
        ATermAppl conj = (ATermAppl) list.getFirst();
        translateSuper(outHead, conj, freeVar, currentVar);
        list = list.getNext();
      }
    } else if (fun.equals( ATermUtils.SOMEFUN )) {
      ATermAppl prop = (ATermAppl) sup.getArgument(0);
      ATermAppl q = (ATermAppl) sup.getArgument(1);
     
View Full Code Here

    AFun fun = sup.getAFun();
    if( ATermUtils.isPrimitive( sup ) || ATermUtils.isBottom( sup ) ) {
      m_Facts.add( makeSubclassFact( anon, sup ) );
    }
    else if( fun.equals( ATermUtils.ANDFUN ) ) {
      ATermList list = (ATermList) sup.getArgument( 0 );

      while( !list.isEmpty() ) {
        ATermAppl conj = (ATermAppl) list.getFirst();
        translateSuperSome( anon, conj );
        list = list.getNext();
      }
    }
    else if( fun.equals( ATermUtils.SOMEFUN ) ) {
      ATermAppl prop = (ATermAppl) sup.getArgument( 0 );
      ATermAppl q = (ATermAppl) sup.getArgument( 1 );
View Full Code Here

    boolean isEL = false;
    if( ATermUtils.isPrimitive( concept ) || ATermUtils.isBottom( concept ) ) {
      isEL = true;
    }
    else if( fun.equals( ATermUtils.ANDFUN ) ) {
      ATermList listEL = (ATermList) concept.getArgument( 0 );

      while( !listEL.isEmpty() ) {
        if( !isEL( (ATermAppl) listEL.getFirst() ) ) {
          break;
        }
        listEL = listEL.getNext();
      }
      isEL = listEL.isEmpty();
    }
    else if( fun.equals( ATermUtils.SOMEFUN ) ) {
      ATermAppl p = (ATermAppl) concept.getArgument( 0 );
      ATermAppl q = (ATermAppl) concept.getArgument( 1 );
      isEL = ATermUtils.isPrimitive(p) && isEL( q );
View Full Code Here

  public static ATermAppl simplify(ATermAppl elConcept) throws InternalReasonerException {
    ATermAppl simp = elConcept;
    AFun fun = elConcept.getAFun();
   
    if( fun.equals( ATermUtils.ANDFUN ) ) {
      ATermList conjuncts = (ATermList) elConcept.getArgument( 0 );
      Set<ATermAppl> set = CollectionUtils.makeSet();
      for( MultiListIterator i = new MultiListIterator( conjuncts ); i.hasNext(); ) {
        ATermAppl c = i.next();
        if( ATermUtils.isAnd( c ) ) {
          i.append( (ATermList) c.getArgument( 0 ) );
View Full Code Here

      defineClass( c1 );
      defineClass( c2 );
      kb.addSubClass( c1, c2 );
    }
    else if( afun.equals( ATermUtils.DISJOINTSFUN ) ) {
      ATermList concepts = (ATermList) axiom.getArgument( 0 );
     
      for( ATermList l = concepts; !l.isEmpty(); l = l.getNext() )
        defineClass( (ATermAppl) l.getFirst() );           
      kb.addDisjointClasses( concepts );
    }
    else if( afun.equals( ATermUtils.DISJOINTFUN ) ) {
      ATermAppl c1 = (ATermAppl) axiom.getArgument( 0 );
      ATermAppl c2 = (ATermAppl) axiom.getArgument( 1 );

      defineClass( c1 );
      defineClass( c2 );
      kb.addDisjointClass( c1, c2 );
    }
    else if( afun.equals( ATermUtils.DISJOINTPROPSFUN ) ) {
      ATermList props = (ATermList) axiom.getArgument( 0 );
     
      for( ATermList l = props; !l.isEmpty(); l = l.getNext() )
        defineProperty( l.getFirst() );
      kb.addDisjointProperties( props );
    }
    else if( afun.equals( ATermUtils.DISJOINTPROPFUN ) ) {
      ATermAppl p1 = (ATermAppl) axiom.getArgument( 0 );
      ATermAppl p2 = (ATermAppl) axiom.getArgument( 1 );

      defineProperty( p1 );
      defineProperty( p2 );
      kb.addDisjointProperty( p1, p2 );
    }
    else if( afun.equals( ATermUtils.SUBPROPFUN ) ) {
      ATerm p1 = axiom.getArgument( 0 );
      ATermAppl p2 = (ATermAppl) axiom.getArgument( 1 );

      defineProperty( p1 );
      defineProperty( p2 );
      kb.addSubProperty( p1, p2 );
    }
    else if( afun.equals( ATermUtils.EQPROPFUN ) ) {
      ATermAppl p1 = (ATermAppl) axiom.getArgument( 0 );
      ATermAppl p2 = (ATermAppl) axiom.getArgument( 1 );

      defineProperty( p1 );
      defineProperty( p2 );
      kb.addEquivalentProperty( p1, p2 );
    }
    else if( afun.equals( ATermUtils.DOMAINFUN ) ) {
      ATermAppl p = (ATermAppl) axiom.getArgument( 0 );
      ATermAppl c = (ATermAppl) axiom.getArgument( 1 );

      defineProperty( p );
      defineClass( c );
      kb.addDomain( p, c );
    }
    else if( afun.equals( ATermUtils.RANGEFUN ) ) {
      ATermAppl p = (ATermAppl) axiom.getArgument( 0 );
      ATermAppl c = (ATermAppl) axiom.getArgument( 1 );

      defineProperty( p );
      defineClass( c );
      kb.addRange( p, c );
    }
    else if( afun.equals( ATermUtils.INVPROPFUN ) ) {
      ATermAppl p1 = (ATermAppl) axiom.getArgument( 0 );
      ATermAppl p2 = (ATermAppl) axiom.getArgument( 1 );

      kb.addObjectProperty( p1 );
      kb.addObjectProperty( p2 );
      kb.addInverseProperty( p1, p2 );
    }
    else if( afun.equals( ATermUtils.TRANSITIVEFUN ) ) {
      ATermAppl p = (ATermAppl) axiom.getArgument( 0 );

      kb.addObjectProperty( p );
      kb.addTransitiveProperty( p );
    }
    else if( afun.equals( ATermUtils.FUNCTIONALFUN ) ) {
      ATermAppl p = (ATermAppl) axiom.getArgument( 0 );

      defineProperty( p );
      kb.addFunctionalProperty( p );
    }
    else if( afun.equals( ATermUtils.INVFUNCTIONALFUN ) ) {
      ATermAppl p = (ATermAppl) axiom.getArgument( 0 );

      kb.addObjectProperty( p );
      kb.addInverseFunctionalProperty( p );
    }
    else if( afun.equals( ATermUtils.SYMMETRICFUN ) ) {
      ATermAppl p = (ATermAppl) axiom.getArgument( 0 );

      kb.addObjectProperty( p );
      kb.addSymmetricProperty( p );
    }
    else if( afun.equals( ATermUtils.ASYMMETRICFUN ) ) {
      ATermAppl p = (ATermAppl) axiom.getArgument( 0 );

      kb.addObjectProperty( p );
      kb.addAsymmetricProperty( p );
    }
    else if( afun.equals( ATermUtils.REFLEXIVEFUN ) ) {
      ATermAppl p = (ATermAppl) axiom.getArgument( 0 );

      kb.addObjectProperty( p );
      kb.addReflexiveProperty( p );
    }
    else if( afun.equals( ATermUtils.IRREFLEXIVEFUN ) ) {
      ATermAppl p = (ATermAppl) axiom.getArgument( 0 );

      kb.addObjectProperty( p );
      kb.addIrreflexiveProperty( p )
    }
    else if( afun.equals( ATermUtils.TYPEFUN ) ) {
      ATermAppl ind = (ATermAppl) axiom.getArgument( 0 );
      ATermAppl cls = (ATermAppl) axiom.getArgument( 1 );

      kb.addIndividual( ind );
      defineClass( cls );
      kb.addType( ind, cls );
    }
    else if( afun.equals( ATermUtils.PROPFUN ) ) {
      ATermAppl p = (ATermAppl) axiom.getArgument( 0 );
      ATermAppl s = (ATermAppl) axiom.getArgument( 1 );
      ATermAppl o = (ATermAppl) axiom.getArgument( 2 );

      kb.addIndividual( s );
      if( ATermUtils.isLiteral( o ) ) {
        kb.addDatatypeProperty( p );
      }
      else {
        kb.addObjectProperty( p );
        kb.addIndividual( o );
      }
      kb.addPropertyValue( p, s, o );
    }
    else if( afun.equals( ATermUtils.NOTFUN )
        && ((ATermAppl) axiom.getArgument( 0 )).getAFun().equals( ATermUtils.PROPFUN ) ) {
      axiom = (ATermAppl) axiom.getArgument( 0 );

      ATermAppl p = (ATermAppl) axiom.getArgument( 0 );
      ATermAppl s = (ATermAppl) axiom.getArgument( 1 );
      ATermAppl o = (ATermAppl) axiom.getArgument( 2 );
     
      kb.addIndividual( s );
      if( ATermUtils.isLiteral( o ) ) {
        kb.addDatatypeProperty( p );
      }
      else {
        kb.addObjectProperty( p );
        kb.addIndividual( o );
      }
      kb.addNegatedPropertyValue( p, s, o );     
    }
    else if( afun.equals( ATermUtils.SAMEASFUN ) ) {
      ATermAppl ind1 = (ATermAppl) axiom.getArgument( 0 );
      ATermAppl ind2 = (ATermAppl) axiom.getArgument( 1 );

      kb.addIndividual( ind1 );
      kb.addIndividual( ind2 );
      kb.addSame( ind1, ind2 );
    }
    else if( afun.equals( ATermUtils.DIFFERENTFUN ) ) {
      ATermAppl ind1 = (ATermAppl) axiom.getArgument( 0 );
      ATermAppl ind2 = (ATermAppl) axiom.getArgument( 1 );

      kb.addIndividual( ind1 );
      kb.addIndividual( ind2 );
      kb.addDifferent( ind1, ind2 );
    }
    else if( afun.equals( ATermUtils.ALLDIFFERENTFUN ) ) {
      ATermList inds = (ATermList) axiom.getArgument( 0 );
     
      for( ATermList l = inds; !l.isEmpty(); l = l.getNext() )
        kb.addIndividual( (ATermAppl) l.getFirst() );
      kb.addAllDifferent( inds );
    }
    else if( afun.equals( ATermUtils.RULEFUN ) ) {
      Set<RuleAtom> antecedent = new HashSet<RuleAtom>(); // Body
      Set<RuleAtom> consequent = new HashSet<RuleAtom>(); // Head

      ATermList head = (ATermList) axiom.getArgument( 1 );
      ATermList body = (ATermList) axiom.getArgument( 2 );

      for( ; !body.isEmpty(); body = body.getNext() )
        antecedent.add( convertRuleAtom( (ATermAppl) body.getFirst() ) );

      for( ; !head.isEmpty(); head = head.getNext() )
        consequent.add( convertRuleAtom( (ATermAppl) head.getFirst() ) );

      if( !antecedent.contains( null ) && !consequent.contains( null ) ) {
View Full Code Here

      AtomIObject io2 = convertAtomIObject( i2 );
     
      atom = new DifferentIndividualsAtom( io1, io2 );     
    }
    else if( term.getAFun().equals( ATermUtils.BUILTINFUN ) ) {
      ATermList args = (ATermList) term.getArgument( 0 );
      ATermAppl builtin = (ATermAppl) args.getFirst();
      List<AtomDObject> list = new ArrayList<AtomDObject>();
      for( args = args.getNext(); !args.isEmpty(); args = args.getNext() ) {
        ATermAppl arg = (ATermAppl) args.getFirst();
        list.add( convertAtomDObject( arg ) );
      }
     
      atom = new BuiltInAtom( builtin.toString(), list );     
    }
View Full Code Here

      }
    }   

    ATermAppl c = sup.getConcept();
    if( ATermUtils.isAnd( c ) ) {
      ATermList list = (ATermList) c.getArgument( 0 );
      while( !list.isEmpty() ) {
        ATermAppl conj = (ATermAppl) list.getFirst();
       
        addToQueue( sub, concepts.get( conj ) );

        list = list.getNext();
      }
    } else if( ATermUtils.isSomeValues( c ) ) {
      ATermAppl p = (ATermAppl) c.getArgument( 0 );
      ATermAppl qualification = (ATermAppl) c.getArgument( 1 );

      addSuccessor( sub, p, concepts.get( qualification ) );
    } else {
      assert ATermUtils.isPrimitive( c );
    }

    Set<ConceptInfo> referredConjunctions = conjunctions.get( sup );
    if( referredConjunctions != null ) {
      for( ConceptInfo conjunction : referredConjunctions ) {
        ATermList list = (ATermList) conjunction.getConcept().getArgument( 0 );
        while( !list.isEmpty() ) {
          ATermAppl conj = (ATermAppl) list.getFirst();
         
          if( !sub.hasSuperClass( concepts.get( conj ) ) ) {
            break;
          }
         
          list = list.getNext();
        }
       
        if( list.isEmpty() ) {
          addToQueue( sub, conjunction );
        }
      }
    }
   
View Full Code Here

TOP

Related Classes of aterm.ATermList

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.