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

Andy Seaborne commented on JENA-2187:
-------------------------------------

[~phtyson] -- The {{person-eg.jsonld}} case is different.

The JSON-LD engine, Titanium, does not expose the results of parsing the 
{{\@context}} to Jena.

What Jena does is to get the JSON document, find the global {{@context}} and 
extract the prefixes. It does not, at this point, do a full processing of the 
context. Instead, it looks for {{"prefix" : "uri"}} pairs by traversing the 
JSON, where "uri" ends in "/", "#" or ":". Jena also interprest {{\@vocab}} and 
an URI with one of those ending as the "" prefix.

I've logged a feature request with Titanium: 
https://github.com/filip26/titanium-json-ld/issues/193 to ask for the context 
prefixes be exposed after JSON-LD parsing.

> LangJSONLD11 doesn't extract prefixes from context array or URL reference
> -------------------------------------------------------------------------
>
>                 Key: JENA-2187
>                 URL: https://issues.apache.org/jira/browse/JENA-2187
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: ARQ
>    Affects Versions: Jena 4.2.0
>            Reporter: Paul Tyson
>            Priority: Minor
>         Attachments: jena-2187-fail.jsonld11, jena-2187-pass.jsonld11, 
> person-eg.jsonld
>
>
> Using riot cmdline, when processing a json-ld @context that is an array, I 
> get the following message, and the prefixes are not emitted in the ttl output.
> {code:java}
> 10:46:02 WARN  LangJSONLD11    :: Unexpected problem while extracting 
> prefixes: Cannot cast org.glassfish.json.JsonArrayBuilderImpl$JsonArrayImpl 
> to jakarta.json.JsonObject
> java.lang.ClassCastException: Cannot cast 
> org.glassfish.json.JsonArrayBuilderImpl$JsonArrayImpl to 
> jakarta.json.JsonObject
>         at java.lang.Class.cast(Class.java:3605) ~[?:?]
>         at jakarta.json.JsonValue.asJsonObject(JsonValue.java:117) 
> ~[jakarta.json-2.0.1.jar:2.0.1]
>         at 
> org.apache.jena.riot.lang.LangJSONLD11.extractPrefixes(LangJSONLD11.java:97) 
> [jena-arq-4.2.0.jar:4.2.0]
>         at org.apache.jena.riot.lang.LangJSONLD11.read(LangJSONLD11.java:75) 
> [jena-arq-4.2.0.jar:4.2.0]
>         at org.apache.jena.riot.lang.LangJSONLD11.read(LangJSONLD11.java:55) 
> [jena-arq-4.2.0.jar:4.2.0]
>         at org.apache.jena.riot.RDFParser.read(RDFParser.java:358) 
> [jena-arq-4.2.0.jar:4.2.0]
>         at org.apache.jena.riot.RDFParser.parseURI(RDFParser.java:324) 
> [jena-arq-4.2.0.jar:4.2.0]
>         at org.apache.jena.riot.RDFParser.parse(RDFParser.java:299) 
> [jena-arq-4.2.0.jar:4.2.0]
>         at riotcmd.CmdLangParse.parseRIOT(CmdLangParse.java:297) 
> [jena-cmds-4.2.0.jar:4.2.0]
>         at riotcmd.CmdLangParse.parseFile(CmdLangParse.java:251) 
> [jena-cmds-4.2.0.jar:4.2.0]
>         at riotcmd.CmdLangParse.exec$(CmdLangParse.java:163) 
> [jena-cmds-4.2.0.jar:4.2.0]
>         at riotcmd.CmdLangParse.exec(CmdLangParse.java:128) 
> [jena-cmds-4.2.0.jar:4.2.0]
>         at org.apache.jena.cmd.CmdMain.mainMethod(CmdMain.java:92) 
> [jena-cmds-4.2.0.jar:4.2.0]
>         at org.apache.jena.cmd.CmdMain.mainRun(CmdMain.java:58) 
> [jena-cmds-4.2.0.jar:4.2.0]
>         at org.apache.jena.cmd.CmdMain.mainRun(CmdMain.java:45) 
> [jena-cmds-4.2.0.jar:4.2.0]
>         at riotcmd.riot.main(riot.java:29) [jena-cmds-4.2.0.jar:4.2.0]
> {code}
> If the context is a JSON object, no warning message appears, and the prefixes 
> are included in the output.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to