From 4ed5fdf142111baf310aec6ced80dbeeac4cc74a Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Wed, 25 Oct 2023 17:43:03 +0200 Subject: [PATCH] fix: Point to a correct graph to retrieve creator labels --- app/rdf/query-search.ts | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/app/rdf/query-search.ts b/app/rdf/query-search.ts index b6e766b83..2763c4932 100644 --- a/app/rdf/query-search.ts +++ b/app/rdf/query-search.ts @@ -5,7 +5,7 @@ import { Literal, NamedNode } from "rdf-js"; import StreamClient from "sparql-http-client"; import ParsingClient from "sparql-http-client/ParsingClient"; -import { Awaited, truthy } from "@/domain/types"; +import { truthy } from "@/domain/types"; import { RequestQueryMeta } from "@/graphql/query-meta"; import { DataCubePublicationStatus, @@ -178,13 +178,6 @@ export const searchCubes = async ({ ?theme ${ns.schema.name} ?themeName. `)} - ${(creatorValues.length > 0 ? identity : optional)( - sparql` - ?iri ${ns.dcterms.creator} ?creator. - ?creator ${ns.schema.name} ?creatorLabel. - ` - )} - ${makeVisualizeDatasetFilter({ includeDrafts: !!includeDrafts, cubeIriVar: "?iri", @@ -195,9 +188,20 @@ export const searchCubes = async ({ ${makeInFilter("creator", creatorValues)} FILTER(!BOUND(?description) || ?lang = LANG(?description)) - FILTER(!BOUND(?creatorLabel) || ?lang = LANG(?creatorLabel)) FILTER(!BOUND(?themeName) || ?lang = LANG(?themeName)) + ${(creatorValues.length > 0 ? identity : optional)(sparql` + ?iri ${ns.dcterms.creator} ?creator . + GRAPH { + ?creator a ${ns.schema.Organization} ; + ${ns.schema.inDefinedTermSet} . + OPTIONAL { + ?creator ${ns.schema.name} ?creatorLabel . + FILTER(!BOUND(?creatorLabel) || LANG(?creatorLabel) = ?lang) + } + } + `)} + ${ query ? `FILTER(