You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Andy Seaborne (Jira)" <ji...@apache.org> on 2019/08/29 09:59:00 UTC
[jira] [Comment Edited] (JENA-1744) JSON-LD writing handles
non-qname property URI badly.
[ https://issues.apache.org/jira/browse/JENA-1744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16918459#comment-16918459 ]
Andy Seaborne edited comment on JENA-1744 at 8/29/19 9:58 AM:
--------------------------------------------------------------
Changing to a "curie" split will produce:
{noformat}
{
"@id" : "http://somewhere/s1",
"(prop1)" : "123",
"(prop2)" : "456",
"@context" : {
"(prop2)" : {
"@id" : "http://example/ns/(prop2)"
},
"(prop1)" : {
"@id" : "http://example/ns/(prop1)"
}
}
}
{noformat}
The JSON keys are "(prop1)" and "(prop2)".
was (Author: andy.seaborne):
Changing to a "curie" split will produce:
{noformat}
{
"@graph" : [ {
"@id" : "http://somewhere/s1",
"(prop1)" : "prop 1"
}, {
"@id" : "http://somewhere/s2",
"(prop2)" : "prop 2"
} ],
"@context" : {
"(prop2)" : {
"@id" : "http://example/ns/(prop2)"
},
"(prop1)" : {
"@id" : "http://example/ns/(prop1)"
}
}
}
{noformat}
The object keys are "(prop1)" and "(prop2)".
> JSON-LD writing handles non-qname property URI badly.
> -----------------------------------------------------
>
> Key: JENA-1744
> URL: https://issues.apache.org/jira/browse/JENA-1744
> Project: Apache Jena
> Issue Type: Improvement
> Components: RIOT
> Affects Versions: Jena 3.12.0
> Reporter: Andy Seaborne
> Assignee: Andy Seaborne
> Priority: Major
>
> Example Turtle file, no prefixes:
> {noformat}
> <http://somewhere/s1> <http://example/ns/(prop1)> "123" .
> <http://somewhere/s1> <http://example/ns/(prop2)> "456" .
> {noformat}
> produces ({{riot --pretty JSONLD D.ttl}}) the JSON LD
> {noformat}
> {
> "@id" : "http://somewhere/s1",
> "http://example/ns/(prop1)" : "123",
> "" : "456",
> "@context" : {
> "" : {
> "@id" : "http://example/ns/(prop2)"
> }
> }
> }
> {noformat}
> which parses back to to the original RDF triples correctly.
> However, the treatment of the two properties is asymmetric - one is context "" and one is full URI as "http://example/ns/(prop1)".
> This can create problems downstream if the JSON-LD is treated as JSON (the motivating case is ingesting extracted RDF data into a BI-tool via it's JSON adapter).
> The [JSONLD writer (line 321)|https://github.com/apache/jena/blob/0dde76f777e55109a75db87c855bfc17e40c9d4a/jena-arq/src/main/java/org/apache/jena/riot/writer/JsonLDWriter.java#L321] uses "{{p.getLocalName()}}" to choose JSON-LD field name. In both cases, it is "" because "()" are legal in a URI but not legal for an RDF qname localname. The XML-split is the pair (full-URI, "").
> JSON-LD does not need the restrictions need for RDF/XML. The split can be made at the "/". JSON-LD uses [curies|https://www.w3.org/TR/curie/].
--
This message was sent by Atlassian Jira
(v8.3.2#803003)