Search in sources :

Example 1 with SparqlClient

use of org.globalbioticinteractions.util.SparqlClient in project eol-globi-data by jhpoelen.

the class DatasetImporterForPensoftIT method retrieveCitationById3.

@Test
public void retrieveCitationById3() throws IOException {
    final SparqlClient sparqlClientImpl = new OpenBiodivClientImpl(getResourceServiceTest());
    String citation = DatasetImporterForPensoft.findCitationById("http://openbiodiv.net/222C9E1B135454BEB7144BD7794FA01C", sparqlClientImpl);
    assertThat(citation, is("Marko Prous, Andrew Liston, Katja Kramp, Henri Savina, Hege Vårdal, Andreas Taeger. 2019. The West Palaearctic genera of Nematinae (Hymenoptera, Tenthredinidae). ZooKeys. https://doi.org/10.3897/zookeys.875.35748"));
}
Also used : SparqlClient(org.globalbioticinteractions.util.SparqlClient) OpenBiodivClientImpl(org.globalbioticinteractions.util.OpenBiodivClientImpl) Test(org.junit.Test) TestUtil.getResourceServiceTest(org.eol.globi.data.TestUtil.getResourceServiceTest)

Example 2 with SparqlClient

use of org.globalbioticinteractions.util.SparqlClient in project eol-globi-data by jhpoelen.

the class DatasetImporterForPensoftIT method retrieveCitation.

@Test
public void retrieveCitation() throws IOException {
    final SparqlClient sparqlClientImpl = new OpenBiodivClientImpl(getResourceServiceTest());
    String citation = DatasetImporterForPensoft.findCitationByDoi("10.3897/zookeys.306.5455", sparqlClientImpl);
    assertThat(citation, is("Dewi Sartiami, Laurence A. Mound. 2013. Identification of the terebrantian thrips (Insecta, Thysanoptera) associated with cultivated plants in Java, Indonesia. ZooKeys. https://doi.org/10.3897/zookeys.306.5455"));
}
Also used : SparqlClient(org.globalbioticinteractions.util.SparqlClient) OpenBiodivClientImpl(org.globalbioticinteractions.util.OpenBiodivClientImpl) Test(org.junit.Test) TestUtil.getResourceServiceTest(org.eol.globi.data.TestUtil.getResourceServiceTest)

Example 3 with SparqlClient

use of org.globalbioticinteractions.util.SparqlClient in project eol-globi-data by jhpoelen.

the class SparqlClientOpenBiodivFactoryTest method expectNonCaching.

@Test(expected = IOException.class)
public void expectNonCaching() throws IOException {
    final ResourceService resourceService = SparqlClientCachingFactoryTest.singleRequestResourceService();
    final SparqlClient openBiodivClient = new OpenBiodivClientImpl(resourceService);
    DatasetImporterForPensoft.findCitationByDoi("10.3897/zookeys.306.5455", openBiodivClient);
    try {
        DatasetImporterForPensoft.findCitationByDoi("10.3897/zookeys.306.5455", openBiodivClient);
    } catch (IOException ex) {
        assertThat(ex.getCause().getMessage(), is("should not ask twice"));
        throw ex;
    }
}
Also used : SparqlClient(org.globalbioticinteractions.util.SparqlClient) ResourceService(org.eol.globi.service.ResourceService) OpenBiodivClientImpl(org.globalbioticinteractions.util.OpenBiodivClientImpl) IOException(java.io.IOException) Test(org.junit.Test)

Example 4 with SparqlClient

use of org.globalbioticinteractions.util.SparqlClient in project eol-globi-data by jhpoelen.

the class DatasetImporterForPensoftIT method retrieveCitationById3ByDOI.

@Test
public void retrieveCitationById3ByDOI() throws IOException {
    final SparqlClient sparqlClientImpl = new OpenBiodivClientImpl(getResourceServiceTest());
    String citation = DatasetImporterForPensoft.findCitationByDoi("10.3897/zookeys.875.35748", sparqlClientImpl);
    assertThat(citation, is("Marko Prous, Andrew Liston, Katja Kramp, Henri Savina, Hege Vårdal, Andreas Taeger. 2019. The West Palaearctic genera of Nematinae (Hymenoptera, Tenthredinidae). ZooKeys. https://doi.org/10.3897/zookeys.875.35748"));
}
Also used : SparqlClient(org.globalbioticinteractions.util.SparqlClient) OpenBiodivClientImpl(org.globalbioticinteractions.util.OpenBiodivClientImpl) Test(org.junit.Test) TestUtil.getResourceServiceTest(org.eol.globi.data.TestUtil.getResourceServiceTest)

Example 5 with SparqlClient

use of org.globalbioticinteractions.util.SparqlClient in project eol-globi-data by jhpoelen.

the class DatasetImporterForPensoftIT method retrieveCitationById2.

@Test
public void retrieveCitationById2() throws IOException {
    final SparqlClient sparqlClientImpl = new OpenBiodivClientImpl(getResourceServiceTest());
    String citation = DatasetImporterForPensoft.findCitationById("http://openbiodiv.net/D37E8D1A-221B-FFA6-FFE7-4458FFA0FFC2", sparqlClientImpl);
    assertThat(citation, is("Dewi Sartiami, Laurence A. Mound. 2013. Identification of the terebrantian thrips (Insecta, Thysanoptera) associated with cultivated plants in Java, Indonesia. ZooKeys. https://doi.org/10.3897/zookeys.306.5455"));
}
Also used : SparqlClient(org.globalbioticinteractions.util.SparqlClient) OpenBiodivClientImpl(org.globalbioticinteractions.util.OpenBiodivClientImpl) Test(org.junit.Test) TestUtil.getResourceServiceTest(org.eol.globi.data.TestUtil.getResourceServiceTest)

Aggregations

SparqlClient (org.globalbioticinteractions.util.SparqlClient)8 Test (org.junit.Test)7 OpenBiodivClientImpl (org.globalbioticinteractions.util.OpenBiodivClientImpl)6 TestUtil.getResourceServiceTest (org.eol.globi.data.TestUtil.getResourceServiceTest)5 IOException (java.io.IOException)2 ResourceService (org.eol.globi.service.ResourceService)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 BufferedReader (java.io.BufferedReader)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1