[oslc-core] Multi-types resources in JSON representation

James Conallen jconallen at us.ibm.com
Fri Jan 14 15:00:52 EST 2011



The guidance for JSON states that JSON representations should have a type:

   rdf:type A resource can have multiple types, so this is a JSON Array of
   objects, each with an rdf:resource field that is a type of the resource.

Looking over the examples, it appears that rdf:type is not an array:

   {
      "prefixes" : {
         "oslc": "http://open-services.net/ns/core#",
         "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
         "foaf" : "http://http://xmlns.com/foaf/0.1/",
         "dcterms" : "http://purl.org/dc/terms/"
      },
      "rdf:type" : { "rdf:resource" :
   "http://open-services.net/ns/bogus/blogs#Entry" },
      "rdf:about" : "http://example.com/blogs/entry/1",
      "dcterms:title" : "I love trash",
      "dcterms:modified" : "2002-10-10T12:00:00-05:00",
      "dcterms:content" : "Anything dirty or dingy or dusty. \\nAnything
   ragged or rotten or rusty.",
      "dcterms:creator" : {
         "foaf:name" : "Oscar T. Grouch"
      },
   }

I am thinking the following is the correct example:

   {
      "prefixes" : {
         "oslc": "http://open-services.net/ns/core#",
         "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
         "foaf" : "http://http://xmlns.com/foaf/0.1/",
         "dcterms" : "http://purl.org/dc/terms/"
      },
      "rdf:type" : [ { "rdf:resource" :
   "http://open-services.net/ns/bogus/blogs#Entry" } ],
      "rdf:about" : "http://example.com/blogs/entry/1",
      "dcterms:title" : "I love trash",
      "dcterms:modified" : "2002-10-10T12:00:00-05:00",
      "dcterms:content" : "Anything dirty or dingy or dusty. \\nAnything
   ragged or rotten or rusty.",
      "dcterms:creator" : {
         "foaf:name" : "Oscar T. Grouch"
      },
   }

Is this an error in the example, or in my understanding of spec?




<jim/>

jim conallen
CAM Lead Architect, OSLC AM Lead
jconallen at us.ibm.com
Rational Software, IBM Software Group
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://open-services.net/pipermail/oslc-core_open-services.net/attachments/20110114/f7b1ee0f/attachment-0003.html>


More information about the Oslc-Core mailing list