diff --git a/app/rdf/queries.ts b/app/rdf/queries.ts index 09b7cae97..30bdc28fd 100644 --- a/app/rdf/queries.ts +++ b/app/rdf/queries.ts @@ -34,6 +34,7 @@ import { isCubePublished, parseCube, parseCubeDimension, + parseRelatedDimensions, } from "./parse"; import { loadDimensionValues, @@ -141,9 +142,19 @@ export const getCubeDimensions = async ({ try { const dimensions = cube.dimensions .filter(isObservationDimension) - .filter((x) => - componentIris ? componentIris.includes(x.path.value) : true - ); + .filter((d) => { + if (componentIris) { + return ( + componentIris.includes(d.path.value) || + parseRelatedDimensions(d).some((r) => + componentIris?.includes(r.iri) + ) + ); + } + + return true; + }); + const dimensionUnits = dimensions.flatMap(getDimensionUnits); const dimensionUnitIndex = index( @@ -494,9 +505,18 @@ export const getCubeObservations = async ({ cache, }); - const cubeDimensions = allResolvedDimensions.filter((d) => - componentIris ? componentIris.includes(d.data.iri) : true - ); + const cubeDimensions = allResolvedDimensions.filter((d) => { + if (componentIris) { + return ( + componentIris.includes(d.data.iri) || + d.data.related.find((r) => componentIris?.includes(r.iri)) + ); + } + + return true; + }); + + componentIris = cubeDimensions.map((d) => d.data.iri); const serverFilters: typeof filters = {}; let dbFilters: typeof filters = {};