Re: [rules-users] unable to create field extractor for tickerId
Unable to create FIeld extractor, mostly that is because you did not declare getters and in your java class. Drools uses the getters to extract the needed values. Make sure you use the correct naming conventions as well. I.e. public int getTicketId(){...} Regards, frank sirinath wrote: declare ReqMktData @role( event ) end declare TickPrice @role( event ) @expires( 2m ) end declare TickSize @role( event ) @expires( 2m ) end rule Bids when $req: ReqMktData($tickerId : tickerId) from entry-point IB Events $bidprice: TickPrice(field == 1, tickerId == $tickerId, this after $req) from entry-point IB Events $bidsize: TickSize(field == 0, tickerId == $tickerId, this after $req) from entry-point IB Events then Bid bid = new Bid($tickerId, $req.contract, size, price); insert(bid); end public class ReqMktData { public int tickerId; public Contract contract; public String genericTickList; public boolean snapshot; } -- View this message in context: http://drools.46999.n3.nabble.com/unable-to-create-field-extractor-for-tickerId-tp2846413p2846464.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] And Or Problem
Hi sir , I am facing one issue regarding and( , ) and OR( || ) condition i have one rule like that dialect java rule mytest1 when test ( ( i==1,j==2) || (i == 2 ,j==3) ) then System.out.println(Found); end it gives excpetion [ERR 102] Line 24:22 mismatched input ',' expecting 'then' in rule mytest1 can we not do such type of combination ? dialect java rule mytest1 when test (( i==1 || j==2) ,(i == 2 || j==3)) then System.out.println(Found); end this gives no excpetion and works as expected . Regards , Saurabh Maheshwari ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] And Or Problem
Hi, No, it is indeed not possible to combine the operators that way. To make it work, you will have to replace , with . I believe in the expert documentation there is a section with examples of constraints that can and cannot be used. Regards, Frank -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-And-Or-Problem-tp2846480p2846497.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] Dynamic updates of stateful sessions
Do you have any suggestion on how to update a stateful session with the new KnowledgeBase and keep the current facts? I tried by keeping track of when the session and knowledgeBase was created/updated and then create a new session (if kbase.updated session.created) and then copy all facts from the old session. This seemed to work until I tried to add a new global to the new session which then complained about unknown global. Best regards Mattias -- View this message in context: http://drools.46999.n3.nabble.com/Dynamic-updates-of-stateful-sessions-tp2834623p2846613.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] Dynamic updates of stateful sessions
Hi! I't fails in the sense that no rules are triggered. there are no messages in the logs that indicate that something went wrong with loading the rules. I have implemented a Eventlistener that should print any error to the output log. Best Regards Mattias -- View this message in context: http://drools.46999.n3.nabble.com/Dynamic-updates-of-stateful-sessions-tp2834623p2846622.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] How does SpreadSheetCompiler work?
Hi, All! I got a question with SpreadSheetCompiler now. The story is: I have two Decision Tables,which are SOP.xls and quotation.xls. When I try to write a class,named as XLSConverter.java to compile them to drl rule files, I found a strange thing-- 1.The RuleSet of SOP.xls is 'com.my.booking.as.drools', after compiling SOP.xls, the 'package' value of compiled drl file from SOP.xls is 'com.my.booking.as.drools'; And if I change RuleSet of it to 'com.sample', after compiling, package value is also 'com.sample', which is normal; 2.But while RuleSet of quotation.xls is 'com.sample', after compiling quotation.xls, the package value of compiled drl file from quotation.xls is 'rule_table'; And no matter what I change RuleSet of it to, after compiling it, its package value is still 'rule_table'. Could anybody please help me to explain why is that? Any help is appreciated! Yours sincerely, Jay -- View this message in context: http://drools.46999.n3.nabble.com/How-does-SpreadSheetCompiler-work-tp2846694p2846694.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] How does SpreadSheetCompiler work?
Check whether the cell RuleSet com.sample has leading spaces. Spaces were not trimmed in 5.1.1 or earlier. -W On 21 April 2011 13:39, Jay mzliang...@gmail.com wrote: Hi, All! I got a question with SpreadSheetCompiler now. The story is: I have two Decision Tables,which are SOP.xls and quotation.xls. When I try to write a class,named as XLSConverter.java to compile them to drl rule files, I found a strange thing-- 1.The RuleSet of SOP.xls is 'com.my.booking.as.drools', after compiling SOP.xls, the 'package' value of compiled drl file from SOP.xls is 'com.my.booking.as.drools'; And if I change RuleSet of it to 'com.sample', after compiling, package value is also 'com.sample', which is normal; 2.But while RuleSet of quotation.xls is 'com.sample', after compiling quotation.xls, the package value of compiled drl file from quotation.xls is 'rule_table'; And no matter what I change RuleSet of it to, after compiling it, its package value is still 'rule_table'. Could anybody please help me to explain why is that? Any help is appreciated! Yours sincerely, Jay -- View this message in context: http://drools.46999.n3.nabble.com/How-does-SpreadSheetCompiler-work-tp2846694p2846694.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
[rules-users] how to run pkg from java
Hi , I Build few classes using Eclipse and then import it into JBoss BRMS then I created few rule and and using knowledge base I created binary package. I try to open the pkg using Eclipse with this code : CollectionKnowledgePackage kpkgs = new ArrayListKnowledgePackage(); ObjectInputStream in = new ObjectInputStream(new FileInputStream( c:/com.jspeed.brms.fire.pkg)); Object o = in.readObject(); System.out.println(Read: pkg ok ); in.close(); KnowledgePackage kp = (KnowledgePackage) o; kpkgs.add(kp); KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages(kpkgs); and I am getting error - java.io.ObjectInputStream cannot be cast to org.drools.common.DroolsObjectInput What am I doing wrong ? My imports : import java.io.FileInputStream; import java.io.ObjectInputStream; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Map; import org.drools.KnowledgeBase; import org.drools.KnowledgeBaseFactory; import org.drools.definition.KnowledgePackage; import org.drools.runtime.StatefulKnowledgeSession; import org.drools.runtime.rule.FactHandle; -- View this message in context: http://drools.46999.n3.nabble.com/how-to-run-pkg-from-java-tp2848164p2848164.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] how to run pkg from java
You are getting this error in one of the lines shown in your email? -W On 21 April 2011 20:52, MichaelBini mich...@jspeed.co.il wrote: Hi , I Build few classes using Eclipse and then import it into JBoss BRMS then I created few rule and and using knowledge base I created binary package. I try to open the pkg using Eclipse with this code : CollectionKnowledgePackage kpkgs = new ArrayListKnowledgePackage(); ObjectInputStream in = new ObjectInputStream(new FileInputStream( c:/com.jspeed.brms.fire.pkg)); Object o = in.readObject(); System.out.println(Read: pkg ok ); in.close(); KnowledgePackage kp = (KnowledgePackage) o; kpkgs.add(kp); KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages(kpkgs); and I am getting error - java.io.ObjectInputStream cannot be cast to org.drools.common.DroolsObjectInput What am I doing wrong ? My imports : import java.io.FileInputStream; import java.io.ObjectInputStream; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Map; import org.drools.KnowledgeBase; import org.drools.KnowledgeBaseFactory; import org.drools.definition.KnowledgePackage; import org.drools.runtime.StatefulKnowledgeSession; import org.drools.runtime.rule.FactHandle; -- View this message in context: http://drools.46999.n3.nabble.com/how-to-run-pkg-from-java-tp2848164p2848164.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] how to run pkg from java
The full Error - java.lang.ClassCastException: java.io.ObjectInputStream cannot be cast to org.drools.common.DroolsObjectInput at org.drools.rule.JavaDialectRuntimeData.readExternal(JavaDialectRuntimeData.java:111) at java.io.ObjectInputStream.readExternalData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.readObject(Unknown Source) at java.util.HashMap.readObject(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at java.io.ObjectStreamClass.invokeReadObject(Unknown Source) at java.io.ObjectInputStream.readSerialData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.readObject(Unknown Source) at org.drools.rule.DialectRuntimeRegistry.readExternal(DialectRuntimeRegistry.java:59) at java.io.ObjectInputStream.readExternalData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.readObject(Unknown Source) at org.drools.rule.Package.readExternal(Package.java:194) at java.io.ObjectInputStream.readExternalData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.readObject(Unknown Source) at com.jspeed.brms.fire.Alarm2.readKnowledgeBase(Alarm2.java:66) at com.jspeed.brms.fire.Alarm2.main(Alarm2.java:24) Exception in thread main java.lang.NullPointerException at com.jspeed.brms.fire.Alarm2.main(Alarm2.java:28) I get this Error in this line : KnowledgePackage kp = (KnowledgePackage) o; -- View this message in context: http://drools.46999.n3.nabble.com/how-to-run-pkg-from-java-tp2848164p2848269.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] [guvnor] How to use a rule in a java application
http://drools.46999.n3.nabble.com/rules-users-Can-t-Get-Rules-To-Modify-Object-State-in-Mortgage-Example-of-Drools-5-1-1-Guvnor-td2817700.html Viel Glück -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-guvnor-How-to-use-a-rule-in-a-java-application-tp2842402p2848336.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] Need JSON request for Drools Server
I have deployed Drools Server 5.1.1 on Tomcat and have successfully tested it with the sample Test.jsp and with a raw XML batch-execution request via TCPMON. However, I need to support JSON-based requests to the server, and I have been unable to find any documentation or examples on how to specify a valid JSON request to the server. Would someone please translate the sample XML request to a JSON request that actually WORKS on the Drools Server. batch-execution lookup=ksession1 insert out-identifier=message org.test.Message textHello World/text /org.test.Message /insert /batch-execution BTW, I am behind a corporate proxy, so I cannot access certain web sites (including plugtree.com!), but go ahead and point me to the proper documentation for this, if any. Thanks so much! Fulton -- View this message in context: http://drools.46999.n3.nabble.com/Need-JSON-request-for-Drools-Server-tp2848527p2848527.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] Problem in compiling each rule separately
Am 19.04.2011 12:56, schrieb saurabh maheshwari: Hi sir , I have 10 rules . rules are created dynamically .Now if any of them is causing problem so none of them runs so I want to compile each rule separately , so that i can create knowledge base with rules which have no errors but can i do this ? Roughly like this: - create one file for each rule containing the rule code - create a KnowledgeBuilder instance (see documentation for details) - for each rule file: |- add file resource to knowledgeBuilder |- handle all errors Best regards Ansgar ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] how to run pkg from java
I'm not sure how this .pkg file was created, but if I guess correctly, you should be able to add it to a KnowledgeBuilder: kbuilder.add( ResourceFactory.newFileResource( ...pkg ), ResourceType.PKG ); -W On 21 April 2011 20:52, MichaelBini mich...@jspeed.co.il wrote: Hi , I Build few classes using Eclipse and then import it into JBoss BRMS then I created few rule and and using knowledge base I created binary package. I try to open the pkg using Eclipse with this code : CollectionKnowledgePackage kpkgs = new ArrayListKnowledgePackage(); ObjectInputStream in = new ObjectInputStream(new FileInputStream( c:/com.jspeed.brms.fire.pkg)); Object o = in.readObject(); System.out.println(Read: pkg ok ); in.close(); KnowledgePackage kp = (KnowledgePackage) o; kpkgs.add(kp); KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages(kpkgs); and I am getting error - java.io.ObjectInputStream cannot be cast to org.drools.common.DroolsObjectInput What am I doing wrong ? My imports : import java.io.FileInputStream; import java.io.ObjectInputStream; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Map; import org.drools.KnowledgeBase; import org.drools.KnowledgeBaseFactory; import org.drools.definition.KnowledgePackage; import org.drools.runtime.StatefulKnowledgeSession; import org.drools.runtime.rule.FactHandle; -- View this message in context: http://drools.46999.n3.nabble.com/how-to-run-pkg-from-java-tp2848164p2848164.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] how to run pkg from java
still don't working the code - private static KnowledgeBase readKnowledgeBase() throws Exception { KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add( ResourceFactory.newFileResource( c:/com.jspeed.brms.fire.pkg ), ResourceType.PKG ); KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); return kbase; } Error - java.lang.RuntimeException: java.io.EOFException at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:544) at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28) at com.jspeed.brms.fire.Alarm2.readKnowledgeBase(Alarm2.java:75) at com.jspeed.brms.fire.Alarm2.main(Alarm2.java:27) Caused by: java.io.EOFException at java.io.DataInputStream.readInt(Unknown Source) at java.io.ObjectInputStream$BlockDataInputStream.readInt(Unknown Source) at java.io.ObjectInputStream.readInt(Unknown Source) at org.drools.rule.JavaDialectRuntimeData.readExternal(JavaDialectRuntimeData.java:112) at java.io.ObjectInputStream.readExternalData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) -- View this message in context: http://drools.46999.n3.nabble.com/how-to-run-pkg-from-java-tp2848164p2849214.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] how to run pkg from java
Probably the Drools Runtime configured in Eclipse is not same version as what is used in your Guvnor. Make sure that you are using the same bits on both sides and try again. On 4/21/11 7:19 PM, MichaelBini wrote: still don't working the code - private static KnowledgeBase readKnowledgeBase() throws Exception { KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add( ResourceFactory.newFileResource( c:/com.jspeed.brms.fire.pkg ), ResourceType.PKG ); KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); return kbase; } Error - java.lang.RuntimeException: java.io.EOFException at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:544) at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28) at com.jspeed.brms.fire.Alarm2.readKnowledgeBase(Alarm2.java:75) at com.jspeed.brms.fire.Alarm2.main(Alarm2.java:27) Caused by: java.io.EOFException at java.io.DataInputStream.readInt(Unknown Source) at java.io.ObjectInputStream$BlockDataInputStream.readInt(Unknown Source) at java.io.ObjectInputStream.readInt(Unknown Source) at org.drools.rule.JavaDialectRuntimeData.readExternal(JavaDialectRuntimeData.java:112) at java.io.ObjectInputStream.readExternalData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) -- View this message in context: http://drools.46999.n3.nabble.com/how-to-run-pkg-from-java-tp2848164p2849214.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] How does SpreadSheetCompiler work?
I've checked that before you said,but found no space, and it's still 'package rule_table' after compiling. Are there other possibilities? Thanks. 2011/4/21 Wolfgang Laun wolfgang.l...@gmail.com Check whether the cell RuleSet com.sample has leading spaces. Spaces were not trimmed in 5.1.1 or earlier. -W On 21 April 2011 13:39, Jay mzliang...@gmail.com wrote: Hi, All! I got a question with SpreadSheetCompiler now. The story is: I have two Decision Tables,which are SOP.xls and quotation.xls. When I try to write a class,named as XLSConverter.java to compile them to drl rule files, I found a strange thing-- 1.The RuleSet of SOP.xls is 'com.my.booking.as.drools', after compiling SOP.xls, the 'package' value of compiled drl file from SOP.xls is 'com.my.booking.as.drools'; And if I change RuleSet of it to 'com.sample', after compiling, package value is also 'com.sample', which is normal; 2.But while RuleSet of quotation.xls is 'com.sample', after compiling quotation.xls, the package value of compiled drl file from quotation.xls is 'rule_table'; And no matter what I change RuleSet of it to, after compiling it, its package value is still 'rule_table'. Could anybody please help me to explain why is that? Any help is appreciated! Yours sincerely, Jay -- View this message in context: http://drools.46999.n3.nabble.com/How-does-SpreadSheetCompiler-work-tp2846694p2846694.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 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How does SpreadSheetCompiler work?
I found the reason to my problem now, just because there is a value 'Company ABC' of the cell next to the RuleSet declaration, like this: Company ABC RuleSet com.sample So when call SpreadSheetCompiler to compile it, this inner method of compile method of SpreadSheetCompiler--- [listener.getRuleSet http://grepcode.com/file/repository.jboss.org/maven2/org.drools/drools-decisiontables/5.0.1/org/drools/decisiontable/parser/RuleSheetListener.java#RuleSheetListener.getRuleSet%28%29();] doesn't work. Thanks for your reply,Wolfgang. On 22 April 2011 09:59, Minzeng Liang mzliang...@gmail.com wrote: I've checked that before you said,but found no space, and it's still 'package rule_table' after compiling. Are there other possibilities? Thanks. 2011/4/21 Wolfgang Laun wolfgang.l...@gmail.com Check whether the cell RuleSet com.sample has leading spaces. Spaces were not trimmed in 5.1.1 or earlier. -W On 21 April 2011 13:39, Jay mzliang...@gmail.com wrote: Hi, All! I got a question with SpreadSheetCompiler now. The story is: I have two Decision Tables,which are SOP.xls and quotation.xls. When I try to write a class,named as XLSConverter.java to compile them to drl rule files, I found a strange thing-- 1.The RuleSet of SOP.xls is 'com.my.booking.as.drools', after compiling SOP.xls, the 'package' value of compiled drl file from SOP.xls is 'com.my.booking.as.drools'; And if I change RuleSet of it to 'com.sample', after compiling, package value is also 'com.sample', which is normal; 2.But while RuleSet of quotation.xls is 'com.sample', after compiling quotation.xls, the package value of compiled drl file from quotation.xls is 'rule_table'; And no matter what I change RuleSet of it to, after compiling it, its package value is still 'rule_table'. Could anybody please help me to explain why is that? Any help is appreciated! Yours sincerely, Jay -- View this message in context: http://drools.46999.n3.nabble.com/How-does-SpreadSheetCompiler-work-tp2846694p2846694.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 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users