relaton 2.2.0.pre.alpha.1 → 3.0.0.pre.alpha.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/{docs/README.adoc → README.adoc} +109 -38
- data/lib/relaton/3gpp/bibdata.rb +9 -0
- data/lib/relaton/3gpp/bibitem.rb +9 -0
- data/lib/relaton/3gpp/bibliography.rb +48 -0
- data/lib/relaton/3gpp/data_fetcher.rb +255 -0
- data/lib/relaton/3gpp/doctype.rb +9 -0
- data/lib/relaton/3gpp/ext.rb +31 -0
- data/lib/relaton/3gpp/item.rb +12 -0
- data/lib/relaton/3gpp/item_data.rb +15 -0
- data/lib/relaton/3gpp/parser.rb +400 -0
- data/lib/relaton/3gpp/processor.rb +68 -0
- data/lib/relaton/3gpp/release.rb +34 -0
- data/lib/relaton/3gpp/util.rb +8 -0
- data/lib/relaton/3gpp.rb +25 -0
- data/lib/relaton/bib/converter/asciibib/to_asciibib.rb +663 -0
- data/lib/relaton/bib/converter/asciibib.rb +13 -0
- data/lib/relaton/bib/converter/bibtex/from_bibtex.rb +245 -0
- data/lib/relaton/bib/converter/bibtex/to_bibtex.rb +341 -0
- data/lib/relaton/bib/converter/bibtex.rb +23 -0
- data/lib/relaton/bib/converter/bibxml/from_rfcxml.rb +386 -0
- data/lib/relaton/bib/converter/bibxml/from_rfcxml_referencegroup.rb +71 -0
- data/lib/relaton/bib/converter/bibxml/to_rfcxml.rb +308 -0
- data/lib/relaton/bib/converter/bibxml/to_rfcxml_referencegroup.rb +52 -0
- data/lib/relaton/bib/converter/bibxml.rb +51 -0
- data/lib/relaton/bib/hash_parser_v1.rb +767 -0
- data/lib/relaton/bib/item_data.rb +229 -0
- data/lib/relaton/bib/model/abstract.rb +16 -0
- data/lib/relaton/bib/model/address.rb +22 -0
- data/lib/relaton/bib/model/affiliation.rb +16 -0
- data/lib/relaton/bib/model/bibdata.rb +11 -0
- data/lib/relaton/bib/model/bibdata_shared.rb +12 -0
- data/lib/relaton/bib/model/bibitem.rb +11 -0
- data/lib/relaton/bib/model/bibitem_shared.rb +12 -0
- data/lib/relaton/bib/model/contact.rb +18 -0
- data/lib/relaton/bib/model/contribution_info.rb +15 -0
- data/lib/relaton/bib/model/contributor.rb +29 -0
- data/lib/relaton/bib/model/copyright.rb +27 -0
- data/lib/relaton/bib/model/date.rb +31 -0
- data/lib/relaton/bib/model/depiction.rb +16 -0
- data/lib/relaton/bib/model/docidentifier.rb +34 -0
- data/lib/relaton/bib/model/doctype.rb +14 -0
- data/lib/relaton/bib/model/edition.rb +14 -0
- data/lib/relaton/bib/model/ext.rb +39 -0
- data/lib/relaton/bib/model/extent.rb +16 -0
- data/lib/relaton/bib/model/formattedref.rb +43 -0
- data/lib/relaton/bib/model/full_name_type.rb +64 -0
- data/lib/relaton/bib/model/fullname.rb +11 -0
- data/lib/relaton/bib/model/ics.rb +49 -0
- data/lib/relaton/bib/model/image.rb +28 -0
- data/lib/relaton/bib/model/item.rb +96 -0
- data/lib/relaton/bib/model/item_base.rb +20 -0
- data/lib/relaton/bib/model/item_shared.rb +88 -0
- data/lib/relaton/bib/model/keyword.rb +30 -0
- data/lib/relaton/bib/model/locality.rb +18 -0
- data/lib/relaton/bib/model/locality_stack.rb +14 -0
- data/lib/relaton/bib/model/localized_string.rb +48 -0
- data/lib/relaton/bib/model/localized_string_attrs.rb +24 -0
- data/lib/relaton/bib/model/logo.rb +14 -0
- data/lib/relaton/bib/model/medium.rb +22 -0
- data/lib/relaton/bib/model/note.rb +16 -0
- data/lib/relaton/bib/model/organization.rb +13 -0
- data/lib/relaton/bib/model/organization_type.rb +42 -0
- data/lib/relaton/bib/model/person.rb +36 -0
- data/lib/relaton/bib/model/phone.rb +14 -0
- data/lib/relaton/bib/model/place.rb +33 -0
- data/lib/relaton/bib/model/price.rb +14 -0
- data/lib/relaton/bib/model/relation.rb +43 -0
- data/lib/relaton/bib/model/series.rb +34 -0
- data/lib/relaton/bib/model/size.rb +23 -0
- data/lib/relaton/bib/model/source_locality_stack.rb +14 -0
- data/lib/relaton/bib/model/status.rb +27 -0
- data/lib/relaton/bib/model/structured_identifier.rb +48 -0
- data/lib/relaton/bib/model/subdivision.rb +16 -0
- data/lib/relaton/bib/model/title.rb +56 -0
- data/lib/relaton/bib/model/type/plain_date.rb +16 -0
- data/lib/relaton/bib/model/type/string_date.rb +48 -0
- data/lib/relaton/bib/model/uri.rb +18 -0
- data/lib/relaton/bib/model/validity.rb +16 -0
- data/lib/relaton/bib/model/version.rb +43 -0
- data/lib/relaton/bib/namespace_helper.rb +21 -0
- data/lib/relaton/bib/sanitizer.rb +68 -0
- data/lib/relaton/bib/util.rb +18 -0
- data/lib/relaton/bib/versions.json +35 -0
- data/lib/relaton/bib.rb +48 -0
- data/lib/relaton/bipm/bibliography.rb +82 -0
- data/lib/relaton/bipm/converter/asciibib.rb +64 -0
- data/lib/relaton/bipm/data_fetcher.rb +57 -0
- data/lib/relaton/bipm/data_outcomes_parser.rb +657 -0
- data/lib/relaton/bipm/id_parser.rb +277 -0
- data/lib/relaton/bipm/item_data.rb +47 -0
- data/lib/relaton/bipm/model/bibdata.rb +9 -0
- data/lib/relaton/bipm/model/bibitem.rb +9 -0
- data/lib/relaton/bipm/model/comment_period.rb +13 -0
- data/lib/relaton/bipm/model/doctype.rb +12 -0
- data/lib/relaton/bipm/model/ext.rb +38 -0
- data/lib/relaton/bipm/model/item.rb +11 -0
- data/lib/relaton/bipm/model/structured_identifier.rb +15 -0
- data/lib/relaton/bipm/processor.rb +69 -0
- data/lib/relaton/bipm/rawdata_bipm_metrologia/affiliations.rb +111 -0
- data/lib/relaton/bipm/rawdata_bipm_metrologia/fetcher.rb +174 -0
- data/lib/relaton/bipm/rawdata_bipm_metrologia/niso_jats_parser.rb +353 -0
- data/lib/relaton/bipm/si_brochure_parser.rb +186 -0
- data/lib/relaton/bipm/util.rb +8 -0
- data/lib/relaton/bipm.rb +32 -0
- data/lib/relaton/bsi/bibliography.rb +124 -0
- data/lib/relaton/bsi/hit.rb +14 -0
- data/lib/relaton/bsi/hit_collection.rb +114 -0
- data/lib/relaton/bsi/item_data.rb +13 -0
- data/lib/relaton/bsi/model/bibdata.rb +8 -0
- data/lib/relaton/bsi/model/bibitem.rb +8 -0
- data/lib/relaton/bsi/model/docidentifier.rb +9 -0
- data/lib/relaton/bsi/model/doctype.rb +14 -0
- data/lib/relaton/bsi/model/ext.rb +17 -0
- data/lib/relaton/bsi/model/item.rb +17 -0
- data/lib/relaton/bsi/model/item_base.rb +22 -0
- data/lib/relaton/bsi/model/relation.rb +9 -0
- data/lib/relaton/bsi/processor.rb +42 -0
- data/lib/relaton/bsi/schema.json +24882 -0
- data/lib/relaton/bsi/scraper.rb +288 -0
- data/lib/relaton/bsi/util.rb +8 -0
- data/lib/relaton/bsi.rb +25 -0
- data/lib/relaton/calconnect/bibliography.rb +95 -0
- data/lib/relaton/calconnect/data_fetcher.rb +106 -0
- data/lib/relaton/calconnect/hit.rb +14 -0
- data/lib/relaton/calconnect/hit_collection.rb +84 -0
- data/lib/relaton/calconnect/item_data.rb +12 -0
- data/lib/relaton/calconnect/model/bibdata.rb +8 -0
- data/lib/relaton/calconnect/model/bibitem.rb +8 -0
- data/lib/relaton/calconnect/model/doctype.rb +11 -0
- data/lib/relaton/calconnect/model/ext.rb +11 -0
- data/lib/relaton/calconnect/model/item.rb +13 -0
- data/lib/relaton/calconnect/processor.rb +66 -0
- data/lib/relaton/calconnect/scraper.rb +87 -0
- data/lib/relaton/calconnect/util.rb +8 -0
- data/lib/relaton/calconnect.rb +26 -0
- data/lib/relaton/ccsds/bibliography.rb +63 -0
- data/lib/relaton/ccsds/data/fetcher.rb +247 -0
- data/lib/relaton/ccsds/data/iso_references.rb +30 -0
- data/lib/relaton/ccsds/data/parser.rb +194 -0
- data/lib/relaton/ccsds/hit.rb +24 -0
- data/lib/relaton/ccsds/hit_collection.rb +42 -0
- data/lib/relaton/ccsds/item_data.rb +9 -0
- data/lib/relaton/ccsds/model/bibdata.rb +8 -0
- data/lib/relaton/ccsds/model/bibitem.rb +8 -0
- data/lib/relaton/ccsds/model/doctype.rb +9 -0
- data/lib/relaton/ccsds/model/ext.rb +19 -0
- data/lib/relaton/ccsds/model/item.rb +13 -0
- data/lib/relaton/ccsds/processor.rb +68 -0
- data/lib/relaton/ccsds/util.rb +10 -0
- data/lib/relaton/ccsds.rb +33 -0
- data/lib/relaton/cen/bibliography.rb +121 -0
- data/lib/relaton/cen/committees.yaml +66 -0
- data/lib/relaton/cen/hit.rb +16 -0
- data/lib/relaton/cen/hit_collection.rb +68 -0
- data/lib/relaton/cen/item_data.rb +7 -0
- data/lib/relaton/cen/model/bibdata.rb +8 -0
- data/lib/relaton/cen/model/bibitem.rb +8 -0
- data/lib/relaton/cen/model/docidentifier.rb +9 -0
- data/lib/relaton/cen/model/ext.rb +11 -0
- data/lib/relaton/cen/model/item.rb +14 -0
- data/lib/relaton/cen/model/structured_identifier.rb +9 -0
- data/lib/relaton/cen/processor.rb +40 -0
- data/lib/relaton/cen/scraper.rb +210 -0
- data/lib/relaton/cen/util.rb +8 -0
- data/lib/relaton/cen.rb +29 -0
- data/lib/relaton/cie/bibdata.rb +8 -0
- data/lib/relaton/cie/bibitem.rb +8 -0
- data/lib/relaton/cie/bibliography.rb +31 -0
- data/lib/relaton/cie/data_fetcher.rb +355 -0
- data/lib/relaton/cie/ext.rb +7 -0
- data/lib/relaton/cie/item.rb +11 -0
- data/lib/relaton/cie/item_data.rb +6 -0
- data/lib/relaton/cie/processor.rb +66 -0
- data/lib/relaton/cie/scrapper.rb +39 -0
- data/lib/relaton/cie/util.rb +8 -0
- data/lib/relaton/cie.rb +28 -0
- data/lib/relaton/core/array_wrapper.rb +20 -0
- data/lib/relaton/core/data_fetcher.rb +97 -0
- data/lib/relaton/core/date_parser.rb +42 -0
- data/lib/relaton/core/hash_keys_sybolizer.rb +19 -0
- data/lib/relaton/core/hit.rb +49 -0
- data/lib/relaton/core/hit_collection.rb +118 -0
- data/lib/relaton/core/processor.rb +48 -0
- data/lib/relaton/core/workers_pool.rb +45 -0
- data/lib/relaton/core.rb +9 -0
- data/lib/relaton/db/registry.rb +4 -4
- data/lib/relaton/db.rb +0 -1
- data/lib/relaton/doi/crossref.rb +72 -0
- data/lib/relaton/doi/parser.rb +827 -0
- data/lib/relaton/doi/processor.rb +65 -0
- data/lib/relaton/doi/util.rb +8 -0
- data/lib/relaton/doi.rb +20 -0
- data/lib/relaton/ecma/bibdata.rb +8 -0
- data/lib/relaton/ecma/bibitem.rb +8 -0
- data/lib/relaton/ecma/bibliography.rb +81 -0
- data/lib/relaton/ecma/data_fetcher.rb +103 -0
- data/lib/relaton/ecma/data_parser.rb +49 -0
- data/lib/relaton/ecma/edition_parser.rb +80 -0
- data/lib/relaton/ecma/ext.rb +7 -0
- data/lib/relaton/ecma/item.rb +11 -0
- data/lib/relaton/ecma/item_data.rb +6 -0
- data/lib/relaton/ecma/memento_parser.rb +60 -0
- data/lib/relaton/ecma/page_fetcher.rb +27 -0
- data/lib/relaton/ecma/parser_common.rb +33 -0
- data/lib/relaton/ecma/processor.rb +66 -0
- data/lib/relaton/ecma/standard_parser.rb +134 -0
- data/lib/relaton/ecma/util.rb +8 -0
- data/lib/relaton/ecma.rb +24 -0
- data/lib/relaton/etsi/bibdata.rb +10 -0
- data/lib/relaton/etsi/bibitem.rb +10 -0
- data/lib/relaton/etsi/bibliography.rb +46 -0
- data/lib/relaton/etsi/data_fetcher.rb +128 -0
- data/lib/relaton/etsi/data_parser.rb +208 -0
- data/lib/relaton/etsi/doctype.rb +30 -0
- data/lib/relaton/etsi/ext.rb +31 -0
- data/lib/relaton/etsi/item.rb +15 -0
- data/lib/relaton/etsi/item_data.rb +6 -0
- data/lib/relaton/etsi/processor.rb +69 -0
- data/lib/relaton/etsi/pubid.rb +37 -0
- data/lib/relaton/etsi/status.rb +13 -0
- data/lib/relaton/etsi/util.rb +8 -0
- data/lib/relaton/etsi.rb +25 -0
- data/lib/relaton/gb/bibdata.rb +8 -0
- data/lib/relaton/gb/bibitem.rb +8 -0
- data/lib/relaton/gb/bibliography.rb +145 -0
- data/lib/relaton/gb/ccs.rb +14 -0
- data/lib/relaton/gb/committee.rb +13 -0
- data/lib/relaton/gb/docidentifier.rb +23 -0
- data/lib/relaton/gb/doctype.rb +9 -0
- data/lib/relaton/gb/ext.rb +36 -0
- data/lib/relaton/gb/gb_scraper.rb +61 -0
- data/lib/relaton/gb/gb_type.rb +20 -0
- data/lib/relaton/gb/hit.rb +48 -0
- data/lib/relaton/gb/hit_collection.rb +19 -0
- data/lib/relaton/gb/item.rb +13 -0
- data/lib/relaton/gb/item_data.rb +6 -0
- data/lib/relaton/gb/processor.rb +46 -0
- data/lib/relaton/gb/project_number.rb +38 -0
- data/lib/relaton/gb/scraper.rb +204 -0
- data/lib/relaton/gb/sec_scraper.rb +92 -0
- data/lib/relaton/gb/stage_name.rb +13 -0
- data/lib/relaton/gb/structured_identifier.rb +26 -0
- data/lib/relaton/gb/t_scraper.rb +126 -0
- data/lib/relaton/gb/util.rb +8 -0
- data/lib/relaton/gb/yaml/prefixes.yaml +200 -0
- data/lib/relaton/gb.rb +33 -0
- data/lib/relaton/iana/bibdata.rb +8 -0
- data/lib/relaton/iana/bibitem.rb +8 -0
- data/lib/relaton/iana/bibliography.rb +47 -0
- data/lib/relaton/iana/data_fetcher.rb +71 -0
- data/lib/relaton/iana/item.rb +7 -0
- data/lib/relaton/iana/item_data.rb +6 -0
- data/lib/relaton/iana/parser.rb +146 -0
- data/lib/relaton/iana/processor.rb +68 -0
- data/lib/relaton/iana/util.rb +8 -0
- data/lib/relaton/iana.rb +29 -0
- data/lib/relaton/iec/bibliography.rb +283 -0
- data/lib/relaton/iec/data_fetcher.rb +216 -0
- data/lib/relaton/iec/data_parser.rb +391 -0
- data/lib/relaton/iec/hit.rb +26 -0
- data/lib/relaton/iec/hit_collection.rb +138 -0
- data/lib/relaton/iec/item_data.rb +7 -0
- data/lib/relaton/iec/model/bibdata.rb +8 -0
- data/lib/relaton/iec/model/bibitem.rb +8 -0
- data/lib/relaton/iec/model/docidentifier.rb +131 -0
- data/lib/relaton/iec/model/doctype.rb +12 -0
- data/lib/relaton/iec/model/ext.rb +53 -0
- data/lib/relaton/iec/model/item.rb +20 -0
- data/lib/relaton/iec/model/item_base.rb +12 -0
- data/lib/relaton/iec/model/relation.rb +7 -0
- data/lib/relaton/iec/model/stage_name.rb +13 -0
- data/lib/relaton/iec/processor.rb +73 -0
- data/lib/relaton/iec/statuses.yml +199 -0
- data/lib/relaton/iec/util.rb +8 -0
- data/lib/relaton/iec.rb +98 -0
- data/lib/relaton/ieee/balloting_group.rb +13 -0
- data/lib/relaton/ieee/bibdata.rb +8 -0
- data/lib/relaton/ieee/bibitem.rb +8 -0
- data/lib/relaton/ieee/bibliography.rb +51 -0
- data/lib/relaton/ieee/converter/bibxml/from_rfcxml.rb +10 -0
- data/lib/relaton/ieee/converter/bibxml/from_rfcxml_referencegroup.rb +10 -0
- data/lib/relaton/ieee/converter/bibxml.rb +20 -0
- data/lib/relaton/ieee/data_fetcher.rb +630 -0
- data/lib/relaton/ieee/doctype.rb +9 -0
- data/lib/relaton/ieee/editorial_group.rb +19 -0
- data/lib/relaton/ieee/ext.rb +36 -0
- data/lib/relaton/ieee/idams_parser.rb +323 -0
- data/lib/relaton/ieee/item.rb +11 -0
- data/lib/relaton/ieee/item_data.rb +7 -0
- data/lib/relaton/ieee/processor.rb +68 -0
- data/lib/relaton/ieee/pub_id.rb +161 -0
- data/lib/relaton/ieee/rawbib_id_parser.rb +548 -0
- data/lib/relaton/ieee/util.rb +8 -0
- data/lib/relaton/ieee.rb +29 -0
- data/lib/relaton/ietf/bibdata.rb +8 -0
- data/lib/relaton/ietf/bibitem.rb +8 -0
- data/lib/relaton/ietf/bibliography.rb +35 -0
- data/lib/relaton/ietf/bibxml_parser.rb +232 -0
- data/lib/relaton/ietf/data_fetcher.rb +278 -0
- data/lib/relaton/ietf/doctype.rb +9 -0
- data/lib/relaton/ietf/ext.rb +63 -0
- data/lib/relaton/ietf/item.rb +16 -0
- data/lib/relaton/ietf/item_base.rb +18 -0
- data/lib/relaton/ietf/item_data.rb +6 -0
- data/lib/relaton/ietf/processing_instructions.rb +79 -0
- data/lib/relaton/ietf/processor.rb +68 -0
- data/lib/relaton/ietf/relation.rb +9 -0
- data/lib/relaton/ietf/rfc/abstract.rb +19 -0
- data/lib/relaton/ietf/rfc/author.rb +21 -0
- data/lib/relaton/ietf/rfc/entry.rb +410 -0
- data/lib/relaton/ietf/rfc/entry_date.rb +21 -0
- data/lib/relaton/ietf/rfc/format.rb +19 -0
- data/lib/relaton/ietf/rfc/index.rb +46 -0
- data/lib/relaton/ietf/rfc/is_also.rb +21 -0
- data/lib/relaton/ietf/rfc/keywords.rb +19 -0
- data/lib/relaton/ietf/rfc/rfc_index_namespace.rb +11 -0
- data/lib/relaton/ietf/scraper.rb +68 -0
- data/lib/relaton/ietf/util.rb +8 -0
- data/lib/relaton/ietf/wg_name_resolver.rb +42 -0
- data/lib/relaton/ietf.rb +27 -0
- data/lib/relaton/iho/bibdata.rb +8 -0
- data/lib/relaton/iho/bibitem.rb +8 -0
- data/lib/relaton/iho/bibliography.rb +114 -0
- data/lib/relaton/iho/comment_period.rb +13 -0
- data/lib/relaton/iho/docidentifier.rb +31 -0
- data/lib/relaton/iho/doctype.rb +10 -0
- data/lib/relaton/iho/ext.rb +20 -0
- data/lib/relaton/iho/hash_parser_v1.rb +144 -0
- data/lib/relaton/iho/item.rb +20 -0
- data/lib/relaton/iho/item_base.rb +18 -0
- data/lib/relaton/iho/item_data.rb +6 -0
- data/lib/relaton/iho/processor.rb +54 -0
- data/lib/relaton/iho/relation.rb +9 -0
- data/lib/relaton/iho/structured_identifier.rb +20 -0
- data/lib/relaton/iho/util.rb +8 -0
- data/lib/relaton/iho.rb +27 -0
- data/lib/relaton/index/config.rb +52 -0
- data/lib/relaton/index/file_io.rb +305 -0
- data/lib/relaton/index/file_storage.rb +61 -0
- data/lib/relaton/index/id_number.rb +30 -0
- data/lib/relaton/index/pool.rb +41 -0
- data/lib/relaton/index/type.rb +159 -0
- data/lib/relaton/index/util.rb +18 -0
- data/lib/relaton/index.rb +60 -0
- data/lib/relaton/isbn/isbn.rb +61 -0
- data/lib/relaton/isbn/open_library.rb +43 -0
- data/lib/relaton/isbn/parser.rb +88 -0
- data/lib/relaton/isbn/processor.rb +48 -0
- data/lib/relaton/isbn/util.rb +8 -0
- data/lib/relaton/isbn.rb +19 -0
- data/lib/relaton/iso/bibliography.rb +407 -0
- data/lib/relaton/iso/data_fetcher.rb +338 -0
- data/lib/relaton/iso/data_parser.rb +444 -0
- data/lib/relaton/iso/hash_parser_v1.rb +177 -0
- data/lib/relaton/iso/hit.rb +57 -0
- data/lib/relaton/iso/hit_collection.rb +184 -0
- data/lib/relaton/iso/item_data.rb +28 -0
- data/lib/relaton/iso/model/bibdata.rb +10 -0
- data/lib/relaton/iso/model/bibitem.rb +8 -0
- data/lib/relaton/iso/model/contributor.rb +6 -0
- data/lib/relaton/iso/model/contributor_info.rb +9 -0
- data/lib/relaton/iso/model/docidentifier.rb +134 -0
- data/lib/relaton/iso/model/doctype.rb +13 -0
- data/lib/relaton/iso/model/ext.rb +35 -0
- data/lib/relaton/iso/model/item.rb +17 -0
- data/lib/relaton/iso/model/item_base.rb +22 -0
- data/lib/relaton/iso/model/organization.rb +9 -0
- data/lib/relaton/iso/model/project_number.rb +22 -0
- data/lib/relaton/iso/model/relation.rb +9 -0
- data/lib/relaton/iso/model/stagename.rb +14 -0
- data/lib/relaton/iso/model/structured_identifier.rb +31 -0
- data/lib/relaton/iso/processor.rb +84 -0
- data/lib/relaton/iso/scraper.rb +619 -0
- data/lib/relaton/iso/type/pubid.rb +50 -0
- data/lib/relaton/iso/util.rb +8 -0
- data/lib/relaton/iso.rb +30 -0
- data/lib/relaton/itu/bibliography.rb +90 -0
- data/lib/relaton/itu/data_fetcher.rb +104 -0
- data/lib/relaton/itu/data_parser_r.rb +140 -0
- data/lib/relaton/itu/hit.rb +22 -0
- data/lib/relaton/itu/hit_collection.rb +127 -0
- data/lib/relaton/itu/item_data.rb +6 -0
- data/lib/relaton/itu/model/approval_stage.rb +13 -0
- data/lib/relaton/itu/model/bibdata.rb +8 -0
- data/lib/relaton/itu/model/bibitem.rb +8 -0
- data/lib/relaton/itu/model/docidentifier.rb +9 -0
- data/lib/relaton/itu/model/doctype.rb +13 -0
- data/lib/relaton/itu/model/ext.rb +47 -0
- data/lib/relaton/itu/model/item.rb +13 -0
- data/lib/relaton/itu/model/meeting.rb +13 -0
- data/lib/relaton/itu/model/meeting_date.rb +15 -0
- data/lib/relaton/itu/model/question.rb +13 -0
- data/lib/relaton/itu/model/recommendation_status.rb +11 -0
- data/lib/relaton/itu/model/structured_identifier.rb +19 -0
- data/lib/relaton/itu/processor.rb +66 -0
- data/lib/relaton/itu/pubid.rb +177 -0
- data/lib/relaton/itu/radio_regulations_parser.rb +70 -0
- data/lib/relaton/itu/recommendation_parser.rb +161 -0
- data/lib/relaton/itu/scraper.rb +193 -0
- data/lib/relaton/itu/util.rb +8 -0
- data/lib/relaton/itu.rb +33 -0
- data/lib/relaton/jis/bibdata.rb +8 -0
- data/lib/relaton/jis/bibitem.rb +8 -0
- data/lib/relaton/jis/bibliography.rb +75 -0
- data/lib/relaton/jis/data_fetcher.rb +181 -0
- data/lib/relaton/jis/docidentifier.rb +21 -0
- data/lib/relaton/jis/doctype.rb +9 -0
- data/lib/relaton/jis/ext.rb +13 -0
- data/lib/relaton/jis/hit.rb +93 -0
- data/lib/relaton/jis/hit_collection.rb +127 -0
- data/lib/relaton/jis/item.rb +22 -0
- data/lib/relaton/jis/item_base.rb +26 -0
- data/lib/relaton/jis/item_data.rb +8 -0
- data/lib/relaton/jis/processor.rb +55 -0
- data/lib/relaton/jis/relation.rb +11 -0
- data/lib/relaton/jis/scraper.rb +232 -0
- data/lib/relaton/jis/structured_identifier.rb +13 -0
- data/lib/relaton/jis/util.rb +8 -0
- data/lib/relaton/jis.rb +33 -0
- data/lib/relaton/logger/channels/gh_issue.rb +78 -0
- data/lib/relaton/logger/config.rb +34 -0
- data/lib/relaton/logger/formatter_json.rb +8 -0
- data/lib/relaton/logger/formatter_string.rb +12 -0
- data/lib/relaton/logger/log.rb +64 -0
- data/lib/relaton/logger/log_device.rb +27 -0
- data/lib/relaton/logger/pool.rb +24 -0
- data/lib/relaton/logger.rb +18 -0
- data/lib/relaton/nist/bibdata.rb +8 -0
- data/lib/relaton/nist/bibitem.rb +8 -0
- data/lib/relaton/nist/bibliography.rb +191 -0
- data/lib/relaton/nist/comment_period.rb +15 -0
- data/lib/relaton/nist/data_fetcher.rb +84 -0
- data/lib/relaton/nist/date.rb +7 -0
- data/lib/relaton/nist/doctype.rb +7 -0
- data/lib/relaton/nist/ext.rb +16 -0
- data/lib/relaton/nist/hit.rb +18 -0
- data/lib/relaton/nist/hit_collection.rb +362 -0
- data/lib/relaton/nist/item.rb +17 -0
- data/lib/relaton/nist/item_data.rb +6 -0
- data/lib/relaton/nist/mods_parser.rb +276 -0
- data/lib/relaton/nist/processor.rb +68 -0
- data/lib/relaton/nist/pubs_export.rb +69 -0
- data/lib/relaton/nist/relation.rb +7 -0
- data/lib/relaton/nist/scraper.rb +290 -0
- data/lib/relaton/nist/series.yaml +49 -0
- data/lib/relaton/nist/util.rb +8 -0
- data/lib/relaton/nist.rb +34 -0
- data/lib/relaton/oasis/bibdata.rb +8 -0
- data/lib/relaton/oasis/bibitem.rb +8 -0
- data/lib/relaton/oasis/bibliography.rb +60 -0
- data/lib/relaton/oasis/browser_agent.rb +71 -0
- data/lib/relaton/oasis/data_fetcher.rb +94 -0
- data/lib/relaton/oasis/data_parser.rb +305 -0
- data/lib/relaton/oasis/data_parser_utils.rb +296 -0
- data/lib/relaton/oasis/data_part_parser.rb +239 -0
- data/lib/relaton/oasis/doctype.rb +7 -0
- data/lib/relaton/oasis/ext.rb +19 -0
- data/lib/relaton/oasis/item.rb +11 -0
- data/lib/relaton/oasis/item_data.rb +6 -0
- data/lib/relaton/oasis/processor.rb +68 -0
- data/lib/relaton/oasis/util.rb +8 -0
- data/lib/relaton/oasis.rb +28 -0
- data/lib/relaton/ogc/bibdata.rb +8 -0
- data/lib/relaton/ogc/bibitem.rb +8 -0
- data/lib/relaton/ogc/bibliography.rb +64 -0
- data/lib/relaton/ogc/data_fetcher.rb +110 -0
- data/lib/relaton/ogc/docidentifier.rb +6 -0
- data/lib/relaton/ogc/doctype.rb +12 -0
- data/lib/relaton/ogc/ext.rb +15 -0
- data/lib/relaton/ogc/hit.rb +18 -0
- data/lib/relaton/ogc/hit_collection.rb +36 -0
- data/lib/relaton/ogc/item.rb +13 -0
- data/lib/relaton/ogc/item_data.rb +6 -0
- data/lib/relaton/ogc/processor.rb +58 -0
- data/lib/relaton/ogc/scraper.rb +225 -0
- data/lib/relaton/ogc/util.rb +8 -0
- data/lib/relaton/ogc.rb +26 -0
- data/lib/relaton/oiml/bibdata.rb +8 -0
- data/lib/relaton/oiml/bibitem.rb +8 -0
- data/lib/relaton/oiml/bibliography.rb +94 -0
- data/lib/relaton/oiml/docidentifier.rb +33 -0
- data/lib/relaton/oiml/doctype.rb +13 -0
- data/lib/relaton/oiml/ext.rb +42 -0
- data/lib/relaton/oiml/item.rb +20 -0
- data/lib/relaton/oiml/item_base.rb +18 -0
- data/lib/relaton/oiml/item_data.rb +6 -0
- data/lib/relaton/oiml/processor.rb +54 -0
- data/lib/relaton/oiml/relation.rb +9 -0
- data/lib/relaton/oiml/util.rb +8 -0
- data/lib/relaton/oiml.rb +24 -0
- data/lib/relaton/omg/bibdata.rb +8 -0
- data/lib/relaton/omg/bibitem.rb +8 -0
- data/lib/relaton/omg/bibliography.rb +31 -0
- data/lib/relaton/omg/ext.rb +7 -0
- data/lib/relaton/omg/item.rb +8 -0
- data/lib/relaton/omg/item_data.rb +6 -0
- data/lib/relaton/omg/processor.rb +34 -0
- data/lib/relaton/omg/scraper.rb +141 -0
- data/lib/relaton/omg/util.rb +8 -0
- data/lib/relaton/omg.rb +24 -0
- data/lib/relaton/plateau/bibdata.rb +8 -0
- data/lib/relaton/plateau/bibitem.rb +8 -0
- data/lib/relaton/plateau/bibliography.rb +24 -0
- data/lib/relaton/plateau/data_fetcher.rb +153 -0
- data/lib/relaton/plateau/doctype.rb +7 -0
- data/lib/relaton/plateau/ext.rb +23 -0
- data/lib/relaton/plateau/handbook_parser.rb +95 -0
- data/lib/relaton/plateau/hit.rb +13 -0
- data/lib/relaton/plateau/hit_collection.rb +59 -0
- data/lib/relaton/plateau/item.rb +12 -0
- data/lib/relaton/plateau/item_data.rb +6 -0
- data/lib/relaton/plateau/parser.rb +101 -0
- data/lib/relaton/plateau/processor.rb +49 -0
- data/lib/relaton/plateau/technical_report_parser.rb +91 -0
- data/lib/relaton/plateau/util.rb +8 -0
- data/lib/relaton/plateau.rb +28 -0
- data/lib/relaton/un/bibdata.rb +8 -0
- data/lib/relaton/un/bibitem.rb +8 -0
- data/lib/relaton/un/bibliography.rb +48 -0
- data/lib/relaton/un/doctype.rb +10 -0
- data/lib/relaton/un/ext.rb +30 -0
- data/lib/relaton/un/hit.rb +56 -0
- data/lib/relaton/un/hit_collection.rb +61 -0
- data/lib/relaton/un/item.rb +11 -0
- data/lib/relaton/un/item_data.rb +6 -0
- data/lib/relaton/un/parser.rb +108 -0
- data/lib/relaton/un/processor.rb +38 -0
- data/lib/relaton/un/session.rb +25 -0
- data/lib/relaton/un/token_generator.rb +105 -0
- data/lib/relaton/un/util.rb +8 -0
- data/lib/relaton/un/wasm/decoder.rb +434 -0
- data/lib/relaton/un/wasm/instance.rb +101 -0
- data/lib/relaton/un/wasm/interpreter.rb +613 -0
- data/lib/relaton/un/wasm/memory.rb +112 -0
- data/lib/relaton/un/wasm/module.rb +47 -0
- data/lib/relaton/un/wasm.rb +17 -0
- data/lib/relaton/un/wasm_v_bg.wasm +0 -0
- data/lib/relaton/un.rb +28 -0
- data/lib/relaton/version.rb +1 -1
- data/lib/relaton/w3c/bibdata.rb +8 -0
- data/lib/relaton/w3c/bibitem.rb +8 -0
- data/lib/relaton/w3c/bibliography.rb +54 -0
- data/lib/relaton/w3c/data_fetcher.rb +309 -0
- data/lib/relaton/w3c/data_parser.rb +379 -0
- data/lib/relaton/w3c/doctype.rb +7 -0
- data/lib/relaton/w3c/ext.rb +11 -0
- data/lib/relaton/w3c/item.rb +12 -0
- data/lib/relaton/w3c/item_data.rb +6 -0
- data/lib/relaton/w3c/processor.rb +49 -0
- data/lib/relaton/w3c/pubid.rb +73 -0
- data/lib/relaton/w3c/safe_realize.rb +59 -0
- data/lib/relaton/w3c/util.rb +8 -0
- data/lib/relaton/w3c.rb +25 -0
- data/lib/relaton/xsf/bibdata.rb +8 -0
- data/lib/relaton/xsf/bibitem.rb +8 -0
- data/lib/relaton/xsf/bibliography.rb +24 -0
- data/lib/relaton/xsf/data_fetcher.rb +56 -0
- data/lib/relaton/xsf/hit.rb +17 -0
- data/lib/relaton/xsf/hit_collection.rb +24 -0
- data/lib/relaton/xsf/item.rb +7 -0
- data/lib/relaton/xsf/item_data.rb +6 -0
- data/lib/relaton/xsf/processor.rb +50 -0
- data/lib/relaton/xsf/util.rb +9 -0
- data/lib/relaton/xsf.rb +30 -0
- data/lib/relaton-core.rb +1 -0
- data/lib/relaton.rb +43 -0
- metadata +673 -170
- data/.github/workflows/rake.yml +0 -14
- data/.github/workflows/release.yml +0 -24
- data/.github/workflows/rubocop.yml +0 -48
- data/.gitignore +0 -12
- data/.rspec +0 -3
- data/CLAUDE.md +0 -78
- data/Gemfile +0 -29
- data/Rakefile +0 -6
- data/docs/CHANGELOG.adoc +0 -16
- data/docs/VERSIONING_POLICY.adoc +0 -38
- data/docs/navigation.adoc +0 -6
- data/lib/relaton/db/version.rb +0 -5
- data/relaton.gemspec +0 -72
- data/spec/relaton/config_spec.rb +0 -10
- data/spec/relaton/db_cache_spec.rb +0 -51
- data/spec/relaton/db_spec.rb +0 -567
- data/spec/relaton/registry_spec.rb +0 -178
- data/spec/relaton/util_spec.rb +0 -3
- data/spec/relaton_meta_spec.rb +0 -25
- data/spec/relaton_spec.rb +0 -800
- data/spec/spec_helper.rb +0 -45
- data/spec/support/gb_t_20223_2006.xml +0 -33
- data/spec/support/iso_111111119115_1.xml +0 -0
- data/spec/support/iso_19115_1.xml +0 -115
- data/spec/support/iso_19115_2.xml +0 -95
- data/spec/support/rfc_8341.xml +0 -46
- data/spec/vcr_cassetes/api_relaton_org.yml +0 -121
- data/spec/vcr_cassetes/api_relaton_org_unavailable.yml +0 -140
- data/spec/vcr_cassetes/cc_dir_10005_2019.yml +0 -202
- data/spec/vcr_cassetes/cipm_meeting_43.yml +0 -1505
- data/spec/vcr_cassetes/gb_t_20223_2006.yml +0 -729
- data/spec/vcr_cassetes/iso_111111119115_1.yml +0 -12951
- data/spec/vcr_cassetes/iso_19115_1.yml +0 -17334
- data/spec/vcr_cassetes/iso_19115_1_2.yml +0 -322
- data/spec/vcr_cassetes/iso_19115_1_std.yml +0 -17334
- data/spec/vcr_cassetes/iso_19115_all_parts.yml +0 -185
- data/spec/vcr_cassetes/iso_19133_2005.yml +0 -144
- data/spec/vcr_cassetes/iso_combined_applied.yml +0 -318
- data/spec/vcr_cassetes/iso_combined_included.yml +0 -318
- data/spec/vcr_cassetes/ogc_19_025r1.yml +0 -374
- data/spec/vcr_cassetes/omg_ami4ccm_1_0.yml +0 -317
- data/spec/vcr_cassetes/rfc_8341.yml +0 -1278
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Itu
|
|
3
|
+
class StructuredIdentifier < Lutaml::Model::Serializable
|
|
4
|
+
attribute :bureau, :string, values: %w[T D R]
|
|
5
|
+
attribute :docnumber, :string
|
|
6
|
+
attribute :annexid, :string
|
|
7
|
+
attribute :amendment, :integer
|
|
8
|
+
attribute :corrigendum, :integer
|
|
9
|
+
|
|
10
|
+
xml do
|
|
11
|
+
map_element "bureau", to: :bureau
|
|
12
|
+
map_element "docnumber", to: :docnumber
|
|
13
|
+
map_element "annexid", to: :annexid
|
|
14
|
+
map_element "amendment", to: :amendment
|
|
15
|
+
map_element "corrigendum", to: :corrigendum
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
require "relaton/core/processor"
|
|
2
|
+
|
|
3
|
+
module Relaton
|
|
4
|
+
module Itu
|
|
5
|
+
class Processor < Relaton::Core::Processor
|
|
6
|
+
def initialize
|
|
7
|
+
@short = :relaton_itu
|
|
8
|
+
@prefix = "ITU"
|
|
9
|
+
@defaultprefix = %r{^ITU\s}
|
|
10
|
+
@idtype = "ITU"
|
|
11
|
+
@datasets = %w[itu-r]
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# @param code [String]
|
|
15
|
+
# @param date [String, nil] year
|
|
16
|
+
# @param opts [Hash]
|
|
17
|
+
# @return [Relaton::Itu::ItemData, nil]
|
|
18
|
+
def get(code, date, opts)
|
|
19
|
+
require_relative "../itu"
|
|
20
|
+
Bibliography.get(code, date, opts)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
#
|
|
24
|
+
# Fetch all the documents from https://extranet.itu.int/brdocsearch/
|
|
25
|
+
#
|
|
26
|
+
# @param [String] source source name (itu-r)
|
|
27
|
+
# @param [Hash] opts
|
|
28
|
+
# @option opts [String] :output directory to output documents, default is data
|
|
29
|
+
# @option opts [String] :format output format, default is yaml
|
|
30
|
+
#
|
|
31
|
+
def fetch_data(source, opts)
|
|
32
|
+
require_relative "data_fetcher"
|
|
33
|
+
DataFetcher.fetch(source, **opts)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# @param xml [String]
|
|
37
|
+
# @return [Relaton::Itu::ItemData]
|
|
38
|
+
def from_xml(xml)
|
|
39
|
+
require_relative "../itu"
|
|
40
|
+
Item.from_xml xml
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# @param yaml [Hash]
|
|
44
|
+
# @return [Relaton::Itu::ItemData]
|
|
45
|
+
def from_yaml(yaml)
|
|
46
|
+
require_relative "../itu"
|
|
47
|
+
Item.from_yaml yaml
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Returns hash of XML grammar
|
|
51
|
+
# @return [String]
|
|
52
|
+
def grammar_hash
|
|
53
|
+
require_relative "../itu"
|
|
54
|
+
@grammar_hash ||= Itu.grammar_hash
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
#
|
|
58
|
+
# Remove index file
|
|
59
|
+
#
|
|
60
|
+
def remove_index_file
|
|
61
|
+
require_relative "../itu"
|
|
62
|
+
Relaton::Index.find_or_create(:itu, url: true, file: "#{INDEXFILE}.yaml").remove_file
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Itu
|
|
3
|
+
class Pubid
|
|
4
|
+
class Parser < Parslet::Parser
|
|
5
|
+
rule(:dash) { str("-") }
|
|
6
|
+
rule(:dot) { str(".") }
|
|
7
|
+
rule(:dot?) { dot.maybe }
|
|
8
|
+
rule(:separator) { match['\s-'] }
|
|
9
|
+
rule(:space) { match("\s") }
|
|
10
|
+
rule(:num) { match["0-9"] }
|
|
11
|
+
|
|
12
|
+
rule(:prefix) { str("ITU").as(:prefix) }
|
|
13
|
+
rule(:sector) { separator >> match("[A-Z]").as(:sector) }
|
|
14
|
+
rule(:type) { separator >> str("REC").as(:type) }
|
|
15
|
+
rule(:type?) { type.maybe }
|
|
16
|
+
rule(:code) { separator >> (match["A-Z0-9"].repeat(1) >> match["[:alnum:]/.-"].repeat).as(:code) }
|
|
17
|
+
rule(:year) { (match["12"] >> num.repeat(3, 3)).as(:year) }
|
|
18
|
+
|
|
19
|
+
rule(:month1) { num.repeat(2, 2).as(:month) }
|
|
20
|
+
rule(:date1) { str(" (") >> (month1 >> str("/")).maybe >> year >> str(")") }
|
|
21
|
+
rule(:month2) { match["IVX"].repeat(1, 3).as(:month) }
|
|
22
|
+
rule(:date2) { str(" - ") >> num.repeat(2, 2).as(:day) >> dot >> month2 >> dot >> year }
|
|
23
|
+
rule(:date) { date1 | date2 }
|
|
24
|
+
rule(:date?) { date.maybe }
|
|
25
|
+
|
|
26
|
+
rule(:amd_month) { num.repeat(2, 2) }
|
|
27
|
+
rule(:amd_year) { num.repeat(4, 4) }
|
|
28
|
+
rule(:amd_date) { str(" (") >> (amd_month >> str("/") >> amd_year).as(:amd_date) >> str(")") }
|
|
29
|
+
rule(:amd_date?) { amd_date.maybe }
|
|
30
|
+
rule(:amd) { space >> (str("Amd") | str("Amendment")) >> dot? >> space >> num.repeat(1, 2).as(:amd) >> amd_date? }
|
|
31
|
+
rule(:amd?) { amd.maybe }
|
|
32
|
+
|
|
33
|
+
rule(:sup) { space >> str("Suppl") >> dot? >> space >> num.repeat(1, 2).as(:suppl) }
|
|
34
|
+
rule(:sup?) { sup.maybe }
|
|
35
|
+
|
|
36
|
+
rule(:annex) { space >> str("Annex") >> space >> match["[:alnum:]"].repeat(1, 2).as(:annex) }
|
|
37
|
+
rule(:annex?) { annex.maybe }
|
|
38
|
+
|
|
39
|
+
rule(:ver) { space >> str("(V") >> num.repeat(1, 2).as(:version) >> str(")") }
|
|
40
|
+
rule(:ver?) { ver.maybe }
|
|
41
|
+
|
|
42
|
+
rule(:itu_pubid_sector) { prefix >> sector >> type? >> code >> sup? >> annex? >> ver? >> date? >> amd? >> any.repeat }
|
|
43
|
+
rule(:itu_pubid_no_sector) { prefix >> type? >> code >> sup? >> annex? >> ver? >> date? >> amd? >> any.repeat }
|
|
44
|
+
rule(:itu_pubid) { itu_pubid_sector | itu_pubid_no_sector }
|
|
45
|
+
root(:itu_pubid)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
attr_accessor :prefix, :sector, :type, :code, :suppl, :annex, :version, :year, :month, :day, :amd, :amd_date
|
|
49
|
+
|
|
50
|
+
#
|
|
51
|
+
# Create a new ITU publication identifier.
|
|
52
|
+
#
|
|
53
|
+
# @param [String] prefix
|
|
54
|
+
# @param [String] code
|
|
55
|
+
#
|
|
56
|
+
def initialize(prefix:, code:, **args)
|
|
57
|
+
@prefix = prefix
|
|
58
|
+
@sector = args[:sector]
|
|
59
|
+
@type = args[:type]
|
|
60
|
+
@day = args[:day]
|
|
61
|
+
@code, year, month = date_from_code code
|
|
62
|
+
@suppl = args[:suppl]
|
|
63
|
+
@annex = args[:annex]
|
|
64
|
+
@version = args[:version]
|
|
65
|
+
@year = args[:year] || year
|
|
66
|
+
@month = roman_to_2digit args[:month] || month
|
|
67
|
+
@amd = args[:amd]
|
|
68
|
+
@amd_date = args[:amd_date]
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def self.parse(id)
|
|
72
|
+
id_parts = Parser.new.parse(id).to_h.transform_values(&:to_s)
|
|
73
|
+
new(**id_parts)
|
|
74
|
+
rescue Parslet::ParseFailed => e
|
|
75
|
+
Util.error "`#{id}` is invalid ITU publication identifier\n" \
|
|
76
|
+
"#{e.parse_failure_cause.ascii_tree}"
|
|
77
|
+
raise e
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def to_h(with_type: true) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
81
|
+
hash = { prefix: prefix, code: code }
|
|
82
|
+
hash[:sector] = sector if sector
|
|
83
|
+
hash[:type] = type if type && with_type
|
|
84
|
+
hash[:suppl] = suppl if suppl
|
|
85
|
+
hash[:annex] = annex if annex
|
|
86
|
+
hash[:version] = version if version
|
|
87
|
+
hash[:year] = year if year
|
|
88
|
+
hash[:month] = month if month
|
|
89
|
+
hash[:day] = day if day
|
|
90
|
+
hash[:amd] = amd if amd
|
|
91
|
+
hash[:amd_date] = amd_date if amd_date
|
|
92
|
+
hash
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def to_ref
|
|
96
|
+
to_s ref: true
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def to_s(ref: false) # rubocop:disable Metrics/AbcSize
|
|
100
|
+
s = prefix.dup
|
|
101
|
+
s << "-#{sector}" if sector
|
|
102
|
+
s << " #{type}" if type && !ref
|
|
103
|
+
s << " #{code}"
|
|
104
|
+
s << " Suppl. #{suppl}" if suppl
|
|
105
|
+
s << " Annex #{annex}" if annex
|
|
106
|
+
s << " (V#{version})" if version
|
|
107
|
+
s << date_to_s
|
|
108
|
+
s << " Amd #{amd}" if amd
|
|
109
|
+
s << " (#{amd_date})" if amd_date
|
|
110
|
+
s
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def ===(other, ignore_args = [])
|
|
114
|
+
hash = to_h with_type: false
|
|
115
|
+
other_hash = other.to_h with_type: false
|
|
116
|
+
hash.delete(:version) if ignore_args.include?(:version)
|
|
117
|
+
other_hash.delete(:version) unless hash[:version]
|
|
118
|
+
hash.delete(:day)
|
|
119
|
+
other_hash.delete(:day)
|
|
120
|
+
hash.delete(:month)
|
|
121
|
+
other_hash.delete(:month)
|
|
122
|
+
hash.delete(:year) if ignore_args.include?(:year)
|
|
123
|
+
other_hash.delete(:year) unless hash[:year]
|
|
124
|
+
hash.delete(:amd_date) if ignore_args.include?(:amd_date)
|
|
125
|
+
other_hash.delete(:amd_date) unless hash[:amd_date]
|
|
126
|
+
hash == other_hash
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
private
|
|
130
|
+
|
|
131
|
+
def date_from_code(code)
|
|
132
|
+
/(?<cod>.+?)-(?<date>\d{6})(?:-I|$)/ =~ code
|
|
133
|
+
return [code, nil, nil] unless cod && date
|
|
134
|
+
|
|
135
|
+
[cod, date[0..3], date[4..5]]
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def roman_to_2digit(num) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
|
139
|
+
return unless num
|
|
140
|
+
|
|
141
|
+
roman_nums = { "I" => 1, "V" => 5, "X" => 10 }
|
|
142
|
+
last = roman_nums[num[-1]]
|
|
143
|
+
return num unless last
|
|
144
|
+
|
|
145
|
+
return roman_nums[num].to_s.rjust(2, "0") if num.size == 1
|
|
146
|
+
|
|
147
|
+
num.chars.each_cons(2).reduce(last) do |acc, (a, b)|
|
|
148
|
+
if roman_nums[a] < roman_nums[b]
|
|
149
|
+
acc - roman_nums[a]
|
|
150
|
+
else
|
|
151
|
+
acc + roman_nums[a]
|
|
152
|
+
end
|
|
153
|
+
end.to_s.rjust(2, "0")
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def month_to_roman
|
|
157
|
+
int = month.to_i
|
|
158
|
+
return month unless int.between? 1, 12
|
|
159
|
+
|
|
160
|
+
roman_tens = ["", "X"]
|
|
161
|
+
roman_units = ["", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"]
|
|
162
|
+
|
|
163
|
+
tens = int / 10
|
|
164
|
+
units = int % 10
|
|
165
|
+
|
|
166
|
+
roman_tens[tens] + roman_units[units]
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
def date_to_s
|
|
170
|
+
if month && year then " (#{month}/#{year})"
|
|
171
|
+
elsif year then " (#{year})"
|
|
172
|
+
else ""
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
require "cgi"
|
|
2
|
+
|
|
3
|
+
module Relaton
|
|
4
|
+
module Itu
|
|
5
|
+
class RadioRegulationsParser
|
|
6
|
+
include Relaton::Core::ArrayWrapper
|
|
7
|
+
|
|
8
|
+
ROMAN_MONTHS = %w[I II III IV V VI VII VIII IX X XI XII].freeze
|
|
9
|
+
|
|
10
|
+
def initialize(hit)
|
|
11
|
+
@hit = hit
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def doc
|
|
15
|
+
@doc ||= hit.hit_collection.agent.get doc_url
|
|
16
|
+
rescue Mechanize::ResponseCodeError, SocketError, Timeout::Error, Errno::ECONNRESET,
|
|
17
|
+
EOFError, Net::ProtocolError, OpenSSL::SSL::SSLError => e
|
|
18
|
+
raise Relaton::RequestError, "Could not access #{doc_url}: #{e.message}"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def doc_url
|
|
22
|
+
CGI.unescape(hit.hit[:url]).split("dest=").last
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def fetch_edition = nil
|
|
26
|
+
def fetch_status = nil
|
|
27
|
+
def fetch_abstract = []
|
|
28
|
+
def fetch_relations = []
|
|
29
|
+
def fetch_workgroup = nil
|
|
30
|
+
|
|
31
|
+
# @return [Array<Relaton::Bib::Title>]
|
|
32
|
+
def fetch_titles
|
|
33
|
+
title = doc.at("//title")&.text&.strip
|
|
34
|
+
return [] if title.nil? || title.empty?
|
|
35
|
+
|
|
36
|
+
Relaton::Bib::Title.from_string title, "en", "Latn"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# @return [Array<Relaton::Bib::Date>]
|
|
40
|
+
def fetch_dates
|
|
41
|
+
array(doc_date).map { |on| Relaton::Bib::Date.new(type: "published", at: on) }
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def doc_date
|
|
45
|
+
return @doc_date if defined? @doc_date
|
|
46
|
+
|
|
47
|
+
date_str = doc.at("//td[@class='title']/text()")&.text&.slice(/(?<=Year:\s)(?:\d{1,2}\.\w+\.)?\d{4}/)
|
|
48
|
+
@doc_date = date_str ? roman_to_arabic(date_str) : nil
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# @return [Array<Relaton::Bib::Uri>]
|
|
52
|
+
def fetch_source
|
|
53
|
+
[Relaton::Bib::Uri.new(type: "src", content: doc_url)]
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
private
|
|
57
|
+
|
|
58
|
+
attr_reader :hit
|
|
59
|
+
|
|
60
|
+
def roman_to_arabic(date)
|
|
61
|
+
%r{(?<rmonth>[IVX]+)} =~ date
|
|
62
|
+
if ROMAN_MONTHS.index(rmonth)
|
|
63
|
+
month = ROMAN_MONTHS.index(rmonth) + 1
|
|
64
|
+
Date.parse(date.sub(%r{[IVX]+}, month.to_s)).to_s
|
|
65
|
+
else date
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Itu
|
|
3
|
+
class RecommendationParser
|
|
4
|
+
include Relaton::Core::ArrayWrapper
|
|
5
|
+
|
|
6
|
+
RECHDR = "https://www.itu.int/mws/api/recommendations/getRecHdrDetail?idrec=%{idrec}&lang=en"
|
|
7
|
+
RECEDITIONS = "https://www.itu.int/mws/api/recommendations/getRecEditions?idrec=%{idrec}&lang=en"
|
|
8
|
+
RECSUPPLEMENTS = "https://www.itu.int/mws/api/recommendations/getRecSupplements?idrec=%{idrec}&lang=en"
|
|
9
|
+
IMPLGUIDES = "https://www.itu.int/mws/api/recommendations/getImplGuides?idrec=%{idrec}&lang=en"
|
|
10
|
+
|
|
11
|
+
def initialize(hit, idrec, imp)
|
|
12
|
+
@hit = hit
|
|
13
|
+
@idrec = idrec
|
|
14
|
+
@imp = imp
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def doc
|
|
18
|
+
@doc ||= begin
|
|
19
|
+
url = (imp ? IMPLGUIDES : RECHDR) % { idrec: idrec }
|
|
20
|
+
resp = get_data url
|
|
21
|
+
imp ? resp.first : resp
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# @return [String, nil]
|
|
26
|
+
def fetch_edition
|
|
27
|
+
self_edition&.dig("Version")
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# @return [Array<Relaton::Bib::Title>]
|
|
31
|
+
def fetch_titles
|
|
32
|
+
title = imp ? doc["imp_title_e"] : doc["rec_title"]
|
|
33
|
+
return [] if title.nil? || title.empty?
|
|
34
|
+
|
|
35
|
+
Relaton::Bib::Title.from_string title, "en", "Latn"
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# @return [Relaton::Bib::Status, nil]
|
|
39
|
+
def fetch_status
|
|
40
|
+
inforce = imp ? imp_status : doc["status"]
|
|
41
|
+
return if inforce.nil? || inforce.empty?
|
|
42
|
+
|
|
43
|
+
status = inforce == "In force" ? "Published" : "Withdrawal"
|
|
44
|
+
Relaton::Bib::Status.new(stage: Relaton::Bib::Status::Stage.new(content: status))
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# @return [Array<Relaton::Bib::Date>]
|
|
48
|
+
def fetch_dates
|
|
49
|
+
array(doc_date).map { |on| Relaton::Bib::Date.new(type: "published", at: on) }
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# @return [Array<Relaton::Bib::LocalizedMarkedUpString>]
|
|
53
|
+
def fetch_abstract
|
|
54
|
+
array(doc["summary"]).map do |content|
|
|
55
|
+
Relaton::Bib::Abstract.new(content: content, language: "en", script: "Latn")
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# @return [Array<Relaton::Bib::Uri>]
|
|
60
|
+
def fetch_source
|
|
61
|
+
link = imp ? doc["imp_dms_link"] : doc["handle_id"]
|
|
62
|
+
links = [Relaton::Bib::Uri.new(type: "src", content: link)]
|
|
63
|
+
links << Relaton::Bib::Uri.new(type: "pdf", content: doc["handle_id_pdf_link"]) if doc["handle_id_pdf_link"]
|
|
64
|
+
imp_word_link { |wlink| links << Relaton::Bib::Uri.new(type: "word", content: wlink) }
|
|
65
|
+
links
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def doc_date
|
|
69
|
+
return @doc_date if defined? @doc_date
|
|
70
|
+
|
|
71
|
+
date = imp ? doc["imp_approval_date"] : doc["approval_date"]
|
|
72
|
+
@doc_date = Date.parse(date).to_s rescue date # rubocop:disable Style/RescueModifier
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# @return [Array<Relaton::Bib::Relation>]
|
|
76
|
+
def fetch_relations
|
|
77
|
+
relations = []
|
|
78
|
+
editions.each do |ed|
|
|
79
|
+
next if ed["idrec"] == idrec
|
|
80
|
+
|
|
81
|
+
relations << create_relation("hasEdition", ed["title"], ed["rec_name"])
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
supplements.each { |supp| relations << create_relation("complementOf", supp["title_text"], supp["rec_name"]) }
|
|
85
|
+
relations
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Fetch the study group name from the recommendation HTML page.
|
|
89
|
+
# @return [String, nil]
|
|
90
|
+
def fetch_workgroup
|
|
91
|
+
url = "https://www.itu.int/ITU-T/recommendations/rec.aspx?rec=#{idrec}&lang=en"
|
|
92
|
+
page = hit.hit_collection.agent.get(url)
|
|
93
|
+
wg = page.at('//span[contains(@id, "uc_rec_main_info1_rpt_main_ctl00_Label8")]/a')
|
|
94
|
+
wg&.text
|
|
95
|
+
rescue StandardError
|
|
96
|
+
nil
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
private
|
|
100
|
+
|
|
101
|
+
attr_reader :hit, :idrec, :imp
|
|
102
|
+
|
|
103
|
+
def get_data(url)
|
|
104
|
+
JSON.parse request_document(url).body
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def request_document(url)
|
|
108
|
+
hit.hit_collection.agent.get url
|
|
109
|
+
rescue Mechanize::ResponseCodeError, SocketError, Timeout::Error, Errno::ECONNRESET,
|
|
110
|
+
EOFError, Net::ProtocolError, OpenSSL::SSL::SSLError => e
|
|
111
|
+
raise Relaton::RequestError, "Could not access #{url}: #{e.message}"
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def editions
|
|
115
|
+
@editions ||= begin
|
|
116
|
+
url = RECEDITIONS % { idrec: idrec }
|
|
117
|
+
get_data(url) || []
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def self_edition
|
|
122
|
+
@self_edition ||= editions.find { |ed| ed["idrec"] == idrec }
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def imp_status
|
|
126
|
+
self_edition&.dig("status")
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def imp_word_link
|
|
130
|
+
return unless doc["imp_dms_link"]
|
|
131
|
+
|
|
132
|
+
@doc_page ||= request_document(doc["imp_dms_link"])
|
|
133
|
+
wrd_elm = @doc_page.at("//font[contains(.,'Word')]/../..")
|
|
134
|
+
yield wrd_elm[:href] if block_given? && wrd_elm
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def create_relation(type, title_text, id)
|
|
138
|
+
titles = []
|
|
139
|
+
if title_text && !title_text.empty?
|
|
140
|
+
titles << Relaton::Bib::Title.new(content: title_text, language: "en", script: "Latn")
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
fref = titles.empty? ? id : nil
|
|
144
|
+
did = Relaton::Bib::Docidentifier.new(type: "ITU", content: id, primary: true)
|
|
145
|
+
bibitem = Relaton::Bib::ItemData.new(title: titles, formattedref: (fref ? Relaton::Bib::Formattedref.new(content: fref) : nil), docidentifier: [did])
|
|
146
|
+
Relaton::Bib::Relation.new(type: type, bibitem: bibitem)
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
def supplements
|
|
150
|
+
@supplements ||= begin
|
|
151
|
+
if imp
|
|
152
|
+
[]
|
|
153
|
+
else
|
|
154
|
+
url = RECSUPPLEMENTS % { idrec: idrec }
|
|
155
|
+
get_data(url) || []
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
end
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "cgi"
|
|
4
|
+
require_relative "recommendation_parser"
|
|
5
|
+
require_relative "radio_regulations_parser"
|
|
6
|
+
|
|
7
|
+
module Relaton
|
|
8
|
+
module Itu
|
|
9
|
+
# Scraper.
|
|
10
|
+
class Scraper
|
|
11
|
+
attr_reader :hit, :imp
|
|
12
|
+
|
|
13
|
+
TYPES = {
|
|
14
|
+
"ISO" => "international-standard",
|
|
15
|
+
"TS" => "technicalSpecification",
|
|
16
|
+
"TR" => "technicalReport",
|
|
17
|
+
"PAS" => "publiclyAvailableSpecification",
|
|
18
|
+
"AWI" => "appruvedWorkItem",
|
|
19
|
+
"CD" => "committeeDraft",
|
|
20
|
+
"FDIS" => "finalDraftInternationalStandard",
|
|
21
|
+
"NP" => "newProposal",
|
|
22
|
+
"DIS" => "draftInternationalStandard",
|
|
23
|
+
"WD" => "workingDraft",
|
|
24
|
+
"R" => "recommendation",
|
|
25
|
+
"Guide" => "guide",
|
|
26
|
+
}.freeze
|
|
27
|
+
|
|
28
|
+
def initialize(hit, imp: false)
|
|
29
|
+
@hit = hit
|
|
30
|
+
@imp = imp
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def self.parse_page(hit, imp: false)
|
|
34
|
+
new(hit, imp: imp).parse_page
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Parse page.
|
|
38
|
+
# @return [Relaton::Itu::ItemData, nil]
|
|
39
|
+
def parse_page # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
|
40
|
+
return unless parser.doc
|
|
41
|
+
|
|
42
|
+
Relaton::Itu::ItemData.new(
|
|
43
|
+
fetched: Date.today.to_s,
|
|
44
|
+
type: "standard",
|
|
45
|
+
docidentifier: docid,
|
|
46
|
+
edition: edition,
|
|
47
|
+
language: ["en"],
|
|
48
|
+
script: ["Latn"],
|
|
49
|
+
title: parser.fetch_titles,
|
|
50
|
+
status: parser.fetch_status,
|
|
51
|
+
date: parser.fetch_dates,
|
|
52
|
+
abstract: parser.fetch_abstract,
|
|
53
|
+
source: parser.fetch_source,
|
|
54
|
+
relation: parser.fetch_relations,
|
|
55
|
+
contributor: fetch_contributors,
|
|
56
|
+
copyright: fetch_copyright,
|
|
57
|
+
place: [Relaton::Bib::Place.new(city: "Geneva")],
|
|
58
|
+
ext: Relaton::Itu::Ext.new(
|
|
59
|
+
doctype: Relaton::Itu::Doctype.new(content: hit.hit[:type]),
|
|
60
|
+
flavor: "itu",
|
|
61
|
+
),
|
|
62
|
+
)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
private
|
|
66
|
+
|
|
67
|
+
def edition
|
|
68
|
+
ed = parser.fetch_edition
|
|
69
|
+
Relaton::Bib::Edition.new(content: ed) if ed
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def idrec
|
|
73
|
+
return @idrec if defined? @idrec
|
|
74
|
+
|
|
75
|
+
@idrec = CGI.unescape(hit.hit[:url]).split("/").last.slice(/^\d+(?=-)/)&.to_i
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def parser
|
|
79
|
+
@parser ||= begin
|
|
80
|
+
if idrec
|
|
81
|
+
RecommendationParser.new hit, idrec, imp
|
|
82
|
+
else
|
|
83
|
+
RadioRegulationsParser.new hit
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Fetch docid.
|
|
89
|
+
# @return [Array<Relaton::Bib::Docidentifier>]
|
|
90
|
+
def docid
|
|
91
|
+
@docid ||= begin
|
|
92
|
+
docids = hit.hit[:code].to_s.split(" | ").map { |c| createdocid(c) }
|
|
93
|
+
docids << createdocid(doc["rec_name"]) if docids.empty?
|
|
94
|
+
docids
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# @param text [String]
|
|
99
|
+
# @return [Relaton::Bib::Docidentifier]
|
|
100
|
+
def createdocid(text) # rubocop:disable Metrics/MethodLength
|
|
101
|
+
if text.match?(/^(?:ISO|ETSI)/)
|
|
102
|
+
type = "ISO"
|
|
103
|
+
text.match(/[^(]+/).to_s.strip.squeeze(" ")
|
|
104
|
+
else
|
|
105
|
+
pubid = Pubid.parse(text)
|
|
106
|
+
type = pubid.prefix
|
|
107
|
+
pubid.to_s
|
|
108
|
+
end => id
|
|
109
|
+
Docidentifier.new(type: type, content: id, primary: true)
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# @return [Array<Relaton::Bib::Contributor>]
|
|
113
|
+
def fetch_contributors
|
|
114
|
+
contribs = fetch_publisher_contributors
|
|
115
|
+
eg = fetch_editorial_contributor
|
|
116
|
+
contribs << eg if eg
|
|
117
|
+
contribs
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# @return [Array<Relaton::Bib::Contributor>]
|
|
121
|
+
def fetch_publisher_contributors
|
|
122
|
+
return [] unless hit.hit[:code]
|
|
123
|
+
|
|
124
|
+
abbrev = hit.hit[:code].sub(/-\w\s.*/, "")
|
|
125
|
+
case abbrev
|
|
126
|
+
when "ITU"
|
|
127
|
+
name = "International Telecommunication Union"
|
|
128
|
+
url = "www.itu.int"
|
|
129
|
+
end
|
|
130
|
+
org = Relaton::Bib::Organization.new(
|
|
131
|
+
name: [Relaton::Bib::TypedLocalizedString.new(content: name)],
|
|
132
|
+
abbreviation: Relaton::Bib::LocalizedString.new(content: abbrev),
|
|
133
|
+
uri: [Relaton::Bib::Uri.new(content: url)],
|
|
134
|
+
)
|
|
135
|
+
role = Relaton::Bib::Contributor::Role.new(type: "publisher")
|
|
136
|
+
[Relaton::Bib::Contributor.new(organization: org, role: [role])]
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# @return [Relaton::Bib::Contributor, nil]
|
|
140
|
+
def fetch_editorial_contributor
|
|
141
|
+
wg_name = parser.fetch_workgroup
|
|
142
|
+
bureau = hit.hit[:code]&.match(/(?<=-)\w/)&.to_s
|
|
143
|
+
return unless bureau
|
|
144
|
+
|
|
145
|
+
org = Relaton::Bib::Organization.new(
|
|
146
|
+
name: [Relaton::Bib::TypedLocalizedString.new(content: "International Telecommunication Union")],
|
|
147
|
+
abbreviation: Relaton::Bib::LocalizedString.new(content: "ITU-#{bureau.upcase}"),
|
|
148
|
+
subdivision: group_subdivision(wg_name),
|
|
149
|
+
)
|
|
150
|
+
role = Relaton::Bib::Contributor::Role.new(
|
|
151
|
+
type: "author",
|
|
152
|
+
description: [Relaton::Bib::LocalizedMarkedUpString.new(content: "committee")],
|
|
153
|
+
)
|
|
154
|
+
Relaton::Bib::Contributor.new(organization: org, role: [role])
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# @param wg_name [String, nil]
|
|
158
|
+
# @return [Array<Relaton::Bib::Subdivision>]
|
|
159
|
+
def group_subdivision(wg_name)
|
|
160
|
+
return [] unless wg_name
|
|
161
|
+
|
|
162
|
+
subtype = case wg_name
|
|
163
|
+
when /Advisory Group/ then "tsag"
|
|
164
|
+
when /Study Group/ then "study-group"
|
|
165
|
+
else "work-group"
|
|
166
|
+
end
|
|
167
|
+
[Relaton::Bib::Subdivision.new(
|
|
168
|
+
type: "technical-committee",
|
|
169
|
+
subtype: subtype,
|
|
170
|
+
name: [Relaton::Bib::TypedLocalizedString.new(content: wg_name)],
|
|
171
|
+
)]
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# @return [Array<Relaton::Bib::Copyright>]
|
|
175
|
+
def fetch_copyright
|
|
176
|
+
abbreviation = hit.hit[:code].match(/^[^-]+/).to_s
|
|
177
|
+
case abbreviation
|
|
178
|
+
when "ITU"
|
|
179
|
+
name = "International Telecommunication Union"
|
|
180
|
+
url = "www.itu.int"
|
|
181
|
+
end
|
|
182
|
+
org = Relaton::Bib::Organization.new(
|
|
183
|
+
name: [Relaton::Bib::TypedLocalizedString.new(content: name)],
|
|
184
|
+
abbreviation: Relaton::Bib::LocalizedString.new(content: abbreviation),
|
|
185
|
+
uri: [Relaton::Bib::Uri.new(content: url)],
|
|
186
|
+
)
|
|
187
|
+
owner = Relaton::Bib::ContributionInfo.new(organization: org)
|
|
188
|
+
year = parser.doc_date&.match(/\d{4}/)&.to_s
|
|
189
|
+
[Relaton::Bib::Copyright.new(from: year, owner: [owner])]
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
end
|