Re: Alternate routes with the JSON-LD format

You should probably HTTP redirect from the alternate to the canonical URL, so that the @id is consistent with the canonical URL no matter which is requested.

You may add a property like http://schema.org/sameAs to indicate that there is an alternative URL.


-- 
Stian Soiland-Reyes, The University of Manchester
https://www.esciencelab.org.uk/

https://orcid.org/0000-0001-9842-9718

    Please note that I may work flexibly – whilst it suits me to email now, 
    I do not expect a response or action outside of your own working hours.
 

On 2021-07-01, 11:15, "Antoine Bluchet" <antoine@bluchet.fr> wrote:

    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:20:09 UTC