use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.
the class ExporterSiteMapForCitationsTest method writeSiteMapWithCitations.
@Test
public void writeSiteMapWithCitations() throws StudyImporterException, IOException {
final Study study = nodeFactory.getOrCreateStudy(new StudyImpl("title", new DOI("some", "doi"), "citation123&bla"));
assertThat(study.getExternalId(), is("https://doi.org/10.some/doi"));
final File baseDirCitations = createBaseDir("target/sitemap/citations");
final GraphExporter siteMapForCitationsExporter = new ExporterSiteMapForCitations();
siteMapForCitationsExporter.export(getGraphDb(), baseDirCitations);
final String substring = "http://www.globalbioticinteractions.org/?accordingTo=" + "https://doi.org/10.some/doi";
assertSiteMap(baseDirCitations, substring, "https://depot.globalbioticinteractions.org/snapshot/target/data/sitemap/citations/sitemap.xml.gz");
}
use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.
the class NodeFactoryNeo4jTest method createStudy.
@Test
public void createStudy() throws NodeFactoryException {
StudyNode study = getNodeFactory().getOrCreateStudy(new StudyImpl("myTitle", new DOI("myDoi", "123"), null));
assertThat(study.getDOI().toString(), is("10.myDoi/123"));
assertThat(study.getExternalId(), is("https://doi.org/10.myDoi/123"));
}
use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.
the class NodeFactoryNeo4jTest method createStudyWithDifferentExternalIdInDifferentNamespace.
@Test
public void createStudyWithDifferentExternalIdInDifferentNamespace() throws NodeFactoryException {
StudyImpl study1 = new StudyImpl("myTitle", new DOI("myDoi", "123"), null);
study1.setOriginatingDataset(new DatasetImpl("name/space", URI.create("foo:bar"), is -> is));
study1.setExternalId("foo:bar");
StudyNode study1Created = getNodeFactory().getOrCreateStudy(study1);
StudyImpl study2 = new StudyImpl("myTitle", new DOI("myDoi", "123"), null);
study2.setOriginatingDataset(new DatasetImpl("name/spacz", URI.create("foo:bar"), is -> is));
study2.setExternalId("foo:baz");
StudyNode study2Created = getNodeFactory().getOrCreateStudy(study2);
assertThat(study1Created.getExternalId(), is("foo:bar"));
assertThat(study1Created.getOriginatingDataset().getNamespace(), is("name/space"));
assertThat(study2Created.getExternalId(), is("foo:baz"));
assertThat(study2Created.getOriginatingDataset().getNamespace(), is("name/spacz"));
}
use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.
the class NodeFactoryIT method createStudy.
@Test
public void createStudy() throws NodeFactoryException {
Study study = nodeFactory.getOrCreateStudy(new StudyImpl("bla", new DOI("1111", "j.1469-7998.1966.tb02907.x"), ExternalIdUtil.toCitation(null, "descr", null)));
assertThat(study.getDOI().toURI().toString(), is("https://doi.org/10.1111/j.1469-7998.1966.tb02907.x"));
assertThat(study.getCitation(), is("descr"));
}
use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.
the class ExportCitationsTest method exportCitations.
@Test
public void exportCitations() throws IOException, NodeFactoryException {
StringWriter writer = new StringWriter();
getNodeFactory().getOrCreateStudy(new StudyImpl("some title", new DOI("some", "doi"), "some citation"));
getNodeFactory().getOrCreateStudy(new StudyImpl("some other title", new DOI("some", "otherdoi"), "some other citation"));
ExportUtil.export(ExportUtil.AppenderWriter.of(writer), getGraphDb(), ExportCitations.CYPHER_QUERY);
assertThat(writer.toString(), Is.is("doi\tcitation" + "\n10.some/doi\tsome citation" + "\n10.some/otherdoi\tsome other citation\n"));
}
Aggregations