unitsdb 1.0.0 → 2.0.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/.gitmodules +3 -0
- data/.rspec +2 -1
- data/.rubocop_todo.yml +168 -15
- data/Gemfile +3 -2
- data/README.adoc +803 -1
- data/exe/unitsdb +7 -0
- data/lib/unitsdb/cli.rb +88 -0
- data/lib/unitsdb/commands/_modify.rb +22 -0
- data/lib/unitsdb/commands/base.rb +26 -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 +73 -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/ucum/check.rb +126 -0
- data/lib/unitsdb/commands/ucum/formatter.rb +141 -0
- data/lib/unitsdb/commands/ucum/matcher.rb +301 -0
- data/lib/unitsdb/commands/ucum/update.rb +84 -0
- data/lib/unitsdb/commands/ucum/updater.rb +98 -0
- data/lib/unitsdb/commands/ucum/xml_parser.rb +34 -0
- data/lib/unitsdb/commands/ucum.rb +43 -0
- data/lib/unitsdb/commands/validate/identifiers.rb +42 -0
- data/lib/unitsdb/commands/validate/references.rb +318 -0
- data/lib/unitsdb/commands/validate/si_references.rb +109 -0
- data/lib/unitsdb/commands/validate.rb +40 -0
- data/lib/unitsdb/database.rb +662 -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 +5 -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 +5 -11
- data/lib/unitsdb/quantities.rb +5 -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 +12 -0
- data/lib/unitsdb/si_derived_base.rb +19 -0
- data/lib/unitsdb/symbol_presentations.rb +3 -8
- data/lib/unitsdb/ucum.rb +198 -0
- 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 +5 -10
- data/lib/unitsdb/units.rb +5 -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 -3
- metadata +124 -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/unit.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "symbol_presentations"
|
4
|
+
require_relative "unit_system_reference"
|
5
|
+
require_relative "root_unit_reference"
|
6
|
+
require_relative "si_derived_base"
|
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"
|
12
|
+
|
13
|
+
# "NISTu10":
|
14
|
+
# dimension_url: "#NISTd9"
|
15
|
+
# short: steradian
|
16
|
+
# root: true
|
17
|
+
# unit_system:
|
18
|
+
# type: "SI_derived_special"
|
19
|
+
# name: "SI"
|
20
|
+
# names:
|
21
|
+
# - "steradian"
|
22
|
+
# unit_symbols:
|
23
|
+
# - id: "sr"
|
24
|
+
# ascii: "sr"
|
25
|
+
# html: "sr"
|
26
|
+
# mathml: "<mi mathvariant='normal'>sr</mi>"
|
27
|
+
# latex: \ensuremath{\mathrm{sr}}
|
28
|
+
# unicode: "sr"
|
29
|
+
# root_units:
|
30
|
+
# enumerated_root_units:
|
31
|
+
# - unit: "steradian"
|
32
|
+
# power_denominator: 1
|
33
|
+
# power: 1
|
34
|
+
# quantity_reference:
|
35
|
+
# - name: "solid angle"
|
36
|
+
# url: "#NISTq11"
|
37
|
+
# si_derived_bases:
|
38
|
+
# - id: NISTu1
|
39
|
+
# prefix:
|
40
|
+
# power: 1
|
41
|
+
# - id: NISTu1
|
42
|
+
# prefix:
|
43
|
+
# power: -1
|
44
|
+
|
45
|
+
module Unitsdb
|
46
|
+
class Unit < Lutaml::Model::Serializable
|
47
|
+
# model Config.model_for(:unit)
|
48
|
+
|
49
|
+
attribute :identifiers, Identifier, collection: true
|
50
|
+
attribute :short, :string
|
51
|
+
attribute :root, :boolean
|
52
|
+
attribute :prefixed, :boolean
|
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
|
58
|
+
attribute :si_derived_bases, SiDerivedBase, collection: true
|
59
|
+
attribute :root_units, RootUnitReference, collection: true
|
60
|
+
attribute :references, ExternalReference, collection: true
|
61
|
+
attribute :scale_reference, ScaleReference
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "identifier"
|
4
|
+
require_relative "localized_string"
|
5
|
+
|
6
|
+
module Unitsdb
|
7
|
+
class UnitSystem < Lutaml::Model::Serializable
|
8
|
+
# model Config.model_for(:unit_system)
|
9
|
+
|
10
|
+
attribute :identifiers, Identifier, collection: true
|
11
|
+
attribute :names, LocalizedString, collection: true
|
12
|
+
attribute :short, :string
|
13
|
+
attribute :acceptable, :boolean
|
14
|
+
end
|
15
|
+
end
|
data/lib/unitsdb/unit_systems.rb
CHANGED
@@ -1,18 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative "
|
3
|
+
require_relative "unit_system"
|
4
4
|
|
5
5
|
module Unitsdb
|
6
|
-
class UnitSystems
|
7
|
-
|
8
|
-
model Config.model_for(:unit_systems)
|
6
|
+
class UnitSystems < Lutaml::Model::Serializable
|
7
|
+
# model Config.model_for(:unit_systems)
|
9
8
|
|
9
|
+
attribute :schema_version, :string
|
10
|
+
attribute :version, :string
|
10
11
|
attribute :unit_systems, UnitSystem, collection: true
|
11
|
-
|
12
|
-
key_value do
|
13
|
-
map to: :unit_systems, root_mappings: {
|
14
|
-
id: :key
|
15
|
-
}
|
16
|
-
end
|
17
12
|
end
|
18
13
|
end
|
data/lib/unitsdb/units.rb
CHANGED
@@ -1,18 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "unit"
|
4
4
|
|
5
5
|
module Unitsdb
|
6
|
-
class Units
|
7
|
-
|
8
|
-
model Config.model_for(:units)
|
6
|
+
class Units < Lutaml::Model::Serializable
|
7
|
+
# model Config.model_for(:units)
|
9
8
|
|
9
|
+
attribute :schema_version, :string
|
10
|
+
attribute :version, :string
|
10
11
|
attribute :units, Unit, collection: true
|
11
|
-
|
12
|
-
key_value do
|
13
|
-
map to: :units, root_mappings: {
|
14
|
-
id: :key,
|
15
|
-
}
|
16
|
-
end
|
17
12
|
end
|
18
13
|
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Unitsdb
|
4
|
+
module Utils
|
5
|
+
DEFAULT_YAML_FILES = %w[dimensions prefixes quantities unit_systems units].map { |f| "#{f}.yaml" }
|
6
|
+
|
7
|
+
def self.levenshtein_distance(s, t)
|
8
|
+
m = s.length
|
9
|
+
n = t.length
|
10
|
+
|
11
|
+
return m if n.zero?
|
12
|
+
return n if m.zero?
|
13
|
+
|
14
|
+
d = Array.new(m + 1) { Array.new(n + 1) }
|
15
|
+
|
16
|
+
(0..m).each { |i| d[i][0] = i }
|
17
|
+
(0..n).each { |j| d[0][j] = j }
|
18
|
+
|
19
|
+
(1..n).each do |j|
|
20
|
+
(1..m).each do |i|
|
21
|
+
d[i][j] = if s[i - 1] == t[j - 1]
|
22
|
+
d[i - 1][j - 1]
|
23
|
+
else
|
24
|
+
[d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + 1].min
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
d[m][n]
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.find_similar_ids(id, valid_ids, max_results = 5)
|
33
|
+
# Simple similarity measure based on Levenshtein distance
|
34
|
+
valid_ids
|
35
|
+
.map { |valid_id| [valid_id, levenshtein_distance(id.to_s, valid_id.to_s)] }
|
36
|
+
.sort_by { |_, distance| distance }
|
37
|
+
.take(max_results)
|
38
|
+
.select { |_, distance| distance < [id.to_s.length, 10].min }
|
39
|
+
.map { |valid_id, _| valid_id }
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.sort_yaml_keys(obj)
|
43
|
+
case obj
|
44
|
+
when Hash
|
45
|
+
# Transform values first, then sort keys
|
46
|
+
obj.transform_values { |v| sort_yaml_keys(v) }
|
47
|
+
.sort_by do |key, _|
|
48
|
+
key_str = key.to_s
|
49
|
+
|
50
|
+
# Handle NIST IDs with proper category-based sorting
|
51
|
+
case key_str
|
52
|
+
when /\ANIST([a-z])(\d+)_(-?\d+)\Z/ # Prefixes with power (NISTp2_10)
|
53
|
+
[0, ::Regexp.last_match(1), ::Regexp.last_match(2).to_i, ::Regexp.last_match(3).to_i]
|
54
|
+
when /\ANIST([a-z])(\d+)\Z/ # Prefixes without power
|
55
|
+
[0, ::Regexp.last_match(1), ::Regexp.last_match(2).to_i, 0]
|
56
|
+
when %r{[/e]} # Composite IDs with '/' or 'e' to the end
|
57
|
+
[2, key_str]
|
58
|
+
when /\ANISTu(\d+)\.(.+)\Z/ # Simple unit IDs (NISTu10.1)
|
59
|
+
[1, "u", ::Regexp.last_match(1).to_i, ::Regexp.last_match(2)]
|
60
|
+
else
|
61
|
+
[3, key_str] # Everything else
|
62
|
+
end
|
63
|
+
end.to_h
|
64
|
+
when Array
|
65
|
+
# For arrays in the new structure, sort them if they're arrays of hashes with 'id' or 'short' keys
|
66
|
+
if !obj.empty? && obj.all? { |item| item.is_a?(Hash) }
|
67
|
+
# Sort by 'id' within identifiers array
|
68
|
+
if obj.first.key?("id") && obj.first.key?("type")
|
69
|
+
obj.sort_by { |item| item["id"].to_s }.map { |item| sort_yaml_keys(item) }
|
70
|
+
# Sort by 'short' for other arrays (like main unit arrays)
|
71
|
+
elsif obj.first.key?("short")
|
72
|
+
obj.sort_by { |item| item["short"].to_s }.map { |item| sort_yaml_keys(item) }
|
73
|
+
else
|
74
|
+
obj.map { |item| sort_yaml_keys(item) }
|
75
|
+
end
|
76
|
+
else
|
77
|
+
obj.map { |item| sort_yaml_keys(item) }
|
78
|
+
end
|
79
|
+
else
|
80
|
+
obj
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
data/lib/unitsdb/version.rb
CHANGED
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
@@ -19,8 +19,6 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.metadata["source_code_uri"] = spec.homepage
|
20
20
|
spec.metadata["changelog_uri"] = "https://github.com/unitsml/unitsdb-ruby/releases"
|
21
21
|
|
22
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
|
23
|
-
|
24
22
|
# Specify which files should be added to the gem when it is released.
|
25
23
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
26
24
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
@@ -33,5 +31,10 @@ Gem::Specification.new do |spec|
|
|
33
31
|
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
34
32
|
spec.require_paths = ["lib"]
|
35
33
|
|
36
|
-
spec.add_dependency "lutaml-model"
|
34
|
+
spec.add_dependency "lutaml-model", "~>0.7"
|
35
|
+
spec.add_dependency "rdf", "~> 3.1"
|
36
|
+
spec.add_dependency "rdf-turtle", "~> 3.1"
|
37
|
+
spec.add_dependency "rubyzip", "~> 2.3"
|
38
|
+
spec.add_dependency "terminal-table"
|
39
|
+
spec.add_dependency "thor", "~> 1.0"
|
37
40
|
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:
|
4
|
+
version: 2.0.1
|
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-23 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,62 @@ 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/ucum.rb
|
136
|
+
- lib/unitsdb/commands/ucum/check.rb
|
137
|
+
- lib/unitsdb/commands/ucum/formatter.rb
|
138
|
+
- lib/unitsdb/commands/ucum/matcher.rb
|
139
|
+
- lib/unitsdb/commands/ucum/update.rb
|
140
|
+
- lib/unitsdb/commands/ucum/updater.rb
|
141
|
+
- lib/unitsdb/commands/ucum/xml_parser.rb
|
142
|
+
- lib/unitsdb/commands/validate.rb
|
143
|
+
- lib/unitsdb/commands/validate/identifiers.rb
|
144
|
+
- lib/unitsdb/commands/validate/references.rb
|
145
|
+
- lib/unitsdb/commands/validate/si_references.rb
|
50
146
|
- lib/unitsdb/config.rb
|
147
|
+
- lib/unitsdb/database.rb
|
148
|
+
- lib/unitsdb/dimension.rb
|
149
|
+
- lib/unitsdb/dimension_details.rb
|
150
|
+
- lib/unitsdb/dimension_reference.rb
|
51
151
|
- lib/unitsdb/dimensions.rb
|
52
|
-
- lib/unitsdb/
|
53
|
-
- lib/unitsdb/
|
54
|
-
- lib/unitsdb/
|
152
|
+
- lib/unitsdb/errors.rb
|
153
|
+
- lib/unitsdb/external_reference.rb
|
154
|
+
- lib/unitsdb/identifier.rb
|
155
|
+
- lib/unitsdb/localized_string.rb
|
156
|
+
- lib/unitsdb/prefix.rb
|
157
|
+
- lib/unitsdb/prefix_reference.rb
|
55
158
|
- lib/unitsdb/prefixes.rb
|
56
|
-
- lib/unitsdb/prefixes/prefix.rb
|
57
|
-
- lib/unitsdb/prefixes/symbol.rb
|
58
159
|
- lib/unitsdb/quantities.rb
|
59
|
-
- lib/unitsdb/
|
60
|
-
- lib/unitsdb/
|
160
|
+
- lib/unitsdb/quantity.rb
|
161
|
+
- lib/unitsdb/quantity_reference.rb
|
162
|
+
- lib/unitsdb/root_unit_reference.rb
|
163
|
+
- lib/unitsdb/scale.rb
|
164
|
+
- lib/unitsdb/scale_properties.rb
|
165
|
+
- lib/unitsdb/scale_reference.rb
|
166
|
+
- lib/unitsdb/scales.rb
|
167
|
+
- lib/unitsdb/si_derived_base.rb
|
61
168
|
- lib/unitsdb/symbol_presentations.rb
|
169
|
+
- lib/unitsdb/ucum.rb
|
170
|
+
- lib/unitsdb/unit.rb
|
171
|
+
- lib/unitsdb/unit_reference.rb
|
172
|
+
- lib/unitsdb/unit_system.rb
|
173
|
+
- lib/unitsdb/unit_system_reference.rb
|
62
174
|
- lib/unitsdb/unit_systems.rb
|
63
|
-
- lib/unitsdb/unit_systems/unit_system.rb
|
64
175
|
- 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
|
176
|
+
- lib/unitsdb/utils.rb
|
73
177
|
- lib/unitsdb/version.rb
|
74
178
|
- sig/unitsdb.rbs
|
75
179
|
- unitsdb.gemspec
|
@@ -95,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
199
|
- !ruby/object:Gem::Version
|
96
200
|
version: '0'
|
97
201
|
requirements: []
|
98
|
-
rubygems_version: 3.
|
202
|
+
rubygems_version: 3.5.22
|
99
203
|
signing_key:
|
100
204
|
specification_version: 4
|
101
205
|
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
|