Re: [JSON] RDF collections and JSON arrays

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. The triple-based representation is neither machine, nor human friendly, IMHO.

- Steve

On 2011-03-25, at 08:11, Ivan Herman wrote:

> I agree that having a syntactic sugar for lists would be a good thing, similarly to what Turtle already has.
> 
> The problem is that the list syntax of JSON, ie, '[...]' is would be very useful for cases when we'd want to define shortcuts. Eg, the equivalent of 
> 
> :a :b :c, :d .
> 
> in Turtle would make use of something like '[ :c, :d ]' and I am not sure there is an alternative for that.
> 
> So no, it is not trivial nor obvious... Hence the slightly ugly
> 
> [[ :c,:d ]]
> 
> proposal that came up on the list. I would have to hold by nose looking at that, but I do not see any radically different alternative:-(
> 
> Ivan
> 
> 
> 
> 
> On Mar 25, 2011, at 24:25 , Pat Hayes wrote:
> 
>> Um... I am not sure if this is trivial or obvious, but has the WG thought about the RDF collections vocabulary in the JSON context? Since this is supposed to correspond as nearly as possible to a LISP list, it seems it would be 'natural' for an RDF collection to map into a JSON array. And if this is to round-trip, then these arrays must be somehow marked as coming from an RDF collection so that they can be mapped back into one. 
>> 
>> I wish I had something more constructive to offer on this point, but I don't, other than to suggest it might turn out to be important, since the collection vocabulary is used to extensively in the OWL/RDF syntax. While OWL is not a prime target for our WG, it would seem to be a good idea to define a JSON mapping which does not completely screw up OWL, if at all possible. 
>> 
>> Just a 2c observation.
>> 
>> Pat
>> ------------------------------------------------------------
>> IHMC                                     (850)434 8903 or (650)494 3973   
>> 40 South Alcaniz St.           (850)202 4416   office
>> Pensacola                            (850)202 4440   fax
>> FL 32502                              (850)291 0667   mobile
>> phayesAT-SIGNihmc.us       http://www.ihmc.us/users/phayes
>> 
>> 
>> 
>> 
>> 
>> 
> 
> 
> ----
> Ivan Herman, W3C Semantic Web Activity Lead
> Home: http://www.w3.org/People/Ivan/
> mobile: +31-641044153
> PGP Key: http://www.ivan-herman.net/pgpkey.html
> FOAF: http://www.ivan-herman.net/foaf.rdf
> 
> 
> 
> 
> 

-- 
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 08:34:29 UTC