I am creating rules using Ruta as implemented in CLAMP ( https://clamp.uth.edu/ ). As one of the steps, I would like to identify all sentences that contain Temperature annotations.
So I would like to be able to specify attribute values for the annotation in CONTAINS function like this:
Sentence{CONTAINS(ClampNameEntityUIMA{"semanticTag", "Temperature"})
-> CREATE( ClampNameEntityUIMA , "semanticTag" = "TemperatureSentence")};
The statement that works is:
Sentence{CONTAINS(ClampNameEntityUIMA)
-> CREATE( ClampNameEntityUIMA , "semanticTag" = "TemperatureSentence")};
but that marks all sentences regardless of the contained annotation's feature value. CLAMP does not allow creating types on the fly so I cannot declare a new type as a placeholder for annotations that meet conditions. So I have to use only the existing type - ClampNameEntityUIMA - and I can only check the feature values to differentiate the annotation classes.
Is there a way to include additional conditions in CONTAINS function? Or can I manipulate annotations without having to declare a new type?
The CONTAINS condition does not support what you need. If more complex condition are required as in your example, you need to switch to inlined rules as condition. A rule like the following could solve your problem:
Sentence{-> CREATE(ClampNameEntityUIMA, "semanticTag" = "TemperatureSentence")}
<- {e:ClampNameEntityUIMA{e.semanticTag == "Temperature"};};
DISCLAIMER: I am a developer of UIMA Ruta