diff --git a/CHANGELOG.md b/CHANGELOG.md index f50816e50..8ac6c7293 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ You can also check the [release page](https://github.com/visualize-admin/visuali - Style - Map now outlines shapes on hover, instead of changing their colors +- Maintenance + - Added retrieval of dimension units via `qudt:hasUnit` (but kept `qudt:unit` for backward compatibility) # [3.23.0] - 2023-10-17 diff --git a/app/docs/rdf-to-visualize.mdx b/app/docs/rdf-to-visualize.mdx index d6d3dc25a..2554dba3c 100644 --- a/app/docs/rdf-to-visualize.mdx +++ b/app/docs/rdf-to-visualize.mdx @@ -244,7 +244,7 @@ the charts that rely on those cubes will continue to work. not work anymore. Here are the properties of a dimension that should not change: - `a`: Dimension type - - `qudt:unit`: Unit + - `qudt:hasUnit`: Unit - `qudt:scaleType`: Scale type - `shacl:datatype`: Data type - `meta:dataKind`: Data kind diff --git a/app/rdf/parse.ts b/app/rdf/parse.ts index 81cfaad00..eb93b33cc 100644 --- a/app/rdf/parse.ts +++ b/app/rdf/parse.ts @@ -244,7 +244,8 @@ export const parseCubeDimension = ({ .out(ns.rdf.type) .terms.some((t) => t.equals(ns.cube.MeasureDimension)); - const unitTerm = dim.out(ns.qudt.unit).term; + // Keeping qudt:unit format for backwards compatibility. + const unitTerm = dim.out(ns.qudt.unit).term ?? dim.out(ns.qudt.hasUnit).term; const unit = unitTerm ? units?.get(unitTerm.value) : undefined; const unitLabel = unit?.label?.value; diff --git a/app/rdf/queries.ts b/app/rdf/queries.ts index eeafe9469..c55ea0b7b 100644 --- a/app/rdf/queries.ts +++ b/app/rdf/queries.ts @@ -123,7 +123,9 @@ export const getResolvedCube = async ({ }; const getDimensionUnits = (d: CubeDimension) => { - const t = d.out(ns.qudt.unit).term; + // Keeping qudt:unit format for backwards compatibility. + const t = d.out(ns.qudt.unit).term ?? d.out(ns.qudt.hasUnit).term; + return t ? [t] : []; };