Skip to content

Commit

Permalink
Log warnings about langString filters
Browse files Browse the repository at this point in the history
  • Loading branch information
jstcki committed Mar 24, 2021
1 parent e58fe65 commit 619ec5f
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions app/rdf/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,22 @@ const getCubeDimensionValuesWithLabels = async ({
dimensionValueLiterals.length > 0
) {
console.warn(
`WARNING: dimension with mixed literals and named nodes ${dimension.path?.value}`
`WARNING: dimension with mixed literals and named nodes <${dimension.path?.value}>`
);

// console.log(`Named:`);
// console.log(dimensionValueNamedNodes);
// console.log(`Literal:`);
// console.log(dimensionValueLiterals);
}

if (
dimensionValueNamedNodes.length === 0 &&
dimensionValueLiterals.length === 0
) {
console.warn(`WARNING: dimension with NO values ${dimension.path?.value}`);
console.warn(
`WARNING: dimension with NO values <${dimension.path?.value}>`
);
}

const values =
Expand Down Expand Up @@ -315,7 +322,7 @@ const buildFilters = ({
const filterEntries = Object.entries(filters).flatMap(([dimIri, filter]) => {
const cubeDimension = cube.dimensions.find((d) => d.path?.value === dimIri);
if (!cubeDimension) {
console.log(`No cube dimension ${dimIri}`);
console.warn(`WARNING: No cube dimension ${dimIri}`);
return [];
}
const dimension = view.dimension({ cubeDimension: dimIri });
Expand All @@ -326,6 +333,12 @@ const buildFilters = ({

const dataType = cubeDimension.datatype;

if (ns.rdf.langString.equals(dataType)) {
console.warn(
`WARNING: Dimension <${dimIri}> has dataType 'langString'. Filtering won't work.`
);
}

const selectedValues =
filter.type === "single"
? [
Expand Down

0 comments on commit 619ec5f

Please sign in to comment.