@Test public void generateReferenceAndReferenceId() { final HashMap<String, String> properties = new HashMap<String, String>() { { put(DatasetImporterForMetaTable.AUTHOR, "Johnny"); put(DatasetImporterForMetaTable.TITLE, "My first pony"); put(DatasetImporterForMetaTable.YEAR, "1981"); put(DatasetImporterForMetaTable.JOURNAL, "journal of bla"); } }; assertThat(DatasetImporterForMetaTable.generateReferenceCitation(properties), is("Johnny, 1981. My first pony. journal of bla.")); properties.put(DatasetImporterForMetaTable.VOLUME, "123"); assertThat(DatasetImporterForMetaTable.generateReferenceCitation(properties), is("Johnny, 1981. My first pony. journal of bla, 123.")); properties.put(DatasetImporterForMetaTable.NUMBER, "11"); assertThat(DatasetImporterForMetaTable.generateReferenceCitation(properties), is("Johnny, 1981. My first pony. journal of bla, 123(11).")); properties.put(DatasetImporterForMetaTable.PAGES, "33"); assertThat(DatasetImporterForMetaTable.generateReferenceCitation(properties), is("Johnny, 1981. My first pony. journal of bla, 123(11), pp.33.")); }
static String generateReferenceCitation(Map<String, String> properties) { StringBuilder citation = new StringBuilder(); append(citation, properties.get(AUTHOR), ", "); append(citation, properties.get(YEAR), ". "); append(citation, properties.get(TITLE), ". "); append(citation, properties.get(JOURNAL), properties.containsKey(VOLUME) || properties.containsKey(NUMBER) || properties.containsKey(PAGES) ? ", " : ". "); append(citation, properties.get(VOLUME), properties.containsKey(NUMBER) ? "(" : (properties.containsKey(PAGES) ? ", " : ". ")); append(citation, properties.get(NUMBER), properties.containsKey(VOLUME) ? ")" : ""); if (properties.containsKey(NUMBER)) { citation.append(properties.containsKey(PAGES) ? ", " : "."); } append(citation, properties.get(PAGES), ". ", "pp."); return StringUtils.trim(citation.toString()); }
DatasetImporterForMetaTable extends DatasetImporterWithListener { static String generateReferenceCitation(Map<String, String> properties) { StringBuilder citation = new StringBuilder(); append(citation, properties.get(AUTHOR), ", "); append(citation, properties.get(YEAR), ". "); append(citation, properties.get(TITLE), ". "); append(citation, properties.get(JOURNAL), properties.containsKey(VOLUME) || properties.containsKey(NUMBER) || properties.containsKey(PAGES) ? ", " : ". "); append(citation, properties.get(VOLUME), properties.containsKey(NUMBER) ? "(" : (properties.containsKey(PAGES) ? ", " : ". ")); append(citation, properties.get(NUMBER), properties.containsKey(VOLUME) ? ")" : ""); if (properties.containsKey(NUMBER)) { citation.append(properties.containsKey(PAGES) ? ", " : "."); } append(citation, properties.get(PAGES), ". ", "pp."); return StringUtils.trim(citation.toString()); } }
DatasetImporterForMetaTable extends DatasetImporterWithListener { static String generateReferenceCitation(Map<String, String> properties) { StringBuilder citation = new StringBuilder(); append(citation, properties.get(AUTHOR), ", "); append(citation, properties.get(YEAR), ". "); append(citation, properties.get(TITLE), ". "); append(citation, properties.get(JOURNAL), properties.containsKey(VOLUME) || properties.containsKey(NUMBER) || properties.containsKey(PAGES) ? ", " : ". "); append(citation, properties.get(VOLUME), properties.containsKey(NUMBER) ? "(" : (properties.containsKey(PAGES) ? ", " : ". ")); append(citation, properties.get(NUMBER), properties.containsKey(VOLUME) ? ")" : ""); if (properties.containsKey(NUMBER)) { citation.append(properties.containsKey(PAGES) ? ", " : "."); } append(citation, properties.get(PAGES), ". ", "pp."); return StringUtils.trim(citation.toString()); } DatasetImporterForMetaTable(ParserFactory parserFactory, NodeFactory nodeFactory); }
DatasetImporterForMetaTable extends DatasetImporterWithListener { static String generateReferenceCitation(Map<String, String> properties) { StringBuilder citation = new StringBuilder(); append(citation, properties.get(AUTHOR), ", "); append(citation, properties.get(YEAR), ". "); append(citation, properties.get(TITLE), ". "); append(citation, properties.get(JOURNAL), properties.containsKey(VOLUME) || properties.containsKey(NUMBER) || properties.containsKey(PAGES) ? ", " : ". "); append(citation, properties.get(VOLUME), properties.containsKey(NUMBER) ? "(" : (properties.containsKey(PAGES) ? ", " : ". ")); append(citation, properties.get(NUMBER), properties.containsKey(VOLUME) ? ")" : ""); if (properties.containsKey(NUMBER)) { citation.append(properties.containsKey(PAGES) ? ", " : "."); } append(citation, properties.get(PAGES), ". ", "pp."); return StringUtils.trim(citation.toString()); } DatasetImporterForMetaTable(ParserFactory parserFactory, NodeFactory nodeFactory); @Override void importStudy(); static void append(StringBuilder citation, String value, String suffix, String prefix); static void append(StringBuilder citation, String value, String continuation); static InteractType generateInteractionType(Map<String, String> properties, InteractTypeMapper mapper); JsonNode getConfig(); String getBaseUrl(); static void importAll(InteractionListener interactionListener,
                                 List<Column> columnNames,
                                 CSVParse csvParse, JsonNode config, ImportLogger importLogger); static void parseColumnValue(ImportLogger importLogger, Map<String, String> mappedLine, String value, Column column); static void logParseWarning(ImportLogger importLogger, Map<String, String> mappedLine, String value, Column column); static String valueOrDefault(String value, Column column); static void setInteractionType(Map<String, String> properties, InteractType type); static String parseValue(String value, Column column); void setDataset(Dataset dataset); Dataset getDataset(); static List<Column> columnNamesForMetaTable(JsonNode config); static List<Column> columnNamesForSchema(JsonNode tableSchema); static Column createStringColumn(JsonNode columnName); }
DatasetImporterForMetaTable extends DatasetImporterWithListener { static String generateReferenceCitation(Map<String, String> properties) { StringBuilder citation = new StringBuilder(); append(citation, properties.get(AUTHOR), ", "); append(citation, properties.get(YEAR), ". "); append(citation, properties.get(TITLE), ". "); append(citation, properties.get(JOURNAL), properties.containsKey(VOLUME) || properties.containsKey(NUMBER) || properties.containsKey(PAGES) ? ", " : ". "); append(citation, properties.get(VOLUME), properties.containsKey(NUMBER) ? "(" : (properties.containsKey(PAGES) ? ", " : ". ")); append(citation, properties.get(NUMBER), properties.containsKey(VOLUME) ? ")" : ""); if (properties.containsKey(NUMBER)) { citation.append(properties.containsKey(PAGES) ? ", " : "."); } append(citation, properties.get(PAGES), ". ", "pp."); return StringUtils.trim(citation.toString()); } DatasetImporterForMetaTable(ParserFactory parserFactory, NodeFactory nodeFactory); @Override void importStudy(); static void append(StringBuilder citation, String value, String suffix, String prefix); static void append(StringBuilder citation, String value, String continuation); static InteractType generateInteractionType(Map<String, String> properties, InteractTypeMapper mapper); JsonNode getConfig(); String getBaseUrl(); static void importAll(InteractionListener interactionListener,
                                 List<Column> columnNames,
                                 CSVParse csvParse, JsonNode config, ImportLogger importLogger); static void parseColumnValue(ImportLogger importLogger, Map<String, String> mappedLine, String value, Column column); static void logParseWarning(ImportLogger importLogger, Map<String, String> mappedLine, String value, Column column); static String valueOrDefault(String value, Column column); static void setInteractionType(Map<String, String> properties, InteractType type); static String parseValue(String value, Column column); void setDataset(Dataset dataset); Dataset getDataset(); static List<Column> columnNamesForMetaTable(JsonNode config); static List<Column> columnNamesForSchema(JsonNode tableSchema); static Column createStringColumn(JsonNode columnName); static final String AUTHOR; static final String TITLE; static final String YEAR; static final String JOURNAL; static final String VOLUME; static final String NUMBER; static final String PAGES; static final String LONGITUDE; static final String LATITUDE; static final String EVENT_DATE; }