W3C home > Mailing lists > Public > public-hydra@w3.org > June 2014

RE: Relating hydra:Classes to hydra:IriTemplates

From: Markus Lanthaler <markus.lanthaler@gmx.net>
Date: Sun, 22 Jun 2014 22:01:11 +0200
To: <public-hydra@w3.org>
Message-ID: <06bc01cf8e54$b8e75880$2ab60980$@gmx.net>
On 17 Jun 2014 at 12:19, Jindřich Mynarz wrote:
> I was thinking a bit more about relating hydra:Classes to
> hydra:IriTemplates. It seems to me that the intended way how to do
> that is by using hydra:TemplatedLink to mint a property (like
> hydra:search is defined). Consider the following example:

You still have search in mind, right? In my response below, I assume you want to tell a client that the API supports schema:Person and how to find a specific person.


> :simple-search-api a hydra:ApiDocumentation ;
>   hydra:supportedClass schema:Person .
>
> schema:Person a hydra:Class ;
>   :simple-search-person :simple-search-person-template .
>
> :simple-search-person a hydra:TemplatedLink ;
>   # Additional possible assertions:
>   #   rdfs:domain hydra:Class ;
>   #   rdfs:range hydra:IriTemplate ;
>   #   rdfs:subPropertyOf hydra:search ;

That should be enough IMO. You don't really need to describe an operation if all you do is to connect two resources.


>   hydra:supportedOperation :simple-search-person-operation .
> :simple-search-person-operation a hydra:Operation ;
>   hydra:method "GET" ;
>   hydra:returns schema:Person . # or instead hydra:Collection (of
> schema:Persons)?
> 
> :simple-search-person-template a hydra:IriTemplate ;
>   hydra:template "/person{?name}" ;
>   hydra:mapping [
>       a hydra:IriTemplateMapping ;
>       hydra:variable "name" ;
>       hydra:property schema:name ;
>       hydra:required true
>     ] .
>
> However, this example looks a bit convoluted and the
> :simple-search-person-operation seems to be underspecified. I also

Yeah, to be useful, the operation would need to be typed. Something like a FindInstanceOperation...


> thought about relating the hydra:IriTemplate to hydra:Class via
> hydra:supportedProperty mechanism. In this way, hydra:property of the
> hydra:SupportedProperty would link to a hydra:TemplatedLink, as in the
> following example:
> 
> schema:Person a hydra:Class ;
>   hydra:supportedProperty [
>     a hydra:SupportedProperty ;
>     hydra:property :simple-search-person
>   ] .
> :simple-search-person a hydra:TemplatedLink .
> 
> If I approach describing the relation in this way, I don't know how to
> relate a hydra:IriTemplate to the :simple-search-person templated
> link.

Yeah, because you would need to do that on each instance. "supportedProperty" describes what properties instances of that class support respectively what properties are required when used in "expects".



--
Markus Lanthaler
@markuslanthaler
Received on Sunday, 22 June 2014 20:01:42 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 15:53:59 UTC