Search code examples
uimaruta

UIMA Ruta: Check if feature is empty/undefined


Within a UIMA Ruta script, I would like to check whether a feature of an annotation has been set/defined/is not null (whatever you call it). The feature is itself not of primitive type, but an "Annotation".

Is there a way to do that so that this check can be used to restrict generation of new annotations if the feature is not set.


Solution

  • You should be able to simply write it down in the feature dot notation with a comparison against null:

    MyAnnotation.complexFeature != null;
    a:MyAnnotation{a.complexFeature != null};
    

    (requires a newer Ruta version, it should work just fine in Ruta 2.6.1)

    DISCLAIMER: I am a developer of UIMA Ruta