I have rules with the following structure:
rule "ins b"
when
A()
then
B $b = new B();
$B.setName("hello");
insert($b);
end
I want to get the objects (and its attributes) that the rule adds to the working memory.
I'm able to get the LHS objects with the following code:
RuleImpl ri = (RuleImpl) kSession.getKieBase().getRule("com.sample", "ins b");
System.out.println("L: " + ri.getLhs());
Pattern rce = (Pattern) ri.getLhs().getChildren().get( 0 );
System.out.println("L: " + rce.getConstraints());
But I can't find something similar to obtain the RHS of the rule.
I want to do that because I'm trying to generate querys "automatically" based on rules. From the above rule I want to generate something like:
query hotToGetA()
@Abductive( target = A.class )
$b := B( name == "hello" )
end
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire