relaton 2.1.0 → 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/cache.rb +232 -0
- data/lib/relaton/db/config.rb +24 -0
- data/lib/relaton/db/registry.rb +119 -0
- data/lib/relaton/db/util.rb +9 -0
- data/lib/relaton/db/workers_pool.rb +22 -0
- data/lib/relaton/db.rb +20 -206
- 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 +44 -9
- metadata +708 -150
- 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/.rubocop.yml +0 -12
- data/CLAUDE.md +0 -70
- data/Gemfile +0 -21
- 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/config.rb +0 -24
- data/lib/relaton/db_cache.rb +0 -230
- data/lib/relaton/registry.rb +0 -118
- data/lib/relaton/util.rb +0 -7
- data/lib/relaton/workers_pool.rb +0 -21
- data/relaton.gemspec +0 -61
- data/spec/relaton/config_spec.rb +0 -10
- data/spec/relaton/db_cache_spec.rb +0 -51
- data/spec/relaton/db_spec.rb +0 -556
- data/spec/relaton/registry_spec.rb +0 -178
- data/spec/relaton/util_spec.rb +0 -3
- data/spec/relaton_spec.rb +0 -725
- 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/3gpp_tr_00_01u_umts_3_0_0.yml +0 -12720
- data/spec/vcr_cassetes/api_relaton_org.yml +0 -121
- data/spec/vcr_cassetes/api_relaton_org_unavailable.yml +0 -143
- data/spec/vcr_cassetes/cc_dir_10005_2019.yml +0 -199
- data/spec/vcr_cassetes/cie_001_1980.yml +0 -401
- data/spec/vcr_cassetes/cipm_meeting_43.yml +0 -1513
- data/spec/vcr_cassetes/doi_10_6028_nist_ir_8245.yml +0 -86
- data/spec/vcr_cassetes/ecma_6.yml +0 -112
- data/spec/vcr_cassetes/en_10160_1999.yml +0 -13624
- data/spec/vcr_cassetes/gb_t_20223_2006.yml +0 -733
- data/spec/vcr_cassetes/ieee_528_2019.yml +0 -2786
- data/spec/vcr_cassetes/iso_111111119115_1.yml +0 -12951
- data/spec/vcr_cassetes/iso_19115_1.yml +0 -13177
- data/spec/vcr_cassetes/iso_19115_1_2.yml +0 -369
- data/spec/vcr_cassetes/iso_19115_1_std.yml +0 -13177
- data/spec/vcr_cassetes/iso_19115_all_parts.yml +0 -229
- data/spec/vcr_cassetes/iso_19133_2005.yml +0 -148
- data/spec/vcr_cassetes/iso_combined_applied.yml +0 -364
- data/spec/vcr_cassetes/iso_combined_included.yml +0 -364
- data/spec/vcr_cassetes/iso_dis.yml +0 -157
- data/spec/vcr_cassetes/ogc_19_025r1.yml +0 -371
- data/spec/vcr_cassetes/omg_ami4ccm_1_0.yml +0 -317
- data/spec/vcr_cassetes/rfc_8341.yml +0 -1272
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Ecma
|
|
3
|
+
class StandardParser
|
|
4
|
+
include ParserCommon
|
|
5
|
+
|
|
6
|
+
ATTRS = %i[docidentifier title date source abstract relation edition ext].freeze
|
|
7
|
+
|
|
8
|
+
# @param [Nokogiri::XML::Element] hit document hit
|
|
9
|
+
# @param [Mechanize::Page] doc fetched document page
|
|
10
|
+
# @param [Hash] errors error tracking hash
|
|
11
|
+
def initialize(hit:, doc:, errors: {})
|
|
12
|
+
@hit = hit
|
|
13
|
+
@doc = doc
|
|
14
|
+
@errors = errors
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# @return [Hash] bibliographic item attributes
|
|
18
|
+
def to_bib_hash
|
|
19
|
+
bib = default_bib_hash
|
|
20
|
+
ATTRS.each { |a| bib[a] = send "fetch_#{a}" }
|
|
21
|
+
bib
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# @return [Array] precomputed translation sources
|
|
25
|
+
def translation_source
|
|
26
|
+
@translation_source ||= parse_translation_source
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# @return [Array<Relaton::Bib::Docidentifier>]
|
|
30
|
+
def fetch_docidentifier
|
|
31
|
+
result = super(@hit.text)
|
|
32
|
+
@errors[:standard_docidentifier] &&= result.empty?
|
|
33
|
+
result
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# @return [Array<Relaton::Bib::Title>]
|
|
37
|
+
def fetch_title
|
|
38
|
+
result = @doc.xpath('//p[@class="ecma-item-short-description"]').map do |t|
|
|
39
|
+
Bib::Title.new(content: t.text.strip, language: "en", script: "Latn")
|
|
40
|
+
end
|
|
41
|
+
@errors[:standard_title] &&= result.empty?
|
|
42
|
+
result
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# @return [Array<Relaton::Bib::LocalizedMarkedUpString>]
|
|
46
|
+
def fetch_abstract
|
|
47
|
+
content = @doc.xpath('//div[@class="ecma-item-content"]/p').map do |a|
|
|
48
|
+
a.text.strip.squeeze(" ").gsub("\r\n", "")
|
|
49
|
+
end.join "\n"
|
|
50
|
+
return [] if content.empty?
|
|
51
|
+
|
|
52
|
+
result = [Bib::Abstract.new(content: content, language: "en", script: "Latn")]
|
|
53
|
+
@errors[:standard_abstract] &&= result.empty?
|
|
54
|
+
result
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# @return [Array<Relaton::Bib::Date>]
|
|
58
|
+
def fetch_date
|
|
59
|
+
result = @doc.xpath('//p[@class="ecma-item-edition"]').map do |d|
|
|
60
|
+
date = d.text.split(", ").last
|
|
61
|
+
Bib::Date.new type: "published", at: date
|
|
62
|
+
end
|
|
63
|
+
@errors[:standard_date] &&= result.empty?
|
|
64
|
+
result
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# @return [Array<Relaton::Bib::Uri>]
|
|
68
|
+
def fetch_source # rubocop:disable Metrics/AbcSize
|
|
69
|
+
source = []
|
|
70
|
+
source << Bib::Uri.new(type: "src", content: @hit[:href]) if @hit[:href]
|
|
71
|
+
ref = @doc.at('//div[@class="ecma-item-content-wrapper"]/span/a',
|
|
72
|
+
'//div[@class="ecma-item-content-wrapper"]/a')
|
|
73
|
+
source << Bib::Uri.new(type: "pdf", content: ref[:href]) if ref
|
|
74
|
+
result = source + edition_translation_source(fetch_edition_content)
|
|
75
|
+
@errors[:standard_source] &&= result.empty?
|
|
76
|
+
result
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# @return [Array<Relaton::Bib::Relation>]
|
|
80
|
+
def fetch_relation # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity
|
|
81
|
+
edition_parser = EditionParser.new(doc: @doc, bib: {}, errors: @errors)
|
|
82
|
+
result = @doc.xpath("//ul[@class='ecma-item-archives']/li").filter_map do |rel|
|
|
83
|
+
ref, ed, date, vol = edition_parser.edition_id_parts rel.at("span").text
|
|
84
|
+
next if ed.nil? || ed.empty?
|
|
85
|
+
|
|
86
|
+
docid = Bib::Docidentifier.new(type: "ECMA", content: ref, primary: true)
|
|
87
|
+
source = rel.xpath("span/a").map { |l| Bib::Uri.new type: "pdf", content: l[:href] }
|
|
88
|
+
edition = Bib::Edition.new content: ed
|
|
89
|
+
extent = edition_parser.create_extent(vol)
|
|
90
|
+
@errors[:standard_relation_extent] &&= extent.nil?
|
|
91
|
+
bibitem = ItemData.new(
|
|
92
|
+
docidentifier: [docid], formattedref: Bib::Formattedref.new(content: ref), date: date, edition: edition,
|
|
93
|
+
source: source, extent: extent
|
|
94
|
+
)
|
|
95
|
+
Bib::Relation.new(type: "updates", bibitem: bibitem)
|
|
96
|
+
end
|
|
97
|
+
@errors[:standard_relation] &&= result.empty?
|
|
98
|
+
result
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# @return [Relaton::Bib::Edition, nil]
|
|
102
|
+
def fetch_edition
|
|
103
|
+
cnt = fetch_edition_content
|
|
104
|
+
result = Bib::Edition.new(content: cnt) if cnt && !cnt.empty?
|
|
105
|
+
@errors[:standard_edition] &&= result.nil?
|
|
106
|
+
result
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
private
|
|
110
|
+
|
|
111
|
+
def fetch_edition_content
|
|
112
|
+
@doc.at('//p[@class="ecma-item-edition"]')&.text&.match(/^\d+(?=(?:st|nd|th|rd))/)&.to_s
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def edition_translation_source(edition)
|
|
116
|
+
translation_source.select { |s| s[:ed] == edition }.map { |s| s[:source] }
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def parse_translation_source
|
|
120
|
+
return [] unless @doc
|
|
121
|
+
|
|
122
|
+
@doc.xpath("//h2[.='Translations']/following-sibling::ul/li").map do |l|
|
|
123
|
+
a = l.at("span/a")
|
|
124
|
+
id = l.at("span").text
|
|
125
|
+
%r{\w+[\d-]+,\s(?<lang>\w+)\sversion,\s(?<ed>[\d.]+)(?:st|nd|rd|th)\sedition} =~ id
|
|
126
|
+
case lang
|
|
127
|
+
when "Japanese"
|
|
128
|
+
{ ed: ed, source: Bib::Uri.new(type: "pdf", language: "ja", script: "Jpan", content: a[:href]) }
|
|
129
|
+
end
|
|
130
|
+
end.compact
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
end
|
data/lib/relaton/ecma.rb
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require "relaton/index"
|
|
2
|
+
require "relaton/bib"
|
|
3
|
+
require_relative "version"
|
|
4
|
+
require_relative "ecma/util"
|
|
5
|
+
require_relative "ecma/item_data"
|
|
6
|
+
require_relative "ecma/item"
|
|
7
|
+
require_relative "ecma/bibitem"
|
|
8
|
+
require_relative "ecma/bibdata"
|
|
9
|
+
require_relative "ecma/bibliography"
|
|
10
|
+
|
|
11
|
+
module Relaton
|
|
12
|
+
module Ecma
|
|
13
|
+
INDEXFILE = "index-v1"
|
|
14
|
+
|
|
15
|
+
# Returns hash of XML reammar
|
|
16
|
+
# @return [String]
|
|
17
|
+
def self.grammar_hash
|
|
18
|
+
# gem_path = File.expand_path "..", __dir__
|
|
19
|
+
# grammars_path = File.join gem_path, "grammars", "*"
|
|
20
|
+
# grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
|
|
21
|
+
Digest::MD5.hexdigest Relaton::VERSION # grammars
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Relaton
|
|
4
|
+
module Etsi
|
|
5
|
+
# Methods for search IANA standards.
|
|
6
|
+
module Bibliography
|
|
7
|
+
SOURCE = "https://raw.githubusercontent.com/relaton/relaton-data-etsi/refs/heads/v2/"
|
|
8
|
+
|
|
9
|
+
# @param text [String]
|
|
10
|
+
# @return [Relaton::Etsi::ItemData, nil]
|
|
11
|
+
def search(text) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
|
12
|
+
index = Relaton::Index.find_or_create :etsi, url: "#{SOURCE}index-v1.zip", file: INDEX_FILE
|
|
13
|
+
row = index.search(text).min_by { |r| r[:id] }
|
|
14
|
+
return unless row
|
|
15
|
+
|
|
16
|
+
url = "#{SOURCE}#{row[:file]}"
|
|
17
|
+
resp = Net::HTTP.get_response URI(url)
|
|
18
|
+
return unless resp.code == "200"
|
|
19
|
+
|
|
20
|
+
Item.from_yaml(resp.body).tap { |item| item.fetched = Date.today.to_s }
|
|
21
|
+
rescue SocketError, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET,
|
|
22
|
+
EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError,
|
|
23
|
+
Net::ProtocolError, Errno::ETIMEDOUT => e
|
|
24
|
+
raise Relaton::RequestError, e.message
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# @param ref [String] the ETSI standard Code to look up
|
|
28
|
+
# @param year [String, nil] year
|
|
29
|
+
# @param opts [Hash] options
|
|
30
|
+
# @return [Relaton::Etsi::ItemData, nil]
|
|
31
|
+
def get(ref, _year = nil, _opts = {})
|
|
32
|
+
Util.info "Fetching from Relaton repository ...", key: ref
|
|
33
|
+
result = search(ref)
|
|
34
|
+
unless result
|
|
35
|
+
Util.info "Not found.", key: ref
|
|
36
|
+
return
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
Util.info "Found: `#{result.docidentifier[0].content}`", key: ref
|
|
40
|
+
result
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
extend Bibliography
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
require "date"
|
|
2
|
+
require "json"
|
|
3
|
+
require "mechanize"
|
|
4
|
+
require "relaton/core"
|
|
5
|
+
require "relaton/index"
|
|
6
|
+
require_relative "../etsi"
|
|
7
|
+
require_relative "data_parser"
|
|
8
|
+
|
|
9
|
+
module Relaton
|
|
10
|
+
module Etsi
|
|
11
|
+
class DataFetcher < Core::DataFetcher
|
|
12
|
+
PAGE_SIZE = 50
|
|
13
|
+
|
|
14
|
+
SOURCEURL = "https://www.etsi.org/custom/standardssearch/data.php?format=json&includeScope=1&" \
|
|
15
|
+
"page=%<page>s&search=&title=1&etsiNumber=1&content=1&version=0&onApproval=1&published=1&" \
|
|
16
|
+
"withdrawn=1&historical=1&isCurrent=1&superseded=1&startDate=1988-01-15&endDate=%<date>s&" \
|
|
17
|
+
"harmonized=0&keyword=&TB=&stdType=&frequency=&mandate=&collection=&sort=1&x=%<timestamp>s".freeze
|
|
18
|
+
|
|
19
|
+
def index
|
|
20
|
+
@index ||= Relaton::Index.find_or_create :etsi, file: INDEX_FILE
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def log_error(msg)
|
|
24
|
+
Util.error msg
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
#
|
|
28
|
+
# Fetch all ETSI documents from the ETSI website.
|
|
29
|
+
#
|
|
30
|
+
# @param [Object] _source unused, required by superclass interface
|
|
31
|
+
#
|
|
32
|
+
def fetch(_source = nil)
|
|
33
|
+
first_page = fetch_page(1)
|
|
34
|
+
process_records(first_page)
|
|
35
|
+
fetch_remaining_pages(first_page)
|
|
36
|
+
index.save
|
|
37
|
+
report_errors
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def fetch_remaining_pages(first_page)
|
|
41
|
+
total = first_page.first ? first_page.first["total_count"].to_i : 0
|
|
42
|
+
total_pages = (total / PAGE_SIZE.to_f).ceil
|
|
43
|
+
(2..total_pages).each do |page|
|
|
44
|
+
records = fetch_page(page)
|
|
45
|
+
break if records.empty?
|
|
46
|
+
|
|
47
|
+
process_records(records)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def fetch_page(page)
|
|
52
|
+
date = Time.now.to_date + 1
|
|
53
|
+
timestamp = (Time.now.to_f * 1000).to_i
|
|
54
|
+
url = format(SOURCEURL, page: page, date: date, timestamp: timestamp)
|
|
55
|
+
JSON.parse(fetch_with_retry(url))
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def process_records(records)
|
|
59
|
+
records.each do |record|
|
|
60
|
+
save DataParser.new(normalize(record), @errors).parse
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def normalize(record)
|
|
65
|
+
{
|
|
66
|
+
"ETSI deliverable" => record["ETSI_DELIVERABLE"],
|
|
67
|
+
"title" => record["TITLE"],
|
|
68
|
+
"Details link" => "https://webapp.etsi.org/workprogram/Report_WorkItem.asp?WKI_ID=#{record['wki_id']}",
|
|
69
|
+
"PDF link" => "https://www.etsi.org/deliver/#{record['EDSpathname']}#{record['EDSPDFfilename']}",
|
|
70
|
+
"Status" => derive_status(record),
|
|
71
|
+
"Keywords" => record["Keywords"].to_s,
|
|
72
|
+
"Technical body" => record["TB"],
|
|
73
|
+
"Scope" => record["Scope"],
|
|
74
|
+
}
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def derive_status(record)
|
|
78
|
+
return "Withdrawn" if record["ACTION_TYPE"] == "WD"
|
|
79
|
+
|
|
80
|
+
code = record["STATUS_CODE"].to_i
|
|
81
|
+
return "On Approval" if code < 12
|
|
82
|
+
return "Historical" if code == 13
|
|
83
|
+
|
|
84
|
+
"Published"
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
NETWORK_ERRORS = [
|
|
88
|
+
Mechanize::Error, Net::OpenTimeout, Net::ReadTimeout,
|
|
89
|
+
SocketError, Errno::ECONNRESET
|
|
90
|
+
].freeze
|
|
91
|
+
|
|
92
|
+
def fetch_with_retry(url, retries: 3, delay: 2) # rubocop:disable Metrics/MethodLength
|
|
93
|
+
attempt = 0
|
|
94
|
+
begin
|
|
95
|
+
Mechanize.new.get(url).body
|
|
96
|
+
rescue *NETWORK_ERRORS => e
|
|
97
|
+
attempt += 1
|
|
98
|
+
if attempt <= retries
|
|
99
|
+
Util.info "Fetch failed (#{e.message}), " \
|
|
100
|
+
"retrying (#{attempt}/#{retries})..."
|
|
101
|
+
sleep delay * attempt
|
|
102
|
+
retry
|
|
103
|
+
end
|
|
104
|
+
raise
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def save(bib)
|
|
109
|
+
id = bib.docidentifier.first.content
|
|
110
|
+
file = output_file id
|
|
111
|
+
File.write file, serialize(bib), encoding: "UTF-8"
|
|
112
|
+
index.add_or_update id, file
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def to_yaml(bib)
|
|
116
|
+
bib.to_yaml
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def to_xml(bib)
|
|
120
|
+
bib.to_xml bibdata: true
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def to_bibxml(bib)
|
|
124
|
+
bib.to_rfcxml
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
require_relative "pubid"
|
|
2
|
+
module Relaton
|
|
3
|
+
module Etsi
|
|
4
|
+
class DataParser
|
|
5
|
+
ATTRS = %i[
|
|
6
|
+
title docnumber source date docidentifier version status contributor
|
|
7
|
+
keyword ext abstract language script
|
|
8
|
+
].freeze
|
|
9
|
+
|
|
10
|
+
def initialize(row, errors = {})
|
|
11
|
+
@row = row
|
|
12
|
+
@errors = errors
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def parse
|
|
16
|
+
args = ATTRS.to_h { |attr| [attr, send(attr)] }
|
|
17
|
+
ItemData.new(type: "standard", **args)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def pubid
|
|
21
|
+
return @pubid if defined?(@pubid)
|
|
22
|
+
|
|
23
|
+
unless @row["ETSI deliverable"]
|
|
24
|
+
@errors[:pubid] &&= true
|
|
25
|
+
@pubid = nil
|
|
26
|
+
return @pubid
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
@errors[:pubid] &&= false
|
|
30
|
+
@pubid = PubId.parse(@row["ETSI deliverable"])
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def title
|
|
34
|
+
result = if @row["title"]
|
|
35
|
+
[Bib::Title.new(
|
|
36
|
+
content: @row["title"], language: "en", script: "Latn",
|
|
37
|
+
)]
|
|
38
|
+
else
|
|
39
|
+
[]
|
|
40
|
+
end
|
|
41
|
+
@errors[:title] &&= result.empty?
|
|
42
|
+
result
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def docnumber
|
|
46
|
+
@row["ETSI deliverable"]
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def source
|
|
50
|
+
urls = []
|
|
51
|
+
if @row["Details link"]
|
|
52
|
+
urls << Bib::Uri.new(content: @row["Details link"], type: "src")
|
|
53
|
+
end
|
|
54
|
+
if @row["PDF link"]
|
|
55
|
+
urls << Bib::Uri.new(content: @row["PDF link"], type: "pdf")
|
|
56
|
+
end
|
|
57
|
+
@errors[:source] &&= urls.empty?
|
|
58
|
+
urls
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def date
|
|
62
|
+
result = if pubid&.date
|
|
63
|
+
[Bib::Date.new(type: "published", at: pubid.date)]
|
|
64
|
+
else
|
|
65
|
+
[]
|
|
66
|
+
end
|
|
67
|
+
@errors[:date] &&= result.empty?
|
|
68
|
+
result
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def docidentifier
|
|
72
|
+
result = if @row["ETSI deliverable"]
|
|
73
|
+
[Bib::Docidentifier.new(
|
|
74
|
+
content: @row["ETSI deliverable"],
|
|
75
|
+
type: "ETSI",
|
|
76
|
+
primary: true,
|
|
77
|
+
)]
|
|
78
|
+
else
|
|
79
|
+
[]
|
|
80
|
+
end
|
|
81
|
+
@errors[:docidentifier] &&= result.empty?
|
|
82
|
+
result
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def version
|
|
86
|
+
return [] unless pubid&.version
|
|
87
|
+
|
|
88
|
+
[Bib::Version.new(draft: pubid.version)]
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def status
|
|
92
|
+
unless @row["Status"]
|
|
93
|
+
@errors[:status] &&= true
|
|
94
|
+
return
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
stage = @row["Status"]
|
|
98
|
+
if stage == "On Approval"
|
|
99
|
+
stage = "#{pubid&.type} approval"
|
|
100
|
+
end
|
|
101
|
+
@errors[:status] &&= false
|
|
102
|
+
Status.new(stage: stage)
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def contributor
|
|
106
|
+
contribs = [publisher_contributor]
|
|
107
|
+
contribs << committee_contributor if @row["Technical body"]
|
|
108
|
+
contribs
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def publisher_contributor
|
|
112
|
+
org = Bib::Organization.new(
|
|
113
|
+
name: [etsi_org_name], abbreviation: etsi_abbreviation,
|
|
114
|
+
)
|
|
115
|
+
role = Bib::Contributor::Role.new(type: "publisher")
|
|
116
|
+
Bib::Contributor.new(organization: org, role: [role])
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def etsi_org_name
|
|
120
|
+
Bib::TypedLocalizedString.new(
|
|
121
|
+
content: "European Telecommunications Standards Institute",
|
|
122
|
+
language: "en",
|
|
123
|
+
script: "Latn",
|
|
124
|
+
)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def etsi_abbreviation
|
|
128
|
+
Bib::LocalizedString.new(
|
|
129
|
+
content: "ETSI",
|
|
130
|
+
language: "en",
|
|
131
|
+
script: "Latn",
|
|
132
|
+
)
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def committee_contributor
|
|
136
|
+
desc = Bib::LocalizedMarkedUpString.new(content: "committee")
|
|
137
|
+
role = Bib::Contributor::Role.new(
|
|
138
|
+
type: "author", description: [desc],
|
|
139
|
+
)
|
|
140
|
+
Bib::Contributor.new(organization: committee_org, role: [role])
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def committee_org
|
|
144
|
+
Bib::Organization.new(
|
|
145
|
+
name: [etsi_name],
|
|
146
|
+
abbreviation: etsi_abbreviation,
|
|
147
|
+
subdivision: [technical_committee_subdivision],
|
|
148
|
+
)
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def etsi_name
|
|
152
|
+
Bib::TypedLocalizedString.new(
|
|
153
|
+
content: "European Telecommunications Standards Institute",
|
|
154
|
+
)
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def technical_committee_subdivision
|
|
158
|
+
Bib::Subdivision.new(
|
|
159
|
+
name: [Bib::TypedLocalizedString.new(
|
|
160
|
+
content: @row["Technical body"],
|
|
161
|
+
)],
|
|
162
|
+
type: "technical-committee",
|
|
163
|
+
)
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
def keyword
|
|
167
|
+
unless @row["Keywords"]
|
|
168
|
+
@errors[:keyword] &&= true
|
|
169
|
+
return []
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
result = @row["Keywords"].split(",").map do |kw|
|
|
173
|
+
Bib::Keyword.new(vocab: Bib::LocalizedString.new(content: kw.strip, language: "en", script: "Latn"))
|
|
174
|
+
end
|
|
175
|
+
@errors[:keyword] &&= result.empty?
|
|
176
|
+
result
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
def ext
|
|
180
|
+
Ext.new(doctype: doctype, flavor: "etsi")
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
def doctype
|
|
184
|
+
return unless pubid
|
|
185
|
+
|
|
186
|
+
Doctype.create_from_abbreviation pubid.type
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
def abstract
|
|
190
|
+
result = if @row["Scope"]
|
|
191
|
+
[Bib::Abstract.new(content: @row["Scope"], language: "en", script: "Latn")]
|
|
192
|
+
else
|
|
193
|
+
[]
|
|
194
|
+
end
|
|
195
|
+
@errors[:abstract] &&= result.empty?
|
|
196
|
+
result
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def language
|
|
200
|
+
["en"]
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
def script
|
|
204
|
+
["Latn"]
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Etsi
|
|
3
|
+
class Doctype < Bib::Doctype
|
|
4
|
+
DOCTYPES = {
|
|
5
|
+
"EN" => "European Standard",
|
|
6
|
+
"ES" => "ETSI Standard",
|
|
7
|
+
"EG" => "ETSI Guide",
|
|
8
|
+
"TS" => "Technical Specification",
|
|
9
|
+
"GS" => "Group Specification",
|
|
10
|
+
"GR" => "Group Report",
|
|
11
|
+
"TR" => "Technical Report",
|
|
12
|
+
"ETR" => "ETSI Technical Report",
|
|
13
|
+
"GTS" => "GSM Technical Specification",
|
|
14
|
+
"SR" => "Special Report",
|
|
15
|
+
"TCRTR" => "Technical Committee Reference Technical Report",
|
|
16
|
+
"TBR" => "Technical Basis for Regulation",
|
|
17
|
+
"ETS" => "European Telecommunication Standard",
|
|
18
|
+
"I-ETS" => "Interim European Telecommunication Standard",
|
|
19
|
+
"NET" => "Norme Européenne de Télécommunication",
|
|
20
|
+
}.freeze
|
|
21
|
+
|
|
22
|
+
attribute :abbreviation, :string, values: DOCTYPES.keys
|
|
23
|
+
attribute :content, :string, values: DOCTYPES.values
|
|
24
|
+
|
|
25
|
+
def self.create_from_abbreviation(abbreviation)
|
|
26
|
+
new(content: DOCTYPES[abbreviation], abbreviation: abbreviation)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require_relative "doctype"
|
|
2
|
+
|
|
3
|
+
module Relaton
|
|
4
|
+
module Etsi
|
|
5
|
+
class Ext < Bib::Ext
|
|
6
|
+
attribute :doctype, Doctype
|
|
7
|
+
attribute :marker, :string, values: %w[Current Superseded]
|
|
8
|
+
attribute :frequency, :string, collection: true
|
|
9
|
+
attribute :mandate, :string, collection: true
|
|
10
|
+
attribute :custom_collection, :string, values: %W[
|
|
11
|
+
HSs\scited\sin\sOJ HSs\snot\syet\scited\sin\sOJ HSs\sRED\scited\sin\sOJ HSs\sEMC\scited\sin\sOJ
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
xml do
|
|
15
|
+
map_element "marker", to: :marker
|
|
16
|
+
map_element "frequency", to: :frequency
|
|
17
|
+
map_element "mandate", to: :mandate
|
|
18
|
+
map_element "custom-collection", to: :custom_collection
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
key_value do
|
|
22
|
+
map_element "marker", to: :marker
|
|
23
|
+
map_element "frequency", to: :frequency
|
|
24
|
+
map_element "mandate", to: :mandate
|
|
25
|
+
map_element "custom_collection", to: :custom_collection
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def get_schema_version = Relaton.schema_versions["relaton-model-etsi"]
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require "relaton/bib"
|
|
2
|
+
require_relative "item_data"
|
|
3
|
+
require_relative "ext"
|
|
4
|
+
require_relative "status"
|
|
5
|
+
|
|
6
|
+
module Relaton
|
|
7
|
+
module Etsi
|
|
8
|
+
class Item < Bib::Item
|
|
9
|
+
model ItemData
|
|
10
|
+
|
|
11
|
+
attribute :ext, Ext
|
|
12
|
+
attribute :status, Status
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|