use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImporterForRSSTest method readRSS.
@Test
public void readRSS() throws StudyImporterException, IOException {
final Dataset dataset = getDatasetGroup();
List<Dataset> datasets = DatasetImporterForRSS.getDatasetsForFeed(dataset);
assertThat(datasets.size(), is(3));
assertThat(datasets.get(0).getOrDefault("hasDependencies", null), is("false"));
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImporterForRSSTest method readFieldMuseum.
@Test
public void readFieldMuseum() throws StudyImporterException, IOException {
String configJson = "{ \"url\": \"classpath:/org/eol/globi/data/rss_fieldmuseum.xml\" }";
final Dataset dataset = datasetFor(configJson);
List<Dataset> datasets = DatasetImporterForRSS.getDatasetsForFeed(dataset);
assertThat(datasets.size(), is(14));
assertThat(datasets.get(0).getOrDefault("hasDependencies", null), is("false"));
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImporterForRSSTest method titleIncludePatternOnly.
@Test
public void titleIncludePatternOnly() throws StudyImporterException, IOException {
String configJson = "{ \"url\": \"classpath:/org/eol/globi/data/rss_vertnet.xml\", " + "\"include\": \".*(Arctos).*\", " + "\"hasDependencies\": true }";
final Dataset dataset = datasetFor(configJson);
assertTrue(DatasetImporterForRSS.shouldIncludeTitleInDatasetCollection("bla (Arctos) GGBN", dataset));
assertTrue(DatasetImporterForRSS.shouldIncludeTitleInDatasetCollection("bla (Arctos)", dataset));
assertFalse(DatasetImporterForRSS.shouldIncludeTitleInDatasetCollection("bla", dataset));
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImporterForRSSTest method embeddedDatasetWithConfig.
@Test
public void embeddedDatasetWithConfig() throws IOException {
Dataset embeddedDataset = embeddedDatasetFor(getDatasetGroupWithProperty(), URI.create("http://example.com/archive.zip"));
assertThat(embeddedDataset.getCitation(), is("some other citation"));
assertThat(embeddedDataset.getOrDefault(DatasetConstant.SHOULD_RESOLVE_REFERENCES, "true"), is("false"));
assertThat(embeddedDataset.getArchiveURI().toString(), is("http://example.com/archive.zip"));
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImporterForTSVTest method withGenus.
@Test
public void withGenus() throws StudyImporterException {
String firstFewLines = "sourceTaxonFamily\tsourceTaxonGenus\tinteractionTypeId\ttargetTaxonName\n" + "Bacillaceae\tBacillus\tRO:0002454\tMorus alba\n";
Dataset dataset = getDataset(new TreeMap<URI, String>() {
{
put(URI.create("/interactions.tsv"), firstFewLines);
}
});
DatasetImporterForTSV importer = new DatasetImporterForTSV(null, nodeFactory);
importer.setDataset(dataset);
importStudy(importer);
Taxon taxon = taxonIndex.findTaxonByName("Bacillus");
assertThat(taxon, is(notNullValue()));
assertThat(taxon.getName(), is("Bacillus"));
assertThat(taxon.getPath(), is("Bacillaceae | Bacillus"));
assertThat(taxon.getPathNames(), is("family | genus"));
final List<StudyNode> allStudies = NodeUtil.findAllStudies(getGraphDb());
}
Aggregations