Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

We should use @base to shorten @id slugs #349

Open
RickMoynihan opened this issue Jan 31, 2024 · 2 comments
Open

We should use @base to shorten @id slugs #349

RickMoynihan opened this issue Jan 31, 2024 · 2 comments
Assignees

Comments

@RickMoynihan
Copy link
Member

RickMoynihan commented Jan 31, 2024

e.g. in the following request (output elided somewhat for berevity):

curl -X 'GET' \
  'https://dluhc-pmd5-prototype.publishmydata.com/data/English-Indices-of-Deprivation/releases' \
  -H 'accept: application/ld+json' | jq

{
  "contents": [
    {
      "dcterms:modified": "2024-01-31T14:40:43.03714128Z",
      "@id": "English-Indices-of-Deprivation/release/2019",
      "dcterms:title": "2019"
    },
    {
      "dcterms:modified": "2024-01-31T14:40:18.930331568Z",
      "@id": "English-Indices-of-Deprivation/release/2015",
      "dcterms:title": "2015"
    }
  ],
  "@context": {
    "dh": "https://publishmydata.com/def/datahost/",
    "dcterms": "http://purl.org/dc/terms/",
    "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
    "@base": "https://ldapi-prototype.gss-data.org.uk/data/",
    "appropriate-csvw": "https://publishmydata.com/def/appropriate-csvw/",
    "contents": {
      "@id": "dh:collection-contents",
      "@container": "@set"
    },
    "csvw": "http://www.w3.org/ns/csvw#",
    "dcat": "http://www.w3.org/ns/dcat#",
    "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  }
}

The @id is based at /data/ which means they include the path prefix English-Indices-of-Deprivation/release/, I think it would be worth setting the @base in the JSONLD context to English-Indices-of-Deprivation/release so that the @id's can be just 2019 and 2015 respectively.

Reducing the @id to this form will mean they don't need to be parsed to feed back into parameters in the openapi.

This is likely happening for more routes than just this, we should identify them and list them on this issue as a first step.

NOTE: changing this will break the prototype, so if we do it, we will need to update that too.

@kjoshi
Copy link

kjoshi commented Feb 7, 2024

See issue #369 for suggestions/examples of how to nest the @contexts

@RickMoynihan
Copy link
Member Author

For a solution to this problem see my comment on this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants