DROOLs callback API for L-value predicate matching events
by Cotton, Ben
Hi, Can someone please point me to compelling examples/sample code of how to use a DROOLs callback API for very high-resolution logging of L-value predicate matching events?
E.g. I want to be able to log when each of these 5 L-value predicates either "MATCHES" or "FAILS TO MATCH" (at the time of the event)
rule "LCHUS_IRS_CURRENCY_RULE" //XLS Item=195
when
IRDCurrencyRuleFact(
productType == "IRS",
currency=="GBP",
upfrontFeePaymentDate < IRDCurrencyRuleFact.terminationDate,
maturity <= 18275, //unit = days, i.e. 50 Years
notional <= 99,999,999,999.99 //max Notional
)
then
System.out.println("LCHUS");
end
Ben D Cotton III
Morgan Stanley & Co.
OTC Derivatives Clearing Technology
1221 AOTA Rockefeller Ctr - Flr 27
New York, NY 10020
(212)762.9094
ben.cotton(a)ms.com<mailto:ben.cotton@ms.com>
________________________________
NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.
13 years
InvalidItemStateException while accessing Guvnor
by worldofprasanna
Hi All ..
We are getting the following error message in Guvnor when trying to access
it.
org.drools.repository.RulesRepositoryException:
javax.jcr.InvalidItemStateException: property
/drools:repository/drools:package_area/com.lsi.sort/assets/Lotting
Guidelines/drools:content: the property cannot be saved because it has been
modified externally.
This occurs in our production system and it is occurring rarely (So We
couldn t reproduce it locally in our environment).
But this issue is resolved when we restarted the Server in which the Guvnor
app is running. But this is nearly impossible as this occurs in production
system.
We are using Oracle DB as our Persistent Manager (as seen in the attachment)
and running the guvnor in clustered environment.
I presume that the issue might be related to versioning in Guvnor ? If so
can anyone guide us to solve this versioning problem ?
Herewith attached the repository.xml file.
Thanks in advance,
Prasanna Venkataraman.
repository.xml
<http://drools.46999.n3.nabble.com/file/n4021115/repository.xml>
--
View this message in context: http://drools.46999.n3.nabble.com/InvalidItemStateException-while-accessi...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years
documentation on rules engine
by Michiel Vermandel
Hi,
I would like to read some documentation on how the rules engine (specifically for planner) works.
I have a number of unanswered questions.
Some type of questions:
- If I have two rules in my drl file, will the engine execute first the first rule with all possible combinations of the planning entities matching the conditions of the rule
and then the second rule with all possible combinations of the planning entities matching the conditions of the rule
- Can I trace which rules are executed with what planning-variables and in which order
- What is the purpose of the last variable amount of parameters ($x, $y, $z) in the RHS logic insertLogical(new IntConstraintOccurrence( ... , $x, $y ,$z))
I know there is http://docs.jboss.org/drools/release/5.5.0.Final/drools-planner-docs/html... but it does not really answer the above questions.
Thanks,
Michiel
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
13 years
Re: [rules-users] debug
by Kevin Kelleher
Hi,
As I see it , this is a big problem.
I was looking at drools about 10 months ago (5.3.0 Final) and debug worked
just fine ... ... so similar to earlier comment of Bruno here.
Today I downloaded drools 5.5.0 Final & eclipse Juno and debug is broken
...
Can we expect a patch? I can't see how we could proceed if this issue is not
resolved.
Any suggestions welcome.
Regards,
Kevin
--
View this message in context: http://drools.46999.n3.nabble.com/debug-tp3889772p4021012.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years
Re: [rules-users] Executing more than one rules having no infinite execution
by Esteban Aliverti
Using drools.halt() is not considered a good practice at all. I would
recommend you to read this post:
http://ilesteban.wordpress.com/2012/11/16/about-drools-and-infinite-execu...
Best Regards,
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Esteban Aliverti
- Blog @ http://ilesteban.wordpress.com
On Fri, Dec 7, 2012 at 8:59 AM, Hushen Savani
<hushen.savani(a)elitecore.com>wrote:
> Hi,****
>
> ** **
>
> I have a simple rule as following:****
>
> ** **
>
> *import java.util.HashMap;*
>
> * *
>
> *rule "first"*
>
> *when*
>
> * a : CrestelRuleModel( $hmap : singleHashMap!=null);*
>
> *then*
>
> * System.out.println("Old Map: " + $hmap);*
>
> * HashMap mapp = new HashMap();*
>
> * mapp.put("hello", "world");*
>
> * a.setSingleHashMap(mapp);*
>
> * System.out.println("New Map: " + a.getSingleHashMap());*
>
> * update(a);*
>
> *end;*
>
> ** **
>
> When I invoke the rule from my client, the rule is executed *infinitely*.*
> ***
>
> ** **
>
> So, I have placed a “*drools.halt()*” before “*end*” statement of above
> rule. So, it stopped executing infinitely as I wanted. But *is it a good
> practice?*****
>
> ** **
>
> Now, I want my input to be filtered by *two rules*, so I have placed
> rules like following:****
>
> ** **
>
> *import java.util.HashMap;*
>
> * *
>
> *rule "first"*
>
> *when*
>
> * a : CrestelRuleModel( $hmap : singleHashMap!=null);*
>
> *then*
>
> * System.out.println("Old Map: " + $hmap);*
>
> * HashMap mapp = new HashMap();*
>
> * mapp.put("hello", "world");*
>
> * a.setSingleHashMap(mapp);*
>
> * System.out.println("New Map: " + a.getSingleHashMap());*
>
> * update(a);*
>
> * drools.halt();*
>
> *end;*
>
> * *
>
> *rule "second"*
>
> *when*
>
> * b : CrestelRuleModel( $hmap2 : singleHashMap!=null);*
>
> *then*
>
> * System.out.println("Old Map2: " + $hmap2);*
>
> * HashMap mapp2 = new HashMap();*
>
> * mapp2.put("hello2", "world2");*
>
> * b.setSingleHashMap(mapp2);*
>
> * System.out.println("New Map2: " + b.getSingleHashMap());*
>
> * update(b);*
>
> * drools.halt();*
>
> *end;*
>
> ** **
>
> But in above case, *only the “second” rule executes*. What to do in
> order to execute both the rules without any infinite loop?****
>
> ** **
>
> Kindly share some pointers on this. Thanks.****
>
> ** **
>
> ** **
>
> *PS*: *CrestelRuleModel* is my POJO model having following fields,****
>
> * *
>
> *public* *class* CrestelRuleModel {****
>
> ****
>
> *private* *ArrayList* arrayListOfHashMap;****
>
> *private* *HashMap* singleHashMap;****
>
> *private* Object object;****
>
> *private* String remarks;****
>
> ** **
>
> //Getters and Setters****
>
> ** **
>
> }****
>
> ** **
>
> Best Regards****
>
> *Hushen Savani* | Crestel Billing****
>
> [image: ecTag]****
>
> ** **
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
13 years
Executing more than one rules having no infinite execution
by Hushen Savani
Hi,
I have a simple rule as following:
import java.util.HashMap;
rule "first"
when
a : CrestelRuleModel( $hmap : singleHashMap!=null);
then
System.out.println("Old Map: " + $hmap);
HashMap mapp = new HashMap();
mapp.put("hello", "world");
a.setSingleHashMap(mapp);
System.out.println("New Map: " + a.getSingleHashMap());
update(a);
end;
When I invoke the rule from my client, the rule is executed infinitely.
So, I have placed a "drools.halt()" before "end" statement of above rule.
So, it stopped executing infinitely as I wanted. But is it a good practice?
Now, I want my input to be filtered by two rules, so I have placed rules
like following:
import java.util.HashMap;
rule "first"
when
a : CrestelRuleModel( $hmap : singleHashMap!=null);
then
System.out.println("Old Map: " + $hmap);
HashMap mapp = new HashMap();
mapp.put("hello", "world");
a.setSingleHashMap(mapp);
System.out.println("New Map: " + a.getSingleHashMap());
update(a);
drools.halt();
end;
rule "second"
when
b : CrestelRuleModel( $hmap2 : singleHashMap!=null);
then
System.out.println("Old Map2: " + $hmap2);
HashMap mapp2 = new HashMap();
mapp2.put("hello2", "world2");
b.setSingleHashMap(mapp2);
System.out.println("New Map2: " + b.getSingleHashMap());
update(b);
drools.halt();
end;
But in above case, only the "second" rule executes. What to do in order to
execute both the rules without any infinite loop?
Kindly share some pointers on this. Thanks.
PS: CrestelRuleModel is my POJO model having following fields,
public class CrestelRuleModel {
private ArrayList arrayListOfHashMap;
private HashMap singleHashMap;
private Object object;
private String remarks;
//Getters and Setters
}
Best Regards
Hushen Savani | Crestel Billing
ecTag
13 years
How to get a package from Guvnor and start it
by DO
I've posted this over in the JBPM forums, but now I think it's more of a
Guvnor question...
Can anyone tell me how to get a process/package from Guvnor and run it from
a java app using the demo setup?
I have installed jbpm via the JBPM 5.4 full installer. I have taken the
ScriptTask.bpmn from jbpm-examples and successfully put it in the Guvnor. I
have added a Model Pojo and was able to build the package inside the default
package. I have even created a snapshot.
Guvnor lists these URLS:
URL for package documentation:
http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defa...
Use this url to download package documentation PDF.
URL for package source:
http://localhost:8080/drools-guvnor/rest/packages/defaultPackage/source
Use this URL to download the source, or in the 'runtime agent' to access
the rules in source form
URL for package binary:
http://localhost:8080/drools-guvnor/rest/packages/defaultPackage/binary
Use this url in the 'runtime agent' to fetch a pre compiled binary.
URL for running tests:
http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defa...
Use this url to run the scenarios remotely and collect results.
Change Set:
http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defa...
URL to change set for deployment agents.
POJO Model:
http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defa...
Additionally it has this link Download binary package which is:
http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defa...
Now I have my main java app:
package org.jbpm.examples.quickstarts;
import java.util.HashMap;
import java.util.Map;
import org.drools.KnowledgeBase;
import org.drools.agent.KnowledgeAgent;
import org.drools.agent.KnowledgeAgentConfiguration;
import org.drools.agent.KnowledgeAgentFactory;
import org.drools.io.Resource;
import org.drools.io.ResourceFactory;
import org.drools.runtime.StatefulKnowledgeSession;
public class HelloRunner {
public static final void main(String[] args) {
try {
// load up the knowledge base
KnowledgeBase kbase = readKnowledgeBase();
StatefulKnowledgeSession ksession =
kbase.newStatefulKnowledgeSession();
Map<String, Object> params = new HashMap<String, Object>();
Person p = new Person("Krisv");
params.put("person", p);
ksession.startProcess("com.sample.script", params);
} catch (Throwable t) {
t.printStackTrace();
}
}
private static KnowledgeBase readKnowledgeBase() throws Exception {
KnowledgeAgentConfiguration aconf =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
KnowledgeAgent kagent =
KnowledgeAgentFactory.newKnowledgeAgent("test", aconf);
String url =
"http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defa...";
UrlResource resource = (UrlResource)
ResourceFactory.newUrlResource(url);
resource.setBasicAuthentication("enabled");
resource.setUsername("guest");
resource.setPassword("guest");
kagent.applyChangeSet(resource);
return kagent.getKnowledgeBase();
}
}
This code runs, authenticates, and then gives me back this error:
ERROR drools.xml.ExtensibleXmlParser.fatalError - (null: 1, 1): Content
is not allowed in prolog.
I figured out this was because I am trying to add the binary package as a
changeset, and it can't parse the binary file as a changeset... so I realize
my approach is kind of flawed...
So how do I get the binary package from Guvnor and start the process?
Thank you!
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-get-a-package-from-Guvnor-and-st...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years
null planning variables
by Michiel Vermandel
Hi,
I have got a Planning entity which takes several planning variables.
The provided variable-lists never contain null elements.
Though, in my rules I get planning entities with uninitialized planning variables (null).
Why is that?
Can this be avoided?
Thanks
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
13 years