[
https://issues.apache.org/jira/browse/JENA-1744?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andy Seaborne resolved JENA-1744.
---------------------------------
Fix Version/s: Jena 3.13.0
Resolution: Fixed
> 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
> Fix For: Jena 3.13.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> 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)