<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
Thanks for the advice!<br>
<br>
Bruno.<br>
<br>
<br>
Wolfgang Laun a &eacute;crit&nbsp;:
<blockquote
 cite="mid:AANLkTimcBtrwAyPVrNgoD03nJTQpmgs5_mMJ4HFmvvQ8@mail.gmail.com"
 type="cite">
  <pre wrap="">If some value is variable, it must be privided in a fact - otherwise
the Inference Engine does not register any changes.

Notice that you cannot use "matches" in an eval, where plain Java (or
mvel) must be used.

-W

2011/1/24 Bruno Freudensprung <a class="moz-txt-link-rfc2396E" href="mailto:bruno.freudensprung@temis.com">&lt;bruno.freudensprung@temis.com&gt;</a>:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Thanks Wolfgang! My sincere apologies for the wrong answer.
Does it mean that (probably at the price of a performance penalty) one could
handle the variable results of getPropName() over time and write (?):

MyEvent(eval (prop1 matches ("This event is for"+getPropName()+" and is sent
toblah blah blah")))

Best regards,

Bruno.

Wolfgang Laun a &eacute;crit&nbsp;:

2011/1/24 Bruno Freudensprung <a class="moz-txt-link-rfc2396E" href="mailto:bruno.freudensprung@temis.com">&lt;bruno.freudensprung@temis.com&gt;</a>


MyEvent(prop1 matches eval("This event is for"+getPropName()+" and is sent
to
blah blah blah"))



You cannot use eval() like this. It is a conditional element.

If getPropName() is a function that is constant over time (!) then you
should be able to

   MyEvent(prop1 matches ("This event is for"+getPropName()+" and is..."))

If you need to match against a value that should change during
execution, put the value into a fact and make sure to update/modify
that fact when you change the value:

   MyPattern( $v: value )
   MyEvent( prop1 matches ("This event is for"+$v +" and is..."))

In both cases, the parentheses around the concatenaion are essential.

-W





Best regards,

Bruno.


Ayush a &eacute;crit&nbsp;:

Hi, I'm trying to implement regular expression using matches. The regular
expression is dynamic and retrieved from a java function. In my first
approach I'm tried to call the java function for matches like

MyEvent(prop1 matches "This event is for"+getPropName()+" and is sent to
blah blah blah")

Now when I try to execute the above expression it gives error as illegal
statement (I even tried back-slash to escape it). It also gives error like
"Expecting ')' instead of '(' ".

So I declared a function which takes two string parameters and returns me
the concatenated one.
function String concatenate(String str1, String str2) {
        return str1+str2;
}

$matchStr : String() from concatenate("This event is for",getPropName()+"
and is sent to blah blah blah")

Now when I'm using this variable in my rule it is not getting executed.
Please note that there is no problem in regex because when I put the regex
as string (i.e. without using any function to retreive it) it works fine.

MyEvent(prop1 matches $matchStr)

Can anyone please let me know how can I solve it. Thanks in advance.




_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>



_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>



_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>


    </pre>
  </blockquote>
  <pre wrap=""><!---->
_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>

  </pre>
</blockquote>
<br>
</body>
</html>