[JSON] Tiny Proposal

Hi All,

Here's a tiny proposal:

1: Constrain JSON [1] to be an (optionally nested) sequence of one or 
more objects (where one, no enclosing [] is needed).

2: constrain object keys to be strings with no white space

3: add in IRI recognition as a value type (wrapped in quotes), likewise 
dateTime, date and time.

4: add recognition for a special "@id" property who's value is an IRI 
(sets the subject of the object when present)

5: add recognition for a special "@vocab" property who's value is an IRI 
(when present, each key in that object is concatenated to the @vocabs 
value to form the IRI of the property)

6: add recognition for a special "@type" property who's value is simple 
string (when present the value is concatenated to the @vocabs value to 
form the IRI of the rdf:type)

7: add recognition for a special "@base" property who's value is an IRI 
(relative IRI-ref resolution)

For the Sample Graphs [2] this would produce:

  {
   "@vocab": "http://xmlns.com/foaf/0.1/",
   "@type": "Person",
   "@id": "http://jondoe.example.org/#me",
   "nick": "Jonny",
   "givenname": "Jon",
   "family_name": "Doe",
   "depiction": "http://jondoe.example.org/me.jpg",
   "homepage": "http://jondoe.example.org/",
   "interest": "http://dbpedia.org/resource/Film",
   "knows":  {
     "@type": "Person",
     "@id": "http://janedoe.example.org/#me",
     "name": "Jane Doe"
    }
  }

and for the next example:

  {
   "@vocab": "http://business.example.org/v/custom-gr-merged#",
   "@base": "http://business.example.org/openinghours.html",
   "@id": "#business",
   "@type": "BusinessEntity",
   "label": "Example Business, Inc.",
   "legalName": "Example Business, Inc.",
   "page": [
     "http://business.example.com",
     "http://business.example.org/openinghours.html"
   ],
   "fn": "Example Business, Inc.",
   "geo": {
     "latitude": "49.0202626",
     "longitude": "12.8407428"
   },
   "tel": "+49-12-3546789",
   "url": "http://business.example.com",
   "hasPOS": {
     "@vocab": "http://purl.org/goodrelations/v1#",
     "@type": "LocationOfSalesOrServiceProvisioning",
     "@id": "#shop",
     "hasOpeningHoursSpecification": [
       {
        "@type": "OpeningHoursSpecification",
        "@id": "#mon",
        "opens": "08:00:00",
        "closes": "18:00:00"
       },
       {
        "@type": "OpeningHoursSpecification",
        "@id": "#tue",
        "opens": "08:00:00",
        "closes": "18:00:00"
       },
       {
        "@type": "OpeningHoursSpecification",
        "@id": "#wed",
        "opens": "08:00:00",
        "closes": "14:00:00"
       },
       {
        "@type": "OpeningHoursSpecification",
        "@id": "#thu",
        "opens": "08:00:00",
        "closes": "18:00:00"
       },
       {
        "@type": "OpeningHoursSpecification",
        "@id": "#fri",
        "opens": "08:00:00",
        "closes": "20:00:00"
       },
       {
        "@type": "OpeningHoursSpecification",
        "@id": "#mon",
        "opens": "09:00:00",
        "closes": "15:00:00"
       }
     ]
   }

trade-offs and clarifications:

  - multiple values represented by an array
  - blank nodes are objects with no "@id" (blank node identifiers not 
supported)
  - no provision for @language or @datatype
  - when terms from multiple vocabularies are needed it requires people 
to make their own custom vocab which includes aliases to terms in other 
vocabularies. (having a single cachable vocab is lighter for network 
though and easier to maintain)

I think that's about it..

Best,

Nathan

[1] http://json.org/
[2] http://www.w3.org/2011/rdf-wg/wiki/TF-JSON#Sample_Graphs

Received on Wednesday, 23 March 2011 18:15:03 UTC