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,303 @@
|
|
|
1
|
+
require "fileutils"
|
|
2
|
+
require "net/http"
|
|
3
|
+
require "uri"
|
|
4
|
+
require_relative "../3gpp"
|
|
5
|
+
require_relative "parser"
|
|
6
|
+
|
|
7
|
+
module Relaton
|
|
8
|
+
module ThreeGpp
|
|
9
|
+
class DataFetcher < Core::DataFetcher
|
|
10
|
+
CURRENT = "current.yaml".freeze
|
|
11
|
+
CSV_URL = "https://www.3gpp.org/ftp/Information/Databases/3GPPBibliography.csv".freeze
|
|
12
|
+
|
|
13
|
+
def log_error(msg)
|
|
14
|
+
Util.error msg
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# The index is pubid-backed: `pubid_class:` makes Relaton::Index sort the
|
|
18
|
+
# rows by `id.root.number` on save and serialize each id to its
|
|
19
|
+
# `_type: pubid:3gpp:*` hash. Without it a v1-shaped file would be
|
|
20
|
+
# written under a v2 name, with no error and no narrowing — FileIO#save
|
|
21
|
+
# only calls `to_hash` when the value is an instance of `pubid_class`.
|
|
22
|
+
def index
|
|
23
|
+
@index ||= Relaton::Index.find_or_create(
|
|
24
|
+
"3gpp", file: "#{INDEXFILE}.yaml",
|
|
25
|
+
pubid_class: ::Pubid::Tgpp::Identifier
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
#
|
|
30
|
+
# Parse documents
|
|
31
|
+
#
|
|
32
|
+
# @param [String] source source of documents, status-smg-3gpp for updare
|
|
33
|
+
# or status-smg-3gpp-force for renewal
|
|
34
|
+
#
|
|
35
|
+
def fetch(source) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
|
36
|
+
renewal = source == "status-smg-3GPP-force"
|
|
37
|
+
file = get_file renewal
|
|
38
|
+
return unless file && File.exist?(file) && File.size(file) > 20_000_000
|
|
39
|
+
|
|
40
|
+
if renewal
|
|
41
|
+
FileUtils.rm_f Dir.glob(File.join(@output, "/*"))
|
|
42
|
+
index.remove_all # if renewal
|
|
43
|
+
end
|
|
44
|
+
CSV.open(file, "r:bom|utf-8", headers: true, col_sep: ";").each do |row|
|
|
45
|
+
save_doc Parser.parse(row, @errors)
|
|
46
|
+
end
|
|
47
|
+
File.write CURRENT, @current.to_yaml, encoding: "UTF-8"
|
|
48
|
+
index.save
|
|
49
|
+
report_errors
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
#
|
|
53
|
+
# Get file via HTTPS. If file has not changed, return nil
|
|
54
|
+
#
|
|
55
|
+
# @param [Boolean] renewal force to update all documents
|
|
56
|
+
#
|
|
57
|
+
# @return [String, nil] file name
|
|
58
|
+
#
|
|
59
|
+
def get_file(renewal) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
60
|
+
@current = YAML.load_file CURRENT if File.exist? CURRENT
|
|
61
|
+
@current ||= {}
|
|
62
|
+
uri = URI(CSV_URL)
|
|
63
|
+
n = 0
|
|
64
|
+
begin
|
|
65
|
+
last_modified = head_last_modified(uri)
|
|
66
|
+
return unless last_modified
|
|
67
|
+
|
|
68
|
+
dt = DateTime.parse(last_modified)
|
|
69
|
+
if !renewal && !@current["date"].to_s.empty? &&
|
|
70
|
+
dt == DateTime.parse(@current["date"])
|
|
71
|
+
return
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
tmp_file = File.join Dir.tmpdir, "3gpp.csv"
|
|
75
|
+
download(uri, tmp_file)
|
|
76
|
+
rescue Net::OpenTimeout, Net::ReadTimeout, SocketError => e
|
|
77
|
+
n += 1
|
|
78
|
+
retry if n < 5
|
|
79
|
+
raise e
|
|
80
|
+
end
|
|
81
|
+
@current["date"] = dt.to_s
|
|
82
|
+
tmp_file
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def head_last_modified(uri)
|
|
86
|
+
Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https",
|
|
87
|
+
open_timeout: 30, read_timeout: 30) do |http|
|
|
88
|
+
resp = http.request(Net::HTTP::Head.new(uri.request_uri))
|
|
89
|
+
raise "HTTP #{resp.code} from #{uri}" unless resp.is_a?(Net::HTTPSuccess)
|
|
90
|
+
|
|
91
|
+
resp["last-modified"]
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def download(uri, tmp_file)
|
|
96
|
+
Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https",
|
|
97
|
+
open_timeout: 30, read_timeout: 120) do |http|
|
|
98
|
+
http.request(Net::HTTP::Get.new(uri.request_uri)) do |resp|
|
|
99
|
+
raise "HTTP #{resp.code} from #{uri}" unless resp.is_a?(Net::HTTPSuccess)
|
|
100
|
+
|
|
101
|
+
File.open(tmp_file, "wb") { |f| resp.read_body { |chunk| f.write(chunk) } }
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
#
|
|
107
|
+
# Save document to file
|
|
108
|
+
#
|
|
109
|
+
# @param [RelatonW3c::W3cBibliographicItem, nil] bib bibliographic item
|
|
110
|
+
#
|
|
111
|
+
def save_doc(bib) # rubocop:disable Metrics/MethodLength,Metrics/AbcSize
|
|
112
|
+
return unless bib
|
|
113
|
+
|
|
114
|
+
bib1 = bib
|
|
115
|
+
# A DISTINCT docnumber that sanitizes to the same filename must not be
|
|
116
|
+
# merged into the other document — give it a path of its own. Only a
|
|
117
|
+
# genuine duplicate (same docnumber, same path) still merges.
|
|
118
|
+
file = unique_output_file(bib1.docnumber)
|
|
119
|
+
# A reserved path only ever belongs to one docnumber, so a hit here is
|
|
120
|
+
# the same document again and still merges. Checked FIRST: a
|
|
121
|
+
# disambiguated path stays != output_file forever, so gating the merge
|
|
122
|
+
# on that comparison would drop the merge enrichment on every repeat of
|
|
123
|
+
# a disambiguated docnumber.
|
|
124
|
+
if @files.include? file
|
|
125
|
+
bib1 = merge_duplication bib1, file
|
|
126
|
+
Util.warn "File #{file} already exists. Document: #{bib.docnumber}" if bib1.nil?
|
|
127
|
+
else
|
|
128
|
+
if file != output_file(bib1.docnumber)
|
|
129
|
+
Util.warn "File #{output_file bib1.docnumber} already exists. " \
|
|
130
|
+
"Document: #{bib.docnumber}. Writing #{file} instead."
|
|
131
|
+
end
|
|
132
|
+
@files << file
|
|
133
|
+
index_primary bib1.docidentifier&.detect(&:primary), file
|
|
134
|
+
end
|
|
135
|
+
File.write file, serialize(bib1), encoding: "UTF-8" unless bib1.nil?
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
#
|
|
139
|
+
# Add a document's primary id to the index.
|
|
140
|
+
#
|
|
141
|
+
# The pubid is already parsed on `Docidentifier`, so index it directly
|
|
142
|
+
# rather than re-parsing `docnumber`. `pubid.to_s` (no publisher token)
|
|
143
|
+
# reproduces the `docnumber` string this used to store byte-for-byte, so
|
|
144
|
+
# the index key does not move; `docnumber` still names the output file.
|
|
145
|
+
#
|
|
146
|
+
# An id pubid cannot rebuild is recorded in `@errors` — the inherited
|
|
147
|
+
# `report_errors` logs a String value as the message — and the row is
|
|
148
|
+
# skipped rather than indexed unparsed: `Relaton::Index` rejects the
|
|
149
|
+
# WHOLE index if a single row fails to deserialize, and its sort calls
|
|
150
|
+
# `.root.number` on every id. The data file is still written, so the
|
|
151
|
+
# document is unindexed, never lost. (The W3C precedent.)
|
|
152
|
+
#
|
|
153
|
+
# @param [Docidentifier, nil] docid the document's primary identifier
|
|
154
|
+
# @param [String] file path the document was written to
|
|
155
|
+
#
|
|
156
|
+
def index_primary(docid, file)
|
|
157
|
+
if docid&.pubid
|
|
158
|
+
index.add_or_update docid.pubid, file
|
|
159
|
+
return
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
id = docid&.content || file
|
|
163
|
+
@errors[id.to_s] = "Unparseable primary id `#{id}` was not indexed (#{file})"
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
#
|
|
167
|
+
# Merge duplication
|
|
168
|
+
#
|
|
169
|
+
# @param [Relaton3gpp::BibliographicItem] bib new bibliographic item
|
|
170
|
+
# @param [String] file file name of existing bibliographic item
|
|
171
|
+
#
|
|
172
|
+
# @return [Relaton3gpp::BibliographicItem, nil] merged bibliographic item or nil if no merge has been done
|
|
173
|
+
#
|
|
174
|
+
def merge_duplication(bib, file)
|
|
175
|
+
hash = YAML.load_file file
|
|
176
|
+
existed = Item.from_hash hash
|
|
177
|
+
changed = update_source? bib, existed
|
|
178
|
+
bib1, bib2, chng = transposed_relation bib, existed
|
|
179
|
+
changed ||= chng
|
|
180
|
+
chng = add_contributor(bib1, bib2)
|
|
181
|
+
changed ||= chng
|
|
182
|
+
bib1 if changed
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
#
|
|
186
|
+
# Update link in case one of bibliographic items has no link
|
|
187
|
+
#
|
|
188
|
+
# @param [Relaton3gpp::BibliographicItem] bib1
|
|
189
|
+
# @param [Relaton3gpp::BibliographicItem] bib2
|
|
190
|
+
#
|
|
191
|
+
# @return [Boolean] true if link has been updated
|
|
192
|
+
#
|
|
193
|
+
def update_source?(bib1, bib2)
|
|
194
|
+
if bib1.source.any? && bib2.source.empty?
|
|
195
|
+
bib2.source = bib1.source
|
|
196
|
+
true
|
|
197
|
+
elsif bib1.source.empty? && bib2.source.any?
|
|
198
|
+
bib1.source = bib2.source
|
|
199
|
+
true
|
|
200
|
+
else false
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
#
|
|
205
|
+
# If one of bibliographic items has date gereater than anotherm=, make it relation
|
|
206
|
+
#
|
|
207
|
+
# @param [Relaton3gpp::BibliographicItem] bib new bibliographic item
|
|
208
|
+
# @param [Relaton3gpp::BibliographicItem] existed existing bibliographic item
|
|
209
|
+
#
|
|
210
|
+
# @return [Array<Relaton3gpp::BibliographicItem, Boolean>] main bibliographic item,
|
|
211
|
+
# related bibliographic item, true if relation has been added
|
|
212
|
+
#
|
|
213
|
+
def transposed_relation(bib, existed) # rubocop:disable Metrics/CyclomaticComplexity
|
|
214
|
+
if (bib.date.none? && existed.date.none?) || (bib.date.any? && existed.date.none?)
|
|
215
|
+
return [bib, existed, false]
|
|
216
|
+
end
|
|
217
|
+
return [existed, bib, true] if bib.date.none? && existed.date.any?
|
|
218
|
+
|
|
219
|
+
check_transposed_date bib, existed
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
#
|
|
223
|
+
# Check if date of one bibliographic item is transposed to another
|
|
224
|
+
#
|
|
225
|
+
# @param [Relaton3gpp::BibliographicItem] bib new bibliographic item
|
|
226
|
+
# @param [Relaton3gpp::BibliographicItem] existed existing bibliographic item
|
|
227
|
+
#
|
|
228
|
+
# @return [Array<Relaton3gpp::BibliographicItem, Boolean>] main bibliographic item,
|
|
229
|
+
# related bibliographic item, true if relation has been added
|
|
230
|
+
#
|
|
231
|
+
def check_transposed_date(bib, existed)
|
|
232
|
+
if bib.date[0].at < existed.date[0].at
|
|
233
|
+
add_transposed_relation bib, existed
|
|
234
|
+
[bib, existed, true]
|
|
235
|
+
elsif bib.date[0].at > existed.date[0].at
|
|
236
|
+
add_transposed_relation existed, bib
|
|
237
|
+
[existed, bib, true]
|
|
238
|
+
else [bib, existed, false]
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
#
|
|
243
|
+
# Add transposed relation
|
|
244
|
+
#
|
|
245
|
+
# @param [Relaton3gpp::BibliographicItem] bib1 the main bibliographic item
|
|
246
|
+
# @param [Relaton3gpp::BibliographicItem] bib2 the transposed bibliographic item
|
|
247
|
+
#
|
|
248
|
+
# @return [Relaton3gpp::BibliographicItem]
|
|
249
|
+
#
|
|
250
|
+
def add_transposed_relation(bib1, bib2)
|
|
251
|
+
bib2.relation.each { |r| bib1.relation << r }
|
|
252
|
+
bib2.relation.clear
|
|
253
|
+
desc = Bib::LocalizedMarkedUpString.new content: "equivalent"
|
|
254
|
+
rel = Bib::Relation.new(type: "adoptedAs", bibitem: bib2, description: desc)
|
|
255
|
+
bib1.relation << rel
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
def add_contributor(bib1, bib2) # rubocop:disable Metrics/MethodLength,Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
|
259
|
+
changed = false
|
|
260
|
+
|
|
261
|
+
bib2.contributor.each do |bc|
|
|
262
|
+
next unless bc.person
|
|
263
|
+
|
|
264
|
+
existed = bib1.contributor.find { |ic| ic.person&.name == bc.person.name }
|
|
265
|
+
if existed
|
|
266
|
+
chng = add_affiliation existed, bc.person.affiliation
|
|
267
|
+
changed ||= chng
|
|
268
|
+
else
|
|
269
|
+
bib1.contributor << bc
|
|
270
|
+
changed = true
|
|
271
|
+
end
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
changed
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
def add_affiliation(contrib, affiliation)
|
|
278
|
+
changed = false
|
|
279
|
+
|
|
280
|
+
affiliation.each do |a|
|
|
281
|
+
unless contrib.person.affiliation.include? a
|
|
282
|
+
contrib.person.affiliation << a
|
|
283
|
+
changed = true
|
|
284
|
+
end
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
changed
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
def to_xml(bib)
|
|
291
|
+
bib.to_xml(bibdata: true)
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
def to_yaml(bib)
|
|
295
|
+
bib.to_yaml
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
def to_bibxml(bib)
|
|
299
|
+
bib.to_rfcxml
|
|
300
|
+
end
|
|
301
|
+
end
|
|
302
|
+
end
|
|
303
|
+
end
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module ThreeGpp
|
|
3
|
+
# Structured 3GPP document identifier. `content` stays the canonical string
|
|
4
|
+
# (e.g. "3GPP TS 29.198-04-1:REL-5/5.0.0") and the parsed
|
|
5
|
+
# `Pubid::Tgpp::Identifier` is kept alongside it in `@pubid`.
|
|
6
|
+
#
|
|
7
|
+
# Without this subclass 3GPP items inherit `Bib::Docidentifier`, whose
|
|
8
|
+
# `remove_part!` / `remove_date!` / `to_all_parts!` all raise
|
|
9
|
+
# NotImplementedError — so `ItemData#to_all_parts` and
|
|
10
|
+
# `#to_most_recent_reference`, which broadcast to every docidentifier,
|
|
11
|
+
# raised on every 3GPP item.
|
|
12
|
+
class Docidentifier < Bib::Docidentifier
|
|
13
|
+
attr_reader :pubid
|
|
14
|
+
|
|
15
|
+
# Capture the inherited (LocalizedMarkedUpString) content setter before
|
|
16
|
+
# overriding #content=, so #refresh_content! can write the re-rendered
|
|
17
|
+
# string back WITHOUT re-parsing (a re-parse would rebuild @pubid from
|
|
18
|
+
# the string and discard the in-place mutations just made).
|
|
19
|
+
alias_method :store_content, :content=
|
|
20
|
+
|
|
21
|
+
def initialize(attrs = {}, options = {})
|
|
22
|
+
pubid = attrs.is_a?(Hash) ? attrs.delete(:pubid) : nil
|
|
23
|
+
attrs[:content] ||= render(pubid) if pubid
|
|
24
|
+
super
|
|
25
|
+
@pubid = pubid if pubid
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def content=(value)
|
|
29
|
+
super
|
|
30
|
+
return unless value
|
|
31
|
+
|
|
32
|
+
@pubid = begin
|
|
33
|
+
# Rescue LoadError so a missing pubid gem degrades to a plain string,
|
|
34
|
+
# and StandardError so non-3GPP or unparseable content just leaves
|
|
35
|
+
# @pubid nil rather than raising. Deserialization reaches this setter
|
|
36
|
+
# without the flavor entry file necessarily having been loaded, hence
|
|
37
|
+
# the local require.
|
|
38
|
+
require "pubid"
|
|
39
|
+
::Pubid::Tgpp::Identifier.parse(value.to_s)
|
|
40
|
+
rescue LoadError, StandardError
|
|
41
|
+
nil
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# `Pubid::Tgpp::Identifier` models number/suffix/parts/release/version.
|
|
46
|
+
# It has no date, and `suffix` is folded into the document code, so:
|
|
47
|
+
#
|
|
48
|
+
# * #remove_part! clears `parts` — a real, separable component here
|
|
49
|
+
# (unlike IALA's, which is a no-op): "TS 29.198-04-1" -> "TS 29.198".
|
|
50
|
+
# * #remove_date! clears `release` AND `version`. 3GPP carries no date;
|
|
51
|
+
# those two are its version discriminators — the same pair
|
|
52
|
+
# `Bibliography#ignored` treats as omittable — so clearing both gives
|
|
53
|
+
# the version-agnostic ("most recent") reference "TS 23.207".
|
|
54
|
+
# * #to_all_parts! does both, then wraps `@pubid` in pubid's `AllParts`.
|
|
55
|
+
# `content` stays the plain stripped id — the Tgpp renderer has no
|
|
56
|
+
# "(all parts)" marker, and `content` is cached from the pre-wrap
|
|
57
|
+
# pubid on purpose. `#pubid` itself, read directly, now answers
|
|
58
|
+
# `all_parts? == true` and renders WITH pubid's generic marker
|
|
59
|
+
# (`#to_s`), since it's the wrapper.
|
|
60
|
+
#
|
|
61
|
+
# All three no-op safely when @pubid is nil (parse failed, or the pubid
|
|
62
|
+
# gem is unavailable), so ItemData#to_all_parts and
|
|
63
|
+
# #to_most_recent_reference never raise on 3GPP items.
|
|
64
|
+
|
|
65
|
+
def remove_part!
|
|
66
|
+
clear_attrs! :parts
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def remove_date!
|
|
70
|
+
clear_attrs! :release, :version
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def to_all_parts!
|
|
74
|
+
return if !@pubid || @pubid.all_parts?
|
|
75
|
+
|
|
76
|
+
# `#exclude` (no args) rebuilds a full independent copy — `remove_part!`
|
|
77
|
+
# / `remove_date!` mutate `@pubid` in place, so a bare reference here
|
|
78
|
+
# would lose the original part/version to that mutation too.
|
|
79
|
+
original = @pubid.exclude
|
|
80
|
+
remove_part!
|
|
81
|
+
remove_date!
|
|
82
|
+
@pubid = original.to_all_parts
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
private
|
|
86
|
+
|
|
87
|
+
def clear_attrs!(*attrs)
|
|
88
|
+
return unless @pubid
|
|
89
|
+
|
|
90
|
+
cleared = attrs.select { |attr| @pubid.respond_to?("#{attr}=") }
|
|
91
|
+
return if cleared.empty?
|
|
92
|
+
|
|
93
|
+
# `parts` is a collection: empty it rather than nil it, so #code keeps
|
|
94
|
+
# rendering through `parts.map` instead of tripping over nil.
|
|
95
|
+
cleared.each do |attr|
|
|
96
|
+
@pubid.public_send("#{attr}=", attr == :parts ? [] : nil)
|
|
97
|
+
end
|
|
98
|
+
refresh_content!
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def refresh_content!
|
|
102
|
+
store_content(render(@pubid)) if @pubid
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# `Pubid::Tgpp::Identifier#to_s` defaults to OMITTING the "3GPP " token —
|
|
106
|
+
# deliberately, so it reproduces the index id. The stored docidentifier
|
|
107
|
+
# content carries the prefix ("3GPP TS 23.207:REL-4/4.0.0"), so every
|
|
108
|
+
# render here must opt back in or a mutation would silently strip it.
|
|
109
|
+
def render(pubid)
|
|
110
|
+
pubid.to_s(with_publisher: true)
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require_relative "doctype"
|
|
2
|
+
require_relative "release"
|
|
3
|
+
|
|
4
|
+
module Relaton
|
|
5
|
+
module ThreeGpp
|
|
6
|
+
class Ext < Bib::Ext
|
|
7
|
+
attribute :doctype, Doctype
|
|
8
|
+
attribute :release, Release
|
|
9
|
+
attribute :subdoctype, :string, values: %w[spec release]
|
|
10
|
+
attribute :radiotechnology, :string, values: %w[2G 3G LTE 5G]
|
|
11
|
+
attribute :common_ims_spec, :boolean
|
|
12
|
+
attribute :internal, :boolean
|
|
13
|
+
|
|
14
|
+
def get_schema_version = Relaton.schema_versions["relaton-model-3gpp"]
|
|
15
|
+
|
|
16
|
+
xml do
|
|
17
|
+
map_element "radiotechnology", to: :radiotechnology
|
|
18
|
+
map_element "common-ims-spec", to: :common_ims_spec
|
|
19
|
+
map_element "internal", to: :internal
|
|
20
|
+
map_element "release", to: :release
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
key_value do
|
|
24
|
+
map_element "radiotechnology", to: :radiotechnology
|
|
25
|
+
map_element "common_ims_spec", to: :common_ims_spec
|
|
26
|
+
map_element "internal", to: :internal
|
|
27
|
+
map_element "release", to: :release
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require_relative "item_data"
|
|
2
|
+
require_relative "ext"
|
|
3
|
+
require_relative "docidentifier"
|
|
4
|
+
|
|
5
|
+
module Relaton
|
|
6
|
+
module ThreeGpp
|
|
7
|
+
class Item < Bib::Item
|
|
8
|
+
model ItemData
|
|
9
|
+
|
|
10
|
+
attribute :ext, Ext
|
|
11
|
+
# Shadow the Bib::Docidentifier declaration in Bib::ItemShared so items
|
|
12
|
+
# carry the pubid-backed 3GPP identifier. Bibitem and Bibdata subclass
|
|
13
|
+
# Item, so this one declaration covers all three.
|
|
14
|
+
attribute :docidentifier, Docidentifier, collection: true,
|
|
15
|
+
initialize_empty: true
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module ThreeGpp
|
|
3
|
+
class ItemData < Bib::ItemData
|
|
4
|
+
def create_id(without_date: false)
|
|
5
|
+
return id if id && !id.empty?
|
|
6
|
+
|
|
7
|
+
docid = find_primary_docid
|
|
8
|
+
return unless docid
|
|
9
|
+
|
|
10
|
+
pubid = without_date ? docid.content.sub(/:\d{4}$/, "") : docid.content
|
|
11
|
+
self.id = pubid.to_s.sub(/\A3GPP\s+/, "").gsub(/\W+/, "")
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|