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,97 @@
|
|
|
1
|
+
require "net/http"
|
|
2
|
+
|
|
3
|
+
module Relaton
|
|
4
|
+
module Jcgm
|
|
5
|
+
# Retrieval for JCGM (Joint Committee for Guides in Metrology) publications.
|
|
6
|
+
# Index-backed (no scraping): the reference is parsed with `Pubid::Jcgm`,
|
|
7
|
+
# matched against the pre-built index (whose rows are `Pubid::Jcgm::Identifier`
|
|
8
|
+
# hashes, deserialized via `pubid_class`), and the matching per-document YAML
|
|
9
|
+
# is fetched from the `relaton/relaton-data-jcgm` GitHub repo.
|
|
10
|
+
module Bibliography
|
|
11
|
+
ENDPOINT = "https://raw.githubusercontent.com/relaton/relaton-data-jcgm/main/".freeze
|
|
12
|
+
|
|
13
|
+
class << self
|
|
14
|
+
#
|
|
15
|
+
# Search for a JCGM publication by its identifier.
|
|
16
|
+
#
|
|
17
|
+
# @param text [String, Pubid::Jcgm::Identifier] e.g. "JCGM 200:2012" or
|
|
18
|
+
# "JCGM 17th Meeting (2012)"
|
|
19
|
+
# @param year [String, nil] edition year (optional; may be embedded)
|
|
20
|
+
# @param _opts [Hash] options (unused)
|
|
21
|
+
#
|
|
22
|
+
# @return [Relaton::Jcgm::Item, nil]
|
|
23
|
+
#
|
|
24
|
+
def search(text, year = nil, _opts = {}) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
|
25
|
+
pubid = parse_ref(text)
|
|
26
|
+
Util.info "Fetching from Relaton repository ...", key: pubid.to_s
|
|
27
|
+
row = index.search(pubid) { |r| pubid_match?(r[:id], pubid, year) }
|
|
28
|
+
.max_by { |r| r[:id].year.to_i }
|
|
29
|
+
unless row
|
|
30
|
+
Util.info "Not found.", key: pubid.to_s
|
|
31
|
+
return
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
uri = URI("#{ENDPOINT}#{row[:file]}")
|
|
35
|
+
resp = Net::HTTP.get_response uri
|
|
36
|
+
unless resp.code == "200"
|
|
37
|
+
raise Relaton::RequestError, "Could not access #{uri}: HTTP #{resp.code}"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
item = Relaton::Jcgm::Item.from_yaml resp.body
|
|
41
|
+
Util.info "Found: `#{item.docidentifier.first&.content}`", key: pubid.to_s
|
|
42
|
+
item.tap { |i| i.fetched = Date.today.to_s }
|
|
43
|
+
rescue SocketError, Errno::EINVAL, Errno::ECONNRESET, EOFError,
|
|
44
|
+
Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError,
|
|
45
|
+
Net::ProtocolError, Net::ReadTimeout, OpenSSL::SSL::SSLError,
|
|
46
|
+
Errno::ETIMEDOUT => e
|
|
47
|
+
raise Relaton::RequestError, "Could not access #{uri}: #{e.message}"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# @see #search
|
|
51
|
+
def get(ref, year = nil, opts = {})
|
|
52
|
+
search(ref, year, opts)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
private
|
|
56
|
+
|
|
57
|
+
# Parse a reference into a Pubid::Jcgm identifier. An unrecognized
|
|
58
|
+
# reference raises; like ISO and 3GPP we let it propagate --
|
|
59
|
+
# relaton-cli rescues Pubid::Errors::Error and renders "... is not a
|
|
60
|
+
# recognized standards identifier". The `search` rescue lists transport
|
|
61
|
+
# errors only, so it does not swallow the parse error.
|
|
62
|
+
def parse_ref(text)
|
|
63
|
+
return text unless text.is_a?(String)
|
|
64
|
+
|
|
65
|
+
::Pubid::Jcgm.parse(text)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def index
|
|
69
|
+
Relaton::Index.find_or_create(
|
|
70
|
+
:jcgm,
|
|
71
|
+
url: "#{ENDPOINT}#{INDEXFILE}.zip",
|
|
72
|
+
file: "#{INDEXFILE}.yaml",
|
|
73
|
+
pubid_class: ::Pubid::Jcgm::Identifier,
|
|
74
|
+
)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# `row_id` and `query` are both `Pubid::Jcgm::Identifier` instances.
|
|
78
|
+
# Matching is pubid's asymmetric subset match (`Pubid::SubsetMatch`):
|
|
79
|
+
# the reference on the left, the row on the right, and a component the
|
|
80
|
+
# reference omits matches any value. Guides distinguish editions by year
|
|
81
|
+
# (`JCGM 200:2008` vs `:2012`), so a reference without a year reaches
|
|
82
|
+
# both and the latest edition is picked by `max_by` in #search. Meetings
|
|
83
|
+
# distinguish by number (`17th` vs `18th`), which the reference states,
|
|
84
|
+
# so they never collapse together. The type is the identifier's class,
|
|
85
|
+
# and `===` requires the same class, so cross-type collisions cannot
|
|
86
|
+
# occur. The `year` argument lets a caller pin an edition the reference
|
|
87
|
+
# string omitted; a year the reference states is compared by `===`
|
|
88
|
+
# itself.
|
|
89
|
+
def pubid_match?(row_id, query, year)
|
|
90
|
+
wanted_year = (query.year || year)&.to_s
|
|
91
|
+
query === row_id &&
|
|
92
|
+
(wanted_year.nil? || row_id.year.to_s == wanted_year)
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
require_relative "../jcgm"
|
|
2
|
+
require_relative "meetings_parser"
|
|
3
|
+
|
|
4
|
+
module Relaton::Jcgm
|
|
5
|
+
# Harvests the JCGM **meeting proceedings** from the `jcgm/meetings-{en,fr}`
|
|
6
|
+
# dirs of a local checkout of metanorma/bipm-data-outcomes, writing one Relaton
|
|
7
|
+
# YAML per meeting and indexing each by its `Pubid::Jcgm` identifier.
|
|
8
|
+
#
|
|
9
|
+
# The curated guide/GUM/VIM records are **not** harvested here: they are
|
|
10
|
+
# hand-maintained YAMLs that live in the data repo's own `static/` dir, so the
|
|
11
|
+
# data repo's `crawler.rb` indexes them (like relaton-data-bipm's crawler does)
|
|
12
|
+
# by looping `static/**` and calling the public, guarded {#add_to_index} —
|
|
13
|
+
# keeping the "which static files" policy in the data repo while the guarded,
|
|
14
|
+
# sorted, `_type: pubid:jcgm:*` indexing mechanism stays here.
|
|
15
|
+
class DataFetcher < Relaton::Core::DataFetcher
|
|
16
|
+
attr_reader :output, :format, :ext, :files, :errors
|
|
17
|
+
|
|
18
|
+
def index
|
|
19
|
+
@index ||= Relaton::Index.find_or_create(
|
|
20
|
+
:jcgm, file: "#{INDEXFILE}.yaml", pubid_class: ::Pubid::Jcgm::Identifier
|
|
21
|
+
)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def log_error(msg) = Util.error msg
|
|
25
|
+
|
|
26
|
+
#
|
|
27
|
+
# @param [String] source dataset name ("bipm-data-outcomes")
|
|
28
|
+
#
|
|
29
|
+
def fetch(source)
|
|
30
|
+
MeetingsParser.parse(self) if source == "bipm-data-outcomes"
|
|
31
|
+
index.save
|
|
32
|
+
report_errors
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
#
|
|
36
|
+
# Save document to file
|
|
37
|
+
#
|
|
38
|
+
# @param [String] path Path to file
|
|
39
|
+
# @param [Relaton::Jcgm::ItemData] item document to save
|
|
40
|
+
# @param [Boolean, nil] warn_duplicate Warn if document already exists
|
|
41
|
+
#
|
|
42
|
+
def write_file(path, item, warn_duplicate: true)
|
|
43
|
+
content = serialize item
|
|
44
|
+
if @files.include?(path)
|
|
45
|
+
Util.warn "File #{path} already exists" if warn_duplicate
|
|
46
|
+
else
|
|
47
|
+
@files << path
|
|
48
|
+
end
|
|
49
|
+
File.write path, content, encoding: "UTF-8"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
#
|
|
53
|
+
# Index a document by its pubid. Guarded defensively: a docnumber the
|
|
54
|
+
# `Pubid::Jcgm` grammar can't parse is skipped with a warning rather than
|
|
55
|
+
# allowed to corrupt the whole index (`Relaton::Index` rejects an index if a
|
|
56
|
+
# single row fails to deserialize). All current JCGM records parse on pubid
|
|
57
|
+
# main; the guard protects against a future malformed record.
|
|
58
|
+
#
|
|
59
|
+
# Public so the data repo's crawler can index its curated `static/` guides
|
|
60
|
+
# through the same guarded, sorted, pubid-backed path the meetings use.
|
|
61
|
+
#
|
|
62
|
+
# @param [String] docnumber the record's docnumber (e.g. "JCGM 17th Meeting (2012)")
|
|
63
|
+
# @param [String] path repo-relative path to the YAML file
|
|
64
|
+
#
|
|
65
|
+
def add_to_index(docnumber, path)
|
|
66
|
+
# Store the Pubid::Jcgm identifier object (not its hash): with pubid_class
|
|
67
|
+
# set, Relaton::Index then sorts the index by id number on save and
|
|
68
|
+
# serializes each id to its `_type: pubid:jcgm:*` hash, so the published
|
|
69
|
+
# index is already sorted (no "not sorted by id number" warning on fetch).
|
|
70
|
+
index.add_or_update ::Pubid::Jcgm.parse(docnumber), path
|
|
71
|
+
rescue StandardError => e
|
|
72
|
+
Util.warn "Skipping index entry for `#{docnumber}` (#{path}): #{e.message}"
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def to_xml(item) = item.to_xml bibdata: true
|
|
76
|
+
|
|
77
|
+
def to_yaml(item) = item.to_yaml
|
|
78
|
+
|
|
79
|
+
def to_bibxml(item) = item.to_rfcxml
|
|
80
|
+
end
|
|
81
|
+
end
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Jcgm
|
|
3
|
+
# A JCGM document identifier, backed by `Pubid::Jcgm` (mirrors OIML's
|
|
4
|
+
# pubid-backed Docidentifier). Parsing is best-effort: forms pubid doesn't
|
|
5
|
+
# recognise (e.g. the combined bilingual docidentifiers and the French
|
|
6
|
+
# `réunion` form) leave `pubid` nil via the `content=` rescue rather than
|
|
7
|
+
# raising during deserialization.
|
|
8
|
+
class Docidentifier < Bib::Docidentifier
|
|
9
|
+
attr_reader :pubid
|
|
10
|
+
|
|
11
|
+
# Capture the inherited content setter before overriding #content=, so
|
|
12
|
+
# #refresh_content! can write the re-rendered string back WITHOUT
|
|
13
|
+
# re-parsing (a re-parse would rebuild @pubid from the string, which may
|
|
14
|
+
# not even parse back — e.g. an all-parts wrapper's own "(all parts)"
|
|
15
|
+
# rendering — and would discard whatever mutation was just made).
|
|
16
|
+
alias_method :store_content, :content=
|
|
17
|
+
|
|
18
|
+
def initialize(attrs = {}, options = {})
|
|
19
|
+
pubid = attrs.is_a?(Hash) ? attrs.delete(:pubid) : nil
|
|
20
|
+
attrs[:content] ||= pubid.to_s if pubid
|
|
21
|
+
super
|
|
22
|
+
@pubid = pubid if pubid
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def content=(value)
|
|
26
|
+
super
|
|
27
|
+
@pubid = ::Pubid::Jcgm.parse(value) if value
|
|
28
|
+
rescue StandardError
|
|
29
|
+
@pubid = nil
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# The class carried `#pubid` but none of `Bib::Docidentifier`'s abstract
|
|
33
|
+
# `remove_part!` / `remove_date!` / `to_all_parts!`, so it looked migrated
|
|
34
|
+
# while still raising `NotImplementedError` on every JCGM item through
|
|
35
|
+
# `Bib::ItemData#to_all_parts` / `#to_most_recent_reference` — and
|
|
36
|
+
# `NotImplementedError` descends from `ScriptError`, so a caller's
|
|
37
|
+
# `rescue => e` did not catch it.
|
|
38
|
+
#
|
|
39
|
+
# `Pubid::Jcgm` keeps the publication date in `date` (a
|
|
40
|
+
# `Components::Date`, unlike EASC's and GOST's plain `year`), so
|
|
41
|
+
# `remove_date!` clears that: `JCGM 100:2008` -> `JCGM 100`. `part` and
|
|
42
|
+
# `subpart` come from the pubid base class and are unused by JCGM today,
|
|
43
|
+
# so `remove_part!` is a no-op for the rendered string — implemented so it
|
|
44
|
+
# never raises.
|
|
45
|
+
#
|
|
46
|
+
# The mutation is applied to the identifier **and to its `#root`**. A
|
|
47
|
+
# supplement/corrigendum wraps the document it amends in `base`, and it
|
|
48
|
+
# exposes its own `date=` while carrying nil there — the year lives on the
|
|
49
|
+
# base. Clearing only the wrapper is therefore a silent no-op:
|
|
50
|
+
# `JCGM 200:2008 Corrigendum` keeps its 2008. Clearing the root as well
|
|
51
|
+
# gives `JCGM 200 Corrigendum`. `#root` is the same accessor
|
|
52
|
+
# `Relaton::Index::Type#candidates_by_number` narrows on, so the two stay
|
|
53
|
+
# consistent.
|
|
54
|
+
#
|
|
55
|
+
# Every write is guarded by `respond_to?`, and all three no-op when
|
|
56
|
+
# `@pubid` is nil — the common case the `content=` rescue exists for (the
|
|
57
|
+
# combined bilingual docidentifiers and the French `réunion` form).
|
|
58
|
+
|
|
59
|
+
def remove_part!
|
|
60
|
+
clear_attr!(:part)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def remove_date!
|
|
64
|
+
clear_attr!(:date)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def to_all_parts!
|
|
68
|
+
return if !@pubid || @pubid.all_parts?
|
|
69
|
+
|
|
70
|
+
# `#exclude` (no args) rebuilds a full independent copy, including
|
|
71
|
+
# the `#root` of a supplement/corrigendum — `remove_part!`/
|
|
72
|
+
# `remove_date!` mutate BOTH `@pubid` and its root in place (see
|
|
73
|
+
# `clear_attr!`), so even a shallow `.dup` would still lose the
|
|
74
|
+
# original date to that mutation.
|
|
75
|
+
original = @pubid.exclude
|
|
76
|
+
remove_part!
|
|
77
|
+
remove_date!
|
|
78
|
+
@pubid = original.to_all_parts
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
private
|
|
82
|
+
|
|
83
|
+
def clear_attr!(attr)
|
|
84
|
+
return unless @pubid
|
|
85
|
+
|
|
86
|
+
targets = [@pubid]
|
|
87
|
+
targets << @pubid.root if @pubid.respond_to?(:root) && !@pubid.root.equal?(@pubid)
|
|
88
|
+
targets.each do |id|
|
|
89
|
+
next unless id.respond_to?("#{attr}=")
|
|
90
|
+
|
|
91
|
+
id.public_send("#{attr}=", nil)
|
|
92
|
+
id.subpart = nil if attr == :part && id.respond_to?(:subpart=)
|
|
93
|
+
end
|
|
94
|
+
refresh_content!
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def refresh_content!
|
|
98
|
+
store_content(@pubid.to_s) if @pubid
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Jcgm
|
|
3
|
+
# JCGM document types. Meetings are `meeting-report`; the guides/GUM/VIM
|
|
4
|
+
# records carry `international-standard` (the shape they were filed with
|
|
5
|
+
# under BIPM). The list is intentionally not enforced as an enum so any
|
|
6
|
+
# unforeseen dataset value still round-trips (mirrors OIML's Doctype).
|
|
7
|
+
class Doctype < Bib::Doctype
|
|
8
|
+
TYPES = %w[meeting-report guide international-standard vocabulary
|
|
9
|
+
monographie rapport].freeze
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require_relative "doctype"
|
|
2
|
+
require_relative "structured_identifier"
|
|
3
|
+
|
|
4
|
+
module Relaton
|
|
5
|
+
module Jcgm
|
|
6
|
+
# JCGM bibliographic item extension. JCGM records are BIPM-shaped, so this
|
|
7
|
+
# mirrors `Relaton::Bipm::Ext`: a JCGM `Doctype` and a single
|
|
8
|
+
# `structuredidentifier` (overriding the base collection). `flavor`,
|
|
9
|
+
# `schema_version`, `subdoctype`, `ics` come from the shared `Bib::Ext`.
|
|
10
|
+
class Ext < Bib::Ext
|
|
11
|
+
attribute :doctype, Doctype
|
|
12
|
+
attribute :structuredidentifier, StructuredIdentifier
|
|
13
|
+
|
|
14
|
+
xml do
|
|
15
|
+
map_element "structuredidentifier", to: :structuredidentifier
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
key_value do
|
|
19
|
+
map_element "structuredidentifier", to: :structuredidentifier
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require_relative "item_data"
|
|
2
|
+
require_relative "ext"
|
|
3
|
+
require_relative "docidentifier"
|
|
4
|
+
|
|
5
|
+
module Relaton
|
|
6
|
+
module Jcgm
|
|
7
|
+
class Item < Bib::Item
|
|
8
|
+
model ItemData
|
|
9
|
+
|
|
10
|
+
attribute :ext, Ext
|
|
11
|
+
attribute :docidentifier, Docidentifier, collection: true,
|
|
12
|
+
initialize_empty: true
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
require_relative "relation"
|
|
18
|
+
|
|
19
|
+
Relaton::Jcgm::Item.attribute :relation, Relaton::Jcgm::Relation,
|
|
20
|
+
collection: true, initialize_empty: true
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Jcgm
|
|
3
|
+
class ItemBase < Lutaml::Model::Serializable
|
|
4
|
+
include Bib::NamespaceHelper
|
|
5
|
+
|
|
6
|
+
attr_accessor :type
|
|
7
|
+
|
|
8
|
+
model ItemData
|
|
9
|
+
|
|
10
|
+
instance_exec(&Bib::ItemShared::ATTRIBUTES)
|
|
11
|
+
|
|
12
|
+
xml do
|
|
13
|
+
map_attribute "type", to: :type
|
|
14
|
+
instance_exec(&Bib::ItemShared::XML_BODY)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
require "fileutils"
|
|
2
|
+
require "yaml"
|
|
3
|
+
require "date"
|
|
4
|
+
|
|
5
|
+
module Relaton::Jcgm
|
|
6
|
+
# Harvests JCGM meeting proceedings from the `jcgm/meetings-{en,fr}` dirs of a
|
|
7
|
+
# local checkout of metanorma/bipm-data-outcomes and writes one Relaton YAML
|
|
8
|
+
# per meeting into `<output>/jcgm/meeting/<num>.yaml`, indexing each by its
|
|
9
|
+
# `Pubid::Jcgm` meeting identifier.
|
|
10
|
+
#
|
|
11
|
+
# This is the JCGM-only slice of `Relaton::Bipm::DataOutcomesParser`: JCGM
|
|
12
|
+
# meetings carry no sub-resolutions and no parts, so the resolution/part
|
|
13
|
+
# machinery is dropped. The meeting docnumber's ordinal ("11st"/"12nd"/"13rd"
|
|
14
|
+
# — a naive last-digit rule with no teens exception) is delegated to
|
|
15
|
+
# `Pubid::Jcgm::Identifiers::Meeting.ordinal`, the single source of truth, so
|
|
16
|
+
# the printed form round-trips through pubid.
|
|
17
|
+
class MeetingsParser
|
|
18
|
+
SOURCE_ROOT = "bipm-data-outcomes".freeze
|
|
19
|
+
BODY = "JCGM".freeze
|
|
20
|
+
GH_SRC = "https://raw.githubusercontent.com/metanorma/bipm-data-outcomes/".freeze
|
|
21
|
+
|
|
22
|
+
def self.parse(data_fetcher)
|
|
23
|
+
new(data_fetcher).parse
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def initialize(data_fetcher)
|
|
27
|
+
@data_fetcher = data_fetcher
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def parse
|
|
31
|
+
Dir[File.join(SOURCE_ROOT, "jcgm", "meetings-en", "*.{yml,yaml}")].sort.each do |en_file|
|
|
32
|
+
fetch_meeting en_file
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
private
|
|
37
|
+
|
|
38
|
+
def fetch_meeting(en_file)
|
|
39
|
+
en, fr, fr_file = read_files en_file
|
|
40
|
+
md_en = en["metadata"]
|
|
41
|
+
md_fr = fr && fr["metadata"]
|
|
42
|
+
num = md_en["identifier"].to_s
|
|
43
|
+
date = md_en["date"].to_s
|
|
44
|
+
docnum = meeting_docnum num, date
|
|
45
|
+
id = "JCGMMeeting#{num}#{::Date.parse(date).year}"
|
|
46
|
+
|
|
47
|
+
outdir = File.join @data_fetcher.output, "jcgm", "meeting"
|
|
48
|
+
FileUtils.mkdir_p outdir
|
|
49
|
+
path = File.join outdir, "#{num}.#{@data_fetcher.ext}"
|
|
50
|
+
|
|
51
|
+
item = ItemData.new(**meeting_hash(md_en, md_fr, num, id, docnum,
|
|
52
|
+
meeting_links(en_file, fr_file), en["pdf"]))
|
|
53
|
+
@data_fetcher.write_file path, item
|
|
54
|
+
@data_fetcher.add_to_index docnum, path
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Read English + French metadata (the French file mirrors the path with
|
|
58
|
+
# `en` -> `fr`). `Date`/`Time` are permitted because the source may write
|
|
59
|
+
# an unquoted `date:` scalar; the date is coerced to a string downstream.
|
|
60
|
+
def read_files(en_file)
|
|
61
|
+
fr_file = en_file.sub "en", "fr"
|
|
62
|
+
en = load_yaml en_file
|
|
63
|
+
fr = File.exist?(fr_file) ? load_yaml(fr_file) : nil
|
|
64
|
+
[en, fr, (fr && fr_file)]
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def load_yaml(file)
|
|
68
|
+
YAML.safe_load File.read(file, encoding: "UTF-8"), permitted_classes: [Date, Time]
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# "JCGM 17th Meeting (2012)" — ordinal via pubid's Meeting.ordinal.
|
|
72
|
+
def meeting_docnum(num, date)
|
|
73
|
+
year = ::Date.parse(date).year
|
|
74
|
+
"#{BODY} #{::Pubid::Jcgm::Identifiers::Meeting.ordinal(num)} Meeting (#{year})"
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def meeting_hash(md_en, md_fr, num, id, docnum, src, pdf) # rubocop:disable Metrics/MethodLength
|
|
78
|
+
{
|
|
79
|
+
id: id,
|
|
80
|
+
type: "proceedings",
|
|
81
|
+
title: titles(md_en, md_fr),
|
|
82
|
+
place: [Relaton::Bib::Place.new(city: "Paris")],
|
|
83
|
+
date: date(md_en["date"]),
|
|
84
|
+
docidentifier: docids(docnum),
|
|
85
|
+
docnumber: docnum,
|
|
86
|
+
source: links(md_en, md_fr, src, pdf),
|
|
87
|
+
language: %w[en fr],
|
|
88
|
+
script: ["Latn"],
|
|
89
|
+
contributor: [bipm_contrib],
|
|
90
|
+
ext: ext(num),
|
|
91
|
+
}
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def titles(md_en, md_fr)
|
|
95
|
+
result = []
|
|
96
|
+
result << title(md_en["title"], "en") if md_en && md_en["title"]
|
|
97
|
+
result << title(md_fr["title"], "fr") if md_fr && md_fr["title"]
|
|
98
|
+
result
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def title(content, language)
|
|
102
|
+
content = content.dup
|
|
103
|
+
content.sub!(/(\d+)(e)/, '\1<sup>\2</sup>') if language == "fr"
|
|
104
|
+
Relaton::Bib::Title.new(content: content, language: language, script: "Latn")
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def date(at)
|
|
108
|
+
at = at.to_s
|
|
109
|
+
return [] if at.empty?
|
|
110
|
+
|
|
111
|
+
[Relaton::Bib::Date.new(type: "published", at: at)]
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# en: "JCGM 17th Meeting (2012)"; fr: "JCGM 17<sup>e</sup> réunion (2012)";
|
|
115
|
+
# plus the combined "en / fr" form (mirrors BIPM's create_meeting_docids).
|
|
116
|
+
def docids(en_id)
|
|
117
|
+
fr_id = en_id.sub(/(\d+)(?:st|nd|rd|th)/, '\1e').sub("Meeting", "réunion")
|
|
118
|
+
fr_id_sup = fr_id.sub(/(\d+)(e)/, '\1<sup>\2</sup>')
|
|
119
|
+
[
|
|
120
|
+
docid(en_id, language: "en"),
|
|
121
|
+
docid(fr_id_sup, language: "fr"),
|
|
122
|
+
docid("#{en_id} / #{fr_id_sup}"),
|
|
123
|
+
]
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def docid(content, language: nil)
|
|
127
|
+
attrs = { content: content, type: "BIPM", primary: true }
|
|
128
|
+
attrs.merge!(language: language, script: "Latn") if language
|
|
129
|
+
Docidentifier.new(**attrs)
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def links(md_en, md_fr, src, pdf)
|
|
133
|
+
links = []
|
|
134
|
+
links << uri("citation", md_en["url"], "en") if md_en && md_en["url"]
|
|
135
|
+
links << uri("citation", md_fr["url"], "fr") if md_fr && md_fr["url"]
|
|
136
|
+
Array(pdf).each { |p| links << Relaton::Bib::Uri.new(type: "pdf", content: p) }
|
|
137
|
+
links + Array(src)
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def uri(type, content, language)
|
|
141
|
+
Relaton::Bib::Uri.new(type: type, content: content, language: language, script: "Latn")
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# en/fr `src` links back to the source files in bipm-data-outcomes.
|
|
145
|
+
def meeting_links(en_file, fr_file)
|
|
146
|
+
{ "en" => en_file, "fr" => fr_file }.filter_map do |lang, file|
|
|
147
|
+
next unless file
|
|
148
|
+
|
|
149
|
+
src = GH_SRC + file.split("/")[-3..].unshift("main").join("/")
|
|
150
|
+
Relaton::Bib::Uri.new(type: "src", content: src, language: lang, script: "Latn")
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def ext(num)
|
|
155
|
+
Ext.new(doctype: Doctype.new(content: "meeting-report"),
|
|
156
|
+
structuredidentifier: StructuredIdentifier.new(docnumber: num))
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def bipm_contrib
|
|
160
|
+
names = [
|
|
161
|
+
Relaton::Bib::TypedLocalizedString.new(content: "International Bureau of Weights and Measures", language: "en", script: "Latn"),
|
|
162
|
+
Relaton::Bib::TypedLocalizedString.new(content: "Bureau international des poids et mesures", language: "fr", script: "Latn"),
|
|
163
|
+
]
|
|
164
|
+
org = Relaton::Bib::Organization.new(
|
|
165
|
+
name: names,
|
|
166
|
+
abbreviation: Relaton::Bib::LocalizedString.new(content: "BIPM", language: "fr", script: "Latn"),
|
|
167
|
+
uri: [Relaton::Bib::Uri.new(content: "www.bipm.org")],
|
|
168
|
+
)
|
|
169
|
+
Relaton::Bib::Contributor.new(
|
|
170
|
+
organization: org,
|
|
171
|
+
role: [Relaton::Bib::Contributor::Role.new(type: "publisher")],
|
|
172
|
+
)
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
end
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
require "relaton/core/processor"
|
|
2
|
+
|
|
3
|
+
module Relaton
|
|
4
|
+
module Jcgm
|
|
5
|
+
class Processor < Core::Processor
|
|
6
|
+
attr_reader :idtype
|
|
7
|
+
|
|
8
|
+
def initialize
|
|
9
|
+
@short = :relaton_jcgm
|
|
10
|
+
@prefix = "JCGM"
|
|
11
|
+
@defaultprefix = %r{^JCGM\s}
|
|
12
|
+
@idtype = "JCGM"
|
|
13
|
+
@datasets = %w[bipm-data-outcomes]
|
|
14
|
+
# Prefixes come from pubid (Pubid::Jcgm.prefixes => ["JCGM"]); see
|
|
15
|
+
# Core::Processor#prefixes.
|
|
16
|
+
@pubid_flavor = :Jcgm
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# @param code [String]
|
|
20
|
+
# @param date [String, nil] year
|
|
21
|
+
# @param opts [Hash]
|
|
22
|
+
# @return [Relaton::Jcgm::ItemData, nil]
|
|
23
|
+
def get(code, date, opts)
|
|
24
|
+
require_relative "../jcgm"
|
|
25
|
+
Bibliography.get(code, date, opts)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
#
|
|
29
|
+
# Harvest the JCGM meeting proceedings from metanorma/bipm-data-outcomes.
|
|
30
|
+
# Used to (re)generate the relaton-data-jcgm repo; the curated static guides
|
|
31
|
+
# are indexed by that repo's crawler via DataFetcher#add_to_index.
|
|
32
|
+
#
|
|
33
|
+
# @param [String] source source name ("bipm-data-outcomes")
|
|
34
|
+
# @param [Hash] opts
|
|
35
|
+
#
|
|
36
|
+
def fetch_data(source, opts)
|
|
37
|
+
require_relative "data_fetcher"
|
|
38
|
+
DataFetcher.fetch(source, **opts)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# @param xml [String]
|
|
42
|
+
# @return [Relaton::Jcgm::ItemData]
|
|
43
|
+
def from_xml(xml)
|
|
44
|
+
require_relative "../jcgm"
|
|
45
|
+
Item.from_xml xml
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# @param yaml [String]
|
|
49
|
+
# @return [Relaton::Jcgm::ItemData]
|
|
50
|
+
def from_yaml(yaml)
|
|
51
|
+
require_relative "../jcgm"
|
|
52
|
+
Item.from_yaml yaml
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Returns hash of XML grammar
|
|
56
|
+
# @return [String]
|
|
57
|
+
def grammar_hash
|
|
58
|
+
require_relative "../jcgm"
|
|
59
|
+
@grammar_hash ||= ::Relaton::Jcgm.grammar_hash
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
#
|
|
63
|
+
# Remove index file
|
|
64
|
+
#
|
|
65
|
+
def remove_index_file
|
|
66
|
+
require_relative "../jcgm"
|
|
67
|
+
Relaton::Index.find_or_create(:jcgm, url: true, file: "#{INDEXFILE}.yaml").remove_file
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Jcgm
|
|
3
|
+
# A single structured identifier (e.g. `{ docnumber: "17" }`). JCGM records
|
|
4
|
+
# carry this as a single mapping, not a sequence, so it overrides the base
|
|
5
|
+
# `Bib::Ext#structuredidentifier` collection (mirrors BIPM's model).
|
|
6
|
+
class StructuredIdentifier < Lutaml::Model::Serializable
|
|
7
|
+
attribute :docnumber, :string
|
|
8
|
+
attribute :part, :string
|
|
9
|
+
attribute :appendix, :string
|
|
10
|
+
|
|
11
|
+
xml do
|
|
12
|
+
map_element "docnumber", to: :docnumber
|
|
13
|
+
map_element "part", to: :part
|
|
14
|
+
map_element "appendix", to: :appendix
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# `Bib::ItemData#ext_to_all_parts!` / `#ext_remove_date` broadcast to
|
|
18
|
+
# `ext.structuredidentifier` just as they do to `docidentifier`, so these
|
|
19
|
+
# three are as required here as on the docidentifier. This class descends
|
|
20
|
+
# from `Lutaml::Model::Serializable` rather than `Bib::StructuredIdentifier`
|
|
21
|
+
# (JCGM stores a single mapping, not a sequence), so the methods were not
|
|
22
|
+
# merely unimplemented — they were absent, and the broadcast raised
|
|
23
|
+
# `NoMethodError` on every JCGM item.
|
|
24
|
+
#
|
|
25
|
+
# JCGM structured identifiers carry no date field, so `remove_date!` has
|
|
26
|
+
# nothing to strip and is a deliberate no-op; the year lives on the
|
|
27
|
+
# docidentifier's pubid, which `Docidentifier#remove_date!` handles.
|
|
28
|
+
|
|
29
|
+
def remove_part!
|
|
30
|
+
self.part = nil
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def remove_date!; end
|
|
34
|
+
|
|
35
|
+
def to_all_parts!
|
|
36
|
+
remove_part!
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|