Class: Termium::Core
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Termium::Core
- Defined in:
- lib/termium/core.rb
Overview
For <core>
Instance Method Summary collapse
-
#concept_sources ⇒ Object
TODO: In Termium XML, each definition per lang or note can be linked to a particular source via the sourceRef number.
-
#to_concept(options = {}) ⇒ Object
TODO: Utilize “subject” in the Glossarist object: <subject abbreviation=“YBB” details=“Compartment - ISO/IEC JTC 1 Information Technology Vocabulary” />.
-
#uuid(str = identification_number) ⇒ Object
Deterministic v4 UUID by using the number string.
Instance Method Details
#concept_sources ⇒ Object
TODO: In Termium XML, each definition per lang or note can be linked to a particular source via the sourceRef number. We should utilize “source” order ID in the Glossarist object: <source order=“1” details=“ISO-2382-6 * 1987 * * * ” /> <source order=“2”
details="Ranger, Natalie * 2006 * Bureau de la traduction..." />
36 37 38 |
# File 'lib/termium/core.rb', line 36 def concept_sources source.map(&:to_concept_source) end |
#to_concept(options = {}) ⇒ Object
TODO: Utilize “subject” in the Glossarist object: <subject abbreviation=“YBB” details=“Compartment - ISO/IEC JTC 1 Information Technology Vocabulary” />
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/termium/core.rb', line 48 def to_concept( = {}) Glossarist::ManagedConcept.new.tap do |concept| # The way to set the universal concept's identifier: data.identifier concept.id = identification_number concept.uuid = uuid # Assume no related concepts concept. = [] concept.status = "valid" if [:date_accepted] concept.date_accepted = [:date_accepted] end language_module.map do |lang_mod| localized_concept = lang_mod.to_concept() # TODO: This is needed to skip the empty french entries of 10031781 and 10031778 next if localized_concept.nil? localized_concept.id = identification_number localized_concept.uuid = uuid("#{identification_number}-#{lang_mod.language}") universal_entry.each do |entry| localized_concept.notes << Glossarist::DetailedDefinition.new(content: entry.value) end localized_concept.sources = concept_sources concept.add_localization(localized_concept) end end end |
#uuid(str = identification_number) ⇒ Object
Deterministic v4 UUID by using the number string
41 42 43 |
# File 'lib/termium/core.rb', line 41 def uuid(str = identification_number) UUIDTools::UUID.md5_create(UUIDTools::UUID_DNS_NAMESPACE, str).to_s end |