Package com.clarkparsia.pellet.rules.model

Examples of com.clarkparsia.pellet.rules.model.ClassAtom


                }
                else if( argument == null ) {
                  addUnsupportedFeature( "Error on" + SWRL.argument1 );
                }
                else {
                  atom = new ClassAtom( description, argument );
                }
      }
      else if( hasObject( atomNode, RDF.type.asNode(), SWRL.IndividualPropertyAtom.asNode() ) ) {
        ATermAppl pred = null;
        AtomIObject argument1 = null;
View Full Code Here


      AtomIObject io = convertAtomIObject( i );
      ATermAppl c = (ATermAppl) term.getArgument( 1 );
     
      defineClass( c );
     
      atom = new ClassAtom( c, io );
    }
    else if( term.getAFun().equals( ATermUtils.PROPFUN ) ) {
      ATermAppl p = (ATermAppl) term.getArgument( 0 );
      ATermAppl i1 = (ATermAppl) term.getArgument( 1 );
      ATermAppl i2 = (ATermAppl) term.getArgument( 2 );
View Full Code Here

    v.accept( this );

    AtomIObject subj = swrlIObject;

    c.accept( this );
    swrlAtom = new ClassAtom( term, subj );
  }
View Full Code Here

            varCount = processClass( newVar, filler, atoms, varCount );
          }
        }
      }
      else if( !c.equals( ATermUtils.TOP ) ) {
        atoms.add( new ClassAtom( c, var ) );
      }
     
      return varCount;
    }
View Full Code Here

      varId++;
    }

    // Then add the class atoms for the two subject variables
    body.add( new ClassAtom( c, x ) );
    body.add( new ClassAtom( c, y ) );
   
    addRule( new Rule( head, body ) );
  }
View Full Code Here

    Set<RuleAtom> head = new LinkedHashSet<RuleAtom>();
    Set<RuleAtom> body = new LinkedHashSet<RuleAtom>();

    for( RuleAtom atom : rule.getHead() ) {
      if( atom instanceof ClassAtom ) {
        ClassAtom ca = (ClassAtom) atom;
        AtomIObject arg = ca.getArgument();
        ATermAppl c = ca.getPredicate();
        ATermAppl normC = ATermUtils.normalize( c );
        if( c != normC )
          atom = new ClassAtom( normC, arg );
      }
      head.add( atom );
    }

    Map<AtomIObject, Set<ATermAppl>> types = new HashMap<AtomIObject, Set<ATermAppl>>();

    for( RuleAtom atom : rule.getBody() ) {
      if( atom instanceof IndividualPropertyAtom ) {
        IndividualPropertyAtom propAtom = (IndividualPropertyAtom) atom;
        ATermAppl prop = propAtom.getPredicate();

        AtomIObject subj = propAtom.getArgument1();
        if( subj instanceof AtomIVariable ) {
          Set<ATermAppl> domains = getRole( prop ).getDomains();
          if( domains != null )
            MultiMapUtils.addAll( types, subj, domains );
        }

        AtomIObject obj = propAtom.getArgument2();
        if( obj instanceof AtomIVariable ) {
          Set<ATermAppl> ranges = getRole( prop ).getRanges();
          if( ranges != null )
            MultiMapUtils.addAll( types, obj, ranges );
        }
      }
    }

    for( RuleAtom atom : rule.getBody() ) {
      if( atom instanceof ClassAtom ) {
        ClassAtom ca = (ClassAtom) atom;
        AtomIObject arg = ca.getArgument();
        ATermAppl c = ca.getPredicate();
        ATermAppl normC = ATermUtils.normalize( c );
        if( MultiMapUtils.contains( types, arg, normC ) )
          continue;
        else if( c != normC )
          atom = new ClassAtom( normC, ca.getArgument() );
      }
      body.add( atom );
    }

    return new Rule( rule.getName(), head, body );
View Full Code Here

    v.accept( this );

    AtomIObject subj = swrlIObject;

    c.accept( this );
    swrlAtom = new ClassAtom( term, subj );
  }
View Full Code Here

                }
                else if( argument == null ) {
                  addUnsupportedFeature( "Error on" + SWRL.argument1 );
                }
                else {
                  atom = new ClassAtom( description, argument );
                }
      }
      else if( hasObject( atomNode, RDF.type.asNode(), SWRL.IndividualPropertyAtom.asNode() ) ) {
        ATermAppl pred = null;
        AtomIObject argument1 = null;
View Full Code Here

    kb.addClass( c );
    kb.addClass( d );
    kb.addIndividual( i );
    kb.addType( i, c );

    kb.addRule( new Rule( Arrays.asList( new RuleAtom[] { new ClassAtom( d, new AtomIConstant(
        i ) ) } ), Arrays
        .asList( new RuleAtom[] { new ClassAtom( c, new AtomIConstant( i ) ) } ) ) );

    kb.realize();
    assertTrue( kb.getTypes( i ).contains( Collections.singleton( d ) ) );

  }
View Full Code Here

    AtomIVariable x = new AtomIVariable( "x" ), y = new AtomIVariable( "y" ), z = new AtomIVariable(
        "z" );

    kb.addRule( new Rule( Arrays.asList( new RuleAtom[] { new IndividualPropertyAtom( hasUncle,
        y, z ) } ), Arrays.asList( new RuleAtom[] {
        new IndividualPropertyAtom( hasParent, y, x ), new ClassAtom( male, z ),
        new IndividualPropertyAtom( hasSibling, x, z ), } ) ) );

    assertIteratorValues( kb.getObjectPropertyValues( hasUncle, c11 ).iterator(),
        new Object[] { p2a, } );
  }
View Full Code Here

TOP

Related Classes of com.clarkparsia.pellet.rules.model.ClassAtom

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.