[rules-users] Templates(without spreadsheet) with DSL
Wolfgang Laun
wolfgang.laun at gmail.com
Thu Jan 27 05:21:15 EST 2011
Compiling to DRL is a low-level technique, useful for debugging or
unit tests of Drools itself.
Standard procedure is to add dsl and dslr (in this order) to a KnowledgeBuilder:
KnowledgeBuilder kBuilder = ...
Resource dsl = ResourceFactory.newClassPathResource( dslPath, getClass() );
kBuilder.add( dsl, ResourceType.DSL );
Resource dslr = ResourceFactory.newClassPathResource( dslrPath, getClass() );
kBuilder.add( dslr, ResourceType.DSLR );
-- check for errors
-- get the packages, etc.
-W
On 27 January 2011 10:52, Bala <bala.ganesh at accenture.com> wrote:
>
> Hi,
>
> Is that possible to use templates with dsl without converting the dsl and
> dslr to drl?
>
> I have opted the below way to support templates with DSL and dslr.
>
> But want to know is there a way to use the templates in dsl without
> converting it to drl for ObjectDataCompiler.compile method call? Or am i
> missing something?
>
> ObjectDataCompiler compiler = new ObjectDataCompiler();
> InputStream dslResource =
> ResourceFactory.newClassPathResource("Rules.dsl",
> DroolsValidator.class).getInputStream();
> dsl = convertStreamToString(dslResource);
> DrlParser parser = new DrlParser();
> String resultDrl = parser.getExpandedDRL( subRuleDesc, new
> StringReader(dsl));
> drl = compiler.compile(rulesData, getInputStream(resultDrl));
>
>
> Thanks,
> Bala
> --
> View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Templates-without-spreadsheet-with-DSL-tp2361183p2361183.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
More information about the rules-users
mailing list