Using rdf:type instead of @type for node types

Hello,

we would like to use what my colleague Jan Schnasse has dubbed "side car 
approach" of providing JSON-LD. This means providing a label for each 
node in the data – including RDF types – to enable easy consumption of 
the data without IRI-lookups for presentation purposes. The following 
example shows the general pattern:

{
    "@context":{
       "label":"http://www.w3.org/2000/01/rdf-schema#label",
       "subject":{
          "@id":"http://purl.org/dc/terms/subject",
          "@type":"@id"
       }
    },
    "@id":"http://lobid.org/resource/HT018881872",
    "@type":[
       {
          "@id":"http://purl.org/ontology/bibo/Book",
          "label":"Buch"
       },
       {
          "@id":"http://purl.org/ontology/bibo/Thesis",
          "label":"Abschlussarbeit"
       }
    ],
    "title":[
       "Skateboarding"
    ],
    "otherTitleInformation":[
       "Ethnographie einer urbanen Praxis"
    ],
    "creator":[
       {
          "@id":"http://d-nb.info/gnd/103058788",
          "label":"Peters, Christian"
       }
    ],
    "subject":[
       {
          "@id":"http://d-nb.info/gnd/4181628-6",
          "label":"Skateboardfahren"
       },
       {
          "@id":"http://d-nb.info/gnd/4031483-2",
          "label":"Köln"
       }
    ]
}

Though this is valid JSON it isn't valid JSON-LD, see [0]. This is 
because the @type – whether aliased to "type" or not – keyword doesn't 
allow objects but only takes "an absolute IRI, a relative IRI, a compact 
IRI (including blank node identifiers), a term defined in the active 
context expanding into an absolute IRI, or an array of any of these" 
[1]. See also the section 5.4 Specifying the Type in the JSON-LD spec. [2]

We noticed that the "side car" approach works when instead of "@type" 
another name – e.g. "type" – is used which is mapped to rdf:type in the 
context. Example:

{
    "@context":{
       "label":"http://www.w3.org/2000/01/rdf-schema#label",
       "type":{
          "@id":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
          "@type":"@id"
       }
    },
    "@id":"http://lobid.org/resource/HT018881872",
    "type":[
       {
          "@id":"http://purl.org/ontology/bibo/Book",
          "label":"Buch"
       },
       {
          "@id":"http://purl.org/ontology/bibo/Thesis",
          "label":"Abschlussarbeit"
       }
    ]
}

There is no error in the JSON-LD playground for this and the RDF outcome 
looks as expected. [3] We are now thinking about using the key "type" 
mapped to rdf:type for associating a type with a node and only using 
"@type" in the JSON-LD context and for indicating a value type.

In the recent thread on this list about the "@type" keyword and framing 
[4] it became clear that "@type" is necessary for framing so this is an 
obvious drawback. As we are building our JSON-LD structure without 
framing, mapping "type" to rdf:type wouldn't be a problem in this 
regard. Are there any other reasons from refraining from this or any 
arguments for another approach?

All the best
Adrian


[0] http://tinyurl.com/jfdrdux
[1] https://www.w3.org/TR/json-ld/#node-objects
[2] https://www.w3.org/TR/json-ld/#specifying-the-type
[3] http://tinyurl.com/jkezgm8
[4] 
https://lists.w3.org/Archives/Public/public-linked-json/2016Feb/0008.html

Received on Friday, 19 February 2016 15:18:46 UTC