CentreForDigitalHumanities / CentreForDigitalHumanities/EDPOP
Add a centralized context for all JSON-LD data
- Dominant language
- Python
- Stars
- 1
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
An increasing number of backend views sets an `@context` while sending JSON-LD data to the frontend. The status quo is that there is a constant at module scope that is used as the context for all `RDFView` and `RDFResourceView` subclasses in that module. This a source of both redundancy and inconsistency. It also means that these ad-hoc contexts have to be included in the payload in every request and response.
A better situation would be to have a single (static or dynamic) route that resolves to just a JSON-LD context object. All other code in the application could then just reference the URL of that route instead of having to include the context object itself. In other words, the context becomes something like `"@context": "//path/to/context(.json)"` rather than `"@context": {... (big object) ...}`.
One "catch" with a centralized context behind a URL is that rdflib will have to dereference that URL in order to parse and serialize requests and responses. This won't be a problem if the context is cached, but otherwise, it might slow down the request cycle too much.
Contributor guide
No contributing guide indexed for this repository
Research direction
Locate the modules defining RDFView and RDFResourceView, then inspect their module-scope @context constants and how JSON-LD payloads are assembled. Determine the route shape and caching approach before implementation; done means the application can reference one centralized JSON-LD context URL without repeating the context object in requests and responses.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100