Adventures example
by tomschut
Hi,
I've been trying to get the drools examples from the 5.3 final zip to work,
but I seem to be stuck on the adventures example, the one I'm trying to
understand because of the use of the query syntax.
All other examples work, but as for Adventures eclipse reports errors on
importing declarations and analyzing expressions in e.g. Commands.drl.
When I run the examples from command line or even eclipse it does compile
and run the adventures example, so the problem seems to be related to the
plugin.
Thanks,
Tom Schut
--
View this message in context: http://drools.46999.n3.nabble.com/Adventures-example-tp3703045p3703045.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
Drools 5.3 DSL Or conditions
by gboro54
I am just curious if there is a way to use the "-" appending format for
appending OR conditions to an object. For example:
There exist object a
-where property1 is "Value1"
-or where property2 is "Value2"
This would equate to the drl:
Object(property1=="Value1" || property2=="Value2")
Is this possible or a trick to get something similar? Worst case I can just
separate to two individual rules.
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-5-3-DSL-Or-conditions-tp3703338p...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
DSL for multiple 'OR'
by Stephen Masters
Hi folks,
I'm trying to create a DSL (to drive a Guvnor guided editor), for which a rule could be written as:
Given a cucumber
- containing one or more worm holes
- or with a curvature greater than 10mm per 10 cm length
- or with a hue of less than 90 degrees
- or with a hue of greater than 150 degrees
Do not put that cucumber on the supermarket shelf
(note: I'm actually developing a banking risk management system looking at different types of counterparty ratings, rather than a fruit&veg quality control system, but hopefully the above example is more readable!)
Is there a decent metaphor that could be used by a business user in Guvnor to manage such rules in one place? Or is it likely to be necessary to create multiple rules?
As far as I understand, every condition added to a rule through such DSLRs adds itself to the filter. i.e. They are AND rather than OR.
The other metaphor I could think of is the decision table as a neat interface for generating multiple rules, but that seems to be geared towards creating rules based on multiple values of a single attribute rather than multiple conditions.
I'm trying to keep the user interface as simple as possible, so any thoughts would be appreciated.
Cheers,
Steve
12 years, 10 months
Guvnor Global Area Usage Restirictions
by domingo
I imported some pakages into Guvnor and I want to put it into Global Area.
The following are my observation...
1. Import action create new package into *'Packages' *section do not have
option like want to put *Global Area* or *Packages*.
2. After import into Packages I want to move the packages to Global Area but
package level is not possible.
3. To move my rules files into Global area..I have to open the individual
rules then only Edit menu shows the Promote to Global option.
If I have 20 or 30 rules in the package I have to the same thing 30 times.
It is very timetaking and think not good idea. what happen If have 30
packages and each package having 30 rules.
I am not sure I am using *Guvnor5.3* effectively or not. *In the
documentation(Guvnor5.3) I noticed two lines only about the Global
area.*Please some one can guide me.....
-----
with kind regards,
--
View this message in context: http://drools.46999.n3.nabble.com/Guvnor-Global-Area-Usage-Restirictions-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
Where do I code the calculation for a derieved property of the planning entity?
by aitchnyu
I am making a 2X2 sudoku game, modeled after Nqueens example. A `Digit` class
is assigned a `column` and `row` object. The `row` is the planning entity.
But a sudoku game also has a `block`, which is to be calculated from `row`
and `column`. Two digits cannot share a block. A block is null when the row
is null, and a numerical value that will be equal for all digits in the row.
Question: where do I tell the `Digit` object to recalculate it's `block`? I
did it in doMove, but it is misses most places the object is updated (as per
my attempts at logging). Must I set it to update itself when the `row`
property of the object changes, say at `setRow()`?
A 2X2 sudoku: http://mypuzzle.org/sudoku/kid.html
private integer block;
...
public Integer getBlock(){
return block;
}
public void setBlock(int not_used){
if(this.row==null)
this.block=null;
else
this.block=10*(this.row.getIndex()/2)+this.column.getIndex()/2;
}
--
View this message in context: http://drools.46999.n3.nabble.com/Where-do-I-code-the-calculation-for-a-d...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
null POJO attribute causing template issues -- is there a better way?
by dunnlow
Hi,
I'm using a template to validate information in my POJO. I've got a row for
the different valid possibilities.
My template rule (in guvnor) looks like:
WHEN
There is a MyBean[$mb] with:
itemname matches templateItemName
cost greater than templateCost
caveat matches templateCaveat
THEN
. 8<
(I have columns in my template for templateItemName, templateCost and
templateCaveat).
Almost always, I don't care about the value in $mb.caveat, so I have a ".*"
in the entry for that row. This works fine as long as $mb bean has a caveat
(ie, $mb.caveat !=null). But when caveat is null the check for caveat
matches templateCaveat (where templateCaveat = ".*") fails. I tried the
regex ".*|null" but that doesn't work either, which I suppose isn't so
surprising (although I never see a NPE error msg).
Modifying the template like this doesn't work:
itemname matches templateItemName
cost greater than templateCost
any of the following:
caveat==null
caveat matches templateCaveat
because when a null valued caveat comes in, this then matches both the rule
I want to fire and the lone one or two with a constraint on that field
(something other than ".*"). I know I can set the salience so that the rows
with ".*" fire first, but that seems REALLY ugly.
I also considered putting in a rule with a high salience that adds a dummy
caveat if one doesn't exist, but this still seems somewhat ugly.
What I'd like to do is have a constraint such as: if caveat matches
templateCaveat or (if caveat is null and templateCaveat does not match ".*")
Does anyone have any insight about the best way to implement this?
Thank you,
-J
--
View this message in context: http://drools.46999.n3.nabble.com/null-POJO-attribute-causing-template-is...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
bytecode representation of rules
by Mainul Raju
Hello All:
I have been trying to get the byte code representation of rules (.drl files). I would appreciate it if anyone could kindly provide me any way to do that.
I have created a rule based application with 100 rules in 5 different .drl files. My intention is to analyze the application with some byte code analyzer (i.e. soot). For the purpose of hat static analysis, I need the byte-code representation of rules which I can't get from drools.
Thanks in advance.
//
Mainul
12 years, 10 months