Package aterm

Examples of aterm.AFun


    ATermAppl and = ATermUtils.makeSimplifiedAnd( Arrays.asList( c1, c2 ) );
    createConceptsFromAxiom( and, ATermUtils.BOTTOM );
  }

  private void processAxiom(ATermAppl axiom) {
    AFun fun = axiom.getAFun();

    if( fun.equals( ATermUtils.DISJOINTSFUN ) ) {
      ATermList concepts = (ATermList) axiom.getArgument( 0 );
      int n = concepts.getLength();
      ATermAppl[] simplified = new ATermAppl[n];
      for( int i = 0; !concepts.isEmpty(); concepts = concepts.getNext(), i++ ) {
        simplified[i] = ELSyntaxUtils.simplify( (ATermAppl) concepts.getFirst() );
      }
      for( int i = 0; i < n - 1; i++ ) {
        for( int j = i + 1; j < n; j++ ) {
          createDisjointAxiom( simplified[i], simplified[j] );
        }
      }
    }
    else {
      ATermAppl sub = (ATermAppl) axiom.getArgument( 0 );
      ATermAppl sup = (ATermAppl) axiom.getArgument( 1 );

      sub = ELSyntaxUtils.simplify( sub );
      sup = ELSyntaxUtils.simplify( sup );

      if( fun.equals( ATermUtils.SUBFUN ) ) {
        createConceptsFromAxiom( sub, sup );
      }
      else if( fun.equals( ATermUtils.EQCLASSFUN ) ) {
        createConceptsFromAxiom( sub, sup );
        createConceptsFromAxiom( sup, sub );
      }
      else if( fun.equals( ATermUtils.DISJOINTFUN ) ) {
        createDisjointAxiom( sub, sup );
      }
      else {
        throw new IllegalArgumentException( "Axiom " + axiom + " is not EL." );
      }
View Full Code Here


public abstract class ATermBaseVisitor implements ATermVisitor {
    public static final ATermAppl OWL_THING   = ATermUtils.makeTermAppl(Namespaces.OWL + "Thing");
    public static final ATermAppl OWL_NOTHING = ATermUtils.makeTermAppl(Namespaces.OWL + "Nothing");
   
    public void visit(ATermAppl term) {
        AFun af = term.getAFun();
       
        if(term.equals(ATermUtils.TOP)) {
            visitTerm(OWL_THING);
        }
        else if(term.equals(ATermUtils.BOTTOM)) {
            visitTerm(OWL_NOTHING);
        }
        else if(af.getArity() == 0) {
        visitTerm(term);
    }
        else if(af.equals(ATermUtils.BNODE_FUN)) {
        visitTerm(term);
    }
    else if (af.equals(ATermUtils.ANDFUN)) {
        visitAnd(term);
    }
    else if (af.equals(ATermUtils.ORFUN)) {
        if(ATermUtils.isOneOf(term))
            visitOneOf(term);
        else
            visitOr(term);
    }
    else if (af.equals(ATermUtils.NOTFUN)) {
        visitNot(term);
    }
    else if (af.equals(ATermUtils.ALLFUN)) {
        visitAll(term);
    }
    else if (af.equals(ATermUtils.SOMEFUN)) {
        if(ATermUtils.isHasValue(term))
            visitHasValue(term);
        else
            visitSome(term);
    }
    else if (af.equals(ATermUtils.MINFUN)) {
        visitMin(term);
    }
    else if(af.equals(ATermUtils.MAXFUN)) {   
        visitMax(term);
    }
    else if(af.equals(ATermUtils.CARDFUN)) {   
        visitCard(term);
    }
    else if(af.equals(ATermUtils.VALUEFUN)) {   
        visitValue(term);
    }
    else if(af.equals(ATermUtils.LITFUN)) {   
        visitLiteral(term);
    }
        else if(af.equals(ATermUtils.SELFFUN)) {    
            visitSelf(term);
        }
        else if(af.equals(ATermUtils.INVFUN)) {    
            visitInverse(term);
        }
        else if(af.equals(ATermUtils.RESTRDATATYPEFUN)) {
          visitRestrictedDatatype(term);
        }
    else {
        throw new InternalReasonerException("Invalid term " + term);       
    }
View Full Code Here

    else {
      // there is no other explanation for this dependant axiom so
      // we can safely remove it
      success |= (tboxAxioms.remove( dependantAxiom ) != null);
 
      AFun fun = dependantAxiom.getAFun();
      if( fun.equals( ATermUtils.SUBFUN ) || fun.equals( ATermUtils.EQCLASSFUN ) ) {
        // remove the axiom fom Tu and Tg
        success |= Tu.removeDef( dependantAxiom );
        success |= Tg.removeDef( dependantAxiom );
      }
    }
View Full Code Here

  }

  public boolean addDef(ATermAppl appl) {
    boolean added = false;   
   
    AFun fun = appl.getAFun();
    if( fun.equals( ATermUtils.SUBFUN ) ) {
      added = subClassAxioms.contains(appl) ? false : subClassAxioms.add( appl );
    }
    else if( fun.equals( ATermUtils.EQCLASSFUN ) ) {
      added = eqClassAxioms.contains(appl) ? false : eqClassAxioms.add( appl );
    }
    else {
      throw new RuntimeException( "Cannot add non-definition!" );
    }
View Full Code Here

  }

  public boolean removeDef(ATermAppl axiom) {
    boolean removed;

    AFun fun = axiom.getAFun();
    if( fun.equals( ATermUtils.SUBFUN ) ) {
      removed = subClassAxioms.remove( axiom );
    }
    else if( fun.equals( ATermUtils.EQCLASSFUN ) ) {
      removed = eqClassAxioms.remove( axiom );
    }
    else {
      throw new RuntimeException( "Cannot remove non-definition!" );
    }
View Full Code Here

    // there is no other explanation for this dependant axiom so
    // we can safely remove it
    removed |= (tboxAxioms.remove( dependantAxiom ) != null);

    AFun fun = dependantAxiom.getAFun();
    if( fun.equals( ATermUtils.SUBFUN ) || fun.equals( ATermUtils.EQCLASSFUN ) ) {
      // remove the axiom fom Tu and Tg
//      removed |= Tu.removeDef( dependantAxiom );
//      removed |= Tg.removeDef( dependantAxiom );
    }
View Full Code Here

     
      return true;
    }
   
    protected int processClass(AtomIObject var, ATermAppl c, List<RuleAtom> atoms, int varCount) {
      AFun afun = c.getAFun();
      if( afun.equals( ATermUtils.ANDFUN ) ) {
        for( ATermList list = (ATermList) c.getArgument( 0 ); !list.isEmpty(); list = list.getNext() ) {
          ATermAppl conjunct = (ATermAppl) list.getFirst();
          varCount = processClass( var, conjunct, atoms, varCount );
        }
      }
      else if( afun.equals( ATermUtils.SOMEFUN ) ) {
        ATermAppl p = (ATermAppl) c.getArgument( 0 );
        ATermAppl filler = (ATermAppl) c.getArgument( 1 );
       
        if( filler.getAFun().equals( ATermUtils.VALUEFUN ) ) {
          ATermAppl nominal = (ATermAppl) filler.getArgument( 0 );
View Full Code Here

     
      return varCount;
    }
   
    protected void processDatatype(AtomDObject var, ATermAppl c, List<RuleAtom> atoms) {
      AFun afun = c.getAFun();
      if( afun.equals( ATermUtils.ANDFUN ) ) {
        for( ATermList list = (ATermList) c.getArgument( 0 ); !list.isEmpty(); list = list.getNext() ) {
          ATermAppl conjunct = (ATermAppl) list.getFirst();
          processDatatype( var, conjunct, atoms );
        }
      }
      else if( afun.equals( ATermUtils.RESTRDATATYPEFUN ) ) {
        ATermAppl baseDatatype = (ATermAppl) c.getArgument( 0 );
       
        atoms.add( new DataRangeAtom( baseDatatype, var ) );
       
        for( ATermList list = (ATermList) c.getArgument( 1 ); !list.isEmpty(); list = list.getNext() ) {
View Full Code Here

    m_Rules.add(new Rule(body, head));
  }

  private void translateSub(List<TermTuple> outBody, ATermAppl sub,
      FreeVariableStore freeVar, ATermAppl currentVar) {
    AFun fun = sub.getAFun();
    if (ATermUtils.isPrimitive(sub) || ATermUtils.isBottom(sub)) {
      outBody.add(makeSubclassTuple(currentVar, 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);
      ATermAppl nextVar = freeVar.next();
      outBody.add(makeSubOfSomeTuple(currentVar, prop, nextVar));
      translateSub(outBody, q, freeVar, nextVar);
View Full Code Here

    }
  }

  private void translateSuper(List<TermTuple> outHead, ATermAppl sup,
      FreeVariableStore freeVar, ATermAppl currentVar) {
    AFun fun = sup.getAFun();
    if (ATermUtils.isPrimitive(sup) || ATermUtils.isBottom(sup)) {
      outHead.add(makeSubclassTuple(currentVar, 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);

      if (!ATermUtils.isPrimitive(q) && !ATermUtils.isBottom(q)) {
        // Normalization - breaking complex concepts within someValues
View Full Code Here

TOP

Related Classes of aterm.AFun

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.