Package aterm

Examples of aterm.ATermList


      for( ATermAppl c : r.getDomains() ) {
        if( ATermUtils.isPrimitive( c ) ) {
          conceptFlags.put( c, ConceptFlag.OTHER );
        }
        else if( ATermUtils.isAnd( c ) ) {
          ATermList list = (ATermList) c.getArgument( 0 );
          for( ; !list.isEmpty(); list = list.getNext() ) {
            ATermAppl d = (ATermAppl) list.getFirst();
            if( ATermUtils.isPrimitive( d ) ) {
              conceptFlags.put( d, ConceptFlag.OTHER );
            }
          }
        }
        else if( ATermUtils.isNot( c ) && ATermUtils.isAnd( (ATermAppl) c.getArgument( 0 ) ) ) {
          ATermList list = (ATermList) ((ATermAppl) c.getArgument( 0 )).getArgument( 0 );
          for( ; !list.isEmpty(); list = list.getNext() ) {
            ATermAppl d = (ATermAppl) list.getFirst();
            if( ATermUtils.isNegatedPrimitive( d ) ) {
              conceptFlags.put( (ATermAppl) d.getArgument( 0 ), ConceptFlag.OTHER );
            }
          }
        }
View Full Code Here


            }
    }
    else if( term.getAFun().equals( ATermUtils.DISJOINTSFUN ) ) {
      Set<OWLClassExpression> descriptions = new HashSet<OWLClassExpression>();

      ATermList concepts = (ATermList) term.getArgument( 0 );
      for( ; !concepts.isEmpty(); concepts = concepts.getNext() ) {
        ATermAppl concept = (ATermAppl) concepts.getFirst();
        OWLClassExpression c = (OWLClassExpression) conceptConverter.convert( concept );
        if( c == null ) {
                  break;
                }

        descriptions.add( c );
      }

      // if no error occurred list will be empty
      if( concepts.isEmpty() ) {
              axiom = factory.getOWLDisjointClassesAxiom( descriptions );
            }
    }
    else if( term.getAFun().equals( ATermUtils.DISJOINTFUN ) ) {
      OWLClassExpression c1 = (OWLClassExpression) conceptConverter.convert( (ATermAppl) term
          .getArgument( 0 ) );
      OWLClassExpression c2 = (OWLClassExpression) conceptConverter.convert( (ATermAppl) term
          .getArgument( 1 ) );

      Set<OWLClassExpression> descriptions = new HashSet<OWLClassExpression>();
      descriptions.add( c1 );
      descriptions.add( c2 );

      if( c1 != null && c2 != null ) {
              axiom = factory.getOWLDisjointClassesAxiom( descriptions );
            }
    }
    else if( term.getAFun().equals( ATermUtils.DISJOINTPROPSFUN ) ) {
      Set<OWLObjectProperty> objProperties = new HashSet<OWLObjectProperty>();
      Set<OWLDataProperty> dataProperties = new HashSet<OWLDataProperty>();

      ATermList props = (ATermList) term.getArgument( 0 );
      for( ; !props.isEmpty(); props = props.getNext() ) {
        OWLObject p = conceptConverter.convert( (ATermAppl) term.getArgument( 0 ) );
        if( p == null ) {
          break;
        }
        else if( p instanceof OWLObjectProperty )  {
          if( !dataProperties.isEmpty() ) {
                      break;
                    }
                    else {
                      objProperties.add( (OWLObjectProperty) p );
                    }
        }
        else {
          if( !objProperties.isEmpty() ) {
                      break;
                    }
                    else {
                      dataProperties.add( (OWLDataProperty) p );
                    }
        }       
      }

      // if no error occurred list will be empty
      if( props.isEmpty() ) {
        if( !objProperties.isEmpty() ) {
                  axiom = factory
              .getOWLDisjointObjectPropertiesAxiom( objProperties );
                }
                else {
                  axiom = factory
              .getOWLDisjointDataPropertiesAxiom( dataProperties );
                }
      }
    }
    else if( term.getAFun().equals( ATermUtils.DISJOINTPROPFUN ) ) {
      OWLObject p1 = conceptConverter.convert( (ATermAppl) term.getArgument( 0 ) );
      OWLObject p2 = conceptConverter.convert( (ATermAppl) term.getArgument( 1 ) );

      if( p1 != null && p2 != null ) {
        if( p1 instanceof OWLObjectProperty && p2 instanceof OWLObjectProperty ) {
                  axiom = factory.getOWLDisjointObjectPropertiesAxiom( SetUtils.create(
              (OWLObjectProperty) p1, (OWLObjectProperty) p2 ) );
                }
                else if( p1 instanceof OWLDataProperty && p2 instanceof OWLDataProperty ) {
                  axiom = factory.getOWLDisjointDataPropertiesAxiom( SetUtils.create(
              (OWLDataProperty) p1, (OWLDataProperty) p2 ) );
                }
      }
    }
    else if( term.getAFun().equals( ATermUtils.SUBPROPFUN ) ) {
      if( term.getArgument( 0 ) instanceof ATermList ) {
        List<OWLObjectPropertyExpression> subs = new ArrayList<OWLObjectPropertyExpression>();
        for( ATermList list = (ATermList) term.getArgument( 0 ); !list.isEmpty(); list = list
            .getNext() ) {
          OWLObjectPropertyExpression p = (OWLObjectPropertyExpression) conceptConverter
              .convert( (ATermAppl) list.getFirst() );
          if( p == null ) {
            subs = null;
            break;
          }
          subs.add( p );
        }
        OWLObjectProperty sup = (OWLObjectProperty) conceptConverter
            .convert( (ATermAppl) term.getArgument( 1 ) );

        if( subs != null && sup != null ) {
          axiom = factory.getOWLSubPropertyChainOfAxiom( subs, sup );
        }
      }
      else {
        OWLObject p1 = conceptConverter.convert( (ATermAppl) term.getArgument( 0 ) );
        OWLObject p2 = conceptConverter.convert( (ATermAppl) term.getArgument( 1 ) );

        if( p1 != null && p2 != null ) {
          if( p1 instanceof OWLObjectPropertyExpression && p2 instanceof OWLObjectPropertyExpression ) {
                      axiom = factory.getOWLSubObjectPropertyOfAxiom( (OWLObjectPropertyExpression) p1,
                (OWLObjectPropertyExpression) p2 );
                    }
                    else if( p1 instanceof OWLDataProperty && p2 instanceof OWLDataProperty ) {
                      axiom = factory.getOWLSubDataPropertyOfAxiom( (OWLDataProperty) p1,
                (OWLDataProperty) p2 );
                    }
        }
      }
    }
    else if( term.getAFun().equals( ATermUtils.EQPROPFUN ) ) {
      OWLObject p1 = conceptConverter.convert( (ATermAppl) term.getArgument( 0 ) );
      OWLObject p2 = conceptConverter.convert( (ATermAppl) term.getArgument( 1 ) );

      if( p1 != null && p2 != null ) {
        if( p1 instanceof OWLObjectProperty && p2 instanceof OWLObjectProperty ) {
                  axiom = factory.getOWLEquivalentObjectPropertiesAxiom( SetUtils.create(
              (OWLObjectProperty) p1, (OWLObjectProperty) p2 ) );
                }
                else if( p1 instanceof OWLDataProperty && p2 instanceof OWLDataProperty ) {
                  axiom = factory.getOWLEquivalentDataPropertiesAxiom( SetUtils.create(
              (OWLDataProperty) p1, (OWLDataProperty) p2 ) );
                }
      }
    }
    else if( term.getAFun().equals( ATermUtils.DOMAINFUN ) ) {
      OWLObject p = conceptConverter.convert( (ATermAppl) term.getArgument( 0 ) );
      OWLClassExpression c = (OWLClassExpression) conceptConverter.convert( (ATermAppl) term
          .getArgument( 1 ) );

      if( c != null && p != null ) {
        if( p instanceof OWLObjectProperty ) {
                  axiom = factory.getOWLObjectPropertyDomainAxiom(
              (OWLObjectPropertyExpression) p, c );
                }
                else {
                  axiom = factory
              .getOWLDataPropertyDomainAxiom( (OWLDataPropertyExpression) p, c );
                }
      }
    }
    else if( term.getAFun().equals( ATermUtils.RANGEFUN ) ) {
      OWLPropertyRange e = (OWLPropertyRange) conceptConverter.convert( (ATermAppl) term
          .getArgument( 1 ) );
      if( e != null ) {
        if( e instanceof OWLClassExpression ) {
          OWLObjectProperty p = (OWLObjectProperty) conceptConverter
              .convert( (ATermAppl) term.getArgument( 0 ) );
          if( p != null ) {
                      axiom = factory.getOWLObjectPropertyRangeAxiom( p, (OWLClassExpression) e );
                    }
        }
        else {
          OWLDataProperty p = (OWLDataProperty) conceptConverter
              .convert( (ATermAppl) term.getArgument( 0 ) );
          if( p != null ) {
                      axiom = factory.getOWLDataPropertyRangeAxiom( p, (OWLDataRange) e );
                    }
        }
      }
    }
    else if( term.getAFun().equals( ATermUtils.INVPROPFUN ) ) {
      OWLObjectProperty p1 = (OWLObjectProperty) conceptConverter.convert( (ATermAppl) term
          .getArgument( 0 ) );
      OWLObjectProperty p2 = (OWLObjectProperty) conceptConverter.convert( (ATermAppl) term
          .getArgument( 1 ) );

      if( p1 != null && p2 != null ) {
              axiom = factory.getOWLInverseObjectPropertiesAxiom( p1, p2 );
            }
    }
    else if( term.getAFun().equals( ATermUtils.TRANSITIVEFUN ) ) {
      OWLObjectProperty p = (OWLObjectProperty) conceptConverter.convert( (ATermAppl) term
          .getArgument( 0 ) );

      if( p != null ) {
              axiom = factory.getOWLTransitiveObjectPropertyAxiom( p );
            }
    }
    else if( term.getAFun().equals( ATermUtils.FUNCTIONALFUN ) ) {
      OWLObject p = conceptConverter.convert( (ATermAppl) term.getArgument( 0 ) );

      if( p != null ) {
        if( p instanceof OWLObjectProperty ) {
                  axiom = factory
              .getOWLFunctionalObjectPropertyAxiom( (OWLObjectPropertyExpression) p );
                }
                else if( p instanceof OWLDataProperty ) {
                  axiom = factory
              .getOWLFunctionalDataPropertyAxiom( (OWLDataPropertyExpression) p );
                }
      }
    }
    else if( term.getAFun().equals( ATermUtils.INVFUNCTIONALFUN ) ) {
      OWLObjectProperty p = (OWLObjectProperty) conceptConverter.convert( (ATermAppl) term
          .getArgument( 0 ) );

      if( p != null ) {
              axiom = factory.getOWLInverseFunctionalObjectPropertyAxiom( p );
            }
    }
    else if( term.getAFun().equals( ATermUtils.SYMMETRICFUN ) ) {
      OWLObject p = conceptConverter.convert( (ATermAppl) term.getArgument( 0 ) );

      if( p != null && p instanceof OWLObjectPropertyExpression ) {
              axiom = factory
            .getOWLSymmetricObjectPropertyAxiom( (OWLObjectPropertyExpression) p );
            }
    }
    else if( term.getAFun().equals( ATermUtils.ASYMMETRICFUN ) ) {
      OWLObject p = conceptConverter.convert( (ATermAppl) term.getArgument( 0 ) );

      if( p != null && p instanceof OWLObjectPropertyExpression ) {
              axiom = factory
            .getOWLAsymmetricObjectPropertyAxiom( (OWLObjectPropertyExpression) p );
            }
    }
    else if( term.getAFun().equals( ATermUtils.REFLEXIVEFUN ) ) {
      OWLObject p = conceptConverter.convert( (ATermAppl) term.getArgument( 0 ) );

      if( p != null && p instanceof OWLObjectPropertyExpression ) {
              axiom = factory
            .getOWLReflexiveObjectPropertyAxiom( (OWLObjectPropertyExpression) p );
            }
    }
    else if( term.getAFun().equals( ATermUtils.IRREFLEXIVEFUN ) ) {
      OWLObject p = conceptConverter.convert( (ATermAppl) term.getArgument( 0 ) );

      if( p != null && p instanceof OWLObjectPropertyExpression ) {
              axiom = factory
            .getOWLIrreflexiveObjectPropertyAxiom( (OWLObjectPropertyExpression) p );
            }
    }
    else if( term.getAFun().equals( ATermUtils.TYPEFUN ) ) {
      OWLIndividual i = conceptConverter.convertIndividual((ATermAppl) term
          .getArgument( 0 ) );
      OWLClassExpression c = (OWLClassExpression) conceptConverter.convert( (ATermAppl) term
          .getArgument( 1 ) );

      if( i != null && c != null ) {
              axiom = factory.getOWLClassAssertionAxiom( c, i );
            }
    }
    else if( term.getAFun().equals( ATermUtils.PROPFUN ) ) {
      OWLIndividual subj = conceptConverter.convertIndividual((ATermAppl) term
          .getArgument( 1 ) );

      if( subj == null ) {
              axiom = null;
            }
            else if( ATermUtils.isLiteral( (ATermAppl) term.getArgument( 2 ) ) ) {
        OWLDataProperty pred = (OWLDataProperty) conceptConverter.convert( (ATermAppl) term
            .getArgument( 0 ) );
        OWLLiteral obj = (OWLLiteral) conceptConverter.convert( (ATermAppl) term
            .getArgument( 2 ) );
        if( pred != null && obj != null ) {
                  axiom = factory.getOWLDataPropertyAssertionAxiom( pred, subj, obj );
                }
      }
      else {
        OWLObjectProperty pred = (OWLObjectProperty) conceptConverter
            .convert( (ATermAppl) term.getArgument( 0 ) );
        OWLIndividual obj = conceptConverter.convertIndividual((ATermAppl) term
            .getArgument( 2 ) );
        if( pred != null && obj != null ) {
                  axiom = factory.getOWLObjectPropertyAssertionAxiom( pred, subj, obj );
                }
      }
    }
    else if( term.getAFun().equals( ATermUtils.NOTFUN )
        && ((ATermAppl) term.getArgument( 0 )).getAFun().equals( ATermUtils.PROPFUN ) ) {
      term = (ATermAppl) term.getArgument( 0 );
      OWLIndividual subj = conceptConverter.convertIndividual((ATermAppl) term
          .getArgument( 1 ) );

      if( subj == null ) {
              axiom = null;
            }
            else if( ATermUtils.isLiteral( (ATermAppl) term.getArgument( 2 ) ) ) {
        OWLDataProperty pred = (OWLDataProperty) conceptConverter.convert( (ATermAppl) term
            .getArgument( 0 ) );
        OWLLiteral obj = (OWLLiteral) conceptConverter.convert( (ATermAppl) term
            .getArgument( 2 ) );
        if( pred != null && obj != null ) {
                  axiom = factory.getOWLNegativeDataPropertyAssertionAxiom( pred, subj, obj );
                }
      }
      else {
        OWLObjectProperty pred = (OWLObjectProperty) conceptConverter
            .convert( (ATermAppl) term.getArgument( 0 ) );
        OWLIndividual obj = conceptConverter.convertIndividual((ATermAppl) term
            .getArgument( 2 ) );
        if( pred != null && obj != null ) {
                  axiom = factory.getOWLNegativeObjectPropertyAssertionAxiom( pred, subj, obj );
                }
      }
    }
    else if( term.getAFun().equals( ATermUtils.SAMEASFUN ) ) {
      OWLIndividual ind1 = conceptConverter.convertIndividual((ATermAppl) term
          .getArgument( 0 ) );
      OWLIndividual ind2 = conceptConverter.convertIndividual((ATermAppl) term
          .getArgument( 1 ) );

      Set<OWLIndividual> inds = new HashSet<OWLIndividual>();
      inds.add( ind1 );
      inds.add( ind2 );

      if( ind1 != null && ind2 != null ) {
              axiom = factory.getOWLSameIndividualAxiom( inds );
            }
    }
    else if( term.getAFun().equals( ATermUtils.DIFFERENTFUN ) ) {
      OWLIndividual ind1 = conceptConverter.convertIndividual((ATermAppl) term
          .getArgument( 0 ) );
      OWLIndividual ind2 = conceptConverter.convertIndividual((ATermAppl) term
          .getArgument( 1 ) );

      Set<OWLIndividual> inds = new HashSet<OWLIndividual>();
      inds.add( ind1 );
      inds.add( ind2 );

      if( ind1 != null && ind2 != null ) {
              axiom = factory.getOWLDifferentIndividualsAxiom( inds );
            }
    }
    else if( term.getAFun().equals( ATermUtils.ALLDIFFERENTFUN ) ) {
      Set<OWLIndividual> individuals = new HashSet<OWLIndividual>();

      ATermList list = (ATermList) term.getArgument( 0 );
      for( ; !list.isEmpty(); list = list.getNext() ) {
        ATermAppl ind = (ATermAppl) list.getFirst();
        OWLIndividual i = conceptConverter.convertIndividual(ind);
        if( i == null ) {
                  break;
                }

        individuals.add( i );
      }

      // if no error occurred list will be empty
      if( list.isEmpty() ) {
              axiom = factory.getOWLDifferentIndividualsAxiom( individuals );
            }
    }
    else if( term.getAFun().equals( ATermUtils.RULEFUN ) ) {
      Set<SWRLAtom> antecedent = new HashSet<SWRLAtom>(); // Body
      Set<SWRLAtom> consequent = new HashSet<SWRLAtom>(); // Head

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

      for( ; !body.isEmpty(); body = body.getNext() ) {
              antecedent.add( parseToSWRLAtom( (ATermAppl) body.getFirst() ) );
            }

      for( ; !head.isEmpty(); head = head.getNext() ) {
              consequent.add( parseToSWRLAtom( (ATermAppl) head.getFirst() ) );
            }
View Full Code Here

          return true;
        }

    if( ATermUtils.isAnd( desc ) ) {
      boolean allCDConj = true;
      ATermList conj = (ATermList) desc.getArgument( 0 );
      for( ATermList subConj = conj; allCDConj && !subConj.isEmpty(); subConj = subConj
          .getNext() ) {
        ATermAppl ci = (ATermAppl) subConj.getFirst();
        allCDConj = isCDDesc( ci );
      }
View Full Code Here

          return;
        }

    if( !ATermUtils.isPrimitive( c ) ) {
      if( c.getAFun().equals( ATermUtils.ORFUN ) ) {
        ATermList list = (ATermList) c.getArgument( 0 );
        for( ATermList disj = list; !disj.isEmpty(); disj = disj.getNext() ) {
          ATermAppl e = (ATermAppl) disj.getFirst();
          addToldRelation( e, d, false, explanation );
        }
      }
    }
    else if( ATermUtils.isPrimitive( d ) ) {
      if( ATermUtils.isBnode( d ) ) {
              return;
            }

      if( !equivalent ) {
        if( log.isLoggable( Level.FINER ) ) {
                  log.finer( "Preclassify (1) " + format( c ) + " " + format( d ) );
                }

        addToldSubsumer( c, d, explanation );
      }
      else {
        if( log.isLoggable( Level.FINER ) ) {
                  log.finer( "Preclassify (2) " + format( c ) + " " + format( d ) );
                }

        addToldEquivalent( c, d );
      }
    }
    else if( d.getAFun().equals( ATermUtils.ANDFUN ) ) {
      for( ATermList conj = (ATermList) d.getArgument( 0 ); !conj.isEmpty(); conj = conj
          .getNext() ) {
        ATermAppl e = (ATermAppl) conj.getFirst();
        addToldRelation( c, e, false, explanation );
      }
    }
    else if( d.getAFun().equals( ATermUtils.ORFUN ) ) {
      boolean allPrimitive = true;

      ATermList list = (ATermList) d.getArgument( 0 );
      for( ATermList disj = list; !disj.isEmpty(); disj = disj.getNext() ) {
        ATermAppl e = (ATermAppl) disj.getFirst();
        if( ATermUtils.isPrimitive( e ) ) {
          if( equivalent ) {
            if( log.isLoggable( Level.FINER ) ) {
View Full Code Here

      SWRLIArgument io2 = parseToAtomIObject( i2 );
     
      atom = factory.getSWRLDifferentIndividualsAtom( io1, io2 );     
    }
    else if( term.getAFun().equals( ATermUtils.BUILTINFUN ) ) {
      ATermList args = (ATermList) term.getArgument( 0 );
      ATermAppl builtin = (ATermAppl) args.getFirst();
      List<SWRLDArgument> list = new ArrayList<SWRLDArgument>();
      for( args = args.getNext(); !args.isEmpty(); args = args.getNext() ) {
        ATermAppl arg = (ATermAppl) args.getFirst();
        list.add( parseToAtomDObject( arg ) );
      }
      atom = factory.getSWRLBuiltInAtom( IRI.create( builtin.getName() ), list );
    }
View Full Code Here

      addDisjointAxiom( c1, c2, axioms );
    }
    else if( axiom.getAFun().equals( ATermUtils.DISJOINTSFUN ) ) {
      axioms = CollectionUtils.makeList();     
     
      ATermList concepts = (ATermList) axiom.getArgument( 0 );     
      for( ATermList l1 = concepts; !l1.isEmpty(); l1 = l1.getNext() ) {
        ATermAppl c1 = (ATermAppl) l1.getFirst();
        for( ATermList l2 = l1.getNext(); !l2.isEmpty(); l2 = l2.getNext() ) {
          ATermAppl c2 = (ATermAppl) l2.getFirst();
          addDisjointAxiom( c1, c2, axioms );
View Full Code Here

    setBranch( remember );
  }

  public void addAllDifferent(ATermList list) {
    ATermAppl allDifferent = ATermUtils.makeAllDifferent( list );
    ATermList outer = list;
    while( !outer.isEmpty() ) {
      ATermList inner = outer.getNext();
      while( !inner.isEmpty() ) {
        Individual ind1 = getIndividual( outer.getFirst() );
        Individual ind2 = getIndividual( inner.getFirst() );

        // update syntactic assertions - currently i do not add this to
        // the dependency index
        // now, as it will be added during the actual merge when the
        // completion is performed
        if( PelletOptions.USE_INCREMENTAL_DELETION ) {
                  kb.getSyntacticAssertions().add( allDifferent );
                }

        DependencySet ds = PelletOptions.USE_TRACING
          ? new DependencySet( allDifferent )
          : DependencySet.INDEPENDENT;
         
        final int remember = branch;
        setBranch( DependencySet.NO_BRANCH );
       
        ind1.setDifferent( ind2, ds );
       
        setBranch( remember );

        inner = inner.getNext();
      }
      outer = outer.getNext();
    }
  }
View Full Code Here

      ATermAppl c2 = (ATermAppl) axiom.getArgument( 1 );
     
      axioms = normalizeDisjointAxiom(c1, c2);
    }
    else if( axiom.getAFun().equals( ATermUtils.DISJOINTSFUN ) ) {
      ATermList list = (ATermList) axiom.getArgument( 0 )
      ATermAppl[] concepts = ATermUtils.toArray( list );
     
      axioms = normalizeDisjointAxiom(concepts);
    }
    else {
View Full Code Here

      return false;
    }
   
    public Iterator<ATermAppl> getNominals(ATermAppl term) {
      if( isOneOf( term ) ) {
        ATermList list = (ATermList) term.getArgument( 0 );
        return new MultiListIterator( list );
      }
      else if( isNominal( term ) ) {
        return IteratorUtils.singletonIterator( term );
      }
View Full Code Here

    changes.add( ChangeType.ABOX_ADD );

    // if we can use incremental consistency checking then add to
    // pseudomodel
    if( canUseIncConsistency() ) {
      ATermList outer = list;
      // add to updated inds
      while( !outer.isEmpty() ) {
        ATermList inner = outer.getNext();
        while( !inner.isEmpty() ) {
          // TODO: refactor the access to the updatedIndividuals and
          // newIndividuals - add get method
          abox.getIncrementalChangeTracker().addUpdatedIndividual(
              abox.getIndividual( outer.getFirst() ) );
          abox.getIncrementalChangeTracker().addUpdatedIndividual(
              abox.getIndividual( inner.getFirst() ) );
          inner = inner.getNext();
        }
        outer = outer.getNext();
      }

      // add to pseudomodel - note branch must be temporarily set to 0 to
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.