Skip to content

Commit

Permalink
Merge pull request #1229 from visualize-admin/refactor/consider-quad-…
Browse files Browse the repository at this point in the history
…hasunit

chore: Also retrieve dimension units via qudt:hasUnit
  • Loading branch information
bprusinowski authored Oct 19, 2023
2 parents 830dec3 + 440d670 commit 114fe55
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion app/docs/rdf-to-visualize.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion app/rdf/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 3 additions & 1 deletion app/rdf/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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] : [];
};

Expand Down

1 comment on commit 114fe55

@vercel
Copy link

@vercel vercel bot commented on 114fe55 Oct 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

visualization-tool – ./

visualization-tool-ixt1.vercel.app
visualization-tool-git-main-ixt1.vercel.app
visualization-tool-alpha.vercel.app

Please sign in to comment.