Package com.clarkparsia.pellet.rules.model

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


  @Test
  public void testIndividualPropertyAtom() {
    kb.addObjectProperty(pi);
    kb.addIndividual(a);
    IndividualPropertyAtom atom = new IndividualPropertyAtom(pi, vx, ca);
    TermTuple triple = new TermTuple(DependencySet.INDEPENDENT, pi, vrx, cra);
    assertEquals(triple, ruleTranslator.translateAtom(atom, DependencySet.INDEPENDENT));
  }
View Full Code Here


  @Test
  public void testTranslateRule() {
    kb.addObjectProperty(pi);
    kb.addIndividual(a);
    IndividualPropertyAtom bodyAtom = new IndividualPropertyAtom(pi, vx, ca);
    TermTuple bodyTriple = new TermTuple(DependencySet.INDEPENDENT, pi, vrx, cra);
    SameIndividualAtom headAtom = new SameIndividualAtom(vx, ca);
    TermTuple headTriple = new TermTuple(DependencySet.INDEPENDENT, Compiler.SAME_AS, vrx, cra);

    Rule rule = new Rule(Collections.singletonList((RuleAtom) headAtom), Collections
View Full Code Here

          RuleAtom atom = new DatavaluedPropertyAtom( p, var, arg );
          atoms.add(atom);
        }
        else {
          AtomIConstant arg = new AtomIConstant( nominal );
          RuleAtom atom = new IndividualPropertyAtom( p, var, arg );
          atoms.add(atom);
        }
      }
      else {
        varCount++;
        if( kb.isDatatypeProperty( p ) ) {
          AtomDObject newVar = new AtomDVariable( "var" + varCount );
          RuleAtom atom = new DatavaluedPropertyAtom( p, var, newVar );
          atoms.add(atom);
          processDatatype( newVar, filler, atoms );
        }
        else{
          AtomIObject newVar = new AtomIVariable( "var" + varCount );
          RuleAtom atom = new IndividualPropertyAtom( p, var, newVar );
          atoms.add(atom);
          varCount = processClass( newVar, filler, atoms, varCount );
        }
      }
    }
View Full Code Here

    // Process the body
    // First add the property atom pairs for each property
    for( ATermAppl property : properties ) {
      if( isObjectProperty( property ) ) {
        AtomIVariable z = new AtomIVariable( "z" + varId );
        body.add( new IndividualPropertyAtom( property, x, z ) );
        body.add( new IndividualPropertyAtom( property, y, z ) );
      }
      else if( isDatatypeProperty( property ) ) {
        AtomDVariable z = new AtomDVariable( "z" + varId );
        body.add( new DatavaluedPropertyAtom( property, x, z ) );
        body.add( new DatavaluedPropertyAtom( property, y, z ) );
View Full Code Here

    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 );
        }
View Full Code Here

   
    kb.addType( a, A );
   
    AtomIVariable x = new AtomIVariable( "x" )
    AtomIVariable y = new AtomIVariable( "y" )
    List<RuleAtom> body = Arrays.<RuleAtom>asList( new IndividualPropertyAtom( p, x, y ) );
    List<RuleAtom> head = Arrays.<RuleAtom>asList( new ClassAtom( B, x ) );
 
    kb.addRule( new Rule( head, body ) );
 
    assertTrue( kb.isConsistent() );
View Full Code Here

    kb.addPropertyValue( r, j, k );

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

    RuleAtom body1 = new IndividualPropertyAtom( r, x, y );
    RuleAtom body2 = new DatavaluedPropertyAtom( p, x, z ), head = new DatavaluedPropertyAtom(
        p, y, z );

    Rule rule = new Rule( Collections.singleton( head ), Arrays.asList( new RuleAtom[] {
        body1, body2 } ) );
View Full Code Here

    kb.addPropertyValue( p, i, d );

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

    RuleAtom body1 = new IndividualPropertyAtom( r, x, y );
    RuleAtom body2 = new DatavaluedPropertyAtom( p, x, z );
    RuleAtom head = new DatavaluedPropertyAtom( p, y, z );

    Rule rule = new Rule( Collections.singleton( head ), Arrays.asList( body1, body2 ) );
    kb.addRule( rule );
View Full Code Here

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

    RuleAtom head = new DatavaluedPropertyAtom( p, x, z );
    RuleAtom body1 = new DatavaluedPropertyAtom( p, y, z );
    RuleAtom body2 = new IndividualPropertyAtom( r, x, y );

    Rule rule = new Rule( Collections.singleton( head ), Arrays.asList( body1, body2 ) );
    kb.addRule( rule );
   
    kb.ensureConsistency();
View Full Code Here

    kb.addObjectProperty( r );
    kb.addSubClass( TOP, min( r, 1, TOP ) );
    kb.addSubClass( TOP, oneOf( i, j ) );

    kb.addRule( new Rule( Collections.singletonList( new DifferentIndividualsAtom( x, y ) ),
        Collections.singletonList( new IndividualPropertyAtom( r, x, y ) ) ) );

    kb.realize();
    assertTrue( kb.isConsistent() );
    assertTrue( kb.isDifferentFrom( i, j ) );
  }
View Full Code Here

TOP

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

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.