Re: [rules-users] Do really support the containsKey() function on maps?

2011-08-20 Thread Edson Tirelli
   I think your data is somehow not matching, but you can try to simplify
your rule like this (assuming Drools 5.2):

rule transport
   when
   $pfMapType : MapType( name  ==  transport )
   $inputKey : InputKey( email == true )
   $ldapResponseMap : Map( this[zimbraMailDeliveryAddress]
== $inputKey ||
   this[zimbraDomainName] ==
$inputKey )
   then
   $pfMapType.setQueryFilterCheck(true);
end

   Edson


2011/8/20 dvsnmurty murty.devarako...@teamaol.com

 Hello Wolfgang,
 Thanks for the quick reply.  So if equals($inputKey) is the culprit, how
 can
 I modify the rule to make it work?  My best guess is to do something like
 this:

 rule transport
when
$pfMapType : MapType( name  ==  transport )
$inputKey : InputKey( email == true )
$ldapResponseMap : Map()
 then
updateTransportMap($pfMapType, $inputKey, $ldapResponseMap)
 end

 And then add the function updateTransportMap() to do the required checks
 that I am doing in the eval above.  Do you think of any other way?

 Regards,
 Murty.

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Do-really-support-the-containsKey-function-on-maps-tp3269570p3270684.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




-- 
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by 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] Do really support the containsKey() function on maps?

2011-08-20 Thread dvsnmurty
Hello Edson/Wolfgang,
Thanks for the reply.  I am stuck with 5.0.1 in our company.  Would the map
expression that you gave work with 5.0.1?  I tried to reason it out if there
is anything wrong with my logic itself, but can think of any.  Essentially,
I have a map of Maplt;String, Stringgt; type, where I want to see if a key
is present and if so, compare the value of that key to an expected string. 
For me it sounds like a simple logic, but please correct me if I am wrong
here.  May be my logic is not correct in drools semantics

Here is what I want to do in Java terms:

if( ldapResponseMap.get(zimbraMailDeliveryAddress).equals(abc) ) {
pfMapType.setQueryFilterCheck(true);
}  else {
if( ldapResponseMap.containsKey(zimbraDomainName) ) {
if(ldapResponseMap.get(zimbraDomainName).equals(abc) {
pfMapType.setQueryFilterCheck(true);
}
}
}

Regards,
Murty.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Do-really-support-the-containsKey-function-on-maps-tp3269570p3270932.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] Do really support the containsKey() function on maps?

2011-08-20 Thread Wolfgang Laun
What is the class of $ldapResponseMap.get(zimbraDomainName)? Is it really
an InputKey? And if so, how is equals() defined in this class? Does it
return true for two different objects, one inserted in Working Memory and
another one in the Map()?

Did you explore the truth of the eval expression components?

-W


On 20 August 2011 18:55, dvsnmurty murty.devarako...@teamaol.com wrote:

 Hello Edson/Wolfgang,
 Thanks for the reply.  I am stuck with 5.0.1 in our company.  Would the map
 expression that you gave work with 5.0.1?  I tried to reason it out if
 there
 is anything wrong with my logic itself, but can think of any.  Essentially,
 I have a map of Maplt;String, Stringgt; type, where I want to see if a
 key
 is present and if so, compare the value of that key to an expected string.
 For me it sounds like a simple logic, but please correct me if I am wrong
 here.  May be my logic is not correct in drools semantics

 Here is what I want to do in Java terms:

 if( ldapResponseMap.get(zimbraMailDeliveryAddress).equals(abc) ) {
pfMapType.setQueryFilterCheck(true);
 }  else {
if( ldapResponseMap.containsKey(zimbraDomainName) ) {
if(ldapResponseMap.get(zimbraDomainName).equals(abc) {
pfMapType.setQueryFilterCheck(true);
}
}
 }

 Regards,
 Murty.

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Do-really-support-the-containsKey-function-on-maps-tp3269570p3270932.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] Rule(s) based on different (fact) dates (date-effective/date-expired?)

2011-08-20 Thread Wolfgang Laun
Where do you have problems? date-effective and date-expired simply delimit
the time interval when a rule is capable of firing.

If you have a field of type Date in a fact you can base your rule on this
value being before, equal to or after some other Date value in another fact,
or a literal, written as a quoted string. All relational operators are
applicable, with the natural interpretation.

-W


On 19 August 2011 15:53, dhartford binarymon...@yahoo.com wrote:

 Hey all,
 I see a couple of posts in the mailing list/forum around the date-effective
 and date-expired.

 Forgive my ignorance, I'm still learning as I go, but I have this example
 and I'm wondering if that is where I should look, or if that is the wrong
 path:

 Given the mortgage example, lets say you have LoanApplications come in with
 an 'Application Date'.

 There may be one rule that has 3 different versions (all versions 'active')
 depending on the date of the application, and the application may come in
 later, and/or a rule may be a retroactive rule (I just made a new rule, but
 it came into effect two days ago (say during a weekend and is only for
 those
 two days), so any ApplicationDate based loan applications that show up on
 Monday with dates from the past two days should use that retroactive rule
 instead of, potentially, a new 'current' rule).

 This is not the same as history (what *was* the rule(s) as of prior
 Friday),
 which is also important, which is why I'm asking if someone has tackled
 this
 area that will help someone new understand the best approach for date-based
 rules while understanding/retaining history.

 thanks!
 -Darren



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Rule-s-based-on-different-fact-dates-date-effective-date-expired-tp3268114p3268114.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] Iterative diagnosis - how to determine what is the next best fact?

2011-08-20 Thread Kal
Hi,

I am new to Drools. I read the documentation and I looked at the examples,
but I still not sure how to solve this problem:

1) Kind: iterative diagnosis

Rules:
if (A, B and C) then print (Solution 1)
if (A, B and not C) then print (Solution 2)
if (A, D and E) then print (Solution 3)
and so on...

The entry should be something like this:
* no facts are know
* user answers a question (lets say A = true), I update the Statefull
session and fire the rules
* system chooses a unknow fact based on condition for the best incomplete
rule. In this case, it would be B (as it knows A, but it doesn't know B or
C)
* user answers a new question (B = false), I update the session + fireRules
* system now knows that rule 1 (A, B and C) is not possible. It also knows
that rule 2 (A, B and not C) is not possible. So, it chooses the second
condition on rule 3 (A, D and E), which is: what is D?
* user answers a new question (D = true)

* user answers a new question (E= true)
* system prints: Solution 3!


My big question: can I extract from the working memory or rule manager or
the agenda a list of the rules that are 'almost' good to fire, but that
still requires some of its conditions to be know (by inserting facts)?

Thanks!


--
View this message in context: 
http://drools.46999.n3.nabble.com/Iterative-diagnosis-how-to-determine-what-is-the-next-best-fact-tp3271709p3271709.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