Re: [rules-users] Need help with Decision Table Conditions
Hi Jason, for fact types and attributes you should be able to reuse the Functions keyword in the RuleSet section of your sheet, for example: --- | Functions | declare Person @author( Bob ) . end | --- For rule attributes you can reuse the I keyword as the cell header and add the attributes, for example: - |RuleTable Sample| | | - | Condition |I | Action| - | $p : Person| | | - | name==$param| || - | SomeName | @author( Bob ) | System.out.| - Neither are optimal, but just workarounds. If you raise a Jira, I can put on todo list. Hope this helps. Thanks. Tihomir On 1/7/11 9:35 PM, Jason Mihalick wrote: Tihomir, Do you know if decision tables support metadata http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html_single/index.html#d0e3368? View this message in context: Re: Need help with Decision Table Conditions http://drools-java-rules-engine.46999.n3.nabble.com/Need-help-with-Decision-Table-Conditions-tp2195003p2215160.html Sent from the Drools - User mailing list archive http://drools-java-rules-engine.46999.n3.nabble.com/Drools-User-f47000.html 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] Need help with Decision Table Conditions
I would not use I / DESCRIPTION for these reasons: - it's not parameterized, and I think you don't want to repeat the @Meta(...) for every rule, you just want the argument - you can use only one I column, since the 2nd one silently overwrites the 1st one, so you'll have to squeeze multiple @s into one cell - it is an undocumented feature, and the name would suggest that it was intended for providing a comment Adding a proper metadata column type is simple, given what is available from other column types. -W 2011/1/10 Tihomir Surdilovic tsurd...@redhat.com Hi Jason, for fact types and attributes you should be able to reuse the Functions keyword in the RuleSet section of your sheet, for example: --- | Functions | declare Person @author( Bob ) . end | --- For rule attributes you can reuse the I keyword as the cell header and add the attributes, for example: - |RuleTable Sample| | | - | Condition |I | Action| - | $p : Person| | | - | name==$param| | | - | SomeName | @author( Bob ) | System.out.| - Neither are optimal, but just workarounds. If you raise a Jira, I can put on todo list. Hope this helps. Thanks. Tihomir On 1/7/11 9:35 PM, Jason Mihalick wrote: Tihomir, Do you know if decision tables support metadatahttp://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html_single/index.html#d0e3368? -- View this message in context: Re: Need help with Decision Table Conditionshttp://drools-java-rules-engine.46999.n3.nabble.com/Need-help-with-Decision-Table-Conditions-tp2195003p2215160.html Sent from the Drools - User mailing list archivehttp://drools-java-rules-engine.46999.n3.nabble.com/Drools-User-f47000.htmlat Nabble.com. ___ rules-users mailing listrules-us...@lists.jboss.orghttps://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] Need help with Decision Table Conditions
Hi Wolfgang, good points, thus I asked for a Jira so we can add proper support for it. If you know of a better workaround with whats currently available let us know. Thanks. On 1/10/11 10:13 AM, Wolfgang Laun wrote: I would not use I / DESCRIPTION for these reasons: * it's not parameterized, and I think you don't want to repeat the @Meta(...) for every rule, you just want the argument * you can use only one I column, since the 2nd one silently overwrites the 1st one, so you'll have to squeeze multiple @s into one cell * it is an undocumented feature, and the name would suggest that it was intended for providing a comment Adding a proper metadata column type is simple, given what is available from other column types. -W 2011/1/10 Tihomir Surdilovic tsurd...@redhat.com mailto:tsurd...@redhat.com Hi Jason, for fact types and attributes you should be able to reuse the Functions keyword in the RuleSet section of your sheet, for example: --- | Functions | declare Person @author( Bob ) . end | --- For rule attributes you can reuse the I keyword as the cell header and add the attributes, for example: - |RuleTable Sample| | | - | Condition |I | Action| - | $p : Person| | | - | name==$param| || - | SomeName | @author( Bob ) | System.out.| - Neither are optimal, but just workarounds. If you raise a Jira, I can put on todo list. Hope this helps. Thanks. Tihomir On 1/7/11 9:35 PM, Jason Mihalick wrote: Tihomir, Do you know if decision tables support metadata http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html_single/index.html#d0e3368? View this message in context: Re: Need help with Decision Table Conditions http://drools-java-rules-engine.46999.n3.nabble.com/Need-help-with-Decision-Table-Conditions-tp2195003p2215160.html Sent from the Drools - User mailing list archive http://drools-java-rules-engine.46999.n3.nabble.com/Drools-User-f47000.html at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org mailto: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] Need help with Decision Table Conditions
Thanks Tihomir. I will submit a JIRA ticket for this, as I definitely could use this feature. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Need-help-with-Decision-Table-Conditions-tp2195003p2227739.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] Need help with Decision Table Conditions
JIRA Issue added here: https://issues.jboss.org/browse/JBRULES-2866 -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Need-help-with-Decision-Table-Conditions-tp2195003p2227963.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] Need help with Decision Table Conditions
Tihomir, Do you know if decision tables support http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html_single/index.html#d0e3368 metadata ? -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Need-help-with-Decision-Table-Conditions-tp2195003p2215160.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] Need help with Decision Table Conditions
Thank you so much for the posting! All I had to do was add the 'X' character in the cell below $pgMeta: PageMeta() and that fixed it! When is it necessary to add the 'X' character and when is it ok to leave it blank? I don't recall seeing information about that in the doc. Thanks also for the SpreadsheetCompiler code. I didn't think SpreadsheetCompiler was available until 5.2 because I didn't see it in the http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/apidocs/index.html 5.1 javadoc . -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Need-help-with-Decision-Table-Conditions-tp2195003p2199270.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] Need help with Decision Table Conditions
On 1/5/11 10:47 AM, Jason Mihalick wrote: Thank you so much for the posting! All I had to do was add the 'X' character in the cell below $pgMeta: PageMeta() and that fixed it! Glad it's working for you. When is it necessary to add the 'X' character and when is it ok to leave it blank? I don't recall seeing information about that in the doc. The cell has to exist and cannot be blank. You can put X or BLANK, or // whatever suites your needs. I like using X ;) Thanks also for the SpreadsheetCompiler code. I didn't think SpreadsheetCompiler was available until 5.2 because I didn't see it in the http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/apidocs/index.html 5.1 javadoc . It's org.drools.decisiontable.SpreadsheetCompiler and has been available AFAIK since 4.0.7. It's not part of the public API in Drools 5. Tihomir ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Need help with Decision Table Conditions
I have a decision table with the conditions shown in the graphic below. When Drools attempts to compile the spreadsheet I get the following errors: nested exception is java.lang.RuntimeException: Unable to return Declaration for identifier '$pgMeta' : [Rule name='Section Head Spacing_18'] Unable to create restriction '[VariableRestriction: == $pgMeta ]' for field 'pageMeta' in the rule 'Section Head Spacing_18' : [Rule name='Section Head Spacing_18'] Unable to build expression for 'from' : [Error: Failed to compile: 2 compilation error(s): - (1,7) unqualified type in strict mode for: $pgMeta - (1,22) unable to resolve method using strict-mode: java.lang.Object.getLineMetas()] [Near : {... Unknown }] ^ [Line: 1, Column: 0] '$pgMeta.getLineMetas()' : [Rule name='Section Head Spacing_18'] http://drools-java-rules-engine.46999.n3.nabble.com/file/n2195003/Picture_2.png The LHS of a hand-coded rule for this, is as follows: when $pageMeta : PageMeta() $bodyLines : LineMeta( pageMeta == $pageMeta, lineType == LineType.BODY ) from $pageMeta.getLineMetas() $bodyLine : LineMeta( previousPageMetaComponent != null, previousPageMetaComponent == previousLineMeta, previousLineMeta.lineType == LineType.SECTION_HEAD, verticalSpacingToPreviousPageMetaComponent 5.9525 ) from $bodyLines Can this rule be created in a Decision table or not? Your help is most appreciated! -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Need-help-with-Decision-Table-Conditions-tp2195003p2195003.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