[ 
https://issues.apache.org/jira/browse/JENA-1276?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15821524#comment-15821524
 ] 

Fran├žois-Paul Servant commented on JENA-1276:
---------------------------------------------

jsonld-java 0.9.0 solves the issue

> "loading remote context failed" reading JSON-LD
> -----------------------------------------------
>
>                 Key: JENA-1276
>                 URL: https://issues.apache.org/jira/browse/JENA-1276
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: ARQ
>    Affects Versions: Jena 3.1.1
>         Environment: mac osx 10.11, eclipse mars
>            Reporter: Fran├žois-Paul Servant
>
> getting org.apache.jena.riot.RiotException: loading remote context failed: 
> http://schema.org/ reading json-ld with an @context set to schema.org
> see https://github.com/apache/jena/pull/203
> the exception occurs here:
> com.github.jsonldjava.core.DocumentLoader.loadDocument(String) line 29
> where I get:
> org.apache.http.ConnectionClosedException: Premature end of Content-Length 
> delimited message body (expected: 124346; received: 0
> {noformat}
> public class TestJsonLDReader {
>     @Test public final void simpleReadTest() {
>         try {
>             String jsonld = someSchemaDorOrgJsonld();
>             Model m = ModelFactory.createDefaultModel();
>             try (StringReader reader = new StringReader(jsonld)) {
>                 m.read(reader, null, "JSON-LD");              
>             }
>             assertJohnDoeIsOK(m);
>         } catch (RiotException e) {
>             // org.apache.jena.riot.RiotException: loading remote context 
> failed: http://schema.org/
>             e.printStackTrace();
>         }
>     }
>     /** Example data */
>     private String someSchemaDorOrgJsonld() {
>         return "{\"@id\":\"_:b0\",\"@type\":\"Person\",\"name\":\"John 
> Doe\",\"@context\":\"http://schema.org/\"}";;
>     }
>     /** Checking that the data loaded from someSchemaDorOrgJsonld into a 
> model, is OK */
>     private void assertJohnDoeIsOK(Model m) {
>         assertTrue(m.contains(null, RDF.type, 
> m.createResource("http://schema.org/Person";)));
>         assertTrue(m.contains(null, 
> m.createProperty("http://schema.org/name";), "John Doe"));       
>     }
> }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to