Stream: ontology
Topic: JSON-LD
Grahame Grieve (Jan 10 2017 at 22:24):
I have been working with @David Booth @Eric Prud'hommeaux and Gregg Kellogg on the json-ld representation for FHIR.
Grahame Grieve (Jan 10 2017 at 22:25):
we are currently working through issues identified by the quality test, which is:
- load the ttl format
- load the json-ld format
- require that both lead to the same set of triples
Grahame Grieve (Jan 10 2017 at 22:27):
note that this a decision that we made: we could, for instance, require that the 'triples mean the same thing', but instead, we've chosen for a higher level criteria: 'that they lead to the same triples'. This implies that we believe that it must be acceptable to process the json-ld as pure RDF; there can be no dependency on reading hte json-ld directly (though people can do that if they want)
Grahame Grieve (Jan 10 2017 at 22:31):
what this means is that some decisions we made for the turtle format have to be revisited. Presently, there are 2 significant areas of difference:
- we defined a nodeRole property to identify the root node. In JSON-LD, the root node is explicit, but that explicit-ness is lost once the json-ld is processed to RDF. we could remove it from the turtle format, and leave everyone guessing as to the root, or we can define nodeRole in the json-ld as well
- for the turtle, we chose not to use the RDF list format, and instead, to put a fhir:index property on each property what has cardinality > 1, so that order could be reasoned with. In json-ld, we have to make a decision about this: either we label all the nodes explicit with an index (which is redundant when you look at the json-ld directly), or we use @container : @list in the FHIR context (which means that we would have to change the turtle format too)
Grahame Grieve (Jan 10 2017 at 22:32):
this kind of implies that the conformance criteria for json-ld is : any json-ld that leads to the correct set of triples once processed to rdf is acceptable.
Grahame Grieve (Jan 10 2017 at 22:33):
that has some benefits... but it highly constrains the set of things that are valid json-ld. In particular, I think you can forget about taking the 'json you already use', annotating it with a context, and getting valid FHIR content out of that.
Grahame Grieve (Jan 10 2017 at 22:34):
perhaps this might be possible for json-ld v2, with a greatly enhanced ability to do things in the @context - .e.g redefining context by type, injecting data into the triples from the context, some restructuring/mapping features in the context
Josh Mandel (Jan 11 2017 at 04:16):
My question at this point is: who is the audience for JSON-LD, and who is the audience for turtle? Do we have distinct developers asking for each of these? I'd be worried about making changes that make *both formats* harder to work with, just in the name of unity.
Grahame Grieve (Jan 11 2017 at 18:29):
That's an extremely good question. I think JSON-Ld is a fail, myself. The idea I that you can use your existing JSON, and mark it up,with a context so that it magically turns into rdf. Well, the problem with magic happens here is that there is no magic. The jsonld context is simple, which means that the JSON itself is highly constrained. Complicating the jsonld context so it can value add would make the json much more flexible, but the processing would be very complicated
Grahame Grieve (Jan 11 2017 at 18:30):
so who would use what? I suspect that the jsonld complexity would scare anyone doing json away, while anyone doing rdf is going to need turtle somewhere anyway
Grahame Grieve (Jan 11 2017 at 18:31):
but the committee decided to keep jsonld as an option, so here were are
Grahame Grieve (Jan 11 2017 at 18:32):
my belief that the requirement make them the same triples adds 10% complexity, though since it's all redundant elements that it adds, it'll feel like more than that
David Booth (Jan 13 2017 at 18:49):
People who know they want to treat it as RDF will be able to consume it either as JSON-LD or Turtle. It won't make much difference to them. So from that perspective supporting both is unnecessary.
However, Turtle and JSON-LD each have their own pros and cons. I think Turtle is nicer for concisely expressing the desired RDF triples -- for expository purposes. But for interchange I like to encourage the use of JSON-LD as an RDF format because I think it provides better outreach to the existing developer community, since developers already know JSON but typically not Turtle. That motivation is not specific to FHIR.
But specific to FHIR, I also harbor the hope that the unambiguous property names in JSON-LD -- fully qualified, independent of nesting context -- will appeal to a segment of developers who prefer a coding style that make use of them. I don't have any proof of this though.
Grahame Grieve (Jan 13 2017 at 20:35):
nesting context is always important, unfortunately. There is only a few places in FHIR where we nest unless the cardinality is 0..*, and once the cardinality is 0..*, you cannot ignore the nesting context
Last updated: Apr 12 2022 at 19:14 UTC