Re: Benchmarking RDF in JSON

On Sat, 12 Nov 2011 13:40:57 -0500
Gregg Kellogg <gregg@kellogg-assoc.com> wrote:

> I could serialize this to JSON-LD using consistent identifiers and
> ordering the data in a way that makes sense for my application:
> 
> {
>   "@context": "http://example.com/context",
>   "@subject": "",
>   "maker": [
>     {
>       "@type": "Person",
>       "homepage": "http://greggkellogg.net/",
>       "name": "Gregg Kellogg"
>     },
>     {
>       "@type": "Person",
>       "homepage": "http://tobyinsker.co.uk/",
>       "name": "Toby Insker"
>     }
>   ]
> }

But you could equally serialise it like this:

{
  "@context": "http://example.com/context",
  "@subject": "",
  "maker": [
    {
      "@type": "Person",
      "homepage": "http://greggkellogg.net/",
      "name": "Gregg Kellogg"
    },
    {
      "@about": "http://tobyinkster.co.uk/#i",
      "@type": "Person",
      "name": "Toby Inkster"
    },
    {
      "@about": "http://tobyinkster.co.uk/#i",
      "homepage": "http://tobyinkster.co.uk/",
    }
  ]
}

... which I believe represents the exact same triples. And then your
function:

> function nameForHomePage(homepage, data) {
>  return $.grep(data["maker"], function(person, ndx) {
>    return ( person["name"] && person["homepage"] ) ;
>  }).shift;
> };

... no longer works on the input. i.e. the function doesn't operate on
JSON-LD, but on a highly constrained subset of JSON-LD. 

If I were serving up data in JSON-LD, and decided I had some extra
information to publish, how can I add it to my JSON output without
risking breaking some of the consumers?

Try typing this at a Linux command line (assuming bash):

	URL=http://danbri.org/
	curl -Ls $URL"/foaf.rdf" |\
	  grep foaf:name |\
	  head -n1 |\
	  sed -r 's/^.*>(.*)<.*/\1/'

It works with http://mmt.me.uk/ too, and http://people.w3.org/amy/. But
as a generalised homepage-to-name function it leaves a lot to be
desired. If consumers start relying on that sort of function, then it
rather constrains the kinds of updates Dan can make to his FOAF file.

-- 
Toby A Inkster
<mailto:mail@tobyinkster.co.uk>
<http://tobyinkster.co.uk>

Received on Saturday, 12 November 2011 21:29:08 UTC