use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.
the class DOIResolverCacheTest method initCacheTwice.
@Test
public void initCacheTwice() throws IOException, PropertyEnricherException {
String bla = "doi\tcitation" + "\ndoi:10.some/doi\tsome citation" + "\ndoi:10.some/other/doi\tsome other citation";
Reader reader = new StringReader(bla);
doiResolverCache.init(reader);
doiResolverCache.init(reader);
Map<String, DOI> doiForReference = doiResolverCache.resolveDoiFor(Arrays.asList("some citation", "some other citation"));
assertThat(doiForReference.get("some other citation").toString(), is("10.some/other/doi"));
assertThat(doiForReference.get("some citation").toString(), is("10.some/doi"));
}
use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.
the class DOIResolverCacheTest method initCacheNoTabs.
@Test
public void initCacheNoTabs() throws IOException, PropertyEnricherException {
String bla = "doi citation\n" + "10.some/A citationA\n" + "10.some/B citationB";
Reader reader = new StringReader(bla);
doiResolverCache.init(reader);
Map<String, DOI> doiForReference = doiResolverCache.resolveDoiFor(Collections.singletonList("citationA"));
assertThat(doiForReference.get("citationA"), is(not(new DOI("some", "A"))));
}
use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.
the class DOIResolverImplTest method extractDOIBelowMinScore.
@Test
public void extractDOIBelowMinScore() throws IOException, MalformedDOIException {
String response = IOUtils.toString(getClass().getResourceAsStream("crossRefReply.json"), StandardCharsets.UTF_8);
DOIResolverImpl doiResolver = new DOIResolverImpl();
doiResolver.setMinMatchScore(200);
DOI doi = doiResolver.extractDOI(response);
assertThat(doi, is(nullValue()));
}
use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.
the class GraphExporterImplTest method exportAll.
@Test
public void exportAll() throws StudyImporterException, IOException {
File tmpDir = folder.newFolder();
assertNotNull(tmpDir);
assertThat(tmpDir.list().length, is(0));
Study study = nodeFactory.getOrCreateStudy(new StudyImpl("a study", new DOI("12345", "123"), null));
Specimen human = nodeFactory.createSpecimen(study, new TaxonImpl("Homo sapiens", "NCBI:123"));
human.ate(nodeFactory.createSpecimen(study, new TaxonImpl("Canis familiaris", "BLA:444")));
resolveNames();
new GraphExporterImpl().export(getGraphDb(), tmpDir);
new GraphExporterInteractionsTSVImpl().export(getGraphDb(), tmpDir);
assertThat(tmpDir.list().length, is(8));
}
use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.
the class NodeFactoryNeo4jTest method createStudyWithSameExternalIdInDifferentNamespace.
@Test
public void createStudyWithSameExternalIdInDifferentNamespace() 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:bar");
StudyNode study2Created = getNodeFactory().getOrCreateStudy(study2);
assertThat(study1Created.getExternalId(), is("foo:bar"));
assertThat(study1Created.getOriginatingDataset().getNamespace(), is("name/space"));
assertThat(study2Created.getExternalId(), is("foo:bar"));
assertThat(study2Created.getOriginatingDataset().getNamespace(), is("name/spacz"));
}
Aggregations