Re: [JSON] RDF collections and JSON arrays

On 2011-03-25, at 13:35, Pat Hayes wrote:

> 
> On Mar 25, 2011, at 3:33 AM, Steve Harris wrote:
> 
>> Equally I see using [ ] just to encode multiple object for a single subject and predicate as problematic, consider (in no particular syntax):
>> 
>> {
>>  ...
>>  "http://example.com/alice": {
>>     "foaf:name": "Alice"
>>  },
>>  "http://example.com/bob": {
>>     "foaf:name": [ "Bob", "Bob Smith" ]
>>  }
>> }
>> 
>> That makes access to the data without a library tricky, as for every "object" you read, you'll need some conditional designed to test if it's an array/vector/list, or a literal value.
>> 
>> Though it makes the simple case uglier, it would probably be better to always use an array to represent objects, if the aim is to allow access without a library:
>> 
>> {
>>  ...
>>  "http://example.com/alice": {
>>     "foaf:name": [ "Alice" ]
>>  },
>>  "http://example.com/bob": {
>>     "foaf:name": [ "Bob", "Bob Smith" ]
>>  }
>> }
>> 
>> I'm also not keen on [[ ]] for RDF collections, but don't see a sensible alternative.
> 
> How about [rdf:Collection [ this that other]]  rather than [[this that other]]. I like having a glaring in-your-face label for this case, one that nobody can possibly confuse with anything else. If we use this 'style' consistently, might that make code writing somewhat easier? OK, there will have to be some conditionals to test the first element, but is that so bad?

Given that RDF Collections are pretty rare in real world data (in my experience), no that's not so bad.

It also gives a reasonable route to encode RDF Containers (which seem to be equally unpopular, but more common), so it seems like a good idea. 

- Steve

-- 
Steve Harris, CTO, Garlik Limited
1-3 Halford Road, Richmond, TW10 6AW, UK
+44 20 8439 8203  http://www.garlik.com/
Registered in England and Wales 535 7233 VAT # 849 0517 11
Registered office: Thames House, Portsmouth Road, Esher, Surrey, KT10 9AD

Received on Friday, 25 March 2011 17:11:25 UTC