W3C home > Mailing lists > Public > public-linked-json@w3.org > July 2021

Alternate routes with the JSON-LD format

From: Antoine Bluchet <antoine@bluchet.fr>
Date: Thu, 01 Jul 2021 09:59:40 +0000
To: "public-linked-json@w3.org" <public-linked-json@w3.org>
Message-ID: <gQtq2VcLSDpXQlXEjeVEiZVcb0RMnjjjLrpWpYxzIgutjgFdvlZPopbJibyoVa2jZioNQ0KX2fMQfqcLnRfowQ2KEea9HFAks0JFWzSbZ5Y=@bluchet.fr>
Hello,

I'm working on the API Platform framework where our preferred format is JSON-LD. We want to refactor how our "Resources" are defined and we're introducing the concept of "Alternate Routes". Let's say we have an Answer resource, that you can request through "/answers/1", the response is:

    {
      "@context": "/contexts/Answer",
      "@id": "/answers/1",
      "@type": "Answer",
      "content": "42",
      "question": "/questions/1"
    }

We now define an Alternate route "/questions/1/answer". The answer is the same but we're wondering what the "@id" should be:

Answer A:

    {
      "@context": "/contexts/Answer",
      "@id": "/questions/1/answer",
      "@type": "Answer",
      "content": "42",
      "question": "/questions/1"
    }

Answer B:

    {
      "@context": "/contexts/Answer",
      "@id": "/answers/1",
      "@type": "Answer",
      "content": "42",
      "question": "/questions/1"
    }

Thank you for your insight on the subject.
Received on Thursday, 1 July 2021 10:14:25 UTC

This archive was generated by hypermail 2.4.0 : Thursday, 1 July 2021 10:14:26 UTC