- From: David Booth <david@dbooth.org>
- Date: Tue, 17 Mar 2015 12:43:04 -0400
- To: Linked JSON <public-linked-json@w3.org>, Jim McCusker <mccusj@rpi.edu>, Markus Lanthaler <markus.lanthaler@gmx.net>, msporny@digitalbazaar.com
I've played around further with this problem, and main sticking point seems be the need to distinguish between lists and everything else (JSON objects or strings), because if there is a FHIR JSON list then we need to generate that as an RDF list to retain the ordering information. In theory I think this problem could be solved by inserting a lot of additional @context statements into the JSON-LD instance data, to force different occurrences of a term to be mapped differently, but I'm quite sure that the FHIR working group would not go along with this. So the best solution I have so far is to declare *everything* in the @context to be an @list, so that an RDF list will *always* be generated, whether it is needed or not. The reason for doing this is that in some nesting contexts it *might* be needed. And since I have not found a way to distinguish different nesting contexts in the @context, my solution is to declare everything to be an @list. Here is an example in which I have done that for the "code" element: { "@context": { "@base": "http://example/base/", "base": "http://example/base/", "@vocab": "http://example/fhir#", "fhir": "http://example/fhir#", "resourceType": { "@type": "@vocab" }, "code": { "@id": "fhir:code", "@container": "@list" }, "Observation": {"@id": "fhir:Observation"} }, "resourceType": "Observation", "code": { "coding": [ { "system": "http://loinc.org", "code": "3141-9" } ] }, "foo": { "code": [ "aaa", "bbb" ] }, "bar": { "code": [ { "ccc": "ddd" } ] } } This generated the following RDF: @base <http://example/base/> . @prefix base: <> . @prefix fhir: <../fhir#> . [] fhir:resourceType fhir:Observation ; fhir:code ( [ fhir:coding [ fhir:system "http://loinc.org" ; fhir:code ( "3141-9" ) ] ] ) ; fhir:foo [ fhir:code ( "aaa" "bbb" ) ] ; fhir:bar [ fhir:code ([fhir:ccc "ddd"]) ] . I think this would solve the problem, though it means that there will be a bunch of extra lists in the RDF, wrapping single values. The 'fhir:code ( "3141-9" )' line above is one example. If anyone has other ideas I would love to hear them. Thanks! David Booth On 03/16/2015 11:41 PM, David Booth wrote: > P.S. Here is another example, simplified from > http://hl7-fhir.github.io/observation-example.json.html > Notice that "code" is used in different ways at different nesting > levels. What is the best way to handle this, in order to cause "code" > to be mapped to different RDF properties with different ranges? > > { > "resourceType": "Observation", > "code": { > "coding": [ > { > "system": "http://loinc.org", > "code": "3141-9" > } > ] > } > } > > Thanks, > David Booth > > On 03/16/2015 11:32 PM, David Booth wrote: >> 1. (Nesting) In FHIR, the same JSON element may have different content >> and meaning when it appears in different JSON objects. I would like to >> map them to different RDF properties. What is the best way to do this? >> For example, a FHIR AdverseReaction resource may contain a nested >> "code" element that holds an object: >> >> { >> "resourceType": "Alert", >> ... >> "symptom":[{"code":{"coding": ... >> } >> >> whereas a FHIR ConceptMap resource may contain a "code" element that >> holds a string: >> >> { >> "resourceType": "ConceptMap", >> ... >> "concept": [ >> { >> "system": "http://hl7.org/fhir/address-use", >> "code": "home", >> ... >> } >> >> I would like to process AdverseReaction.code differently than >> ConceptMap.code . Would I have to use a different @context for each >> resource type, like this, or is there a better way? >> >> { >> "@context": "http://example/fhir/Alert", >> "resourceType": "Alert", >> ... >> } >> >> and >> >> { >> "@context": "http://example/fhir/ConceptMap", >> "resourceType": "ConceptMap", >> ... >> } >> >> 2. (Implied triples) If that is the best way to do it, is there some >> way to reduce the redundancy, so that the "resourceType" line does not >> have to be included in the instance data and the @context will still >> generate the same RDF? For example, assuming that the following JSON >> >> { >> "@context": "http://example/fhir/ConceptMap", >> "resourceType": "ConceptMap", >> "foo": "bar" >> } >> >> causes this RDF to be generated: >> >> _:b1 fhir:resourceType fhir:ConceptMap . >> _:b1 fhir:foo "bar" . >> >> Is there some way to make the @context generate the same RDF from the >> following JSON? >> >> { >> "@context": "http://example/fhir/ConceptMap", >> "foo": "bar" >> } >> >> Thanks, >> David Booth > > > >
Received on Tuesday, 17 March 2015 16:43:36 UTC