@Test public void mapReferencesInfoValidURIButInvalidURL() { DummyRecord dummyRecord = new DummyRecord(new HashMap<Term, String>() {{ put(DwcTerm.occurrenceID, "something"); }}); TreeMap<String, String> properties = new TreeMap<>(); mapReferenceInfo(dummyRecord, properties); assertThat(properties.get(REFERENCE_CITATION), is("something")); assertThat(properties.get(REFERENCE_ID), is("something")); assertThat(properties.get(REFERENCE_URL), is(nullValue())); }
static void mapReferenceInfo(Record rec, Map<String, String> interactionProperties) { String value = StringUtils.trim(rec.value(DcTerm.references)); if (StringUtils.isBlank(value)) { value = StringUtils.trim(rec.value(DwcTerm.occurrenceID)); } if (StringUtils.isNotBlank(value)) { interactionProperties.put(REFERENCE_CITATION, value); interactionProperties.put(REFERENCE_ID, value); try { URI referenceURI = new URI(value); URL url = referenceURI.toURL(); interactionProperties.put(REFERENCE_URL, url.toString()); } catch (MalformedURLException | URISyntaxException | IllegalArgumentException e) { } } }
DatasetImporterForDwCA extends DatasetImporterWithListener { static void mapReferenceInfo(Record rec, Map<String, String> interactionProperties) { String value = StringUtils.trim(rec.value(DcTerm.references)); if (StringUtils.isBlank(value)) { value = StringUtils.trim(rec.value(DwcTerm.occurrenceID)); } if (StringUtils.isNotBlank(value)) { interactionProperties.put(REFERENCE_CITATION, value); interactionProperties.put(REFERENCE_ID, value); try { URI referenceURI = new URI(value); URL url = referenceURI.toURL(); interactionProperties.put(REFERENCE_URL, url.toString()); } catch (MalformedURLException | URISyntaxException | IllegalArgumentException e) { } } } }
DatasetImporterForDwCA extends DatasetImporterWithListener { static void mapReferenceInfo(Record rec, Map<String, String> interactionProperties) { String value = StringUtils.trim(rec.value(DcTerm.references)); if (StringUtils.isBlank(value)) { value = StringUtils.trim(rec.value(DwcTerm.occurrenceID)); } if (StringUtils.isNotBlank(value)) { interactionProperties.put(REFERENCE_CITATION, value); interactionProperties.put(REFERENCE_ID, value); try { URI referenceURI = new URI(value); URL url = referenceURI.toURL(); interactionProperties.put(REFERENCE_URL, url.toString()); } catch (MalformedURLException | URISyntaxException | IllegalArgumentException e) { } } } DatasetImporterForDwCA(ParserFactory parserFactory, NodeFactory nodeFactory); }
DatasetImporterForDwCA extends DatasetImporterWithListener { static void mapReferenceInfo(Record rec, Map<String, String> interactionProperties) { String value = StringUtils.trim(rec.value(DcTerm.references)); if (StringUtils.isBlank(value)) { value = StringUtils.trim(rec.value(DwcTerm.occurrenceID)); } if (StringUtils.isNotBlank(value)) { interactionProperties.put(REFERENCE_CITATION, value); interactionProperties.put(REFERENCE_ID, value); try { URI referenceURI = new URI(value); URL url = referenceURI.toURL(); interactionProperties.put(REFERENCE_URL, url.toString()); } catch (MalformedURLException | URISyntaxException | IllegalArgumentException e) { } } } DatasetImporterForDwCA(ParserFactory parserFactory, NodeFactory nodeFactory); @Override void importStudy(); int importCore(Archive archive, InteractionListener interactionListener); void handleRecord(InteractionListener interactionListener, Record rec); static void addRoyalSaskatchewanMuseumOwlPelletCollectionStyleRemarks(List<Map<String, String>> interactionCandidates, String occurrenceRemarks); static Map<String, String> parseRoyalSaskatchewanMuseumOwlPelletCollectionStyleRemarks(String occurrenceRemarks); void addUSNMStyleHostOccurrenceRemarks(List<Map<String, String>> interactionCandidates, String occurrenceRemarks); static void mapCoreProperties(Record rec, Map<String, String> interactionProperties); static void mapLocationAndReferenceInfo(Record rec, Map<String, String> interactionProperties); static void mapSourceProperties(Record rec, Map<String, String> interactionProperties); static void mapIfAvailable(Record rec, Map<String, String> interactionProperties, String key, Term term); static void mapIfAvailable(Map<String, String> interactionProperties, String key, String value); static Map<String, String> parseUSNMStyleHostOccurrenceRemarks(String occurrenceRemarks); static Map<String, String> parseJsonChunk(String candidateJsonChunk); }
DatasetImporterForDwCA extends DatasetImporterWithListener { static void mapReferenceInfo(Record rec, Map<String, String> interactionProperties) { String value = StringUtils.trim(rec.value(DcTerm.references)); if (StringUtils.isBlank(value)) { value = StringUtils.trim(rec.value(DwcTerm.occurrenceID)); } if (StringUtils.isNotBlank(value)) { interactionProperties.put(REFERENCE_CITATION, value); interactionProperties.put(REFERENCE_ID, value); try { URI referenceURI = new URI(value); URL url = referenceURI.toURL(); interactionProperties.put(REFERENCE_URL, url.toString()); } catch (MalformedURLException | URISyntaxException | IllegalArgumentException e) { } } } DatasetImporterForDwCA(ParserFactory parserFactory, NodeFactory nodeFactory); @Override void importStudy(); int importCore(Archive archive, InteractionListener interactionListener); void handleRecord(InteractionListener interactionListener, Record rec); static void addRoyalSaskatchewanMuseumOwlPelletCollectionStyleRemarks(List<Map<String, String>> interactionCandidates, String occurrenceRemarks); static Map<String, String> parseRoyalSaskatchewanMuseumOwlPelletCollectionStyleRemarks(String occurrenceRemarks); void addUSNMStyleHostOccurrenceRemarks(List<Map<String, String>> interactionCandidates, String occurrenceRemarks); static void mapCoreProperties(Record rec, Map<String, String> interactionProperties); static void mapLocationAndReferenceInfo(Record rec, Map<String, String> interactionProperties); static void mapSourceProperties(Record rec, Map<String, String> interactionProperties); static void mapIfAvailable(Record rec, Map<String, String> interactionProperties, String key, Term term); static void mapIfAvailable(Map<String, String> interactionProperties, String key, String value); static Map<String, String> parseUSNMStyleHostOccurrenceRemarks(String occurrenceRemarks); static Map<String, String> parseJsonChunk(String candidateJsonChunk); static final String EXTENSION_ASSOCIATED_TAXA; static final String EXTENSION_RESOURCE_RELATIONSHIP; static final String EXTENSION_TAXON; static final Pattern EX_NOTATION; static final Pattern REARED_EX_NOTATION; static final Pattern PATTERN_ASSOCIATED_TAXA_IDEA; static final Pattern PATTERN_ASSOCIATED_TAXA_EAE; }