unitsdb 1.0.0 → 2.1.0
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/.gitmodules +3 -0
- data/.rspec +2 -1
- data/.rubocop_todo.yml +88 -12
- data/Gemfile +2 -2
- data/README.adoc +697 -1
- data/exe/unitsdb +7 -0
- data/lib/unitsdb/cli.rb +81 -0
- data/lib/unitsdb/commands/_modify.rb +22 -0
- data/lib/unitsdb/commands/base.rb +52 -0
- data/lib/unitsdb/commands/check_si.rb +124 -0
- data/lib/unitsdb/commands/get.rb +133 -0
- data/lib/unitsdb/commands/normalize.rb +81 -0
- data/lib/unitsdb/commands/release.rb +112 -0
- data/lib/unitsdb/commands/search.rb +219 -0
- data/lib/unitsdb/commands/si_formatter.rb +485 -0
- data/lib/unitsdb/commands/si_matcher.rb +470 -0
- data/lib/unitsdb/commands/si_ttl_parser.rb +100 -0
- data/lib/unitsdb/commands/si_updater.rb +212 -0
- data/lib/unitsdb/commands/validate/identifiers.rb +40 -0
- data/lib/unitsdb/commands/validate/references.rb +316 -0
- data/lib/unitsdb/commands/validate/si_references.rb +115 -0
- data/lib/unitsdb/commands/validate.rb +40 -0
- data/lib/unitsdb/database.rb +661 -0
- data/lib/unitsdb/dimension.rb +49 -0
- data/lib/unitsdb/dimension_details.rb +20 -0
- data/lib/unitsdb/dimension_reference.rb +8 -0
- data/lib/unitsdb/dimensions.rb +4 -10
- data/lib/unitsdb/errors.rb +13 -0
- data/lib/unitsdb/external_reference.rb +14 -0
- data/lib/unitsdb/identifier.rb +8 -0
- data/lib/unitsdb/localized_string.rb +17 -0
- data/lib/unitsdb/prefix.rb +30 -0
- data/lib/unitsdb/prefix_reference.rb +10 -0
- data/lib/unitsdb/prefixes.rb +4 -11
- data/lib/unitsdb/quantities.rb +4 -31
- data/lib/unitsdb/quantity.rb +21 -0
- data/lib/unitsdb/quantity_reference.rb +10 -0
- data/lib/unitsdb/root_unit_reference.rb +14 -0
- data/lib/unitsdb/scale.rb +17 -0
- data/lib/unitsdb/scale_properties.rb +12 -0
- data/lib/unitsdb/scale_reference.rb +10 -0
- data/lib/unitsdb/scales.rb +11 -0
- data/lib/unitsdb/si_derived_base.rb +19 -0
- data/lib/unitsdb/symbol_presentations.rb +3 -8
- data/lib/unitsdb/unit.rb +63 -0
- data/lib/unitsdb/unit_reference.rb +10 -0
- data/lib/unitsdb/unit_system.rb +15 -0
- data/lib/unitsdb/unit_system_reference.rb +10 -0
- data/lib/unitsdb/unit_systems.rb +4 -10
- data/lib/unitsdb/units.rb +4 -10
- data/lib/unitsdb/utils.rb +84 -0
- data/lib/unitsdb/version.rb +1 -1
- data/lib/unitsdb.rb +12 -2
- data/unitsdb.gemspec +6 -1
- metadata +116 -20
- data/lib/unitsdb/dimensions/dimension.rb +0 -59
- data/lib/unitsdb/dimensions/quantity.rb +0 -32
- data/lib/unitsdb/dimensions/symbol.rb +0 -26
- data/lib/unitsdb/prefixes/prefix.rb +0 -35
- data/lib/unitsdb/prefixes/symbol.rb +0 -17
- data/lib/unitsdb/quantities/quantity.rb +0 -37
- data/lib/unitsdb/quantities/unit_reference.rb +0 -15
- data/lib/unitsdb/unit_systems/unit_system.rb +0 -19
- data/lib/unitsdb/units/quantity_reference.rb +0 -17
- data/lib/unitsdb/units/root_unit.rb +0 -21
- data/lib/unitsdb/units/root_units.rb +0 -18
- data/lib/unitsdb/units/si_derived_base.rb +0 -26
- data/lib/unitsdb/units/symbol.rb +0 -19
- data/lib/unitsdb/units/system.rb +0 -17
- data/lib/unitsdb/units/unit.rb +0 -73
- data/lib/unitsdb/unitsdb.rb +0 -6
data/lib/unitsdb.rb
CHANGED
@@ -4,8 +4,18 @@ require "lutaml/model"
|
|
4
4
|
|
5
5
|
require_relative "unitsdb/version"
|
6
6
|
require_relative "unitsdb/config"
|
7
|
-
require_relative "unitsdb/
|
8
|
-
require_relative "unitsdb/
|
7
|
+
require_relative "unitsdb/errors"
|
8
|
+
require_relative "unitsdb/database"
|
9
9
|
require_relative "unitsdb/dimensions"
|
10
10
|
require_relative "unitsdb/prefixes"
|
11
11
|
require_relative "unitsdb/quantities"
|
12
|
+
require_relative "unitsdb/unit_systems"
|
13
|
+
require_relative "unitsdb/scales"
|
14
|
+
require_relative "unitsdb/units"
|
15
|
+
require_relative "unitsdb/utils"
|
16
|
+
|
17
|
+
# CLI-related requires
|
18
|
+
require_relative "unitsdb/cli" if defined?(Thor)
|
19
|
+
|
20
|
+
module Unitsdb
|
21
|
+
end
|
data/unitsdb.gemspec
CHANGED
@@ -33,5 +33,10 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
34
34
|
spec.require_paths = ["lib"]
|
35
35
|
|
36
|
-
spec.add_dependency "lutaml-model"
|
36
|
+
spec.add_dependency "lutaml-model", "~>0.7"
|
37
|
+
spec.add_dependency "rdf", "~> 3.1"
|
38
|
+
spec.add_dependency "rdf-turtle", "~> 3.1"
|
39
|
+
spec.add_dependency "rubyzip", "~> 2.3"
|
40
|
+
spec.add_dependency "terminal-table"
|
41
|
+
spec.add_dependency "thor", "~> 1.0"
|
37
42
|
end
|
metadata
CHANGED
@@ -1,17 +1,73 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unitsdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lutaml-model
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.7'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rdf
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rdf-turtle
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubyzip
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.3'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: terminal-table
|
15
71
|
requirement: !ruby/object:Gem::Requirement
|
16
72
|
requirements:
|
17
73
|
- - ">="
|
@@ -24,10 +80,25 @@ dependencies:
|
|
24
80
|
- - ">="
|
25
81
|
- !ruby/object:Gem::Version
|
26
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: thor
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.0'
|
27
97
|
description: Library to handle UnitsDB content.
|
28
98
|
email:
|
29
99
|
- open.source@ribose.com
|
30
|
-
executables:
|
100
|
+
executables:
|
101
|
+
- unitsdb
|
31
102
|
extensions: []
|
32
103
|
extra_rdoc_files: []
|
33
104
|
files:
|
@@ -36,6 +107,7 @@ files:
|
|
36
107
|
- ".github/workflows/rake.yml"
|
37
108
|
- ".github/workflows/release.yml"
|
38
109
|
- ".gitignore"
|
110
|
+
- ".gitmodules"
|
39
111
|
- ".rspec"
|
40
112
|
- ".rubocop.yml"
|
41
113
|
- ".rubocop_todo.yml"
|
@@ -46,30 +118,54 @@ files:
|
|
46
118
|
- Rakefile
|
47
119
|
- bin/console
|
48
120
|
- bin/setup
|
121
|
+
- exe/unitsdb
|
49
122
|
- lib/unitsdb.rb
|
123
|
+
- lib/unitsdb/cli.rb
|
124
|
+
- lib/unitsdb/commands/_modify.rb
|
125
|
+
- lib/unitsdb/commands/base.rb
|
126
|
+
- lib/unitsdb/commands/check_si.rb
|
127
|
+
- lib/unitsdb/commands/get.rb
|
128
|
+
- lib/unitsdb/commands/normalize.rb
|
129
|
+
- lib/unitsdb/commands/release.rb
|
130
|
+
- lib/unitsdb/commands/search.rb
|
131
|
+
- lib/unitsdb/commands/si_formatter.rb
|
132
|
+
- lib/unitsdb/commands/si_matcher.rb
|
133
|
+
- lib/unitsdb/commands/si_ttl_parser.rb
|
134
|
+
- lib/unitsdb/commands/si_updater.rb
|
135
|
+
- lib/unitsdb/commands/validate.rb
|
136
|
+
- lib/unitsdb/commands/validate/identifiers.rb
|
137
|
+
- lib/unitsdb/commands/validate/references.rb
|
138
|
+
- lib/unitsdb/commands/validate/si_references.rb
|
50
139
|
- lib/unitsdb/config.rb
|
140
|
+
- lib/unitsdb/database.rb
|
141
|
+
- lib/unitsdb/dimension.rb
|
142
|
+
- lib/unitsdb/dimension_details.rb
|
143
|
+
- lib/unitsdb/dimension_reference.rb
|
51
144
|
- lib/unitsdb/dimensions.rb
|
52
|
-
- lib/unitsdb/
|
53
|
-
- lib/unitsdb/
|
54
|
-
- lib/unitsdb/
|
145
|
+
- lib/unitsdb/errors.rb
|
146
|
+
- lib/unitsdb/external_reference.rb
|
147
|
+
- lib/unitsdb/identifier.rb
|
148
|
+
- lib/unitsdb/localized_string.rb
|
149
|
+
- lib/unitsdb/prefix.rb
|
150
|
+
- lib/unitsdb/prefix_reference.rb
|
55
151
|
- lib/unitsdb/prefixes.rb
|
56
|
-
- lib/unitsdb/prefixes/prefix.rb
|
57
|
-
- lib/unitsdb/prefixes/symbol.rb
|
58
152
|
- lib/unitsdb/quantities.rb
|
59
|
-
- lib/unitsdb/
|
60
|
-
- lib/unitsdb/
|
153
|
+
- lib/unitsdb/quantity.rb
|
154
|
+
- lib/unitsdb/quantity_reference.rb
|
155
|
+
- lib/unitsdb/root_unit_reference.rb
|
156
|
+
- lib/unitsdb/scale.rb
|
157
|
+
- lib/unitsdb/scale_properties.rb
|
158
|
+
- lib/unitsdb/scale_reference.rb
|
159
|
+
- lib/unitsdb/scales.rb
|
160
|
+
- lib/unitsdb/si_derived_base.rb
|
61
161
|
- lib/unitsdb/symbol_presentations.rb
|
162
|
+
- lib/unitsdb/unit.rb
|
163
|
+
- lib/unitsdb/unit_reference.rb
|
164
|
+
- lib/unitsdb/unit_system.rb
|
165
|
+
- lib/unitsdb/unit_system_reference.rb
|
62
166
|
- lib/unitsdb/unit_systems.rb
|
63
|
-
- lib/unitsdb/unit_systems/unit_system.rb
|
64
167
|
- lib/unitsdb/units.rb
|
65
|
-
- lib/unitsdb/
|
66
|
-
- lib/unitsdb/units/root_unit.rb
|
67
|
-
- lib/unitsdb/units/root_units.rb
|
68
|
-
- lib/unitsdb/units/si_derived_base.rb
|
69
|
-
- lib/unitsdb/units/symbol.rb
|
70
|
-
- lib/unitsdb/units/system.rb
|
71
|
-
- lib/unitsdb/units/unit.rb
|
72
|
-
- lib/unitsdb/unitsdb.rb
|
168
|
+
- lib/unitsdb/utils.rb
|
73
169
|
- lib/unitsdb/version.rb
|
74
170
|
- sig/unitsdb.rbs
|
75
171
|
- unitsdb.gemspec
|
@@ -95,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
191
|
- !ruby/object:Gem::Version
|
96
192
|
version: '0'
|
97
193
|
requirements: []
|
98
|
-
rubygems_version: 3.
|
194
|
+
rubygems_version: 3.5.22
|
99
195
|
signing_key:
|
100
196
|
specification_version: 4
|
101
197
|
summary: Ruby library for UnitsDB
|
@@ -1,59 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "quantity"
|
4
|
-
# NISTd1:
|
5
|
-
# length:
|
6
|
-
# powerNumerator: 1
|
7
|
-
# symbol: L
|
8
|
-
# dim_symbols:
|
9
|
-
# - id: "dim_L"
|
10
|
-
# ascii: "L"
|
11
|
-
# html: "𝖫"
|
12
|
-
# mathml: "<mi mathvariant='sans-serif'>L</mi>"
|
13
|
-
# latex: \ensuremath{\mathsf{L}}
|
14
|
-
# unicode: "𝖫"
|
15
|
-
|
16
|
-
# NISTd9:
|
17
|
-
# -dimensionless: true
|
18
|
-
# -plane_angle:
|
19
|
-
# - dim_symbols:
|
20
|
-
# - - ascii: phi
|
21
|
-
# - html: "𝞅"
|
22
|
-
# - id: dim_phi
|
23
|
-
# - latex: "\\ensuremath{\\mathsf{\\phi}}"
|
24
|
-
# - mathml: "<mi mathvariant='sans-serif'>φ</mi>"
|
25
|
-
# - unicode: "\U0001D785"
|
26
|
-
# - powerNumerator: 1
|
27
|
-
# - symbol: phi
|
28
|
-
|
29
|
-
module Unitsdb
|
30
|
-
class Dimensions
|
31
|
-
class Dimension < Lutaml::Model::Serializable
|
32
|
-
model Config.model_for(:dimension)
|
33
|
-
|
34
|
-
attribute :id, :string
|
35
|
-
attribute :dimensionless, :boolean
|
36
|
-
attribute :length, Quantity
|
37
|
-
attribute :mass, Quantity
|
38
|
-
attribute :time, Quantity
|
39
|
-
attribute :electric_current, Quantity
|
40
|
-
attribute :thermodynamic_temperature, Quantity
|
41
|
-
attribute :amount_of_substance, Quantity
|
42
|
-
attribute :luminous_intensity, Quantity
|
43
|
-
attribute :plane_angle, Quantity
|
44
|
-
|
45
|
-
key_value do
|
46
|
-
map :id, to: :id
|
47
|
-
map :dimensionless, to: :dimensionless
|
48
|
-
map :length, to: :length
|
49
|
-
map :mass, to: :mass
|
50
|
-
map :time, to: :time
|
51
|
-
map :electric_current, to: :electric_current
|
52
|
-
map :thermodynamic_temperature, to: :thermodynamic_temperature
|
53
|
-
map :amount_of_substance, to: :amount_of_substance
|
54
|
-
map :luminous_intensity, to: :luminous_intensity
|
55
|
-
map :plane_angle, to: :plane_angle
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "symbol"
|
4
|
-
# NISTd1:
|
5
|
-
# length:
|
6
|
-
# powerNumerator: 1
|
7
|
-
# symbol: L
|
8
|
-
# dim_symbols:
|
9
|
-
# - id: "dim_L"
|
10
|
-
# ascii: "L"
|
11
|
-
# html: "𝖫"
|
12
|
-
# mathml: "<mi mathvariant='sans-serif'>L</mi>"
|
13
|
-
# latex: \ensuremath{\mathsf{L}}
|
14
|
-
# unicode: "𝖫"
|
15
|
-
|
16
|
-
module Unitsdb
|
17
|
-
class Dimensions
|
18
|
-
class Quantity < Lutaml::Model::Serializable
|
19
|
-
model Config.model_for(:dimension_quantity)
|
20
|
-
|
21
|
-
attribute :power_numerator, :integer
|
22
|
-
attribute :symbol, :string
|
23
|
-
attribute :dim_symbols, Symbol, collection: true
|
24
|
-
|
25
|
-
key_value do
|
26
|
-
map :powerNumerator, to: :power_numerator
|
27
|
-
map :symbol, to: :symbol
|
28
|
-
map :dim_symbols, to: :dim_symbols
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "../symbol_presentations"
|
4
|
-
|
5
|
-
# - id: "dim_L"
|
6
|
-
# ascii: "L"
|
7
|
-
# html: "𝖫"
|
8
|
-
# mathml: "<mi mathvariant='sans-serif'>L</mi>"
|
9
|
-
# latex: \ensuremath{\mathsf{L}}
|
10
|
-
# unicode: "𝖫"
|
11
|
-
|
12
|
-
module Unitsdb
|
13
|
-
class Dimensions
|
14
|
-
class Symbol < SymbolPresentations
|
15
|
-
model Config.model_for(:dimension_symbol)
|
16
|
-
|
17
|
-
attribute :id, :string
|
18
|
-
attribute :mathml, :string
|
19
|
-
|
20
|
-
key_value do
|
21
|
-
map :id, to: :id
|
22
|
-
map :mathml, to: :mathml
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "symbol"
|
4
|
-
# ---
|
5
|
-
# NISTp10_30:
|
6
|
-
# name: quetta
|
7
|
-
# symbol:
|
8
|
-
# ascii: Q
|
9
|
-
# html: Q
|
10
|
-
# latex: Q
|
11
|
-
# unicode: Q
|
12
|
-
# base: 10
|
13
|
-
# power: 30
|
14
|
-
|
15
|
-
module Unitsdb
|
16
|
-
class Prefixes
|
17
|
-
class Prefix < Lutaml::Model::Serializable
|
18
|
-
model Config.model_for(:prefix)
|
19
|
-
|
20
|
-
attribute :id, :string
|
21
|
-
attribute :name, :string
|
22
|
-
attribute :symbol, Symbol
|
23
|
-
attribute :base, :integer
|
24
|
-
attribute :power, :integer
|
25
|
-
|
26
|
-
key_value do
|
27
|
-
map :id, to: :id
|
28
|
-
map :name, to: :name
|
29
|
-
map :symbol, to: :symbol
|
30
|
-
map :base, to: :base
|
31
|
-
map :power, to: :power
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "../symbol_presentations"
|
4
|
-
|
5
|
-
# symbol:
|
6
|
-
# ascii: R
|
7
|
-
# html: R
|
8
|
-
# latex: R
|
9
|
-
# unicode: R
|
10
|
-
|
11
|
-
module Unitsdb
|
12
|
-
class Prefixes
|
13
|
-
class Symbol < SymbolPresentations
|
14
|
-
model Config.model_for(:prefix_symbol)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "unit_reference"
|
4
|
-
|
5
|
-
# # Quantities
|
6
|
-
# NISTq156:
|
7
|
-
# dimension_url: "#NISTd68"
|
8
|
-
# quantity_type: derived
|
9
|
-
# quantity_name:
|
10
|
-
# - linear expansion coefficient
|
11
|
-
# unit_reference:
|
12
|
-
# - name: kelvin to the power minus one
|
13
|
-
# url: "#NISTu5e-1/1"
|
14
|
-
|
15
|
-
# NISTq155:
|
16
|
-
# dimension_url: "#NISTd57"
|
17
|
-
# quantity_type: derived
|
18
|
-
# quantity_name:
|
19
|
-
# - area moment of inertia
|
20
|
-
# - second moment of area
|
21
|
-
# unit_reference:
|
22
|
-
# - name: inch to the fourth power
|
23
|
-
# url: "#NISTu208"
|
24
|
-
|
25
|
-
module Unitsdb
|
26
|
-
class Quantities
|
27
|
-
class Quantity < Lutaml::Model::Serializable
|
28
|
-
model Config.model_for(:quantity)
|
29
|
-
|
30
|
-
attribute :id, :string
|
31
|
-
attribute :dimension_url, :string
|
32
|
-
attribute :quantity_type, :string
|
33
|
-
attribute :quantity_name, :string, collection: true
|
34
|
-
attribute :unit_reference, UnitReference, collection: true
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Unitsdb
|
4
|
-
class Quantities
|
5
|
-
class UnitReference < Lutaml::Model::Serializable
|
6
|
-
attribute :name, :string
|
7
|
-
attribute :url, :string
|
8
|
-
|
9
|
-
key_value do
|
10
|
-
map :name, to: :name
|
11
|
-
map :url, to: :url
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Unitsdb
|
4
|
-
class UnitSystems
|
5
|
-
class UnitSystem < Lutaml::Model::Serializable
|
6
|
-
model Config.model_for(:unit_system)
|
7
|
-
|
8
|
-
attribute :id, :string
|
9
|
-
attribute :name, :string
|
10
|
-
attribute :acceptable, :boolean
|
11
|
-
|
12
|
-
key_value do
|
13
|
-
map :id, to: :id
|
14
|
-
map :name, to: :name
|
15
|
-
map :acceptable, to: :acceptable
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Unitsdb
|
4
|
-
class Units
|
5
|
-
class QuantityReference < Lutaml::Model::Serializable
|
6
|
-
model Config.model_for(:quantity_reference)
|
7
|
-
|
8
|
-
attribute :name, :string
|
9
|
-
attribute :url, :string
|
10
|
-
|
11
|
-
key_value do
|
12
|
-
map :name, to: :name
|
13
|
-
map :url, to: :url
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Unitsdb
|
4
|
-
class Units
|
5
|
-
class RootUnit < Lutaml::Model::Serializable
|
6
|
-
model Config.model_for(:root_unit)
|
7
|
-
|
8
|
-
attribute :unit, :string
|
9
|
-
attribute :power_denominator, :integer
|
10
|
-
attribute :power_numerator, :integer
|
11
|
-
attribute :prefix, :string
|
12
|
-
|
13
|
-
key_value do
|
14
|
-
map :unit, to: :unit
|
15
|
-
map :power_denominator, to: :power_denominator
|
16
|
-
map :power_numerator, to: :power_numerator
|
17
|
-
map :prefix, to: :prefix
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "root_unit"
|
4
|
-
|
5
|
-
module Unitsdb
|
6
|
-
class Units
|
7
|
-
class RootUnits < Lutaml::Model::Serializable
|
8
|
-
model Config.model_for(:root_units)
|
9
|
-
|
10
|
-
attribute :enumerated_root_units, RootUnit, collection: true
|
11
|
-
|
12
|
-
key_value do
|
13
|
-
map :enumerated_root_units,
|
14
|
-
to: :enumerated_root_units
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# - id: NISTu1
|
4
|
-
# prefix:
|
5
|
-
# power: 1
|
6
|
-
# - id: NISTu1
|
7
|
-
# prefix:
|
8
|
-
# power: -1
|
9
|
-
|
10
|
-
module Unitsdb
|
11
|
-
class Units
|
12
|
-
class SiDerivedBase < Lutaml::Model::Serializable
|
13
|
-
model Config.model_for(:si_deribed_base)
|
14
|
-
|
15
|
-
attribute :id, :string
|
16
|
-
attribute :prefix, :string
|
17
|
-
attribute :power, :integer
|
18
|
-
|
19
|
-
key_value do
|
20
|
-
map :id, to: :id
|
21
|
-
map :prefix, to: :prefix, render_nil: true
|
22
|
-
map :power, to: :power
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
data/lib/unitsdb/units/symbol.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "../symbol_presentations"
|
4
|
-
|
5
|
-
module Unitsdb
|
6
|
-
class Units
|
7
|
-
class Symbol < SymbolPresentations
|
8
|
-
model Config.model_for(:unit_symbol)
|
9
|
-
|
10
|
-
attribute :id, :string
|
11
|
-
attribute :mathml, :string
|
12
|
-
|
13
|
-
key_value do
|
14
|
-
map :id, to: :id
|
15
|
-
map :mathml, to: :mathml
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
data/lib/unitsdb/units/system.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Unitsdb
|
4
|
-
class Units
|
5
|
-
class System < Lutaml::Model::Serializable
|
6
|
-
model Config.model_for(:system)
|
7
|
-
|
8
|
-
attribute :name, :string
|
9
|
-
attribute :type, :string
|
10
|
-
|
11
|
-
key_value do
|
12
|
-
map :type, to: :type
|
13
|
-
map :name, to: :name
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
data/lib/unitsdb/units/unit.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "symbol"
|
4
|
-
require_relative "system"
|
5
|
-
require_relative "root_units"
|
6
|
-
require_relative "si_derived_base"
|
7
|
-
require_relative "quantity_reference"
|
8
|
-
|
9
|
-
# "NISTu10":
|
10
|
-
# dimension_url: "#NISTd9"
|
11
|
-
# short: steradian
|
12
|
-
# root: true
|
13
|
-
# unit_system:
|
14
|
-
# type: "SI_derived_special"
|
15
|
-
# name: "SI"
|
16
|
-
# unit_name:
|
17
|
-
# - "steradian"
|
18
|
-
# unit_symbols:
|
19
|
-
# - id: "sr"
|
20
|
-
# ascii: "sr"
|
21
|
-
# html: "sr"
|
22
|
-
# mathml: "<mi mathvariant='normal'>sr</mi>"
|
23
|
-
# latex: \ensuremath{\mathrm{sr}}
|
24
|
-
# unicode: "sr"
|
25
|
-
# root_units:
|
26
|
-
# enumerated_root_units:
|
27
|
-
# - unit: "steradian"
|
28
|
-
# power_denominator: 1
|
29
|
-
# power_numerator: 1
|
30
|
-
# quantity_reference:
|
31
|
-
# - name: "solid angle"
|
32
|
-
# url: "#NISTq11"
|
33
|
-
# si_derived_bases:
|
34
|
-
# - id: NISTu1
|
35
|
-
# prefix:
|
36
|
-
# power: 1
|
37
|
-
# - id: NISTu1
|
38
|
-
# prefix:
|
39
|
-
# power: -1
|
40
|
-
|
41
|
-
module Unitsdb
|
42
|
-
class Units
|
43
|
-
class Unit < Lutaml::Model::Serializable
|
44
|
-
model Config.model_for(:unit)
|
45
|
-
|
46
|
-
attribute :id, :string
|
47
|
-
attribute :short, :string
|
48
|
-
attribute :root, :boolean
|
49
|
-
attribute :prefixed, :boolean
|
50
|
-
attribute :dimension_url, :string
|
51
|
-
attribute :unit_system, System
|
52
|
-
attribute :unit_name, :string, collection: true
|
53
|
-
attribute :unit_symbols, Symbol, collection: true
|
54
|
-
attribute :root_units, RootUnits, collection: true
|
55
|
-
attribute :quantity_reference, QuantityReference, collection: true
|
56
|
-
attribute :si_derived_bases, SiDerivedBase, collection: true
|
57
|
-
|
58
|
-
key_value do
|
59
|
-
map :id, to: :id
|
60
|
-
map :dimension_url, to: :dimension_url
|
61
|
-
map :short, to: :short, render_nil: true
|
62
|
-
map :root, to: :root
|
63
|
-
map :prefixed, to: :prefixed
|
64
|
-
map :unit_system, to: :unit_system
|
65
|
-
map :unit_name, to: :unit_name
|
66
|
-
map :unit_symbols, to: :unit_symbols
|
67
|
-
map :root_units, to: :root_units
|
68
|
-
map :quantity_reference, to: :quantity_reference
|
69
|
-
map :si_derived_bases, to: :si_derived_bases
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|