@Test public void parseReferences() throws IOException, StudyImporterException { String someLocalities = "Oid\tAuthors\tDescription\tComment\tYear\tUserId\tTitle\tType\tTitle2\tTitle3\tDate2\tJourfull\tJourab\tPubcity\tPublisher\tAvailability\tPubaddress\tSN\tPrintst\tVolume\tIssue\tPage1\tPage2\tUrl\tKeywords\tOptimisticLockField\tGCRecord\n" + "{9D773EF5-E522-4527-A404-00297A952B91}\tJ. Vanhara\t\t\t1982\t293\tThe moravian species of flat footed flies (Diptera, Opetiidae and Platypezidae)\t0\t\t\t\tFolia prirodoved. fak. UJEP Brne.\t\t\t\t\t\t\t\t23\t\t137-142\t\t\t\t0\t\n" + "{3B74121B-C819-4EDA-897B-0066CA6E52E1}\tP. Ma_an\t\t\t1998\t4221\tAmeroseius fungicolis sp. n. and A. callosus sp. n., two new ameroseiid species (Acarina, Mesostigmata) associated with wood-destroying fungi\t0\t\t\t\tBiologia Bratislava\t\t\t\t\t\t\t\t53\t5\t645-649\t\t\t\t0\t\n" + "{36A39A57-191F-4867-B0CF-00F1E245CCDC}\tJ. J. Kieffer\t\t\t1894\t304\tUeber die Heteropezinae\t0\t\t\t\tWiener Entomologische Zeitung\t\t\t\t\t\t\t\t13\t\t200Ð212, pl. I\t\t\t\t0\t\n" + "{E340D95F-8B42-48DC-A914-010C78D16106}\tGraham E. Rotheray\t\t\t1990\t75\tLarval and puparial records of some hoverflies associated with dead wood (Diptera, Syrphidae)\t0\t\t\t\tDipterists Digest\t\t\t\t\t\t\t\t7\t\t2-7\t\t\t\t0\t\n"; final Set<Triple<String, String, String>> triples = new TreeSet<>(); DatasetImporterForSaproxylic.parseReferences(triples::add, IOUtils.toInputStream(someLocalities, StandardCharsets.UTF_8)); assertThat(triples, hasItem(DatasetImporterForSaproxylic.asTriple("{9D773EF5-E522-4527-A404-00297A952B91}", "hasName", "J. Vanhara. 1982. The moravian species of flat footed flies (Diptera, Opetiidae and Platypezidae). vol 23. p 137-142. Folia prirodoved. fak. UJEP Brne."))); }
static void parseReferences(Tripler tripler, InputStream is) throws IOException, StudyImporterException { handleLines(parser -> { String referenceId = parser.getValueByLabel("Oid"); List<String> citation = new ArrayList<>(); appendIfNotBlank(parser, citation, "", "Authors"); appendIfNotBlank(parser, citation, "", "Year"); appendIfNotBlank(parser, citation, "", "Title"); appendIfNotBlank(parser, citation, "vol ", "Volume"); appendIfNotBlank(parser, citation, "issue ", "Issue"); appendIfNotBlank(parser, citation, "p ", "Page1"); appendIfNotBlank(parser, citation, "", "Jourfull"); String citationJoined = StringUtils.join(citation, ". "); tripler.on(asTriple(referenceId, HAS_NAME, citationJoined)); }, is); }
DatasetImporterForSaproxylic extends DatasetImporterWithListener { static void parseReferences(Tripler tripler, InputStream is) throws IOException, StudyImporterException { handleLines(parser -> { String referenceId = parser.getValueByLabel("Oid"); List<String> citation = new ArrayList<>(); appendIfNotBlank(parser, citation, "", "Authors"); appendIfNotBlank(parser, citation, "", "Year"); appendIfNotBlank(parser, citation, "", "Title"); appendIfNotBlank(parser, citation, "vol ", "Volume"); appendIfNotBlank(parser, citation, "issue ", "Issue"); appendIfNotBlank(parser, citation, "p ", "Page1"); appendIfNotBlank(parser, citation, "", "Jourfull"); String citationJoined = StringUtils.join(citation, ". "); tripler.on(asTriple(referenceId, HAS_NAME, citationJoined)); }, is); } }
DatasetImporterForSaproxylic extends DatasetImporterWithListener { static void parseReferences(Tripler tripler, InputStream is) throws IOException, StudyImporterException { handleLines(parser -> { String referenceId = parser.getValueByLabel("Oid"); List<String> citation = new ArrayList<>(); appendIfNotBlank(parser, citation, "", "Authors"); appendIfNotBlank(parser, citation, "", "Year"); appendIfNotBlank(parser, citation, "", "Title"); appendIfNotBlank(parser, citation, "vol ", "Volume"); appendIfNotBlank(parser, citation, "issue ", "Issue"); appendIfNotBlank(parser, citation, "p ", "Page1"); appendIfNotBlank(parser, citation, "", "Jourfull"); String citationJoined = StringUtils.join(citation, ". "); tripler.on(asTriple(referenceId, HAS_NAME, citationJoined)); }, is); } DatasetImporterForSaproxylic(ParserFactory parserFactory, NodeFactory nodeFactory); }
DatasetImporterForSaproxylic extends DatasetImporterWithListener { static void parseReferences(Tripler tripler, InputStream is) throws IOException, StudyImporterException { handleLines(parser -> { String referenceId = parser.getValueByLabel("Oid"); List<String> citation = new ArrayList<>(); appendIfNotBlank(parser, citation, "", "Authors"); appendIfNotBlank(parser, citation, "", "Year"); appendIfNotBlank(parser, citation, "", "Title"); appendIfNotBlank(parser, citation, "vol ", "Volume"); appendIfNotBlank(parser, citation, "issue ", "Issue"); appendIfNotBlank(parser, citation, "p ", "Page1"); appendIfNotBlank(parser, citation, "", "Jourfull"); String citationJoined = StringUtils.join(citation, ". "); tripler.on(asTriple(referenceId, HAS_NAME, citationJoined)); }, is); } DatasetImporterForSaproxylic(ParserFactory parserFactory, NodeFactory nodeFactory); @Override void importStudy(); void toInteractions(ResultSet results); }
DatasetImporterForSaproxylic extends DatasetImporterWithListener { static void parseReferences(Tripler tripler, InputStream is) throws IOException, StudyImporterException { handleLines(parser -> { String referenceId = parser.getValueByLabel("Oid"); List<String> citation = new ArrayList<>(); appendIfNotBlank(parser, citation, "", "Authors"); appendIfNotBlank(parser, citation, "", "Year"); appendIfNotBlank(parser, citation, "", "Title"); appendIfNotBlank(parser, citation, "vol ", "Volume"); appendIfNotBlank(parser, citation, "issue ", "Issue"); appendIfNotBlank(parser, citation, "p ", "Page1"); appendIfNotBlank(parser, citation, "", "Jourfull"); String citationJoined = StringUtils.join(citation, ". "); tripler.on(asTriple(referenceId, HAS_NAME, citationJoined)); }, 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; }