- From: Melvin Carvalho <melvincarvalho@gmail.com>
- Date: Wed, 14 Dec 2011 15:26:39 +0100
- To: Manu Sporny <msporny@digitalbazaar.com>
- Cc: Web Payments <public-webpayments@w3.org>
On 14 December 2011 06:11, Manu Sporny <msporny@digitalbazaar.com> wrote: > On 12/06/2011 03:55 AM, Melvin Carvalho wrote: >> >> So can I use the following JSON to represent the data structure? >> >> { >> "a": "com:Transfer", >> "com:forTransaction": >> "<http://redbankexample.com/transactions/20110104#7827982>"; >> "com:source": "<http://redbankexample.com/accounts/12345#account>", >> "com:destination": >> "<http://greencardexample.com/accounts/54321#account>", >> "com:amount": "8.00", >> "com:currency": "USD", >> "rdfs:comment": "Transfer of $8.00 on 2010-10-16 at 12:34pm - >> Paying Jane back for pizza last Monday" >> } > > > Close, we've made a couple of changes to the JSON-LD syntax and the > Commerce vocabulary since then. Unfortunately, I think you were looking > at a very old copy of the Commerce vocabulary when putting together your > example. Sorry about that, we've updated the static file to reflect the > latest changes. This is probably what you could do, instead: > > { > "@context": "http://example.com/contexts/IOU", > "@type": "com:Transfer", > "com:forTransaction": > "http://redbankexample.com/transaction/20110104#7827982"; > > "com:source": "http://redbankexample.com/accounts/12345#account", > "com:destination": "http://greencardexample.com/accounts/54321#account", > "com:amount": "8.00", > "com:currency": "USD", > "rdfs:comment": "Transfer of $8.00 on 2010-10-16 at 12:34pm - Paying Jane > back for pizza last Monday" > } > > You could simplify further and get rid of all of the "com" and "rdfs" > prefixes by optimizing the JSON-LD context, by only using terms and > perhaps re-naming "@type" to "type": > > { > "@context": "http://example.com/contexts/IOU", > "type": "com:Transfer", > "forTransaction": > "http://redbankexample.com/transactions/20110104#7827982"; > "source": "http://redbankexample.com/accounts/12345#account", > "destination": "http://greencardexample.com/accounts/54321#account", > "amount": "8.00", > "currency": "USD", > > "comment": "Transfer of $8.00 on 2010-10-16 at 12:34pm - Paying Jane back > for pizza last Monday" > } Thanks Manu, this version looks great. Assume I can replace com:Transfer with just Transfer? > > You could even rename all of the keys up there in the JSON-LD context to > anything that you'd like, but still utilize the underlying commerce > vocabulary. If there is a term that you need that isn't in the commerce > vocabulary, but should exist in there, let us know and we can add it (if > it makes sense to do so). Does that work for you? > > > -- manu > > -- > Manu Sporny (skype: msporny, twitter: manusporny) > Founder/CEO - Digital Bazaar, Inc. > blog: The Need for Data-Driven Standards > http://manu.sporny.org/2011/data-driven-standards/ >
Received on Wednesday, 14 December 2011 14:27:15 UTC