Search in sources :

Example 6 with DOI

use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.

the class LinkerDOITest method shouldResolveStudy.

@Test
public void shouldResolveStudy() {
    StudyImpl study = new StudyImpl("some title", new DOI("some", "doi"), "some citation");
    assertFalse(LinkerDOI.shouldResolve(study));
}
Also used : StudyImpl(org.eol.globi.domain.StudyImpl) DOI(org.globalbioticinteractions.doi.DOI) Test(org.junit.Test)

Example 7 with DOI

use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.

the class DatasetImplTest method doiExpectedPrefix.

@Test
public void doiExpectedPrefix() throws IOException {
    Dataset dataset = new DatasetImpl("some/namespace", URI.create("some:uri"), inStream -> inStream);
    dataset.setConfig(new ObjectMapper().readTree("{\"doi\": \"doi: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")));
}
Also used : Dataset(org.globalbioticinteractions.dataset.Dataset) DatasetImpl(org.globalbioticinteractions.dataset.DatasetImpl) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) DOI(org.globalbioticinteractions.doi.DOI) Test(org.junit.Test)

Example 8 with DOI

use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.

the class DatasetImplTest method doiExpected.

@Test
public void doiExpected() throws IOException {
    Dataset dataset = new DatasetImpl("some/namespace", URI.create("some:uri"), inStream -> inStream);
    dataset.setConfig(new ObjectMapper().readTree("{\"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")));
}
Also used : Dataset(org.globalbioticinteractions.dataset.Dataset) DatasetImpl(org.globalbioticinteractions.dataset.DatasetImpl) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) DOI(org.globalbioticinteractions.doi.DOI) Test(org.junit.Test)

Example 9 with DOI

use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.

the class DOIResolverCacheTest method initCache.

@Test
public void initCache() 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);
    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"));
}
Also used : StringReader(java.io.StringReader) Reader(java.io.Reader) StringReader(java.io.StringReader) DOI(org.globalbioticinteractions.doi.DOI) Test(org.junit.Test)

Example 10 with DOI

use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.

the class DOIResolverCacheTest method initCache3.

@Test
public void initCache3() throws IOException, PropertyEnricherException {
    String bla = "doi\tcitation\n" + "10.some/A\tcitationA\n" + "\tcitationX\n" + "\t\n" + "10.some/B\tcitationB";
    Reader reader = new StringReader(bla);
    doiResolverCache.init(reader);
    Map<String, DOI> doiForReference = doiResolverCache.resolveDoiFor(Collections.singletonList("citationA"));
    assertThat(doiForReference.get("citationA"), is(new DOI("some", "A")));
}
Also used : StringReader(java.io.StringReader) Reader(java.io.Reader) StringReader(java.io.StringReader) DOI(org.globalbioticinteractions.doi.DOI) Test(org.junit.Test)

Aggregations

DOI (org.globalbioticinteractions.doi.DOI)74 Test (org.junit.Test)50 StudyImpl (org.eol.globi.domain.StudyImpl)28 IOException (java.io.IOException)15 Study (org.eol.globi.domain.Study)15 Specimen (org.eol.globi.domain.Specimen)13 StudyNode (org.eol.globi.domain.StudyNode)12 Matchers.containsString (org.hamcrest.Matchers.containsString)12 TaxonImpl (org.eol.globi.domain.TaxonImpl)11 URI (java.net.URI)10 LabeledCSVParser (com.Ostermiller.util.LabeledCSVParser)8 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)8 DatasetImpl (org.globalbioticinteractions.dataset.DatasetImpl)8 MalformedDOIException (org.globalbioticinteractions.doi.MalformedDOIException)8 Location (org.eol.globi.domain.Location)7 LocationImpl (org.eol.globi.domain.LocationImpl)7 ArrayList (java.util.ArrayList)6 Dataset (org.globalbioticinteractions.dataset.Dataset)6 Reader (java.io.Reader)5 StringReader (java.io.StringReader)5