Re: [rules-users] logical 'not' - is there such a construct?
Vlad, In 3.1M1 you can write: rule X when not ( MyObject( aaa == bbb ) and MyObject2( bbb == aaa ) ) then // do something end But remember that variables bound inside the not block are not avaible in the consequence for obvious reasons. []s Edson Olenin, Vladimir (MOH) wrote: Hi, I wonder if there is logical ‘not’ operator (in the meaning of “!=” - ‘not equal’) which can be applied to the whole rule? Eg: Rule x When ! ( MyObject(aaa == “bbb”) MyObject2(bbb == “aaa”) ) Then // do smth End Basically I’m looking for an operator to reverse the evaluation result of the expression in the brackets. The use case: in my system all rules are defined from ‘rule passes’ prospective, while the application should take some action in case the rule is NOT passed (ie, ‘else’ case). Any way to do that except reformulating the constraints themselves? Thanks, Vlad ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli Software Engineer - JBoss Rules Core Developer Office: +55 11 3124-6000 Mobile: +55 11 9218-4151 JBoss, a division of Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
RE: [rules-users] logical 'not' - is there such a construct?
So, if used like that, 'not' does not have 'existential' meaning then, but simple 'negation'? I mean, the expression not MyObject(field == 'value') would still mean 'not exists', correct? Would the expression not (MyObject(field == 'value')) mean MyObject(field != 'value') then. In other worlds, all objects OTHER then those matching the constraint? Thanks. Vlad -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Edson Tirelli Sent: 20 February 2007 14:37 To: Rules Users List Subject: Re: [rules-users] logical 'not' - is there such a construct? Vlad, In 3.1M1 you can write: rule X when not ( MyObject( aaa == bbb ) and MyObject2( bbb == aaa ) ) then // do something end But remember that variables bound inside the not block are not avaible in the consequence for obvious reasons. []s Edson Olenin, Vladimir (MOH) wrote: Hi, I wonder if there is logical 'not' operator (in the meaning of != - 'not equal') which can be applied to the whole rule? Eg: Rule x When ! ( MyObject(aaa == bbb) MyObject2(bbb == aaa) ) Then // do smth End Basically I'm looking for an operator to reverse the evaluation result of the expression in the brackets. The use case: in my system all rules are defined from 'rule passes' prospective, while the application should take some action in case the rule is NOT passed (ie, 'else' case). Any way to do that except reformulating the constraints themselves? Thanks, Vlad ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli Software Engineer - JBoss Rules Core Developer Office: +55 11 3124-6000 Mobile: +55 11 9218-4151 JBoss, a division of Red Hat @ www.jboss.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] logical 'not' - is there such a construct?
No, the not conditional element is an existential operator, so the meaning is what you expressed in your first example. I thought that was what you were looking for, but apparently it is not. I never heard about any construction capable of doing what you are asking for in a rules engine... maybe someone else can throw some light in... []s Edson Olenin, Vladimir (MOH) wrote: So, if used like that, 'not' does not have 'existential' meaning then, but simple 'negation'? I mean, the expression not MyObject(field == 'value') would still mean 'not exists', correct? Would the expression not (MyObject(field == 'value')) mean MyObject(field != 'value') then. In other worlds, all objects OTHER then those matching the constraint? Thanks. Vlad -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Edson Tirelli Sent: 20 February 2007 14:37 To: Rules Users List Subject: Re: [rules-users] logical 'not' - is there such a construct? Vlad, In 3.1M1 you can write: rule X when not ( MyObject( aaa == bbb ) and MyObject2( bbb == aaa ) ) then // do something end But remember that variables bound inside the not block are not avaible in the consequence for obvious reasons. []s Edson Olenin, Vladimir (MOH) wrote: Hi, I wonder if there is logical 'not' operator (in the meaning of != - 'not equal') which can be applied to the whole rule? Eg: Rule x When ! ( MyObject(aaa == bbb) MyObject2(bbb == aaa) ) Then // do smth End Basically I'm looking for an operator to reverse the evaluation result of the expression in the brackets. The use case: in my system all rules are defined from 'rule passes' prospective, while the application should take some action in case the rule is NOT passed (ie, 'else' case). Any way to do that except reformulating the constraints themselves? Thanks, Vlad ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli Software Engineer - JBoss Rules Core Developer Office: +55 11 3124-6000 Mobile: +55 11 9218-4151 JBoss, a division of Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
RE: [rules-users] logical 'not' - is there such a construct?
Well, probably to rephrase it, what is the status / thoughts on 'else' construct for rules? Basically global 'logical' not for rules would be the 'else' branch of conditional statement (if DROOLS had one), correct? I've read some postings regarding this shortly after I joined the list (ie, around a month ago). I wonder if that discussion went anywhere To clarify, I do need the _logical_ not, NOT exisitential. So that the constructs with logical 'not' would select an 'inverse' fact tuples, ie, tuples for facts that did not the condition Kind of simple logical statement transformation in boolean algebra (DeMorgan law?...): MyObject( field == 'value' ) and MyObject2( field == 'value' ) --- !( MyObject( field != 'value' ) or MyObject2( field != 'value' ) ) If '!' would mean ALL TUPLES FOR FACTS IN THE RULE XOR SELECTED TUPLES, would the above conditions select the same set of tuples? I assume the engine should just 'expand' any such 'logical not' operands to move it into the coluimn constraints?.. I might be confusing smth though On the second thought for my particular case 'existential' not should work too, so I guess the above is just a possible extention of functionality. It really has nothing to do with the rule engine itself (from what I see), but rather transformation of the logical expressions before they are feeded into the rules engine. Thanks for the answers, Edson. Vlad -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Edson Tirelli Sent: 20 February 2007 16:30 To: Rules Users List Subject: Re: [rules-users] logical 'not' - is there such a construct? No, the not conditional element is an existential operator, so the meaning is what you expressed in your first example. I thought that was what you were looking for, but apparently it is not. I never heard about any construction capable of doing what you are asking for in a rules engine... maybe someone else can throw some light in... []s Edson Olenin, Vladimir (MOH) wrote: So, if used like that, 'not' does not have 'existential' meaning then, but simple 'negation'? I mean, the expression not MyObject(field == 'value') would still mean 'not exists', correct? Would the expression not (MyObject(field == 'value')) mean MyObject(field != 'value') then. In other worlds, all objects OTHER then those matching the constraint? Thanks. Vlad -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Edson Tirelli Sent: 20 February 2007 14:37 To: Rules Users List Subject: Re: [rules-users] logical 'not' - is there such a construct? Vlad, In 3.1M1 you can write: rule X when not ( MyObject( aaa == bbb ) and MyObject2( bbb == aaa ) ) then // do something end But remember that variables bound inside the not block are not avaible in the consequence for obvious reasons. []s Edson Olenin, Vladimir (MOH) wrote: Hi, I wonder if there is logical 'not' operator (in the meaning of != - 'not equal') which can be applied to the whole rule? Eg: Rule x When ! ( MyObject(aaa == bbb) MyObject2(bbb == aaa) ) Then // do smth End Basically I'm looking for an operator to reverse the evaluation result of the expression in the brackets. The use case: in my system all rules are defined from 'rule passes' prospective, while the application should take some action in case the rule is NOT passed (ie, 'else' case). Any way to do that except reformulating the constraints themselves? Thanks, Vlad ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli Software Engineer - JBoss Rules Core Developer Office: +55 11 3124-6000 Mobile: +55 11 9218-4151 JBoss, a division of Red Hat @ www.jboss.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