Re: Documenting the type of collections and cardinalities with OWL

Thanks for your reply Markus! It helps a lot.

> It would be great if you could file PR

I'll do it.

> Eventually I'd probably like to support this natively in Hydra.

It would be great. Vocabularies proliferation make the learning curve
harder for web developers.

> This is valid too but why would you use a collection for this instead of
a direct link?

Indeed, my bad we are already using a direct link, I get mixed up.

> Btw. in case you haven't seen it yet, we just started (1st PR under
discussion) developing a reference client in TypeScript. Given your work, I
assume you could contribute quite some experience. Would be great if you
could help us over at

Nice initiative. Is there a document presenting the goals of this tool?
I've already published a library to parse the Hydra documentation (it
powers our admin system and the CRUD generator):
https://github.com/dunglas/api-doc-parser

It's written in ES6 + Flow (not TypeScript) but we will be very happy to
move it to the Hydra org, or merge it with the new client.
Maybe it's a better idea to separate the docs parser and the client (the
client can use the docs parser).

Let me know if I can help.

Best regards.

2017-06-21 20:37 GMT+02:00 Markus Lanthaler <markus.lanthaler@gmx.net>:

> Hi Kévin,
>
> On Wednesday, June 21, 2017 3:05 PM, Kévin Dunglas wrote:
> > A common need of API Platform's [1] users is to be able to retrieve
> > from the Hydra documentation the type of collections (the type of
> > resources contained in hydra:member when it cannot be mixed) as well
> > as the cardinality of relations (to-one or to-many).
>
> It would be great if you could file PR adding a use case for this to
>
>   https://github.com/HydraCG/Specifications/tree/master/drafts/use-cases
>
>
> > There are several issues on our bug tracker about this, and fixing
> > them will also allow to improve our dynamic Hydra-based React admin
> > [2] and our React/Redux app scaffolder [3].
> >
> > Markus pointed out [4] that we could use OWL to define more specific
> > types. I've ended up with the following proposals, but I don't know
> > OWL well.
>
> Yes, OWL definitely works. Eventually I'd probably like to support this
> natively in Hydra.
>
>
> > I would like to have the confirmation that my proposal is
> > valid according to Hydra and OWL.
> >
> > Can someone give a look to the following snippets ?
> >
> > Documentation of the /users URL in the entrypoint (will return a
> > hydra:PagedCollection of #User instances - all keys starting by owl
> > have been added) :
> >
> > ```
> >   {
> >       "@id": "#Entrypoint",
> >       "@type": "hydra:Class",
> >       "hydra:title": "The API entrypoint",
> >       "hydra:supportedProperty": [
> >           {
> >               "@type": "hydra:SupportedProperty",
> >               "hydra:property": {
> >                   "@id": "#Entrypoint/user",
> >                   "@type": "hydra:Link",
> >                   "domain": "#Entrypoint",
> >                   "rdfs:label": "The collection of User resources",
> >                   "rdfs:range": [
> >                     "hydra:PagedCollection",
> >                     {
> >                       "owl:equivalentClass": {
> >                         "owl:onProperty": "hydra:member",
> >                         "owl:allValuesFrom": "#User"
> >                       }
> >                     }
>
> This is fine. The easiest way to check such things in general is to simply
> fire up a reasoner and see whether it makes the desired inferences.
>
>
> > Documentation of a to-one relation (owl:maxCardinality key added):
>
> This is valid too but why would you use a collection for this instead of a
> direct link?
>
>
> Btw. in case you haven't seen it yet, we just started (1st PR under
> discussion) developing a reference client in TypeScript. Given your work, I
> assume you could contribute quite some experience. Would be great if you
> could help us over at
>
>   https://github.com/HydraCG/Heracles.ts
>
>
> Cheers,
> Markus
>
>
> > [1] https://github.com/api-platform/api-platform
> > [2] https://github.com/api-platform/admin
> > [3] https://github.com/api-platform/generate-crud
> > [4] https://github.com/api-platform/core/issues/912#
> issuecomment-273296233
>
>
> --
> Markus Lanthaler
> @markuslanthaler
>
>
>
>
>


-- 
Kévin Dunglas

https://dunglas.fr
Twitter: @dunglas <https://twitter.com/dunglas>
Phone: +33 6 60 91 20 20

Received on Thursday, 22 June 2017 12:47:45 UTC