tc211-termbase 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tc211/termbase/concept.rb +3 -1
- data/lib/tc211/termbase/concept_collection.rb +1 -1
- data/lib/tc211/termbase/glossarist/concept.rb +33 -0
- data/lib/tc211/termbase/glossarist/managed_concept.rb +34 -0
- data/lib/tc211/termbase/term.rb +17 -5
- data/lib/tc211/termbase/version.rb +1 -1
- data/lib/tc211/termbase.rb +17 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e368538397b597d92173769f193389c8f8917aa228c84518777a5637e0e8474
|
4
|
+
data.tar.gz: a397b469e62394c577da6fd2527264a79d72d2249cb72144be4e593951b14c9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7694a9117a74cf937efde25496560a4d6c40a58f6d14aede4bcb78e3d0c16df39173680b7704d6824c13e66410d2244d68ff4685f3d893599c6f683e7a66d068
|
7
|
+
data.tar.gz: 4151e3efee8bcc149bd5709b25668d75d757e4237ea6b605678ea240e274e3c170a672df72b34958ae5751468c6ecebbf9c1406d5564597e419f88e1671c9fdc
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Tc211
|
2
|
+
module Termbase
|
3
|
+
module Glossarist
|
4
|
+
class Concept < ::Glossarist::LocalizedConcept
|
5
|
+
attr_accessor :status, :dateAccepted
|
6
|
+
|
7
|
+
def uuid
|
8
|
+
@uuid ||= ::Glossarist::Utilities::UUID.uuid_v5(
|
9
|
+
::Glossarist::Utilities::UUID::OID_NAMESPACE,
|
10
|
+
to_h(only_data: true).to_yaml,
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_h(only_data: false)
|
15
|
+
data_hash = super()
|
16
|
+
return data_hash if only_data
|
17
|
+
|
18
|
+
data_hash.merge(register_info)
|
19
|
+
end
|
20
|
+
|
21
|
+
def register_info
|
22
|
+
date_accepted = dates.find(&:accepted?)
|
23
|
+
|
24
|
+
{
|
25
|
+
"dateAccepted" => date_accepted&.date&.dup,
|
26
|
+
"id" => uuid,
|
27
|
+
"status" => entry_status,
|
28
|
+
}.compact
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Tc211
|
2
|
+
module Termbase
|
3
|
+
module Glossarist
|
4
|
+
class ManagedConcept < ::Glossarist::ManagedConcept
|
5
|
+
attr_accessor :status
|
6
|
+
|
7
|
+
def uuid
|
8
|
+
@uuid ||= ::Glossarist::Utilities::UUID.uuid_v5(
|
9
|
+
::Glossarist::Utilities::UUID::OID_NAMESPACE,
|
10
|
+
to_h(only_data: true).to_yaml,
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_h(only_data: false)
|
15
|
+
data_hash = super()
|
16
|
+
return data_hash if only_data
|
17
|
+
|
18
|
+
data_hash.merge(register_info)
|
19
|
+
end
|
20
|
+
|
21
|
+
def register_info
|
22
|
+
date_accepted = default_lang.dates.find(&:accepted?)
|
23
|
+
|
24
|
+
{
|
25
|
+
"dateAccepted" => date_accepted&.date&.dup,
|
26
|
+
"id" => uuid,
|
27
|
+
"related" => related&.map(&:to_h) || [],
|
28
|
+
"status" => default_lang.entry_status,
|
29
|
+
}.compact
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/tc211/termbase/term.rb
CHANGED
@@ -339,6 +339,14 @@ module Tc211::Termbase
|
|
339
339
|
}
|
340
340
|
end
|
341
341
|
|
342
|
+
def authoritative_source_array
|
343
|
+
return unless authoritative_source
|
344
|
+
|
345
|
+
[
|
346
|
+
"link" => authoritative_source["link"],
|
347
|
+
]
|
348
|
+
end
|
349
|
+
|
342
350
|
def lineage_source_hash
|
343
351
|
return unless lineage_source
|
344
352
|
|
@@ -352,7 +360,7 @@ module Tc211::Termbase
|
|
352
360
|
end
|
353
361
|
|
354
362
|
def to_localized_concept_hash
|
355
|
-
|
363
|
+
concept_hash = to_hash
|
356
364
|
|
357
365
|
%w[
|
358
366
|
review_status
|
@@ -365,13 +373,17 @@ module Tc211::Termbase
|
|
365
373
|
lineage_source_similarity
|
366
374
|
country_code
|
367
375
|
].each do |key|
|
368
|
-
|
376
|
+
concept_hash.delete(key)
|
369
377
|
end
|
370
378
|
|
371
|
-
|
372
|
-
|
379
|
+
concept_hash["id"] = concept_hash["id"].to_s
|
380
|
+
concept_hash["sources"] = sources_hash
|
381
|
+
|
382
|
+
if authoritative_source_array
|
383
|
+
concept_hash["authoritativeSource"] = authoritative_source_array
|
384
|
+
end
|
373
385
|
|
374
|
-
|
386
|
+
concept_hash
|
375
387
|
end
|
376
388
|
end
|
377
389
|
end
|
data/lib/tc211/termbase.rb
CHANGED
@@ -1,10 +1,27 @@
|
|
1
1
|
require "glossarist"
|
2
2
|
require "tc211/termbase/version"
|
3
3
|
|
4
|
+
require_relative "termbase/glossarist/concept"
|
5
|
+
require_relative "termbase/glossarist/managed_concept"
|
6
|
+
|
4
7
|
module Tc211
|
5
8
|
module Termbase
|
6
9
|
class Error < StandardError; end
|
10
|
+
|
7
11
|
# Your code goes here...
|
12
|
+
::Glossarist.configure do |config|
|
13
|
+
config.register_extension_attributes(["authoritativeSource"])
|
14
|
+
|
15
|
+
config.register_class(
|
16
|
+
:localized_concept,
|
17
|
+
Tc211::Termbase::Glossarist::Concept,
|
18
|
+
)
|
19
|
+
|
20
|
+
config.register_class(
|
21
|
+
:managed_concept,
|
22
|
+
Tc211::Termbase::Glossarist::ManagedConcept,
|
23
|
+
)
|
24
|
+
end
|
8
25
|
end
|
9
26
|
end
|
10
27
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tc211-termbase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: creek
|
@@ -117,6 +117,8 @@ files:
|
|
117
117
|
- lib/tc211/termbase/cli/command.rb
|
118
118
|
- lib/tc211/termbase/concept.rb
|
119
119
|
- lib/tc211/termbase/concept_collection.rb
|
120
|
+
- lib/tc211/termbase/glossarist/concept.rb
|
121
|
+
- lib/tc211/termbase/glossarist/managed_concept.rb
|
120
122
|
- lib/tc211/termbase/information_sheet.rb
|
121
123
|
- lib/tc211/termbase/metadata_section.rb
|
122
124
|
- lib/tc211/termbase/relaton_db.rb
|