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/scales.yaml
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
# yaml-language-server: $schema=schemas/scales-schema.yaml
|
2
|
+
---
|
3
|
+
schema_version: 2.0.0
|
4
|
+
scales:
|
5
|
+
- identifiers:
|
6
|
+
- id: continuous_ratio
|
7
|
+
type: unitsml
|
8
|
+
- id: s:continuous_ratio
|
9
|
+
type: unitsml
|
10
|
+
names:
|
11
|
+
- value: continuous ratio scale
|
12
|
+
lang: en
|
13
|
+
short: continuous_ratio
|
14
|
+
description:
|
15
|
+
- value: A measurement scale with continuous values and a true zero point, allowing
|
16
|
+
for ratio comparisons
|
17
|
+
lang: en
|
18
|
+
properties:
|
19
|
+
continuous: true
|
20
|
+
ordered: true
|
21
|
+
logarithmic: false
|
22
|
+
interval: true
|
23
|
+
ratio: true
|
24
|
+
- identifiers:
|
25
|
+
- id: continuous_interval
|
26
|
+
type: unitsml
|
27
|
+
- id: s:continuous_interval
|
28
|
+
type: unitsml
|
29
|
+
names:
|
30
|
+
- value: continuous interval scale
|
31
|
+
lang: en
|
32
|
+
short: continuous_interval
|
33
|
+
description:
|
34
|
+
- value: A measurement scale with continuous values but an arbitrary zero point,
|
35
|
+
allowing for interval but not ratio comparisons
|
36
|
+
lang: en
|
37
|
+
properties:
|
38
|
+
continuous: true
|
39
|
+
ordered: true
|
40
|
+
logarithmic: false
|
41
|
+
interval: true
|
42
|
+
ratio: false
|
43
|
+
- identifiers:
|
44
|
+
- id: logarithmic_ratio
|
45
|
+
type: unitsml
|
46
|
+
- id: s:logarithmic_ratio
|
47
|
+
type: unitsml
|
48
|
+
names:
|
49
|
+
- value: logarithmic ratio scale
|
50
|
+
lang: en
|
51
|
+
short: logarithmic_ratio
|
52
|
+
description:
|
53
|
+
- value: A scale where equal ratios appear as equal intervals, with a zero point
|
54
|
+
representing a reference value
|
55
|
+
lang: en
|
56
|
+
properties:
|
57
|
+
continuous: true
|
58
|
+
ordered: true
|
59
|
+
logarithmic: true
|
60
|
+
interval: true
|
61
|
+
ratio: true
|
62
|
+
- identifiers:
|
63
|
+
- id: logarithmic_field
|
64
|
+
type: unitsml
|
65
|
+
- id: s:logarithmic_field
|
66
|
+
type: unitsml
|
67
|
+
names:
|
68
|
+
- value: logarithmic field scale
|
69
|
+
lang: en
|
70
|
+
short: logarithmic_field
|
71
|
+
description:
|
72
|
+
- value: A logarithmic scale used for field quantities that uses natural logarithms
|
73
|
+
lang: en
|
74
|
+
properties:
|
75
|
+
continuous: true
|
76
|
+
ordered: true
|
77
|
+
logarithmic: true
|
78
|
+
interval: true
|
79
|
+
ratio: false
|
80
|
+
- identifiers:
|
81
|
+
- id: discrete
|
82
|
+
type: unitsml
|
83
|
+
- id: s:discrete
|
84
|
+
type: unitsml
|
85
|
+
names:
|
86
|
+
- value: discrete scale
|
87
|
+
lang: en
|
88
|
+
short: discrete
|
89
|
+
description:
|
90
|
+
- value: A scale consisting of discrete, countable values
|
91
|
+
lang: en
|
92
|
+
properties:
|
93
|
+
continuous: false
|
94
|
+
ordered: true
|
95
|
+
logarithmic: false
|
96
|
+
interval: true
|
97
|
+
ratio: true
|
@@ -0,0 +1,159 @@
|
|
1
|
+
# UnitsDB YAML Schemas
|
2
|
+
|
3
|
+
This directory contains JSON Schema definitions for all YAML files in the UnitsDB repository. These schemas provide validation, documentation, and IDE support for the structured data files.
|
4
|
+
|
5
|
+
## Schema Files
|
6
|
+
|
7
|
+
### Core Data Schemas
|
8
|
+
|
9
|
+
- **`units-schema.yaml`** - Schema for `units.yaml`
|
10
|
+
- Defines physical units with their symbols, definitions, and relationships
|
11
|
+
- Includes conversion factors, dimension references, and unit systems
|
12
|
+
|
13
|
+
- **`quantities-schema.yaml`** - Schema for `quantities.yaml`
|
14
|
+
- Defines physical quantities with their dimensional analysis
|
15
|
+
- Links quantities to their fundamental dimensions
|
16
|
+
|
17
|
+
- **`dimensions-schema.yaml`** - Schema for `dimensions.yaml`
|
18
|
+
- Defines fundamental physical dimensions (length, mass, time, etc.)
|
19
|
+
- Includes dimensional components and mathematical symbols
|
20
|
+
|
21
|
+
- **`prefixes-schema.yaml`** - Schema for `prefixes.yaml`
|
22
|
+
- Defines unit prefixes (kilo, mega, micro, etc.)
|
23
|
+
- Includes base/power notation and symbol representations
|
24
|
+
|
25
|
+
- **`scales-schema.yaml`** - Schema for `scales.yaml`
|
26
|
+
- Defines measurement scales and their properties
|
27
|
+
- Includes scale types and conversion relationships
|
28
|
+
|
29
|
+
- **`unit_systems-schema.yaml`** - Schema for `unit_systems.yaml`
|
30
|
+
- Defines coherent systems of units (SI, CGS, etc.)
|
31
|
+
- Includes base units and derived unit relationships
|
32
|
+
|
33
|
+
## Features
|
34
|
+
|
35
|
+
### Validation
|
36
|
+
All schemas provide comprehensive validation for:
|
37
|
+
- Required fields and data types
|
38
|
+
- Enumerated values for controlled vocabularies
|
39
|
+
- Pattern matching for identifiers and codes
|
40
|
+
- Cross-references between related entities
|
41
|
+
|
42
|
+
### Documentation
|
43
|
+
Each schema includes:
|
44
|
+
- Detailed descriptions for all fields
|
45
|
+
- Examples of valid values
|
46
|
+
- Explanations of relationships between entities
|
47
|
+
|
48
|
+
### IDE Support
|
49
|
+
The schemas enable:
|
50
|
+
- Auto-completion in YAML editors
|
51
|
+
- Real-time validation feedback
|
52
|
+
- Hover documentation for fields
|
53
|
+
- Error highlighting and suggestions
|
54
|
+
|
55
|
+
## Usage
|
56
|
+
|
57
|
+
### In VSCode
|
58
|
+
The YAML files automatically reference their schemas via the `yaml-language-server` directive at the top of each file:
|
59
|
+
|
60
|
+
```yaml
|
61
|
+
# yaml-language-server: $schema=schemas/units-schema.yaml
|
62
|
+
```
|
63
|
+
|
64
|
+
### Programmatic Validation
|
65
|
+
Use the provided validation script:
|
66
|
+
|
67
|
+
```bash
|
68
|
+
ruby validate_schemas.rb
|
69
|
+
```
|
70
|
+
|
71
|
+
### Manual Validation
|
72
|
+
You can validate individual files using any JSON Schema validator that supports YAML, such as:
|
73
|
+
- `ajv-cli`
|
74
|
+
- `jsonschema` (Python)
|
75
|
+
- Online validators like jsonschemavalidator.net
|
76
|
+
|
77
|
+
## Schema Structure
|
78
|
+
|
79
|
+
All schemas follow a consistent structure:
|
80
|
+
|
81
|
+
```yaml
|
82
|
+
$schema: "http://json-schema.org/draft-06/schema#"
|
83
|
+
$id: "https://unitsml.org/schemas/[schema-name].yaml"
|
84
|
+
title: "[Human Readable Title]"
|
85
|
+
description: "[Detailed description]"
|
86
|
+
|
87
|
+
type: object
|
88
|
+
required: ["schema_version", "[main_array]"]
|
89
|
+
properties:
|
90
|
+
schema_version:
|
91
|
+
type: string
|
92
|
+
pattern: "^\\d+\\.\\d+\\.\\d+$"
|
93
|
+
[main_array]:
|
94
|
+
type: array
|
95
|
+
items:
|
96
|
+
$ref: "#/definitions/[MainType]"
|
97
|
+
|
98
|
+
definitions:
|
99
|
+
# Type definitions...
|
100
|
+
```
|
101
|
+
|
102
|
+
## Common Definitions
|
103
|
+
|
104
|
+
### Identifier
|
105
|
+
All entities use a consistent identifier structure:
|
106
|
+
```yaml
|
107
|
+
type: object
|
108
|
+
required: ["type", "id"]
|
109
|
+
properties:
|
110
|
+
type:
|
111
|
+
type: string
|
112
|
+
enum: ["nist", "unitsml", "si-digital-framework", ...]
|
113
|
+
id:
|
114
|
+
type: string
|
115
|
+
```
|
116
|
+
|
117
|
+
### Name
|
118
|
+
Multilingual names follow this pattern:
|
119
|
+
```yaml
|
120
|
+
type: object
|
121
|
+
required: ["value", "lang"]
|
122
|
+
properties:
|
123
|
+
value:
|
124
|
+
type: string
|
125
|
+
lang:
|
126
|
+
type: string
|
127
|
+
pattern: "^[a-z]{2}(-[A-Z]{2})?$"
|
128
|
+
```
|
129
|
+
|
130
|
+
### Symbol
|
131
|
+
Mathematical symbols are represented as:
|
132
|
+
```yaml
|
133
|
+
type: object
|
134
|
+
required: ["latex", "unicode", "ascii", "html", "id", "mathml"]
|
135
|
+
properties:
|
136
|
+
latex: { type: string }
|
137
|
+
unicode: { type: string }
|
138
|
+
ascii: { type: string }
|
139
|
+
html: { type: string }
|
140
|
+
id: { type: string }
|
141
|
+
mathml: { type: string }
|
142
|
+
```
|
143
|
+
|
144
|
+
## Validation Results
|
145
|
+
|
146
|
+
✅ All schemas successfully validate their corresponding YAML files
|
147
|
+
✅ Cross-references and relationships are properly defined
|
148
|
+
✅ Enumerated values match actual data usage
|
149
|
+
✅ Required fields are correctly identified
|
150
|
+
|
151
|
+
## Maintenance
|
152
|
+
|
153
|
+
When updating the YAML data files:
|
154
|
+
1. Ensure changes conform to the existing schemas
|
155
|
+
2. Update schemas if new fields or structures are added
|
156
|
+
3. Run validation to verify compatibility
|
157
|
+
4. Update this documentation if schema structure changes
|
158
|
+
|
159
|
+
For questions or issues with the schemas, please refer to the main repository documentation or open an issue.
|
@@ -0,0 +1,157 @@
|
|
1
|
+
# yaml-language-server: $schema=http://json-schema.org/draft-06/schema
|
2
|
+
---
|
3
|
+
$schema: "http://json-schema.org/draft-06/schema#"
|
4
|
+
$id: "https://unitsml.org/schemas/dimensions-schema.yaml"
|
5
|
+
title: "Dimensions Database Schema"
|
6
|
+
description: "Schema for dimensions.yaml - defines fundamental physical dimensions"
|
7
|
+
|
8
|
+
type: object
|
9
|
+
required: ["schema_version", "dimensions"]
|
10
|
+
properties:
|
11
|
+
schema_version:
|
12
|
+
type: string
|
13
|
+
pattern: "^\\d+\\.\\d+\\.\\d+$"
|
14
|
+
description: "Semantic version of the schema"
|
15
|
+
dimensions:
|
16
|
+
type: array
|
17
|
+
description: "Array of dimension definitions"
|
18
|
+
items:
|
19
|
+
$ref: "#/definitions/Dimension"
|
20
|
+
|
21
|
+
definitions:
|
22
|
+
Dimension:
|
23
|
+
type: object
|
24
|
+
required: ["identifiers", "names", "short"]
|
25
|
+
properties:
|
26
|
+
identifiers:
|
27
|
+
type: array
|
28
|
+
description: "External identifiers for this dimension"
|
29
|
+
items:
|
30
|
+
$ref: "#/definitions/Identifier"
|
31
|
+
names:
|
32
|
+
type: array
|
33
|
+
description: "Multilingual names for this dimension"
|
34
|
+
items:
|
35
|
+
$ref: "#/definitions/Name"
|
36
|
+
short:
|
37
|
+
type: string
|
38
|
+
description: "Short identifier for the dimension"
|
39
|
+
dimensionless:
|
40
|
+
type: boolean
|
41
|
+
description: "Whether this is a dimensionless quantity"
|
42
|
+
length:
|
43
|
+
$ref: "#/definitions/DimensionComponent"
|
44
|
+
description: "Length dimension component"
|
45
|
+
mass:
|
46
|
+
$ref: "#/definitions/DimensionComponent"
|
47
|
+
description: "Mass dimension component"
|
48
|
+
time:
|
49
|
+
$ref: "#/definitions/DimensionComponent"
|
50
|
+
description: "Time dimension component"
|
51
|
+
electric_current:
|
52
|
+
$ref: "#/definitions/DimensionComponent"
|
53
|
+
description: "Electric current dimension component"
|
54
|
+
thermodynamic_temperature:
|
55
|
+
$ref: "#/definitions/DimensionComponent"
|
56
|
+
description: "Thermodynamic temperature dimension component"
|
57
|
+
amount_of_substance:
|
58
|
+
$ref: "#/definitions/DimensionComponent"
|
59
|
+
description: "Amount of substance dimension component"
|
60
|
+
luminous_intensity:
|
61
|
+
$ref: "#/definitions/DimensionComponent"
|
62
|
+
description: "Luminous intensity dimension component"
|
63
|
+
plane_angle:
|
64
|
+
$ref: "#/definitions/DimensionComponent"
|
65
|
+
description: "Plane angle dimension component"
|
66
|
+
references:
|
67
|
+
type: array
|
68
|
+
description: "External references and citations"
|
69
|
+
items:
|
70
|
+
$ref: "#/definitions/Reference"
|
71
|
+
|
72
|
+
Identifier:
|
73
|
+
type: object
|
74
|
+
required: ["type", "id"]
|
75
|
+
properties:
|
76
|
+
type:
|
77
|
+
type: string
|
78
|
+
enum: ["nist", "unitsml", "si-digital-framework"]
|
79
|
+
description: "Type of identifier system"
|
80
|
+
id:
|
81
|
+
type: string
|
82
|
+
description: "Identifier value within the system"
|
83
|
+
|
84
|
+
Name:
|
85
|
+
type: object
|
86
|
+
required: ["value", "lang"]
|
87
|
+
properties:
|
88
|
+
value:
|
89
|
+
type: string
|
90
|
+
description: "Name in the specified language"
|
91
|
+
lang:
|
92
|
+
type: string
|
93
|
+
pattern: "^[a-z]{2}(-[A-Z]{2})?$"
|
94
|
+
description: "Language code (ISO 639-1, optionally with ISO 3166-1 country)"
|
95
|
+
|
96
|
+
Symbol:
|
97
|
+
type: object
|
98
|
+
required: ["latex", "unicode", "ascii", "html", "id", "mathml"]
|
99
|
+
properties:
|
100
|
+
latex:
|
101
|
+
type: string
|
102
|
+
description: "LaTeX representation"
|
103
|
+
unicode:
|
104
|
+
type: string
|
105
|
+
description: "Unicode representation"
|
106
|
+
ascii:
|
107
|
+
type: string
|
108
|
+
description: "ASCII representation"
|
109
|
+
html:
|
110
|
+
type: string
|
111
|
+
description: "HTML representation"
|
112
|
+
id:
|
113
|
+
type: string
|
114
|
+
description: "Identifier for the symbol"
|
115
|
+
mathml:
|
116
|
+
type: string
|
117
|
+
description: "MathML representation"
|
118
|
+
|
119
|
+
DimensionComponent:
|
120
|
+
type: object
|
121
|
+
required: ["power", "symbol"]
|
122
|
+
properties:
|
123
|
+
power:
|
124
|
+
type: integer
|
125
|
+
description: "Exponent for this dimension component"
|
126
|
+
symbol:
|
127
|
+
type: string
|
128
|
+
description: "Symbol representing this dimension"
|
129
|
+
symbols:
|
130
|
+
type: array
|
131
|
+
description: "Mathematical and textual representations"
|
132
|
+
items:
|
133
|
+
$ref: "#/definitions/Symbol"
|
134
|
+
|
135
|
+
Reference:
|
136
|
+
type: object
|
137
|
+
required: ["type"]
|
138
|
+
properties:
|
139
|
+
type:
|
140
|
+
type: string
|
141
|
+
enum: ["standard", "specification", "publication", "website"]
|
142
|
+
description: "Type of reference"
|
143
|
+
authority:
|
144
|
+
type: string
|
145
|
+
description: "Authoritative body or organization"
|
146
|
+
uri:
|
147
|
+
type: string
|
148
|
+
format: "uri"
|
149
|
+
description: "URI to the reference"
|
150
|
+
title:
|
151
|
+
type: string
|
152
|
+
description: "Title of the reference"
|
153
|
+
year:
|
154
|
+
type: integer
|
155
|
+
minimum: 1000
|
156
|
+
maximum: 9999
|
157
|
+
description: "Publication year"
|
@@ -0,0 +1,159 @@
|
|
1
|
+
# yaml-language-server: $schema=http://json-schema.org/draft-06/schema
|
2
|
+
---
|
3
|
+
$schema: "http://json-schema.org/draft-06/schema"
|
4
|
+
$id: "https://unitsml.org/schemas/prefixes-schema.yaml"
|
5
|
+
title: "Prefixes Database Schema"
|
6
|
+
description: "Schema for prefixes.yaml - defines unit prefixes with their multipliers and symbols"
|
7
|
+
|
8
|
+
type: object
|
9
|
+
required: ["schema_version", "prefixes"]
|
10
|
+
properties:
|
11
|
+
schema_version:
|
12
|
+
type: string
|
13
|
+
pattern: "^\\d+\\.\\d+\\.\\d+$"
|
14
|
+
description: "Semantic version of the schema"
|
15
|
+
prefixes:
|
16
|
+
type: array
|
17
|
+
description: "Array of prefix definitions"
|
18
|
+
items:
|
19
|
+
$ref: "#/definitions/Prefix"
|
20
|
+
|
21
|
+
definitions:
|
22
|
+
Prefix:
|
23
|
+
type: object
|
24
|
+
required: ["identifiers", "names", "base", "power", "short", "symbols"]
|
25
|
+
properties:
|
26
|
+
identifiers:
|
27
|
+
type: array
|
28
|
+
description: "External identifiers for this prefix"
|
29
|
+
items:
|
30
|
+
$ref: "#/definitions/Identifier"
|
31
|
+
names:
|
32
|
+
type: array
|
33
|
+
description: "Multilingual names for this prefix"
|
34
|
+
items:
|
35
|
+
$ref: "#/definitions/Name"
|
36
|
+
base:
|
37
|
+
type: integer
|
38
|
+
description: "Base number for the prefix (e.g., 10 for decimal, 2 for binary)"
|
39
|
+
power:
|
40
|
+
type: integer
|
41
|
+
description: "Power/exponent for the prefix"
|
42
|
+
short:
|
43
|
+
type: string
|
44
|
+
description: "Short identifier for the prefix"
|
45
|
+
symbols:
|
46
|
+
type: array
|
47
|
+
description: "Mathematical and textual representations"
|
48
|
+
items:
|
49
|
+
$ref: "#/definitions/PrefixSymbol"
|
50
|
+
references:
|
51
|
+
type: array
|
52
|
+
description: "External references and citations"
|
53
|
+
items:
|
54
|
+
$ref: "#/definitions/Reference"
|
55
|
+
|
56
|
+
Identifier:
|
57
|
+
type: object
|
58
|
+
required: ["type", "id"]
|
59
|
+
properties:
|
60
|
+
type:
|
61
|
+
type: string
|
62
|
+
enum: ["nist", "unitsml", "ucum", "si-digital-framework"]
|
63
|
+
description: "Type of identifier system"
|
64
|
+
id:
|
65
|
+
type: string
|
66
|
+
description: "Identifier value within the system"
|
67
|
+
|
68
|
+
Name:
|
69
|
+
type: object
|
70
|
+
required: ["value", "lang"]
|
71
|
+
properties:
|
72
|
+
value:
|
73
|
+
type: string
|
74
|
+
description: "Name in the specified language"
|
75
|
+
lang:
|
76
|
+
type: string
|
77
|
+
pattern: "^[a-z]{2}(-[A-Z]{2})?$"
|
78
|
+
description: "Language code (ISO 639-1, optionally with ISO 3166-1 country)"
|
79
|
+
|
80
|
+
Symbol:
|
81
|
+
type: object
|
82
|
+
required: ["type"]
|
83
|
+
properties:
|
84
|
+
type:
|
85
|
+
type: string
|
86
|
+
enum: ["latex", "unicode", "ascii", "html", "id", "mathml"]
|
87
|
+
description: "Type of symbol representation"
|
88
|
+
value:
|
89
|
+
type: string
|
90
|
+
description: "Symbol value (required for most types)"
|
91
|
+
allOf:
|
92
|
+
- if:
|
93
|
+
properties:
|
94
|
+
type:
|
95
|
+
const: "id"
|
96
|
+
then:
|
97
|
+
not:
|
98
|
+
required: ["value"]
|
99
|
+
else:
|
100
|
+
required: ["value"]
|
101
|
+
|
102
|
+
PrefixSymbol:
|
103
|
+
type: object
|
104
|
+
required: ["latex", "unicode", "ascii", "html", "id", "mathml"]
|
105
|
+
properties:
|
106
|
+
latex:
|
107
|
+
type: string
|
108
|
+
description: "LaTeX representation"
|
109
|
+
unicode:
|
110
|
+
type: string
|
111
|
+
description: "Unicode representation"
|
112
|
+
ascii:
|
113
|
+
type: string
|
114
|
+
description: "ASCII representation"
|
115
|
+
html:
|
116
|
+
type: string
|
117
|
+
description: "HTML representation"
|
118
|
+
id:
|
119
|
+
type: string
|
120
|
+
description: "Identifier for the symbol"
|
121
|
+
mathml:
|
122
|
+
type: string
|
123
|
+
description: "MathML representation"
|
124
|
+
|
125
|
+
Multiplier:
|
126
|
+
type: object
|
127
|
+
required: ["base", "power"]
|
128
|
+
properties:
|
129
|
+
base:
|
130
|
+
type: integer
|
131
|
+
minimum: 2
|
132
|
+
description: "Base of the multiplier (typically 10)"
|
133
|
+
power:
|
134
|
+
type: integer
|
135
|
+
description: "Exponent for the multiplier"
|
136
|
+
|
137
|
+
Reference:
|
138
|
+
type: object
|
139
|
+
required: ["type"]
|
140
|
+
properties:
|
141
|
+
type:
|
142
|
+
type: string
|
143
|
+
enum: ["standard", "specification", "publication", "website", "normative", "informative"]
|
144
|
+
description: "Type of reference"
|
145
|
+
authority:
|
146
|
+
type: string
|
147
|
+
description: "Authoritative body or organization"
|
148
|
+
uri:
|
149
|
+
type: string
|
150
|
+
format: "uri"
|
151
|
+
description: "URI to the reference"
|
152
|
+
title:
|
153
|
+
type: string
|
154
|
+
description: "Title of the reference"
|
155
|
+
year:
|
156
|
+
type: integer
|
157
|
+
minimum: 1000
|
158
|
+
maximum: 9999
|
159
|
+
description: "Publication year"
|
@@ -0,0 +1,120 @@
|
|
1
|
+
# yaml-language-server: $schema=http://json-schema.org/draft-06/schema
|
2
|
+
|
3
|
+
---
|
4
|
+
$schema: "http://json-schema.org/draft-06/schema#"
|
5
|
+
$id: "https://unitsml.org/schemas/quantities-schema.yaml"
|
6
|
+
title: "Quantities Database Schema"
|
7
|
+
description: "Schema for quantities.yaml - defines physical quantities with their dimensional analysis"
|
8
|
+
|
9
|
+
type: object
|
10
|
+
required: ["schema_version", "quantities"]
|
11
|
+
properties:
|
12
|
+
schema_version:
|
13
|
+
type: string
|
14
|
+
pattern: "^\\d+\\.\\d+\\.\\d+$"
|
15
|
+
description: "Semantic version of the schema"
|
16
|
+
quantities:
|
17
|
+
type: array
|
18
|
+
description: "Array of quantity definitions"
|
19
|
+
items:
|
20
|
+
$ref: "#/definitions/Quantity"
|
21
|
+
|
22
|
+
definitions:
|
23
|
+
Quantity:
|
24
|
+
type: object
|
25
|
+
required: ["identifiers", "names", "dimension_reference", "quantity_type", "short"]
|
26
|
+
properties:
|
27
|
+
identifiers:
|
28
|
+
type: array
|
29
|
+
description: "External identifiers for this quantity"
|
30
|
+
items:
|
31
|
+
$ref: "#/definitions/Identifier"
|
32
|
+
names:
|
33
|
+
type: array
|
34
|
+
description: "Multilingual names for this quantity"
|
35
|
+
items:
|
36
|
+
$ref: "#/definitions/Name"
|
37
|
+
dimension_reference:
|
38
|
+
$ref: "#/definitions/DimensionReference"
|
39
|
+
description: "Reference to the dimension"
|
40
|
+
quantity_type:
|
41
|
+
type: string
|
42
|
+
enum: ["base", "derived"]
|
43
|
+
description: "Type of quantity (base or derived)"
|
44
|
+
short:
|
45
|
+
type: string
|
46
|
+
description: "Short identifier for the quantity"
|
47
|
+
references:
|
48
|
+
type: array
|
49
|
+
description: "External references and citations"
|
50
|
+
items:
|
51
|
+
$ref: "#/definitions/Reference"
|
52
|
+
|
53
|
+
Identifier:
|
54
|
+
type: object
|
55
|
+
required: ["type", "id"]
|
56
|
+
properties:
|
57
|
+
type:
|
58
|
+
type: string
|
59
|
+
description: "Type of identifier system"
|
60
|
+
id:
|
61
|
+
type: string
|
62
|
+
description: "Identifier value within the system"
|
63
|
+
|
64
|
+
Name:
|
65
|
+
type: object
|
66
|
+
required: ["value", "lang"]
|
67
|
+
properties:
|
68
|
+
value:
|
69
|
+
type: string
|
70
|
+
description: "Name in the specified language"
|
71
|
+
lang:
|
72
|
+
type: string
|
73
|
+
pattern: "^[a-z]{2}(-[A-Z]{2})?$"
|
74
|
+
description: "Language code (ISO 639-1, optionally with ISO 3166-1 country)"
|
75
|
+
|
76
|
+
DimensionReference:
|
77
|
+
type: object
|
78
|
+
required: ["type", "id"]
|
79
|
+
properties:
|
80
|
+
type:
|
81
|
+
type: string
|
82
|
+
const: "nist"
|
83
|
+
description: "Reference type indicator"
|
84
|
+
id:
|
85
|
+
type: string
|
86
|
+
description: "Dimension identifier"
|
87
|
+
|
88
|
+
Symbol:
|
89
|
+
type: object
|
90
|
+
required: ["type"]
|
91
|
+
properties:
|
92
|
+
type:
|
93
|
+
type: string
|
94
|
+
description: "Type of symbol representation"
|
95
|
+
value:
|
96
|
+
type: string
|
97
|
+
description: "Symbol value"
|
98
|
+
|
99
|
+
Reference:
|
100
|
+
type: object
|
101
|
+
required: ["type"]
|
102
|
+
properties:
|
103
|
+
type:
|
104
|
+
type: string
|
105
|
+
description: "Type of reference"
|
106
|
+
authority:
|
107
|
+
type: string
|
108
|
+
description: "Authoritative body or organization"
|
109
|
+
uri:
|
110
|
+
type: string
|
111
|
+
format: "uri"
|
112
|
+
description: "URI to the reference"
|
113
|
+
title:
|
114
|
+
type: string
|
115
|
+
description: "Title of the reference"
|
116
|
+
year:
|
117
|
+
type: integer
|
118
|
+
minimum: 1000
|
119
|
+
maximum: 9999
|
120
|
+
description: "Publication year"
|