Re: Default @type

On Aug 7, 2014, at 12:32 PM, David Janes <davidjanes@davidjanes.com> wrote:

> Let's say I have some temperature / humidity data
> 
>     {
>       "temperature" : 22.1,
>       "humidity" : 44
>     }
> I can mark this up semantically using JSON-LD as follows (note the JSON-LD at the link is a little wonky right now in terms of naming):
> 
>     {
>       "@type" : "https://iotdb.org/iotdb/models/firmata-dht11",
>       "@context" : "https://iotdb.org/iotdb/models/firmata-dht11",
>       "temperature" : 22.1,
>       "humidity" : 44
>     }
> Great, this record now has a type and proper definitions for temperature and humidity. 
> 
> But let's say I want to leave the record alone and use HTTP Links headers to annotate, as per [1]. Obviously I get the @context. But how do I get the @type associated with the record?
> 
You would need to specify the type in the JSON. For example, if you alias "type" as "@type" in your context, you could do the following (given a default vocabulary defined in your context):

    {
      "type" : firmat-dht11,
      "temperature" : 22.1,
      "humidity" : 44
    }

Although, I'm not sure what you gain by having the type the same as the context URL.

Gregg
> [1] http://www.w3.org/TR/json-ld/#interpreting-json-as-json-ld
> Regards,
> 
> D.
> 
> 
> 

Received on Thursday, 7 August 2014 19:42:53 UTC