Package aterm

Examples of aterm.ATermList


    if( node == null ) {
      return ATermUtils.EMPTY_LIST;
    }
   
    ATermAppl first = node2term( node );
    ATermList rest = createList( i );
    ATermList list = ATermUtils.makeList( first, rest );

    return list;
  }
View Full Code Here


        if( expr != null ) {
          Node exprType = expr.getPredicate();
          Node exprValue = expr.getObject();

          if( exprType.equals( OWL.intersectionOf.asNode() ) ) {
            ATermList list = createList( exprValue );
            aTerm = ATermUtils.makeAnd( list );
          }
          else if( exprType.equals( OWL.unionOf.asNode() ) ) {
            ATermList list = createList( exprValue );
            aTerm = ATermUtils.makeOr( list );
          }
          else if( exprType.equals( OWL.complementOf.asNode() )
              || exprType.equals( OWL2.datatypeComplementOf.asNode() ) ) {
            ATermAppl complement = node2term( exprValue );
            aTerm = ATermUtils.makeNot( complement );
          }
          else if( exprType.equals( OWL.inverseOf.asNode() ) ) {
            ATermAppl inverse = node2term( exprValue );
            aTerm = ATermUtils.makeInv( inverse );
          }
          else if( exprType.equals( OWL.oneOf.asNode() ) ) {
            ATermList list = createList( exprValue );
            ATermList result = ATermUtils.EMPTY_LIST;
            if( list.isEmpty() ) {
              aTerm = ATermUtils.BOTTOM;
            }
            else {
              for( ATermList l = list; !l.isEmpty(); l = l.getNext() ) {
                ATermAppl c = (ATermAppl) l.getFirst();
                ATermAppl nominal = ATermUtils.makeValue( c );
                result = result.insert( nominal );
              }

              aTerm = ATermUtils.makeOr( result );
            }
          }
View Full Code Here

                      subProp = st;
                    }
        }
        else if( expr.getPredicate().equals( OWL2.propertyChain.asNode() ) ) {
          subProp = createList( expr.getObject() );
          ATermList list = (ATermList) subProp;
          while( !list.isEmpty() ) {
            if( !defineObjectProperty( (ATermAppl) list.getFirst() ) ) {
              break;
            }
            list = list.getNext();
          }
          if( !list.isEmpty() || !defineObjectProperty( ot ) ) {
                      subProp = null;
                    }
        }
        else {
          addUnsupportedFeature( "Bnode in rdfs:subProperty axioms is not a valid property expression" );
        }
      }
      else if( defineProperties( st, ot ) ) {
        subProp = st;
      }

      if( subProp != null ) {
              kb.addSubProperty( subProp, ot );
            }
            else {
              addUnsupportedFeature( "Ignoring subproperty axiom between " + st + " ("
            + kb.getPropertyType( st ) + "Property) and " + ot + " ("
            + kb.getPropertyType( ot ) + "Property)" );
            }

      break;

    case RDFS_domain:
      if( kb.isAnnotationProperty( st ) ) {
        addUnsupportedFeature( "Ignoring domain axiom for AnnotationProperty " + st );
      }
      else {
        defineProperty( st );
        defineClass( ot );
        kb.addDomain( st, ot );
      }
      break;

    case RDFS_range:
      if( kb.isAnnotationProperty( st ) ) {
        addUnsupportedFeature( "Ignoring range axiom for AnnotationProperty " + st );
        break;
      }

      if( kb.isDatatype( ot ) ) {
              defineDatatypeProperty( st );
            }
            else if( kb.isClass( ot ) ) {
              defineObjectProperty( st );
            }
            else {
              defineProperty( st );
            }

      if( kb.isDatatypeProperty( st ) ) {
              defineDatatype( ot );
            }
            else if( kb.isObjectProperty( st ) ) {
              defineClass( ot );
            }

      kb.addRange( st, ot );

      break;

    case OWL_intersectionOf:
      ATermList list = createList( o );

      defineClass( st );
      ATermAppl conjunction = ATermUtils.makeAnd( list );

      kb.addEquivalentClass( st, conjunction );
      break;

    case OWL_unionOf:
      list = createList( o );

      defineClass( st );
      ATermAppl disjunction = ATermUtils.makeOr( list );
      kb.addEquivalentClass( st, disjunction );

      break;

    case OWL2_disjointUnionOf:
      list = createList( o );

      kb.addDisjointClasses( list );

      defineClass( st );
      disjunction = ATermUtils.makeOr( list );
      kb.addEquivalentClass( st, disjunction );

      break;

    case OWL_complementOf:
      if( !defineClass( st ) ) {
              addUnsupportedFeature( "Ignoring complementOf axiom because the subject is not a class "
            + st + " owl:complementOf " + ot );
            }
            else if( !defineClass( ot ) ) {
              addUnsupportedFeature( "Ignoring complementOf axiom because the object is not a class "
            + st + " owl:complementOf " + ot );
            }
            else {
        kb.addComplementClass( st, ot );
      }
      break;

    case OWL_equivalentClass:
      if( kb.isDatatype( ot ) || anonDatatypes.contains( o ) ) {
        if( !defineDatatype( st ) ) {
                  addUnsupportedFeature( "Ignoring equivalentClass axiom because the subject is not a datatype "
              + st + " owl:equivalentClass " + ot );
                }
                else {
                  kb.addDatatypeDefinition( st, ot );
                }
      }
      else if( !defineClass( st ) ) {
              addUnsupportedFeature( "Ignoring equivalentClass axiom because the subject is not a class "
            + st + " owl:equivalentClass " + ot );
            }
            else if( !defineClass( ot ) ) {
              addUnsupportedFeature( "Ignoring equivalentClass axiom because the object is not a class "
            + st + " owl:equivalentClass " + ot );
            }
            else {
              kb.addEquivalentClass( st, ot );
            }
   
      break;

    case OWL_disjointWith:
      if( !defineClass( st ) ) {
              addUnsupportedFeature( "Ignoring disjointWith axiom because the subject is not a class "
            + st + " owl:disjointWith " + ot );
            }
            else if( !defineClass( ot ) ) {
              addUnsupportedFeature( "Ignoring disjointWith axiom because the object is not a class "
            + st + " owl:disjointWith " + ot );
            }
            else {
        kb.addDisjointClass( st, ot );
      }
      break;

    case OWL2_propertyDisjointWith:
      if( defineProperties( st, ot ) ) {
        kb.addDisjointProperty( st, ot );

        addSimpleProperty( st, DISJOINT );
        addSimpleProperty( ot, DISJOINT );
      }
            else {
              addUnsupportedFeature( "Ignoring disjoint property axiom between " + st + " ("
            + kb.getPropertyType( st ) + "Property) and " + ot + " ("
            + kb.getPropertyType( ot ) + "Property)" );
            }
      break;

    case OWL2_propertyChainAxiom:
      ATermAppl superProp = null;
      if( s.isBlank() ) {
        Triple expr = getExpression( s );
        if( expr == null ) {
          addUnsupportedFeature( "Bnode in owl:propertyChainAxiom axiom is not a valid property expression" );
        }
        else if( expr.getPredicate().equals( OWL2.inverseOf.asNode() ) ) {
          if( defineObjectProperty( (ATermAppl) st.getArgument( 0 ) ) ) {
                      superProp = st;
                    }
        }
        else {
          addUnsupportedFeature( "Bnode in owl:propertyChainAxiom axiom is not a valid property expression" );
        }
      }
      else if( defineObjectProperty( st ) ) {
        superProp = st;
      }

      subProp = createList( o );
      list = (ATermList) subProp;
      while( !list.isEmpty() ) {
        if( !defineObjectProperty( (ATermAppl) list.getFirst() ) ) {
          break;
        }
        list = list.getNext();
      }
      if( !list.isEmpty() ) {
              subProp = null;
            }

      if( subProp != null && superProp != null ) {
              kb.addSubProperty( subProp, superProp );
            }
            else {
              addUnsupportedFeature( "Ignoring property chain axiom between " + st + " ("
            + kb.getPropertyType( st ) + "Property) and " + ot );
            }
      break;

    case OWL_equivalentProperty:
      if( defineProperties( st, ot ) ) {
              kb.addEquivalentProperty( st, ot );
            }
            else {
              addUnsupportedFeature( "Ignoring equivalent property axiom between " + st + " ("
            + kb.getPropertyType( st ) + "Property) and " + ot + " ("
            + kb.getPropertyType( ot ) + "Property)" );
            }

      break;

    case OWL_inverseOf:
      if( defineObjectProperty( st ) && defineObjectProperty( ot ) ) {
              kb.addInverseProperty( st, ot );
            }
            else {
              addUnsupportedFeature( "Ignoring inverseOf axiom between " + st + " ("
            + kb.getPropertyType( st ) + "Property) and " + ot + " ("
            + kb.getPropertyType( ot ) + "Property)" );
            }

      break;

    case OWL_sameAs:
      if( defineIndividual( st ) && defineIndividual( ot ) ) {
              kb.addSame( st, ot );
            }
            else {
              addUnsupportedFeature( "Ignoring sameAs axiom between " + st + " and " + ot );
            }
      break;

    case OWL_differentFrom:
      if( defineIndividual( st ) && defineIndividual( ot ) ) {
              kb.addDifferent( st, ot );
            }
            else {
              addUnsupportedFeature( "Ignoring differentFrom axiom between " + st + " and " + ot );
            }
      break;

    case OWL_distinctMembers:
      list = createList( o );
      for( ATermList l = list; !l.isEmpty(); l = l.getNext() ) {
        ATermAppl c = (ATermAppl) l.getFirst();
        defineIndividual( c );
      }

      kb.addAllDifferent( list );
      break;
     
    case OWL_members:
      BuiltinTerm entityType = null;
      if( preprocessTypeTriples ) {
        entityType = naryDisjoints.get( s );
      }
      else {
        Node type = getObject( s, RDF.type.asNode() );
        if( type != null ) {
                  entityType = BuiltinTerm.find( type );
                }
      }

      if( entityType == null ) {
        addUnsupportedFeature( "There is no valid rdf:type for an owl:members assertion: "
            + s );
      }
      else if( !OWL_MEMBERS_TYPES.contains( entityType ) ) {
        addUnsupportedFeature( "The rdf:type for an owl:members assertion is not recognized: "
            + entityType );
      }
      else {
        list = createList( o );
        for( ATermList l = list; !l.isEmpty(); l = l.getNext() ) {
          ATermAppl c = (ATermAppl) l.getFirst();
          switch ( entityType ) {
          case OWL_AllDifferent:
            defineIndividual( c );
            break;
          case OWL2_AllDisjointClasses:
            defineClass( c );
            break;
          case OWL2_AllDisjointProperties:
            defineProperty( c );
            break;
          }
        }

        switch ( entityType ) {
        case OWL_AllDifferent:
          kb.addAllDifferent( list );
          break;
        case OWL2_AllDisjointClasses:
          kb.addDisjointClasses( list );
          break;
        case OWL2_AllDisjointProperties:
          kb.addDisjointProperties( list );
          break;
        }
      }
      break;

    case OWL_oneOf:
      ATermList resultList = ATermUtils.EMPTY_LIST;

      if( kb.isDatatype( st ) ) {
              return;
            }

      // assert the subject is a class
      defineClass( st );

      disjunction = null;
      list = createList( o );
      if( o.equals( RDF.nil.asNode() ) ) {
              disjunction = ATermUtils.BOTTOM;
            }
            else {
        for( ATermList l = list; !l.isEmpty(); l = l.getNext() ) {
          ATermAppl c = (ATermAppl) l.getFirst();

          if( PelletOptions.USE_PSEUDO_NOMINALS ) {
            ATermAppl nominal = ATermUtils.makeTermAppl( c.getName() + "_nominal" );
            resultList = resultList.insert( nominal );

            defineClass( nominal );
            defineIndividual( c );
            kb.addType( c, nominal );
          }
          else {
            defineIndividual( c );

            resultList = resultList.insert( ATermUtils.makeValue( c ) );
          }
        }
        disjunction = ATermUtils.makeOr( resultList );
      }
      kb.addEquivalentClass( st, disjunction );
View Full Code Here

      }
    }
   
    ATermAppl q = qi.getConcept();
    if (ATermUtils.isAnd(q)) {
      ATermList list = (ATermList) q.getArgument( 0 );
      while( !list.isEmpty() ) {
        ATermAppl conj = (ATermAppl) list.getFirst();
        ConceptInfo conjInfo = createConcept(conj);
        if( ci.addSuccessor( prop, conjInfo ) ) {
          ATermAppl some = ATermUtils.makeSomeValues( prop, conj );
          ConceptInfo si = createConcept( some );
          addToQueue( ci, si.getTriggers() );
        }

        list = list.getNext();
      }
    }

    ATermAppl propRange = roleRestrictions.getRange(prop);
    if (propRange != null) {
View Full Code Here

    ATermAppl c = supInfo.getConcept();
    if( logger.isLoggable( Level.FINE ) )
      logger.fine( "Adding subsumers to " + ci + " " + c + " " + ci.getSuperClasses() );

    if( ATermUtils.isAnd( c ) ) {
      ATermList list = (ATermList) c.getArgument( 0 );
      while( !list.isEmpty() ) {
        ATermAppl conj = (ATermAppl) list.getFirst();
       
        addSubsumer( ci, createConcept( conj ) );

        list = list.getNext();
      }
    } else if( ATermUtils.isSomeValues( c ) ) {
      ATermAppl p = (ATermAppl) c.getArgument( 0 );
      ATermAppl qualification = (ATermAppl) c.getArgument( 1 );
      ConceptInfo q = createConcept( qualification );
View Full Code Here

      /*
       * Step 1: the input conjunction may have conjunctions as arguments.
       * After this step, <code>conjuncts</code> is the flattened list of
       * conjuncts, each in DNF
       */
      ATermList rootConjuncts = (ATermList) term.getArgument( 0 );
      List<ATermAppl> conjuncts = new ArrayList<ATermAppl>();
      MultiListIterator i = new MultiListIterator( rootConjuncts );
      while( i.hasNext() ) {
        ATermAppl a = i.next();
        if( isAnd( a ) )
          i.append( (ATermList) a.getArgument( 0 ) );
        else {
          ATermAppl dnfA = dnfFromNnf( a );
          conjuncts.add( dnfA );
        }
      }

      /*
       * Step 2: element-wise distribute any disjunction among the
       * conjuncts.
       */
      List<ATermAppl> disjuncts = new ArrayList<ATermAppl>();
      for( ATermAppl a : conjuncts ) {
        if( disjuncts.isEmpty() ) {
          addToList( a, isOr( a ), disjuncts );
        }
        else {
          List<ATermAppl> thisArgs = new ArrayList<ATermAppl>();
          List<ATermAppl> newDisjuncts = new ArrayList<ATermAppl>();
          addToList( a, isOr( a ), thisArgs );

          for( ATermAppl a1 : thisArgs ) {
            for( ATermAppl b : disjuncts ) {
              List<ATermAppl> list = new ArrayList<ATermAppl>();
              addToList( a1, isAnd( a1 ), list );
              addToList( b, isAnd( b ), list );             
              newDisjuncts.add( makeAnd( toSet( list ) ) );
            }
          }
          disjuncts = newDisjuncts;
        }
      }

      dnf = makeOr( toSet( disjuncts ) );

    }
    /*
     * If the term is a disjunction merge each element into DNF
     */
    else if( ORFUN.equals( fun ) ) {
      ATermList disjuncts = (ATermList) term.getArgument( 0 );
      MultiListIterator i = new MultiListIterator( disjuncts );
      List<ATermAppl> args = new ArrayList<ATermAppl>();
      while( i.hasNext() ) {
        ATermAppl a = i.next();
        if( isOr( a ) )
View Full Code Here

      AFun fun = axiom.getAFun();

      if( fun.equals( ATermUtils.DISJOINTSFUN ) ) {
        m_Expressivity.setHasDisjointClasses( true );

        ATermList args = (ATermList) axiom.getArgument( 0 );
        for( ; !args.isEmpty(); args = args.getNext() ) {
          if( !isEL( (ATermAppl) args.getFirst() ) ) {
            return false;
          }
        }
      }
      else {
View Full Code Here

    setTransitive(b, ds);
  }

  public void setTransitive(boolean b, DependencySet ds) {

        ATermList roleChain = ATermUtils.makeList( new ATerm[] { name, name } );
        if( b ) {
            flags |= TRANSITIVE;
            explainTransitive = ds;
            addSubRoleChain( roleChain, ds );
        }
View Full Code Here

      RestrictedDatatype<?> dr = (RestrictedDatatype<?>) dt;

      /*
       * Apply each constraining facet value pair in turn
       */
      final ATermList facetValues = (ATermList) a.getArgument(1);
      for (ATermList l = facetValues; !l.isEmpty(); l = l.getNext()) {
        final ATermAppl fv = (ATermAppl) l.getFirst();
        final ATermAppl facet = (ATermAppl) fv.getArgument(0);
        final ATermAppl valueTerm = (ATermAppl) fv.getArgument(1);

View Full Code Here

  public static ATermAppl hasValue(ATermAppl r, ATermAppl ind) {
    return ATermUtils.makeHasValue( r, ind );
  }

  public static ATermAppl oneOf(ATermAppl... terms) {
    ATermList list = ATermUtils.EMPTY_LIST;
    for( ATermAppl term : terms ) {
      list = list.insert( value( term ) );
    }
    return ATermUtils.makeOr( list );
  }
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.