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:41:00 UTC
[jira] [Created] (JENA-1744) JSON-LD writing handles non-qname
property URI badly.
Andy Seaborne created JENA-1744:
-----------------------------------
Summary: 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
Example Turtle file, no prefixes:
{noformat}
<http://somewhere/s1> <http://example/ns/(prop1)> "prop 1" .
<http://somewhere/s2> <http://example/ns/(prop2)> "prop 2" .
{noformat}
produces ({{riot --pretty JSONLD D.ttl}}) the JSON LD
{noformat}
{
"@graph" : [ {
"@id" : "http://somewhere/s1",
"http://example/ns/(prop1)" : "prop 1"
}, {
"@id" : "http://somewhere/s2",
"" : "prop 2"
} ],
"@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 creat problems downstream if the JSON-LD is treated as JSON (the motivating case is ingesting into a BI-tool via it's JSON adapter).
This is because 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 (full-URI, "").
--
This message was sent by Atlassian Jira
(v8.3.2#803003)