[rules-users] Adding multi-select listbox to Guvnor for entering array of values in 'IN' condition
To author LHS conditions that use an array of values, like IN or NOT IN, Guvnor requires entry of a comma-delimited list of values in a textbox. I would sure like to provide the same type of db-enabled list box for selecting multiple values that Guvnor supports for selecting single values. However, I can't seem to find a way to do this. Any thoughts? Ken -- View this message in context: http://drools.46999.n3.nabble.com/Adding-multi-select-listbox-to-Guvnor-for-entering-array-of-values-in-IN-condition-tp4019714.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Error when Loading New KnowledgeBuilder
I just built installed the Drools Eclipse plug-in on a new development machine, and now whenever I load a new KnowledgeBuilder (KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();), the source of PackageBuilderConfiguration.class loads in a new tab with the following lines before the code: Class File Editor Source not found The JAR of this class file belongs to container 'Drools Library' which does not allow modifications to source attachments on its entries. The default 5.0.1 Drools Runtime jars are in the Drools Library path, just like on my previous development machine. Any thoughts? Ken Archer ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] DRLParser not parsing collections
I have successfully used DRLParser with several DRL files, except when they include the 'contains' syntax. My code for parsing DRL and then dumping into XML, is below: public class DroolsDumper { public static final void main(String[] args) throws DroolsParserException { DrlParser parser = new DrlParser(); PackageDescr descr = parser.parse(new InputStreamReader(DroolsDumper.class.getResourceAsStream("/source.drl" ))); // Dump to xml rule. XmlDumper dumper = new XmlDumper(); String result = dumper.dump(descr); System.out.println(result); }} This code returns the following error when the DRL includes 'contains' syntax: Exception in thread "main" java.lang.NullPointerException at org.drools.xml.XmlDumper.visitPackageDescr(XmlDumper.java:224) at org.drools.xml.XmlDumper.dump(XmlDumper.java:71) at com.sample.DroolsDumper.main(DroolsDumper.java:19) This code works fine with the following DRL (whether I dump the parsed DRL into XML or back into DRL): rule 'cart rule' dialect "mvel" when Cart () then System.out.println("Hello World"); end But it returns the above error when the same DRL includes 'contains': rule 'cart rule' dialect "mvel" when Cart (skus contains (123)) then System.out.println("Hello World"); end The DRL works fine in test scenarios and my cart class's array is declared simply as follows: package shopping; import java.util.ArrayList; public class Cart { public ArrayList skus = new ArrayList(); public ArrayList getSkus() { return skus; } public void setSkus(ArrayList skus) { this.skus = skus; } } ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Collections of Collections
There are certain domains where a collection of objects is itself a member of a different collection of objects (e.g. zips in counties in states, persons in cars at intersections). In these domains, it would be helpful to create LHS conditions on the individual members of the "subcollection". An very hypothetical example of a rule that send direct mail to wealthy zip codes in counties with dealers in states where a business is licensed. WHEN $ServiceableState: State (LicensedInState=True) $CountiesWithDealers: County (DealersInCounty>0) from $ServiceableState.counties $WealthyZips: Zip (AvgIncome>$100,000) from $CountiesWithDealers.zips //2nd from not allowed THEN $WealthyZips.SendDirectMail () I know Collect and Accumulate support nested From keywords, but can you nest From keywords themselves to handle collections of collections? Ken Archer Telogical Systems ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Matching 2 Arrays
To create a condition to check if any value within an array of a fact matches any value within an array of values in a rule, the only only approach that seems to work is: WHEN ( CONTAINS || CONTAINS || ...) Is there a more straightforward and elegant approach this type of matching? Ken Archer Telogical Systems ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Authoring Rules in non-JVM Client Apps
The http/xml/json interface provided by drools-server for remote execution of rules from non-JVM apps is wonderful. Is there a similar interface for importing rules authored in non-JVM client apps as xml or drl files? I have not been able to find one. Thanks in advance. Ken Archer Telogical Systems ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Templates Documented as Experimental from Community, not from Red Hat
The jboss.org documentation describes rule templates as "an experimental feature. In particular, the API is subject to change". However, the Red Hat documentation does not caveat rule templates as "experimental" in any way. Are templates (which are available in other BRMSs) no longer considered "experimental"? Thanks so much. Ken Archer Telogical Systems ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How to Enrich Facts with Data from a Database
Earnie, Thanks for this. Do your two solutions to fact enrichment presume use of the Hibernate framework to interact with a database in the rules? Would an example of your first solution be the following? when $w : WMFact($key : id) $d : DatabaseFact(parentKey == $key) then $w.Field1=$d.Field1 AND $w.Field2=$d.Field2 AND $w.Field3=$d.Field3 Ken Date: Tue, 28 Jul 2009 09:35:47 -0700 From: earnied...@yahoo.com To: rules-users@lists.jboss.org Subject: Re: [rules-users] How to Enrich Facts with Data from a Database One way is to extend the original classes and add the desired attributes, then insert the extended class into WorkingMemory. You could then use RHS to modify matched facts. Another way is to inject "related" facts. So your LHS matches a fact and you insert a new "related" fact in the RHS. Rules that must evaluate data from both facts can the do something like this: when $b : BaseFact($key : id) $r : RelatedFact(parentKey == $key) then ... I have used both albeit on small sets of facts and both worked fine. Earnie! From: Ken Archer To: rules-users@lists.jboss.org Sent: Tuesday, July 28, 2009 12:22:37 PM Subject: [rules-users] How to Enrich Facts with Data from a Database I would like to append values to facts in working memory with values from a database before rules processing. The Fusion documentation says, “one of the most common use cases for rules is event data enrichment”, but no documentation seems to explain how this is done whether we’re talking about events or just plain old facts. And the RHS syntax seems to be limited to working with data already in working memory. How can I enrich facts with data from another system? Thanks in advance. Ken Archer Telogical Systems ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] How to Enrich Facts with Data from a Database
I would like to append values to facts in working memory with values from a database before rules processing. The Fusion documentation says, “one of the most common use cases for rules is event data enrichment”, but no documentation seems to explain how this is done whether we’re talking about events or just plain old facts. And the RHS syntax seems to be limited to working with data already in working memory. How can I enrich facts with data from another system? Thanks in advance. Ken Archer Telogical Systems ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users