- From: James M Snell <jasnell@gmail.com>
- Date: Tue, 2 Sep 2014 15:18:41 -0700
- To: Sam Goto <goto@google.com>
- Cc: ☮ elf Pavlik ☮ <perpetual-tripper@wwelves.org>, "public-socialweb@w3.org" <public-socialweb@w3.org>, "public-social-interest@w3.org" <public-social-interest@w3.org>, Markus Lanthaler <markus.lanthaler@gmx.net>
On Tue, Sep 2, 2014 at 2:07 PM, Sam Goto <goto@google.com> wrote: > [snip] > > > Can you point me to how you deal with input parameters? That is, lets say > that to "search" Tartine Bakery, you take a "query". How does AS2 goes about > that? > > http://schema.org/docs/actions.html > I figured it would be better to send this as a separate reply. Looking through the document referenced above, I have several comments: 1. Consistent Vocabulary Model: The Social WG has decided to move forward with the FPWD of the Activity Streams 2.0 document in time for TPAC. As you know, Activity Streams already has it's own basic vocabulary for things like "displayName", "actor", etc. Schema.org, on the other hand, has it's own overlapping and, at times, incompatible vocabulary model. To show by comparison, the first example below illustrates a schema.org/Action that has already occurred: { "@context": "http://schema.org", "@type": "WatchAction", "actionStatus": "CompletedActionStatus", "agent" : { "@type": "Person", "name": "Kevin Bacon" }, "object" : { "@type": "Movie", "name": "Footloose" }, "startTime" : "2014-03-01" } The equivalent AS2 Activity statement would be: { "actor": { "objectType": "person", "displayName": "Kevin Bacon" }, "verb": "watch", "object": { "objectType": "video", "displayName": "Footloose" }, "startTime": "2014-03-01", "status": "completed" } Using a JSON-LD context it is trivial to map between these two, which is fantastic, but doing so creates an additional burden for the developer. Given that schema.org/Actions are naturally built around the core schema.org vocabulary model, in order for the WG to adopt the schema.org/Actions approach, we would have to reconcile the vocabulary inconsistencies, which I'm not sure I can envision happening any time soon unless the WG can be convinced to do things the schema.org way. 2. potentialAction only seems to only permit a single action: In all of the examples on the schema.org/Actions documentation, potentialAction only appears to allow for a single Action to be attached to an object. For instance, a Movie object might have a potential WatchAction, but what if we need an EditAction, ShareAction, ReviewAction and SaveAction on the same object? Can the value of potentialAction be an array? Right now that's not clear. In the AS2 approach, we deal with that by making the value of "actions" a JSON object. The keys of which are the verb identifiers, the values of those are the entry points. 3. The micro-parsing approach used for <property>-input and <property>-output is a bit... well, hokey. For example: { "@context": "http://schema.org", "@type": "WebSite", "name": "Example.com", "potentialAction": { "@type": "SearchAction", "target": "http://example.com/search?q={q}", "query-input": "required maxlength=100 name=q" } } That "query-input" bit is ugly, especially since I'd have to come along and parse that "required maxlength=100 name=q" string after parsing the JSON. In the current AS2 approach, this would come across like: { "objectType": "http://schema.org/WebSite", "displayName": "Example.com", "actions": { "search": { "objectType": "UrlTemplate", "template": "http://example.com/search{?q}", "parameters": { "q": { "maxLength": 100 } } } } } Because of how the defaults are set up in the current AS2 Action Handlers draft, using the UrlTemplate objectType in this way means that invoking the Action Handler will open a browser context (as opposed to just making an HTTP request). If, however, you needed to pass in the search term as an HTML Form Post, you could change it to: { "objectType": "http://schema.org/WebSite", "displayName": "Example.com", "actions": { "search": { "objectType": "ViewActionHandler", "url": "http://example.com/search", "method": "POST", "expects": { "objectType": "HtmlForm", "parameters": { "q": { "maxLength": 100 } } } } } } As I said in the other response, this is currently just a Work In Progress design, so it definitely has room for improvement. 4. Specific Action Types vs. Generic Action Types: Schema.org currently defines things like "AchieveAction", "AssessAction", "WatchAction, etc. The documentation page you link to currently shows 13 top level Action Types with a number of subtypes below that. Most of those do not define any additional properties but some do (such as TransferAction). The approach AS2 Action Handlers takes, by comparison, is to define a small handful of generic action handler types (HttpAction, ViewAction, EmbedAction, IntentAction) with a few additional objectTypes allowed to cover common cases (such as using UrlTemplate as a shortcut for ViewAction, etc). This decouples the verb identifiers from the entry points themselves. It also allows us to describe the objects and actions in more generalized terms, which has both advantages and disadvantages. The big question becomes: do we need a whole bunch of very specific Action subclasses (the schema.org approach) or do we need a limited number of very generalized action handlers that can be used with any verb identifier? There are arguments that can be made for both but I tend to prefer the more generalized approach. Ultimately, however, the answer could very well be: We need both. Which brings up the final point: 5. Using schema.org/Actions within AS2: This is something that I've touched on in entries to my personal weblog as was mentioned earlier in this thread. Essentially: the AS2 model is defined such that we could literally just drop the schema.org/Action JSON structures directly into as Action Handlers. It could get a bit weird around the edges but it would work. - James
Received on Tuesday, 2 September 2014 22:19:28 UTC