Skip to content
This repository has been archived by the owner on Jun 22, 2023. It is now read-only.

Improve JSON-LD output for itemlists #207

Merged
merged 6 commits into from
Jul 13, 2021

Conversation

alastair
Copy link
Member

@alastair alastair commented Jun 28, 2021

Some improvements and bug fixes for json-ld output

  • Some nodes don't serialise to json-ld #193 - only serialise datetime fields to iso8601 if the date field is non-null
  • When serialising a DefinedTermSet, ensure that its @type includes oa:Motivation if the DefinedTermSet is being used as a motivation
  • when we move additionalType values to @type, delete additionalType afterwards
  • Make ItemList serialisation more detailed - details below.

Within schema.org, it is possible to have:

ItemList
   itemListElement -> directly linking to another item in the CE

or

ItemList
   itemListElement (a ListItem)
       item -> this is a link to another item in the CE

We standardised on the second solution because ListItem contains the position property which allows us to have ordered lists.

The CE's Json-ld output only goes "one level" deep when rendering an output. This means that we end up with something like this:

{"name": "our list", "itemListElement": [{"@id": "listitem-id"}, {"@id": "listitem-id2"}] }

in this case, the ids are of the ListItem. In order to get information about the actual things that these items refer to, an agent would have to first query the ItemList, then query each of the ListItems to get the ids of the actual targets, and then again make a query to each of these final target objects.

In order to minimise the number of queries that an agent has to do, we bring the information for each ListItem into the json for the ItemList, so we end up with something like:

{"name": "our list", "itemListElement": [
    {"@id": "listitem-id", "item": {"@id": "the thing's id"}}, 
    {"@id": "listitem-id2", "item": {"@id": "another thing's id"}}
]
}

alastair added 6 commits June 28, 2021 12:06
In the case that a list has items, we should also include information
about those items in the output, rather than requiring clients to
perform an additional query per item to get that information
After using the previous model we realised that it made more sense to
have a DTS as the equivalent of an annotation "motivation", and use a
related term as the annotation's body.
This moves broaderUrl and broaderMotivation from DT to DTS, and changes
supporting code
Copy link
Collaborator

@ChristiaanScheermeijer ChristiaanScheermeijer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@ChristiaanScheermeijer ChristiaanScheermeijer merged commit ec54f6b into staging Jul 13, 2021
@ChristiaanScheermeijer ChristiaanScheermeijer deleted the feat/jsonld-output branch July 13, 2021 12:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants