Getting drl sources from dsl and rdslsr rules:

24 views
Skip to first unread message

otaf otaf

unread,
Aug 5, 2025, 4:35:33 AMAug 5
to Drools Usage
Hello,

we use a dsl and rdslr files in our project (originally Drools 7.69)
Is there a way to intercept the drl equivalent of the rdslr rules ? I see my package is parsed when creating the knowledge : I see some of the messages from (https://docs.drools.org/latest/kie-api-javadoc/org/kie/api/builder/Results.html )


But does it include a drl like source ? If not, how could I get the source rather than making myself the replacements from our dsl and rdslr rules ?

Thanks in advance,

Otf


Toshiya Kobayashi

unread,
Aug 12, 2025, 5:27:10 AMAug 12
to Drools Usage
metaData doesn't contain DRL.

To log the generated DRL,

Add a debug option "#/ result" in your DSL file.
```
#/ result

[when]...
[then]...
```

Set "debug" log level for "org.drools.drl.parser.lang.dsl.DefaultExpander"

for example) logback-test.xml
```
  ...
  <logger name="org.drools.drl.parser.lang.dsl.DefaultExpander" level="debug"/>
  ...
```

You will see generated DRL like this.
```
18:17:30.234 [main] INFO  o.d.d.p.lang.dsl.DefaultExpander.expand:201 -    1  package org.drools.compiler
   2  import org.drools.testcoverage.common.model.Message;
   3  rule "bla"
   4  when
   5   Message(message=="Hi Universe")    
   6  then
   7   System.out.println("Found a Message Hi Universe.");
   8  end
```

FYI) https://kie.apache.org/docs/10.1.x/drools/drools/language-reference-traditional/index.html#_dsl_and_dslr_reference

I hope this helps.

Toshiya

2025年8月5日火曜日 17:35:33 UTC+9 otaf...@gmail.com:
Reply all
Reply to author
Forward
0 new messages