Python Semantic Module Component Reference

The ClassObjectType semantic component differentiates objects by the same rules as the Java type hierarchy. It is constructed using the Class of the class or interface to match. The underlying implementation uses isAssignableFrom and so accomodates subclasses and interface implementations cleanly.

ObjectType type = new ClassObjectType( Person.class );

The ExprCondition semantic component applies a boolean-yielding Python expression to the input objects. It is constructed with a string encapsulating the expression along with an array of available declarations.

Condition condition = new ExprCondition( "person.isTall()", 
                                         new Declaration[] { personDecl, wifeDecl } );

The BlockConsequence semantic component allows blocks of Python statements to be executed as the consequence of a rule. It is constructed with a string encapsulating the statement block along with an array of available declarations. The block is executed by Jython.

Consequence consequence = new BlockConsequence( "print \"person is: \" + person.getName()",
                                                new Declaration[] { personDecl, wifeDecl } );