@Test public void importReferences() throws IOException, StudyImporterException { String someReferences = "REF_ID,DATA_ID,DATA_TYPE,GAME_ID,DATA_SOURCE_TYPE,THESIS_TYPE,REF_TAG,AUTH_L_NAME,AUTH_SUFFIX,AUTH_F_NAME,AUTH_M_INIT,YEAR_PUB,TITLE_REF,EDITOR_L_NAME,EDITOR_F_NAME,EDITOR_M_INIT,SOURCE_NAME,VOL,NUM,START_PAGE,END_PAGE,DOI,PUB_NAME,PUB_CITY,PUB_STATE,PUB_COUNTRY,UNIV_NAME,UNIV_CITY,UNIV_STATE,UNIV_COUNTRY,REF_NOTES,LANGUAGE,REF_POLY_SHAPEFILE_ID,REF_CENT_SHAPEFILE_ID,REF_STAT_SHAPEFILE_ID,ENTRY_DATE,ENTRY_PERSON,EDITED_DATE,DATA_EDITOR,MODIFY_DATE,DATA_MODIFIER\n" + "ACT_5A,ACT_5A,pred/prey,2510,PL,NA,\"Adams and Kendall, 1891\",Adams,NA,A,C,1891,Report upon an investigation of fishing grounds off the west coast of Florida,NA,NA,NA,Bulletin of the United States Fish Commission,NA,NA,289,312,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,English,NA,NA,NA,11/10/2012,Amanda Yzaguirre,NA,Amanda Yzaguirre,15/06/2016,Theresa Mitchell\n" + "ACT_5A,ACT_5A,pred/prey,2510,PL,NA,\"Adams and Kendall, 1891\",Kendall,NA,W,C,1891,Report upon an investigation of fishing grounds off the west coast of Florida,NA,NA,NA,Bulletin of the United States Fish Commission,NA,NA,289,312,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,English,NA,NA,NA,12/10/2012,Amanda Yzaguirre,NA,Amanda Yzaguirre,15/06/2016,Theresa Mitchell\n" + "ACT_14A,ACT_14A,pred/prey,2519,T,BS,Alarcon Sosa 2007,Alarcon Sosa,NA,Adlemy,C,2007,\"Aspectos trĂłficos de la ictiofauna de la laguna de Sontecomapan, Ver. Durante la temporada de secas del 2005. \",NA,NA,NA,NA,NA,NA,1,75,NA,NA,NA,NA,NA,\"Universidad Nacional AutĂłnoma de Mexico, FES-Iztacala\",Mexico City,Distrito Federal,Mexico,NA,Spanish,NA,NA,NA,NA,Jim Jim Simons,NA,Jim Jim Simons,15/06/2016,Theresa Mitchell\n" + "ACT_2B,ACT_2B,pred/prey,2538,T,MS,\"Bailey, 1995\",Bailey,IV,H,Killebrew,1995,Potential Interactive Effects of Habitat Complexity and Sub-adults on Young of the Year Red Snapper (Lutjanus campechanus) Behavior,NA,NA,NA,NA,NA,NA,1,51,NA,NA,NA,NA,NA,University of South Alabama,Mobile,AL,US,NA,English,NA,NA,NA,22/02/2014,Theresa Mitchell,22/02/2014,Theresa Mitchell,15/06/2016,Theresa Mitchell\n" + "ACT_14B,ACT_14B,pred/prey,2569,PL,NA,\"Baughman, 1943\",Baughman,NA,J,L,1943,The Lutianid Fishes of Texas,NA,NA,NA,Copeia,1943,4,212,215,NA,American Society of Ichthyologists and Herpetologists,Lawrence,KS,US,NA,NA,NA,NA,NA,English,NA,NA,NA,06/11/2013,Theresa Mitchell,29/01/2014,Theresa Mitchell,15/06/2016,Theresa Mitchell\n" + "ACT_16B,ACT_16B,pred/prey,2549,PL,NA,Baughman and Springer 1950,Baughman,NA,J,L,1950,\"Biological and Economic Notes on the Sharks of the Gulf of Mexico, With Especial Reference to Those of Texas, and With a Key for their Identification\",NA,NA,NA,The American Midland Naturalist,44,1,96,152,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,English,NA,NA,NA,19/09/2012,Theresa Mitchell,25/01/2013,Theresa Mitchell,15/06/2016,Theresa Mitchell\n" + "ACT_16B,ACT_16B,pred/prey,2549,PL,NA,Baughman and Springer 1950,Springer,NA,Stewart,NA,1950,\"Biological and Economic Notes on the Sharks of the Gulf of Mexico, With Especial Reference to Those of Texas, and With a Key for their Identification\",NA,NA,NA,The American Midland Naturalist,44,1,96,152,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,English,NA,NA,NA,19/09/2012,Theresa Mitchell,25/01/2013,Theresa Mitchell,15/06/2016,Theresa Mitchell\n" + "ACT_17B,ACT_17B,pred/prey,2550,GR,NA,Beaumariage 1973,Beaumariage,NA,Dale,S,1973,\"Age, growth, and reproduction of king mackerel, Scomberomorus cavalla, in Florida. \",NA,NA,NA,Florida Marine Research Publications,NA,1,1,45,,\"Marine Research Laboratory, Florida Department of Natural Resources\",St. Petersburg,FL,US,NA,NA,NA,NA,NA,English,NA,NA,NA,NA,Jim Jim Simons,NA,Jim Jim Simons,15/06/2016,Theresa Mitchell\n" + "ACT_18B,ACT_18B,pred/prey,3178,GR,NA,\"Beaumariage and Bullock, 1976\",Beaumariage,NA,D,S,1976,Biological Research on Snappers and Groupers as Related to Fishery Management Requirements,\"Bullis, Jr.\",Harvey,R,Proceedings: Colloquium on Snapper-Grouper Fishery Resources of the Western Central Atlantic Ocean,1976,17,86,94,NA,Florida Sea Grant College Program,St. Petersberg,FL,US,NA,NA,NA,NA,NA,English,NA,NA,NA,06/11/2013,Theresa Mitchell,29/01/2014,Theresa Mitchell,15/06/2016,Theresa Mitchell\n" + "ACT_18B,ACT_18B,pred/prey,3178,GR,NA,\"Beaumariage and Bullock, 1976\",Beaumariage,NA,D,S,1976,Biological Research on Snappers and Groupers as Related to Fishery Management Requirements,Jones,Albert,C,Proceedings: Colloquium on Snapper-Grouper Fishery Resources of the Western Central Atlantic Ocean,1976,17,86,94,NA,Florida Sea Grant College Program,St. Petersberg,FL,US,NA,NA,NA,NA,NA,English,NA,NA,NA,06/11/2013,Theresa Mitchell,29/01/2014,Theresa Mitchell,15/06/2016,Theresa Mitchell\n"; Map<String, String> contributorMap = DatasetImporterForGoMexSI2.collectContributors(URI.create("test.txt"), CSVTSVUtil.createLabeledCSVParser(CSVTSVUtil.createExcelCSVParse(new StringReader(someReferences)))); assertThat(contributorMap.get("ACT_5A"), is("A Adams, W Kendall")); assertThat(contributorMap.get("ACT_14A"), is("Adlemy Alarcon Sosa")); assertThat(contributorMap.get("ACT_2B"), is("H Bailey")); assertThat(contributorMap.get("ACT_14B"), is("J Baughman")); assertThat(contributorMap.get("ACT_16B"), is("J Baughman, Stewart Springer")); assertThat(contributorMap.get("ACT_17B"), is("Dale Beaumariage")); assertThat(contributorMap.get("ACT_18B"), is("D Beaumariage, D Beaumariage")); }
protected static Map<String, String> collectContributors(URI referenceResource, LabeledCSVParser parser) throws IOException, StudyImporterException { Map<String, String> studyContributorMap = new HashMap<String, String>(); while (parser.getLine() != null) { String refId = getMandatoryValue(referenceResource, parser, "DATA_ID"); String lastName = getMandatoryValue(referenceResource, parser, "AUTH_L_NAME"); String firstName = getMandatoryValue(referenceResource, parser, "AUTH_F_NAME"); String contributors = studyContributorMap.get(refId); studyContributorMap.put(refId, updateContributorList(lastName, firstName, contributors == null ? "" : contributors)); } return studyContributorMap; }
DatasetImporterForGoMexSI2 extends NodeBasedImporter { protected static Map<String, String> collectContributors(URI referenceResource, LabeledCSVParser parser) throws IOException, StudyImporterException { Map<String, String> studyContributorMap = new HashMap<String, String>(); while (parser.getLine() != null) { String refId = getMandatoryValue(referenceResource, parser, "DATA_ID"); String lastName = getMandatoryValue(referenceResource, parser, "AUTH_L_NAME"); String firstName = getMandatoryValue(referenceResource, parser, "AUTH_F_NAME"); String contributors = studyContributorMap.get(refId); studyContributorMap.put(refId, updateContributorList(lastName, firstName, contributors == null ? "" : contributors)); } return studyContributorMap; } }
DatasetImporterForGoMexSI2 extends NodeBasedImporter { protected static Map<String, String> collectContributors(URI referenceResource, LabeledCSVParser parser) throws IOException, StudyImporterException { Map<String, String> studyContributorMap = new HashMap<String, String>(); while (parser.getLine() != null) { String refId = getMandatoryValue(referenceResource, parser, "DATA_ID"); String lastName = getMandatoryValue(referenceResource, parser, "AUTH_L_NAME"); String firstName = getMandatoryValue(referenceResource, parser, "AUTH_F_NAME"); String contributors = studyContributorMap.get(refId); studyContributorMap.put(refId, updateContributorList(lastName, firstName, contributors == null ? "" : contributors)); } return studyContributorMap; } DatasetImporterForGoMexSI2(ParserFactory parserFactory, NodeFactory nodeFactory); }
DatasetImporterForGoMexSI2 extends NodeBasedImporter { protected static Map<String, String> collectContributors(URI referenceResource, LabeledCSVParser parser) throws IOException, StudyImporterException { Map<String, String> studyContributorMap = new HashMap<String, String>(); while (parser.getLine() != null) { String refId = getMandatoryValue(referenceResource, parser, "DATA_ID"); String lastName = getMandatoryValue(referenceResource, parser, "AUTH_L_NAME"); String firstName = getMandatoryValue(referenceResource, parser, "AUTH_F_NAME"); String contributors = studyContributorMap.get(refId); studyContributorMap.put(refId, updateContributorList(lastName, firstName, contributors == null ? "" : contributors)); } return studyContributorMap; } DatasetImporterForGoMexSI2(ParserFactory parserFactory, NodeFactory nodeFactory); @Override void importStudy(); }
DatasetImporterForGoMexSI2 extends NodeBasedImporter { protected static Map<String, String> collectContributors(URI referenceResource, LabeledCSVParser parser) throws IOException, StudyImporterException { Map<String, String> studyContributorMap = new HashMap<String, String>(); while (parser.getLine() != null) { String refId = getMandatoryValue(referenceResource, parser, "DATA_ID"); String lastName = getMandatoryValue(referenceResource, parser, "AUTH_L_NAME"); String firstName = getMandatoryValue(referenceResource, parser, "AUTH_F_NAME"); String contributors = studyContributorMap.get(refId); studyContributorMap.put(refId, updateContributorList(lastName, firstName, contributors == null ? "" : contributors)); } return studyContributorMap; } DatasetImporterForGoMexSI2(ParserFactory parserFactory, NodeFactory nodeFactory); @Override void importStudy(); static final String GOMEXI_SOURCE_DESCRIPTION; static final String STOMACH_COUNT_TOTAL; static final String STOMACH_COUNT_WITH_FOOD; static final String STOMACH_COUNT_WITHOUT_FOOD; static final String GOMEXSI_NAMESPACE; }