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

Peter Ansell commented on STANBOL-221:
--------------------------------------

If a JSON-LD document supports multiple contexts, per the specification, 
appendix A.1 [1], the JSON-LD parser will fall over because it assumes that 
there is only going to be one object in each input document. 

Line 50 in JsonLdParser.java may need to be changed or wrapped up so that it 
attempts to find a JSONArray before it attempts to find a JSONObject, as 
multiple contexts are implemented using an array as the root of the JSON graph, 
and JSONObject cannot be created for this case.

For example, the following is a valid (by my interpretation of the current 
specification) JSON-LD document that fails using the current parser 
implementation. It contains descriptions of three independent subjects:

[{
    "@subject": {
        "@iri": "http://example.com/library";
    },
    "http://example.org/vocab#contains": {
        "@iri": "http://example.org/library/the-republic";
    },
    "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": {
        "@iri": "http://example.org/vocab#Library";
    }
}, {
    "@subject": {
        "@iri": "http://example.org/library/the-republic";
    },
    "http://example.org/vocab#contains": {
        "@iri": "http://example.org/library/the-republic#introduction";
    },
    "http://purl.org/dc/terms/creator": "Plato",
    "http://purl.org/dc/terms/title": "The Republic",
    "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": {
        "@iri": "http://example.org/vocab#Book";
    }
}, {
    "@subject": {
        "@iri": "http://example.org/library/the-republic#introduction";
    },
    "http://purl.org/dc/terms/description": "An introductory chapter on The 
Republic.",
    "http://purl.org/dc/terms/title": "The Introduction",
    "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": {
        "@iri": "http://example.org/vocab#Chapter";
    }
}]

[1] http://json-ld.org/spec/ED/20110911/#disjoint-graphs
                
> Update JSON-LD implementation to Specification version 20110911
> ---------------------------------------------------------------
>
>                 Key: STANBOL-221
>                 URL: https://issues.apache.org/jira/browse/STANBOL-221
>             Project: Stanbol
>          Issue Type: Improvement
>          Components: Commons
>            Reporter: Fabian Christ
>            Assignee: Fabian Christ
>              Labels: json-ld,
>
> The current JSON-LD implementation is based on version 20110201. The 
> implementation should be updated to support the newer specification version 
> 20110911.
> The 20110911 version is online at
> http://json-ld.org/spec/ED/20110911/

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to