Package com.clarkparsia.pellet.rules.model

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


    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


   
    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() );
   
    assertTrue( kb.isType( a, A ) );
    assertFalse( kb.isType( b, A ) );
View Full Code Here

   
    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() );
   
    assertFalse( kb.isType( a, A ) );
    assertTrue( kb.isType( b, A ) );
View Full Code Here

    AtomIVariable x = new AtomIVariable("x");

    List<RuleAtom> body = Arrays.<RuleAtom> asList(new ClassAtom(A, x), new DatavaluedPropertyAtom(p,
                    new AtomIConstant(b), 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 DatavaluedPropertyAtom(p, new AtomIConstant(b),
                    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);
    assertIteratorValues(kb.getDataPropertyValues(q, b).iterator());
  }
View Full Code Here

    AtomIVariable x = new AtomIVariable("x");

    List<RuleAtom> body = Arrays.<RuleAtom> asList(new ClassAtom(A, x), new ClassAtom(B, new AtomIConstant(b)));
    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 ClassAtom(A, new AtomIConstant(b)));
    head = Arrays.<RuleAtom> asList(new DatavaluedPropertyAtom(q, x, new AtomDConstant(f)));
    kb.addRule(new Rule(head, body));

    body = Arrays.<RuleAtom> asList(new ClassAtom(B, x));
    head = Arrays.<RuleAtom> asList(new ClassAtom(C, x));
    kb.addRule(new Rule(head, body));

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

    List<RuleAtom> body = Arrays.<RuleAtom> asList(new ClassAtom(A, x),
            new DatavaluedPropertyAtom(p, new AtomIConstant(b), y),
            new BuiltInAtom(SWRLB + "equal", 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 DatavaluedPropertyAtom(p, new AtomIConstant(b), y),
            new BuiltInAtom(SWRLB + "equal", 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);
    assertIteratorValues(kb.getDataPropertyValues(q, b).iterator());
  }
View Full Code Here

    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);
    assertIteratorValues(kb.getDataPropertyValues(q, b).iterator());
  }
View Full Code Here

            new DatavaluedPropertyAtom(p, x, y),
            new BuiltInAtom( SWRLB + "pow", z, y, new AtomDConstant(TermFactory.literal(2))),
            new BuiltInAtom( SWRLB + "lessThan", z, new AtomDConstant(TermFactory.literal(100)))
            );
    List<RuleAtom> head = Arrays.<RuleAtom> asList(new ClassAtom(A, x));
    kb.addRule(new Rule(head, body));

    assertIteratorValues(kb.getInstances(A).iterator(), a, b);
  }
View Full Code Here

            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());
    assertIteratorValues(kb.getObjectPropertyValues(q, d).iterator());
View Full Code Here

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

    body.add( new ClassAtom( C, new AtomIVariable( "x" ) ) );
    head.add( new ClassAtom( D, new AtomIVariable( "x" ) ) );

    Rule rule = new Rule( head, body );

    kb.addClass( C );
    kb.addClass( D );
    kb.addIndividual( i );
    kb.addType( i, C );
View Full Code Here

TOP

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

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.