Re: RDF 1.1 JSON Serialisation (RDF/JSON)

On 24/08/2011 05:03, Paul Tyson wrote:
> On Tue, 2011-08-23 at 09:55 +0100, Graham Klyne wrote:
>> Re: http://dvcs.w3.org/hg/rdf/raw-file/default/rdf-json/index.html
>>
>> I'm probably wasting my time saying this, but I personally think that defining a
>> JSON format for RDF triples is missing the point of using JSON at all - it still
>> looks nothing like the kind of JSON a non-RDF developer might produce.
>>
>> I think the effort would be better directed to defining a common RDF-carrying
>> JSON syntax that is closer to what applications might actually use.  An example
>> of the sort of thing I mean is JRON:
>> http://decentralyze.com/2010/06/04/from-json-to-rdf-in-six-easy-steps-with-jron/, which
>> I have used quite successfully to migrate an application using non-RDF JSON to
>> using something that can also be interpreted as RDF.
>>
>> "Sometimes, if you stand in the right place and squint, JSON and RDF line up
>> perfectly."  But the view of RDF triples isn't that place.
>
> Maybe I'm far enough away that jron and the editor's draft look a lot
> alike.

Maybe that's so if you start from RDF.  But less so if you start from 
"colloquial" JSON.  Here's an excerpt from the app in which I adopted JRON, 
after starting with a fairly direct JSON representation.

Original JSON:

{ "shuffl:title":   "Card 1 title"
, "shuffl:tags":    [ "card_1_tag", "yellowtag" ]
, "shuffl:text":    "free-form text here"
}

JRON-encoded for interpretation as RDF:

{ "shuffl:title":   "Card 1 title"
, "shuffl:tags":    [ "card_1_tag", "yellowtag" ]
, "shuffl:text":    "free-form text here"
}

Surprise! They're just the same.

Of course, this ignores many benefits of using RDF, but my point is that it's a 
usable starting point for incrementally realizing those benefits.  If I want to 
assign a URI so I can link to this resource, it's one extra line:

{ "__iri":          "http://example.org/exampledata"
, "shuffl:title":   "Card 1 title"
, "shuffl:tags":    [ "card_1_tag", "yellowtag" ]
, "shuffl:text":    "free-form text here"
}

etc.

So, IMO, it comes down to:  how to existing web application developers using 
JSON for data exchange migrate their applications so that their applications can 
interwork with the world of RDF and the Semantic Web?  For my money, an approach 
like JRON helps a lot.

Once you get to using many of the more advanced features of RDF, I agree the 
differences don't look so significant.

Reflecting on your message, I think the key feature of JRON is that it doesn't 
insist on an explicit RDF subject.  It's maybe a small point technically, but I 
think it's a big deal for dealing with existing JSON.

#g
--

> ----------------
>> From jron step 1:
> { "__repr": "2010-03-06",
>    "__type": "http://www.w3.org/2001/XMLSchema#date" }
>
> As in RDF/JSON:
> { "value": "2010-03-06",
>    "type" : "literal" ,
>    "datatype": "http://www.w3.org/2001/XMLSchema#date" }
> ----------------
>> From jron step 2:
> { "__text": "chat",
>    "__lang": "fr" }
>
> As in RDF/JSON:
> { "value": "chat",
>    "lang": "fr" ,
>    "type" : "literal" }
> ------------------
>> From jron step 3:
> { "foaf_name": "Sandro Hawke",
>       "foaf_knows: { "__node_id": "n102" },
>       "__node_id": "n334" }
> ...
>     { "foaf_name": "Eric Prud'hommeaux",
>       "foaf_knows: { "__node_id": "n334" },
>       "__node_id": "n102" }
>
> As in RDF/JSON:
> { "_:n334" : {
>      "foaf_name": [ {"value" : "Sandro Hawke", "type" : "literal"} ],
>      "foaf_knows": [ {"value" : "_:n102" , "type" : "bnode" } ]
>    },
> ...
>   "_:n102" : {
>     "foaf_name": [ { "value" : "Eric Prud'hommeaux" , "type" : "literal" } ],
>     "foaf_knows: [ { "value" : "_:n334" , "type" : "bnode" } ]
>    }
> }
> ------------------
>> From jron step 4:
> { "foaf_name": "Sandro Hawke",
>         "__iri": "http://www.w3.org/People/Sandro/data#Sandro_Hawke"
>       }
>
> As in RDF/JSON:
> { "_:n334" : {
>   "foaf_name": [ {"value" : "Sandro Hawke", "type": "literal"} ],
>    "http://xmlns.com/foaf/0.1/page" : [ {
>      "value" : "http://www.w3.org/People/Sandro/data#Sandro_Hawke",
>      "type" : "uri" } ]
>    }
> }
> ------------------
> Jron step 5 specifies a prefix mechanism which presumably will be added to RDF/JSON (?)
>
> -------------------
>> From jron step 6:
> { "foaf.name": "Sandro Hawke",
>       "foaf.knows: { "__values": [
>                       { "foaf.name": "Eric Prud'hommeaux" },
>                       { "foaf.name": "Dan Brickley" },
>                       { "foaf.name": "Matt Womer" }
>                    ]}
>     }
>
> As in RDF/JSON:
> { "_:n334" : {
>   "foaf_name": [ {"value" : "Sandro Hawke", "type" : "literal"} ],
>    "foaf.knows: [
>                   { "value" : "_:eric" , "type" : "bnode" },
>                   { "value" : "_:dan" , "type" : "bnode" },
>                   { "value" : "_:matt" , "type" : "bnode" }
>                 ]
>    },
>    "_:eric" : { "foaf.name" : [ {"value" : "Eric Prud'hommeaux","type" : "literal" } ] },
>    "_:dan" : { "foaf.name" : [ { "value" : "Dan Brickley", "type" : "literal" } ] } ,
>    "_:matt" : { "foaf.name" : [ { "value" : "Matt Womer", "type" : "literal" } ] }
> }
> --------------------
>
> OK, so jron step 6 falls flat in RDF/JSON, and step 5 is not designed (yet?).
>
> RDF/JSON is a bit wordier than jron, but they seem to line up on the
> main points.  I don't know why triple structures aren't admitted in
> value arrays--I can see some advantage to flattening the graph to a set
> of subject keys in a root object, but no advantage to prohibiting
> nested syntactic structures that could be processed recursively.
>
> I don't use much json myself, but am looking forward to a standard json
> notation for RDF.  This looks like a good start.
>
> Regards,
> --Paul
>
>
>

Received on Wednesday, 24 August 2011 10:48:33 UTC