How to use a result of custom defined function in WHEN part?
by AleBu
Hi,
I am new to Drools and do some experiments on it, and encountered on a
problem which can't solve for a last few days, so maybe someone can explain
what I am doing wrong?
I will probably explain my problem with example. Lets say we have a
collection of letters like 'a', 'b', 'c', 'a', 'd', 'e', 'c'. And I want to
report all letters that are duplicated, but only once providing a number of
duplication. In other words, for each letter which is duplicated I need to
do a report by saying 'Letter X is duplicated N times.
My idea was to create cardinality collection for letters which is a
collection of POJOs Tuple where first is letter and second is cound (first
and second are properties). I created a function for it createCardinality(
Collection letters ) which returns such cardinality info and tried something
like:
when
Something( $letters: collectionOfLetters )
Tuple( $letter: first, $count: second > 1 ) from collect( Tuple() from
createCardinality( $letters ) )
then
System.out.println( "Letter "+letter+" is duplicated "+$count+"
times" )
But I am reported (at least it looks like this) about the problems with my
function createCardinality(). Maybe I misunderstood something about usage of
FROM?
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/How-to-use-a-result-o...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 3 months
Compound DSL statements
by Chris Selwyn
I tried creating a DSL something like the following:-
[when] there is a QQ with attr equal to {YYY} = there is a Q - with attr
equal to {YYY}
[when]there is a Q = Question()
[when] - with attr equal to {YYY} = attr == "{YYY}"
but I find that the expansion does not seem to work right.
When I use this like
when
there is a QQ with attr equal to abc
then
...
What this expands to is
Question() attr == "abc"
I was hoping that the condition would be put inside the pattern.
Is it not possible to make "compound" DSL statements that use inline "-"
clauses?
Chris Selwyn
15 years, 3 months
rulebase configuration Options
by Kumar, Ravendra
Hi Guys,
I am trying to find out more information about rulebase configuration
options written in "drools.default.rulebase.conf"
Do any of you guys know any blog or material written on these options,
If someone has written any blog on these options, and could I know the
location, it will a great help.
Thanks,
Rav.
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of
rules-users-request(a)lists.jboss.org
Sent: 17 December 2010 08:57
To: rules-users(a)lists.jboss.org
Subject: rules-users Digest, Vol 49, Issue 44
Send rules-users mailing list submissions to
rules-users(a)lists.jboss.org
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.jboss.org/mailman/listinfo/rules-users
or, via email, send a message with subject or body 'help' to
rules-users-request(a)lists.jboss.org
You can reach the person managing the list at
rules-users-owner(a)lists.jboss.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of rules-users digest..."
Today's Topics:
1. Re: "Negative" Rules (Ansgar Konermann)
2. Re: Using GlobalArea in Guvnor (Jervis Liu)
3. Re: Guvnor with JBoss AS on Ubuntu (alim)
4. Re: Deploying Guvnor 5.1 on Glassfish v3 (alim)
5. DroolsFlow 5.1.1 ForEach + XOR/OR Gateway = Impossible?
(Dirk Hermanns)
----------------------------------------------------------------------
Message: 1
Date: Fri, 17 Dec 2010 00:34:11 +0100
From: Ansgar Konermann <ansgar.konermann(a)googlemail.com>
Subject: Re: [rules-users] "Negative" Rules
To: rules-users(a)lists.jboss.org
Message-ID: <4D0AA1F3.20307(a)googlemail.com>
Content-Type: text/plain; charset="iso-8859-1"
On 15.12.2010 10:01, Diego San Esteban wrote:
> Greetings,
>
> How is itpossible to implement a "rollback"in theKB?
>
> Suppose that when retracting a fact,I want toundo the changes
made.
>
A very simple, yet effective solution would be to exclusively use
insertLogical(). No updates to facts which are already asserted, no
normal "insert".
Best regards
Ansgar
15 years, 3 months
activation-group issue
by Yaniv Itzhaki
Hi,
I have a group of rules with salience which I would like that only the first
activated rule will fire.
I cant use the activation-group attribute because each rule can fire number
of times, and i want only this rule to be fired in that group:
rule "A1"
salience 100
ruleflow-group "A"
activation-group "A"
when
xxx1
then
yyy1
end
rule "A2"
salience 90
ruleflow-group "A"
activation-group "A"
when
xxx2
then
yyy2
end
If Rule A1 run (activated number of times), rule A2 should not run.
Is there a way to do that? (no global flags etc.)
Thanks
Yaniv
15 years, 3 months
"Negative" Rules
by Diego San Esteban
Greetings,
How is it possible to implement a "rollback" in the KB?
Suppose that when retracting a fact, I want to undo the changes made.
Writing a negative (opposite) rule isn't efficient, it means declaring the
rule twice effectively. Also the negative rule is usually using lots of OR's
and NOT's which isn't fast.
Any help?
Thanks
15 years, 3 months
return value restriction: not all expressions supported?
by Wolfgang Laun
Using 5.1.1 and knowing that "a Return Value restriction is a parenthesized
expression composed from literals, any valid Java primitive or object,
previously bound variables, function calls, and operators" I wrote
OperatorOrder( $code: code, $id1: elId1, $id2: elId2 )
CommandCode( code == $code, operands != ( $id1!=null ? ($id2!=null ? 2 :
1) : 0 ) )
and got the erroneous error message:
Rule Compilation error : [Rule name='operator command: invalid number of
elements']
appl/domain/element/Rule_operator_command__invalid_number_of_elements_0.java
(9:714) : $id2 cannot be resolved
Variations in the return value restriction show that it is the nesting of
-?-:- which causes the bug; a similar (but not equivalent) expression
operands != ( ($id1!=null ? 1:0) + ($id2!=null ? 1:0) )
is accepted.
-W
15 years, 3 months
Case Studies and Success Stories
by Stephen Garvey
Hi everyone,
I hope someone can help me or point me in the right direction. I'm looking
for some case studies on how organisations successfully used Drools.
Organisations like those mentioned on the "Sightings" page. I've been
digging around the site(s) for the past couple of days and have found Red
Hat success stories for jBPM etc.->
http://customers.redhat.com/category/red-hat-jboss-solutions/jboss-enterp...
I was wondering if there was anything like these for Drools, maybe
explaining how people have successfully used Expert and Flow together. I was
at a conference earlier this summer where Mark Proctor gave an overview of
all things Drools and he mentioned some very interesting work going on with
US Navy Healthcare. Are there any of these types of case studies online?
Thanks in advance,
Stephen
15 years, 3 months
Can I create sub packages in Guvnor
by Harshit Bapna
Hello All,
I have gone through the Guvnor UI and I couldn't find a way to create sub
packages under parent package.
for ex: Under package Mortgage, I want to create subMortgage.
*Also I found a method createSubPackage in RepositoryService but not able to
get the UI way to create a subpackage.*
/**
* This creates a package of the given name, and checks it in.
* @return UUID of the created item.
*/
public String createSubPackage(String name,
String description,
String parentPackage) throws
SerializationException;
15 years, 3 months