Re: subject of potentialAction as implied target of Action? (+ @id / url)

On 11/04/2014 11:15 PM, Markus Lanthaler wrote:
> On 4 Nov 2014 at 03:14, ☮ elf Pavlik ☮ wrote:
>> Hello,
>>
>> I fiddle with an example of a Comment which one can like, comment on and
>> perform some other actions/operations.
>>
>> {
>>     "@type": "Comment",
>>     "@id":
>> "https://wwelves.org/perpetual-tripper/61f671f7-5fb5-452a-bccf-153ac5c31b1a",
>>     "url":
>> "http://wwelves.org/perpetual-tripper/61f671f7-5fb5-452a-bccf-153ac5c31b1a",
>>     "sameAs": "http://tiny.cc/ob4oox",
>>     "about": "http://tmblr.co/ZxcvMv1UViUDg",
>>     "author": "https://wwelves.org/perpetual-tripper",
>>     "text": "most web APIs nowadays use JSON, with JSON-LD we can ..."
>>     "potentialAction": [
>>       { "@type": "LikeAction"},
>>       { "@type": "CommentAction" }
>>     ]
>>   }
>> }
>>
>> I would like to use URI of this comment itself as default target for
>> values of potentialAction it advertises, Somehow to infer:
> 
> [...]
> 
>> Would that maybe make sense as a general convention?
> 
> Hydra does exactly that. You just need to replace schema:potentialAction with hydra:operation... obviously you would need to add a bit more information (HTTP method, hydra:expects) to make it usable by tools such as the HydraConsole.

TL;DR We could draw clearer distinction between *social type* of
interaction eg. Like, Comment, Review, Watch and *web plumbing type* -
how do we handle this interaction eg. hydra:Operation, WebMention etc.


To support both Hydra and Schema.org/Action, currently I would need to
'repeat myself':
 {
    "@type": "Comment",
    "@id":
"http://wwelves.org/perpetual-tripper/61f671f7-5fb5-452a-bccf-153ac5c31b1a",
    ...,
    "potentialAction": [
      {
        "@type": "LikeAction",
        "@target":
"http://wwelves.org/perpetual-tripper/61f671f7-5fb5-452a-bccf-153ac5c31b1a"
      },
      {
        "@type": "CommentAction",
        "@target":
"http://wwelves.org/perpetual-tripper/61f671f7-5fb5-452a-bccf-153ac5c31b1a"
     }
    ],
    "operation": [
      { "@type": ["LikeAction", hydra:Operation"] },
      { "@type": ["CommentAction", "hydra:Operation"] }
    ]
 }

Assuming documented elsewhere in machine readable way what LikeAction
and CommentAciton expect, so we just need HTTP URI where we can POST.

Could we make it more DRY where still each [a Comment] can advertise
which actions/operations it supports? But by adding to certain action
types hydra:Operation it would imply target for it and hint existence of
hydra:ApiDocumentation.

 {
    "@type": "Comment",
    "@id":
"http://wwelves.org/perpetual-tripper/61f671f7-5fb5-452a-bccf-153ac5c31b1a",
    ...,
    "potentialAction": [
      { "@type": ["LikeAction", "hydra:Operation"] },
      { "@type": ["CommentAction", "hydra:Operation"] }
    ]
 }

AFAIK hydra doesn't provide mechanism to specify different
*schema:target* of an operation? Thinking about cases when someone wants
to delegate handling API requests to some generic endpoints like
WebMention[1], MicroPub[2], ActivityPump[3], which I would see it in
many cases an easier setup for many people to deploy, comparing to
properly supporting Hydra. So another website not supporting hydra could
support same social interaction using let's say WebMention:

 {
    "@type": "Comment",
    "@id":
"http://wwelves.org/perpetual-tripper/61f671f7-5fb5-452a-bccf-153ac5c31b1a",
    ...,
    "potentialAction": [
      { "@type": ["LikeAction", "indie:WebMention"] },
      { "@type": ["CommentAction", "indie:WebMention"] }
    ]
 }

Or someone could even provide both ways of handling interaction to
support broader audience:

{
   "@type": "Comment",
   "@id":
"http://wwelves.org/perpetual-tripper/61f671f7-5fb5-452a-bccf-153ac5c31b1a",
   ...,
   "potentialAction": [
     {"@type": ["LikeAction", "hydra:Operation", "indie:WebMention"]},
     {"@type": ["CommentAction", "hydra"Operation", "indie:WebMention"]}
   ]
}

While each website can use different mechanism to handle given
interactions, like I tried here using hydra:Operation and WebMention.
Still all those websites can use common social type for interaction, as
I used here schema.org LikeAction and CommentAction.


[1] http://webmention.org | http://webmention.io
[2] micropub.net | http://withknown.com
[3] http://oshepherd.github.io/activitypump/ActivityPump.html

Received on Friday, 7 November 2014 14:28:39 UTC