LDP with JSON-LD … and it looks good !

hello 

I did some experimenting with JSON-LD. With using the @reverse attribute, I can write LDP RDF in an appealing way which has a nice follow-your-nose style (and makes things pretty clear - IMO). 

{
  "@type": "o:Networth",
  "@id": "http://example/nw1",
  "asset" : [ 
      "assets/a1",
      "assets/a2" 
  ],
  "createAndLink": {
    "createsType" : "o:Asset",
    "linkedWith" : "asset",
    "@id" : "http://example/nw1/assets"
  }
}

It shows a Networth which is already linked to 2 Assets. It also advertises its capability to createAndLink new Asset resources. It says that newly created resources will be linked with the 'asset' property from the Networth. 

The createsType attribute is optional. 
It will be important to have a shape/constraints language guiding contents of the POSTed body. 

With a @context added, the JSON-LD above is same as valid LDP triples - see the JSON above in the JSON-LD playground at http://goo.gl/lXDIXx

Extending to cover the case of the Networth directing the case of creating liabilities as well .. 

{
  "@type": "o:Networth",
  "@id": "http://example/nw1",
  "asset": ["assets/a1", "assets/a2"],
  "liability": ["liabilities/l5"],
  "createAndLink": [{
      "createsType": "o:Asset",
      "linkedWith": "asset",
      "@id": "http://example/nw1/assets"
    },{
      "linkedWith": "liability",
      "@id": "http://example/nw1/liabilities"
  }]
}

at http://goo.gl/OgzRcc

Thought it might be of interest. 

Roger

Received on Friday, 28 February 2014 13:54:00 UTC