Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Percentage semantic type #122

Closed
samubura opened this issue Oct 10, 2021 · 3 comments
Closed

Percentage semantic type #122

samubura opened this issue Oct 10, 2021 · 3 comments

Comments

@samubura
Copy link

I feel that having a percentage semantic type would be beneficial for a lot of implementations.
It should be fairly easy to add and can protect integer fields from being misinterpreted when doing computation.
(e.g. a percentage should always be >=0 and <=100)

@briancr-ms
Copy link
Contributor

DTDL v2 supports a percent unit (used with the RelativeHumidity semantic type). Our approach for semantic types (more specifically quantitative types for expressing measurements) has been to use the semantic type to express what the element is measuring (temperature, humidity, etc.) and to use the unit to express the units the measurement is in. Is the quantitative type you're measuring not represented in the set in DTDL v2 (certainly possible since there are many things to measure and DTDL only includes some types)?

@samubura
Copy link
Author

Yeah I wanted to have a property representing the percentage of the battery charge of a device, I understand your approach though and it makes total sense but some "universal" types like this could be a great addition in the future.

@rido-min
Copy link
Member

closing as a dupe of #140

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants