Search in sources :

Example 1 with OpenBiodivClientImpl

use of org.globalbioticinteractions.util.OpenBiodivClientImpl 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 OpenBiodivClientImpl

use of org.globalbioticinteractions.util.OpenBiodivClientImpl 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 OpenBiodivClientImpl

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

the class SparqlClientCachingFactory method create.

@Override
public SparqlClient create(ResourceService resourceService) {
    DB db = getDb();
    final Map<String, String> queryCache = db.createTreeMap("queryCache").make();
    final ResourceService resourceServiceCaching = new ResourceServiceCaching(queryCache, resourceService);
    return new OpenBiodivClientImpl(resourceServiceCaching) {

        @Override
        public void close() throws IOException {
            db.close();
        }
    };
}
Also used : ResourceService(org.eol.globi.service.ResourceService) OpenBiodivClientImpl(org.globalbioticinteractions.util.OpenBiodivClientImpl) DB(org.mapdb.DB)

Example 4 with OpenBiodivClientImpl

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

the class DatasetImporterForPensoftTest method parseRowsAndEnrich.

public static void parseRowsAndEnrich(JsonNode biodivTable, InteractionListener listener, ResourceService resourceService) throws StudyImporterException {
    DatasetImporterForPensoft datasetImporterForPensoft = new DatasetImporterForPensoft(null, null);
    datasetImporterForPensoft.parseRowsAndEnrich(biodivTable, listener, new NullImportLogger(), new OpenBiodivClientImpl(resourceService));
}
Also used : NullImportLogger(org.eol.globi.tool.NullImportLogger) OpenBiodivClientImpl(org.globalbioticinteractions.util.OpenBiodivClientImpl)

Example 5 with OpenBiodivClientImpl

use of org.globalbioticinteractions.util.OpenBiodivClientImpl 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)

Aggregations

OpenBiodivClientImpl (org.globalbioticinteractions.util.OpenBiodivClientImpl)8 SparqlClient (org.globalbioticinteractions.util.SparqlClient)6 Test (org.junit.Test)6 TestUtil.getResourceServiceTest (org.eol.globi.data.TestUtil.getResourceServiceTest)5 ResourceService (org.eol.globi.service.ResourceService)2 IOException (java.io.IOException)1 NullImportLogger (org.eol.globi.tool.NullImportLogger)1 DB (org.mapdb.DB)1