uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Klügl <peter.klu...@averbis.com>
Subject Re: RUTA variable assignment problem
Date Wed, 14 Oct 2015 07:19:22 GMT
Hi,

I think this is the same problem. The CREATE action just searches in its
match context. I will answer the context question is the other mail.

Best,

Peter

Am 11.10.2015 um 16:21 schrieb Mario Juric:
> I am still struggling with the use of variables in some CREATE statements. The features
do not always have the expected values after CREATE. Let me give another more concrete example:
>
> TYPE pmcIdentifier;
> BLOCK(ForEach) IdentifierAnnotation.propertyName=="PMC"{} { // Just capturing scope
>     IdentifierAnnotation.propertyName=="PMC" { -> ASSIGN(pmcIdentifier, IdentifierAnnotation),
LOG(pmcIdentifier.ct)};
> }
>
> TYPE doiIdentifier;
> BLOCK(ForEach) IdentifierAnnotation.propertyName=="DOI"{} { // Just capturing scope
>     IdentifierAnnotation.propertyName=="DOI" { -> ASSIGN(doiIdentifier, IdentifierAnnotation),
LOG(doiIdentifier.ct)};
> }
>
> BLOCK(ForEach) XMLTagAnnotation.path=="article/front/article-meta"{} {
>     XMLTagAnnotation.name=="article-meta" {
>         -> CREATE(
>             DocumentInfoAnnotation,
>             “id" = pmcIdentifier,
>             "doi" = doiIdentifier
>         )
>     };
> }
>
> The IdentifierAnnotation annotations have successfully been created in statements not
shown here, which is also evident from a CAS inspection, and the LOG actions output the expected
strings, but when I reference the variables in the CREATE action then the id and doi features
of the DocumentInfoAnnotation end up pointing to the same identifier (pmc in the above example).
Its puzzling me how this can happen.
>
>> On 09 Oct 2015, at 15:41 , Mario Juric <mario.juric.dk@gmail.com> wrote:
>>
>> Hi,
>>
>> I have a annotation type variable that I am assigning a value in a statement block
and then use that value in match rule to set the attribute in a new annotation like this:
>>
>> Type myvar;
>>
>> BLOCK(ForEach) UniqueMatch{} { // Capturing unique scope with this
>>    “Some (\\w+) Regex" -> 1 = MatchedRegexAnnotation;
>>    MatchedRegexAnnotation { -> ASSIGN(myvar, MatchedRegexAnnotation)};
>> }
>>
>> SomeOtherMatch{} {
>> 	-> CREATE(Markup, “myprop” = myvar)
>> };
>>
>> The “myprop” attribute never gets a value even though the MatchedRegexAnnotation
is created. A completely analog implementation appears to work flawlessly in another context
but not in the current.
>>
>> I am in the dark about this and my Ruta skills are sill infant so any idea to what
could be the problem is much appreciated.
>>
>> Cheers
>> Mario


Mime
View raw message