Details
-
Bug
-
Status: Closed
-
Blocker
-
Resolution: Fixed
-
None
-
None
Description
Raised by Francois:
public class TestJsonLDReader { @Test public final void test() { String jsonld = "{\"@id\":\"_:b0\",\"@type\":\"http://schema.org/Person\",\"name\":\"John Doe\",\"@context\":\"http://schema.org/\"}"; StringReader reader = new StringReader(jsonld); Model m = ModelFactory.createDefaultModel(); m.read(reader, null, "JSON-LD"); m.write(System.out, "TURTLE"); } }
Fails with:
java.lang.NoSuchMethodError: org.apache.http.impl.client.cache.CacheConfig.custom()Lorg/apache/http/impl/client/cache/CacheConfig$Builder; at com.github.jsonldjava.utils.JsonUtils.createDefaultHttpClient(JsonUtils.java:333) at com.github.jsonldjava.utils.JsonUtils.getDefaultHttpClient(JsonUtils.java:323) at com.github.jsonldjava.core.DocumentLoader.getHttpClient(DocumentLoader.java:84) at com.github.jsonldjava.core.DocumentLoader.fromURL(DocumentLoader.java:59) at com.github.jsonldjava.core.DocumentLoader.loadDocument(DocumentLoader.java:29) at com.github.jsonldjava.core.Context.parse(Context.java:169) at com.github.jsonldjava.core.Context.parse(Context.java:252) at com.github.jsonldjava.core.JsonLdApi.expand(JsonLdApi.java:534) at com.github.jsonldjava.core.JsonLdApi.expand(JsonLdApi.java:981) at com.github.jsonldjava.core.JsonLdProcessor.expand(JsonLdProcessor.java:146) at com.github.jsonldjava.core.JsonLdProcessor.toRDF(JsonLdProcessor.java:482) at org.apache.jena.riot.lang.JsonLDReader.read$(JsonLDReader.java:143) at org.apache.jena.riot.lang.JsonLDReader.read(JsonLDReader.java:64)
This is caused by a newer JSONLD-Java 0.8.2 now depending on
<httpclient.version>4.5.1</httpclient.version> <httpcore.version>4.4.4</httpcore.version>
while we explicitly depend on a much older version:
<!-- These are connected because solr4j depends on httpclient as well --> <ver.httpclient>4.2.6</ver.httpclient> <ver.httpcore>4.2.5</ver.httpcore>
Issue JENA-576 discusses why HTTPClient was not upgraded.
I suggest we try again to upgrade HTTPClient, even if this means also a newer Solr.
A workaround would be to have an initialization to set JsonUtils.setDefaultClient() with our own instance - however that would break JSON-LD Context JAR caching which I know we use in Taverna to avoid network traffic.
As JSON-LD with external @context - e.g. with schema.org, is the primary way to use JSON-LD, then I think this should be a blocker for 3.1.0