unitsdb 0.1.1 → 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.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/dependent-repos.json +5 -0
  3. data/.github/workflows/depenedent-gems.yml +16 -0
  4. data/.gitmodules +3 -0
  5. data/.rspec +2 -1
  6. data/.rubocop_todo.yml +88 -12
  7. data/Gemfile +2 -2
  8. data/README.adoc +697 -1
  9. data/exe/unitsdb +7 -0
  10. data/lib/unitsdb/cli.rb +81 -0
  11. data/lib/unitsdb/commands/_modify.rb +22 -0
  12. data/lib/unitsdb/commands/base.rb +52 -0
  13. data/lib/unitsdb/commands/check_si.rb +124 -0
  14. data/lib/unitsdb/commands/get.rb +133 -0
  15. data/lib/unitsdb/commands/normalize.rb +81 -0
  16. data/lib/unitsdb/commands/release.rb +112 -0
  17. data/lib/unitsdb/commands/search.rb +219 -0
  18. data/lib/unitsdb/commands/si_formatter.rb +485 -0
  19. data/lib/unitsdb/commands/si_matcher.rb +470 -0
  20. data/lib/unitsdb/commands/si_ttl_parser.rb +100 -0
  21. data/lib/unitsdb/commands/si_updater.rb +212 -0
  22. data/lib/unitsdb/commands/validate/identifiers.rb +40 -0
  23. data/lib/unitsdb/commands/validate/references.rb +316 -0
  24. data/lib/unitsdb/commands/validate/si_references.rb +115 -0
  25. data/lib/unitsdb/commands/validate.rb +40 -0
  26. data/lib/unitsdb/config.rb +19 -0
  27. data/lib/unitsdb/database.rb +661 -0
  28. data/lib/unitsdb/dimension.rb +19 -25
  29. data/lib/unitsdb/dimension_details.rb +20 -0
  30. data/lib/unitsdb/dimension_reference.rb +8 -0
  31. data/lib/unitsdb/dimensions.rb +3 -6
  32. data/lib/unitsdb/errors.rb +13 -0
  33. data/lib/unitsdb/external_reference.rb +14 -0
  34. data/lib/unitsdb/identifier.rb +8 -0
  35. data/lib/unitsdb/localized_string.rb +17 -0
  36. data/lib/unitsdb/prefix.rb +11 -12
  37. data/lib/unitsdb/prefix_reference.rb +10 -0
  38. data/lib/unitsdb/prefixes.rb +3 -6
  39. data/lib/unitsdb/quantities.rb +3 -27
  40. data/lib/unitsdb/quantity.rb +12 -24
  41. data/lib/unitsdb/quantity_reference.rb +4 -7
  42. data/lib/unitsdb/root_unit_reference.rb +14 -0
  43. data/lib/unitsdb/scale.rb +17 -0
  44. data/lib/unitsdb/scale_properties.rb +12 -0
  45. data/lib/unitsdb/scale_reference.rb +10 -0
  46. data/lib/unitsdb/scales.rb +11 -0
  47. data/lib/unitsdb/si_derived_base.rb +13 -14
  48. data/lib/unitsdb/symbol_presentations.rb +14 -0
  49. data/lib/unitsdb/unit.rb +20 -26
  50. data/lib/unitsdb/unit_reference.rb +5 -8
  51. data/lib/unitsdb/unit_system.rb +8 -10
  52. data/lib/unitsdb/unit_system_reference.rb +10 -0
  53. data/lib/unitsdb/unit_systems.rb +3 -16
  54. data/lib/unitsdb/units.rb +3 -6
  55. data/lib/unitsdb/utils.rb +84 -0
  56. data/lib/unitsdb/version.rb +1 -1
  57. data/lib/unitsdb.rb +13 -10
  58. data/unitsdb.gemspec +6 -1
  59. metadata +112 -12
  60. data/lib/unitsdb/dimension_quantity.rb +0 -28
  61. data/lib/unitsdb/dimension_symbol.rb +0 -22
  62. data/lib/unitsdb/prefix_symbol.rb +0 -12
  63. data/lib/unitsdb/root_unit.rb +0 -17
  64. data/lib/unitsdb/root_units.rb +0 -20
  65. data/lib/unitsdb/symbol.rb +0 -17
  66. data/lib/unitsdb/unit_symbol.rb +0 -15
  67. data/lib/unitsdb/unitsdb.rb +0 -6
@@ -1,9 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "dimension_quantity"
3
+ require_relative "identifier"
4
+ require_relative "dimension_details"
5
+ require_relative "quantity"
6
+ require_relative "localized_string"
4
7
  # NISTd1:
5
8
  # length:
6
- # powerNumerator: 1
9
+ # power: 1
7
10
  # symbol: L
8
11
  # dim_symbols:
9
12
  # - id: "dim_L"
@@ -23,33 +26,24 @@ require_relative "dimension_quantity"
23
26
  # - latex: "\\ensuremath{\\mathsf{\\phi}}"
24
27
  # - mathml: "<mi mathvariant='sans-serif'>&#x3c6;</mi>"
25
28
  # - unicode: "\U0001D785"
26
- # - powerNumerator: 1
29
+ # - power: 1
27
30
  # - symbol: phi
28
31
 
29
32
  module Unitsdb
30
33
  class Dimension < Lutaml::Model::Serializable
31
- attribute :id, :string
32
- attribute :dimensionless, :boolean
33
- attribute :length, DimensionQuantity
34
- attribute :mass, DimensionQuantity
35
- attribute :time, DimensionQuantity
36
- attribute :electric_current, DimensionQuantity
37
- attribute :thermodynamic_temperature, DimensionQuantity
38
- attribute :amount_of_substance, DimensionQuantity
39
- attribute :luminous_intensity, DimensionQuantity
40
- attribute :plane_angle, DimensionQuantity
34
+ # model Config.model_for(:dimension)
41
35
 
42
- key_value do
43
- map :id, to: :id
44
- map :dimensionless, to: :dimensionless
45
- map :length, to: :length
46
- map :mass, to: :mass
47
- map :time, to: :time
48
- map :electric_current, to: :electric_current
49
- map :thermodynamic_temperature, to: :thermodynamic_temperature
50
- map :amount_of_substance, to: :amount_of_substance
51
- map :luminous_intensity, to: :luminous_intensity
52
- map :plane_angle, to: :plane_angle
53
- end
36
+ attribute :identifiers, Identifier, collection: true
37
+ attribute :dimensionless, :boolean
38
+ attribute :length, DimensionDetails
39
+ attribute :mass, DimensionDetails
40
+ attribute :time, DimensionDetails
41
+ attribute :electric_current, DimensionDetails
42
+ attribute :thermodynamic_temperature, DimensionDetails
43
+ attribute :amount_of_substance, DimensionDetails
44
+ attribute :luminous_intensity, DimensionDetails
45
+ attribute :plane_angle, DimensionDetails
46
+ attribute :short, :string
47
+ attribute :names, LocalizedString, collection: true
54
48
  end
55
49
  end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ # power: 1
4
+ # symbol: M
5
+ # symbols:
6
+ # - ascii: M
7
+ # html: "&#x1D5AC;"
8
+ # id: dim_M
9
+ # latex: "\\ensuremath{\\mathsf{M}}"
10
+ # mathml: "<mi mathvariant='sans-serif'>M</mi>"
11
+ # unicode: "\U0001D5AC"
12
+
13
+ require_relative "symbol_presentations"
14
+ module Unitsdb
15
+ class DimensionDetails < Lutaml::Model::Serializable
16
+ attribute :power, :integer
17
+ attribute :symbol, :string
18
+ attribute :symbols, SymbolPresentations, collection: true
19
+ end
20
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Unitsdb
4
+ class DimensionReference < Identifier
5
+ attribute :id, :string
6
+ attribute :type, :string
7
+ end
8
+ end
@@ -4,12 +4,9 @@ require_relative "dimension"
4
4
 
5
5
  module Unitsdb
6
6
  class Dimensions < Lutaml::Model::Serializable
7
- attribute :dimension, Dimension, collection: true
7
+ # model Config.model_for(:dimensions)
8
8
 
9
- key_value do
10
- map to: :dimension, root_mappings: {
11
- id: :key
12
- }
13
- end
9
+ attribute :schema_version, :string
10
+ attribute :dimensions, Dimension, collection: true
14
11
  end
15
12
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Unitsdb
4
+ module Errors
5
+ class DatabaseError < StandardError; end
6
+ class DatabaseNotFoundError < DatabaseError; end
7
+ class DatabaseFileNotFoundError < DatabaseError; end
8
+ class DatabaseFileInvalidError < DatabaseError; end
9
+ class DatabaseLoadError < DatabaseError; end
10
+ class VersionMismatchError < DatabaseError; end
11
+ class UnsupportedVersionError < DatabaseError; end
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ # references:
4
+ # - uri: http://si-digital-framework.org/quantities/LENG
5
+ # type: normative
6
+ # authority: si-digital-framework
7
+
8
+ module Unitsdb
9
+ class ExternalReference < Identifier
10
+ attribute :uri, :string
11
+ attribute :type, :string, values: %w[normative informative]
12
+ attribute :authority, :string
13
+ end
14
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Unitsdb
4
+ class Identifier < Lutaml::Model::Serializable
5
+ attribute :id, :string
6
+ attribute :type, :string
7
+ end
8
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Unitsdb
4
+ # Represents a localized string with a language tag
5
+ class LocalizedString < Lutaml::Model::Serializable
6
+ attribute :value, :string
7
+ attribute :lang, :string
8
+
9
+ def to_s
10
+ "#{value} (#{lang})"
11
+ end
12
+
13
+ def downcase
14
+ value&.downcase
15
+ end
16
+ end
17
+ end
@@ -1,6 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "prefix_symbol"
3
+ require_relative "identifier"
4
+ require_relative "symbol_presentations"
5
+ require_relative "external_reference"
6
+ require_relative "localized_string"
4
7
  # ---
5
8
  # NISTp10_30:
6
9
  # name: quetta
@@ -14,18 +17,14 @@ require_relative "prefix_symbol"
14
17
 
15
18
  module Unitsdb
16
19
  class Prefix < Lutaml::Model::Serializable
17
- attribute :id, :string
18
- attribute :name, :string
19
- attribute :symbol, PrefixSymbol
20
+ # model Config.model_for(:prefix)
21
+
22
+ attribute :identifiers, Identifier, collection: true
23
+ attribute :names, LocalizedString, collection: true
24
+ attribute :short, :string
25
+ attribute :symbols, SymbolPresentations, collection: true
20
26
  attribute :base, :integer
21
27
  attribute :power, :integer
22
-
23
- key_value do
24
- map :id, to: :id
25
- map :name, to: :name
26
- map :symbol, to: :symbol
27
- map :base, to: :base
28
- map :power, to: :power
29
- end
28
+ attribute :references, ExternalReference, collection: true
30
29
  end
31
30
  end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "identifier"
4
+
5
+ module Unitsdb
6
+ class PrefixReference < Identifier
7
+ attribute :id, :string
8
+ attribute :type, :string
9
+ end
10
+ end
@@ -14,12 +14,9 @@ require_relative "prefix"
14
14
 
15
15
  module Unitsdb
16
16
  class Prefixes < Lutaml::Model::Serializable
17
- attribute :prefix, Prefix, collection: true
17
+ # model Config.model_for(:prefixes)
18
18
 
19
- key_value do
20
- map to: :prefix, root_mappings: {
21
- id: :key
22
- }
23
- end
19
+ attribute :schema_version, :string
20
+ attribute :prefixes, Prefix, collection: true
24
21
  end
25
22
  end
@@ -1,35 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # # Quantities
4
- # NISTq156:
5
- # dimension_url: "#NISTd68"
6
- # quantity_type: derived
7
- # quantity_name:
8
- # - linear expansion coefficient
9
- # unit_reference:
10
- # - name: kelvin to the power minus one
11
- # url: "#NISTu5e-1/1"
12
-
13
- # NISTq155:
14
- # dimension_url: "#NISTd57"
15
- # quantity_type: derived
16
- # quantity_name:
17
- # - area moment of inertia
18
- # - second moment of area
19
- # unit_reference:
20
- # - name: inch to the fourth power
21
- # url: "#NISTu208"
22
-
23
3
  require_relative "quantity"
24
4
 
25
5
  module Unitsdb
26
6
  class Quantities < Lutaml::Model::Serializable
27
- attribute :quantity, Quantity, collection: true
28
-
29
- key_value do
30
- map to: :quantity, root_mappings: {
31
- id: :key
32
- }
33
- end
7
+ # model Config.model_for(:quantities)
8
+ attribute :schema_version, :string
9
+ attribute :quantities, Quantity, collection: true
34
10
  end
35
11
  end
@@ -1,33 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # # Quantities
4
- # NISTq156:
5
- # dimension_url: "#NISTd68"
6
- # quantity_type: derived
7
- # quantity_name:
8
- # - linear expansion coefficient
9
- # unit_reference:
10
- # - name: kelvin to the power minus one
11
- # url: "#NISTu5e-1/1"
12
-
13
- # NISTq155:
14
- # dimension_url: "#NISTd57"
15
- # quantity_type: derived
16
- # quantity_name:
17
- # - area moment of inertia
18
- # - second moment of area
19
- # unit_reference:
20
- # - name: inch to the fourth power
21
- # url: "#NISTu208"
22
-
3
+ require_relative "identifier"
23
4
  require_relative "unit_reference"
5
+ require_relative "dimension_reference"
6
+ require_relative "external_reference"
7
+ require_relative "localized_string"
24
8
 
25
9
  module Unitsdb
26
10
  class Quantity < Lutaml::Model::Serializable
27
- attribute :id, :string
28
- attribute :dimension_url, :string
11
+ # model Config.model_for(:quantity)
12
+
13
+ attribute :identifiers, Identifier, collection: true
29
14
  attribute :quantity_type, :string
30
- attribute :quantity_name, :string, collection: true
31
- attribute :unit_reference, UnitReference, collection: true
15
+ attribute :names, LocalizedString, collection: true
16
+ attribute :short, :string
17
+ attribute :unit_references, UnitReference, collection: true
18
+ attribute :dimension_reference, DimensionReference
19
+ attribute :references, ExternalReference, collection: true
32
20
  end
33
21
  end
@@ -1,13 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Unitsdb
4
- class QuantityReference < Lutaml::Model::Serializable
5
- attribute :name, :string
6
- attribute :url, :string
4
+ class QuantityReference < Identifier
5
+ # model Config.model_for(:quantity_reference)
7
6
 
8
- key_value do
9
- map :name, to: :name
10
- map :url, to: :url
11
- end
7
+ attribute :id, :string
8
+ attribute :type, :string
12
9
  end
13
10
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "unit_reference"
4
+ require_relative "prefix_reference"
5
+
6
+ module Unitsdb
7
+ class RootUnitReference < Lutaml::Model::Serializable
8
+ # model Config.model_for(:root_unit)
9
+
10
+ attribute :power, :integer
11
+ attribute :unit_reference, UnitReference
12
+ attribute :prefix_reference, PrefixReference
13
+ end
14
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "identifier"
4
+ require_relative "localized_string"
5
+ require_relative "scale_properties"
6
+
7
+ module Unitsdb
8
+ class Scale < Lutaml::Model::Serializable
9
+ # model Config.model_for(:quantity)
10
+
11
+ attribute :identifiers, Identifier, collection: true
12
+ attribute :names, LocalizedString, collection: true
13
+ attribute :description, LocalizedString, collection: true
14
+ attribute :short, :string
15
+ attribute :properties, ScaleProperties
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Unitsdb
4
+ class ScaleProperties < Lutaml::Model::Serializable
5
+ # model Config.model_for(:quantity)
6
+ attribute :continuous, :boolean
7
+ attribute :ordered, :boolean
8
+ attribute :logarithmic, :boolean
9
+ attribute :interval, :boolean
10
+ attribute :ratio, :boolean
11
+ end
12
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "identifier"
4
+
5
+ module Unitsdb
6
+ class ScaleReference < Identifier
7
+ attribute :id, :string
8
+ attribute :type, :string
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "scale"
4
+
5
+ module Unitsdb
6
+ class Scales < Lutaml::Model::Serializable
7
+ # model Config.model_for(:Scale)
8
+ attribute :schema_version, :string
9
+ attribute :scales, Scale, collection: true
10
+ end
11
+ end
@@ -1,20 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # - id: NISTu1
4
- # prefix:
5
- # power: 1
6
- # - id: NISTu1
7
- # prefix:
8
- # power: -1
3
+ require_relative "root_unit_reference"
9
4
 
10
- class SiDerivedBase < Lutaml::Model::Serializable
11
- attribute :id, :string
12
- attribute :prefix, :string
13
- attribute :power, :integer
5
+ # si_derived_bases:
6
+ # - power: 2
7
+ # unit_reference:
8
+ # id: NISTu1
9
+ # type: nist
10
+ # - power: -2
11
+ # unit_reference:
12
+ # id: NISTu1
13
+ # type: nist
14
14
 
15
- key_value do
16
- map :id, to: :id
17
- map :prefix, to: :prefix, render_nil: true
18
- map :power, to: :power
15
+ module Unitsdb
16
+ class SiDerivedBase < RootUnitReference
17
+ # model Config.model_for(:si_derived_base)
19
18
  end
20
19
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Unitsdb
4
+ class SymbolPresentations < Lutaml::Model::Serializable
5
+ # model Config.model_for(:symbol_presentations)
6
+
7
+ attribute :id, :string
8
+ attribute :ascii, :string
9
+ attribute :html, :string
10
+ attribute :latex, :string
11
+ attribute :mathml, :string
12
+ attribute :unicode, :string
13
+ end
14
+ end
data/lib/unitsdb/unit.rb CHANGED
@@ -1,10 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "unit_system"
4
- require_relative "unit_symbol"
5
- require_relative "root_units"
3
+ require_relative "symbol_presentations"
4
+ require_relative "unit_system_reference"
5
+ require_relative "root_unit_reference"
6
6
  require_relative "si_derived_base"
7
7
  require_relative "quantity_reference"
8
+ require_relative "dimension_reference"
9
+ require_relative "external_reference"
10
+ require_relative "localized_string"
11
+ require_relative "scale_reference"
8
12
 
9
13
  # "NISTu10":
10
14
  # dimension_url: "#NISTd9"
@@ -13,7 +17,7 @@ require_relative "quantity_reference"
13
17
  # unit_system:
14
18
  # type: "SI_derived_special"
15
19
  # name: "SI"
16
- # unit_name:
20
+ # names:
17
21
  # - "steradian"
18
22
  # unit_symbols:
19
23
  # - id: "sr"
@@ -26,7 +30,7 @@ require_relative "quantity_reference"
26
30
  # enumerated_root_units:
27
31
  # - unit: "steradian"
28
32
  # power_denominator: 1
29
- # power_numerator: 1
33
+ # power: 1
30
34
  # quantity_reference:
31
35
  # - name: "solid angle"
32
36
  # url: "#NISTq11"
@@ -40,30 +44,20 @@ require_relative "quantity_reference"
40
44
 
41
45
  module Unitsdb
42
46
  class Unit < Lutaml::Model::Serializable
43
- attribute :id, :string
47
+ # model Config.model_for(:unit)
48
+
49
+ attribute :identifiers, Identifier, collection: true
44
50
  attribute :short, :string
45
51
  attribute :root, :boolean
46
52
  attribute :prefixed, :boolean
47
- attribute :dimension_url, :string
48
- attribute :unit_system, UnitSystem, collection: true
49
- attribute :unit_name, :string, collection: true
50
- attribute :unit_symbol, UnitSymbol, collection: true
51
- attribute :root_units, RootUnits, collection: true
52
- attribute :quantity_reference, QuantityReference, collection: true
53
+ attribute :dimension_reference, DimensionReference
54
+ attribute :unit_system_reference, UnitSystemReference, collection: true
55
+ attribute :names, LocalizedString, collection: true
56
+ attribute :symbols, SymbolPresentations, collection: true
57
+ attribute :quantity_references, QuantityReference, collection: true
53
58
  attribute :si_derived_bases, SiDerivedBase, collection: true
54
-
55
- key_value do
56
- map :id, to: :id
57
- map :dimension_url, to: :dimension_url
58
- map :short, to: :short, render_nil: true
59
- map :root, to: :root
60
- map :prefixed, to: :prefixed
61
- map :unit_system, to: :unit_system
62
- map :unit_name, to: :unit_name
63
- map :unit_symbols, to: :unit_symbol
64
- map :root_units, to: :root_units
65
- map :quantity_reference, to: :quantity_reference
66
- map :si_derived_bases, to: :si_derived_bases
67
- end
59
+ attribute :root_units, RootUnitReference, collection: true
60
+ attribute :references, ExternalReference, collection: true
61
+ attribute :scale_reference, ScaleReference
68
62
  end
69
63
  end
@@ -1,13 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Unitsdb
4
- class UnitReference < Lutaml::Model::Serializable
5
- attribute :name, :string
6
- attribute :url, :string
3
+ require_relative "identifier"
7
4
 
8
- key_value do
9
- map :name, to: :name
10
- map :url, to: :url
11
- end
5
+ module Unitsdb
6
+ class UnitReference < Identifier
7
+ attribute :id, :string
8
+ attribute :type, :string
12
9
  end
13
10
  end
@@ -1,17 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "identifier"
4
+ require_relative "localized_string"
5
+
3
6
  module Unitsdb
4
7
  class UnitSystem < Lutaml::Model::Serializable
5
- attribute :id, :string
6
- attribute :name, :string
7
- attribute :type, :string
8
- attribute :acceptable, :boolean
8
+ # model Config.model_for(:unit_system)
9
9
 
10
- key_value do
11
- map :id, to: :id
12
- map :type, to: :type
13
- map :name, to: :name
14
- map :acceptable, to: :acceptable
15
- end
10
+ attribute :identifiers, Identifier, collection: true
11
+ attribute :names, LocalizedString, collection: true
12
+ attribute :short, :string
13
+ attribute :acceptable, :boolean
16
14
  end
17
15
  end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "identifier"
4
+
5
+ module Unitsdb
6
+ class UnitSystemReference < Identifier
7
+ attribute :id, :string
8
+ attribute :type, :string
9
+ end
10
+ end
@@ -4,22 +4,9 @@ require_relative "unit_system"
4
4
 
5
5
  module Unitsdb
6
6
  class UnitSystems < Lutaml::Model::Serializable
7
- attribute :unit_system, UnitSystem, collection: true
7
+ # model Config.model_for(:unit_systems)
8
8
 
9
- # TODO: How do I parse this?
10
- # ---
11
- # - id: SI_base
12
- # name: SI
13
- # acceptable: true
14
- # - id: SI_derived_special
15
- # name: SI
16
- # acceptable: true
17
- # - id: SI_derived_non-special
18
-
19
- key_value do
20
- map to: :unit_system, root_mappings: {
21
- id: :key
22
- }
23
- end
9
+ attribute :schema_version, :string
10
+ attribute :unit_systems, UnitSystem, collection: true
24
11
  end
25
12
  end
data/lib/unitsdb/units.rb CHANGED
@@ -4,12 +4,9 @@ require_relative "unit"
4
4
 
5
5
  module Unitsdb
6
6
  class Units < Lutaml::Model::Serializable
7
- attribute :units, Unit, collection: true
7
+ # model Config.model_for(:units)
8
8
 
9
- key_value do
10
- map to: :units, root_mappings: {
11
- id: :key,
12
- }
13
- end
9
+ attribute :schema_version, :string
10
+ attribute :units, Unit, collection: true
14
11
  end
15
12
  end