@Test public void parseOccurrences() throws IOException, StudyImporterException { String someOccurrenceRows = "Oid\tProject\tLicense\tLocality\tColl_Ins\tCollection\tColl_refnumber\tDigitizedBy\tDigitizedYear\tStartOn\tEndOn\tUsedName\tTaxon\tExpertTaxon\tStage\tReference\tComment\tSourceComment\tOptimisticLockField\tGCRecord\n" + "{ACF1CDC2-BABD-4B63-AA57-0002A1C918E2}\t\t\t{02759CAD-38BF-4353-8B37-00919DE7F65F}\t\t\t\tAgnieszka Napierala\t2007\t\t\t\t{BE612DC1-8E9E-4D77-936A-543E865DF829}\t{BE612DC1-8E9E-4D77-936A-543E865DF829}\twoody material\t{E4014B48-1D7A-4EC9-BE0B-C43DC82F717F}\t\t\t0\t\n" + "{2C80197C-4783-4C02-AF8F-0006B450F240}\t\t\t{02759CAD-38BF-4353-8B37-00919DE7F65F}\t\t\t\tAgnieszka Napierala\t2007\t\t\t\t{6E58CEC1-5EEA-43F5-AE6C-0B696776DD18}\t{6E58CEC1-5EEA-43F5-AE6C-0B696776DD18}\tadult\t{E4014B48-1D7A-4EC9-BE0B-C43DC82F717F}\t\tDecay well decayed, beech, well decayed, humid, lying log (6m/50-60 m).\t0\t\n" + "{DF656380-877A-4EB4-82BB-0006D111F833}\t\t\t{02759CAD-38BF-4353-8B37-00919DE7F65F}\t\t\t\tAgnieszka Napierala\t2007\t\t\t\t{E75ADA70-586E-4C4E-A626-0663C81DC35D}\t{E75ADA70-586E-4C4E-A626-0663C81DC35D}\twoody material\t{E4014B48-1D7A-4EC9-BE0B-C43DC82F717F}\t\t\t0\t\n" + "{1C0C24A1-4860-424E-BDBE-0006FFC47BF1}\t\t\t{02759CAD-38BF-4353-8B37-00919DE7F65F}\t\t\t\t\t\t\t\t\t{51121BF1-F06A-4BE4-8657-E39779A06AB1}\t{51121BF1-F06A-4BE4-8657-E39779A06AB1}\tadult\t{368E9A85-68DB-4557-8874-369445AEFECB}\t\tRecorded in the galleries of Trypodendron signatum (I).\t0\t\n" + "{2FDA6035-024C-4811-B318-0007FD35066C}\t\t\t{2976B8B6-D04C-47C0-8406-BF73C6FE1DF7}\t\t\t\tJogeir N. Stokland\t2007-2008\t\t\t\t{E6234FAD-896A-4D8E-89DB-0CACC67CD493}\t{E6234FAD-896A-4D8E-89DB-0CACC67CD493}\timago\t{DF56D217-13B1-42B1-81A6-64553F91F7B6}\t\tIn leaves at base of old oaks (Quercus)\t0\t\n" + "{14FAAEEC-1FDA-49CA-AF92-00088736D9C3}\t\t\t{84D0E1DE-452A-4BC0-9E65-BE0AF38A2956}\t\t\t\tIneta Salmane\t\t\t\t\t{B60BDE2D-5DA2-4FEB-8E15-888AE2EC7F63}\t{B60BDE2D-5DA2-4FEB-8E15-888AE2EC7F63}\t\t{C991F8F7-29C0-4178-AF6B-DD37CEB425F2}\t\tRecorded on Coriolus hirsutus on fallen birches in the dark taiga.\t0\t\n" + "{0A992435-37A5-4487-9E9B-000EE13AA5A0}\t\t\t{02759CAD-38BF-4353-8B37-00919DE7F65F}\t\t\t\tIneta Salmane\t\t\t\t\t{32CA58DF-20BA-48D4-B8B6-D7685712C6ED}\t{32CA58DF-20BA-48D4-B8B6-D7685712C6ED}\twoody material\t{3E1845B1-2441-4986-8B31-D6C50167A271}\t\t\t0\t\n"; final Set<Triple<String, String, String>> triples = new TreeSet<>(); DatasetImporterForSaproxylic.parseOccurrences(triples::add, IOUtils.toInputStream(someOccurrenceRows, StandardCharsets.UTF_8)); assertThat(triples, hasItem(DatasetImporterForSaproxylic.asTriple("{ACF1CDC2-BABD-4B63-AA57-0002A1C918E2}", "classifiedAs", "{BE612DC1-8E9E-4D77-936A-543E865DF829}"))); }
static void parseOccurrences(Tripler tripler, InputStream is) throws IOException, StudyImporterException { handleLines(parser -> { String occId = parser.getValueByLabel("Oid"); tripler.on(asTriple(occId, CLASSIFIED_AS, parser.getValueByLabel("ExpertTaxon"))); tripler.on(asTriple(occId, IN_STAGE, parser.getValueByLabel("Stage"))); tripler.on(asTriple(occId, FOUND_AT, parser.getValueByLabel("Locality"))); }, is); }
DatasetImporterForSaproxylic extends DatasetImporterWithListener { static void parseOccurrences(Tripler tripler, InputStream is) throws IOException, StudyImporterException { handleLines(parser -> { String occId = parser.getValueByLabel("Oid"); tripler.on(asTriple(occId, CLASSIFIED_AS, parser.getValueByLabel("ExpertTaxon"))); tripler.on(asTriple(occId, IN_STAGE, parser.getValueByLabel("Stage"))); tripler.on(asTriple(occId, FOUND_AT, parser.getValueByLabel("Locality"))); }, is); } }
DatasetImporterForSaproxylic extends DatasetImporterWithListener { static void parseOccurrences(Tripler tripler, InputStream is) throws IOException, StudyImporterException { handleLines(parser -> { String occId = parser.getValueByLabel("Oid"); tripler.on(asTriple(occId, CLASSIFIED_AS, parser.getValueByLabel("ExpertTaxon"))); tripler.on(asTriple(occId, IN_STAGE, parser.getValueByLabel("Stage"))); tripler.on(asTriple(occId, FOUND_AT, parser.getValueByLabel("Locality"))); }, is); } DatasetImporterForSaproxylic(ParserFactory parserFactory, NodeFactory nodeFactory); }
DatasetImporterForSaproxylic extends DatasetImporterWithListener { static void parseOccurrences(Tripler tripler, InputStream is) throws IOException, StudyImporterException { handleLines(parser -> { String occId = parser.getValueByLabel("Oid"); tripler.on(asTriple(occId, CLASSIFIED_AS, parser.getValueByLabel("ExpertTaxon"))); tripler.on(asTriple(occId, IN_STAGE, parser.getValueByLabel("Stage"))); tripler.on(asTriple(occId, FOUND_AT, parser.getValueByLabel("Locality"))); }, is); } DatasetImporterForSaproxylic(ParserFactory parserFactory, NodeFactory nodeFactory); @Override void importStudy(); void toInteractions(ResultSet results); }
DatasetImporterForSaproxylic extends DatasetImporterWithListener { static void parseOccurrences(Tripler tripler, InputStream is) throws IOException, StudyImporterException { handleLines(parser -> { String occId = parser.getValueByLabel("Oid"); tripler.on(asTriple(occId, CLASSIFIED_AS, parser.getValueByLabel("ExpertTaxon"))); tripler.on(asTriple(occId, IN_STAGE, parser.getValueByLabel("Stage"))); tripler.on(asTriple(occId, FOUND_AT, parser.getValueByLabel("Locality"))); }, is); } DatasetImporterForSaproxylic(ParserFactory parserFactory, NodeFactory nodeFactory); @Override void importStudy(); void toInteractions(ResultSet results); static final String CLASSIFIED_AS; static final String IN_STAGE; static final String FOUND_AT; static final String MENTIONED_BY; static final String PARTICIPATES_IN; static final String HAS_NAME; static final String HAS_RANK; static final String HAS_PATH_IDS; static final String HAS_PATH_NAMES; }