Package aterm

Examples of aterm.ATermList


      kb.addObjectProperty( p );

      ATermAppl or1 = or( A, some( p, A ) );
      ATermAppl or2 = or( B, some( p, B ) );

      ATermList list = ATermUtils.toSet( new ATerm[] { or1, or2 }, 2 );
      kb.addDisjointClasses( list );

      assertTrue( kb.isConsistent() );

      ATermAppl disjoint = ATermUtils.makeDisjoints( list );
View Full Code Here


        if( av.getArity() == 0 )
            throw new InternalReasonerException();
        ATerm p = av.getArgument( 0 );
        ATermAppl c = (ATermAppl) av.getArgument( 1 );       
       
        ATermList roleChain = ATermUtils.EMPTY_LIST;
        Role s = null;
        if( p.getType() == ATerm.LIST ) {
            roleChain = (ATermList) p;
            s = strategy.getABox().getRole( roleChain.getFirst() );
            roleChain = roleChain.getNext();
        }
        else
            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( roleChain.isEmpty() )
                applyAllValues( x, s, y, c, finalDS );
            else if(y.isIndividual()) {
                ATermAppl allRC = ATermUtils.makeAllValues( roleChain, c );

                strategy.addType( y, allRC, finalDS );
            }

            if( x.isMerged() || strategy.getABox().isClosed() )
                return;
        }

        if( !s.isSimple() ) {
            Set<ATermList> subRoleChains = s.getSubRoleChains();
            for( Iterator<ATermList> it = subRoleChains.iterator(); it.hasNext(); ) {
                ATermList chain = it.next();
                DependencySet subChainDS = ds.union(s.getExplainSub(chain), strategy.getABox().doExplanation() );
        if (!applyAllValuesPropertyChain(x, chain, c, subChainDS))
          return;
            }
        }
View Full Code Here

            ATermAppl av = i.next();

            ATerm p = av.getArgument( 0 );
            ATermAppl c = (ATermAppl) av.getArgument( 1 );
           
            ATermList roleChain = ATermUtils.EMPTY_LIST;
            Role s = null;
            if( p.getType() == ATerm.LIST ) {
                roleChain = (ATermList) p;
                s = strategy.getABox().getRole( roleChain.getFirst() );
                roleChain = roleChain.getNext();
            }
            else
                s = strategy.getABox().getRole( p );
                       
            if ( s.isTop() && s.isObjectRole() ) {
              applyAllValuesTop( av, c, ds );
              if( strategy.getABox().isClosed() )
                    return;
              continue;
            }

            if( pred.isSubRoleOf( s ) ) {
                DependencySet finalDS = subj.getDepends( av );
        finalDS = finalDS.union( ds, strategy.getABox().doExplanation() );
        finalDS = finalDS.union( s.getExplainSubOrInv( pred ), strategy.getABox().doExplanation() );
                if( roleChain.isEmpty() )
                    applyAllValues( subj, s, obj, c, finalDS );
                else if (obj.isIndividual()) {
                    ATermAppl allRC = ATermUtils.makeAllValues( roleChain, c );

                    strategy.addType( obj, allRC, finalDS );
                }
               
                if( strategy.getABox().isClosed() )
                    return;
            }

            if( !s.isSimple() ) {
                DependencySet finalDS = subj.getDepends( av ).union( ds, strategy.getABox().doExplanation() );
                Set<ATermList> subRoleChains = s.getSubRoleChains();
                for( Iterator<ATermList> it = subRoleChains.iterator(); it.hasNext(); ) {
                    ATermList chain = it.next();
                   
//                    if( !pred.getName().equals( chain.getFirst() ) )
                    Role firstRole = strategy.getABox().getRole(chain.getFirst());
                    if( !pred.isSubRoleOf( firstRole ) )
                        continue;

                    ATermAppl allRC = ATermUtils.makeAllValues( chain.getNext(), c );

                    applyAllValues( subj, pred, obj, allRC, finalDS.union(
                        firstRole.getExplainSub(pred.getName()), strategy.getABox().doExplanation()).union(
                            s.getExplainSub(chain), strategy.getABox().doExplanation() ) );
View Full Code Here

            else if(r.isAnon()) {
                if(rawModel.contains(r, RDF.first, NULL)) {
                    aTerm = createList(r);
                }
                else if(rawModel.contains(r, OWL.intersectionOf)) {
                    ATermList list = createList(rawModel.getProperty(r, OWL.intersectionOf).getResource());
                    aTerm = ATermUtils.makeAnd(list);
                }
                else if(rawModel.contains(r, OWL.unionOf)) {
                    ATermList list = createList(rawModel.getProperty(r, OWL.unionOf).getResource());
                    aTerm = ATermUtils.makeOr(list);
                }
                else if(rawModel.contains(r, OWL.oneOf)) {
                    ATermList list = createList(rawModel.getProperty(r, OWL.oneOf).getResource());
                    ATermList result = ATermUtils.EMPTY_LIST;
                    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);
                }
                else if(rawModel.contains(r, OWL.complementOf)) {
View Full Code Here

    obj = restr;
  }

  public void visitOneOf(ATermAppl term) {
    ATermList list = (ATermList) term.getArgument( 0 );
    visitList( list );

    if( list.isEmpty() || !ATermUtils.isLiteral( (ATermAppl) ((ATermAppl) list.getFirst()).getArgument( 0 ) ) )
      createClassExpression( OWL.oneOf );
    else
      createDataExpression( OWL.oneOf );
  }
View Full Code Here

    TripleAdder.add( graph, def, RDF.type, RDFS.Datatype );
    TripleAdder.add( graph, def, OWL2.onDatatype, JenaUtils.makeGraphNode( (ATermAppl) dt.getArgument( 0 ) ) )
     
    Node list = null;
    ATermList restrictions = (ATermList) dt.getArgument( 1 );
    for( ; !restrictions.isEmpty(); restrictions = restrictions.getNext() ) {
      ATermAppl facet = (ATermAppl) restrictions.getFirst();
     
      Node facetNode = Node.createAnon();
      TripleAdder.add( graph, facetNode, JenaUtils.makeGraphNode( (ATermAppl) facet.getArgument( 0 ) ), JenaUtils
          .makeGraphNode( (ATermAppl) facet.getArgument( 1 ) ) );
     
View Full Code Here

        node = Node.createURI( name.getName() );
      }
           
      TripleAdder.add( graph, node, RDF.type, SWRL.Imp );
     
      ATermList head = (ATermList) axiom.getArgument( 1 );
      if( head.isEmpty() ) {
        TripleAdder.add( graph, node, SWRL.head, RDF.nil );
      }
      else {
        Node list = null;
        for( ; !head.isEmpty(); head = head.getNext() ) {
          Node atomNode = convertAtom( (ATermAppl) head.getFirst() );
          Node newList = Node.createAnon();
          TripleAdder.add( graph, newList, RDF.type, SWRL.AtomList );
          TripleAdder.add( graph, newList, RDF.first, atomNode );
          if( list != null )
            TripleAdder.add( graph, list, RDF.rest, newList );
          else
            TripleAdder.add( graph, node, SWRL.head, newList );
          list = newList;
        }
        TripleAdder.add( graph, list, RDF.rest, RDF.nil );
      }
     
      ATermList body = (ATermList) axiom.getArgument( 2 );
      if( body.isEmpty() ) {
        TripleAdder.add( graph, node, SWRL.body, RDF.nil );
      }
      else {
        Node list = null;
        for( ; !body.isEmpty(); body = body.getNext() ) {
          Node atomNode = convertAtom( (ATermAppl) body.getFirst() );
          Node newList = Node.createAnon();
          TripleAdder.add( graph, newList, RDF.type, SWRL.AtomList );
          TripleAdder.add( graph, newList, RDF.first, atomNode );
          if( list != null )
            TripleAdder.add( graph, list, RDF.rest, newList );
View Full Code Here

      TripleAdder.add( graph, atom, RDF.type, SWRL.DifferentIndividualsAtom );
      TripleAdder.add( graph, atom, SWRL.argument1, node1 );
      TripleAdder.add( graph, atom, SWRL.argument2, node2 );         
    }
    else if( term.getAFun().equals( ATermUtils.BUILTINFUN ) ) {
      ATermList args = (ATermList) term.getArgument( 0 );
      ATermAppl builtin = (ATermAppl) args.getFirst();
      args = args.getNext();
     
      TripleAdder.add( graph, atom, RDF.type, SWRL.BuiltinAtom );
      TripleAdder.add( graph, atom, SWRL.builtin, Node.createURI( builtin.toString() ) );     
     
      if( args.isEmpty() ) {
        TripleAdder.add( graph, atom, SWRL.arguments, RDF.nil );
      }
      else {
        Node list = null;
        for( ; !args.isEmpty(); args = args.getNext() ) {
          Node atomNode = convertAtomObject( (ATermAppl) args.getFirst() );
          Node newList = Node.createAnon();
          TripleAdder.add( graph, newList, RDF.first, atomNode );
          if( list != null )
            TripleAdder.add( graph, list, RDF.rest, newList );
          else
View Full Code Here

  private void convertNary(ATermAppl axiom, Resource type, Property p) {
    Node n = Node.createAnon();
    TripleAdder.add( graph, n, RDF.type, type );

    ATermList concepts = (ATermList) axiom.getArgument( 0 );
    converter.visitList( concepts );

    TripleAdder.add( graph, n, p, converter.getResult() );
  }
View Full Code Here

  protected ATermList createList(Node node) {
    if( lists.containsKey( node ) ) {
          return lists.get( node );
        }
   
    ATermList list = createList( new RDFListIterator( node ) );

    lists.put( node, list );
   
    return 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.