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,162 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "English"
|
|
4
|
+
require "mechanize"
|
|
5
|
+
require "relaton/core"
|
|
6
|
+
require_relative "../ecma"
|
|
7
|
+
require_relative "parser_common"
|
|
8
|
+
require_relative "page_fetcher"
|
|
9
|
+
require_relative "standard_parser"
|
|
10
|
+
require_relative "memento_parser"
|
|
11
|
+
require_relative "edition_parser"
|
|
12
|
+
require_relative "data_parser"
|
|
13
|
+
|
|
14
|
+
module Relaton
|
|
15
|
+
module Ecma
|
|
16
|
+
class DataFetcher < Core::DataFetcher
|
|
17
|
+
URL = "https://www.ecma-international.org/publications-and-standards/"
|
|
18
|
+
SOURCES = %w[standards technical-reports mementos].freeze
|
|
19
|
+
|
|
20
|
+
def index
|
|
21
|
+
# `pubid_class:` on the producer too: FileIO#save only calls `to_hash`
|
|
22
|
+
# for instances of it, so without it the crawl writes v1-shaped rows
|
|
23
|
+
# under a v2 name, silently.
|
|
24
|
+
@index ||= Relaton::Index.find_or_create(
|
|
25
|
+
:ecma, file: "#{INDEXFILE}.yaml", pubid_class: ::Pubid::Ecma::Identifier
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def log_error(msg)
|
|
30
|
+
Util.error msg
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def agent
|
|
34
|
+
@agent ||= Mechanize.new.tap { |a| a.user_agent_alias = Mechanize::AGENT_ALIASES.keys.sample }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# @param bib [Relaton::Ecma::ItemData]
|
|
38
|
+
def write_file(bib)
|
|
39
|
+
# Two distinct ids can sanitize to one filename, in which case the
|
|
40
|
+
# second document used to be dropped outright. Give it a path of its
|
|
41
|
+
# own; a genuine duplicate (same id) still resolves to one path and is
|
|
42
|
+
# still skipped.
|
|
43
|
+
file = unique_output_file filename_id(bib)
|
|
44
|
+
# A reserved path only ever belongs to one id, so a hit here is the same
|
|
45
|
+
# document again. Checked FIRST: a disambiguated path stays != filename
|
|
46
|
+
# forever, so gating this on that comparison would make a repeat of a
|
|
47
|
+
# disambiguated id skip the skip and overwrite its own file.
|
|
48
|
+
if @files.include? file
|
|
49
|
+
Util.warn "Duplicate file #{file}"
|
|
50
|
+
return
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
Util.warn "Duplicate file #{filename bib}; writing #{file} instead" if file != filename(bib)
|
|
54
|
+
@files << file
|
|
55
|
+
File.write file, serialize(bib), encoding: "UTF-8"
|
|
56
|
+
add_to_index bib, file
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
#
|
|
60
|
+
# Index the document, or record why it could not be indexed.
|
|
61
|
+
#
|
|
62
|
+
# An id pubid cannot rebuild is recorded in `@errors` — the inherited
|
|
63
|
+
# `report_errors` logs a String value as the message, and its GhIssue
|
|
64
|
+
# channel opens a GitHub issue at the end of the crawl — and the row is
|
|
65
|
+
# skipped rather than indexed unparsed: `Relaton::Index` rejects the WHOLE
|
|
66
|
+
# index if a single row fails to deserialize, and its sort calls
|
|
67
|
+
# `.root.number` on every id. The data file is already written by the
|
|
68
|
+
# caller, so the document is unindexed, never lost. (The 3GPP/W3C shape.)
|
|
69
|
+
#
|
|
70
|
+
# @param bib [Relaton::Ecma::ItemData]
|
|
71
|
+
# @param file [String] path the document was written to
|
|
72
|
+
#
|
|
73
|
+
def add_to_index(bib, file)
|
|
74
|
+
id = index_id bib
|
|
75
|
+
return index.add_or_update(id, file) if id
|
|
76
|
+
|
|
77
|
+
docid = bib.docidentifier[0]&.content || file
|
|
78
|
+
@errors[docid.to_s] = "Unparseable primary id `#{docid}` was not indexed (#{file})"
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def filename(bib)
|
|
82
|
+
output_file filename_id(bib)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# The docid the filename is derived from.
|
|
86
|
+
def filename_id(bib)
|
|
87
|
+
id = bib.docidentifier[0].content
|
|
88
|
+
id += " #{bib.edition.content}" if bib.edition
|
|
89
|
+
locality = locality_with_volume bib
|
|
90
|
+
id += " #{locality.reference_from}" if locality
|
|
91
|
+
id
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
#
|
|
95
|
+
# The index key: a `Pubid::Ecma::Identifier` carrying the number, the
|
|
96
|
+
# edition and the volume.
|
|
97
|
+
#
|
|
98
|
+
# Built from the MODEL, never from a rendered string — the same three
|
|
99
|
+
# fields `#filename_id` reads — so the crawl cannot lose a component to a
|
|
100
|
+
# parse or to a render default. The base identifier is the docidentifier's
|
|
101
|
+
# own pubid, **duplicated** first: `edition` and `volume` are index
|
|
102
|
+
# metadata, and every `ECMA-269` volume file carries the bare
|
|
103
|
+
# `docidentifier: ECMA-269`, so setting them on the shared object would
|
|
104
|
+
# promote the document's own printed id to the index form.
|
|
105
|
+
#
|
|
106
|
+
# @param bib [Relaton::Ecma::ItemData]
|
|
107
|
+
# @return [Pubid::Ecma::Identifier, nil] nil if pubid rejects the docid
|
|
108
|
+
#
|
|
109
|
+
def index_id(bib)
|
|
110
|
+
pubid = bib.docidentifier[0]&.pubid&.dup
|
|
111
|
+
return unless pubid
|
|
112
|
+
|
|
113
|
+
pubid.edition = bib.edition.content if bib.edition
|
|
114
|
+
locality = locality_with_volume bib
|
|
115
|
+
pubid.volume = locality.reference_from if locality
|
|
116
|
+
pubid
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def locality_with_volume(bib)
|
|
120
|
+
bib.extent.each do |e|
|
|
121
|
+
locality = e.locality.find { |l| l.type == "volume" }
|
|
122
|
+
return locality if locality
|
|
123
|
+
end
|
|
124
|
+
nil
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def to_xml(bib) = bib.to_xml(bibdata: true)
|
|
128
|
+
def to_yaml(bib) = bib.to_yaml
|
|
129
|
+
def to_bibxml(bib) = bib.to_rfcxml
|
|
130
|
+
|
|
131
|
+
# @param hit [Nokogiri::XML::Element]
|
|
132
|
+
def parse_page(hit) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
|
133
|
+
DataParser.new(hit, @errors).parse.each { |item| write_file item }
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# @param type [String]
|
|
137
|
+
def html_index(type) # rubocop:disable Metrics/MethodLength
|
|
138
|
+
result = agent.get "#{URL}#{type}/"
|
|
139
|
+
# @last_call_time = Time.now
|
|
140
|
+
result.xpath(
|
|
141
|
+
"//li/span[1]/a",
|
|
142
|
+
"//div[contains(@class, 'entry-content-wrapper')][.//a[.='Download']]",
|
|
143
|
+
).each do |hit|
|
|
144
|
+
parse_page(hit)
|
|
145
|
+
rescue StandardError => e
|
|
146
|
+
Util.error { "#{e.message}\n#{e.backtrace}" }
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
#
|
|
151
|
+
# Fetch data from Ecma website.
|
|
152
|
+
#
|
|
153
|
+
# @return [void]
|
|
154
|
+
#
|
|
155
|
+
def fetch(_ = nil)
|
|
156
|
+
SOURCES.each { |source| html_index source }
|
|
157
|
+
index.save
|
|
158
|
+
report_errors
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Ecma
|
|
3
|
+
class DataParser
|
|
4
|
+
include ParserCommon
|
|
5
|
+
|
|
6
|
+
#
|
|
7
|
+
# Initialize parser
|
|
8
|
+
#
|
|
9
|
+
# @param [Nokogiri::XML::Element] hit document hit
|
|
10
|
+
# @param [Hash] errors error tracking hash
|
|
11
|
+
#
|
|
12
|
+
def initialize(hit, errors = {})
|
|
13
|
+
@hit = hit
|
|
14
|
+
@errors = errors
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# @return [Array<Relaton::Ecma::ItemData>]
|
|
18
|
+
def parse
|
|
19
|
+
if @hit[:href]
|
|
20
|
+
parse_standard
|
|
21
|
+
else
|
|
22
|
+
parse_memento
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
def parse_standard
|
|
29
|
+
doc = PageFetcher.new.get(@hit[:href])
|
|
30
|
+
parser = StandardParser.new(hit: @hit, doc: doc, errors: @errors)
|
|
31
|
+
bib = parser.to_bib_hash
|
|
32
|
+
bib[:contributor] = contributor
|
|
33
|
+
items = [ItemData.new(**bib)]
|
|
34
|
+
edition_parser = EditionParser.new(
|
|
35
|
+
doc: doc, bib: bib, errors: @errors,
|
|
36
|
+
translation_source: parser.translation_source
|
|
37
|
+
)
|
|
38
|
+
items + edition_parser.parse
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def parse_memento
|
|
42
|
+
parser = MementoParser.new(hit: @hit, errors: @errors)
|
|
43
|
+
bib = parser.to_bib_hash
|
|
44
|
+
bib[:contributor] = contributor
|
|
45
|
+
[ItemData.new(**bib)]
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Ecma
|
|
3
|
+
# Structured ECMA document identifier. The docid string is the BARE printed
|
|
4
|
+
# form ("ECMA-269", "ECMA TR/101", "ECMA MEM/2021"), and it is parsed into a
|
|
5
|
+
# `Pubid::Ecma::Identifier` kept in `@pubid` while the lutaml `content`
|
|
6
|
+
# attribute stays a plain string for serialization.
|
|
7
|
+
#
|
|
8
|
+
# Parsing is **soft**: `content=` lazily requires pubid and rescues
|
|
9
|
+
# `LoadError`/`StandardError`, so a missing pubid gem or non-ECMA content
|
|
10
|
+
# leaves `@pubid` nil rather than raising.
|
|
11
|
+
#
|
|
12
|
+
# ## Why this class exists, and the one rule that is ECMA-specific
|
|
13
|
+
#
|
|
14
|
+
# `Pubid::Ecma::Identifier#to_s` renders the edition and the volume **by
|
|
15
|
+
# default** — `"ECMA-269 ed3 vol2"`. That default is deliberate on the pubid
|
|
16
|
+
# side: `Relaton::Index::Type#add_or_update` keys on a bare `id.to_s`, and
|
|
17
|
+
# 740 of the 804 published rows carry an edition, so without it 383 rows
|
|
18
|
+
# collapse onto another row's key and vanish from the index.
|
|
19
|
+
#
|
|
20
|
+
# A **document's own** docidentifier is the opposite. Every `ECMA-269`
|
|
21
|
+
# volume file in `relaton-data-ecma` carries `docidentifier: ECMA-269` and
|
|
22
|
+
# the same title — the edition and the volume are index metadata, not part
|
|
23
|
+
# of the printed id. So `refresh_content!` must opt OUT of both, or a
|
|
24
|
+
# mutation would silently promote the stored content to the index form.
|
|
25
|
+
#
|
|
26
|
+
# This is the mirror image of `Relaton::ThreeGpp::Docidentifier`, whose
|
|
27
|
+
# `refresh_content!` must pass `with_publisher: true` because ITS pubid
|
|
28
|
+
# defaults to the index rendering and its stored content is the fuller one.
|
|
29
|
+
# The two look contradictory only until you notice each one re-renders what
|
|
30
|
+
# its own stored `content` already holds.
|
|
31
|
+
class Docidentifier < Bib::Docidentifier
|
|
32
|
+
attr_reader :pubid
|
|
33
|
+
|
|
34
|
+
# Capture the inherited (LocalizedMarkedUpString) content setter before
|
|
35
|
+
# overriding #content=, so #refresh_content! can write the re-rendered
|
|
36
|
+
# string back WITHOUT re-parsing (a re-parse would rebuild @pubid from the
|
|
37
|
+
# string and discard in-place mutations).
|
|
38
|
+
alias_method :store_content, :content=
|
|
39
|
+
|
|
40
|
+
def initialize(attrs = {}, options = {})
|
|
41
|
+
pubid = attrs.is_a?(Hash) ? attrs.delete(:pubid) : nil
|
|
42
|
+
attrs[:content] ||= render(pubid) if pubid
|
|
43
|
+
super
|
|
44
|
+
@pubid = pubid if pubid
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def content=(value)
|
|
48
|
+
super
|
|
49
|
+
return unless value
|
|
50
|
+
|
|
51
|
+
@pubid = begin
|
|
52
|
+
require "pubid"
|
|
53
|
+
::Pubid::Ecma::Identifier.parse(value.to_s)
|
|
54
|
+
rescue LoadError, StandardError
|
|
55
|
+
nil
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# `Pubid::Ecma::Identifier` models number/part/subpart/edition/volume, so
|
|
60
|
+
# the mapping is:
|
|
61
|
+
#
|
|
62
|
+
# - **`remove_date!` → clears `edition`.** ECMA has no date component;
|
|
63
|
+
# `edition` is its version discriminator, so clearing it yields the
|
|
64
|
+
# version-agnostic ("most recent") reference. It is invisible in the
|
|
65
|
+
# rendered bare form, which never carried the edition to begin with —
|
|
66
|
+
# but the identifier really does change, and a consumer reading
|
|
67
|
+
# `#pubid` sees it.
|
|
68
|
+
# - **`remove_part!` → clears `part`/`subpart`.** Real here:
|
|
69
|
+
# "ECMA-418-1" -> "ECMA-418".
|
|
70
|
+
# - **`to_all_parts!` → both, then wraps `@pubid` in pubid's `AllParts`.**
|
|
71
|
+
# `content` stays the plain stripped id — ECMA's own renderer has no
|
|
72
|
+
# "(all parts)" marker, and `content` is cached from the pre-wrap
|
|
73
|
+
# pubid on purpose. `#pubid` itself, read directly, now answers
|
|
74
|
+
# `all_parts? == true` and renders WITH pubid's generic marker
|
|
75
|
+
# (`#to_s`), since it's the wrapper.
|
|
76
|
+
#
|
|
77
|
+
# All three no-op safely when `@pubid` is nil, so `Bib::ItemData`'s
|
|
78
|
+
# `#to_all_parts` / `#to_most_recent_reference` never raise on ECMA items.
|
|
79
|
+
|
|
80
|
+
def remove_part!
|
|
81
|
+
clear_attrs! :part
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def remove_date!
|
|
85
|
+
clear_attrs! :edition
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def to_all_parts!
|
|
89
|
+
return if !@pubid || @pubid.all_parts?
|
|
90
|
+
|
|
91
|
+
# `#exclude` (no args) rebuilds a full independent copy — `remove_part!`
|
|
92
|
+
# / `remove_date!` mutate `@pubid` in place, so a bare reference here
|
|
93
|
+
# would lose the original part/edition to that mutation too.
|
|
94
|
+
original = @pubid.exclude
|
|
95
|
+
remove_part!
|
|
96
|
+
remove_date!
|
|
97
|
+
@pubid = original.to_all_parts
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
private
|
|
101
|
+
|
|
102
|
+
def clear_attrs!(*attrs)
|
|
103
|
+
return unless @pubid
|
|
104
|
+
|
|
105
|
+
cleared = attrs.select { |attr| @pubid.respond_to?("#{attr}=") }
|
|
106
|
+
return if cleared.empty?
|
|
107
|
+
|
|
108
|
+
cleared.each { |attr| @pubid.public_send("#{attr}=", nil) }
|
|
109
|
+
@pubid.subpart = nil if attrs.include?(:part) && @pubid.respond_to?(:subpart=)
|
|
110
|
+
refresh_content!
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def refresh_content!
|
|
114
|
+
store_content(render(@pubid)) if @pubid
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# The bare document form. See the class comment for why both flags are
|
|
118
|
+
# opted out of, and why 3GPP's twin does the opposite.
|
|
119
|
+
def render(pubid)
|
|
120
|
+
pubid.to_s(with_edition: false, with_volume: false)
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
end
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Ecma
|
|
3
|
+
class EditionParser
|
|
4
|
+
include ParserCommon
|
|
5
|
+
|
|
6
|
+
# @param [Mechanize::Page] doc document page
|
|
7
|
+
# @param [Hash] bib base bibliographic item attributes
|
|
8
|
+
# @param [Hash] errors error tracking hash
|
|
9
|
+
# @param [Array] translation_source precomputed translation sources
|
|
10
|
+
def initialize(doc:, bib:, errors: {}, translation_source: [])
|
|
11
|
+
@doc = doc
|
|
12
|
+
@bib = bib
|
|
13
|
+
@errors = errors
|
|
14
|
+
@translation_source = translation_source
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# @return [Array<Relaton::Ecma::ItemData>] editions
|
|
18
|
+
def parse # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
|
19
|
+
return [] unless @doc
|
|
20
|
+
|
|
21
|
+
docid = @bib[:docidentifier]
|
|
22
|
+
@doc.xpath('//div[@id="main"]/div[1]/div/main/article/div/div/standard/div/ul/li').map do |hit|
|
|
23
|
+
bib = @bib.dup
|
|
24
|
+
id, ed, bib[:date], vol = edition_id_parts hit.at("./span", "./a").text
|
|
25
|
+
bib[:source] = edition_source(hit) + edition_translation_source(ed)
|
|
26
|
+
next if ed.nil? || ed.empty?
|
|
27
|
+
|
|
28
|
+
bib[:docidentifier] = id.nil? || id.empty? ? docid : fetch_docidentifier(id)
|
|
29
|
+
@errors[:edition_docidentifier] &&= bib[:docidentifier].empty?
|
|
30
|
+
bib[:edition] = Bib::Edition.new(content: ed)
|
|
31
|
+
bib[:extent] = create_extent(vol)
|
|
32
|
+
@errors[:edition_extent] &&= bib[:extent].nil?
|
|
33
|
+
ItemData.new(**bib)
|
|
34
|
+
end.compact
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
#
|
|
38
|
+
# Parse edition and date
|
|
39
|
+
#
|
|
40
|
+
# @param [String] text identifier text
|
|
41
|
+
#
|
|
42
|
+
# @return [Array<String,nil,Array<Relaton::Bib::Date>>] edition and date
|
|
43
|
+
#
|
|
44
|
+
def edition_id_parts(text) # rubocop:disable Metrics/MethodLength
|
|
45
|
+
%r{^
|
|
46
|
+
(?<id>\w+(?:[\d-]+|\sTR/\d+)),?\s
|
|
47
|
+
(?:Volume\s(?<vol>[\d.]+),?\s)?
|
|
48
|
+
(?<ed>[\d.]+)(?:st|nd|rd|th)?\sedition
|
|
49
|
+
(?:[,.]\s(?<dt>\w+\s\d+))?
|
|
50
|
+
}x =~ text
|
|
51
|
+
date = [dt].compact.map do |d|
|
|
52
|
+
on = Date.strptime(d, "%B %Y").strftime("%Y-%m")
|
|
53
|
+
Bib::Date.new(type: "published", at: on)
|
|
54
|
+
end
|
|
55
|
+
[id, ed, date, vol]
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def edition_source(hit)
|
|
59
|
+
es = { "src" => hit.at("./a"), "pdf" => hit.at("./span/a") }.map do |type, a|
|
|
60
|
+
Bib::Uri.new(type: type, content: a[:href]) if a
|
|
61
|
+
end.compact
|
|
62
|
+
@errors[:edition_source] &&= es.empty?
|
|
63
|
+
es
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def create_extent(vol)
|
|
67
|
+
return unless vol && !vol.empty?
|
|
68
|
+
|
|
69
|
+
locality = Bib::Locality.new(type: "volume", reference_from: vol)
|
|
70
|
+
[Bib::Extent.new(locality: [locality])]
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
private
|
|
74
|
+
|
|
75
|
+
def edition_translation_source(edition)
|
|
76
|
+
@translation_source.select { |s| s[:ed] == edition }.map { |s| s[:source] }
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require_relative "docidentifier"
|
|
2
|
+
require_relative "ext"
|
|
3
|
+
|
|
4
|
+
module Relaton
|
|
5
|
+
module Ecma
|
|
6
|
+
class Item < Bib::Item
|
|
7
|
+
model ItemData
|
|
8
|
+
|
|
9
|
+
attribute :docidentifier, Docidentifier, collection: true, initialize_empty: true
|
|
10
|
+
attribute :ext, Ext
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Ecma
|
|
3
|
+
class MementoParser
|
|
4
|
+
include ParserCommon
|
|
5
|
+
|
|
6
|
+
ATTRS = %i[docidentifier title date source ext].freeze
|
|
7
|
+
|
|
8
|
+
# @param [Nokogiri::XML::Element] hit document hit
|
|
9
|
+
# @param [Hash] errors error tracking hash
|
|
10
|
+
def initialize(hit:, errors: {})
|
|
11
|
+
@hit = hit
|
|
12
|
+
@errors = errors
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# @return [Hash] bibliographic item attributes
|
|
16
|
+
def to_bib_hash
|
|
17
|
+
bib = default_bib_hash
|
|
18
|
+
ATTRS.each { |a| bib[a] = send "fetch_#{a}" }
|
|
19
|
+
bib
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
# @return [Array<Relaton::Ecma::Docidentifier>]
|
|
25
|
+
def fetch_docidentifier
|
|
26
|
+
code = "ECMA MEM/#{@hit.at('div[1]//p').text}"
|
|
27
|
+
docid = super(code)
|
|
28
|
+
@errors[:memento_docidentifier] &&= docid.empty?
|
|
29
|
+
docid
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# @return [Array<Relaton::Bib::Title>]
|
|
33
|
+
def fetch_title
|
|
34
|
+
year = @hit.at("div[1]//p").text
|
|
35
|
+
content = "\"Memento #{year}\" for year #{year}"
|
|
36
|
+
result = [Bib::Title.new(content: content, language: "en", script: "Latn")]
|
|
37
|
+
@errors[:memento_title] &&= result.empty?
|
|
38
|
+
result
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# @return [Array<Relaton::Bib::Date>]
|
|
42
|
+
def fetch_date
|
|
43
|
+
date = @hit.at("div[2]//p").text
|
|
44
|
+
on = Date.strptime(date, "%B %Y").strftime "%Y-%m"
|
|
45
|
+
result = [Bib::Date.new(type: "published", at: on)]
|
|
46
|
+
@errors[:memento_date] &&= result.empty?
|
|
47
|
+
result
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# @return [Array<Relaton::Bib::Uri>]
|
|
51
|
+
def fetch_source
|
|
52
|
+
result = @hit.xpath("./div/section/div/p/a").map do |a|
|
|
53
|
+
Bib::Uri.new(type: "pdf", content: a[:href])
|
|
54
|
+
end
|
|
55
|
+
@errors[:memento_source] &&= result.empty?
|
|
56
|
+
result
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Ecma
|
|
3
|
+
class PageFetcher
|
|
4
|
+
RETRIES = 3
|
|
5
|
+
|
|
6
|
+
def initialize
|
|
7
|
+
@agent = Mechanize.new
|
|
8
|
+
@agent.user_agent_alias = Mechanize::AGENT_ALIASES.keys[rand(21)]
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
#
|
|
12
|
+
# Get page with retries
|
|
13
|
+
#
|
|
14
|
+
# A failed fetch must raise, not fall out of the loop. `RETRIES.times`
|
|
15
|
+
# returns its receiver, so the exhausted loop used to hand the caller the
|
|
16
|
+
# Integer 3 as if it were a page, and `StandardParser#fetch_title`
|
|
17
|
+
# reported the transport error as `undefined method 'xpath' for an
|
|
18
|
+
# instance of Integer`. `DataFetcher#html_index` already rescues per hit,
|
|
19
|
+
# so one unreachable page is skipped with a readable message.
|
|
20
|
+
#
|
|
21
|
+
# @param [String] url url to fetch
|
|
22
|
+
#
|
|
23
|
+
# @return [Mechanize::Page] document
|
|
24
|
+
# @raise [Relaton::RequestError] after RETRIES attempts
|
|
25
|
+
#
|
|
26
|
+
def get(url)
|
|
27
|
+
error = nil
|
|
28
|
+
RETRIES.times do |n|
|
|
29
|
+
sleep n
|
|
30
|
+
return @agent.get url
|
|
31
|
+
rescue StandardError => e
|
|
32
|
+
error = e
|
|
33
|
+
Util.error e.message
|
|
34
|
+
end
|
|
35
|
+
raise Relaton::RequestError, "Could not access #{url}: #{error.message}"
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Ecma
|
|
3
|
+
module ParserCommon
|
|
4
|
+
def default_bib_hash
|
|
5
|
+
{
|
|
6
|
+
type: "standard", language: ["en"], script: ["Latn"], place: [Bib::Place.new(city: "Geneva")]
|
|
7
|
+
}
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def contributor
|
|
11
|
+
orgname = Bib::TypedLocalizedString.new(content: "Ecma International", language: "en", script: "Latn")
|
|
12
|
+
org = Bib::Organization.new name: [orgname]
|
|
13
|
+
role = Bib::Contributor::Role.new type: "publisher"
|
|
14
|
+
[Bib::Contributor.new(organization: org, role: [role])]
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# @return [Array<Relaton::Ecma::Docidentifier>]
|
|
18
|
+
def fetch_docidentifier(id = nil)
|
|
19
|
+
return [] if id.nil? || id.empty?
|
|
20
|
+
|
|
21
|
+
[Docidentifier.new(type: "ECMA", content: id, primary: true)]
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def fetch_ext
|
|
25
|
+
Ext.new(doctype: fetch_doctype, flavor: "ecma")
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def fetch_doctype
|
|
29
|
+
Bib::Doctype.new content: "document"
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
require "relaton/core/processor"
|
|
2
|
+
|
|
3
|
+
module Relaton
|
|
4
|
+
module Ecma
|
|
5
|
+
class Processor < Relaton::Core::Processor
|
|
6
|
+
def initialize
|
|
7
|
+
@short = :relaton_ecma
|
|
8
|
+
@prefix = "ECMA"
|
|
9
|
+
@defaultprefix = /^ECMA(-|\s)/
|
|
10
|
+
@idtype = "ECMA"
|
|
11
|
+
@datasets = %w[ecma-standards]
|
|
12
|
+
@pubid_flavor = :Ecma
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# @param code [String]
|
|
16
|
+
# @param date [String, nil] year
|
|
17
|
+
# @param opts [Hash]
|
|
18
|
+
# @return [Relaton::Ecma::ItemData, nil]
|
|
19
|
+
def get(code, date, opts)
|
|
20
|
+
require_relative "../ecma"
|
|
21
|
+
Bibliography.get(code, date, opts)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
#
|
|
25
|
+
# Fetch all the documents from a source
|
|
26
|
+
#
|
|
27
|
+
# @param [String] source source name (iec-harmonized-all, iec-harmonized-latest)
|
|
28
|
+
# @param [Hash] opts
|
|
29
|
+
# @option opts [String] :output directory to output documents
|
|
30
|
+
# @option opts [String] :format output format (xml, yaml, bibxml)
|
|
31
|
+
#
|
|
32
|
+
def fetch_data(source, opts)
|
|
33
|
+
require_relative "data_fetcher"
|
|
34
|
+
DataFetcher.fetch(source, **opts)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# @param xml [String]
|
|
38
|
+
# @return [Relaton::Ecma::ItemData]
|
|
39
|
+
def from_xml(xml)
|
|
40
|
+
require_relative "../ecma"
|
|
41
|
+
Item.from_xml xml
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# @param yaml [String]
|
|
45
|
+
# @return [Relaton::Ecma::ItemData]
|
|
46
|
+
def from_yaml(yaml)
|
|
47
|
+
require_relative "../ecma" # defines Item — cache reads hit this cold
|
|
48
|
+
Item.from_yaml yaml
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Returns hash of XML grammar
|
|
52
|
+
# @return [String]
|
|
53
|
+
def grammar_hash
|
|
54
|
+
require_relative "../ecma"
|
|
55
|
+
@grammar_hash ||= Ecma.grammar_hash
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
#
|
|
59
|
+
# Remove index file
|
|
60
|
+
#
|
|
61
|
+
def remove_index_file
|
|
62
|
+
require_relative "../ecma"
|
|
63
|
+
Relaton::Index.find_or_create(
|
|
64
|
+
:ECMA, url: true, file: "#{INDEXFILE}.yaml"
|
|
65
|
+
).remove_file
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|