<div> </div>
<div>YOu can use collect function. Please refer <a href="http://blog.athico.com/2007/06/chained-from-accumulate-collect.html">http://blog.athico.com/2007/06/chained-from-accumulate-collect.html</a></div>
<div><br><br> </div>
<div><span class="gmail_quote">On 8/26/09, <b class="gmail_sendername"><a href="mailto:rules-users-request@lists.jboss.org">rules-users-request@lists.jboss.org</a></b> <<a href="mailto:rules-users-request@lists.jboss.org">rules-users-request@lists.jboss.org</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Send rules-users mailing list submissions to<br> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<br>To subscribe or unsubscribe via the World Wide Web, visit<br> <a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:rules-users-request@lists.jboss.org">rules-users-request@lists.jboss.org</a><br><br>You can reach the person managing the list at<br> <a href="mailto:rules-users-owner@lists.jboss.org">rules-users-owner@lists.jboss.org</a><br>
<br>When replying, please edit your Subject line so it is more specific<br>than "Re: Contents of rules-users digest..."<br><br><br>Today's Topics:<br><br> 1. Rule for Collection (Ashish Soni)<br> 2. Using KnowledgeAgent with Stateful session (nestabur)<br>
3. Re: Cannot view Process Definitions in gwt-console (rbms)<br> 4. Re: Using KnowledgeAgent with Stateful session (James Owen)<br><br><br>----------------------------------------------------------------------<br><br>Message: 1<br>
Date: Wed, 26 Aug 2009 12:22:55 -0400<br>From: Ashish Soni <<a href="mailto:learnspring@gmail.com">learnspring@gmail.com</a>><br>Subject: [rules-users] Rule for Collection<br>To: Rules Users List <<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>><br>
Message-ID:<br> <<a href="mailto:cf7a8a020908260922je3d0f9cie85eada146f594e9@mail.gmail.com">cf7a8a020908260922je3d0f9cie85eada146f594e9@mail.gmail.com</a>><br>Content-Type: text/plain; charset="iso-8859-1"<br>
<br>Hi All ,<br><br>Can someone please help how can i write a rule for below condition -<br><br>I have Student object which contains List of Courses<br><br>public Class Person<br>{<br> private List<Course> courseList;<br>
}<br><br>public Class Course<br>{<br> private String name;<br> private int duration;<br>}<br><br>Now lets say the list of course inside person object contains 10 course<br>objects and if one of the course object contain name =="XYZ" and another<br>
contain a duration = 20 hours then how i can write a rule for this.<br><br><br>Thanks.<br>-------------- next part --------------<br>An HTML attachment was scrubbed...<br>URL: <a href="http://lists.jboss.org/pipermail/rules-users/attachments/20090826/f74f64ca/attachment-0001.html">http://lists.jboss.org/pipermail/rules-users/attachments/20090826/f74f64ca/attachment-0001.html</a><br>
<br>------------------------------<br><br>Message: 2<br>Date: Wed, 26 Aug 2009 09:34:33 -0700 (PDT)<br>From: nestabur <<a href="mailto:nestabur@gmail.com">nestabur@gmail.com</a>><br>Subject: [rules-users] Using KnowledgeAgent with Stateful session<br>
To: <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>Message-ID: <<a href="mailto:25151447.post@talk.nabble.com">25151447.post@talk.nabble.com</a>><br>Content-Type: text/plain; charset=us-ascii<br>
<br><br><br>Does anyone tried to use the knowledgeAgent with statefulSessions?<br><br>I've tried to configure my rule engine obtaining unexpected behaviour.<br><br>I configure my statefulSession as follows:<br><br>wm = (ReteooStatefulSession) ((KnowledgeBaseImpl) kagent<br>
.getKnowledgeBase()).ruleBase.newStatefulSession(<br> (SessionConfiguration) sessionConf, env);<br>ksession = new StatefulKnowledgeSessionImpl(wm, kagent.getKnowledgeBase());<br>
<br>And after updating the KnowledgeBase in the agent I update my ksession:<br><br>wm.setRuleBase((InternalRuleBase) ((KnowledgeBaseImpl) kagent<br> .getKnowledgeBase()).ruleBase);<br>
ksession = new StatefulKnowledgeSessionImpl(wm, kagent.getKnowledgeBase());<br><br>Without using entry-points this approach works as expected, but using them<br>it fails after the first update throwing the error:<br><br>Exception while processing message: java.lang.NullPointerException<br>
java.lang.NullPointerException<br> at<br>org.drools.reteoo.ReteooFactHandleFactory.newFactHandle(ReteooFactHandleFactory.java:54)<br> at<br>org.drools.common.AbstractFactHandleFactory.newFactHandle(AbstractFactHandleFactory.java:79)<br>
at<br>org.drools.common.AbstractFactHandleFactory.newFactHandle(AbstractFactHandleFactory.java:66)<br> at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:109)<br> at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:80)<br>
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:28)<br><br>Browsing the drools core code I found the line that was throwing the<br>exception and tried to get the same result by implementing:<br><br>
if (!((InternalRuleBase) ((KnowledgeBaseImpl)<br>ksession.getKnowledgeBase()).ruleBase)<br> .getTypeDeclaration(fact.getClass()) == null)<br> <a href="http://log.info">log.info</a> (((InternalRuleBase) ((KnowledgeBaseImpl)<br>
ksession.getKnowledgeBase()).ruleBase)<br><br>.getTypeDeclaration(fact.getClass()).getTimestampExtractor().toString());<br><br>after updating my ksession. The result was the same, again the same<br>exception thrown but my logger wrote:<br>
18:01:50,232 INFO [ClassFieldExtractor class=MyPackage.MyFact<br>field=myTimestampField]<br><br>So I dont know why the core is throwing that exception, is that<br>implementation correct?, any ideas?<br><br><br>Thanks,<br>
<br>Nestor<br><br>--<br>View this message in context: <a href="http://www.nabble.com/Using-KnowledgeAgent-with-Stateful-session-tp25151447p25151447.html">http://www.nabble.com/Using-KnowledgeAgent-with-Stateful-session-tp25151447p25151447.html</a><br>
Sent from the drools - user mailing list archive at Nabble.com.<br><br><br><br>------------------------------<br><br>Message: 3<br>Date: Wed, 26 Aug 2009 11:37:55 -0700 (PDT)<br>From: rbms <<a href="mailto:rbms@hotmail.com">rbms@hotmail.com</a>><br>
Subject: Re: [rules-users] Cannot view Process Definitions in<br> gwt-console<br>To: <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>Message-ID: <<a href="mailto:25152800.post@talk.nabble.com">25152800.post@talk.nabble.com</a>><br>
Content-Type: text/plain; charset=us-ascii<br><br><br>Thanks for the reply Kris,<br><br>I finally found the issue. When file is uploaded from guvnor, looks like the<br>compile package bytes property is not set in the repo.<br>
<br>So I had to invoke rebuildPackages function from<br>org.drools.guvnor.server.ServiceImplementation.loadRuleAsset function<br><br>thanks<br>-Ramesh<br><br><br>Kris Verlaenen wrote:<br>><br>> Because the gwt-console does not allow you to specify which knowledge<br>
> package should be loaded (yet), it currently uses the "default" package.<br>> Putting your rule flow in a package called "default" (and then building<br>> that package in Guvnor) should solve your issue I think. You could also<br>
> change the name of the package to load in the changeset.xml file in<br>> drools-gwt-console.<br>><br>> Kris<br>><br>> Quoting rbms <<a href="mailto:rbms@hotmail.com">rbms@hotmail.com</a>>:<br>><br>
>><br>>> I am trying to deploy drools-guvnor, gwt-console in Tomcat.<br>>> I am using mysql for persistence.<br>>> I uploaded the process definitions in drools-guvnor.(I can see them<br>>> Packages<br>
>> --> defaultPackage --> RuleFlows)<br>>> However when I try to view them in Processes --> Process Definitions<br>>> --><br>>> Definition List, I cannot see them.<br>>><br>>> Following is from tomcat server log.(with debugging statements that<br>
>> I<br>>> added.)<br>>><br>>> I placed debug statements in<br>>> org.drools.guvnor.server.files.PackageDeploymentServlet.doGet method.<br>>> This<br>>> method calls<br>>> org.drools.guvnor.server.files.FileManagerUtils.loadBinaryPackage<br>
>> method.<br>>><br>>> //Following is the debug statement that I placed in<br>>> org.drools.guvnor.server.files.FileManagerUtils.loadBinaryPackage<br>>> method.<br>>> public String loadBinaryPackage(String packageName,<br>
>> String packageVersion,<br>>> boolean isLatest,<br>>> OutputStream out) throws<br>>> IOException {<br>
>> PackageItem item = null;<br>>> if ( isLatest ) {<br>>> item = repository.loadPackage( packageName );<br>>> System.out.println("FileManagerUtils.loadBinaryPackage() ...");<br>
>> AssetItemIterator ai = item.queryAssets("drools:format='rf'",<br>>> false);<br>>> for (;ai.hasNext();) {<br>>> Object o = ai.next();<br>>> System.out.println("FileManagerUtils.loadBinaryPackage item = "<br>
>> +<br>>> o.getClass() +":"+o);<br>>><br>>><br>> System.out.println("*************************************************************************");<br>>> }<br>>><br>
>> As you can see the servlet returns the rule flow.<br>>><br>>> I also placed some debug statements in<br>>> org.drools.rule.Package.readExternal<br>>> method. As you can see when it comes to this method rule flow is<br>
>> empty.<br>>><br>>> Because of this<br>>> org.drools.integration.console.DroolsFlowCommandDelegate.getProcesses()<br>>> function returns 0 process definitions.<br>>><br>>> Can somebody help?<br>
>><br>>> ********************************************************<br>>> [2009:08:231 22:08:625:debug] KnowledgeAgent rebuilding KnowledgeBase<br>>> using<br>>> ChangeSet<br>>> [2009:08:231 22:08:625:debug] KnowledgeAgent building<br>
>> resource=[UrlResource<br>>><br>> path='<a href="http://localhost:8081/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST">http://localhost:8081/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST</a>']<br>
>> PackageName: defaultPackage<br>>> //org.drools.guvnor.server.files.PackageDeploymentServlet.doGet -<br>>> Begin<br>>> PackageVersion: LATEST<br>>> PackageIsLatest: true<br>>> PackageIsSource: false<br>
>> requestURI:<br>>> /drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST<br>>> test:<br>>> /drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST<br>>> //org.drools.guvnor.server.files.PackageDeploymentServlet.doGet -<br>
>> End<br>>> FileManagerUtils.loadBinaryPackage() ... //<br>>> org.drools.guvnor.server.files.FileManagerUtils.loadBinaryPackage -<br>>> Begin<br>>> FileManagerUtils.loadBinaryPackage item = class<br>
>> org.drools.repository.AssetItem:Content of rule item named 'testRF':<br>>> Content: <?xml version="1.0" encoding="UTF-8"?><br>>> <process xmlns="<a href="http://drools.org/drools-5.0/process">http://drools.org/drools-5.0/process</a>"<br>
>> xmlns:xs="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>"<br>>> xs:schemaLocation="<a href="http://drools.org/drools-5.0/process">http://drools.org/drools-5.0/process</a><br>
>> drools-processes-5.0.xsd"<br>>> type="RuleFlow" name="ProjectApprovalProcess"<br>>> id="ProjectApprovalProcess" package-name="defaultPackage" ><br>
>><br>>> <header><br>>> <variables><br>>> <variable name="project" ><br>>> <type<br>>> name="org.drools.process.core.datatype.impl.type.ObjectDataType"<br>
>> className="com.yesVin.workflow.project.Project" /><br>>> </variable><br>>> <variable name="status" ><br>>> <type<br>>> name="org.drools.process.core.datatype.impl.type.StringDataType" /><br>
>> </variable><br>>> </variables><br>>> </header><br>>><br>>> <nodes><br>>> <start id="1" name="Start" x="15" y="11" width="80" height="40"<br>
>> /><br>>> <end id="2" name="End" x="206" y="442" width="80" height="40" /><br>>> <humanTask id="3" name="Review Project" x="126" y="12"<br>
>> width="80"<br>>> height="40" ><br>>> ..<br>>> ...<br>>> .....<br>>> ......<br>>> //org.drools.guvnor.server.files.FileManagerUtils.loadBinaryPackage<br>>> -<br>
>> End<br>>> Package.readExternal isDroolsStream = true //<br>>> org.drools.rule.Package.readExternal - Begin<br>>> Package.readExternal pkg = null<br>>> dialectRuntimeRegistry =<br>>> org.drools.rule.DialectRuntimeRegistry@198046<br>
>> name = defaultPackage<br>>> imports =<br>>> {defaultPackage.*=org.drools.rule.ImportDeclaration@d75e0360}<br>>> staticImports = []<br>>> functions = {}<br>>> factTemplates = {}<br>>> ruleFlows = {}<br>
>> globals = {}<br>>> valid = true<br>>> rules = {}<br>>> classFieldAccessorStore =<br>>> org.drools.base.ClassFieldAccessorStore@34b350<br>>> //org.drools.rule.Package.readExternal - End<br>
>> --<br>>> View this message in context:<br>>><br>> <a href="http://www.nabble.com/Cannot-view-Process-Definitions-in-gwt-console-tp25056005p25056005.html">http://www.nabble.com/Cannot-view-Process-Definitions-in-gwt-console-tp25056005p25056005.html</a><br>
>> Sent from the drools - user mailing list archive at Nabble.com.<br>>><br>>> _______________________________________________<br>>> rules-users mailing list<br>>> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
>> <a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>>><br>><br>><br>><br>><br>> Disclaimer: <a href="http://www.kuleuven.be/cwis/email_disclaimer.htm">http://www.kuleuven.be/cwis/email_disclaimer.htm</a><br>
> _______________________________________________<br>> rules-users mailing list<br>> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>> <a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
><br>><br><br>--<br>View this message in context: <a href="http://www.nabble.com/Cannot-view-Process-Definitions-in-gwt-console-tp25056005p25152800.html">http://www.nabble.com/Cannot-view-Process-Definitions-in-gwt-console-tp25056005p25152800.html</a><br>
Sent from the drools - user mailing list archive at Nabble.com.<br><br><br><br>------------------------------<br><br>Message: 4<br>Date: Wed, 26 Aug 2009 16:31:04 -0500<br>From: James Owen <<a href="mailto:jco2009@att.net">jco2009@att.net</a>><br>
Subject: Re: [rules-users] Using KnowledgeAgent with Stateful session<br>To: Rules Users List <<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>><br>Message-ID: <<a href="mailto:7DCB55B5-8A89-481A-BCDC-77E4A2C5F0B6@att.net">7DCB55B5-8A89-481A-BCDC-77E4A2C5F0B6@att.net</a>><br>
Content-Type: text/plain; charset="us-ascii"<br><br>Greetings:<br><br>Nobody seems to be replying and I'm not really "qualified" to reply<br>but I might be able to point you in the right direction. Long, long<br>
ago in a land far, far away we did a really cool project using<br>Intelligent Agents and employed most of the technology from FIPA, The<br>Foundation for Intelligent Physical Agents; see <a href="http://www.fipa.org/">http://www.fipa.org/</a><br>
for more information.<br><br>SDG<br>James Owen<br>Founder October Rules Fest<br>Senior Consultant / Architect KBSC<br><a href="http://www.kbsc.com">http://www.kbsc.com</a><br><a href="http://www.OctoberRulesFest.org">http://www.OctoberRulesFest.org</a><br>
Twitter: OctRulesFest<br>Blogs:<br><a href="http://JavaRules.blogspot.com">http://JavaRules.blogspot.com</a> [Rulebased Systems Blog]<br><a href="http://ORF2009.blogspot.com">http://ORF2009.blogspot.com</a> [October Rules Fest Blog]<br>
<a href="http://exscg.blogspot.com/">http://exscg.blogspot.com/</a> [Expert Systems Consulting Group Blog]<br><br>"If I have seen a little further it is by standing on the shoulders of<br>giants."<br>Sir Isaac Newton in a letter to Robert Hooke, 5 Feb 1676<br>
<br>Come to October Rules Fest and stand on the shoulders of the Giants of<br>the industry; if only for a week.<br><br><br><br>On Aug 26, 2009, at 11:34 AM, nestabur wrote:<br><br>><br>><br>> Does anyone tried to use the knowledgeAgent with statefulSessions?<br>
><br>> I've tried to configure my rule engine obtaining unexpected behaviour.<br>><br>> I configure my statefulSession as follows:<br>><br>> wm = (ReteooStatefulSession) ((KnowledgeBaseImpl) kagent<br>
> .getKnowledgeBase()).ruleBase.newStatefulSession(<br>> (SessionConfiguration) sessionConf, env);<br>> ksession = new StatefulKnowledgeSessionImpl(wm,<br>
> kagent.getKnowledgeBase());<br>><br>> And after updating the KnowledgeBase in the agent I update my<br>> ksession:<br>><br>> wm.setRuleBase((InternalRuleBase) ((KnowledgeBaseImpl) kagent<br>> .getKnowledgeBase()).ruleBase);<br>
> ksession = new StatefulKnowledgeSessionImpl(wm,<br>> kagent.getKnowledgeBase());<br>><br>> Without using entry-points this approach works as expected, but<br>> using them<br>> it fails after the first update throwing the error:<br>
><br>> Exception while processing message: java.lang.NullPointerException<br>> java.lang.NullPointerException<br>> at<br>> org<br>> .drools<br>> .reteoo<br>> .ReteooFactHandleFactory.newFactHandle(ReteooFactHandleFactory.java:<br>
> 54)<br>> at<br>> org<br>> .drools<br>> .common<br>> .AbstractFactHandleFactory<br>> .newFactHandle(AbstractFactHandleFactory.java:79)<br>> at<br>> org<br>> .drools<br>> .common<br>
> .AbstractFactHandleFactory<br>> .newFactHandle(AbstractFactHandleFactory.java:66)<br>> at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:109)<br>> at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:80)<br>
> at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:28)<br>><br>> Browsing the drools core code I found the line that was throwing the<br>> exception and tried to get the same result by implementing:<br>
><br>> if (!((InternalRuleBase) ((KnowledgeBaseImpl)<br>> ksession.getKnowledgeBase()).ruleBase)<br>> .getTypeDeclaration(fact.getClass()) == null)<br>> <a href="http://log.info">log.info</a> (((InternalRuleBase) ((KnowledgeBaseImpl)<br>
> ksession.getKnowledgeBase()).ruleBase)<br>><br>> .getTypeDeclaration<br>> (fact.getClass()).getTimestampExtractor().toString());<br>><br>> after updating my ksession. The result was the same, again the same<br>
> exception thrown but my logger wrote:<br>> 18:01:50,232 INFO [ClassFieldExtractor class=MyPackage.MyFact<br>> field=myTimestampField]<br>><br>> So I dont know why the core is throwing that exception, is that<br>
> implementation correct?, any ideas?<br>><br>><br>> Thanks,<br>><br>> Nestor<br>><br>> --<br>> View this message in context: <a href="http://www.nabble.com/Using-KnowledgeAgent-with-Stateful-session-tp25151447p25151447.html">http://www.nabble.com/Using-KnowledgeAgent-with-Stateful-session-tp25151447p25151447.html</a><br>
> Sent from the drools - user mailing list archive at Nabble.com.<br>><br>> _______________________________________________<br>> rules-users mailing list<br>> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br>-------------- next part --------------<br>An HTML attachment was scrubbed...<br>URL: <a href="http://lists.jboss.org/pipermail/rules-users/attachments/20090826/f3daf7ee/attachment.html">http://lists.jboss.org/pipermail/rules-users/attachments/20090826/f3daf7ee/attachment.html</a><br>
<br>------------------------------<br><br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br><br>End of rules-users Digest, Vol 33, Issue 81<br>*******************************************<br></blockquote></div><br>