unitsml 0.4.7 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/docs/README.adoc +104 -2
- data/lib/unitsml/dimension.rb +1 -1
- data/lib/unitsml/fenced.rb +77 -0
- data/lib/unitsml/formula.rb +21 -8
- data/lib/unitsml/intermediate_exp_rules.rb +35 -0
- data/lib/unitsml/parse.rb +16 -25
- data/lib/unitsml/parser.rb +19 -4
- data/lib/unitsml/prefix.rb +10 -10
- data/lib/unitsml/transform.rb +31 -0
- data/lib/unitsml/unit.rb +29 -7
- data/lib/unitsml/unitsdb/dimension.rb +12 -18
- data/lib/unitsml/unitsdb/dimension_quantity.rb +2 -6
- data/lib/unitsml/unitsdb/dimensions.rb +4 -8
- data/lib/unitsml/unitsdb/prefix_reference.rb +23 -0
- data/lib/unitsml/unitsdb/prefixes.rb +19 -5
- data/lib/unitsml/unitsdb/quantities.rb +6 -4
- data/lib/unitsml/unitsdb/unit.rb +21 -0
- data/lib/unitsml/unitsdb/units.rb +20 -17
- data/lib/unitsml/unitsdb.rb +8 -4
- data/lib/unitsml/utility.rb +36 -44
- data/lib/unitsml/version.rb +1 -1
- data/lib/unitsml.rb +34 -16
- data/unitsdb/LICENSE.md +53 -0
- data/unitsdb/README.adoc +1071 -0
- data/unitsdb/RELEASE-NOTES.adoc +269 -0
- data/unitsdb/dimensions.yaml +1255 -602
- data/unitsdb/prefixes.yaml +742 -301
- data/unitsdb/quantities.yaml +3104 -2458
- data/unitsdb/scales.yaml +97 -0
- data/unitsdb/schemas/README.md +159 -0
- data/unitsdb/schemas/dimensions-schema.yaml +157 -0
- data/unitsdb/schemas/prefixes-schema.yaml +159 -0
- data/unitsdb/schemas/quantities-schema.yaml +120 -0
- data/unitsdb/schemas/scales-schema.yaml +109 -0
- data/unitsdb/schemas/unit_systems-schema.yaml +120 -0
- data/unitsdb/schemas/units-schema.yaml +219 -0
- data/unitsdb/spec/units_spec.rb +11 -10
- data/unitsdb/unit_systems.yaml +73 -15
- data/unitsdb/units.yaml +12566 -9974
- data/unitsdb/validate_schemas.rb +208 -0
- data/unitsml.gemspec +2 -1
- metadata +34 -6
- data/unitsdb/docs/README.adoc +0 -12
- data/unitsdb/docs/navigation.adoc +0 -7
data/unitsdb/README.adoc
ADDED
@@ -0,0 +1,1071 @@
|
|
1
|
+
= UnitsDB
|
2
|
+
|
3
|
+
== Purpose
|
4
|
+
|
5
|
+
This data repository is used in conjunction with UnitsML.
|
6
|
+
|
7
|
+
Sources include:
|
8
|
+
|
9
|
+
* https://www.bipm.org/en/publications/si-brochure/[BIPM SI Brochure]
|
10
|
+
* https://www.nist.gov/pml/special-publication-811[NIST SP 811]
|
11
|
+
* ISO 80000 series
|
12
|
+
* (in some cases, "Encyclopaedia of Scientific Units, Weights and Measures, Their SI Equivalences and Origins" by François Cardarelli, is consulted)
|
13
|
+
|
14
|
+
NOTE: Conversion factors here are not updated with the revised SI.
|
15
|
+
|
16
|
+
== Structure
|
17
|
+
|
18
|
+
This repository contains the following YAML files:
|
19
|
+
|
20
|
+
`dimensions.yaml`:: Contains the base dimensions and their symbols.
|
21
|
+
|
22
|
+
`prefixes.yaml`:: Contains the SI prefixes and their symbols.
|
23
|
+
|
24
|
+
`scales.yaml`:: Contains the measurement scale types and their properties.
|
25
|
+
|
26
|
+
`units.yaml`:: Contains the units and their symbols, with English and French
|
27
|
+
names. French translations come from BIPM.
|
28
|
+
|
29
|
+
`unit_systems.yaml`:: Contains the unit systems and their symbols.
|
30
|
+
|
31
|
+
`quantities.yaml`:: Contains the quantities and their symbols, with English and
|
32
|
+
French names. French translations come from BIPM.
|
33
|
+
|
34
|
+
|
35
|
+
== Supported languages
|
36
|
+
|
37
|
+
The database currently supports the following languages:
|
38
|
+
|
39
|
+
* English (en): Primary language for all entries
|
40
|
+
|
41
|
+
* French (fr): Provided for units and quantities, sourced from the BIPM SI
|
42
|
+
Digital Framework
|
43
|
+
|
44
|
+
|
45
|
+
== Versioning
|
46
|
+
|
47
|
+
=== Version scheme
|
48
|
+
|
49
|
+
UnitsDB follows semantic versioning (https://semver.org/[SemVer]) using a
|
50
|
+
`MAJOR.MINOR.PATCH` structure.
|
51
|
+
|
52
|
+
Where,
|
53
|
+
|
54
|
+
`MAJOR`:: Incremented for incompatible changes that may require updates to consuming applications
|
55
|
+
|
56
|
+
`MINOR`:: Incremented for backwards-compatible additions or changes
|
57
|
+
|
58
|
+
`PATCH`:: Incremented for backwards-compatible bug fixes
|
59
|
+
|
60
|
+
|
61
|
+
=== Version field
|
62
|
+
|
63
|
+
Each YAML file in the database contains a `schema_version` field (string) at the
|
64
|
+
top level.
|
65
|
+
|
66
|
+
[source,yaml]
|
67
|
+
----
|
68
|
+
schema_version: "2.0.0"
|
69
|
+
dimensions:
|
70
|
+
# content follows
|
71
|
+
----
|
72
|
+
|
73
|
+
The version number is consistent across all files in a given release, ensuring
|
74
|
+
the database is treated as a cohesive unit.
|
75
|
+
|
76
|
+
=== Version changes
|
77
|
+
|
78
|
+
[cols="1,3a"]
|
79
|
+
|===
|
80
|
+
|Version level |Types of changes
|
81
|
+
|
82
|
+
|`MAJOR`
|
83
|
+
|
|
84
|
+
* Structural changes to the data model
|
85
|
+
* Removal of units, dimensions, or quantities
|
86
|
+
* Changes to identifier schemes
|
87
|
+
* Any other backwards-incompatible changes
|
88
|
+
|
89
|
+
|`MINOR`
|
90
|
+
|
|
91
|
+
* Addition of new units, dimensions, or quantities
|
92
|
+
* Addition of new properties to existing entities
|
93
|
+
* Other backwards-compatible enhancements
|
94
|
+
|
95
|
+
|`PATCH`
|
96
|
+
|
|
97
|
+
* Corrections to symbols, names, or other properties
|
98
|
+
* Fixes to references between entities
|
99
|
+
* Other backwards-compatible fixes
|
100
|
+
|
101
|
+
|===
|
102
|
+
|
103
|
+
=== Version usage
|
104
|
+
|
105
|
+
Applications consuming UnitsDB should:
|
106
|
+
|
107
|
+
. Check the `schema_version` field to ensure compatibility, ensure all files are
|
108
|
+
consistent with the same version
|
109
|
+
. Handle version transitions appropriately based on the semantic versioning rules
|
110
|
+
. Document which version(s) of UnitsDB they support
|
111
|
+
|
112
|
+
== Content classes
|
113
|
+
|
114
|
+
=== Basic structures
|
115
|
+
|
116
|
+
==== General
|
117
|
+
|
118
|
+
Several shared content models are used across the different entities.
|
119
|
+
|
120
|
+
==== Identifier
|
121
|
+
|
122
|
+
The Identifier object represents a unique identifier within the identifier type.
|
123
|
+
|
124
|
+
Every entity in the database includes an `identifiers` array that contains one or
|
125
|
+
more identifiers.
|
126
|
+
|
127
|
+
Each identifier has:
|
128
|
+
|
129
|
+
`id`:: A unique string that identifies the entity
|
130
|
+
`type`:: The system or authority that defines the identifier
|
131
|
+
|
132
|
+
The `type: unitsml` identifier is mandatory for every entry, where it uniquely
|
133
|
+
identifies the entity within the UnitsML framework.
|
134
|
+
|
135
|
+
Other types of identifier types are also supported, such as `type: nist` for
|
136
|
+
legacy UnitsML identifiers that start with a prefix of `NIST`.
|
137
|
+
|
138
|
+
The UnitsML identifier follows a specific format:
|
139
|
+
|
140
|
+
[source,yaml]
|
141
|
+
----
|
142
|
+
id: {entity-type}:{entity-name}
|
143
|
+
type: unitsml
|
144
|
+
----
|
145
|
+
|
146
|
+
Where,
|
147
|
+
|
148
|
+
`entity-type`:: Abbreviated code for the type of entity.
|
149
|
+
`u`::: Unit
|
150
|
+
`d`::: Dimension
|
151
|
+
`p`::: Prefix
|
152
|
+
`q`::: Quantity
|
153
|
+
`s`::: Scale
|
154
|
+
`us`::: Unit system
|
155
|
+
|
156
|
+
`entity-name`:: The short name of the entity, typically identical to the
|
157
|
+
`short:` attribute of the entity.
|
158
|
+
|
159
|
+
The legacy UnitsML identifier ("NIST" prefix) is used for backward compatibility
|
160
|
+
and is not required for new entries.
|
161
|
+
|
162
|
+
[source,yaml]
|
163
|
+
----
|
164
|
+
id: NIST{entity-type}{entity-code}
|
165
|
+
type: nist
|
166
|
+
----
|
167
|
+
|
168
|
+
Where,
|
169
|
+
|
170
|
+
`entity-type`:: Abbreviated code for the type of entity.
|
171
|
+
`u`::: Unit
|
172
|
+
`d`::: Dimension
|
173
|
+
`p`::: Prefix
|
174
|
+
`q`::: Quantity
|
175
|
+
|
176
|
+
`entity-code`:: A unique code for the entity. It is a number for units, quantities and
|
177
|
+
dimensions, and a string pattern of `{base_number}_{power}` for prefixes.
|
178
|
+
|
179
|
+
[example]
|
180
|
+
====
|
181
|
+
[source,yaml]
|
182
|
+
----
|
183
|
+
identifiers:
|
184
|
+
- id: u:meter
|
185
|
+
type: unitsml
|
186
|
+
- id: NISTu1
|
187
|
+
type: nist
|
188
|
+
----
|
189
|
+
====
|
190
|
+
|
191
|
+
|
192
|
+
==== Symbols
|
193
|
+
|
194
|
+
The Symbol object represents the notation used to represent the entity in different
|
195
|
+
contexts and formats.
|
196
|
+
|
197
|
+
The Symbol object is used for units, prefixes, certain quantities and certain dimensions.
|
198
|
+
|
199
|
+
A Symbol object contains the following attributes which allow for rendering in
|
200
|
+
various formats:
|
201
|
+
|
202
|
+
`id`:: A unique identifier identifying the symbol across UnitsDB
|
203
|
+
`ascii`:: Plain text ASCII representation
|
204
|
+
`unicode`:: Unicode representation, used in UnicodeMath
|
205
|
+
`html`:: HTML markup representation
|
206
|
+
`mathml`:: MathML markup representation
|
207
|
+
`latex`:: LaTeX markup representation
|
208
|
+
|
209
|
+
This multi-format approach ensures that the symbols can be rendered correctly
|
210
|
+
across various applications and documents.
|
211
|
+
|
212
|
+
[example]
|
213
|
+
====
|
214
|
+
[source,yaml]
|
215
|
+
----
|
216
|
+
symbols:
|
217
|
+
- latex: "\\ensuremath{\\mathrm{m}}"
|
218
|
+
unicode: m
|
219
|
+
ascii: m
|
220
|
+
html: m
|
221
|
+
id: m
|
222
|
+
mathml: "<mi mathvariant='normal'>m</mi>"
|
223
|
+
----
|
224
|
+
====
|
225
|
+
|
226
|
+
==== Localized string
|
227
|
+
|
228
|
+
The localized string object represents a human-readable string that can be
|
229
|
+
localized into different languages.
|
230
|
+
|
231
|
+
It is used for names, descriptions, and other text fields that may require
|
232
|
+
translation or localization. Multiple values are allowed per language.
|
233
|
+
|
234
|
+
A localized string object contains the following attributes:
|
235
|
+
|
236
|
+
`value`:: The localized string value
|
237
|
+
`lang`:: The language code (e.g., "en" for English, "fr" for French)
|
238
|
+
|
239
|
+
[example]
|
240
|
+
====
|
241
|
+
[source,yaml]
|
242
|
+
----
|
243
|
+
names:
|
244
|
+
- value: metre
|
245
|
+
lang: en
|
246
|
+
- value: meter
|
247
|
+
lang: en
|
248
|
+
- value: mètre
|
249
|
+
lang: fr
|
250
|
+
----
|
251
|
+
====
|
252
|
+
|
253
|
+
==== References
|
254
|
+
|
255
|
+
A reference object represents a link to an external resource or standard
|
256
|
+
that provides additional context or information about the entity.
|
257
|
+
|
258
|
+
Currently, UnitsDB units, quantities and prefixes link to:
|
259
|
+
|
260
|
+
* the SI Digital Framework
|
261
|
+
* UCUM
|
262
|
+
|
263
|
+
A reference contains the following attributes:
|
264
|
+
|
265
|
+
`uri`:: The URI or URL of the reference
|
266
|
+
`type`:: The type of reference (e.g., "normative", "informative")
|
267
|
+
`authority`:: The authority responsible for the reference
|
268
|
+
|
269
|
+
[example]
|
270
|
+
====
|
271
|
+
[source,yaml]
|
272
|
+
----
|
273
|
+
references:
|
274
|
+
- uri: http://si-digital-framework.org/SI/units/metre
|
275
|
+
type: normative
|
276
|
+
authority: si-digital-framework
|
277
|
+
- type: informative
|
278
|
+
authority: ucum
|
279
|
+
uri: ucum:base-unit:code:m
|
280
|
+
----
|
281
|
+
====
|
282
|
+
|
283
|
+
The SI Digital Framework reference is a normative reference to the
|
284
|
+
official SI unit definitions.
|
285
|
+
|
286
|
+
SI references are added to:
|
287
|
+
|
288
|
+
* units.yaml for units
|
289
|
+
* quantities.yaml for quantities
|
290
|
+
* prefixes.yaml for prefixes
|
291
|
+
* dimensions.yaml for dimensions
|
292
|
+
|
293
|
+
|
294
|
+
The UCUM URI format is a custom one used inside UnitsML with the pattern
|
295
|
+
`ucum:{type}:{klass}:code:{unit_code}`, and is listed as informative.
|
296
|
+
|
297
|
+
UCUM references are added to:
|
298
|
+
|
299
|
+
* units.yaml for units
|
300
|
+
* prefixes.yaml for prefixes
|
301
|
+
|
302
|
+
|
303
|
+
=== Dimensions
|
304
|
+
|
305
|
+
==== General
|
306
|
+
|
307
|
+
Dimensions represent the fundamental physical quantities that form the basis of
|
308
|
+
any measurement system. They are the abstract properties that define the nature
|
309
|
+
of a physical quantity, independent of any specific unit of measurement.
|
310
|
+
|
311
|
+
* The SI system defines seven base dimensions (length, mass, time, electric
|
312
|
+
current, thermodynamic temperature, amount of substance, and luminous intensity).
|
313
|
+
|
314
|
+
* A special dimensionless dimension is also defined, which has no physical
|
315
|
+
significance but is used in certain contexts.
|
316
|
+
|
317
|
+
* Derived dimensions are formed by combining base dimensions through
|
318
|
+
multiplication, division, or exponentiation. For example, velocity is a derived
|
319
|
+
dimension formed from length and time (L/T), and force is derived from mass
|
320
|
+
and acceleration (ML/T²).
|
321
|
+
|
322
|
+
A dimension object in `dimensions.yaml` typically has the following structure:
|
323
|
+
|
324
|
+
[source,yaml]
|
325
|
+
----
|
326
|
+
- identifiers:
|
327
|
+
- id: dimension_id
|
328
|
+
type: type_identifier
|
329
|
+
short: short_name
|
330
|
+
{dimension_name}:
|
331
|
+
power: power_numerator
|
332
|
+
symbol: ASCII representation
|
333
|
+
symbols:
|
334
|
+
- ascii: ASCII representation
|
335
|
+
html: "HTML representation"
|
336
|
+
id: dimension_symbol_id
|
337
|
+
latex: "LaTeX representation"
|
338
|
+
mathml: "MathML representation"
|
339
|
+
unicode: "Unicode representation"
|
340
|
+
----
|
341
|
+
|
342
|
+
For example:
|
343
|
+
|
344
|
+
[source,yaml]
|
345
|
+
----
|
346
|
+
- identifiers:
|
347
|
+
- id: NISTd1
|
348
|
+
type: nist
|
349
|
+
length:
|
350
|
+
power: 1
|
351
|
+
symbol: L
|
352
|
+
symbols:
|
353
|
+
- ascii: L
|
354
|
+
html: "𝖫"
|
355
|
+
id: dim_L
|
356
|
+
latex: "\\ensuremath{\\mathsf{L}}"
|
357
|
+
mathml: "<mi mathvariant='sans-serif'>L</mi>"
|
358
|
+
unicode: "\U0001D5AB"
|
359
|
+
short: length
|
360
|
+
- identifiers:
|
361
|
+
- id: NISTd2
|
362
|
+
type: nist
|
363
|
+
mass:
|
364
|
+
power: 1
|
365
|
+
symbol: M
|
366
|
+
symbols:
|
367
|
+
- ascii: M
|
368
|
+
html: "𝖬"
|
369
|
+
id: dim_M
|
370
|
+
latex: "\\ensuremath{\\mathsf{M}}"
|
371
|
+
mathml: "<mi mathvariant='sans-serif'>M</mi>"
|
372
|
+
unicode: "\U0001D5AC"
|
373
|
+
short: mass
|
374
|
+
----
|
375
|
+
|
376
|
+
==== Notes
|
377
|
+
|
378
|
+
The following dimensions are identified by NIST but they are excluded from
|
379
|
+
`dimensions.yaml` since they are unused:
|
380
|
+
|
381
|
+
[source,yaml]
|
382
|
+
----
|
383
|
+
- identifiers:
|
384
|
+
- id: NISTd87
|
385
|
+
type: nist
|
386
|
+
dimensionless: true
|
387
|
+
short: dimensionless
|
388
|
+
|
389
|
+
- identifiers:
|
390
|
+
- id: NISTd86
|
391
|
+
type: nist
|
392
|
+
dimensionless: true
|
393
|
+
short: dimensionless
|
394
|
+
|
395
|
+
- identifiers:
|
396
|
+
- id: NISTd81
|
397
|
+
type: nist
|
398
|
+
dimensionless: true
|
399
|
+
short: dimensionless
|
400
|
+
----
|
401
|
+
|
402
|
+
|
403
|
+
=== Prefixes
|
404
|
+
|
405
|
+
==== General
|
406
|
+
|
407
|
+
Prefixes are modifiers that can be attached to units to indicate decimal
|
408
|
+
multiples or submultiples. They provide a concise way to express very large or
|
409
|
+
small quantities without resorting to scientific notation.
|
410
|
+
|
411
|
+
[example]
|
412
|
+
The prefix "kilo" (k) multiplies a unit by 1000, so 1 kilometer equals 1000
|
413
|
+
meters.
|
414
|
+
|
415
|
+
The SI system defines a set of standard prefixes included in UnitsDB.
|
416
|
+
|
417
|
+
A prefix object in `prefixes.yaml` typically has the following structure:
|
418
|
+
|
419
|
+
[source,yaml]
|
420
|
+
----
|
421
|
+
- identifiers:
|
422
|
+
- id: prefix_id
|
423
|
+
type: type_identifier
|
424
|
+
base: base
|
425
|
+
names:
|
426
|
+
- prefix_name
|
427
|
+
short: prefix_short_name
|
428
|
+
power: power
|
429
|
+
symbol:
|
430
|
+
id: symbol_id
|
431
|
+
ascii: ASCII representation
|
432
|
+
html: "HTML representation"
|
433
|
+
latex: "LaTeX representation"
|
434
|
+
unicode: "Unicode representation"
|
435
|
+
mathml: "MathML representation"
|
436
|
+
----
|
437
|
+
|
438
|
+
For example:
|
439
|
+
|
440
|
+
[source,yaml]
|
441
|
+
----
|
442
|
+
- identifiers:
|
443
|
+
- id: NISTp10_2
|
444
|
+
type: nist
|
445
|
+
base: 10
|
446
|
+
names:
|
447
|
+
- hecto
|
448
|
+
short: hecto
|
449
|
+
power: 2
|
450
|
+
symbol:
|
451
|
+
latex: h
|
452
|
+
unicode: h
|
453
|
+
ascii: h
|
454
|
+
html: h
|
455
|
+
id: hecto
|
456
|
+
mathml: "<mi>h</mi>"
|
457
|
+
- identifiers:
|
458
|
+
- id: NISTp10_1
|
459
|
+
type: nist
|
460
|
+
base: 10
|
461
|
+
names:
|
462
|
+
- deka
|
463
|
+
short: deka
|
464
|
+
power: 1
|
465
|
+
symbol:
|
466
|
+
latex: da
|
467
|
+
unicode: da
|
468
|
+
ascii: da
|
469
|
+
html: da
|
470
|
+
id: deka
|
471
|
+
mathml: "<mi>da</mi>"
|
472
|
+
----
|
473
|
+
|
474
|
+
==== Notes
|
475
|
+
|
476
|
+
Decimal prefixes are identified by their power of 10, e.g. `NISTp10_1`
|
477
|
+
|
478
|
+
The prefix `NISTp10_0` is a placeholder for unity.
|
479
|
+
|
480
|
+
Binary prefixes are identified by their power of 2, e.g. `NISTp2_10`
|
481
|
+
|
482
|
+
|
483
|
+
=== Quantities
|
484
|
+
|
485
|
+
==== General
|
486
|
+
|
487
|
+
Quantities are measurable properties of physical phenomena, objects, or
|
488
|
+
substances. They represent the attributes that can be measured and expressed
|
489
|
+
with numbers. Each quantity is associated with a specific dimension (or
|
490
|
+
combination of dimensions) and can be measured using various units.
|
491
|
+
|
492
|
+
The SI system categorizes quantities into two main types:
|
493
|
+
|
494
|
+
* Base quantities: The seven fundamental quantities from which all others are
|
495
|
+
derived (length, mass, time, electric current, thermodynamic temperature, amount
|
496
|
+
of substance, and luminous intensity)
|
497
|
+
|
498
|
+
* Derived quantities: Quantities formed by algebraic combinations of base
|
499
|
+
quantities (e.g., area, volume, velocity, force)
|
500
|
+
|
501
|
+
Each quantity has a unique identity and can be measured in specific units that
|
502
|
+
share the same dimension.
|
503
|
+
|
504
|
+
[example]
|
505
|
+
"length" is a quantity that can be measured in meters, feet, or kilometers.
|
506
|
+
|
507
|
+
A quantity can be combined with other quantities to form compound quantities,
|
508
|
+
such as velocity (length/time) or force (mass × acceleration).
|
509
|
+
|
510
|
+
A quantity object in `quantities.yaml` typically has the following structure:
|
511
|
+
|
512
|
+
[source,yaml]
|
513
|
+
----
|
514
|
+
- identifiers:
|
515
|
+
- id: quantity_id
|
516
|
+
type: type_identifier
|
517
|
+
names:
|
518
|
+
- names
|
519
|
+
quantity_type: {base|derived}
|
520
|
+
short: short_name
|
521
|
+
unit_references:
|
522
|
+
- id: unit_id
|
523
|
+
type: type_identifier
|
524
|
+
dimension_reference:
|
525
|
+
id: dimension_id
|
526
|
+
type: type_identifier
|
527
|
+
references:
|
528
|
+
- uri: http://si-digital-framework.org/quantities/QUANTITY_ID
|
529
|
+
type: normative
|
530
|
+
authority: si-digital-framework
|
531
|
+
----
|
532
|
+
|
533
|
+
For example:
|
534
|
+
|
535
|
+
[source,yaml]
|
536
|
+
----
|
537
|
+
- identifiers:
|
538
|
+
- id: NISTq8
|
539
|
+
type: nist
|
540
|
+
names:
|
541
|
+
- value: area
|
542
|
+
lang: en
|
543
|
+
- value: superficie
|
544
|
+
lang: fr
|
545
|
+
quantity_type: base
|
546
|
+
unit_references:
|
547
|
+
- id: NISTu164
|
548
|
+
type: nist
|
549
|
+
- id: NISTu165
|
550
|
+
type: nist
|
551
|
+
- id: NISTu1e2/1
|
552
|
+
type: nist
|
553
|
+
- id: NISTu283
|
554
|
+
type: nist
|
555
|
+
- id: NISTu317
|
556
|
+
type: nist
|
557
|
+
- id: NISTu42
|
558
|
+
type: nist
|
559
|
+
- id: NISTu43
|
560
|
+
type: nist
|
561
|
+
- id: NISTu44
|
562
|
+
type: nist
|
563
|
+
- id: NISTu45
|
564
|
+
type: nist
|
565
|
+
- id: NISTu46
|
566
|
+
type: nist
|
567
|
+
dimension_reference:
|
568
|
+
id: NISTd8
|
569
|
+
type: nist
|
570
|
+
references:
|
571
|
+
- uri: http://si-digital-framework.org/quantities/AREA
|
572
|
+
type: normative
|
573
|
+
authority: si-digital-framework
|
574
|
+
- identifiers:
|
575
|
+
- id: NISTq166
|
576
|
+
type: nist
|
577
|
+
names:
|
578
|
+
- electric potential
|
579
|
+
quantity_type: derived
|
580
|
+
unit_references:
|
581
|
+
- id: NISTu261
|
582
|
+
type: nist
|
583
|
+
- id: NISTu268
|
584
|
+
type: nist
|
585
|
+
dimension_reference:
|
586
|
+
id: NISTd18
|
587
|
+
type: nist
|
588
|
+
- identifiers:
|
589
|
+
- id: NISTq7
|
590
|
+
type: nist
|
591
|
+
names:
|
592
|
+
- luminous intensity
|
593
|
+
quantity_type: base
|
594
|
+
short: luminous_intensity
|
595
|
+
unit_references:
|
596
|
+
- id: NISTu7
|
597
|
+
type: nist
|
598
|
+
dimension_reference:
|
599
|
+
id: NISTd7
|
600
|
+
type: nist
|
601
|
+
----
|
602
|
+
|
603
|
+
|
604
|
+
=== Units
|
605
|
+
|
606
|
+
==== General
|
607
|
+
|
608
|
+
Units are standardized quantities used to express measurements of physical
|
609
|
+
properties. They provide a reference scale for measuring quantities, allowing
|
610
|
+
values to be communicated uniformly. Each unit is associated with a specific
|
611
|
+
physical quantity and dimension, and has a defined relationship to other units
|
612
|
+
in the same dimension.
|
613
|
+
|
614
|
+
The SI system classifies units into several categories:
|
615
|
+
|
616
|
+
* Base units: The seven fundamental units corresponding to the base quantities
|
617
|
+
(meter, kilogram, second, ampere, kelvin, mole, and candela)
|
618
|
+
|
619
|
+
* Derived units: Units formed from combinations of base units (e.g., newton,
|
620
|
+
joule, pascal)
|
621
|
+
|
622
|
+
* Special named units: Derived units that have been given unique names for
|
623
|
+
convenience (e.g., newton for kg·m/s²)
|
624
|
+
|
625
|
+
* Units outside the SI: Non-SI units that are accepted for use with the SI
|
626
|
+
(e.g., minute, hour, degree)
|
627
|
+
|
628
|
+
Units can be combined with prefixes to express multiples or submultiples, and
|
629
|
+
can be combined algebraically (through multiplication and division) to form
|
630
|
+
compound units.
|
631
|
+
|
632
|
+
A unit object in `units.yaml` typically has the following structure:
|
633
|
+
|
634
|
+
[source,yaml]
|
635
|
+
----
|
636
|
+
- identifiers:
|
637
|
+
- id: unit_id
|
638
|
+
type: type_identifier
|
639
|
+
quantity_references:
|
640
|
+
- id: quantity_id
|
641
|
+
type: type_identifier
|
642
|
+
names:
|
643
|
+
- names
|
644
|
+
root: true|false
|
645
|
+
short: unit_short_name
|
646
|
+
symbols:
|
647
|
+
- id: symbol_id
|
648
|
+
ascii: ASCII representation
|
649
|
+
html: "HTML representation"
|
650
|
+
mathml: "MathML representation"
|
651
|
+
latex: "LaTeX representation"
|
652
|
+
unicode: "Unicode representation"
|
653
|
+
dimension_reference:
|
654
|
+
id: dimension_id
|
655
|
+
type: type_identifier
|
656
|
+
unit_system_reference:
|
657
|
+
- id: unit_system_id
|
658
|
+
type: type_identifier
|
659
|
+
# Optional fields for derived units:
|
660
|
+
prefixed: true|false
|
661
|
+
|
662
|
+
# Note: Use either root_units OR si_derived_bases, but not both together
|
663
|
+
|
664
|
+
# Use root_units for composite units that include any non-SI or non-SI-derived units
|
665
|
+
# root_units can also contain SI units
|
666
|
+
root_units:
|
667
|
+
- power: power_numerator
|
668
|
+
unit_reference:
|
669
|
+
id: unit_id
|
670
|
+
type: type_identifier
|
671
|
+
prefix_reference:
|
672
|
+
id: prefix_id
|
673
|
+
type: type_identifier
|
674
|
+
|
675
|
+
# Use si_derived_bases only for composite units that use exclusively SI base units
|
676
|
+
si_derived_bases:
|
677
|
+
- power: power_numerator
|
678
|
+
unit_reference:
|
679
|
+
id: unit_id
|
680
|
+
type: type_identifier
|
681
|
+
prefix_reference:
|
682
|
+
id: prefix_id
|
683
|
+
type: type_identifier
|
684
|
+
----
|
685
|
+
|
686
|
+
For example:
|
687
|
+
|
688
|
+
[source,yaml]
|
689
|
+
----
|
690
|
+
- identifiers:
|
691
|
+
- id: NISTu5
|
692
|
+
type: nist
|
693
|
+
quantity_references:
|
694
|
+
- id: NISTq5
|
695
|
+
type: nist
|
696
|
+
names:
|
697
|
+
- value: kelvin
|
698
|
+
lang: en
|
699
|
+
- value: kelvin
|
700
|
+
lang: fr
|
701
|
+
root: true
|
702
|
+
short: kelvin
|
703
|
+
symbols:
|
704
|
+
- latex: "\\ensuremath{\\mathrm{K}}"
|
705
|
+
unicode: K
|
706
|
+
ascii: K
|
707
|
+
html: K
|
708
|
+
id: K
|
709
|
+
mathml: "<mi mathvariant='normal'>K</mi>"
|
710
|
+
- latex: "\\ensuremath{\\mathrm{^{\\circ}K}}"
|
711
|
+
unicode: "°K"
|
712
|
+
ascii: degK
|
713
|
+
html: "°K"
|
714
|
+
id: degK
|
715
|
+
mathml: "<mi mathvariant='normal'>°K</mi>"
|
716
|
+
dimension_reference:
|
717
|
+
id: NISTd5
|
718
|
+
type: nist
|
719
|
+
unit_system_reference:
|
720
|
+
- id: si-base
|
721
|
+
type: unitsml
|
722
|
+
----
|
723
|
+
|
724
|
+
|
725
|
+
=== Scales
|
726
|
+
|
727
|
+
==== General
|
728
|
+
|
729
|
+
Scales define the mathematical properties of measurement systems and how values
|
730
|
+
relate to each other. They specify important characteristics like whether a
|
731
|
+
scale has a true zero point, whether equal intervals represent equal
|
732
|
+
differences, or whether the scale uses logarithmic relationships.
|
733
|
+
|
734
|
+
Understanding the scale type is crucial for proper interpretation of
|
735
|
+
measurements and for determining what mathematical operations can legitimately
|
736
|
+
be performed on the values.
|
737
|
+
|
738
|
+
[example]
|
739
|
+
On a ratio scale (like length), you can say that 10 meters is twice as long as 5
|
740
|
+
meters. On an interval scale (like Celsius temperature), 20°C is not "twice as
|
741
|
+
hot" as 10°C.
|
742
|
+
|
743
|
+
UnitsDB defines several scale types including continuous ratio scales,
|
744
|
+
continuous interval scales, logarithmic scales, and discrete scales, each with
|
745
|
+
specific properties that determine how measurements should be interpreted and
|
746
|
+
what mathematical operations are valid.
|
747
|
+
|
748
|
+
A scale object in `scales.yaml` typically has the following structure:
|
749
|
+
|
750
|
+
[source,yaml]
|
751
|
+
----
|
752
|
+
- identifiers:
|
753
|
+
- id: scale_id
|
754
|
+
type: type_identifier
|
755
|
+
names:
|
756
|
+
- scale_name
|
757
|
+
short: short_name
|
758
|
+
description:
|
759
|
+
- description of scale type
|
760
|
+
properties:
|
761
|
+
continuous: true|false
|
762
|
+
ordered: true|false
|
763
|
+
logarithmic: true|false
|
764
|
+
interval: true|false
|
765
|
+
ratio: true|false
|
766
|
+
----
|
767
|
+
|
768
|
+
For example:
|
769
|
+
|
770
|
+
[source,yaml]
|
771
|
+
----
|
772
|
+
- identifiers:
|
773
|
+
- id: continuous_ratio
|
774
|
+
type: unitsml
|
775
|
+
names:
|
776
|
+
- continuous ratio scale
|
777
|
+
short: continuous_ratio
|
778
|
+
description:
|
779
|
+
- A measurement scale with continuous values and a true zero point, allowing for ratio comparisons
|
780
|
+
properties:
|
781
|
+
continuous: true
|
782
|
+
ordered: true
|
783
|
+
logarithmic: false
|
784
|
+
interval: true
|
785
|
+
ratio: true
|
786
|
+
- identifiers:
|
787
|
+
- id: logarithmic_ratio
|
788
|
+
type: unitsml
|
789
|
+
names:
|
790
|
+
- logarithmic ratio scale
|
791
|
+
short: logarithmic_ratio
|
792
|
+
description:
|
793
|
+
- A scale where equal ratios appear as equal intervals, with a zero point representing a reference value
|
794
|
+
properties:
|
795
|
+
continuous: true
|
796
|
+
ordered: true
|
797
|
+
logarithmic: true
|
798
|
+
interval: true
|
799
|
+
ratio: true
|
800
|
+
----
|
801
|
+
|
802
|
+
Units refer to scales using a `scale_reference` object:
|
803
|
+
|
804
|
+
[source,yaml]
|
805
|
+
----
|
806
|
+
scale_reference:
|
807
|
+
id: scale_id
|
808
|
+
type: type_identifier
|
809
|
+
----
|
810
|
+
|
811
|
+
==== Notes
|
812
|
+
|
813
|
+
The following scale types are currently defined:
|
814
|
+
|
815
|
+
`continuous_ratio`:: A measurement scale with continuous values and a true zero
|
816
|
+
point (most physical quantities)
|
817
|
+
|
818
|
+
`continuous_interval`:: A measurement scale with continuous values but an
|
819
|
+
arbitrary zero point (e.g., temperature in °C)
|
820
|
+
|
821
|
+
`logarithmic_ratio`:: A logarithmic scale where equal ratios appear as equal
|
822
|
+
intervals (e.g., decibels)
|
823
|
+
|
824
|
+
`logarithmic_field`:: A logarithmic scale used for field quantities that uses
|
825
|
+
natural logarithms (e.g., neper)
|
826
|
+
|
827
|
+
`discrete`:: A scale consisting of discrete, countable values (e.g., bits)
|
828
|
+
|
829
|
+
|
830
|
+
== Unit systems
|
831
|
+
|
832
|
+
=== General
|
833
|
+
|
834
|
+
Unit systems are coherent collections of units that are used together to express
|
835
|
+
measurements in a consistent way. Each unit system has its own set of base units
|
836
|
+
and derived units, organized according to specific principles.
|
837
|
+
|
838
|
+
The most widely used unit system is the International System of Units (SI), but
|
839
|
+
the database also includes information about other unit systems and their
|
840
|
+
relationships to SI.
|
841
|
+
|
842
|
+
Unit systems help provide context for units, indicating whether they are part of
|
843
|
+
the official SI system, acceptable for use with SI (like minutes or degrees), or
|
844
|
+
belong to entirely different measurement frameworks (like imperial units). This
|
845
|
+
context is important for interoperability and conversion between different
|
846
|
+
measurement standards.
|
847
|
+
|
848
|
+
In the UnitsDB, units are associated with their respective unit systems through
|
849
|
+
references, allowing applications to identify which units belong to which
|
850
|
+
systems and to determine compatibility between measurements expressed in
|
851
|
+
different systems.
|
852
|
+
|
853
|
+
A unit system object in `unit_systems.yaml` typically has the following structure:
|
854
|
+
|
855
|
+
[source,yaml]
|
856
|
+
----
|
857
|
+
- acceptable: {true|false} # whether the unit system is SI acceptable
|
858
|
+
short: short_name
|
859
|
+
identifiers:
|
860
|
+
- id: unit_system_id
|
861
|
+
type: type_identifier
|
862
|
+
name: unit_system_name
|
863
|
+
----
|
864
|
+
|
865
|
+
For example:
|
866
|
+
|
867
|
+
[source,yaml]
|
868
|
+
----
|
869
|
+
- acceptable: true
|
870
|
+
short: si-compatible
|
871
|
+
identifiers:
|
872
|
+
- id: SI_compatible
|
873
|
+
type: nist
|
874
|
+
name: Units compatible with SI
|
875
|
+
- acceptable: true
|
876
|
+
short: si-base
|
877
|
+
identifiers:
|
878
|
+
- id: SI_base
|
879
|
+
type: nist
|
880
|
+
name: SI base units
|
881
|
+
----
|
882
|
+
|
883
|
+
=== Notes
|
884
|
+
|
885
|
+
The following unit systems are currently defined:
|
886
|
+
|
887
|
+
`si-base`:: Contains the seven SI base units (meter, kilogram, second, ampere,
|
888
|
+
kelvin, mole, and candela). These form the foundation of the SI system.
|
889
|
+
|
890
|
+
`si-derived-special`:: Contains SI-derived units with special names and symbols
|
891
|
+
(e.g., newton, pascal, joule). These units are derived from base units but have
|
892
|
+
been given unique names for convenience.
|
893
|
+
|
894
|
+
`si-derived-nonspecial`:: Contains SI-derived units that use combinations of
|
895
|
+
base unit symbols without special names (e.g., m/s, kg/m³).
|
896
|
+
|
897
|
+
`si-compatible`:: Contains all units that are compatible with the SI system,
|
898
|
+
including base units, derived units, and accepted non-SI units.
|
899
|
+
|
900
|
+
`nonsi-acceptable`:: Contains non-SI units that are accepted for use with the SI
|
901
|
+
system based on the BIPM SI Brochure (e.g., minute, hour, degree).
|
902
|
+
|
903
|
+
`nonsi-unacceptable`:: Contains non-SI units that are not acceptable for use
|
904
|
+
with the SI system (e.g., deprecated or obsolete units).
|
905
|
+
|
906
|
+
`nonsi-nist-acceptable`:: Contains non-SI units that are acceptable according to
|
907
|
+
NIST SP 811 but may not be officially accepted by BIPM (e.g., certain customary
|
908
|
+
or traditional units).
|
909
|
+
|
910
|
+
|
911
|
+
In UnitsDB, a unit can belong to multiple unit systems. This classification
|
912
|
+
helps applications determine the appropriate use contexts for each unit.
|
913
|
+
|
914
|
+
[example]
|
915
|
+
A unit might be categorized as both `nonsi-unacceptable` (meaning it is not
|
916
|
+
acceptable for SI usage) but also as `nonsi-nist-acceptable` (meaning NIST SP
|
917
|
+
811 considers it acceptable in certain contexts).
|
918
|
+
|
919
|
+
When using unit systems in applications, the `acceptable` property can be used
|
920
|
+
as a quick filter for SI-compliant units, while more specific categorization can
|
921
|
+
be achieved using the individual unit system references.
|
922
|
+
|
923
|
+
|
924
|
+
== Contributing
|
925
|
+
|
926
|
+
=== General
|
927
|
+
|
928
|
+
When contributing to this repository, please follow these guidelines.
|
929
|
+
|
930
|
+
=== Proposing a new unit, dimension, or quantity
|
931
|
+
|
932
|
+
. Check if the unit already exists in the database.
|
933
|
+
. If it does not exist, create a new YAML file in the appropriate directory
|
934
|
+
(e.g., `units.yaml`, `dimensions.yaml`, etc.).
|
935
|
+
. Follow the structure outlined in the "Content classes" section.
|
936
|
+
. Ensure that the new unit is properly referenced in the relevant files.
|
937
|
+
. Add a test case for the new unit in the appropriate test file.
|
938
|
+
. Run the tests to ensure everything is working correctly.
|
939
|
+
. Submit a pull request with a clear description of the changes made.
|
940
|
+
. Include any relevant references or sources for the new unit.
|
941
|
+
. Ensure that the pull request is against the `main` branch of the repository.
|
942
|
+
. Wait for review and feedback from the repository maintainers.
|
943
|
+
. Address any comments or suggestions made during the review process.
|
944
|
+
. Once approved, the pull request will be merged into the main branch.
|
945
|
+
|
946
|
+
|
947
|
+
=== Database normalization
|
948
|
+
|
949
|
+
For ease of use, the database is normalized to avoid redundancy and ensure
|
950
|
+
consistency.
|
951
|
+
|
952
|
+
UnitsDB uses the `unitsdb` gem to normalize the database.
|
953
|
+
|
954
|
+
NOTE: The `--sort=nist` option ensures that the output is sorted according to
|
955
|
+
legacy NIST identifiers for stability reasons, which may change in the future.
|
956
|
+
|
957
|
+
Please run the following commands to ensure that the database is
|
958
|
+
normalized before submitting a pull request:
|
959
|
+
|
960
|
+
[source,bash]
|
961
|
+
----
|
962
|
+
$ gem install unitsdb
|
963
|
+
|
964
|
+
$ unitsdb _modify normalize --all --database={unitsdb_yaml_dir} --sort=nist
|
965
|
+
|
966
|
+
Normalized {unitsdb_yaml_dir}/dimensions.yaml
|
967
|
+
Normalized {unitsdb_yaml_dir}/prefixes.yaml
|
968
|
+
Normalized {unitsdb_yaml_dir}/quantities.yaml
|
969
|
+
Normalized {unitsdb_yaml_dir}/unit_systems.yaml
|
970
|
+
Normalized {unitsdb_yaml_dir}/units.yaml
|
971
|
+
All YAML files normalized successfully!
|
972
|
+
|
973
|
+
----
|
974
|
+
|
975
|
+
=== Database validation
|
976
|
+
|
977
|
+
All YAML files must be validated before submitting a pull request.
|
978
|
+
|
979
|
+
UnitsDB uses the `unitsdb` gem to validate the database.
|
980
|
+
|
981
|
+
[source,bash]
|
982
|
+
----
|
983
|
+
# Validate all references
|
984
|
+
$ unitsdb validate references --database={unitsdb_yaml_dir}
|
985
|
+
|
986
|
+
# Validate all identifiers
|
987
|
+
$ unitsdb validate identifiers --database={unitsdb_yaml_dir}
|
988
|
+
|
989
|
+
# Check for duplicate SI references:
|
990
|
+
$ unitsdb validate si_references --database={unitsdb_yaml_dir}
|
991
|
+
----
|
992
|
+
|
993
|
+
=== Creating release files
|
994
|
+
|
995
|
+
When preparing an official release of UnitsDB, create unified release files for
|
996
|
+
users.
|
997
|
+
|
998
|
+
UnitsDB uses the `unitsdb` gem to create release files.
|
999
|
+
|
1000
|
+
[source,bash]
|
1001
|
+
----
|
1002
|
+
# Create both unified YAML and ZIP archive files
|
1003
|
+
$ unitsdb release --database={unitsdb_yaml_dir} --output-dir=release
|
1004
|
+
|
1005
|
+
# Create only unified YAML file
|
1006
|
+
$ unitsdb release --format=yaml --database={unitsdb_yaml_dir} --output-dir=release
|
1007
|
+
|
1008
|
+
# Create only ZIP archive
|
1009
|
+
$ unitsdb release --format=zip --database={unitsdb_yaml_dir} --output-dir=release --version=2.1.0
|
1010
|
+
|
1011
|
+
# Specify a version (required, must be in semantic format x.y.z)
|
1012
|
+
$ unitsdb release --version=2.1.0 --database={unitsdb_yaml_dir} --output-dir=release
|
1013
|
+
----
|
1014
|
+
|
1015
|
+
=== Automated releases with GitHub Actions
|
1016
|
+
|
1017
|
+
This repository includes a GitHub Actions workflow that automatically creates
|
1018
|
+
release artifacts when a new version tag is pushed. To create a new release:
|
1019
|
+
|
1020
|
+
. Tag the repository with the version number (prefixed with 'v'):
|
1021
|
+
+
|
1022
|
+
[source,bash]
|
1023
|
+
----
|
1024
|
+
$ git tag v2.1.0
|
1025
|
+
$ git push origin v2.1.0
|
1026
|
+
----
|
1027
|
+
|
1028
|
+
. The GitHub Actions workflow will automatically:
|
1029
|
+
|
1030
|
+
** Generate the unified YAML file
|
1031
|
+
** Create a ZIP archive of all database files
|
1032
|
+
** Upload both files as release assets
|
1033
|
+
** Create a GitHub release with the tag name
|
1034
|
+
|
1035
|
+
The release artifacts will be available on the GitHub releases page.
|
1036
|
+
|
1037
|
+
The unified YAML file combines all database files into a single file for easier
|
1038
|
+
integration:
|
1039
|
+
|
1040
|
+
[source,yaml]
|
1041
|
+
----
|
1042
|
+
schema_version: "2.0.0"
|
1043
|
+
version: "2.1.0"
|
1044
|
+
dimensions:
|
1045
|
+
- identifiers: [...]
|
1046
|
+
length: {...}
|
1047
|
+
names: [...]
|
1048
|
+
# ...
|
1049
|
+
prefixes: [...]
|
1050
|
+
quantities: [...]
|
1051
|
+
units: [...]
|
1052
|
+
unit_systems: [...]
|
1053
|
+
----
|
1054
|
+
|
1055
|
+
This unified format makes it more convenient for users to work with the entire
|
1056
|
+
database while ensuring all components are compatible with each other.
|
1057
|
+
|
1058
|
+
The ZIP archive contains all individual database files for users who prefer to
|
1059
|
+
work with separate files.
|
1060
|
+
|
1061
|
+
Both release formats include version information in their filenames (e.g.,
|
1062
|
+
`unitsdb-2.0.0.yaml` and `unitsdb-2.0.0.zip`).
|
1063
|
+
|
1064
|
+
|
1065
|
+
== Copyright and license
|
1066
|
+
|
1067
|
+
Copyright CalConnect. Incorporates public domain work from NIST.
|
1068
|
+
|
1069
|
+
This work is licensed under the Creative Commons Attribution 4.0 International
|
1070
|
+
License. To view a copy of this license, visit
|
1071
|
+
https://creativecommons.org/licenses/by/4.0/[CC-BY 4.0]
|