- From: Kévin Dunglas <dunglas@gmail.com>
- Date: Mon, 6 Apr 2015 09:49:23 +0200
- To: Dietrich Schulten <ds@escalon.de>
- Cc: Hydra <public-hydra@w3.org>
- Message-ID: <CAOv1iQZotmXh9G1P3HuC7REB5yPV9xHF-tnM35iBZhKC9YTvwA@mail.gmail.com>
Hi Dietrich,
Thank you very much for your explanations. It's clearer now.
In order to reduce the size and complexity of responses when using the API
"the old way" (with a custom client not supporting Hydra vocab at all), do
you know if there is a way to map the current to-many structure in the
context like it's currently done for the to-one:
{
> "@context": {
> "organization": {
> "@id": "#Book/organization",
> "@type": "@id"
> },
> "authors": {
> "@id": "#Book/authors",
> "@type": "@id"
> }
> },
> // It works and is valid
> "organization": "/organizations/22",
> // It doesn't work, is there a way to map a similar structure in the
> context?
> "authors": ["/authors/1", "/authors/22"],
> // It works, but is more complex client-side
> "authors": [{"@id": "/authors/1"}, {"@id": "/authors/22"}]
> }
Best regards,
2015-03-19 18:38 GMT+01:00 Dietrich Schulten <ds@escalon.de>:
> Hi Kévin,
>
> You can embed the two authors on the :authors property, but you have to
> use two json objects with "@id":"/people/1", "@id":"/people/2" properties
> on each object, instead of plain strings. The plain strings are not
> recognized as identifiers in your example.
>
> As I see it, you need no hydra:Collection if you just want to embed a set
> of two items and if you have no requirement to identify the set as an
> entity in its own right.
>
> Otoh, if you want to make the authors a remote collection, you might need
> hydra:collection with :manages block. Please tell us a bit more about your
> use case, if you think you need that. For example, does your :author
> property have an rdfs:range?
>
> HTH,
> Dietrich
>
> Via Boxer senden
> Am 18.03.2015 23:41 schrieb Kévin Dunglas <dunglas@gmail.com>:
>
> Thanks for the link Dietrich. Do you think the new design is ready to be
> implemented or should we keep the current published spec for now?
>
> I'm very interested in feedbacks about JsonLdApiBundle, especially about
> the validity of the generated Hydra and the two issues I posted in my first
> mail (where to put filter definition and how to handle many-to-many
> relations). Can anyone take it a look?
>
> Thank you :)
>
>
>
> 2015-03-11 17:28 GMT+01:00 Dietrich Schulten <ds@escalon.de>:
>
>> Hi Kévin,
>>
>> the wiki description of the collection design is at
>>
>> http://www.w3.org/community/hydra/wiki/Collection_Design
>>
>> The issues are #41 and #42.
>>
>> Best regards,
>> Dietrich
>>
>> On March 9, 2015 9:58:09 PM Kévin Dunglas <dunglas@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I've published a new tool to create hypermedia REST API with the Symfony
>>> framework.
>>> It supports JSON-LD and Hydra and leverages Symfony to make it really
>>> easy to the average web developper to create that kind of API. Even if they
>>> don't share any code, this bundle has been inspirited by Markus's
>>> HydraBundle and can be considered as a HydraBundle on steroid.
>>>
>>> It uses Doctrine, Symfony Serializer (2.7) and Symfony Validator
>>> metadata to generate the Hydra documentation (no need for special
>>> annotations - except for external IRIs -, a typical Doctrine entity class
>>> will works great without any extra work) ; it supports out of the box
>>> serialization and deserialization groups, pagination, filters, errors and
>>> is highly extensible (event system, pluggabbles normalizers).
>>> The code source and the full list of features is available on GitHub:
>>> https://github.com/dunglas/DunglasJsonLdApiBundle
>>>
>>> I've also built a demo API (a bookstore). The source code is also
>>> available on GitHub: https://github.com/dunglas/api-platform
>>> A public endpoint is available here: http://bookstore-api.dunglas.fr
>>> HydraConsole:
>>> http://www.markus-lanthaler.com/hydra/console/?url=http://bookstore-api.dunglas.fr
>>>
>>> It works great with the Hydra console. However, there is two features
>>> not well described in the generated Hydra documentation and I don't know
>>> how to handle that correctly:
>>>
>>> - Filters (ex:
>>> http://bookstore-api.dunglas.fr/organizations?name=another) are not
>>> described in the Hydra documentation. I've read about hydra:search in the
>>> spec but I don't know where is the preferred way to add those definitions.
>>> In hydra:supportedOperation? Do you have an example of an API using
>>> hydra:search available?
>>> - Many-To-Many relations such as the author property in this
>>> document: http://bookstore-api.dunglas.fr/books/2 An hydra
>>> documentation is generated but should be invalid because the collection of
>>> is not recognized by Hydra console. Any hint on how to fix that?
>>>
>>> Any feedback, both on the JSON-LD / Hydra support and on the ease of use
>>> as a web developer is welcome.
>>>
>>> P.S.: I've read on the list about a new Collection format but wasn't
>>> able to find the mail or the issue where it is described, can you send me a
>>> pointer to this new format?
>>>
>>> Best regards,
>>>
>>>
>>> --
>>> Kévin Dunglas
>>>
>>> http://dunglas.fr
>>>
>>>
>
>
> --
> Kévin Dunglas
>
> http://dunglas.fr
>
>
--
Kévin Dunglas
Consultant et développeur freelance
http://dunglas.fr
Received on Monday, 6 April 2015 07:50:12 UTC