Re: [FHIR JSON-LD] Possible to specify namespace of object node in @context?

On 3/13/15 4:56 PM, David Booth wrote:
> I'm experimenting with @type and @id in the @context to generate an 
> object node.  AFAICT, when I convert to Turtle, the URI for the object 
> node is generated using the @base URI.  Is there some other way to 
> specify it in the @context?  FHIR has a "resourceType" property, and 
> I'd like to treat the value of that property as an rdf:type in the 
> fhir: namespace.  So given JSON-LD like this:
>
> {
>   "@context": ...
>   "resourceType": "Observation",
>   "@id": "obs123",
>   ...
> }
>
> I would like it to generate RDF like this (assuming the base URI 
> corresponds to the b: prefix):
>
>   b:obs123 rdf:type fhir:Observation .
>
> However, what I'm getting so far is something like:
>
>   b:obs123 rdf:type b:Observation .
>
> Here is the actual JSON-LD that I am trying so far:
>
> {
>    "@context":
>    {
>       "@base": "http://example/base/",
>       "@vocab": "http://example/vocab#",
>       "fhir": "http://example/fhir#",
>       "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
>       "resourceType":
>       {
>          "@id": "rdf:type",
>          "@type": "@id"
>       }
>    },
>
>   "@id": "obs123",
>   "resourceType": "Observation",
>   "text": {
>     "@id": "text456",
>     "status": "generated",
>     "div": "<div>...</div>"
>   }
> }
>
> and here is the RDF that I'm getting as a result:
>
> @prefix fhir: <http://example/fhir#> .
> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
> @prefix b: <http://example/base/> .
>
> b:obs123
> <http://example/vocab#text> b:text456 ;
>         rdf:type                     b:Observation .
>
> b:text456
> <http://example/vocab#div> "<div>...</div>" ;
> <http://example/vocab#status> "generated" .
>
> Is it possible to use @context to generate the type of b:obs123 as 
> fhir:Observation instead of b:Observation?
>
> Thanks,
> David Booth

David,

You are conversant in TURTLE, so why not produce the description in that 
notation first,  and then attempt to convert it to JSON-LD? That's your 
most productive route.

There are many conversion tools (worst case bugs in some of them will be 
revealed and then fixed, as this effort progresses). Likewise, those 
that can (or like to) convert by hand end up with something useful to 
study and contribute to etc..

-- 
Regards,

Kingsley Idehen 
Founder & CEO
OpenLink Software
Company Web: http://www.openlinksw.com
Personal Weblog 1: http://kidehen.blogspot.com
Personal Weblog 2: http://www.openlinksw.com/blog/~kidehen
Twitter Profile: https://twitter.com/kidehen
Google+ Profile: https://plus.google.com/+KingsleyIdehen/about
LinkedIn Profile: http://www.linkedin.com/in/kidehen
Personal WebID: http://kingsley.idehen.net/dataspace/person/kidehen#this

Received on Friday, 13 March 2015 21:37:25 UTC