use of org.eol.globi.service.DatasetImpl in project eol-globi-data by jhpoelen.
the class StudyImporterForHurlbertTest method doImport.
public StudyImporter doImport(final String namespace) throws StudyImporterException {
StudyImporter importer = new StudyImporterForHurlbert(null, nodeFactory);
Dataset dataset = new DatasetImpl(namespace, URI.create("some:uri")) {
@Override
public InputStream getResource(String name) {
return StudyImporterForHurlbertTest.getResource();
}
};
importer.setDataset(dataset);
importStudy(importer);
return importer;
}
use of org.eol.globi.service.DatasetImpl in project eol-globi-data by jhpoelen.
the class StudyImporterForJSONLDTest method importStatic.
@Test
public void importStatic() throws StudyImporterException, URISyntaxException {
StudyImporter importer = new StudyImporterForJSONLD(null, nodeFactory);
DatasetImpl dataset = new DatasetImpl("some/namespace", URI.create("http://example.com"));
dataset.setConfigURI(URI.create("classpath:/org/eol/globi/data/globi-jsonld/globi-dataset.jsonld"));
importer.setDataset(dataset);
importStudy(importer);
List<Study> allStudies = NodeUtil.findAllStudies(getGraphDb());
for (Study study : allStudies) {
assertThat(study.getExternalId(), is("http://arctos.database.museum/guid/CUMV:Bird:25225"));
assertThat(study.getCitation(), is("http://arctos.database.museum/guid/CUMV:Bird:25225"));
assertThat(study.getSource(), startsWith("Christopher Mungall. 2015. Accessed at <classpath:/org/eol/globi/data/globi-jsonld/globi-dataset.jsonld> on "));
}
assertThat(taxonIndex.findTaxonById("NCBI:8782"), not(is(nullValue())));
}
use of org.eol.globi.service.DatasetImpl in project eol-globi-data by jhpoelen.
the class StudyImporterForGoMexSI2IT method importWithCommit.
protected StudyImporterForGoMexSI2 importWithCommit(String baseUrlLastCommit) throws StudyImporterException, IOException {
StudyImporterForGoMexSI2 importer = new StudyImporterForGoMexSI2(new ParserFactoryLocal(), nodeFactory);
final List<String> msgs = new ArrayList<String>();
importer.setLogger(new ImportLogger() {
@Override
public void warn(LogContext study, String message) {
LOG.warn(message);
msgs.add("warn: " + message);
}
@Override
public void info(LogContext study, String message) {
LOG.info(message);
msgs.add("info: " + message);
}
@Override
public void severe(LogContext study, String message) {
LOG.error(message);
msgs.add("severe: " + message);
}
});
JsonNode config = new ObjectMapper().readTree("{ \n" + " \"citation\": \"testing source citation\",\n" + " \"format\": \"gomexsi\"\n" + "}");
DatasetImpl dataset = new DatasetImpl("some/namespace", URI.create(baseUrlLastCommit));
importer.setDataset(dataset);
dataset.setConfig(config);
importStudy(importer);
return importer;
}
use of org.eol.globi.service.DatasetImpl in project eol-globi-data by jhpoelen.
the class ExportFlatInteractionsTest method init.
@Before
public void init() throws IOException {
super.startGraphDb();
DatasetImpl dataset = new DatasetImpl("some/namespace", URI.create("http://example.com"));
factory = new NodeFactoryWithDatasetContext(nodeFactory, dataset);
}
use of org.eol.globi.service.DatasetImpl in project eol-globi-data by jhpoelen.
the class LinkerDOITest method createStudyDOIlookupCitationEnabled.
@Test
public void createStudyDOIlookupCitationEnabled() throws NodeFactoryException {
StudyImpl title = new StudyImpl("title", "some source", null, "some citation");
DatasetImpl originatingDataset = new DatasetImpl("some/namespace", URI.create("some:uri"));
ObjectNode objectNode = new ObjectMapper().createObjectNode();
objectNode.put(DatasetConstant.SHOULD_RESOLVE_REFERENCES, true);
originatingDataset.setConfig(objectNode);
title.setOriginatingDataset(originatingDataset);
StudyNode study = getNodeFactory().getOrCreateStudy(title);
new LinkerDOI(getGraphDb()).linkStudy(new TestDOIResolver(), study);
assertThat(study.getSource(), is("some source"));
assertThat(study.getDOI(), is("doi:some citation"));
assertThat(study.getCitation(), is("some citation"));
assertThat(study.getTitle(), is("title"));
}
Aggregations