ISSUE-11: Remove predefined operations from the core vocabulary

> The predefined operations have confused many people as they were regarded as
> the complete set of supported operations.
> 
> In Amsterdam, Ruben and I were inclined to keep them, but make it clearer
> that they can either be specialized or alternatively concepts from, e.g.,
> schema.org can be reused. Now that schema.org has completed their Potential
> Action vocabulary, I think it would be wiser to get rid of them completely.
> 
> PROPOSAL: Remove all *ResourceOperations by replacing them with their
> schema.org counterparts CreateAction (CreateResourceOperation), DeleteAction
> (DeleteResourceOperation), ReplaceAction (ReplaceResourceOperation). As
> Schema.org now has a more or less complete Action model, describe in more
> detail how it can be used with Hydra.
> 
> https://github.com/HydraCG/Specifications/issues/11

It seems to me that schema Actions are a bit different than Hydra Operations. Sub-classes of Operation define method/expects/returns and so-forth, while the schema Action classes define the content of the messages. In this case, it seems to make more sense to use the Action class as the value of expects. For example:

:SportsTeam a hydra:Class;
   hydra:supportedOperation [
     a hydra:Operation;
     hydra:title "Express interest in something"@en;
     hydra:description "Indicate if you like something."@en;
     hydra:expects schema:LikeAction;
     hydra:method "POST";
     hydra:returns schema:UserLikes;
   ] .

schema:LikeAction a hydra:Class;
  hydra:supportedProperty schema:agent, schema:object . # schema:object may be redundant, as it could be inferred to be on the URL to which the message is posted.

You would then know to POST a message containing select properties of a schema:LikeAction, and perhaps get back a schema:UserLikes representation, which would have been added to a collection containing specific property relationships, such as :interestCollection.

It may be that only schema:UpdateAction, and descendants, are appropriate for updating and deleting, and everything else is a kind of create, in which case, only the method property is really needed, and all operations are simply hydra:Operation.

An alternate way to perform this operation might be to do a schema:AddAction on the collection and have schema:object reference a schema:UserLikes instance included along with the message. This could also be done as an operation on the :interestCollection property, but I have to say that the distinction eludes me.

In the schema.org Action examples, it seems that actions do not target the resources they affect, but are sent to some other ActionHandler, and reference the resource they affect. A LikeAction could be sent to some specified handler, and reference the resource I like, rather than being an operation on the resource which I want to indicate a Like (or even on the agent, referencing the resource which is liked).

Gregg Kellogg
gregg@greggkellogg.net

Received on Tuesday, 22 April 2014 22:58:27 UTC