Re: [rules-users] Firing Mulitple packages
for( KnowledgePackage kp: kbase.getKnowledgePackages() ){ System.out.println( kp.getName() ); } // -W On 30 November 2011 15:25, srinivasasanda wrote: > Hi Vignesh and Esteban, > > Please help me out in this issue..From your code,I'm trying to display the > packages present in the kbase.But it is displaying hashcode instead of > Package name.Here is my code > > KnowledgeBuilder kbuilder1 = KnowledgeBuilderFactory.newKnowledgeBuilder(); > > KnowledgeBuilder kbuilder2 = KnowledgeBuilderFactory.newKnowledgeBuilder(); > > kbuilder1.add(ResourceFactory.newUrlResource("http://localhost:8082/guvnor-5.2.0.Final-jboss-as-5.1/org.drools.guvnor.Guvnor/package/big/LATEST";),ResourceType.PKG); > > kbuilder2.add(ResourceFactory.newUrlResource("http://localhost:8082/guvnor-5.2.0.Final-jboss-as-5.1/org.drools.guvnor.Guvnor/package/persondetails/LATEST";),ResourceType.PKG); > KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); > kbase.addKnowledgePackages(kbuilder1.getKnowledgePackages()); > kbase.addKnowledgePackages(kbuilder2.getKnowledgePackages()); > Collection c=for; > Iterator it=c.iterator(); > while(it.hasNext()) > { > > System.out.println(it.next().toString()); > } > > The output is > > org.drools.definitions.impl.KnowledgePackageImp@1f0b7d3 > org.drools.definitions.impl.KnowledgePackageImp@b4be3d > > I need to display package names present in KBase as(big,persondetails which > are packagenames)..Please help > me > > -- > View this message in context: > http://drools.46999.n3.nabble.com/Firing-Mulitple-packages-tp1127290p3548459.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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Firing Mulitple packages
Hi Vignesh and Esteban, Please help me out in this issue..From your code,I'm trying to display the packages present in the kbase.But it is displaying hashcode instead of Package name.Here is my code KnowledgeBuilder kbuilder1 = KnowledgeBuilderFactory.newKnowledgeBuilder(); KnowledgeBuilder kbuilder2 = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder1.add(ResourceFactory.newUrlResource("http://localhost:8082/guvnor-5.2.0.Final-jboss-as-5.1/org.drools.guvnor.Guvnor/package/big/LATEST";),ResourceType.PKG); kbuilder2.add(ResourceFactory.newUrlResource("http://localhost:8082/guvnor-5.2.0.Final-jboss-as-5.1/org.drools.guvnor.Guvnor/package/persondetails/LATEST";),ResourceType.PKG); KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages(kbuilder1.getKnowledgePackages()); kbase.addKnowledgePackages(kbuilder2.getKnowledgePackages()); Collection c=kbase.getKnowledgePackages(); Iterator it=c.iterator(); while(it.hasNext()) { System.out.println(it.next().toString()); } The output is org.drools.definitions.impl.KnowledgePackageImp@1f0b7d3 org.drools.definitions.impl.KnowledgePackageImp@b4be3d I need to display package names present in KBase as(big,persondetails which are packagenames)..Please help me -- View this message in context: http://drools.46999.n3.nabble.com/Firing-Mulitple-packages-tp1127290p3548459.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
Re: [rules-users] Firing Mulitple packages
Hi Esteban, Its working now, actually i had given the wrong package name for my rule flow which i had added from my eclipse package whereas the one in Guvnor was different, which had created the problem/confusion. Thanks a lot for your suggestion. I have another question in this regard, Is it possible to fire a specific rule in any of the packages added to the Kbase/StatefulKnowledgeSession? I tried this logic with RuleBase using WorkingMemory by giving the AgendaFilter with the rule name and I was able to fire the specific rule, but when i tried the same with Kbase/StatefulKnowledgeSession i was not able to do the same, could you please help me on this? Thanks, Vignesh -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Firing-Mulitple-packages-tp1127290p1191467.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Firing Mulitple packages
Hi, Using a single kbuilder should also work. Beyond that, I don't see anything wrong in your code. You can check for errors in your kbuilder after the packages were added: if (kbuilder.hasErrors()){ Iterator errors = kbuilder.getErrors().iterator(); while (errors.hasNext()){ System.out.println("Error: "+errors.next().getMessage()); } throw new IllegalStateException("Errors during resource compilation"); } Could you be more specific about your expectations? i.e: How do you know processes are not being added? Regarding to DSL assets, you are not going to see them in the PKG. DSL and DSLR are used during package compilation, and only the generated rules are added to the resulting package. Esteban Aliverti - Developer @ http://www.plugtree.com - Blog @ http://ilesteban.wordpress.com On Sat, Aug 14, 2010 at 8:11 AM, Vignesh wrote: > > Hi Esteban, > > I have added the complete package into the kbuilder using the package url, > Below is the way Im using to add the package, > > KnowledgeBuilder kbuilder1 = KnowledgeBuilderFactory.newKnowledgeBuilder(); > KnowledgeBuilder kbuilder2 = KnowledgeBuilderFactory.newKnowledgeBuilder(); > kbuilder1.add(ResourceFactory.newUrlResource(" > http://localhost:8983/drools-guvnor/org.drools.guvnor.Guvnor/package/test1/LATEST > "),ResourceType.PKG); > kbuilder2.add(ResourceFactory.newUrlResource(" > http://localhost:8983/drools-guvnor/org.drools.guvnor.Guvnor/package/test2/LATEST > "),ResourceType.PKG); > KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); > kbase.addKnowledgePackages(kbuilder1.getKnowledgePackages()); > kbase.addKnowledgePackages(kbuilder2.getKnowledgePackages()); > StatefulKnowledgeSession wrkMemory = kbase.newStatefulKnowledgeSession(); > int i=wrkMemory.fireAllRules(); > > Let me know whether this approach is fine or if Im missing something here, > provide your comments on the same. > > Thanks, > Vignesh > -- > View this message in context: > http://drools-java-rules-engine.46999.n3.nabble.com/Firing-Mulitple-packages-tp1127290p1145342.html > Sent from the Drools - User 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Firing Mulitple packages
Hi Esteban, I have added the complete package into the kbuilder using the package url, Below is the way Im using to add the package, KnowledgeBuilder kbuilder1 = KnowledgeBuilderFactory.newKnowledgeBuilder(); KnowledgeBuilder kbuilder2 = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder1.add(ResourceFactory.newUrlResource("http://localhost:8983/drools-guvnor/org.drools.guvnor.Guvnor/package/test1/LATEST";),ResourceType.PKG); kbuilder2.add(ResourceFactory.newUrlResource("http://localhost:8983/drools-guvnor/org.drools.guvnor.Guvnor/package/test2/LATEST";),ResourceType.PKG); KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages(kbuilder1.getKnowledgePackages()); kbase.addKnowledgePackages(kbuilder2.getKnowledgePackages()); StatefulKnowledgeSession wrkMemory = kbase.newStatefulKnowledgeSession(); int i=wrkMemory.fireAllRules(); Let me know whether this approach is fine or if Im missing something here, provide your comments on the same. Thanks, Vignesh -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Firing-Mulitple-packages-tp1127290p1145342.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Firing Mulitple packages
Could you post the way you are using to add kassets to kbase? El ago 13, 2010 12:20 p.m., "Vignesh" escribió: Hi Esteban, I have tried the same logic by adding all the packages in my application in to the kbase and executed the same, but only the drl file got loaded in it, other kassets like dsl, ruleflow present in it were not added to the same. Do we need to add everything separetly? Kindly let me know whether im missing something here. Thanks, Vignesh -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Firing-Mulitple-packages-tp1127290p1134730.html Sent from the Drools - User mailing list archive at Nabble.com. ... ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Firing Mulitple packages
Hi Esteban, I have tried the same logic by adding all the packages in my application in to the kbase and executed the same, but only the drl file got loaded in it, other kassets like dsl, ruleflow present in it were not added to the same. Do we need to add everything separetly? Kindly let me know whether im missing something here. Thanks, Vignesh -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Firing-Mulitple-packages-tp1127290p1134730.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Firing Mulitple packages
You can add all the packages into a single kbase, create a ksession from it and fireAllRules(). Is this what you are asking? Best, Esteban Aliverti - Developer @ http://www.plugtree.com - Blog @ http://ilesteban.wordpress.com On Fri, Aug 13, 2010 at 3:31 AM, Vignesh wrote: > > Hi, > > We tried with a properties file with url of the set of package names in the > applicaiton and by iterating this file and fired the rules with out any > issues, but I want to know whether there is any way to fire all the rules > in > multiple packages present in a Guvnor application using any built-in > methods? > > Thanks in advance. > > Regards, > Vignesh > -- > View this message in context: > http://drools-java-rules-engine.46999.n3.nabble.com/Firing-Mulitple-packages-tp1127290p1127290.html > Sent from the Drools - User 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Firing Mulitple packages
Hi, We tried with a properties file with url of the set of package names in the applicaiton and by iterating this file and fired the rules with out any issues, but I want to know whether there is any way to fire all the rules in multiple packages present in a Guvnor application using any built-in methods? Thanks in advance. Regards, Vignesh -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Firing-Mulitple-packages-tp1127290p1127290.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users