Re: [rules-users] rules-users Digest, Vol 40, Issue 55
by Nilima R
Hi All,
Can someone tell me how to use create enums with Dynamic values in Guvnor.
For example I need enum which does not contain static value like A,B,C
rather these A,B,C values come from database.
Nilima
From:
rules-users-request(a)lists.jboss.org
To:
rules-users(a)lists.jboss.org
Date:
03/12/2010 10:36 PM
Subject:
rules-users Digest, Vol 40, Issue 55
Sent by:
rules-users-bounces(a)lists.jboss.org
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: OutOfMemoryError on Marshalling with non-existence check
in flow XOR split (heldeen)
2. Re: high sailence event/utility rules and ruleflows (H.C.)
----------------------------------------------------------------------
Message: 1
Date: Fri, 12 Mar 2010 07:49:03 -0800 (PST)
From: heldeen <heldeen(a)overstock.com>
Subject: Re: [rules-users] OutOfMemoryError on Marshalling with
non-existence check in flow XOR split
To: rules-users(a)lists.jboss.org
Message-ID: <1268408943169-444246.post(a)n3.nabble.com>
Content-Type: text/plain; charset=us-ascii
I think I need to clarify a few things. First the OOME is not in running
the
rules but on marshalling the state for the flow, which I do after each
command using a custom CommandService that marshals the session after each
command is executed. Second, the ValidationRuleFlowGroup is only going to
insert a ValidationResult() if there is something that is invalid. So a
valid set of facts would have no ValidationResult() in memory, hence
wanting
to split to a "valid" branch on "not ValidationResult()".
--
View this message in context:
http://n3.nabble.com/OutOfMemoryError-with-non-existence-check-in-flow-XO...
Sent from the Drools - User mailing list archive at Nabble.com.
------------------------------
Message: 2
Date: Fri, 12 Mar 2010 08:36:16 -0800 (PST)
From: "H.C." <canterburry(a)gmail.com>
Subject: Re: [rules-users] high sailence event/utility rules and
ruleflows
To: rules-users(a)lists.jboss.org
Message-ID: <1268411776720-444339.post(a)n3.nabble.com>
Content-Type: text/plain; charset=us-ascii
Thanks,
I tried this but I don't see my ruleflow group rules coming back and
re-processing once the high priority auto focus rules in my new
"maintenance" agenda group have executed. Do my rules in my ruleflow group
now also need an agenda group and auto-focus set to be re-evaluated?
--
View this message in context:
http://n3.nabble.com/high-sailence-event-utility-rules-and-ruleflows-tp44...
Sent from the Drools - User mailing list archive at Nabble.com.
------------------------------
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
End of rules-users Digest, Vol 40, Issue 55
*******************************************
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
16 years
OutOfMemoryError with non-existence check in flow XOR split
by heldeen
I am using drools marshalling for persistence and am getting an OOME with my
simple rule flow. I have a custom CommandService that persists at the end of
each execution. (I am not using JPA :-( ).
In the rule flow I have a split that checks for the non-existence of a
simple pojo using "not ValidationResult()" as one of the constraints. The
other constraint is ValidationResult(valid == false). I get an
OutOfMemoryError using the "not" in one of the constraints. Changing "not
ValidationResult()" to "ValidationResult(valid == true)" results in normal
operation.
The flow is essentially Start->ValidationRuleFlowGroup->XOR Split->Valid
Action XOR Invalid Action -> End. The ValidationRuleFlowGroup has a simple
set of rules that will insert a ValidationResult() fact if something is not
valid.
Anyone have any idea why checking for the non-existence of a fact causes
this error. I'll post the pojo and the stack trace below.
public class ValidationResult {
private boolean isValid;
private String message;
public boolean isValid() {
return isValid;
}
public void setValid(boolean isValid) {
this.isValid = isValid;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2786)
at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:94)
at
java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputStream.java:1838)
at
java.io.ObjectOutputStream$BlockDataOutputStream.write(ObjectOutputStream.java:1769)
at java.io.DataOutputStream.writeInt(DataOutputStream.java:182)
at
java.io.ObjectOutputStream$BlockDataOutputStream.writeInt(ObjectOutputStream.java:1904)
at java.io.ObjectOutputStream.writeInt(ObjectOutputStream.java:769)
at
org.drools.marshalling.impl.OutputMarshaller.writeLeftTuple(OutputMarshaller.java:459)
at
org.drools.marshalling.impl.OutputMarshaller.writeInitialFactHandleLeftTuples(OutputMarshaller.java:356)
at
org.drools.marshalling.impl.OutputMarshaller.writeFactHandles(OutputMarshaller.java:251)
at
org.drools.marshalling.impl.OutputMarshaller.writeSession(OutputMarshaller.java:85)
at
org.drools.marshalling.impl.DefaultMarshaller.marshall(DefaultMarshaller.java:117)
Thanks,
Heath
--
View this message in context: http://n3.nabble.com/OutOfMemoryError-with-non-existence-check-in-flow-XO...
Sent from the Drools - User mailing list archive at Nabble.com.
16 years
About fusion and collections
by Amit Kumar
Hello All,
Was doing some rule writing and am seeing some issues which I want to
overcome.
In Fusion when we send the facts into working memory.. there seems to be no
way that rules are automatically getting triggered.
We have to call fireAllRules after each fact insertion. Is this the way it
was designed. Its like this in the stocktick example also
This one should be simple for somebody with little more experience than me
In the following rule
rule "raise alarm"
when
Event($type : eventType)
$events: ArrayList (size > 10)
from collect (Event(eventType == $type))
then
raise alarm
In the above rule the raise alarm is getting called 10 times. .. How can I
make it to be called only once.
Thanks
Amit
16 years
issue in using packages
by Nair, Mahesh
H i
our ruleflow is coupled with a struts2 application. we use guvnor generated pkg files and create knowledgebase out of it and use a caching mechanism to store kbases for reuse.
when i create a ksession out of the kbase and start a process , it works for the first time . whenever i try to start the same process second time using the cached kbase, i get the following exception :
ERROR - ExceptionInterceptor.publishException(107) | ExceptionInterceptor received exception java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585) etc ...
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)
Caused by: java.lang.NoSuchMethodError: com.qwest.rx.ruleflow.Process_com_qwest_rx_ruleflow_0.action104(Lorg/drools/spi/
KnowledgeHelper;Lcom/qwest/rx/brain/drools/action/RceHolderUtil;Lorg/drools/spi/ProcessContext;)V
at com.qwest.rx.ruleflow.Process_com_qwest_rx_ruleflow_0Action104Invoker.execute(Process_com_qwest_rx_ruleflow_0Action104Invoker.java:21)
at org.drools.workflow.instance.impl.ExtendedNodeInstanceImpl.executeAction(ExtendedNodeInstanceImpl.java:66)
at org.drools.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerEvent(ExtendedNodeInstanceImpl.java:45)
at org.drools.workflow.instance.impl.ExtendedNodeInstanceImpl.internalTrigger(ExtendedNodeInstanceImpl.java:28)
at org.drools.workflow.instance.node.StateBasedNodeInstance.internalTrigger(StateBasedNodeInstance.java:31)
at org.drools.workflow.instance.node.WorkItemNodeInstance.internalTrigger(WorkItemNodeInstance.java:80)
at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:112)
at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:148)
at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:135)
at org.drools.workflow.instance.node.StartNodeInstance.triggerCompleted(StartNodeInstance.java:49)
at org.drools.workflow.instance.node.StartNodeInstance.internalTrigger(StartNodeInstance.java:41)
at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:112)
at org.drools.ruleflow.instance.RuleFlowProcessInstance.internalStart(RuleFlowProcessInstance.java:16)
at org.drools.process.instance.impl.ProcessInstanceImpl.start(ProcessInstanceImpl.java:185)
at org.drools.workflow.instance.impl.WorkflowProcessInstanceImpl.start(WorkflowProcessInstanceImpl.java:284)
at org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1763)
at org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1741)
at org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:284)
at com.qwest.rx.brain.drools.action.GetNextPageletAction.execute(GetNextPageletAction.java:557)
... 98 more
when i try to create the kbase by parsing rf files directly , they are all working fine. the same caching mechanism works well with rf files parsed kbases.
any thoughts / suggestions?
Regards,
Dipasoke Chattopadhyay | * Office: +91 80 6618 4813 | Email: dipasoke.chattopadhyay(a)qwest.com<mailto:dipasoke.chattopadhyay@qwest.com>
________________________________
This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and destroy
all copies of the communication and any attachments.
16 years
Better way to find rule with max value
by Gaurav
Hi All,
I have aother question on drools.
There can le level1 to level6 present in a rule and we need to pick always
the highest level rule which satisfied list price and discount comdition.
Following code is giving me expected results but do we have any better way
to implement the same. Can I avoid last 2 iternations and combine it to
first one iteration.
RoutingRule.java
----------------
private String level1 = "";
private String level2 = "";
private String level3 = "";
private String level4 = "";
private String level5 = "";
private String level6 = "";
private String serviceSalesPath = "";
private String productSalesPath = "";
private String nonStdTerm = "";
private String currency = "";
private double listPriceFrom = Double.MAX_VALUE ;
private double listPriceTo = Double.MAX_VALUE ;
private double discountPriceFrom = 100;
private double discountPriceTo = 100 ;
private double nodeOfRule =0;
Rule
-----
$selectedTSSRulesWithOutHier : ArrayList()
from collect ($routingRule : RoutingRule(currency == $curr
&& (
listPriceFrom <= $tssListPrice && listPriceTo > $tssListPrice
&& discountPriceFrom <= $tssDisc && discountPriceTo > $tssDisc &&
nonStdTerm =="TSS" )
)
from $tssRoutingRuleList)
$lowestNodeTSS : Double(intValue > 0)
from accumulate ( RoutingRule($nodeOfRule : nodeOfRule)
from $selectedTSSRulesWithOutHier, max($nodeOfRule))
$lowestNodeTSSRule : ArrayList()
from collect( $ruleObj : RoutingRule( eval(nodeOfRule == $lowestNodeTSS) )
from $selectedTSSRulesWithOutHier )
Many thanks in advance,
Gaurav
--
View this message in context: http://n3.nabble.com/Better-way-to-find-rule-with-max-value-tp442484p4424...
Sent from the Drools - User mailing list archive at Nabble.com.
16 years
XStream, Pipeline
by Bertrand Grottier
Hello,
I still have a problem loading facts using XStream. The last line of the following code triggers a com.thoughtworks.xstream.mapper.CannotResolveClassException.
// load up the knowledge base
KnowledgeBase kbase = readKnowledgeBase();
StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession();
// Make the results, in this case the FactHandles, available to the user
Action executeResultHandler = PipelineFactory.newExecuteResultHandler();
// Insert the transformed object into the session associated with the PipelineContext
KnowledgeRuntimeCommand insertStage = PipelineFactory.newStatefulKnowledgeSessionInsert();
insertStage.setReceiver( executeResultHandler );
// Create the transformer instance and create the Transformer stage, where we are going from Xml to Pojo.
XStream xstream = new XStream();
Transformer transformer = PipelineFactory.newXStreamFromXmlTransformer( xstream );
transformer.setReceiver( insertStage );
// Create the start adapter Pipeline for StatefulKnowledgeSessions
Pipeline pipeline = PipelineFactory.newStatelessKnowledgeSessionPipeline( ksession );
pipeline.setReceiver( transformer );
// Instantiate a simple result handler and load and insert the XML
ResultHandlerImpl resultHandler = new ResultHandlerImpl();
InputStream is = new FileInputStream("D:/workspaces/prise_main_drools/src/main/rules/lproduits.xml");
pipeline.insert( is, resultHandler );
Any idea ?
Thank you in advance.
Regards,
Benoît
_________________________________________________________________
Consultez gratuitement vos emails Orange, Gmail, Free, ... directement dans HOTMAIL !
http://www.windowslive.fr/hotmail/agregation/
16 years
high sailence event/utility rules and ruleflows
by H.C.
I have a number of business rules structured into ruleflow groups and a
ruleflow to determine the order of execution of these groups. At the same
time, I have a number of maintenance and utility rules that do side tasks
such as maintain counts or summations, detect error conditions etc. These
utility rules need to come in immediately whenever necessary and don't
belong to any one ruleflow group but should fire whenever needed anywhere.
In other rule engine products I have used event rules to accomplish this.
I drools I am trying to achieve the same with setting a high salience on
these rules and not tagging them with with a ruleflow group.
Will this work correctly in drools when used with ruleflows? Will all rules
within a particular ruleflow group fire and then re-fire if these
maintenance rules update facts in the LHS...or...will the entire flow
complete and only then will these maintenance rules be considered since they
don't have a flow group?
Are there other ways to accomplish what I describe in drools?
Thanks.
--
View this message in context: http://n3.nabble.com/high-sailence-event-utility-rules-and-ruleflows-tp44...
Sent from the Drools - User mailing list archive at Nabble.com.
16 years
Problems count and sumarizing data in facts
by Yamil Bracho
Hi, I have two kind of facts in a map.There is a field called _TYPE_ (H)eader, D)etail)In the Header line I have two String fields, one for the number of details lines ("NU_REGISTROS") and another for the sum of the detail line ("MT_TOTAL")In the detail lines I only have a String field called "MONTO"
I would like to build two rules. One to check the count of detail lines versus the field in the header line so I wrote :
rule "Contador de lineas detalle vs Header" salience 10 when $numRecs : Number() from accumulate(Map(this["_TYPE_"] == "D", $d : this["_NUMLINE_"]), count($d)) $map : Map(this["_TYPE_"] == "H", this["NU_REGISTROS"] != $numRecs) then System.out.println("NumRecs=" + $numRecs); listBitacora.add(new BitacoraDTO($map.get("_NUMLINE_"), "Error en el Detalle: El número del lineas de detalle (" + $total + ") no empareja con lo del encabezado (" + $map.get("NU_REGISTROS") + ")")); end However I always got "NumRecs=1" when i print out the value of $numRecs but I am absolute sure there is two details lines... Second when i try to sumarize the total field in the details line i got (MONTO in the detail line is a string): rule "Sumatoria de lineas detalle vs Header" salience 10 when $total : Number() from accumulate(Map(this["_TYPE_"] == "D", $monto : this["MONTO"]), sum(eval(Double.valueOf((String) $monto )))) $map : Map(this["_TYPE_"] == "H", this["MT_TOTAL"] != $total) then System.out.println("TOTAL=" + $total); listBitacora.add(new BitacoraDTO($map.get("_NUMLINE_"), "Error en el Detalle: El número del lineas de detalle (" + $total + ") no empareja con lo del encabezado (" + $map.get("NU_REGISTROS") + ")")); end but I got Rule Compilation error : [Rule name='Sumatoria de lineas detalle vs Header'] rule/Rule_Sumatoria_de_lineas_detalle_vs_Header_0.java (9:1313) : The method eval(Double) is undefined for the type Rule_Sumatoria_de_lineas_detalle_vs_Header_0
Any help in those tow problems TIA
Yamil
_________________________________________________________________
Escucha a quienes ya han probado Windows 7 ¡Hazlo aquí!
http://www.sietesunpueblodeexpertos.com/index_windows7.html
16 years