On Jul 16, 2013, at 12:23 PM, Rajika Kumarasiri <[email protected]> 
wrote:

> Ok, in that case I think the property should have the results of regex 
> evaluation, which will be actually be the net result of xpath and regex 
> evaluation. What's the result of xpath when it does matching nothing ? Is it 
> an empty string ? Is it a null ? I think that should be the property value.

Well if the regex doesn't match, there won't be any matching groups. Which is 
sort of like getting an empty string as the result. In that sense the patch is 
correct.

I think I'll check in this patch. If anybody has a strong reason not to, feel 
free to comment on this thread or on the jira.

Thanks,
Hiranya

> 
> Rajika
> 
> 
> On Tue, Jul 16, 2013 at 3:04 PM, Hiranya Jayathilaka <[email protected]> 
> wrote:
> Hi Rajika,
> 
> On Jul 16, 2013, at 11:32 AM, Rajika Kumarasiri <[email protected]> 
> wrote:
> 
>> This optional regex property let users to extract fine grain information 
>> form the xpath match. In case of missing regex property,
> 
> The problem is not about what happens when the pattern is not present. The 
> problem is what do we do when the pattern attribute is present, but it 
> doesn't match the result of the XPath expression.
> 
> Thanks,
> Hiranya
> 
>> system should be fallback to use the default, which is the xpath result.  So 
>> I believe current implementation is correct and we should leave it as it is. 
>> 
>> #2 incorrectly says that the final result of the evaluation (xpath + regex) 
>> is an empty string, which is not true because we have a result for the 
>> xpath. 
>> 
>> #3 ignores the part of successful elevation of xpath.   
>> 
>> So we should keep it as it is.
>> 
>> Rajika
>> 
>> 
>> On Tue, Jul 16, 2013 at 2:16 PM, Hiranya Jayathilaka <[email protected]> 
>> wrote:
>> Hi Folks,
>> 
>> The property mediator supports a pattern attribute which can be used to 
>> specify a regular expression. When specified, the value of the XPath 
>> expression is matched against this regex and the resulting group of the 
>> match is what gets assigned to the property. If the regex doesn't match, the 
>> mediator assigns the original value of the XPath expression to the property. 
>> 
>> SYNAPSE-890 argues that this behavior is wrong, and the mediator must assign 
>> the empty string to the property if the regex doesn't match. I'm not quite 
>> sure what the right behavior should be. Does anybody have any ideas? To me 
>> it's a contest between:
>> 
>> 1. Assign the value of the XPath expression (current behavior)
>> 2. Assign the empty string (behavior proposed in SYNAPSE-890)
>> 3. Not set the property value at all - leave the current property value 
>> unmodified
>> 
>> Thanks,
>> Hiranya
>> 
>> --
>> Hiranya Jayathilaka
>> Mayhem Lab/RACE Lab;
>> Dept. of Computer Science, UCSB;  http://cs.ucsb.edu
>> E-mail: [email protected];  Mobile: +1 (805) 895-7443
>> Blog: http://techfeast-hiranya.blogspot.com
>> 
>> 
> 
> 
> --
> Hiranya Jayathilaka
> Mayhem Lab/RACE Lab;
> Dept. of Computer Science, UCSB;  http://cs.ucsb.edu
> E-mail: [email protected];  Mobile: +1 (805) 895-7443
> Blog: http://techfeast-hiranya.blogspot.com
> 
> 

--
Hiranya Jayathilaka
Mayhem Lab/RACE Lab;
Dept. of Computer Science, UCSB;  http://cs.ucsb.edu
E-mail: [email protected];  Mobile: +1 (805) 895-7443
Blog: http://techfeast-hiranya.blogspot.com

Reply via email to