@Test public void testExtractIdFromFilename() throws Exception { JCas cas = JCasFactory.createJCas("de.julielab.jcore.types.jcore-document-meta-pubmed-types", "de.julielab.jcore.types.jcore-document-structure-pubmed-types"); CollectionReader reader = CollectionReaderFactory.createReader(PMCReader.class, PMCReader.PARAM_INPUT, "src/test/resources/documents-recursive/PMC2847692.nxml.gz", PMCReader.PARAM_EXTRACT_ID_FROM_FILENAME, true); assertTrue(reader.hasNext()); reader.getNext(cas.getCas()); String docId = ((Header)cas.getAnnotationIndex(Header.type).iterator().next()).getDocId(); assertEquals(docId, "PMC2847692"); }
@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; }