Package com.clarkparsia.pellet.rules.model

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


    kb.addType( p2a, male );

    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


  }

  public void testVariableUtils2() {
    ATermAppl p = term( "p" );
    AtomIVariable var1 = new AtomIVariable( "var1" ), var2 = new AtomIVariable( "var2" );
    RuleAtom atom = new IndividualPropertyAtom( p, var1, var2 );
    assertIteratorValues( VariableUtils.getVars( atom ).iterator(), new Object[] { var1, var2 } );
  }
View Full Code Here

    {
      AtomIVariable v = new AtomIVariable( "v" );
      RuleAtom body = new ClassAtom( some( p, or( and( A, B ), or(
          and( A, C ), and( B, C ) ) ) ), v );
      RuleAtom head = new IndividualPropertyAtom( q, v, new AtomIConstant( y ) );
      Rule rule = new Rule( Collections.singleton( head ), Collections.singleton( body ) );
      kb.addRule( rule );
    }

    {
      AtomIVariable v = new AtomIVariable( "v" );
      RuleAtom body = new ClassAtom( G, v );
      RuleAtom head = new IndividualPropertyAtom( p, v, new AtomIConstant( y ) );
      Rule rule = new Rule( Collections.singleton( head ), Collections.singleton( body ) );
      kb.addRule( rule );
    }

    assertTrue( kb.isConsistent() );
View Full Code Here

    kb.addPropertyValue( p, b, c );

    List<RuleAtom> body = new ArrayList<RuleAtom>();
    List<RuleAtom> head = new ArrayList<RuleAtom>();

    body.add( new IndividualPropertyAtom( p, x, y ) );
    head.add( new IndividualPropertyAtom( q, x, y ) );

    kb.addRule( new Rule( head, body ) );

    assertTrue( kb.hasPropertyValue( a, p, b ) );
    assertTrue( kb.hasPropertyValue( a, p, c ) );
View Full Code Here

    AtomIVariable x = new AtomIVariable( "x" );
    AtomIVariable y = new AtomIVariable( "y" );
    List<RuleAtom> body = new ArrayList<RuleAtom>();
    body.add( new ClassAtom( C, x ) );
    List<RuleAtom> head = new ArrayList<RuleAtom>();
    head.add( new IndividualPropertyAtom( p, x, y ) );
    Rule rule = new Rule( head, body );
    kb.addRule( rule );
   
    assertEquals( singleton( rule ), kb.getRules() )
    assertNull( kb.getNormalizedRules().get( rule ) );
View Full Code Here

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

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

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

    List<RuleAtom> body = Arrays.<RuleAtom> asList(new ClassAtom(A, x),
            new IndividualPropertyAtom(r, y, new AtomIConstant(b)),
            new DatavaluedPropertyAtom(p, y, new AtomDConstant(TermFactory.literal(true))));
    List<RuleAtom> head = Arrays.<RuleAtom> asList(new DatavaluedPropertyAtom(q, x, new AtomDConstant(t)));
    kb.addRule(new Rule(head, body));

    body = Arrays.<RuleAtom> asList(new ClassAtom(A, x),
            new IndividualPropertyAtom(r, y, new AtomIConstant(b)),
            new DatavaluedPropertyAtom(p, y, new AtomDConstant(TermFactory.literal(false))));
    head = Arrays.<RuleAtom> asList(new DatavaluedPropertyAtom(q, x, new AtomDConstant(f)));
    kb.addRule(new Rule(head, body));

    assertIteratorValues(kb.getDataPropertyValues(q, a).iterator(), t);
View Full Code Here

    AtomIVariable x = new AtomIVariable("x");
    AtomIVariable y = new AtomIVariable("y");
    AtomIVariable z = new AtomIVariable("z");
   
    List<RuleAtom> body = Arrays.<RuleAtom> asList(
            new IndividualPropertyAtom(p, x, y),
            new IndividualPropertyAtom(p, y, z),
            new IndividualPropertyAtom(p, x, z)
            );
    List<RuleAtom> head = Arrays.<RuleAtom> asList(new IndividualPropertyAtom(q, x, z));
    kb.addRule(new Rule(head, body));

    assertIteratorValues(kb.getObjectPropertyValues(q, a).iterator(), c);
    assertIteratorValues(kb.getObjectPropertyValues(q, b).iterator(), e);
    assertIteratorValues(kb.getObjectPropertyValues(q, c).iterator());
View Full Code Here

    VariableBinding binding = new VariableBinding(kb.getABox());
    binding.set(x, mary);
    binding.set(y, robert);

    RuleAtom atom = new IndividualPropertyAtom(p, x, y);
    TrivialSatisfactionHelpers tester = new TrivialSatisfactionHelpers(kb.getABox());
    assertTrue(tester.isAtomTrue(atom, binding) != null);
  }
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.