This is an automated email from the ASF dual-hosted git repository. pkluegl pushed a commit to branch bugfix/UIMA-6394-Ruta-label-assignment-in-alternative-match-causes-problems-bugfix in repository https://gitbox.apache.org/repos/asf/uima-ruta.git
commit ec58d0a4280187673096a6f5a9ead44a2effe15e Author: Peter Klügl <peter.klu...@averbis.com> AuthorDate: Fri Jan 7 13:56:07 2022 +0100 UIMA-6394: Ruta: label assignment in alternative match causes problems - adding test --- .../annotation/AnnotationLabelExpressionTest.java | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/ruta-core/src/test/java/org/apache/uima/ruta/expression/annotation/AnnotationLabelExpressionTest.java b/ruta-core/src/test/java/org/apache/uima/ruta/expression/annotation/AnnotationLabelExpressionTest.java index c4738aa..dd63f43 100644 --- a/ruta-core/src/test/java/org/apache/uima/ruta/expression/annotation/AnnotationLabelExpressionTest.java +++ b/ruta-core/src/test/java/org/apache/uima/ruta/expression/annotation/AnnotationLabelExpressionTest.java @@ -845,4 +845,31 @@ public class AnnotationLabelExpressionTest { RutaTestUtils.assertAnnotationsEquals(cas, 1, 1, "Some text"); } + @Test + public void testCompareStringFeatures() throws Exception { + + String document = "A b."; + Map<String, String> typeMap = new TreeMap<String, String>(); + typeMap.put("Struct1", "uima.tcas.Annotation"); + typeMap.put("Struct2", "uima.tcas.Annotation"); + + Map<String, List<TestFeature>> featureMap = new TreeMap<String, List<TestFeature>>(); + List<TestFeature> list = new ArrayList<RutaTestUtils.TestFeature>(); + featureMap.put("Struct1", list); + featureMap.put("Struct2", list); + list.add(new TestFeature("s", "", "uima.cas.String")); + + String script = ""; + script += "SW{->CREATE(Struct2, \"s\" = \"b\")};\n"; + script += "SW{->CREATE(Struct2, \"s\" = \"a\")};\n"; + script += "CW{->CREATE(Struct1, \"s\" = \"a\")};\n"; + script += "(s1:Struct1 s2:Struct2){s1.s==s2.s-> T1};\n"; + + CAS cas = RutaTestUtils.getCAS(document, typeMap, featureMap); + Ruta.apply(cas, script); + + RutaTestUtils.assertAnnotationsEquals(cas, 1, 1, "A b"); + + } + }