Re: Offer/Demand & potentialAction -> TradeAction/TransferAction

On Wed, Jul 2, 2014 at 6:48 AM, ☮ elf Pavlik ☮ <
perpetual-tripper@wwelves.org> wrote:

> I struggle to understand how (if) Actions can work together with
> Offer/Demand. In particular TradeAction/TransferAction seem to have some
> potential to work together with Offer/Demand...
>
> Looking at: Thing > Action > TransferAction > GiveAction
> http://schema.org/GiveAction
> "The act of transferring ownership of an object to a destination.
> Reciprocal of TakeAction."
>
>
> For example: https://gist.github.com/elf-pavlik/848d332d2259ffe9199e
>
> *Jane Doe gave a Fairphone to elf Pavlik*
>
> {
>   "@id": "https://example.net/jane/actions/12345",
>   "@type": "GiveAction",
>   "recipient": {
>     "@id": "https://wwelves.org/perpetual-tripper",
>     "@type": "Person",
>     "name": "elf Pavlik"
>   },
>   "agent": {
>     "@id": "https://example.net/jane",
>     "@type": "Person",
>     "name": "Jane Doe"
>   },
>   "object": {
>     "@id": "https://example.net/jane/assets/231231",
>     "@type": "IndividualProduct",
>     "model": {
>       "@id": "http://fairphone.com/v1",
>       "@type": "ProductModel",
>       "name": "Fairphone V1"
>   }
> }
>
> To arrive at to this point in real world scenario, I would need to
> publish a Demand and/or Jane would need to publish an Offer. At the same
> time looking at Actions, using *potentialAction* seems an attractive
> option when publishing list of assets:
>
> https://gist.github.com/elf-pavlik/f26562c3c1719bf06273
> {
>   "@id": "https://example.net/jane/assets/231231",
>   "@type": "IndividualProduct",
>   "model": {
>     "@id": "http://fairphone.com/v1",
>     "@type": "ProductModel",
>     "name": "Fairphone V1"
>   },
>   "potentialAction": [
>     {
>       "@type": "GiveAction",
>       "object": "https://example.net/jane/assets/231231"
>     },
>     {
>       "@type": "BorrowAction",
>       "object": "https://example.net/jane/assets/231231"
>     },swee
>     {
>       "@type": "UseAction",
>       "object": "https://example.net/jane/assets/231231"
>     }
>   ]
> }
>

When an action is attached to a Thing via potentialAction, the "object"
property refers back to the entity/resource. So, you can write this as:

{
  "@id": "https://example.net/jane/assets/231231",
  "@type": "IndividualProduct",
  "model": {
    "@id": "http://fairphone.com/v1",
    "@type": "ProductModel",
    "name": "Fairphone V1"
  },
  "potentialAction": [
    {
      "@type": "GiveAction",
    },
    {
      "@type": "BorrowAction",
    },
    {
      "@type": "UseAction",
    }
  ]
}

And that's equally expressive.


>
> I wonder how it could fit with Offer/Demand
>
> {
>   "@id": "https://example.net/jane/listings/5939304",
>   "@type": "Offer",
>   "seller": "https://example.net/jane",
>   "itemOffered": {
>     "@id": "https://example.net/jane/assets/231231",
>     "@type": "IndividualProduct",
>     "model": {
>       "@id": "http://fairphone.com/v1",
>       "@type": "ProductModel",
>       "name": "Fairphone V1"
>     },
>   }
> }
>
> schema:TradeAction already enables schema:price (not sure why not
> schema:priceSpecification ?)


Yeah, we may have overlooked that. I'd be open to making "price" take a
PriceSpecification instead.


> which in a way suggests this possibility:
>
> {
>   "@type": ["GiveAction", "Offer"],
>

Yeah, the dual typing here was discussed in the past. We run into this
problem (i.e. a noun that is almost a 1:1 mapping with a verb) in multiple
occasions. For example: Order vs OrderAction, Reservation vs ReserveAction
and Review vs ReviewAction.

We did consider having the verbs inherit from the nouns (e.g. ReviewAction
inheriting from Review, inheriting all of its properties) and
sub-property-of the properties of the action types.

I agree that we don't have yet a clear story on this subject yet.


>   "object": {
>     "@id": "https://example.net/jane/assets/231231",
>     "@type" "IndividualProduct"
>   },
>   "actionStatus": {"@type": "PotentialActionStatus"},
>   "agent": {
>     "@type": "Person",
>     "@id": "https://example.net/jane",
>     "name": "Jane Doe"
>   }
> }
>
> I like schema:object here which also fits nicer then schema:itemOffered
> when used in schema:Demand
> Similar schema:agent provides generic alternative to schema:seller
> (which I find somehow confusing when used in Demand!)
>
> {
>   "@type": ["ReceiveAction", "Demand"],
>   "object": {
>     "@id": "https://example.net/jane/assets/231231",
>     "@type" "IndividualProduct"
>   },
>   "actionStatus": {"@type": "PotentialActionStatus"},
>   "agent": {
>     "@type": "Person",
>     "@id": "https://wwelves.org/perpetual-tripper",
>     "name": "elf Pavlik"
> }
>

There is a notion of "executable" for potential actions that I think needs
to be present here somehow. That is, while Demand/Offer tells you "what"
can be done it doesn't tell you the "how" (e.g. hypermedia controls). That
is, in your examples, I'm missing the "how" to complete/execute the
potential action, possibly because there isn't a "target" associated with
the actions. So, for example, the following is what I was expecting to find:

{
  @type: IndividualProduct,
  potentialAction: {
    @type: GiveAction,
     target: {
       urlTemplate: "http://example.com/products/123/give",
       httpMethod: "POST"
     },
     recipient: {
       @type: Person,
       name-input: "required name='recipient'"
     }
  }
}

Which would give you the information you need to "execute" a "giving" via
asking the user who is the "recipient" and making a POST request to an
EntryPoint.


> Maybe also Offer/Demand could in a way 'mint' Trade/Transfer Actions...
>
> I try lately to follow developments in Hydra CG[1], now together with
> Linked Data Fragments[2]. I see there strong emphasis on Hypermedia
> Controls[3] and building around Actions looks like a nice fit[4]
>

Yep, actions is deliberately based on hypermedia controls [3] and we worked
very closely with [4] to get this going. Mike Amundsen, too,
participated/contributed.


>
> Any thoughts?

:)
>
> [1] http://www.hydra-cg.com/
> [2] http://linkeddatafragments.org/
> [3] https://sites.google.com/site/restframework/hypermedia-controls
> [4] http://www.hydra-cg.com/spec/latest/schema.org/
>
>

Received on Wednesday, 2 July 2014 18:25:48 UTC