@Test public void testMatching() { String document = "Some text."; CAS cas = null; try { cas = RutaTestUtils.getCAS(document); } catch (Exception e) { e.printStackTrace(); } Type t1 = RutaTestUtils.getTestType(cas, 1); AnnotationFS a1 = cas.createAnnotation(t1, 5, 9); cas.addFsToIndexes(a1); int ref = 0; if (a1 instanceof AnnotationImpl) { AnnotationImpl aImpl = (AnnotationImpl) a1; ref = aImpl.getAddress(); } String script = ""; script += "$" + ref + "{REGEXP(\".*ex.*\")-> T2};"; script += "W $" + ref + "{REGEXP(\".*ex.*\")-> T3};"; try { Ruta.apply(cas, script); } catch (Exception e) { e.printStackTrace(); } RutaTestUtils.assertAnnotationsEquals(cas, 2, 1, "text"); RutaTestUtils.assertAnnotationsEquals(cas, 3, 1, "text"); if (cas != null) { cas.release(); } }
public String getAddress() { return address; }
AnnotationAddressExpression extends AbstractAnnotationExpression { public String getAddress() { return address; } }
AnnotationAddressExpression extends AbstractAnnotationExpression { public String getAddress() { return address; } AnnotationAddressExpression(String address); }
AnnotationAddressExpression extends AbstractAnnotationExpression { public String getAddress() { return address; } AnnotationAddressExpression(String address); @Override AnnotationFS getAnnotation(MatchContext context, RutaStream stream); @Override FeatureStructure getFeatureStructure(MatchContext context, RutaStream stream); String getAddress(); }
AnnotationAddressExpression extends AbstractAnnotationExpression { public String getAddress() { return address; } AnnotationAddressExpression(String address); @Override AnnotationFS getAnnotation(MatchContext context, RutaStream stream); @Override FeatureStructure getFeatureStructure(MatchContext context, RutaStream stream); String getAddress();  }