relaton 2.2.0.pre.alpha.1 → 3.0.0.pre.alpha.2
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} +165 -38
- data/bin/console +0 -1
- data/lib/relaton/3gpp/bibdata.rb +9 -0
- data/lib/relaton/3gpp/bibitem.rb +9 -0
- data/lib/relaton/3gpp/bibliography.rb +123 -0
- data/lib/relaton/3gpp/data_fetcher.rb +303 -0
- data/lib/relaton/3gpp/docidentifier.rb +114 -0
- data/lib/relaton/3gpp/doctype.rb +9 -0
- data/lib/relaton/3gpp/ext.rb +31 -0
- data/lib/relaton/3gpp/item.rb +18 -0
- data/lib/relaton/3gpp/item_data.rb +15 -0
- data/lib/relaton/3gpp/parser.rb +400 -0
- data/lib/relaton/3gpp/processor.rb +71 -0
- data/lib/relaton/3gpp/release.rb +34 -0
- data/lib/relaton/3gpp/util.rb +8 -0
- data/lib/relaton/3gpp.rb +29 -0
- data/lib/relaton/adobe/bibdata.rb +8 -0
- data/lib/relaton/adobe/bibitem.rb +8 -0
- data/lib/relaton/adobe/bibliography.rb +92 -0
- data/lib/relaton/adobe/docidentifier.rb +49 -0
- data/lib/relaton/adobe/doctype.rb +14 -0
- data/lib/relaton/adobe/ext.rb +32 -0
- data/lib/relaton/adobe/item.rb +15 -0
- data/lib/relaton/adobe/item_base.rb +18 -0
- data/lib/relaton/adobe/item_data.rb +6 -0
- data/lib/relaton/adobe/processor.rb +45 -0
- data/lib/relaton/adobe/util.rb +8 -0
- data/lib/relaton/adobe.rb +37 -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 +49 -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 +49 -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 +264 -0
- data/lib/relaton/bib/util.rb +18 -0
- data/lib/relaton/bib/versions.json +35 -0
- data/lib/relaton/bib.rb +46 -0
- data/lib/relaton/bipm/bibliography.rb +231 -0
- data/lib/relaton/bipm/converter/asciibib.rb +64 -0
- data/lib/relaton/bipm/data_fetcher.rb +81 -0
- data/lib/relaton/bipm/data_outcomes_parser.rb +656 -0
- data/lib/relaton/bipm/id_parser.rb +278 -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 +36 -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 +172 -0
- data/lib/relaton/bipm/rawdata_bipm_metrologia/niso_jats_parser.rb +353 -0
- data/lib/relaton/bipm/si_brochure_parser.rb +188 -0
- data/lib/relaton/bipm/util.rb +8 -0
- data/lib/relaton/bipm.rb +38 -0
- data/lib/relaton/bsi/bibliography.rb +196 -0
- data/lib/relaton/bsi/hit.rb +28 -0
- data/lib/relaton/bsi/hit_collection.rb +113 -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 +107 -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 +43 -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 +93 -0
- data/lib/relaton/calconnect/data_fetcher.rb +174 -0
- data/lib/relaton/calconnect/docidentifier.rb +80 -0
- data/lib/relaton/calconnect/hit.rb +14 -0
- data/lib/relaton/calconnect/hit_collection.rb +92 -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 +20 -0
- data/lib/relaton/calconnect/processor.rb +72 -0
- data/lib/relaton/calconnect/scraper.rb +87 -0
- data/lib/relaton/calconnect/util.rb +8 -0
- data/lib/relaton/calconnect.rb +36 -0
- data/lib/relaton/ccsds/bibliography.rb +63 -0
- data/lib/relaton/ccsds/data/fetcher.rb +252 -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 +47 -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/docidentifier.rb +121 -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 +15 -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 +149 -0
- data/lib/relaton/cen/committees.yaml +66 -0
- data/lib/relaton/cen/hit.rb +31 -0
- data/lib/relaton/cen/hit_collection.rb +116 -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 +100 -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 +45 -0
- data/lib/relaton/cen/scraper.rb +218 -0
- data/lib/relaton/cen/util.rb +8 -0
- data/lib/relaton/cen.rb +30 -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 +540 -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 +68 -0
- data/lib/relaton/cie/scrapper.rb +52 -0
- data/lib/relaton/cie/util.rb +8 -0
- data/lib/relaton/cie.rb +29 -0
- data/lib/relaton/core/array_wrapper.rb +20 -0
- data/lib/relaton/core/data_fetcher.rb +244 -0
- data/lib/relaton/core/date_parser.rb +42 -0
- data/lib/relaton/core/governor.rb +320 -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/pacer.rb +134 -0
- data/lib/relaton/core/processor.rb +67 -0
- data/lib/relaton/core/request_error.rb +14 -0
- data/lib/relaton/core/workers_pool.rb +45 -0
- data/lib/relaton/core.rb +12 -0
- data/lib/relaton/db/registry.rb +44 -4
- data/lib/relaton/db.rb +0 -1
- data/lib/relaton/doi/crossref.rb +89 -0
- data/lib/relaton/doi/parser.rb +921 -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/easc/bibdata.rb +8 -0
- data/lib/relaton/easc/bibitem.rb +8 -0
- data/lib/relaton/easc/bibliography.rb +95 -0
- data/lib/relaton/easc/docidentifier.rb +100 -0
- data/lib/relaton/easc/doctype.rb +14 -0
- data/lib/relaton/easc/ext.rb +44 -0
- data/lib/relaton/easc/item.rb +13 -0
- data/lib/relaton/easc/item_base.rb +18 -0
- data/lib/relaton/easc/item_data.rb +6 -0
- data/lib/relaton/easc/processor.rb +46 -0
- data/lib/relaton/easc/util.rb +8 -0
- data/lib/relaton/easc.rb +35 -0
- data/lib/relaton/ecma/bibdata.rb +8 -0
- data/lib/relaton/ecma/bibitem.rb +8 -0
- data/lib/relaton/ecma/bibliography.rb +149 -0
- data/lib/relaton/ecma/data_fetcher.rb +162 -0
- data/lib/relaton/ecma/data_parser.rb +49 -0
- data/lib/relaton/ecma/docidentifier.rb +124 -0
- data/lib/relaton/ecma/edition_parser.rb +80 -0
- data/lib/relaton/ecma/ext.rb +7 -0
- data/lib/relaton/ecma/item.rb +13 -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 +39 -0
- data/lib/relaton/ecma/parser_common.rb +33 -0
- data/lib/relaton/ecma/processor.rb +69 -0
- data/lib/relaton/ecma/standard_parser.rb +134 -0
- data/lib/relaton/ecma/util.rb +8 -0
- data/lib/relaton/ecma.rb +33 -0
- data/lib/relaton/etsi/bibdata.rb +10 -0
- data/lib/relaton/etsi/bibitem.rb +10 -0
- data/lib/relaton/etsi/bibliography.rb +111 -0
- data/lib/relaton/etsi/data_fetcher.rb +167 -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 +71 -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 +26 -0
- data/lib/relaton/gb/bibdata.rb +8 -0
- data/lib/relaton/gb/bibitem.rb +8 -0
- data/lib/relaton/gb/bibliography.rb +171 -0
- data/lib/relaton/gb/ccs.rb +14 -0
- data/lib/relaton/gb/committee.rb +13 -0
- data/lib/relaton/gb/docidentifier.rb +72 -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 +49 -0
- data/lib/relaton/gb/project_number.rb +38 -0
- data/lib/relaton/gb/scraper.rb +221 -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/gost/bibdata.rb +8 -0
- data/lib/relaton/gost/bibitem.rb +8 -0
- data/lib/relaton/gost/bibliography.rb +107 -0
- data/lib/relaton/gost/docidentifier.rb +80 -0
- data/lib/relaton/gost/doctype.rb +16 -0
- data/lib/relaton/gost/ext.rb +46 -0
- data/lib/relaton/gost/item.rb +15 -0
- data/lib/relaton/gost/item_base.rb +18 -0
- data/lib/relaton/gost/item_data.rb +6 -0
- data/lib/relaton/gost/processor.rb +49 -0
- data/lib/relaton/gost/util.rb +8 -0
- data/lib/relaton/gost.rb +36 -0
- data/lib/relaton/iala/bibdata.rb +8 -0
- data/lib/relaton/iala/bibitem.rb +8 -0
- data/lib/relaton/iala/bibliography.rb +146 -0
- data/lib/relaton/iala/docidentifier.rb +89 -0
- data/lib/relaton/iala/doctype.rb +18 -0
- data/lib/relaton/iala/ext.rb +32 -0
- data/lib/relaton/iala/item.rb +21 -0
- data/lib/relaton/iala/item_base.rb +18 -0
- data/lib/relaton/iala/item_data.rb +6 -0
- data/lib/relaton/iala/processor.rb +43 -0
- data/lib/relaton/iala/relation.rb +7 -0
- data/lib/relaton/iala/util.rb +8 -0
- data/lib/relaton/iala.rb +35 -0
- data/lib/relaton/iana/bibdata.rb +8 -0
- data/lib/relaton/iana/bibitem.rb +8 -0
- data/lib/relaton/iana/bibliography.rb +100 -0
- data/lib/relaton/iana/data_fetcher.rb +101 -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 +70 -0
- data/lib/relaton/iana/util.rb +8 -0
- data/lib/relaton/iana.rb +40 -0
- data/lib/relaton/iec/bibliography.rb +283 -0
- data/lib/relaton/iec/data_fetcher.rb +222 -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 +135 -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 +74 -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 +73 -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 +771 -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 +330 -0
- data/lib/relaton/ieee/item.rb +11 -0
- data/lib/relaton/ieee/item_data.rb +7 -0
- data/lib/relaton/ieee/processor.rb +71 -0
- data/lib/relaton/ieee/rawbib_id_parser.rb +753 -0
- data/lib/relaton/ieee/util.rb +8 -0
- data/lib/relaton/ieee.rb +30 -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 +561 -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 +72 -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 +446 -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 +101 -0
- data/lib/relaton/ietf/util.rb +8 -0
- data/lib/relaton/ietf/wg_name_resolver.rb +42 -0
- data/lib/relaton/ietf.rb +30 -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 +66 -0
- data/lib/relaton/index/pool.rb +46 -0
- data/lib/relaton/index/shard_source.rb +201 -0
- data/lib/relaton/index/type.rb +210 -0
- data/lib/relaton/index/util.rb +18 -0
- data/lib/relaton/index.rb +61 -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 +412 -0
- data/lib/relaton/iso/data_fetcher.rb +338 -0
- data/lib/relaton/iso/data_parser.rb +458 -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 +196 -0
- data/lib/relaton/iso/item_data.rb +50 -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 +146 -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 +85 -0
- data/lib/relaton/iso/scraper.rb +635 -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 +95 -0
- data/lib/relaton/itu/data_crawler_r.rb +664 -0
- data/lib/relaton/itu/data_fetcher.rb +550 -0
- data/lib/relaton/itu/data_merge_r.rb +149 -0
- data/lib/relaton/itu/data_parser_r.rb +214 -0
- data/lib/relaton/itu/data_parser_t.rb +228 -0
- data/lib/relaton/itu/family_cache.rb +177 -0
- data/lib/relaton/itu/governor.rb +56 -0
- data/lib/relaton/itu/hit.rb +28 -0
- data/lib/relaton/itu/hit_collection.rb +299 -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 +75 -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 +38 -0
- data/lib/relaton/itu/processor.rb +72 -0
- data/lib/relaton/itu/pubid.rb +199 -0
- data/lib/relaton/itu/radio_regulations_parser.rb +70 -0
- data/lib/relaton/itu/recommendation_fields.rb +334 -0
- data/lib/relaton/itu/recommendation_parser.rb +30 -0
- data/lib/relaton/itu/scraper.rb +203 -0
- data/lib/relaton/itu/util.rb +8 -0
- data/lib/relaton/itu.rb +34 -0
- data/lib/relaton/jcgm/bibdata.rb +8 -0
- data/lib/relaton/jcgm/bibitem.rb +8 -0
- data/lib/relaton/jcgm/bibliography.rb +97 -0
- data/lib/relaton/jcgm/data_fetcher.rb +81 -0
- data/lib/relaton/jcgm/docidentifier.rb +102 -0
- data/lib/relaton/jcgm/doctype.rb +12 -0
- data/lib/relaton/jcgm/ext.rb +23 -0
- data/lib/relaton/jcgm/item.rb +20 -0
- data/lib/relaton/jcgm/item_base.rb +18 -0
- data/lib/relaton/jcgm/item_data.rb +6 -0
- data/lib/relaton/jcgm/meetings_parser.rb +175 -0
- data/lib/relaton/jcgm/processor.rb +71 -0
- data/lib/relaton/jcgm/relation.rb +9 -0
- data/lib/relaton/jcgm/structured_identifier.rb +40 -0
- data/lib/relaton/jcgm/util.rb +8 -0
- data/lib/relaton/jcgm.rb +24 -0
- data/lib/relaton/jis/bibdata.rb +8 -0
- data/lib/relaton/jis/bibitem.rb +8 -0
- data/lib/relaton/jis/bibliography.rb +73 -0
- data/lib/relaton/jis/data_fetcher.rb +183 -0
- data/lib/relaton/jis/docidentifier.rb +120 -0
- data/lib/relaton/jis/doctype.rb +9 -0
- data/lib/relaton/jis/ext.rb +13 -0
- data/lib/relaton/jis/hit.rb +88 -0
- data/lib/relaton/jis/hit_collection.rb +128 -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 +32 -0
- data/lib/relaton/logger/channels/gh_issue.rb +143 -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 +134 -0
- data/lib/relaton/nist/date.rb +7 -0
- data/lib/relaton/nist/docidentifier.rb +165 -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 +19 -0
- data/lib/relaton/nist/item_base.rb +16 -0
- data/lib/relaton/nist/item_data.rb +6 -0
- data/lib/relaton/nist/mods_parser.rb +302 -0
- data/lib/relaton/nist/processor.rb +69 -0
- data/lib/relaton/nist/pubs_export.rb +69 -0
- data/lib/relaton/nist/relation.rb +10 -0
- data/lib/relaton/nist/scraper.rb +293 -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 +201 -0
- data/lib/relaton/oasis/browser_agent.rb +71 -0
- data/lib/relaton/oasis/data_fetcher.rb +130 -0
- data/lib/relaton/oasis/data_parser.rb +305 -0
- data/lib/relaton/oasis/data_parser_utils.rb +330 -0
- data/lib/relaton/oasis/data_part_parser.rb +239 -0
- data/lib/relaton/oasis/docidentifier.rb +54 -0
- data/lib/relaton/oasis/doctype.rb +7 -0
- data/lib/relaton/oasis/ext.rb +19 -0
- data/lib/relaton/oasis/item.rb +14 -0
- data/lib/relaton/oasis/item_data.rb +6 -0
- data/lib/relaton/oasis/processor.rb +74 -0
- data/lib/relaton/oasis/util.rb +8 -0
- data/lib/relaton/oasis.rb +41 -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 +131 -0
- data/lib/relaton/ogc/docidentifier.rb +111 -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 +111 -0
- data/lib/relaton/ogc/item.rb +13 -0
- data/lib/relaton/ogc/item_data.rb +6 -0
- data/lib/relaton/ogc/processor.rb +59 -0
- data/lib/relaton/ogc/scraper.rb +225 -0
- data/lib/relaton/ogc/util.rb +8 -0
- data/lib/relaton/ogc.rb +30 -0
- data/lib/relaton/oiml/bibdata.rb +8 -0
- data/lib/relaton/oiml/bibitem.rb +8 -0
- data/lib/relaton/oiml/bibliography.rb +169 -0
- data/lib/relaton/oiml/docidentifier.rb +48 -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/docidentifier.rb +67 -0
- data/lib/relaton/omg/ext.rb +7 -0
- data/lib/relaton/omg/item.rb +9 -0
- data/lib/relaton/omg/item_data.rb +6 -0
- data/lib/relaton/omg/processor.rb +35 -0
- data/lib/relaton/omg/scraper.rb +186 -0
- data/lib/relaton/omg/util.rb +8 -0
- data/lib/relaton/omg.rb +25 -0
- data/lib/relaton/plateau/bibdata.rb +8 -0
- data/lib/relaton/plateau/bibitem.rb +8 -0
- data/lib/relaton/plateau/bibliography.rb +31 -0
- data/lib/relaton/plateau/data_fetcher.rb +176 -0
- data/lib/relaton/plateau/doctype.rb +7 -0
- data/lib/relaton/plateau/ext.rb +23 -0
- data/lib/relaton/plateau/handbook_parser.rb +102 -0
- data/lib/relaton/plateau/hit.rb +21 -0
- data/lib/relaton/plateau/hit_collection.rb +79 -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 +51 -0
- data/lib/relaton/plateau/technical_report_parser.rb +98 -0
- data/lib/relaton/plateau/util.rb +8 -0
- data/lib/relaton/plateau.rb +29 -0
- data/lib/relaton/sdo/config.rb +34 -0
- data/lib/relaton/sdo/fetcher.rb +52 -0
- data/lib/relaton/sdo/logo.rb +95 -0
- data/lib/relaton/sdo/name.rb +26 -0
- data/lib/relaton/sdo/organization.rb +71 -0
- data/lib/relaton/sdo/store.rb +49 -0
- data/lib/relaton/sdo.rb +29 -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 +174 -0
- data/lib/relaton/w3c/data_fetcher.rb +487 -0
- data/lib/relaton/w3c/data_parser.rb +379 -0
- data/lib/relaton/w3c/docidentifier.rb +48 -0
- data/lib/relaton/w3c/doctype.rb +7 -0
- data/lib/relaton/w3c/ext.rb +11 -0
- data/lib/relaton/w3c/governor.rb +32 -0
- data/lib/relaton/w3c/item.rb +15 -0
- data/lib/relaton/w3c/item_data.rb +6 -0
- data/lib/relaton/w3c/processor.rb +49 -0
- data/lib/relaton/w3c/pubid.rb +85 -0
- data/lib/relaton/w3c/safe_realize.rb +148 -0
- data/lib/relaton/w3c/util.rb +8 -0
- data/lib/relaton/w3c.rb +36 -0
- data/lib/relaton/xsf/bibdata.rb +8 -0
- data/lib/relaton/xsf/bibitem.rb +8 -0
- data/lib/relaton/xsf/bibliography.rb +84 -0
- data/lib/relaton/xsf/data_fetcher.rb +106 -0
- data/lib/relaton/xsf/docidentifier.rb +46 -0
- data/lib/relaton/xsf/hit.rb +17 -0
- data/lib/relaton/xsf/hit_collection.rb +52 -0
- data/lib/relaton/xsf/item.rb +13 -0
- data/lib/relaton/xsf/item_data.rb +6 -0
- data/lib/relaton/xsf/processor.rb +51 -0
- data/lib/relaton/xsf/util.rb +9 -0
- data/lib/relaton/xsf.rb +34 -0
- data/lib/relaton-core.rb +1 -0
- data/lib/relaton.rb +85 -0
- metadata +775 -161
- 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,334 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "json"
|
|
4
|
+
require_relative "family_cache"
|
|
5
|
+
|
|
6
|
+
module Relaton
|
|
7
|
+
module Itu
|
|
8
|
+
# Shared extraction of ITU-T Recommendation metadata from the
|
|
9
|
+
# `mws/api/recommendations/*` detail endpoints. Reused by BOTH the live
|
|
10
|
+
# lookup path (`RecommendationParser`, via `Scraper`) and the offline
|
|
11
|
+
# harvester (`DataParserT`), so producer output and runtime output stay
|
|
12
|
+
# identical field-for-field.
|
|
13
|
+
#
|
|
14
|
+
# The includer must provide four hooks:
|
|
15
|
+
# #agent — a Mechanize agent (browser UA; www.itu.int is behind an F5 WAF)
|
|
16
|
+
# #idrec — the recommendation record id
|
|
17
|
+
# #imp — whether this is an Implementers' Guide (live-only; harvester false)
|
|
18
|
+
# #cache — a cross-row cache, defaulting to NullCache (see below)
|
|
19
|
+
#
|
|
20
|
+
# `#doc` (the getRecHdrDetail JSON) is memoised here from those hooks.
|
|
21
|
+
#
|
|
22
|
+
# **The cache and the runtime boundary.** `searchRecs` returns one row per
|
|
23
|
+
# *edition*, but two of the four endpoints below answer for the whole
|
|
24
|
+
# recommendation, so the offline harvester asks the same question once per
|
|
25
|
+
# edition — 21 times over for H.264. `#cache` lets it ask once instead. The
|
|
26
|
+
# live lookup path handles one recommendation per `Bibliography.get` and must
|
|
27
|
+
# not share state between calls, so the default is {NullCache}, whose
|
|
28
|
+
# `#fetch` is a bare yield: same behaviour, same requests, nothing retained.
|
|
29
|
+
# `Scraper` is deliberately left calling the three-argument constructor, so
|
|
30
|
+
# no path from `Bibliography.get` can reach a real cache.
|
|
31
|
+
module RecommendationFields
|
|
32
|
+
include Relaton::Core::ArrayWrapper
|
|
33
|
+
|
|
34
|
+
RECHDR = "https://www.itu.int/mws/api/recommendations/getRecHdrDetail?idrec=%{idrec}&lang=en"
|
|
35
|
+
RECEDITIONS = "https://www.itu.int/mws/api/recommendations/getRecEditions?idrec=%{idrec}&lang=en"
|
|
36
|
+
RECSUPPLEMENTS = "https://www.itu.int/mws/api/recommendations/getRecSupplements?idrec=%{idrec}&lang=en"
|
|
37
|
+
IMPLGUIDES = "https://www.itu.int/mws/api/recommendations/getImplGuides?idrec=%{idrec}&lang=en"
|
|
38
|
+
|
|
39
|
+
# The recommendation header detail (getRecHdrDetail / getImplGuides).
|
|
40
|
+
# @return [Hash]
|
|
41
|
+
def doc
|
|
42
|
+
@doc ||= begin
|
|
43
|
+
url = (imp ? IMPLGUIDES : RECHDR) % { idrec: idrec }
|
|
44
|
+
resp = get_data url
|
|
45
|
+
imp ? resp.first : resp
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Cross-row cache for the family-invariant endpoints. Overridden by
|
|
50
|
+
# RecommendationParser when the harvester passes one in.
|
|
51
|
+
# @return [#fetch, #warm]
|
|
52
|
+
def cache
|
|
53
|
+
NullCache.instance
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Canonical id for the recommendation this edition belongs to: the
|
|
57
|
+
# smallest idrec ITU's own getRecEditions response lists.
|
|
58
|
+
#
|
|
59
|
+
# Derived from API output, never from parsing `rec_name`. That is the
|
|
60
|
+
# whole point — two recommendations whose names happen to normalize alike
|
|
61
|
+
# would silently share each other's metadata, and nothing downstream would
|
|
62
|
+
# notice (the data repo's `guard_enrichment` counts `contributor:` lines,
|
|
63
|
+
# which such a record still has).
|
|
64
|
+
#
|
|
65
|
+
# Free on the live path: `Scraper#parse_page` already calls
|
|
66
|
+
# `#fetch_relations`, which already calls `#editions`.
|
|
67
|
+
#
|
|
68
|
+
# @return [Integer, String]
|
|
69
|
+
def family_id
|
|
70
|
+
@family_id ||= (editions.filter_map { |e| e["idrec"] }.min || idrec)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# @return [String, nil]
|
|
74
|
+
def fetch_edition
|
|
75
|
+
self_edition&.dig("Version")
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# @return [Array<Relaton::Bib::Title>]
|
|
79
|
+
def fetch_titles
|
|
80
|
+
title = imp ? doc["imp_title_e"] : doc["rec_title"]
|
|
81
|
+
return [] if title.nil? || title.empty?
|
|
82
|
+
|
|
83
|
+
Relaton::Bib::Title.from_string title, "en", "Latn"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# @return [Relaton::Bib::Status, nil]
|
|
87
|
+
def fetch_status
|
|
88
|
+
inforce = imp ? imp_status : doc["status"]
|
|
89
|
+
return if inforce.nil? || inforce.empty?
|
|
90
|
+
|
|
91
|
+
status = inforce == "In force" ? "Published" : "Withdrawal"
|
|
92
|
+
Relaton::Bib::Status.new(stage: Relaton::Bib::Status::Stage.new(content: status))
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# @return [Array<Relaton::Bib::Date>]
|
|
96
|
+
def fetch_dates
|
|
97
|
+
array(doc_date).map { |on| Relaton::Bib::Date.new(type: "published", at: on) }
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# @return [Array<Relaton::Bib::Abstract>]
|
|
101
|
+
def fetch_abstract
|
|
102
|
+
array(doc["summary"]).map do |content|
|
|
103
|
+
Relaton::Bib::Abstract.new(content: content, language: "en", script: "Latn")
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# @return [Array<Relaton::Bib::Uri>]
|
|
108
|
+
def fetch_source
|
|
109
|
+
link = imp ? doc["imp_dms_link"] : doc["handle_id"]
|
|
110
|
+
links = [Relaton::Bib::Uri.new(type: "src", content: link)]
|
|
111
|
+
links << Relaton::Bib::Uri.new(type: "pdf", content: doc["handle_id_pdf_link"]) if doc["handle_id_pdf_link"]
|
|
112
|
+
imp_word_link { |wlink| links << Relaton::Bib::Uri.new(type: "word", content: wlink) }
|
|
113
|
+
links
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def doc_date
|
|
117
|
+
return @doc_date if defined? @doc_date
|
|
118
|
+
|
|
119
|
+
date = imp ? doc["imp_approval_date"] : doc["approval_date"]
|
|
120
|
+
@doc_date = Date.parse(date).to_s rescue date # rubocop:disable Style/RescueModifier
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# @return [Array<Relaton::Bib::Relation>]
|
|
124
|
+
def fetch_relations
|
|
125
|
+
relations = []
|
|
126
|
+
editions.each do |ed|
|
|
127
|
+
next if ed["idrec"] == idrec
|
|
128
|
+
|
|
129
|
+
relations << create_relation("hasEdition", ed["title"], ed["rec_name"])
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
supplements.each { |supp| relations << create_relation("complementOf", supp["title_text"], supp["rec_name"]) }
|
|
133
|
+
relations
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# The equivalent ISO/IEC(/IEEE) identifier, from the recommendation
|
|
137
|
+
# header's `iso_number` (e.g. "ISO/IEC 17788:2014 (Common)", or a deliverable
|
|
138
|
+
# form like "ISO/IEC TR 29110"). Used as an additional docidentifier. Only
|
|
139
|
+
# recommendations carry it. The optional TR/TS/PAS/IWA/Guide token keeps
|
|
140
|
+
# deliverable forms that a bare `\d` anchor would drop.
|
|
141
|
+
# @return [Relaton::Itu::Docidentifier, nil]
|
|
142
|
+
def iso_docid
|
|
143
|
+
num = doc["iso_number"]
|
|
144
|
+
id = num && num[%r{ISO(?:/IEC)?(?:/IEEE)?(?:\s+(?:TR|TS|PAS|IWA|Guide))?\s+\d[\d-]*}]
|
|
145
|
+
Docidentifier.new(type: "ISO", content: id, primary: true) if id
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# The editorial-group (study group / TSAG) contributor, from the
|
|
149
|
+
# recommendation HTML page's workgroup name.
|
|
150
|
+
# @param bureau [String, nil] the sector letter, e.g. "T" (from ITU-T)
|
|
151
|
+
# @return [Relaton::Bib::Contributor, nil]
|
|
152
|
+
def editorial_group(bureau)
|
|
153
|
+
return unless bureau
|
|
154
|
+
|
|
155
|
+
org = Relaton::Bib::Organization.new(
|
|
156
|
+
name: [Relaton::Bib::TypedLocalizedString.new(content: "International Telecommunication Union")],
|
|
157
|
+
abbreviation: Relaton::Bib::LocalizedString.new(content: "ITU-#{bureau.upcase}"),
|
|
158
|
+
subdivision: group_subdivision(fetch_workgroup),
|
|
159
|
+
)
|
|
160
|
+
role = Relaton::Bib::Contributor::Role.new(
|
|
161
|
+
type: "author",
|
|
162
|
+
description: [Relaton::Bib::LocalizedMarkedUpString.new(content: "committee")],
|
|
163
|
+
)
|
|
164
|
+
Relaton::Bib::Contributor.new(organization: org, role: [role])
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# The publisher contributor (ITU) for the given abbreviation.
|
|
168
|
+
# @param abbrev [String, nil] e.g. "ITU"
|
|
169
|
+
# @return [Relaton::Bib::Contributor, nil]
|
|
170
|
+
def publisher(abbrev)
|
|
171
|
+
return unless abbrev == "ITU"
|
|
172
|
+
|
|
173
|
+
org = Relaton::Bib::Organization.new(
|
|
174
|
+
name: [Relaton::Bib::TypedLocalizedString.new(content: "International Telecommunication Union")],
|
|
175
|
+
abbreviation: Relaton::Bib::LocalizedString.new(content: abbrev),
|
|
176
|
+
uri: [Relaton::Bib::Uri.new(content: "www.itu.int")],
|
|
177
|
+
)
|
|
178
|
+
role = Relaton::Bib::Contributor::Role.new(type: "publisher")
|
|
179
|
+
Relaton::Bib::Contributor.new(organization: org, role: [role])
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# @param wg_name [String, nil]
|
|
183
|
+
# @return [Array<Relaton::Bib::Subdivision>]
|
|
184
|
+
def group_subdivision(wg_name)
|
|
185
|
+
return [] unless wg_name
|
|
186
|
+
|
|
187
|
+
subtype = case wg_name
|
|
188
|
+
when /Advisory Group/ then "tsag"
|
|
189
|
+
when /Study Group/ then "study-group"
|
|
190
|
+
else "work-group"
|
|
191
|
+
end
|
|
192
|
+
[Relaton::Bib::Subdivision.new(
|
|
193
|
+
type: "technical-committee",
|
|
194
|
+
subtype: subtype,
|
|
195
|
+
name: [Relaton::Bib::TypedLocalizedString.new(content: wg_name)],
|
|
196
|
+
)]
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# Fetch the study group name from the recommendation HTML page.
|
|
200
|
+
#
|
|
201
|
+
# The single most expensive request per record: `rec.aspx` is ~90-240 KB
|
|
202
|
+
# of HTML that then has to be parsed into a DOM. It is also the one field
|
|
203
|
+
# here that is a property of the *recommendation* rather than the edition
|
|
204
|
+
# — ITU renders the current owning study group even on an old edition's
|
|
205
|
+
# page, which is why `?rec=H.264` and `?rec=14659` both yield "ITU-T Study
|
|
206
|
+
# Group 21" in `spec/itu/vcr_cassettes/itu_t_h_264.yml`. So it is cached
|
|
207
|
+
# per family.
|
|
208
|
+
#
|
|
209
|
+
# The rescue sits outside the cache on purpose: a transient failure must
|
|
210
|
+
# not be stored as nil for the whole family. FamilyCache does not mark an
|
|
211
|
+
# entry computed when the block raises, so the next sibling retries.
|
|
212
|
+
# @return [String, nil]
|
|
213
|
+
def fetch_workgroup
|
|
214
|
+
# Short-circuited rather than keyed-then-yielded, because #family_id
|
|
215
|
+
# reads #editions: with the null cache that would add a getRecEditions
|
|
216
|
+
# request to a runtime lookup that did not need one. The live path must
|
|
217
|
+
# keep exactly the request count it had.
|
|
218
|
+
return workgroup_from_page unless cache.caching?
|
|
219
|
+
|
|
220
|
+
cache.fetch([:workgroup, family_id]) { workgroup_from_page }
|
|
221
|
+
rescue StandardError
|
|
222
|
+
nil
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
private
|
|
226
|
+
|
|
227
|
+
def workgroup_from_page
|
|
228
|
+
url = "https://www.itu.int/ITU-T/recommendations/rec.aspx?rec=#{idrec}&lang=en"
|
|
229
|
+
page = agent.get(url)
|
|
230
|
+
wg = page.at('//span[contains(@id, "uc_rec_main_info1_rpt_main_ctl00_Label8")]/a')
|
|
231
|
+
wg&.text
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
def fetch_editions
|
|
235
|
+
get_data(RECEDITIONS % { idrec: idrec }) || []
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
# The other editions this response answers for.
|
|
239
|
+
#
|
|
240
|
+
# Empty unless the response actually lists the idrec we asked for: if it
|
|
241
|
+
# does not, the endpoint's contract has changed under us and sharing the
|
|
242
|
+
# payload would hand a whole family another recommendation's data. Losing
|
|
243
|
+
# the dedup is the cheap failure; sharing wrongly is the expensive one.
|
|
244
|
+
def siblings_of(rows)
|
|
245
|
+
unless rows.any? { |r| r["idrec"] == idrec }
|
|
246
|
+
Util.warn "ITU-T: getRecEditions(#{idrec}) does not list #{idrec}; not sharing it across the family"
|
|
247
|
+
return []
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
rows.filter_map { |r| [:editions, r["idrec"]] unless r["idrec"] == idrec }
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
def get_data(url)
|
|
254
|
+
JSON.parse request_document(url).body
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
def request_document(url)
|
|
258
|
+
agent.get url
|
|
259
|
+
rescue Mechanize::ResponseCodeError, SocketError, Timeout::Error, Errno::ECONNRESET,
|
|
260
|
+
EOFError, Net::ProtocolError, OpenSSL::SSL::SSLError => e
|
|
261
|
+
raise Relaton::RequestError, "Could not access #{url}: #{e.message}"
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
# Every edition of this recommendation, newest first.
|
|
265
|
+
#
|
|
266
|
+
# One request answers the whole family, and the response says so itself:
|
|
267
|
+
# it lists every sibling `idrec`, and the payload for each of them is the
|
|
268
|
+
# same one — verified byte-for-byte for 16818 and 14659 in
|
|
269
|
+
# `spec/itu/vcr_cassettes/itu_t_h_264.yml`. So the result is published
|
|
270
|
+
# under every sibling key, and the family's other 20 editions cost nothing.
|
|
271
|
+
def editions
|
|
272
|
+
@editions ||= begin
|
|
273
|
+
rows = cache.fetch([:editions, idrec]) { fetch_editions }
|
|
274
|
+
# Warmed after #fetch released the entry lock, so there is no
|
|
275
|
+
# lock-order inversion between the table lock and an entry lock.
|
|
276
|
+
cache.warm(siblings_of(rows), rows)
|
|
277
|
+
rows
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
def self_edition
|
|
282
|
+
@self_edition ||= editions.find { |ed| ed["idrec"] == idrec }
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
def imp_status
|
|
286
|
+
self_edition&.dig("status")
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
def imp_word_link
|
|
290
|
+
return unless doc["imp_dms_link"]
|
|
291
|
+
|
|
292
|
+
@doc_page ||= request_document(doc["imp_dms_link"])
|
|
293
|
+
wrd_elm = @doc_page.at("//font[contains(.,'Word')]/../..")
|
|
294
|
+
yield wrd_elm[:href] if block_given? && wrd_elm
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
def create_relation(type, title_text, id)
|
|
298
|
+
titles = []
|
|
299
|
+
if title_text && !title_text.empty?
|
|
300
|
+
titles << Relaton::Bib::Title.new(content: title_text, language: "en", script: "Latn")
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
fref = titles.empty? ? id : nil
|
|
304
|
+
did = Relaton::Bib::Docidentifier.new(type: "ITU", content: id, primary: true)
|
|
305
|
+
bibitem = Relaton::Bib::ItemData.new(title: titles, formattedref: (fref ? Relaton::Bib::Formattedref.new(content: fref) : nil), docidentifier: [did])
|
|
306
|
+
Relaton::Bib::Relation.new(type: type, bibitem: bibitem)
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
# Supplements to this recommendation.
|
|
310
|
+
#
|
|
311
|
+
# **Deliberately not shared across the family**, unlike #editions and
|
|
312
|
+
# #fetch_workgroup. It very probably is family-invariant — supplements
|
|
313
|
+
# belong to a recommendation, not to an edition — but that is an
|
|
314
|
+
# assumption, and the only recording in the suite is a single
|
|
315
|
+
# `getRecSupplements?idrec=14659`. Sharing it wrongly would give a
|
|
316
|
+
# record another recommendation's `relation:` list, silently: the data
|
|
317
|
+
# repo's `guard_enrichment` counts `contributor:` lines, which a wrongly
|
|
318
|
+
# enriched record still has. What would settle it: add a
|
|
319
|
+
# `getRecSupplements?idrec=16818` interaction to
|
|
320
|
+
# `spec/itu/vcr_cassettes/itu_t_h_264.yml` and assert the two payloads
|
|
321
|
+
# are equal; then key this on #family_id like the other two.
|
|
322
|
+
def supplements
|
|
323
|
+
@supplements ||= begin
|
|
324
|
+
if imp
|
|
325
|
+
[]
|
|
326
|
+
else
|
|
327
|
+
url = RECSUPPLEMENTS % { idrec: idrec }
|
|
328
|
+
get_data(url) || []
|
|
329
|
+
end
|
|
330
|
+
end
|
|
331
|
+
end
|
|
332
|
+
end
|
|
333
|
+
end
|
|
334
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require_relative "recommendation_fields"
|
|
2
|
+
|
|
3
|
+
module Relaton
|
|
4
|
+
module Itu
|
|
5
|
+
# Live-lookup ITU-T Recommendation parser. All field extraction lives in the
|
|
6
|
+
# shared RecommendationFields module (reused by the offline DataParserT
|
|
7
|
+
# harvester); this class only binds the module's `agent`/`idrec`/`imp` hooks.
|
|
8
|
+
class RecommendationParser
|
|
9
|
+
include RecommendationFields
|
|
10
|
+
|
|
11
|
+
# @param agent [Mechanize] the HTTP agent (was a Hit before decoupling)
|
|
12
|
+
# @param idrec [String, Integer] the recommendation record id
|
|
13
|
+
# @param imp [Boolean] Implementers' Guide flag
|
|
14
|
+
# @param cache [#fetch, #warm] cross-row cache for the family-invariant
|
|
15
|
+
# endpoints. Defaults to NullCache, i.e. off — only the offline
|
|
16
|
+
# harvester passes a real one, so the live lookup path keeps exactly the
|
|
17
|
+
# behaviour and the request count it had before the cache existed.
|
|
18
|
+
def initialize(agent, idrec, imp, cache: NullCache.instance)
|
|
19
|
+
@agent = agent
|
|
20
|
+
@idrec = idrec
|
|
21
|
+
@imp = imp
|
|
22
|
+
@cache = cache
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
attr_reader :agent, :idrec, :imp, :cache
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,203 @@
|
|
|
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.hit_collection.agent, idrec, imp
|
|
82
|
+
else
|
|
83
|
+
RadioRegulationsParser.new hit
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# The primary docid comes from the hit's code; a recommendation additionally
|
|
89
|
+
# carries the equivalent ISO/IEC(/IEEE) identifier, which used to be part of
|
|
90
|
+
# the search result's media name and now comes from the recommendation
|
|
91
|
+
# header's `iso_number` via the shared `RecommendationFields#iso_docid`.
|
|
92
|
+
# Both are guarded on `idrec` — `RadioRegulationsParser` (RR/OB) parses an
|
|
93
|
+
# HTML page and has neither `rec_name` nor `iso_docid`.
|
|
94
|
+
#
|
|
95
|
+
# @return [Array<Relaton::Bib::Docidentifier>]
|
|
96
|
+
def docid
|
|
97
|
+
@docid ||= begin
|
|
98
|
+
docids = hit.hit[:code].to_s.split(" | ").map { |c| createdocid(c) }
|
|
99
|
+
if idrec
|
|
100
|
+
docids << createdocid("ITU-T #{parser.doc['rec_name']}") if docids.empty?
|
|
101
|
+
iso = parser.iso_docid
|
|
102
|
+
docids << iso if iso
|
|
103
|
+
end
|
|
104
|
+
docids
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# @param text [String]
|
|
109
|
+
# @return [Relaton::Bib::Docidentifier]
|
|
110
|
+
def createdocid(text) # rubocop:disable Metrics/MethodLength
|
|
111
|
+
if text.match?(/^(?:ISO|ETSI)/)
|
|
112
|
+
type = "ISO"
|
|
113
|
+
text.match(/[^(]+/).to_s.strip.squeeze(" ")
|
|
114
|
+
else
|
|
115
|
+
pubid = Pubid.parse(text)
|
|
116
|
+
type = pubid.prefix
|
|
117
|
+
pubid.to_s
|
|
118
|
+
end => id
|
|
119
|
+
Docidentifier.new(type: type, content: id, primary: true)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# @return [Array<Relaton::Bib::Contributor>]
|
|
123
|
+
def fetch_contributors
|
|
124
|
+
contribs = fetch_publisher_contributors
|
|
125
|
+
eg = fetch_editorial_contributor
|
|
126
|
+
contribs << eg if eg
|
|
127
|
+
contribs
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# @return [Array<Relaton::Bib::Contributor>]
|
|
131
|
+
def fetch_publisher_contributors
|
|
132
|
+
return [] unless hit.hit[:code]
|
|
133
|
+
|
|
134
|
+
abbrev = hit.hit[:code].sub(/-\w\s.*/, "")
|
|
135
|
+
case abbrev
|
|
136
|
+
when "ITU"
|
|
137
|
+
name = "International Telecommunication Union"
|
|
138
|
+
url = "www.itu.int"
|
|
139
|
+
end
|
|
140
|
+
org = Relaton::Bib::Organization.new(
|
|
141
|
+
name: [Relaton::Bib::TypedLocalizedString.new(content: name)],
|
|
142
|
+
abbreviation: Relaton::Bib::LocalizedString.new(content: abbrev),
|
|
143
|
+
uri: [Relaton::Bib::Uri.new(content: url)],
|
|
144
|
+
)
|
|
145
|
+
role = Relaton::Bib::Contributor::Role.new(type: "publisher")
|
|
146
|
+
[Relaton::Bib::Contributor.new(organization: org, role: [role])]
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# @return [Relaton::Bib::Contributor, nil]
|
|
150
|
+
def fetch_editorial_contributor
|
|
151
|
+
wg_name = parser.fetch_workgroup
|
|
152
|
+
bureau = hit.hit[:code]&.match(/(?<=-)\w/)&.to_s
|
|
153
|
+
return unless bureau
|
|
154
|
+
|
|
155
|
+
org = Relaton::Bib::Organization.new(
|
|
156
|
+
name: [Relaton::Bib::TypedLocalizedString.new(content: "International Telecommunication Union")],
|
|
157
|
+
abbreviation: Relaton::Bib::LocalizedString.new(content: "ITU-#{bureau.upcase}"),
|
|
158
|
+
subdivision: group_subdivision(wg_name),
|
|
159
|
+
)
|
|
160
|
+
role = Relaton::Bib::Contributor::Role.new(
|
|
161
|
+
type: "author",
|
|
162
|
+
description: [Relaton::Bib::LocalizedMarkedUpString.new(content: "committee")],
|
|
163
|
+
)
|
|
164
|
+
Relaton::Bib::Contributor.new(organization: org, role: [role])
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# @param wg_name [String, nil]
|
|
168
|
+
# @return [Array<Relaton::Bib::Subdivision>]
|
|
169
|
+
def group_subdivision(wg_name)
|
|
170
|
+
return [] unless wg_name
|
|
171
|
+
|
|
172
|
+
subtype = case wg_name
|
|
173
|
+
when /Advisory Group/ then "tsag"
|
|
174
|
+
when /Study Group/ then "study-group"
|
|
175
|
+
else "work-group"
|
|
176
|
+
end
|
|
177
|
+
[Relaton::Bib::Subdivision.new(
|
|
178
|
+
type: "technical-committee",
|
|
179
|
+
subtype: subtype,
|
|
180
|
+
name: [Relaton::Bib::TypedLocalizedString.new(content: wg_name)],
|
|
181
|
+
)]
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# @return [Array<Relaton::Bib::Copyright>]
|
|
185
|
+
def fetch_copyright
|
|
186
|
+
abbreviation = hit.hit[:code].match(/^[^-]+/).to_s
|
|
187
|
+
case abbreviation
|
|
188
|
+
when "ITU"
|
|
189
|
+
name = "International Telecommunication Union"
|
|
190
|
+
url = "www.itu.int"
|
|
191
|
+
end
|
|
192
|
+
org = Relaton::Bib::Organization.new(
|
|
193
|
+
name: [Relaton::Bib::TypedLocalizedString.new(content: name)],
|
|
194
|
+
abbreviation: Relaton::Bib::LocalizedString.new(content: abbreviation),
|
|
195
|
+
uri: [Relaton::Bib::Uri.new(content: url)],
|
|
196
|
+
)
|
|
197
|
+
owner = Relaton::Bib::ContributionInfo.new(organization: org)
|
|
198
|
+
year = parser.doc_date&.match(/\d{4}/)&.to_s
|
|
199
|
+
[Relaton::Bib::Copyright.new(from: year, owner: [owner])]
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
end
|
data/lib/relaton/itu.rb
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require "mechanize"
|
|
2
|
+
require "parslet"
|
|
3
|
+
require "pubid"
|
|
4
|
+
require "digest/md5"
|
|
5
|
+
require "relaton/index"
|
|
6
|
+
require "relaton/bib"
|
|
7
|
+
require "relaton/core"
|
|
8
|
+
require_relative "version"
|
|
9
|
+
require_relative "itu/util"
|
|
10
|
+
require_relative "itu/item_data"
|
|
11
|
+
require_relative "itu/model/item"
|
|
12
|
+
require_relative "itu/model/bibitem"
|
|
13
|
+
require_relative "itu/model/bibdata"
|
|
14
|
+
require_relative "itu/pubid"
|
|
15
|
+
require_relative "itu/scraper"
|
|
16
|
+
require_relative "itu/hit_collection"
|
|
17
|
+
require_relative "itu/bibliography"
|
|
18
|
+
|
|
19
|
+
module Relaton
|
|
20
|
+
module Itu
|
|
21
|
+
INDEXFILE = "index-v2"
|
|
22
|
+
|
|
23
|
+
class Error < StandardError; end
|
|
24
|
+
|
|
25
|
+
# Returns hash of XML reammar
|
|
26
|
+
# @return [String]
|
|
27
|
+
def self.grammar_hash
|
|
28
|
+
# gem_path = File.expand_path "..", __dir__
|
|
29
|
+
# grammars_path = File.join gem_path, "grammars", "*"
|
|
30
|
+
# grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
|
|
31
|
+
Digest::MD5.hexdigest Relaton::VERSION # grammars
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|