Search code examples
uimarutanegation

Negation in UIMA Ruta Not Equal


I am new to Ruta and trying to write a rule containing a negation. What I want is something like this:

((POS.PosValue == "ADJA")|(POS.PosValue == "ADJD") & -(MorphologicalFeatures.degree=="comp"))

So an adjective that is not a comparative. I know it's possible to negate conditions with the "-" symbol (https://uima.apache.org/d/ruta-current/ruta.html), but it doesn't seem to work the same way for "not equal".

I tried variations like

((POS.PosValue == "ADJA")|(POS.PosValue == "ADJD") & (MorphologicalFeatures.degree-="comp"))

or

((POS.PosValue == "ADJA")|(POS.PosValue == "ADJD") & (-MorphologicalFeatures.degree-="comp"))

But nothing works.

Thanks for helping!


Solution

  • Negation in comparisons can be formulated with "!=". In your example this would be: MorphologicalFeatures.degree!="comp". (See 2.6.5. Boolean Expressions in the documentation)

    A side note: I recommend to avoid conjunctive and disjunctive rule elements (| and &) if possible as their rule ionference is rather complex and can easily result in matches one would not expect. Inlined rules as condition can used to specify patterns on the same position.