2009/5/20 Steve Ronderos <steve.ronderos(a)ni.com>
>
> Jon,
>
> We are currently trying to convert our drl files to brls as well. Would
> it be possible to share your perl conversion utility? We were just about to
> start creating a similar script, but it would help us out greatly if we
> could have a look at yours.
>
> Thanks,
>
> Steve
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
Hi Steve,
I am not sure my script would be too useful as it did not convert .drl
to .brl, but rather our own rule language (stored in DB tables) to
.brl. The Perl script pulled the needed values from the DB tables
and then did nothing more than write .brl files using XML templates
like this:
my $rule = <<EOF;
<rule>
<name>$rulename</name>
<modelVersion>1.0</modelVersion>
<attributes>
<attribute>
<attributeName>salience</attributeName>
<value>$salience</value>
</attribute>
<attribute>
<attributeName>enabled</attributeName>
<value>$enabled</value>
</attribute>
<attribute>
<attributeName>activation-group</attributeName>
<value>foo</value>
</attribute>
</attributes>
<metadataList/>
<lhs>
<fact>
<constraintList>
<constraints>
<fieldConstraint>
<value>$lang</value>
<constraintValueType>1</constraintValueType>
<fieldName>languageString</fieldName>
<operator>==</operator>
<fieldType>String</fieldType>
</fieldConstraint>
</constraints>
</constraintList>
<factType>Language</factType>
</fact>
...
...
...
...
Then of course just writing the rule file.
unless (open(OUT, ">$outfile"))
{
die "Unable to open output file";
}
print OUT "$rule\n";
close OUT;
As I mentioned before, to create the template, I just created some
similar-looking rules using the guided graphical editor and looked at
the resulting XML.
We will also use .drl files too, but for the simple rules which are
managed by analysts, the more basic .brl functionality is going to
work quite well IMO.
Jon