Skip to content

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

@RickMoynihan

Description

@RickMoynihan

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions