Re: the terms for to and from

On 29 November 2012 19:09, Manu Sporny <msporny@digitalbazaar.com> wrote:

> On 11/29/12 11:17, Melvin Carvalho wrote:
> > I've been looking at the terms 'to' and 'from' wrt a transfer in
> > webcredits / opentransact / payswarm and pingback ongologies
> >
> > Payswarm uses
> >
> > source destination
>
> Note that since PaySwarm uses JSON-LD, the developer can change this to
> anything that they want to. You can just as easily do this:
>
> {
>   'id': 'http://bluebank.com/transactions/329873',
>   'source': 'http://payswarm.example.com/accounts/blue',
>   'destination': 'http://redbank.com/accounts/red',
>   'amount': '50.43',
>   'currency': 'USD'
> }
>
> as this:
>
> {
>   'id': 'http://bluebank.com/transactions/329873',
>   'from': 'http://payswarm.example.com/accounts/blue',
>   'to': 'http://redbank.com/accounts/red',
>   'amount': '50.43',
>   'currency': 'USD',
> }
>
> You just need to declare this context for the first example:
>
> '@context': {
>   '@id': 'id',    // alias @id to id
>   'source': {
>     '@id': 'http://purl.org/commerce#source',
>     '@type': '@id' // source is an IRI
>   },
>   'destination': {
>     '@id': 'http://purl.org/commerce#destination',
>     '@type': '@id' // destination is an IRI
>   },
>   ...
> }
>
> and this context for the second one:
>
> '@context': {
>   'from': {
>     '@id': 'http://purl.org/commerce#source',
>     '@type': '@id' // from is an IRI
>   },
>   'to': {
>     '@id': 'http://purl.org/commerce#destination',
>     '@type': '@id' // to is an IRI
>   },
>   ...
> }
>
> Ultimately, it's up to the developers to pick what they'd like... a
> PaySwarm service consuming an object like the above could accept either.
> As for preference, I personally don't have any strong feelings one way
> or the other. Pelle's argument about it being similar to e-mail is the
> argument that is resonating the most with me regarding changing it in
> the spec. My concern is that it's too generic and some people might be
> annoyed that we've squatted on something as generic as 'to' and 'from'
> and that they'd want to use those keywords in their application.
> However, the same argument could be made for 'source' and 'destination'.
>
> One compromise would be allowing 'source', 'destination', 'to', and
> 'from' in the PaySwarm JSON-LD context. That would allow the developer
> to use whatever they wanted to use... but then, it would be a failure to
> standardize on something. :P
>

Thanks Manu, yes there is the a lot of flexibility when you use @context.

Using the 'to' and 'from' would be to make things more intuitive in the
examples.  For example

- naming fields in JSON
- naming fields in an HTML form
- naming fields in an API (e.g. like OpenTransact)
- naming fields in a relational database

I also like the email analogy.  Ie I can send you an email, and 'attach' a
payment and also I could use exactly the same system to send a web style
email.  As you say there's the risk of collision too ... so tricky


>
> -- manu
>
> --
> Manu Sporny (skype: msporny, twitter: manusporny)
> President/CEO - Digital Bazaar, Inc.
> blog: HTML5 and RDFa 1.1
> http://manu.sporny.org/2012/html5-and-rdfa/
>

Received on Friday, 30 November 2012 10:21:13 UTC