For your problem of different instances of a map : If you want to
match 2 maps, and compare them, your have to set a placeholder in
your DSL to set the variable's name
[when]The property {key:ENUM:Map.properties} of the map {mapVar}
is {value}={mapVar} : Map((this["{key}"] == "{value}"))
And another DSL phrase to check that instances are
different
[when]The map {mapVar1} is not map {mapVar2}
= eval ({mapVar1}["id"] != {mapVar2}["id"]))
But it will force your users to handle variables. I can't see
simpler way for doing that with DSL.
You may consider completely another way. If your property lists are
constant (and they are because you can create static enums), you can
write a simple program to generate the corresponding POJOs (which
contains the map inside them and use it in set/get methods for
corresponding key) and create a jar with them.
Each POJO will then have its fields listed automatically in Guided
Editor, which will prevent you for writing complex DSL and enums,
and provide a good way for users to edit rules. For instance, you
can bind an object to a variable only if you need it (with DSL you
are forced to bind a variable at each time you use the phrase), and
you can use other operator (not only equals) without writing a new
DSL phrase.
I did not understand this question :
I have to put my rules in 4 drl files separate (i know
which rules go in which drl file), is the only way to create a
different package for each drl file i want? And to put the Enum
and DSL part in Global if i have to use it for the 4 files? If i
want a precise name for my drl file, i have to give this exact
name to the package?
But yes, a DSL (and enums) is specific to its package.