Oops, now I saw this built-in functionality in the docs, sorry, I was trying to use "if" statement.
We are using ANNOTATIONLIST because there are other situations where anchors, values, positions have different contents. Thanks a lot JM 2018-02-26 10:21 GMT+01:00 Peter Klügl <[email protected]>: > Hi, > > > you can use the normal functionality of conditions in the head rule of a > block, which results in sort of "if". This could look like: > > > BLOCK(p) Participant{APL==true} { > > or > > BLOCK(p) Participant{APL} { > > You still have the iterator, so maybe you would like to add another > (outer) block just for the "if". > > > > It hard to say something about how the rules could be improved without a > typical use case where they are applied and the larger context. > > I personally would use more annotations/types and less ANNOTATIONLIST > since Ruta debugging does not cover it and it is more readable. Using > additional types, you could write the second block probably in one rule. > Something like: > > p1:Participant{APL, p1.isCustomer -> CREATE(ControlRuleDetection, > "anchors" = SelectedMark, "values" = SelectedMark)} > <-{m1:Mark{ m1.code=="BAD", m1.value=="Y" -> TRANSFER(SelectedMark)};}; > > This is not a solution for you, just as an example. It's also missing > the positions. > > > Best, > > > Peter > > > Am 26.02.2018 um 06:47 schrieb Josep María Formentí Serra: > > Hi all, > > > > I have this script in Ruta: > > > > PACKAGE com.aia.tas.uima.types; > > DECLARE ControlRuleDetection; > > ANNOTATIONLIST anchors; > > ANNOTATIONLIST values; > > INTLIST positions; > > BOOLEAN APL; > > BOOLEAN BAD; > > BLOCK(h) Header{} { > > Document { -> APL = false }; > > a1:Attribute{ a1.code=="general.codapl", a1.ct=="CDO" -> APL = true}; > > } > > BLOCK(p) Participant{} { > > Document{ -> BAD=false, CLEAR(anchors), CLEAR(values), CLEAR(positions) > }; > > m1:Mark{ m1.code=="BAD", m1.value=="Y" -> BAD=true, ADD(anchors, m1), > > ADD(values, m1), ADD(positions, 1)}; > > p1:Document{APL, p1.isCustomer, BAD -> CREATE(ControlRuleDetection, > > "anchors" = anchors, "values" = values, "positions" = positions)}; > > } > > > > > > where there are 2 BLOCKs, the 2th BLOCK should be only executed when > > APL==true (calculated in first BLOCK). > > > > How could I do? another optimizations are welcome too. > > > > BR, > > JM > > -- > Peter Klügl > R&D Text Mining/Machine Learning > > Averbis GmbH > Tennenbacher Str. 11 > 79106 Freiburg > Germany > > Fon: +49 761 708 394 0 > Fax: +49 761 708 394 10 > Email: [email protected] > Web: https://averbis.com > > Headquarters: Freiburg im Breisgau > Register Court: Amtsgericht Freiburg im Breisgau, HRB 701080 > Managing Directors: Dr. med. Philipp Daumke, Dr. Kornél Markó > > -- ------------------------------------------------------------------- --- -- - - - *Grupo AIA* - *www.aia.es <http://www.aia.es> * Josep Mª Formentí Serra <[email protected]> *[email protected] <[email protected]>*Dpto. Servicios Financieros y Seguros ESADECREAPOLIS, Sant Cugat, Barcelona Telf.: +34 93 504 49 00 Fax.: +34 93 580 21 88 ------------------------------------------------------------------- --- -- - - - The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.
