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

feat(schema): Add rdau:P60537 (medium of performance) field #173

Merged
merged 2 commits into from
Apr 30, 2021

Conversation

alastair
Copy link
Member

@alastair alastair commented Apr 5, 2021

Fixes #42

Useful in MusicComposition and MediaObject to indicate instrumentation

As discussed in this issue, and in slack recently.

Need confirmation that this is correct in the context:
"rdau": "http://rdaregistry.info/Elements/u/"

We decided to use library of congress performance mediums, but this patch doesn't verify that the value of the field is a URL. If we want to add this we should modify additionalTypeFieldTransformer to be a generic is-a-url transformer checker.

Example mutation:

mutation {
  CreateMusicComposition(
        name: "Prelude number 1 in some key"
        contributor: "https://musicbrainz.org"
        creator: "https://github.com/trompamusic/ce-data-import"
        source: "https://musicbrainz.org/work/some-uuid"
        format: "text/html"
    mediumOfPerformance:["http://id.loc.gov/authorities/performanceMediums/mp2013015550"]
) {
identifier
}
}

resulting json-ld output (edited)

{
  "@context": [
    "https://schema.org/",
    {
      "dc": "http://purl.org/dc/terms/",
      "prov": "http://www.w3.org/ns/prov#",
      "skos": "http://www.w3.org/2004/02/skos/core#",
      "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
      "bib": "https://bib.schema.org/",
      "rdau": "http://rdaregistry.info/Elements/u/"
    }
  ],
  "@type": [
    "https://schema.org/MusicComposition"
  ],
  ... lots of items chopped here
  "rdau:P60537": [
    "http://id.loc.gov/authorities/performanceMediums/mp2013015550"
  ],
  "firstPerformance": null,
  "bitrate": null,
  "dc:language": null,
  "dc:source": "https://musicbrainz.org/work/some-uuid",
  ... lots of items chopped here
  "dc:identifier": "5a5f683f-ebe4-4ee0-975e-21170b44f6d6",
  "identifier": "5a5f683f-ebe4-4ee0-975e-21170b44f6d6",
  "image": null,
  "schema_publisher": [],
  "workExampleMediaObject": [],
  "dc:created": "2021-04-05T15:21:55.292000000Z",
  "dc:format": "text/html",
  ... lots of items chopped here
  "name": "Prelude number 1 in some key",
  ... lots of items chopped here
  "dc:contributor": "https://musicbrainz.org",
  "contributor": "https://musicbrainz.org",
  ... lots of items chopped here
}

Useful in MusicComposition and MediaObject to indicate instrumentation
@alastair alastair requested a review from musicog April 5, 2021 16:07
@musicog
Copy link
Member

musicog commented Apr 6, 2021

Almost perfect :-)

The JSON-LD output needs to produce {"@id": "http://example.org/foo"} objects for external URIs, instead of just "http://example.org/foo", which is otherwise interpreted as a string literal.

@alastair
Copy link
Member Author

alastair commented Apr 6, 2021

The correct output of this field should be:

"rdau:P60537": [
    {"@id": "http://id.loc.gov/authorities/performanceMediums/mp2013015550"}
]

We're going to need a way that indicates to the json-ld serialiser that some fields are IDs instead of string constants. This could be added to the json schema definition file. If we do this then it makes sense that we also validate that the field is a URL, because to be an ID it always must be an external url.

@alastair alastair force-pushed the feat/medium-of-performance branch from 49bf086 to ac61d6b Compare April 12, 2021 07:01
@alastair
Copy link
Member Author

I updated this to add a relationalProperties field to the json definition file that indicates when a field should be rendered as a reference to an external url instead of a string.

I also updated the additionalProperties transformer to turn it into a generic "check is a url" transformer and added the mediumOfPerformance field

@alastair
Copy link
Member Author

@ChristiaanScheermeijer ready for review

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.

LGTM

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.

Controlled vocabulary for instrumentation ("medium of performance")
3 participants