[rules-users] DSL question: how to apply same conversion multiple times?

Charles Binford Charles.Binford at Sun.COM
Tue Nov 11 19:05:44 EST 2008


I'm using the DSL feature of 4.07 and am having trouble getting it to
behave like I want.

I have a File object where I'm always going to have a "state"
constraint, plus one or more optional constraints based on user input. 
(I'm parsing user data to generate the .dsrl file on the fly).

Samples:
    file in "1.x" state where uid == 0 where gid == 0
Should turn into
   $f: File ( classState == "1.x", uid == 0, gid == 0 )

The key lines from my DSL file that do this are:
[condition][]file in "{state}" state {constraints}=$f: File ( classState
== "{state}" {constraints} )
[condition][]where {constraint}=, {constraint}

Unfortunately what I get is
   $f: File ( classState == "1.x", uid == 0 where gid == 0 )

If only have one "where" then all works fine.  If I add another
"[condition][]where {constraint}=, {constraint}"
line in my DSL file it works. The first DSL "where" line catches the
first "where uuid" and the second DSL line catches the "where gid".   On
the current path it looks like I'll have to set a hard limit on how many
constraints a user can specify and make sure I've dup'd the "where" line
that many times in the DSL file.  Of course I'd much rather leave it
open and have the single "where" line apply itself as many times as it can.

Thanks in advance for any help.

Charles Binford
Sun Microsystems



More information about the rules-users mailing list