AndDescr lhs = new AndDescr();
queryDescr.setLhs( lhs );
PatternDescr pattern = new PatternDescr( Person.class.getName() );
lhs.addDescr( pattern );
FieldConstraintDescr literalDescr = new FieldConstraintDescr( "name" );
literalDescr.addRestriction( new VariableRestrictionDescr( "==",
"$name" ) );
pattern.addConstraint( literalDescr );
literalDescr = new FieldConstraintDescr( "age" );
literalDescr.addRestriction( new VariableRestrictionDescr( "==",
"$age" ) );
pattern.addConstraint( literalDescr );
literalDescr = new FieldConstraintDescr( "likes" );
literalDescr.addRestriction( new VariableRestrictionDescr( "==",
"$likes" ) );
pattern.addConstraint( literalDescr );
RuleDescr ruleDescr = new RuleDescr( "rule-1" );
packageDescr.addRule( ruleDescr );