Re: [JSON] Tiny Proposal -- rdf:Lists, property types

On Wed, 2011-03-23 at 19:38 +0000, Nathan wrote:
> Peter Frederick Patel-Schneider wrote:
> > From: Nathan <nathan@webr3.org>
> > Subject: [JSON] Tiny Proposal
> > Date: Wed, 23 Mar 2011 13:14:00 -0500
> > 
> >> 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).
> > 
> > Do you mean here that no arrays are allowed at all?  Why?  Can't arrays
> > turn into lists?
> 
> Yes arrays are allowed, as for lists how would one distinguish between 
> multiple values and a list?
> 
> x y "a", "b", "c" .
> x y ( "a" "b" "c" ) .
> 
> would both be
> {
>   "@id": "x",
>   "y": ["a","b","c"]
> }
> 
> One approach is to double wrap lists [["a","b","c"]], another is to 
> infer from the range of a property.

I don't think either of those options works.   A double list could be a
list of lists, which is a perfectly reasonable thing to have.  And using
the range of the property, while tempting ... well, it raises a whole
lot of problems -- like OWL DL not allowing list ranges, and the general
idea that you'd have to do ontology reasoning in your parser.

I do see two solution, though.  The first is what I put in JRON:

x y ( "a" "b" "c" ) .
==>
{ "_id": "x",
  "y": "a","b","c"]
}

and

x y "a", "b", "c" .
==>
{ "_id": "x",
  "y": {"_values":["a","b","c"]}
}

It's not exactly pretty, but I figured JSON people don't ever give
properties multiple values so for them this will never come up.  That
is, no where in the facebook, twitter, flickr, foursquare, etc, APIs,
would you ever see _values, since they don't model with multiple values
now - they only use lists.  (I'm just assuming here, actually.  It's
possible they have some explicit notion of unordered lists, I guess.)

The solution I actually prefer, though, is to put an explicit
conversion step into the @context, associated with each property.   It
would be somewhat like a "range" but not an RDFS range - just a json
type conversion.  You could use it for lists like this, but also for
things like dates, double-vs-decimal-vs-float, and even IRI-vs-string. 

(Of course, I also want to use this for RDFa, to deal with OGP's
non-RDF modeling, as in [1].   I dunno, maybe it can use rdfs:range, but
it will be very tricky.)

    -- Sandro

[1] http://decentralyze.com/2010/11/10/simplified-rdf/

Received on Friday, 8 April 2011 05:14:11 UTC