yes - the code need updating.

https://issues.apache.org/jira/browse/JENA-576

    Andy

On 09/05/16 12:16, François-Paul Servant wrote:
Hi,

I get another JSON-LD error with using the @context
https://w3id.org/bundle/context that I need to check further what is
the cause of that (it works fine with JSON-LD Playground).

org.apache.jena.riot.RiotException: loading remote context failed:
https://w3id.org/bundle/context
    at 
org.apache.jena.riot.system.ErrorHandlerFactory$ErrorHandlerStd.error(ErrorHandlerFactory.java:128)
    at org.apache.jena.riot.lang.JsonLDReader.read$(JsonLDReader.java:146)
    at org.apache.jena.riot.lang.JsonLDReader.read(JsonLDReader.java:83)
    at org.apache.jena.riot.RDFDataMgr.process(RDFDataMgr.java:861)
    at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:259)
    at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:245)


I don’t know whether it is the same thing, but I noticed (working with 
3.1.1-SNAPSHOT) that following test, that attempts to read a simple jsonld 
document with an external context

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");
        }

}

gives:

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)

It seems that there is a conflict between the version of http-client cache used 
by JSON-LD java 0.8.2 (4.5.1), and the one that wants jena (4.2.6). Jena seems 
to really want to choose its version, cf pom/xml:

+       /*
+      <dependency>
+        <groupId>com.github.jsonld-java</groupId>
+        <artifactId>jsonld-java</artifactId>
+        <version>${ver.jsonldjava}</version>
+        <exclusions>
+          <exclusion>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+          </exclusion>
+          <!-- Exclude so we use our choice of versions -->
+          <exclusion>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient-cache</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+          </exclusion>

Best,

fps


Reply via email to