List colList = personPattern.getDescrs();
assertEquals( 3,
colList.size() );
// first, we have a field binding
BindingDescr fbd = (BindingDescr) colList.get( 0 );
assertEquals( "$bf",
fbd.getVariable() );
assertEquals( "name",
fbd.getExpression() );
// then, we have a field constraint
FieldConstraintDescr fieldConstraintDescr = (FieldConstraintDescr) colList.get( 1 );
assertEquals( "name",
fieldConstraintDescr.getFieldName() );
RestrictionConnectiveDescr root = (RestrictionConnectiveDescr) fieldConstraintDescr.getRestriction();
assertEquals( 1,
root.getRestrictions().size() );
RestrictionConnectiveDescr or = (RestrictionConnectiveDescr) root.getRestrictions().get( 0 );
assertEquals( RestrictionConnectiveDescr.OR,
or.getConnective() );
List restrictionList = or.getRestrictions();
assertEquals( 3,
restrictionList.size() );
// first we have a literal restriction
LiteralRestrictionDescr litDescr = (LiteralRestrictionDescr) restrictionList.get( 0 );
assertEquals( "==",
litDescr.getEvaluator() );
assertEquals( "yyy",
litDescr.getText() );
// second, we have another literal restriction
litDescr = (LiteralRestrictionDescr) restrictionList.get( 1 );
assertEquals( "!=",
litDescr.getEvaluator() );
assertEquals( "zzz",
litDescr.getText() );
ReturnValueRestrictionDescr retDescr = (ReturnValueRestrictionDescr) restrictionList.get( 2 );
assertEquals( "!=",
retDescr.getEvaluator() );
LispForm lispForm = ( LispForm ) retDescr.getContent();
assertEquals("(+ 2 3)", lispForm.toString() );
// ----------------
// this is how it would be compatible to our core engine
PredicateDescr predicateDescr = (PredicateDescr) colList.get( 2 );
lispForm = ( LispForm ) predicateDescr.getContent();
assertEquals("(< 1 2)", lispForm.toString() );
// -----------------
// Parse the second column
PatternDescr hobbyPattern = (PatternDescr) lhsList.get( 1 );
assertEquals( "$c",
hobbyPattern.getIdentifier() );
assertEquals( "hobby",
hobbyPattern.getObjectType() );
colList = hobbyPattern.getDescrs();
assertEquals( 3,
colList.size() );
fbd = (BindingDescr) colList.get( 0 );
assertEquals( "$bf2",
fbd.getVariable() );
assertEquals( "type",
fbd.getExpression() );
fieldConstraintDescr = (FieldConstraintDescr) colList.get( 1 );
restrictionList = fieldConstraintDescr.getRestrictions();
assertEquals( "type",