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

Andy Seaborne commented on JENA-1276:
-------------------------------------

The exception is caused by JsonLDReader:
{noformat}
        catch (JsonLdError e) {
            errorHandler.error(e.getMessage(), -1, -1); 
            throw new RiotException(e) ;
        }
{noformat}
so this something being passed up by the JSON-LD engine.

This not a Jena 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