@Test public void testLocationRT1() throws Exception { jCas.setDocumentText("The former school house at GR 1234 5678."); ReferenceTarget rt = new ReferenceTarget(jCas); rt.addToIndexes(); Location l = new Location(jCas, 4, 23); l.setReferent(rt); l.addToIndexes(); Coordinate c = new Coordinate(jCas, 27, 39); c.addToIndexes(); processJCas(); assertEquals(2, JCasUtil.select(jCas, Location.class).size()); assertEquals(rt, c.getReferent()); }
private void setReferent(JCas jCas, Location l, Coordinate c) { if (l.getReferent() == null && c.getReferent() == null) { ReferenceTarget rt = new ReferenceTarget(jCas); rt.addToIndexes(); l.setReferent(rt); c.setReferent(rt); } else if (l.getReferent() != null && c.getReferent() == null) { c.setReferent(l.getReferent()); } else if (l.getReferent() == null && c.getReferent() != null) { l.setReferent(c.getReferent()); } else { for (Location lRt : JCasUtil.select(jCas, Location.class).stream() .filter(l2 -> l2.getReferent().equals(l.getReferent())) .collect(Collectors.toList())) { lRt.setReferent(c.getReferent()); } } }
NPAtCoordinate extends BaleenAnnotator { private void setReferent(JCas jCas, Location l, Coordinate c) { if (l.getReferent() == null && c.getReferent() == null) { ReferenceTarget rt = new ReferenceTarget(jCas); rt.addToIndexes(); l.setReferent(rt); c.setReferent(rt); } else if (l.getReferent() != null && c.getReferent() == null) { c.setReferent(l.getReferent()); } else if (l.getReferent() == null && c.getReferent() != null) { l.setReferent(c.getReferent()); } else { for (Location lRt : JCasUtil.select(jCas, Location.class).stream() .filter(l2 -> l2.getReferent().equals(l.getReferent())) .collect(Collectors.toList())) { lRt.setReferent(c.getReferent()); } } } }
NPAtCoordinate extends BaleenAnnotator { private void setReferent(JCas jCas, Location l, Coordinate c) { if (l.getReferent() == null && c.getReferent() == null) { ReferenceTarget rt = new ReferenceTarget(jCas); rt.addToIndexes(); l.setReferent(rt); c.setReferent(rt); } else if (l.getReferent() != null && c.getReferent() == null) { c.setReferent(l.getReferent()); } else if (l.getReferent() == null && c.getReferent() != null) { l.setReferent(c.getReferent()); } else { for (Location lRt : JCasUtil.select(jCas, Location.class).stream() .filter(l2 -> l2.getReferent().equals(l.getReferent())) .collect(Collectors.toList())) { lRt.setReferent(c.getReferent()); } } }  }
NPAtCoordinate extends BaleenAnnotator { private void setReferent(JCas jCas, Location l, Coordinate c) { if (l.getReferent() == null && c.getReferent() == null) { ReferenceTarget rt = new ReferenceTarget(jCas); rt.addToIndexes(); l.setReferent(rt); c.setReferent(rt); } else if (l.getReferent() != null && c.getReferent() == null) { c.setReferent(l.getReferent()); } else if (l.getReferent() == null && c.getReferent() != null) { l.setReferent(c.getReferent()); } else { for (Location lRt : JCasUtil.select(jCas, Location.class).stream() .filter(l2 -> l2.getReferent().equals(l.getReferent())) .collect(Collectors.toList())) { lRt.setReferent(c.getReferent()); } } }  @Override AnalysisEngineAction getAction(); }
NPAtCoordinate extends BaleenAnnotator { private void setReferent(JCas jCas, Location l, Coordinate c) { if (l.getReferent() == null && c.getReferent() == null) { ReferenceTarget rt = new ReferenceTarget(jCas); rt.addToIndexes(); l.setReferent(rt); c.setReferent(rt); } else if (l.getReferent() != null && c.getReferent() == null) { c.setReferent(l.getReferent()); } else if (l.getReferent() == null && c.getReferent() != null) { l.setReferent(c.getReferent()); } else { for (Location lRt : JCasUtil.select(jCas, Location.class).stream() .filter(l2 -> l2.getReferent().equals(l.getReferent())) .collect(Collectors.toList())) { lRt.setReferent(c.getReferent()); } } }  @Override AnalysisEngineAction getAction();  }