private void swapGeoJson(final String geoJson) { // Swap out the GeoJson in the location entity for another // Note this is not changing the data.getmentions() instance JCasUtil.select(data.getJCas(), Location.class).stream().forEach(l -> l.setGeoJson(geoJson)); } }
public static Location createLocation( JCas jCas, int begin, int end, String value, String geojson) { Location l = new Location(jCas); l.setValue(value); l.setBegin(begin); l.setEnd(end); if (geojson != null) { l.setGeoJson(geojson); } l.addToIndexes(); return l; }
@Test public void testOneGeoJsonInner() throws Exception { AnalysisEngine rneAE = AnalysisEngineFactory.createEngine(RemoveNestedLocations.class); jCas.setDocumentText(NORTH_LONDON); Location l1 = Annotations.createLocation(jCas, 6, 12, LONDON, FAKE_GEOJSON); Location l2 = Annotations.createLocation(jCas, 0, 12, NORTH_LONDON, null); rneAE.process(jCas); assertEquals(1, JCasUtil.select(jCas, Location.class).size()); Location l = JCasUtil.selectByIndex(jCas, Location.class, 0); assertEquals(l1.getGeoJson(), l.getGeoJson()); l.setGeoJson(null); assertEquals(l2, l); } }
l.setGeoJson(scr.getGeoJson(cca3)); l.addToIndexes();
public JCasSerializationTester() throws UIMAException { out = JCasFactory.createJCas(); in = JCasFactory.createJCas(); in.setDocumentText("This is a test"); final DocumentAnnotation inDA = (DocumentAnnotation) in.getDocumentAnnotationFs(); inDA.setDocumentClassification("CLASS"); final Location l = new Location(in); l.setBegin(10); l.setEnd(12); l.setGeoJson(GEO_JSON); l.setValue("Dinagat Islands"); l.setConfidence(0.9d); l.addToIndexes(in); final ReferenceTarget rt = new ReferenceTarget(in); rt.setBegin(0); rt.setEnd(1); rt.addToIndexes(in); final Person p = new Person(in); p.setBegin(2); p.setEnd(8); p.setGender("Male"); p.setValue("Peter"); p.setConfidence(0.5d); p.setReferent(rt); p.addToIndexes(in); }
l.setBegin(72); l.setEnd(87); l.setGeoJson(GEO_JSON); l.setValue("Dinagat Islands"); l.setConfidence(0.9d);