Stian Soiland-Reyes created JENA-1176:
-----------------------------------------
Summary: JSON-LD @context parsing fails due to outdated HTTPClient
Key: JENA-1176
URL: https://issues.apache.org/jira/browse/JENA-1176
Project: Apache Jena
Issue Type: Bug
Reporter: Stian Soiland-Reyes
Priority: Blocker
Fix For: Jena 3.1.0
Raised by
[Francois|http://mail-archives.apache.org/mod_mbox/jena-dev/201605.mbox/%3CB51A2FF9-23E8-460B-913D-43BAB7A07E29%40gmail.com%3E]:
{code}
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");
}
}
{code}
Fails with:
{code}
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)
{code}
This is caused by a newer [JSONLD-Java
0.8.2|https://github.com/jsonld-java/jsonld-java/blob/v0.8.2/pom.xml#L42] now
depending on
{code:xml}
<httpclient.version>4.5.1</httpclient.version>
<httpcore.version>4.4.4</httpcore.version>
{code}
while we explicitly depend on a much older version:
{code:xml}
<!-- These are connected because solr4j depends on httpclient as well -->
<ver.httpclient>4.2.6</ver.httpclient>
<ver.httpcore>4.2.5</ver.httpcore>
{code}
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|https://github.com/jsonld-java/jsonld-java#loading-contexts-from-classpathjar]
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
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)