Skip to content

feat: ontology used configured at field level

Context

in order to make the output per-field DFC-compliant we need the fields to match the correct ontology, e.g. (from the Swagger docs)

{
    "@context": "https://www.datafoodconsortium.org",
    "dfc-b:email": "hello@example.org",
    "ofn:contact_name": "Fred Farmer"
}

Currently our output looks more like this:

{
    "@context": "https://cdn.startinblox.com/owl/context.jsonld",
    "email": "hello@example.org",
    "contact_name": "Fred Farmer"
}

How

  • Override Django's Field to add the attribute rdf_type
  • Extend LDPSerializer to allow for the field data to be moved according to this property

This MR does also fix some test pollution found in DjangoLDP tests during the development, and it improves the compliance to Python's style guide (PEP 8), without formatting everything.

Edited by Calum Mackervoy

Merge request reports

Loading