use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImplTest method useCitationFromMultipleTableDefinitionsWithDifferentCitations.
@Test
public void useCitationFromMultipleTableDefinitionsWithDifferentCitations() throws IOException {
Dataset dataset = new DatasetImpl("some/namespace", URI.create("some:uri"), inStream -> inStream);
dataset.setConfig(new ObjectMapper().readTree(getClass().getResourceAsStream("/org/eol/globi/data/test-meta-globi-default-external-schemas-different-citations.json")));
assertThat(dataset.getCitation(), is("a citation; other citation"));
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImplTest method doiScrubbing.
@Test
public void doiScrubbing() throws IOException {
Dataset dataset = new DatasetImpl("some/namespace", URI.create("some:uri"), inStream -> inStream);
dataset.setConfig(new ObjectMapper().readTree("{\"doi\": \"doi:http://dx.doi.org/10.2980/1195-6860(2006)13[23:TDOFUB]2.0.CO;2\" }"));
assertThat(dataset.getDOI(), is(new DOI("2980", "1195-6860(2006)13[23:TDOFUB]2.0.CO;2")));
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImplTest method useCitationFromMultipleTableDefinitions.
@Test
public void useCitationFromMultipleTableDefinitions() throws IOException {
Dataset dataset = new DatasetImpl("some/namespace", URI.create("some:uri"), inStream -> inStream);
dataset.setConfig(new ObjectMapper().readTree(getClass().getResourceAsStream("/org/eol/globi/data/test-meta-globi-default-external-schemas.json")));
assertThat(dataset.getCitation(), is("Seltzer, Carrie; Wysocki, William; Palacios, Melissa; Eickhoff, Anna; Pilla, Hannah; Aungst, Jordan; Mercer, Aaron; Quicho, Jamie; Voss, Neil; Xu, Man; J. Ndangalasi, Henry; C. Lovett, Jon; J. Cordeiro, Norbert (2015): Plant-animal interactions from Africa. figshare. https://dx.doi.org/10.6084/m9.figshare.1526128"));
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImportUtilTest method listDependencies.
@Test
public void listDependencies() throws StudyImporterException, IOException {
String jsonConfig = "{" + " \"format\": \"dwca\", " + " \"citation\": \"The MSB Division of Parasitology Collection\"," + " \"url\": \"http://ipt.vertnet.org:8080/ipt/archive.do?r=msb_para\"," + " \"references\": [" + " {" + " \"format\": \"dwca\"," + " \"url\": \"http://ipt.vertnet.org:8080/ipt/archive.do?r=msb_host\"," + " \"citation\": \"The MSB Division of Host Collection\"" + " }, {" + " \"format\": \"dwca\"," + " \"url\": \"http://ipt.vertnet.org:8080/ipt/archive.do?r=msb_host2\"," + " \"citation\": \"The MSB Division of Host Collection2\"" + " }]" + "}";
final DatasetImpl datasetOrig = new DatasetImpl("name/space", URI.create("some:uri"), in -> in);
JsonNode objectNode = new ObjectMapper().readTree(jsonConfig);
datasetOrig.setConfig(objectNode);
final List<Dataset> references = getReferences(datasetOrig);
assertThat(references.size(), Is.is(2));
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImportUtilTest method getReferences.
public static List<Dataset> getReferences(Dataset dataset) {
List<Dataset> referenceList = new ArrayList<>();
final JsonNode config = dataset.getConfig();
final JsonNode references = config.get("references");
if (references != null && references.isArray()) {
for (JsonNode reference : references) {
final DatasetProxy datasetProxy = new DatasetProxy(dataset);
datasetProxy.setConfig(reference);
referenceList.add(datasetProxy);
}
}
return referenceList;
}
Aggregations