Skip to content

Support for units and currencies #709

@HolgerKnublauch

Description

@HolgerKnublauch

Many properties implicitly assume that values are stored in a certain unit of measurement. For example, some ontologies define properties such as priceUSD or weightKG. It would be better to have this lifted into the ontology itself and made explicit. For example, we could have

ex:Fridge-height
    sh:path ex:height ;
    sh:datatype xsd:decimal ;
    sh:unit "cm" ;    # Or shui:unit   or sh:unitCode
.

This is particularly useful for UI builders, which can render values as "180 cm" instead of just "180". The UI (and server) can also use this info to automatically translate between units, for example to show feet instead of metric units for US visitors.

There are various units ontologies esp QUDT that define proper URIs for these units. However, I think it would be less commitment and more flexible to just use them as strings, because those strings can be mapped to the units as they are standardized already by International System of Units (SI) and ISO. So people can still use QUDT with a simple join in SPARQL.

And we can expect people to add currencies too, such as USD, EUR and AUD and those are more fluent as countries and their financial systems keep evolving.

As the primary use case is for UI, we could elect to move such a property into SHACL UI namespace. However, I think units are so central that they should be promoted to the main sh: namespace because they may be picked up by other algorithms. For example, with temperatures in Kelvin, I think 0 is the implicit sh:minInclusive value. Therefore I suggest we add them to the section that already contains sh:name, sh:codeIdentifier and sh:order.

Metadata

Metadata

Labels

CoreFor SHACL 1.2 Core specUIFor SHACL 1.2 UI spec

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions