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

RE: hydra:returns for operations returning collections of class instances

From: Markus Lanthaler <markus.lanthaler@gmx.net>
Date: Wed, 18 Jun 2014 23:47:17 +0200
To: <public-hydra@w3.org>
Message-ID: <017e01cf8b3e$e0bb53c0$a231fb40$@gmx.net>
On 18 Jun 2014 at 18:15, Jindřich Mynarz wrote:
> On Wed, Jun 18, 2014 at 2:21 PM, Markus Lanthaler wrote:
>> That's a good question. The "main entity" that is returned is a collection but the thing the
>> client is probably interested in are the instances of :Class. I'd say the best thing would be to
>> be more explicit, i.e., expressing that it returns a Collection of :Class instances. This would
>> be quite trivial to describe with OWL (property restriction on member).
> If you hint to use OWL in this case, do you mean something like the following?

Yes. I'm modifying your examples directly to show you what I had in mind:

  @prefix hydra: <http://www.w3.org/ns/hydra/core#> .
  @prefix owl: <http://www.w3.org/2002/07/owl#> .
  @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

      a hydra:Operation ;
              a owl:Restriction ;
              owl:onProperty hydra:member ;
              owl:allValuesFrom </some/Class>
      ] .

or, in JSON-LD:
    "@context" : {
      "@vocab": "http://www.w3.org/ns/hydra/core#",
      "subClassOf": { "@id": http://www.w3.org/2000/01/rdf-schema#subClassOf", "@type": "@vocab" },
      "owl": "http://www.w3.org/2002/07/owl#",   
      "onProperty": { "@type" : "@vocab" },
      "allValuesFrom": { "@type" : "@id" }
    "@id": "/operation/1",
    "@type": "Operation"
    "returns": {
      "subClassOf": [
          "@type": "owl:Restriction",
          "onProperty": "member",
          "allValuesFrom": "/some/Class"

> I think there may be some minor issues with this design.
> Wouldn't this design lead to proliferation of "collection classes" for
> many popular classes? I can imagine that if this was recommended
> practice, then we could see several classes of collections of
> schema:Person or schema:Product etc.

I don't think so because those classes don't need to have a name (or identifier if you prefer). As you see above, you would just 

> The description is in OWL (albeit in a simple subset) and there might
> be few clients and developers, who create these clients, that read
> OWL. If the main goal is to support a machine-readable API
> description, which is also readable to most web developers, and
> reasoning support isn't required, then OWL might not be the best way
> how to achieve this goal.

Fully agreed. If this feature turns out to be important, we can introduce a shortcut or something directly into Hydra.

> This design doesn't help solving the ISSUE #41 (a.k.a. collections
> breaking relationships), which I think is very much related, so a
> solution to this issue should be aligned with the solution to ISSUE #41.

I think it's a mostly unrelated issue.

Markus Lanthaler
Received on Wednesday, 18 June 2014 21:47:47 UTC

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