From 3d4f9a8c4baec99eadf7fb4f6c0d129ca61c106e Mon Sep 17 00:00:00 2001 From: Alastair Porter Date: Thu, 4 Feb 2021 15:48:07 +0100 Subject: [PATCH] Add EXAMPLE_OF_WORK relations that link directly to Audio/MediaObject Because workExample links to CreativeWorkInterface, we can't use the auto-generated filters to query a more specific type, e.g.: MusicComposition(filter:{workExample:{contentUrl_not:null}}) doesn't work because contentUrl is part of MediaObject not CreativeWork. We add additional fields using the same relation name that point directly to the concrete types that we use in TROMPA. This means that the workExample relation still works, but if we need to filter on a specific Audio/MediaObject field we can. This isn't very sustainable because we'd have to add it every time we need to do this kind of query to a specific type, but it's a quick fix for our current requirements --- src/schema/type/MusicComposition.graphql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/schema/type/MusicComposition.graphql b/src/schema/type/MusicComposition.graphql index ca20b99..7b1ae2e 100644 --- a/src/schema/type/MusicComposition.graphql +++ b/src/schema/type/MusicComposition.graphql @@ -210,6 +210,10 @@ type MusicComposition implements MetadataInterface & SearchableInterface & Thing video: [VideoObject] @relation(name: "VIDEO", direction: "OUT") "https://schema.org/workExample" workExample: [CreativeWorkInterface] @relation(name: "EXAMPLE_OF_WORK", direction: "IN") + "https://schema.org/workExample" + workExampleMediaObject: [MediaObject] @relation(name: "EXAMPLE_OF_WORK", direction: "IN") + "https://schema.org/workExample" + workExampleAudioObject: [AudioObject] @relation(name: "EXAMPLE_OF_WORK", direction: "IN") "https://bib.schema.org/workTranslation" workTranslation: [CreativeWorkInterface] @relation(name: "WORK_TRANSLATION", direction: "OUT") #######################################