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

feat(json-jd): Allow ItemList.item to be an external URL #183

Merged
merged 1 commit into from
Apr 30, 2021

Conversation

alastair
Copy link
Member

The CE model of ItemList allowed us to only link to existing items in the CE, but in linked data there's nothing stopping this from linking to an external URL. This allows us to make a list of things external to the CE.
This follows the same pattern that we use in the annotation models where we have separate fields for either a link to an item in the CE, or a text field linking to an external resource.

This PR requires #173 and #182 to be merged before it, and we also need to modify the validUrlFieldTransformer in #173 to also validate this field.

Items in the CE render like this:

{
  "data": {
    "ListItem": [
      {
        "identifier": "bfbb7ff2-ffbd-4b3e-bee8-a7cb0ffd560b",
        "itemUrl": null,
        "item": [
          {
            "identifier": "7c338222-6c68-45ce-a1aa-f2a41a261520"
          }
        ]
      },
      {
        "identifier": "e4c988d6-1428-4985-a4c2-07d5a91740c3",
        "itemUrl": [
          "http://www.w3.org/ns/oa#commenting"
        ],
        "item": []
      }
    ]
  }
}

and as json-ld like this:

{
  "@context": [
    "https://schema.org",
    {
      "dc": "http://purl.org/dc/terms/"
    }
  ],
  "@type": [
    "https://schema.org/ListItem"
  ],
  "dc:modified": "2021-04-10T22:48:12.443000000Z",
  "dc:identifier": "bfbb7ff2-ffbd-4b3e-bee8-a7cb0ffd560b",
  "identifier": "bfbb7ff2-ffbd-4b3e-bee8-a7cb0ffd560b",
  "item": [
    {
      "@id": "http://localhost:4000/7c338222-6c68-45ce-a1aa-f2a41a261520"
    }
  ],
  "dc:created": "2021-04-10T22:48:12.443000000Z",
  "name": "anitem"
}

or

  "@context": [
    "https://schema.org",
    {
      "dc": "http://purl.org/dc/terms/"
    }
  ],
  "@type": [
    "https://schema.org/ListItem"
  ],
  "dc:modified": "2021-04-13T11:56:54.361000000Z",
  "dc:identifier": "e4c988d6-1428-4985-a4c2-07d5a91740c3",
  "identifier": "e4c988d6-1428-4985-a4c2-07d5a91740c3",
  "dc:created": "2021-04-13T11:56:54.361000000Z",
  "name": "some item",
  "item": [
    {
      "@id": "http://www.w3.org/ns/oa#commenting"
    }
  ]
}

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