@Test public void testFigures() throws Exception { JCas cas = JCasFactory.createJCas("de.julielab.jcore.types.jcore-all-types"); CollectionReader reader = CollectionReaderFactory.createReader(PMCReader.class, PMCReader.PARAM_INPUT, "src/test/resources/documents-recursive/PMC2847692.nxml.gz"); assertTrue(reader.hasNext()); reader.getNext(cas.getCas()); Iterator<AnnotationFS> figureIt = CasUtil.iterator(cas.getCas(), CasUtil.getAnnotationType(cas.getCas(), Figure.class)); assertTrue(figureIt.hasNext()); int tablenum = 0; while (figureIt.hasNext()) { Figure figure = (Figure) figureIt.next(); assertNotNull(figure.getObjectCaption()); assertNotNull(figure.getObjectTitle()); Title tabelTitle = figure.getObjectTitle(); if (tablenum == 0) { assertEquals("Fig. 1", tabelTitle.getCoveredText()); assertEquals("Fig.\u00A01", figure.getObjectLabel()); assertTrue(figure.getObjectCaption().getCoveredText().startsWith("The Baltic Sea")); assertEquals("Fig1", figure.getObjectId()); } ++tablenum; } }
@Override public void getNext(JCas cas) throws CollectionException { URI next = null; try { next = pmcFiles.next(); casPopulator.populateCas(next, cas); if (extractIdFromFilename) ((Header)cas.getAnnotationIndex(Header.type).iterator().next()).setDocId(getIdFromFilename(next)); } catch (ElementParsingException e) { log.error("Exception occurred when trying to parse {}", next, e); throw new CollectionException(e); } completed++; }
PMCReader extends PMCReaderBase { @Override public void getNext(JCas cas) throws CollectionException { URI next = null; try { next = pmcFiles.next(); casPopulator.populateCas(next, cas); if (extractIdFromFilename) ((Header)cas.getAnnotationIndex(Header.type).iterator().next()).setDocId(getIdFromFilename(next)); } catch (ElementParsingException e) { log.error("Exception occurred when trying to parse {}", next, e); throw new CollectionException(e); } completed++; } }
PMCReader extends PMCReaderBase { @Override public void getNext(JCas cas) throws CollectionException { URI next = null; try { next = pmcFiles.next(); casPopulator.populateCas(next, cas); if (extractIdFromFilename) ((Header)cas.getAnnotationIndex(Header.type).iterator().next()).setDocId(getIdFromFilename(next)); } catch (ElementParsingException e) { log.error("Exception occurred when trying to parse {}", next, e); throw new CollectionException(e); } completed++; }  }
PMCReader extends PMCReaderBase { @Override public void getNext(JCas cas) throws CollectionException { URI next = null; try { next = pmcFiles.next(); casPopulator.populateCas(next, cas); if (extractIdFromFilename) ((Header)cas.getAnnotationIndex(Header.type).iterator().next()).setDocId(getIdFromFilename(next)); } catch (ElementParsingException e) { log.error("Exception occurred when trying to parse {}", next, e); throw new CollectionException(e); } completed++; }  @Override void initialize(UimaContext context); @Override void getNext(JCas cas); }
PMCReader extends PMCReaderBase { @Override public void getNext(JCas cas) throws CollectionException { URI next = null; try { next = pmcFiles.next(); casPopulator.populateCas(next, cas); if (extractIdFromFilename) ((Header)cas.getAnnotationIndex(Header.type).iterator().next()).setDocId(getIdFromFilename(next)); } catch (ElementParsingException e) { log.error("Exception occurred when trying to parse {}", next, e); throw new CollectionException(e); } completed++; }  @Override void initialize(UimaContext context); @Override void getNext(JCas cas); static final String PARAM_INPUT; static final String PARAM_RECURSIVELY; static final String PARAM_SEARCH_ZIP; static final String PARAM_WHITELIST; static final String PARAM_EXTRACT_ID_FROM_FILENAME; }