Re: Action firing twice
by Vithal Kuchibhotla
3rd tryI have a list of Items that I am inserting into working memory.Here is the rule that is failing:rule "Cannot select X if both Y and Z are not selected"when Item(code == "X") (or (not Item(code == "Y")) (not Item(code == "Z")))then System.out.println("Error: You cannot select X unless both Y and Z are selected");endThis rule works correctly when X and Y are there, and when X and Z are there.However, when both Y and Z are missing, the error prints twice.Can anyone tell me what I am doing wrong.Thanks a lotVithal
15 years, 4 months
Re :Action firing twice
by Vithal Kuchibhotla
Reformatted as plain text:Hello All,I have a list of Items that I am inserting into working memory. Here is the rule that is failing:
rule "Cannot select X if both Y and Z are not selected"
when
Item(code == "X")
(or (not Item(code == "Y"))
(not Item(code == "Z")))
then
System.out.println("Error: You cannot select X unless both Y and Z are selected");
end
This rule works correctly when X and Y are there, and when X and Z are there.
However, when both Y and Z are missing, the error prints twice.
Can anyone tell me what I am doing wrong.
Thanks a lot
Vithal
15 years, 4 months
Re: JCR to SVN.
by Mark Proctor
danashane2003(a)yahoo.com wrote:
> Hello Mark,
>
> I'm working on a project that used JCR, but we have decided to go with SVNKit and I'm wondering how to
> migrate the content from JCR repo to SVN.
> I saw some posts from you on the internet and it seemed like you were trying to do something similar.
> Would you have any pointers/suggestions?
>
Please don't email me directly, these sort of questions should go on the
user mailing list (in cc), so everyone can benefit. There is some
unfinished work for drools-repository synchronisation for svn. Currently
it only works for getting stuff from SVN into JCR, the other way around
still needs completing. There are unit tests for the svn->jcr direction.
http://fisheye.jboss.org/browse/JBossRules/trunk/drools-repository/src/ma...
http://fisheye.jboss.org/browse/JBossRules/trunk/drools-repository/src/te...
Mark
> Thank you very much,
> Dana
>
>
>
15 years, 4 months
Precompilation of Rule Flows
by keithnielsen
I have a number of questions as it relates the creation of rule flows:
1) I am assuming that when creating the constraints within a given node
within a rule flow that the selection of "rule" as the type will create a
rule behind the scenes while selection of "code" will create some java
object representation? If this is a correct understanding is there any
preference from an engine perspective, are there performance or other
considerations that must be taken into account?
2) Is there any way to precompile rule flows like rule files are (as opposed
to at runtime with a call to packageBuilder.addRuleFlow(source))? With the
Drools builder any errors in the .drl files are highlighted. Not so with the
.rf. In order to see what is generated it appears that you have to step
through in debug mode at runtime and buried inside there is a string
representation of everything that was generated as well a list of errors
which refer to errors such as parse errors. Unfortunately this manifests
itself eventually (at least with my flow) as a NullPointerException giving
absolutely no indication as to the root of the problems, which I am assuming
are these parser errors. Seems to me that these errors should be returned
with a call to packageBuilder.hasErrors() which is empty in my case.
3) Code assist doesnt appear to work in action editor or constraint editor
which is I think is a pretty big usablity issue. Anything planned to make
this available?
Thanks
--
View this message in context: http://www.nabble.com/Precompilation-of-Rule-Flows-tp20774511p20774511.html
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 4 months
RE: [rules-users] drools 4.0 and enum in java 1.5
by Thierry B
> Maybe you will have to import Message.Type.XML in the drl file and then
> use it.
>
Hello,
I've these imports :
import com.pv.rules.beans.Message;
import com.pv.rules.beans.Message.Type.XML;
but it tell me :
Unable to create restriction '[QualifiedIndentifierRestr: ==
com.pv.rules.beans.Message.Type.XML ]' for field 'type' in the rule
'Contexte1' : [Rule name=Contexte1, agendaGroup=MAIN, salience=0,
no-loop=false]
Rule Compilation error : [Rule name=Contexte1, agendaGroup=MAIN,
salience=0, no-loop=false]
com/pv/rules/Rule_Contexte1_0.java (2:63) : The import
com.pv.rules.beans.Message.Type.XML cannot be resolved
com.pv.rules.beans.Message.Type.XML
Maybe, it's not possible to use enum in drl :-(
Thanks :-)
15 years, 4 months
expand rules with dsl
by Thierry B
Hello,
I've a question about drl and dsl with drools 4.0.
I've this rule :
rule "Contexte1"
when
msg : Message(payload : payload)
eval (DOMUtil.xpathEquals(payload, "/Root/aaaa", "bbb"))
eval (DOMUtil.xpathEquals(payload, "/Root/cccc", "dddd"))
then
System.out.println ("Contexte 1 ************* : OK");
end
I use a dsl, to make it work, so now my drl is like that :
rule "Contexte1"
when
>msg : Message(payload : payload)
xpathEquals "/Root/aaaa" "bbb"
xpathEquals "/Root/cccc" "dddd"
then
Log : "Contexte 1 ************* : OK";
end
I was forced to make an ">" at the line "msg : Message(payload : payload)"
otherwise, he tells me that he can't expand that line.
There is a way to :
- avoid to put the ">" even if I have to add something else to the dsl ?
- avoid the line "msg : Message(payload : payload)" in my drl and simplify
my dsl so that xPathEquals "know" that the "payload" variable come from
any object Message in Working Memory ?
Thanks :-)
15 years, 5 months
StatefulSessionSnapshotter and full serialization mode
by Michal Bali
Hi,
Is it possible to use full serialization mode
(SerializablePlaceholderResolverStrategy) with StatefulSessionSnapshotter?
It seems that StatefulSessionSnapshotter uses the default which is identity
(IdentityPlaceholderResolverStrategy). Is is possible to change this?
I have a web application that has a long running drools flow. I am trying to
persist this droolsflow using the SingleSessionCommandService from project
drools-process-enterprise.
Thanking you in advance.
Best Regards,
Michal
15 years, 5 months
drools 4.0 and enum in java 1.5
by Thierry B
Hello,
I'd like to use enum in java 1.5 with drools.
I try that :
A message class :
package com.pv.rules.beans;
public class Message {
String payload;
Type type;
public enum Type {
XML;
}
public Message(){
this.type = Type.XML;
}
public Message(String payload){
this.type = Type.XML;
this.payload = payload;
};
public String getPayload(){
return payload;
}
public void setPayload(String payload){
this.payload = payload;
}
public Type getType(){
return type;
}
}
and in my drl :
rule "Contexte1"
when
>msg : Message(type == "XML", payload : payload)
xpathEquals "/Root/aaaa" "bbbb"
xpathEquals "/Root/cccc" "dddd
then
Log : "Contexte 1 ************* : OK";
end
but I've this error :
Unable to resolve ObjectType 'Message' : [Rule name=Contexte1,
agendaGroup=MAIN, salience=0, no-loop=false]
Rule Compilation error : [Rule name=Contexte1, agendaGroup=MAIN,
salience=0, no-loop=false]
Do you have an idea?
Thanks :-)
15 years, 5 months
Oring conditions
by Waleed Zedan
Hi All,
I have this requirment : Rule A -> Condition 1 AND
(Condition 2 OR
Condition 3 OR
Condition 4)
The problem is that OR (||) operators in drools are not a short circuiting
operators like in Java.
May you please tell me an approach to handle this situation , i have already
tried splitting it on multiple rules ,but i am searching for better
approach.
I am using Drools 4.0.7.
Thanks.
Best Regards,
--
Waleed Zedan
15 years, 5 months
recommend way about same when , different then
by Shigeaki Wakizaka
Hi. I'm newbie to Drools.
I'm just wondering how I define the rules with my web application that has
several layers, web,business-logic,and data access.
one rule is used in the wab layer, and another one is used in the
business-logic layer.
Both rule's "when" are the same, but the "then"(action) is different.
It looks like code dupulication.
(I mean when the "when" changes, every rules that has same "when" has to be
changed, right?)
What's the recommended way in this situation?
thanks
Shige
15 years, 5 months