@Test public void parseDiet() throws StudyImporterException { final List<Map<String, String>> links = new ArrayList<>(); InputStream is = getClass().getResourceAsStream("diet_fishbase_first100.tsv"); DatasetImporterForFishbase3.importDiet(links::add, is, speciesMap, references, countries, "FB"); Map<String, String> firstItem = links.get(0); assertThat(firstItem.get("referenceCitation"), Is.is("Armstrong, M J. 1982. The predator-prey relationships of Irish Sea poor-cod (<i>Trisopterus minutus</i> L.), pouting (<i>Trisopterus luscus</i> L), and cod (<i>Gadus morhua</i> L.). J. Cons. Int. Explor. Mer. 40(2):135-152.")); assertThat(firstItem.get("decimalLongitude"), Is.is("-1.69182449421")); assertThat(firstItem.get("decimalLatitude"), Is.is("52.8763053517")); assertThat(firstItem.get("referenceUrl"), Is.is("http: assertThat(firstItem.get("localityName"), Is.is("UK|Off the west coast of the Isle of Man, 1977-1978")); assertThat(firstItem.get("localityId"), Is.is("FB_COUNTRY:826|")); assertThat(firstItem.get("sourceTaxonId"), Is.is("FBC:FB:SPECCODE:69")); assertThat(firstItem.get("sourceTaxonName"), Is.is("Gadus morhua")); assertThat(firstItem.get("sourceLifeStageName"), Is.is("recruits/juv.")); assertThat(firstItem.get("targetTaxonId"), Is.is(nullValue())); assertThat(firstItem.get("targetTaxonName"), Is.is("gastropods")); assertThat(firstItem.get("targetLifeStageName"), Is.is("n.a./others")); assertThat(firstItem.get("studyTitle"), Is.is("FB_REF:9604")); assertThat(firstItem.get(DatasetImporterForTSV.INTERACTION_TYPE_NAME), Is.is("eats")); assertThat(firstItem.get(DatasetImporterForTSV.INTERACTION_TYPE_ID), Is.is("http: assertThat(firstItem.get("localityName"), Is.is("UK|Off the west coast of the Isle of Man, 1977-1978")); Map<String, String> secondItem = links.get(1); assertThat(secondItem.get("localityName"), Is.is("UK|Off the west coast of the Isle of Man, 1977-1978")); assertThat(secondItem.get("localityId"), Is.is("FB_COUNTRY:826|")); }
protected static void importDiet(InteractionListener listener, InputStream is, Map<String, Map<String, String>> speciesMap, Map<String, Map<String, String>> references, Map<String, Map<String, String>> countries, String namespace) throws StudyImporterException { RecordListener listener1 = record -> { Map<String, String> props = importPredator(speciesMap, references, countries, namespace, record); appendPreyInfo(speciesMap, namespace, record, props); listener.newLink(props); }; handleTsvInputStream(listener1, is); }
DatasetImporterForFishbase3 extends DatasetImporterWithListener { protected static void importDiet(InteractionListener listener, InputStream is, Map<String, Map<String, String>> speciesMap, Map<String, Map<String, String>> references, Map<String, Map<String, String>> countries, String namespace) throws StudyImporterException { RecordListener listener1 = record -> { Map<String, String> props = importPredator(speciesMap, references, countries, namespace, record); appendPreyInfo(speciesMap, namespace, record, props); listener.newLink(props); }; handleTsvInputStream(listener1, is); } }
DatasetImporterForFishbase3 extends DatasetImporterWithListener { protected static void importDiet(InteractionListener listener, InputStream is, Map<String, Map<String, String>> speciesMap, Map<String, Map<String, String>> references, Map<String, Map<String, String>> countries, String namespace) throws StudyImporterException { RecordListener listener1 = record -> { Map<String, String> props = importPredator(speciesMap, references, countries, namespace, record); appendPreyInfo(speciesMap, namespace, record, props); listener.newLink(props); }; handleTsvInputStream(listener1, is); } DatasetImporterForFishbase3(ParserFactory parserFactory, NodeFactory nodeFactory); }
DatasetImporterForFishbase3 extends DatasetImporterWithListener { protected static void importDiet(InteractionListener listener, InputStream is, Map<String, Map<String, String>> speciesMap, Map<String, Map<String, String>> references, Map<String, Map<String, String>> countries, String namespace) throws StudyImporterException { RecordListener listener1 = record -> { Map<String, String> props = importPredator(speciesMap, references, countries, namespace, record); appendPreyInfo(speciesMap, namespace, record, props); listener.newLink(props); }; handleTsvInputStream(listener1, is); } DatasetImporterForFishbase3(ParserFactory parserFactory, NodeFactory nodeFactory); @Override void importStudy(); static void handleTsvInputStream(RecordListener listener, InputStream is); }
DatasetImporterForFishbase3 extends DatasetImporterWithListener { protected static void importDiet(InteractionListener listener, InputStream is, Map<String, Map<String, String>> speciesMap, Map<String, Map<String, String>> references, Map<String, Map<String, String>> countries, String namespace) throws StudyImporterException { RecordListener listener1 = record -> { Map<String, String> props = importPredator(speciesMap, references, countries, namespace, record); appendPreyInfo(speciesMap, namespace, record, props); listener.newLink(props); }; handleTsvInputStream(listener1, is); } DatasetImporterForFishbase3(ParserFactory parserFactory, NodeFactory nodeFactory); @Override void importStudy(); static void handleTsvInputStream(RecordListener listener, InputStream is); static final String C_CODE_GLOBAL; }