W3C home > Mailing lists > Public > public-webpayments@w3.org > December 2011

Re: Currency Mints (Re: The UN Millenium declaration)

From: Manu Sporny <msporny@digitalbazaar.com>
Date: Wed, 14 Dec 2011 00:11:38 -0500
Message-ID: <4EE8300A.4030701@digitalbazaar.com>
To: Web Payments <public-webpayments@w3.org>
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"
}

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 05:12:02 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:03:29 UTC