relaton 2.1.0 → 3.0.0.pre.alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/{docs/README.adoc → README.adoc} +109 -38
- data/lib/relaton/3gpp/bibdata.rb +9 -0
- data/lib/relaton/3gpp/bibitem.rb +9 -0
- data/lib/relaton/3gpp/bibliography.rb +48 -0
- data/lib/relaton/3gpp/data_fetcher.rb +255 -0
- data/lib/relaton/3gpp/doctype.rb +9 -0
- data/lib/relaton/3gpp/ext.rb +31 -0
- data/lib/relaton/3gpp/item.rb +12 -0
- data/lib/relaton/3gpp/item_data.rb +15 -0
- data/lib/relaton/3gpp/parser.rb +400 -0
- data/lib/relaton/3gpp/processor.rb +68 -0
- data/lib/relaton/3gpp/release.rb +34 -0
- data/lib/relaton/3gpp/util.rb +8 -0
- data/lib/relaton/3gpp.rb +25 -0
- data/lib/relaton/bib/converter/asciibib/to_asciibib.rb +663 -0
- data/lib/relaton/bib/converter/asciibib.rb +13 -0
- data/lib/relaton/bib/converter/bibtex/from_bibtex.rb +245 -0
- data/lib/relaton/bib/converter/bibtex/to_bibtex.rb +341 -0
- data/lib/relaton/bib/converter/bibtex.rb +23 -0
- data/lib/relaton/bib/converter/bibxml/from_rfcxml.rb +386 -0
- data/lib/relaton/bib/converter/bibxml/from_rfcxml_referencegroup.rb +71 -0
- data/lib/relaton/bib/converter/bibxml/to_rfcxml.rb +308 -0
- data/lib/relaton/bib/converter/bibxml/to_rfcxml_referencegroup.rb +52 -0
- data/lib/relaton/bib/converter/bibxml.rb +51 -0
- data/lib/relaton/bib/hash_parser_v1.rb +767 -0
- data/lib/relaton/bib/item_data.rb +229 -0
- data/lib/relaton/bib/model/abstract.rb +16 -0
- data/lib/relaton/bib/model/address.rb +22 -0
- data/lib/relaton/bib/model/affiliation.rb +16 -0
- data/lib/relaton/bib/model/bibdata.rb +11 -0
- data/lib/relaton/bib/model/bibdata_shared.rb +12 -0
- data/lib/relaton/bib/model/bibitem.rb +11 -0
- data/lib/relaton/bib/model/bibitem_shared.rb +12 -0
- data/lib/relaton/bib/model/contact.rb +18 -0
- data/lib/relaton/bib/model/contribution_info.rb +15 -0
- data/lib/relaton/bib/model/contributor.rb +29 -0
- data/lib/relaton/bib/model/copyright.rb +27 -0
- data/lib/relaton/bib/model/date.rb +31 -0
- data/lib/relaton/bib/model/depiction.rb +16 -0
- data/lib/relaton/bib/model/docidentifier.rb +34 -0
- data/lib/relaton/bib/model/doctype.rb +14 -0
- data/lib/relaton/bib/model/edition.rb +14 -0
- data/lib/relaton/bib/model/ext.rb +39 -0
- data/lib/relaton/bib/model/extent.rb +16 -0
- data/lib/relaton/bib/model/formattedref.rb +43 -0
- data/lib/relaton/bib/model/full_name_type.rb +64 -0
- data/lib/relaton/bib/model/fullname.rb +11 -0
- data/lib/relaton/bib/model/ics.rb +49 -0
- data/lib/relaton/bib/model/image.rb +28 -0
- data/lib/relaton/bib/model/item.rb +96 -0
- data/lib/relaton/bib/model/item_base.rb +20 -0
- data/lib/relaton/bib/model/item_shared.rb +88 -0
- data/lib/relaton/bib/model/keyword.rb +30 -0
- data/lib/relaton/bib/model/locality.rb +18 -0
- data/lib/relaton/bib/model/locality_stack.rb +14 -0
- data/lib/relaton/bib/model/localized_string.rb +48 -0
- data/lib/relaton/bib/model/localized_string_attrs.rb +24 -0
- data/lib/relaton/bib/model/logo.rb +14 -0
- data/lib/relaton/bib/model/medium.rb +22 -0
- data/lib/relaton/bib/model/note.rb +16 -0
- data/lib/relaton/bib/model/organization.rb +13 -0
- data/lib/relaton/bib/model/organization_type.rb +42 -0
- data/lib/relaton/bib/model/person.rb +36 -0
- data/lib/relaton/bib/model/phone.rb +14 -0
- data/lib/relaton/bib/model/place.rb +33 -0
- data/lib/relaton/bib/model/price.rb +14 -0
- data/lib/relaton/bib/model/relation.rb +43 -0
- data/lib/relaton/bib/model/series.rb +34 -0
- data/lib/relaton/bib/model/size.rb +23 -0
- data/lib/relaton/bib/model/source_locality_stack.rb +14 -0
- data/lib/relaton/bib/model/status.rb +27 -0
- data/lib/relaton/bib/model/structured_identifier.rb +48 -0
- data/lib/relaton/bib/model/subdivision.rb +16 -0
- data/lib/relaton/bib/model/title.rb +56 -0
- data/lib/relaton/bib/model/type/plain_date.rb +16 -0
- data/lib/relaton/bib/model/type/string_date.rb +48 -0
- data/lib/relaton/bib/model/uri.rb +18 -0
- data/lib/relaton/bib/model/validity.rb +16 -0
- data/lib/relaton/bib/model/version.rb +43 -0
- data/lib/relaton/bib/namespace_helper.rb +21 -0
- data/lib/relaton/bib/sanitizer.rb +68 -0
- data/lib/relaton/bib/util.rb +18 -0
- data/lib/relaton/bib/versions.json +35 -0
- data/lib/relaton/bib.rb +48 -0
- data/lib/relaton/bipm/bibliography.rb +82 -0
- data/lib/relaton/bipm/converter/asciibib.rb +64 -0
- data/lib/relaton/bipm/data_fetcher.rb +57 -0
- data/lib/relaton/bipm/data_outcomes_parser.rb +657 -0
- data/lib/relaton/bipm/id_parser.rb +277 -0
- data/lib/relaton/bipm/item_data.rb +47 -0
- data/lib/relaton/bipm/model/bibdata.rb +9 -0
- data/lib/relaton/bipm/model/bibitem.rb +9 -0
- data/lib/relaton/bipm/model/comment_period.rb +13 -0
- data/lib/relaton/bipm/model/doctype.rb +12 -0
- data/lib/relaton/bipm/model/ext.rb +38 -0
- data/lib/relaton/bipm/model/item.rb +11 -0
- data/lib/relaton/bipm/model/structured_identifier.rb +15 -0
- data/lib/relaton/bipm/processor.rb +69 -0
- data/lib/relaton/bipm/rawdata_bipm_metrologia/affiliations.rb +111 -0
- data/lib/relaton/bipm/rawdata_bipm_metrologia/fetcher.rb +174 -0
- data/lib/relaton/bipm/rawdata_bipm_metrologia/niso_jats_parser.rb +353 -0
- data/lib/relaton/bipm/si_brochure_parser.rb +186 -0
- data/lib/relaton/bipm/util.rb +8 -0
- data/lib/relaton/bipm.rb +32 -0
- data/lib/relaton/bsi/bibliography.rb +124 -0
- data/lib/relaton/bsi/hit.rb +14 -0
- data/lib/relaton/bsi/hit_collection.rb +114 -0
- data/lib/relaton/bsi/item_data.rb +13 -0
- data/lib/relaton/bsi/model/bibdata.rb +8 -0
- data/lib/relaton/bsi/model/bibitem.rb +8 -0
- data/lib/relaton/bsi/model/docidentifier.rb +9 -0
- data/lib/relaton/bsi/model/doctype.rb +14 -0
- data/lib/relaton/bsi/model/ext.rb +17 -0
- data/lib/relaton/bsi/model/item.rb +17 -0
- data/lib/relaton/bsi/model/item_base.rb +22 -0
- data/lib/relaton/bsi/model/relation.rb +9 -0
- data/lib/relaton/bsi/processor.rb +42 -0
- data/lib/relaton/bsi/schema.json +24882 -0
- data/lib/relaton/bsi/scraper.rb +288 -0
- data/lib/relaton/bsi/util.rb +8 -0
- data/lib/relaton/bsi.rb +25 -0
- data/lib/relaton/calconnect/bibliography.rb +95 -0
- data/lib/relaton/calconnect/data_fetcher.rb +106 -0
- data/lib/relaton/calconnect/hit.rb +14 -0
- data/lib/relaton/calconnect/hit_collection.rb +84 -0
- data/lib/relaton/calconnect/item_data.rb +12 -0
- data/lib/relaton/calconnect/model/bibdata.rb +8 -0
- data/lib/relaton/calconnect/model/bibitem.rb +8 -0
- data/lib/relaton/calconnect/model/doctype.rb +11 -0
- data/lib/relaton/calconnect/model/ext.rb +11 -0
- data/lib/relaton/calconnect/model/item.rb +13 -0
- data/lib/relaton/calconnect/processor.rb +66 -0
- data/lib/relaton/calconnect/scraper.rb +87 -0
- data/lib/relaton/calconnect/util.rb +8 -0
- data/lib/relaton/calconnect.rb +26 -0
- data/lib/relaton/ccsds/bibliography.rb +63 -0
- data/lib/relaton/ccsds/data/fetcher.rb +247 -0
- data/lib/relaton/ccsds/data/iso_references.rb +30 -0
- data/lib/relaton/ccsds/data/parser.rb +194 -0
- data/lib/relaton/ccsds/hit.rb +24 -0
- data/lib/relaton/ccsds/hit_collection.rb +42 -0
- data/lib/relaton/ccsds/item_data.rb +9 -0
- data/lib/relaton/ccsds/model/bibdata.rb +8 -0
- data/lib/relaton/ccsds/model/bibitem.rb +8 -0
- data/lib/relaton/ccsds/model/doctype.rb +9 -0
- data/lib/relaton/ccsds/model/ext.rb +19 -0
- data/lib/relaton/ccsds/model/item.rb +13 -0
- data/lib/relaton/ccsds/processor.rb +68 -0
- data/lib/relaton/ccsds/util.rb +10 -0
- data/lib/relaton/ccsds.rb +33 -0
- data/lib/relaton/cen/bibliography.rb +121 -0
- data/lib/relaton/cen/committees.yaml +66 -0
- data/lib/relaton/cen/hit.rb +16 -0
- data/lib/relaton/cen/hit_collection.rb +68 -0
- data/lib/relaton/cen/item_data.rb +7 -0
- data/lib/relaton/cen/model/bibdata.rb +8 -0
- data/lib/relaton/cen/model/bibitem.rb +8 -0
- data/lib/relaton/cen/model/docidentifier.rb +9 -0
- data/lib/relaton/cen/model/ext.rb +11 -0
- data/lib/relaton/cen/model/item.rb +14 -0
- data/lib/relaton/cen/model/structured_identifier.rb +9 -0
- data/lib/relaton/cen/processor.rb +40 -0
- data/lib/relaton/cen/scraper.rb +210 -0
- data/lib/relaton/cen/util.rb +8 -0
- data/lib/relaton/cen.rb +29 -0
- data/lib/relaton/cie/bibdata.rb +8 -0
- data/lib/relaton/cie/bibitem.rb +8 -0
- data/lib/relaton/cie/bibliography.rb +31 -0
- data/lib/relaton/cie/data_fetcher.rb +355 -0
- data/lib/relaton/cie/ext.rb +7 -0
- data/lib/relaton/cie/item.rb +11 -0
- data/lib/relaton/cie/item_data.rb +6 -0
- data/lib/relaton/cie/processor.rb +66 -0
- data/lib/relaton/cie/scrapper.rb +39 -0
- data/lib/relaton/cie/util.rb +8 -0
- data/lib/relaton/cie.rb +28 -0
- data/lib/relaton/core/array_wrapper.rb +20 -0
- data/lib/relaton/core/data_fetcher.rb +97 -0
- data/lib/relaton/core/date_parser.rb +42 -0
- data/lib/relaton/core/hash_keys_sybolizer.rb +19 -0
- data/lib/relaton/core/hit.rb +49 -0
- data/lib/relaton/core/hit_collection.rb +118 -0
- data/lib/relaton/core/processor.rb +48 -0
- data/lib/relaton/core/workers_pool.rb +45 -0
- data/lib/relaton/core.rb +9 -0
- data/lib/relaton/db/cache.rb +232 -0
- data/lib/relaton/db/config.rb +24 -0
- data/lib/relaton/db/registry.rb +119 -0
- data/lib/relaton/db/util.rb +9 -0
- data/lib/relaton/db/workers_pool.rb +22 -0
- data/lib/relaton/db.rb +20 -206
- data/lib/relaton/doi/crossref.rb +72 -0
- data/lib/relaton/doi/parser.rb +827 -0
- data/lib/relaton/doi/processor.rb +65 -0
- data/lib/relaton/doi/util.rb +8 -0
- data/lib/relaton/doi.rb +20 -0
- data/lib/relaton/ecma/bibdata.rb +8 -0
- data/lib/relaton/ecma/bibitem.rb +8 -0
- data/lib/relaton/ecma/bibliography.rb +81 -0
- data/lib/relaton/ecma/data_fetcher.rb +103 -0
- data/lib/relaton/ecma/data_parser.rb +49 -0
- data/lib/relaton/ecma/edition_parser.rb +80 -0
- data/lib/relaton/ecma/ext.rb +7 -0
- data/lib/relaton/ecma/item.rb +11 -0
- data/lib/relaton/ecma/item_data.rb +6 -0
- data/lib/relaton/ecma/memento_parser.rb +60 -0
- data/lib/relaton/ecma/page_fetcher.rb +27 -0
- data/lib/relaton/ecma/parser_common.rb +33 -0
- data/lib/relaton/ecma/processor.rb +66 -0
- data/lib/relaton/ecma/standard_parser.rb +134 -0
- data/lib/relaton/ecma/util.rb +8 -0
- data/lib/relaton/ecma.rb +24 -0
- data/lib/relaton/etsi/bibdata.rb +10 -0
- data/lib/relaton/etsi/bibitem.rb +10 -0
- data/lib/relaton/etsi/bibliography.rb +46 -0
- data/lib/relaton/etsi/data_fetcher.rb +128 -0
- data/lib/relaton/etsi/data_parser.rb +208 -0
- data/lib/relaton/etsi/doctype.rb +30 -0
- data/lib/relaton/etsi/ext.rb +31 -0
- data/lib/relaton/etsi/item.rb +15 -0
- data/lib/relaton/etsi/item_data.rb +6 -0
- data/lib/relaton/etsi/processor.rb +69 -0
- data/lib/relaton/etsi/pubid.rb +37 -0
- data/lib/relaton/etsi/status.rb +13 -0
- data/lib/relaton/etsi/util.rb +8 -0
- data/lib/relaton/etsi.rb +25 -0
- data/lib/relaton/gb/bibdata.rb +8 -0
- data/lib/relaton/gb/bibitem.rb +8 -0
- data/lib/relaton/gb/bibliography.rb +145 -0
- data/lib/relaton/gb/ccs.rb +14 -0
- data/lib/relaton/gb/committee.rb +13 -0
- data/lib/relaton/gb/docidentifier.rb +23 -0
- data/lib/relaton/gb/doctype.rb +9 -0
- data/lib/relaton/gb/ext.rb +36 -0
- data/lib/relaton/gb/gb_scraper.rb +61 -0
- data/lib/relaton/gb/gb_type.rb +20 -0
- data/lib/relaton/gb/hit.rb +48 -0
- data/lib/relaton/gb/hit_collection.rb +19 -0
- data/lib/relaton/gb/item.rb +13 -0
- data/lib/relaton/gb/item_data.rb +6 -0
- data/lib/relaton/gb/processor.rb +46 -0
- data/lib/relaton/gb/project_number.rb +38 -0
- data/lib/relaton/gb/scraper.rb +204 -0
- data/lib/relaton/gb/sec_scraper.rb +92 -0
- data/lib/relaton/gb/stage_name.rb +13 -0
- data/lib/relaton/gb/structured_identifier.rb +26 -0
- data/lib/relaton/gb/t_scraper.rb +126 -0
- data/lib/relaton/gb/util.rb +8 -0
- data/lib/relaton/gb/yaml/prefixes.yaml +200 -0
- data/lib/relaton/gb.rb +33 -0
- data/lib/relaton/iana/bibdata.rb +8 -0
- data/lib/relaton/iana/bibitem.rb +8 -0
- data/lib/relaton/iana/bibliography.rb +47 -0
- data/lib/relaton/iana/data_fetcher.rb +71 -0
- data/lib/relaton/iana/item.rb +7 -0
- data/lib/relaton/iana/item_data.rb +6 -0
- data/lib/relaton/iana/parser.rb +146 -0
- data/lib/relaton/iana/processor.rb +68 -0
- data/lib/relaton/iana/util.rb +8 -0
- data/lib/relaton/iana.rb +29 -0
- data/lib/relaton/iec/bibliography.rb +283 -0
- data/lib/relaton/iec/data_fetcher.rb +216 -0
- data/lib/relaton/iec/data_parser.rb +391 -0
- data/lib/relaton/iec/hit.rb +26 -0
- data/lib/relaton/iec/hit_collection.rb +138 -0
- data/lib/relaton/iec/item_data.rb +7 -0
- data/lib/relaton/iec/model/bibdata.rb +8 -0
- data/lib/relaton/iec/model/bibitem.rb +8 -0
- data/lib/relaton/iec/model/docidentifier.rb +131 -0
- data/lib/relaton/iec/model/doctype.rb +12 -0
- data/lib/relaton/iec/model/ext.rb +53 -0
- data/lib/relaton/iec/model/item.rb +20 -0
- data/lib/relaton/iec/model/item_base.rb +12 -0
- data/lib/relaton/iec/model/relation.rb +7 -0
- data/lib/relaton/iec/model/stage_name.rb +13 -0
- data/lib/relaton/iec/processor.rb +73 -0
- data/lib/relaton/iec/statuses.yml +199 -0
- data/lib/relaton/iec/util.rb +8 -0
- data/lib/relaton/iec.rb +98 -0
- data/lib/relaton/ieee/balloting_group.rb +13 -0
- data/lib/relaton/ieee/bibdata.rb +8 -0
- data/lib/relaton/ieee/bibitem.rb +8 -0
- data/lib/relaton/ieee/bibliography.rb +51 -0
- data/lib/relaton/ieee/converter/bibxml/from_rfcxml.rb +10 -0
- data/lib/relaton/ieee/converter/bibxml/from_rfcxml_referencegroup.rb +10 -0
- data/lib/relaton/ieee/converter/bibxml.rb +20 -0
- data/lib/relaton/ieee/data_fetcher.rb +630 -0
- data/lib/relaton/ieee/doctype.rb +9 -0
- data/lib/relaton/ieee/editorial_group.rb +19 -0
- data/lib/relaton/ieee/ext.rb +36 -0
- data/lib/relaton/ieee/idams_parser.rb +323 -0
- data/lib/relaton/ieee/item.rb +11 -0
- data/lib/relaton/ieee/item_data.rb +7 -0
- data/lib/relaton/ieee/processor.rb +68 -0
- data/lib/relaton/ieee/pub_id.rb +161 -0
- data/lib/relaton/ieee/rawbib_id_parser.rb +548 -0
- data/lib/relaton/ieee/util.rb +8 -0
- data/lib/relaton/ieee.rb +29 -0
- data/lib/relaton/ietf/bibdata.rb +8 -0
- data/lib/relaton/ietf/bibitem.rb +8 -0
- data/lib/relaton/ietf/bibliography.rb +35 -0
- data/lib/relaton/ietf/bibxml_parser.rb +232 -0
- data/lib/relaton/ietf/data_fetcher.rb +278 -0
- data/lib/relaton/ietf/doctype.rb +9 -0
- data/lib/relaton/ietf/ext.rb +63 -0
- data/lib/relaton/ietf/item.rb +16 -0
- data/lib/relaton/ietf/item_base.rb +18 -0
- data/lib/relaton/ietf/item_data.rb +6 -0
- data/lib/relaton/ietf/processing_instructions.rb +79 -0
- data/lib/relaton/ietf/processor.rb +68 -0
- data/lib/relaton/ietf/relation.rb +9 -0
- data/lib/relaton/ietf/rfc/abstract.rb +19 -0
- data/lib/relaton/ietf/rfc/author.rb +21 -0
- data/lib/relaton/ietf/rfc/entry.rb +410 -0
- data/lib/relaton/ietf/rfc/entry_date.rb +21 -0
- data/lib/relaton/ietf/rfc/format.rb +19 -0
- data/lib/relaton/ietf/rfc/index.rb +46 -0
- data/lib/relaton/ietf/rfc/is_also.rb +21 -0
- data/lib/relaton/ietf/rfc/keywords.rb +19 -0
- data/lib/relaton/ietf/rfc/rfc_index_namespace.rb +11 -0
- data/lib/relaton/ietf/scraper.rb +68 -0
- data/lib/relaton/ietf/util.rb +8 -0
- data/lib/relaton/ietf/wg_name_resolver.rb +42 -0
- data/lib/relaton/ietf.rb +27 -0
- data/lib/relaton/iho/bibdata.rb +8 -0
- data/lib/relaton/iho/bibitem.rb +8 -0
- data/lib/relaton/iho/bibliography.rb +114 -0
- data/lib/relaton/iho/comment_period.rb +13 -0
- data/lib/relaton/iho/docidentifier.rb +31 -0
- data/lib/relaton/iho/doctype.rb +10 -0
- data/lib/relaton/iho/ext.rb +20 -0
- data/lib/relaton/iho/hash_parser_v1.rb +144 -0
- data/lib/relaton/iho/item.rb +20 -0
- data/lib/relaton/iho/item_base.rb +18 -0
- data/lib/relaton/iho/item_data.rb +6 -0
- data/lib/relaton/iho/processor.rb +54 -0
- data/lib/relaton/iho/relation.rb +9 -0
- data/lib/relaton/iho/structured_identifier.rb +20 -0
- data/lib/relaton/iho/util.rb +8 -0
- data/lib/relaton/iho.rb +27 -0
- data/lib/relaton/index/config.rb +52 -0
- data/lib/relaton/index/file_io.rb +305 -0
- data/lib/relaton/index/file_storage.rb +61 -0
- data/lib/relaton/index/id_number.rb +30 -0
- data/lib/relaton/index/pool.rb +41 -0
- data/lib/relaton/index/type.rb +159 -0
- data/lib/relaton/index/util.rb +18 -0
- data/lib/relaton/index.rb +60 -0
- data/lib/relaton/isbn/isbn.rb +61 -0
- data/lib/relaton/isbn/open_library.rb +43 -0
- data/lib/relaton/isbn/parser.rb +88 -0
- data/lib/relaton/isbn/processor.rb +48 -0
- data/lib/relaton/isbn/util.rb +8 -0
- data/lib/relaton/isbn.rb +19 -0
- data/lib/relaton/iso/bibliography.rb +407 -0
- data/lib/relaton/iso/data_fetcher.rb +338 -0
- data/lib/relaton/iso/data_parser.rb +444 -0
- data/lib/relaton/iso/hash_parser_v1.rb +177 -0
- data/lib/relaton/iso/hit.rb +57 -0
- data/lib/relaton/iso/hit_collection.rb +184 -0
- data/lib/relaton/iso/item_data.rb +28 -0
- data/lib/relaton/iso/model/bibdata.rb +10 -0
- data/lib/relaton/iso/model/bibitem.rb +8 -0
- data/lib/relaton/iso/model/contributor.rb +6 -0
- data/lib/relaton/iso/model/contributor_info.rb +9 -0
- data/lib/relaton/iso/model/docidentifier.rb +134 -0
- data/lib/relaton/iso/model/doctype.rb +13 -0
- data/lib/relaton/iso/model/ext.rb +35 -0
- data/lib/relaton/iso/model/item.rb +17 -0
- data/lib/relaton/iso/model/item_base.rb +22 -0
- data/lib/relaton/iso/model/organization.rb +9 -0
- data/lib/relaton/iso/model/project_number.rb +22 -0
- data/lib/relaton/iso/model/relation.rb +9 -0
- data/lib/relaton/iso/model/stagename.rb +14 -0
- data/lib/relaton/iso/model/structured_identifier.rb +31 -0
- data/lib/relaton/iso/processor.rb +84 -0
- data/lib/relaton/iso/scraper.rb +619 -0
- data/lib/relaton/iso/type/pubid.rb +50 -0
- data/lib/relaton/iso/util.rb +8 -0
- data/lib/relaton/iso.rb +30 -0
- data/lib/relaton/itu/bibliography.rb +90 -0
- data/lib/relaton/itu/data_fetcher.rb +104 -0
- data/lib/relaton/itu/data_parser_r.rb +140 -0
- data/lib/relaton/itu/hit.rb +22 -0
- data/lib/relaton/itu/hit_collection.rb +127 -0
- data/lib/relaton/itu/item_data.rb +6 -0
- data/lib/relaton/itu/model/approval_stage.rb +13 -0
- data/lib/relaton/itu/model/bibdata.rb +8 -0
- data/lib/relaton/itu/model/bibitem.rb +8 -0
- data/lib/relaton/itu/model/docidentifier.rb +9 -0
- data/lib/relaton/itu/model/doctype.rb +13 -0
- data/lib/relaton/itu/model/ext.rb +47 -0
- data/lib/relaton/itu/model/item.rb +13 -0
- data/lib/relaton/itu/model/meeting.rb +13 -0
- data/lib/relaton/itu/model/meeting_date.rb +15 -0
- data/lib/relaton/itu/model/question.rb +13 -0
- data/lib/relaton/itu/model/recommendation_status.rb +11 -0
- data/lib/relaton/itu/model/structured_identifier.rb +19 -0
- data/lib/relaton/itu/processor.rb +66 -0
- data/lib/relaton/itu/pubid.rb +177 -0
- data/lib/relaton/itu/radio_regulations_parser.rb +70 -0
- data/lib/relaton/itu/recommendation_parser.rb +161 -0
- data/lib/relaton/itu/scraper.rb +193 -0
- data/lib/relaton/itu/util.rb +8 -0
- data/lib/relaton/itu.rb +33 -0
- data/lib/relaton/jis/bibdata.rb +8 -0
- data/lib/relaton/jis/bibitem.rb +8 -0
- data/lib/relaton/jis/bibliography.rb +75 -0
- data/lib/relaton/jis/data_fetcher.rb +181 -0
- data/lib/relaton/jis/docidentifier.rb +21 -0
- data/lib/relaton/jis/doctype.rb +9 -0
- data/lib/relaton/jis/ext.rb +13 -0
- data/lib/relaton/jis/hit.rb +93 -0
- data/lib/relaton/jis/hit_collection.rb +127 -0
- data/lib/relaton/jis/item.rb +22 -0
- data/lib/relaton/jis/item_base.rb +26 -0
- data/lib/relaton/jis/item_data.rb +8 -0
- data/lib/relaton/jis/processor.rb +55 -0
- data/lib/relaton/jis/relation.rb +11 -0
- data/lib/relaton/jis/scraper.rb +232 -0
- data/lib/relaton/jis/structured_identifier.rb +13 -0
- data/lib/relaton/jis/util.rb +8 -0
- data/lib/relaton/jis.rb +33 -0
- data/lib/relaton/logger/channels/gh_issue.rb +78 -0
- data/lib/relaton/logger/config.rb +34 -0
- data/lib/relaton/logger/formatter_json.rb +8 -0
- data/lib/relaton/logger/formatter_string.rb +12 -0
- data/lib/relaton/logger/log.rb +64 -0
- data/lib/relaton/logger/log_device.rb +27 -0
- data/lib/relaton/logger/pool.rb +24 -0
- data/lib/relaton/logger.rb +18 -0
- data/lib/relaton/nist/bibdata.rb +8 -0
- data/lib/relaton/nist/bibitem.rb +8 -0
- data/lib/relaton/nist/bibliography.rb +191 -0
- data/lib/relaton/nist/comment_period.rb +15 -0
- data/lib/relaton/nist/data_fetcher.rb +84 -0
- data/lib/relaton/nist/date.rb +7 -0
- data/lib/relaton/nist/doctype.rb +7 -0
- data/lib/relaton/nist/ext.rb +16 -0
- data/lib/relaton/nist/hit.rb +18 -0
- data/lib/relaton/nist/hit_collection.rb +362 -0
- data/lib/relaton/nist/item.rb +17 -0
- data/lib/relaton/nist/item_data.rb +6 -0
- data/lib/relaton/nist/mods_parser.rb +276 -0
- data/lib/relaton/nist/processor.rb +68 -0
- data/lib/relaton/nist/pubs_export.rb +69 -0
- data/lib/relaton/nist/relation.rb +7 -0
- data/lib/relaton/nist/scraper.rb +290 -0
- data/lib/relaton/nist/series.yaml +49 -0
- data/lib/relaton/nist/util.rb +8 -0
- data/lib/relaton/nist.rb +34 -0
- data/lib/relaton/oasis/bibdata.rb +8 -0
- data/lib/relaton/oasis/bibitem.rb +8 -0
- data/lib/relaton/oasis/bibliography.rb +60 -0
- data/lib/relaton/oasis/browser_agent.rb +71 -0
- data/lib/relaton/oasis/data_fetcher.rb +94 -0
- data/lib/relaton/oasis/data_parser.rb +305 -0
- data/lib/relaton/oasis/data_parser_utils.rb +296 -0
- data/lib/relaton/oasis/data_part_parser.rb +239 -0
- data/lib/relaton/oasis/doctype.rb +7 -0
- data/lib/relaton/oasis/ext.rb +19 -0
- data/lib/relaton/oasis/item.rb +11 -0
- data/lib/relaton/oasis/item_data.rb +6 -0
- data/lib/relaton/oasis/processor.rb +68 -0
- data/lib/relaton/oasis/util.rb +8 -0
- data/lib/relaton/oasis.rb +28 -0
- data/lib/relaton/ogc/bibdata.rb +8 -0
- data/lib/relaton/ogc/bibitem.rb +8 -0
- data/lib/relaton/ogc/bibliography.rb +64 -0
- data/lib/relaton/ogc/data_fetcher.rb +110 -0
- data/lib/relaton/ogc/docidentifier.rb +6 -0
- data/lib/relaton/ogc/doctype.rb +12 -0
- data/lib/relaton/ogc/ext.rb +15 -0
- data/lib/relaton/ogc/hit.rb +18 -0
- data/lib/relaton/ogc/hit_collection.rb +36 -0
- data/lib/relaton/ogc/item.rb +13 -0
- data/lib/relaton/ogc/item_data.rb +6 -0
- data/lib/relaton/ogc/processor.rb +58 -0
- data/lib/relaton/ogc/scraper.rb +225 -0
- data/lib/relaton/ogc/util.rb +8 -0
- data/lib/relaton/ogc.rb +26 -0
- data/lib/relaton/oiml/bibdata.rb +8 -0
- data/lib/relaton/oiml/bibitem.rb +8 -0
- data/lib/relaton/oiml/bibliography.rb +94 -0
- data/lib/relaton/oiml/docidentifier.rb +33 -0
- data/lib/relaton/oiml/doctype.rb +13 -0
- data/lib/relaton/oiml/ext.rb +42 -0
- data/lib/relaton/oiml/item.rb +20 -0
- data/lib/relaton/oiml/item_base.rb +18 -0
- data/lib/relaton/oiml/item_data.rb +6 -0
- data/lib/relaton/oiml/processor.rb +54 -0
- data/lib/relaton/oiml/relation.rb +9 -0
- data/lib/relaton/oiml/util.rb +8 -0
- data/lib/relaton/oiml.rb +24 -0
- data/lib/relaton/omg/bibdata.rb +8 -0
- data/lib/relaton/omg/bibitem.rb +8 -0
- data/lib/relaton/omg/bibliography.rb +31 -0
- data/lib/relaton/omg/ext.rb +7 -0
- data/lib/relaton/omg/item.rb +8 -0
- data/lib/relaton/omg/item_data.rb +6 -0
- data/lib/relaton/omg/processor.rb +34 -0
- data/lib/relaton/omg/scraper.rb +141 -0
- data/lib/relaton/omg/util.rb +8 -0
- data/lib/relaton/omg.rb +24 -0
- data/lib/relaton/plateau/bibdata.rb +8 -0
- data/lib/relaton/plateau/bibitem.rb +8 -0
- data/lib/relaton/plateau/bibliography.rb +24 -0
- data/lib/relaton/plateau/data_fetcher.rb +153 -0
- data/lib/relaton/plateau/doctype.rb +7 -0
- data/lib/relaton/plateau/ext.rb +23 -0
- data/lib/relaton/plateau/handbook_parser.rb +95 -0
- data/lib/relaton/plateau/hit.rb +13 -0
- data/lib/relaton/plateau/hit_collection.rb +59 -0
- data/lib/relaton/plateau/item.rb +12 -0
- data/lib/relaton/plateau/item_data.rb +6 -0
- data/lib/relaton/plateau/parser.rb +101 -0
- data/lib/relaton/plateau/processor.rb +49 -0
- data/lib/relaton/plateau/technical_report_parser.rb +91 -0
- data/lib/relaton/plateau/util.rb +8 -0
- data/lib/relaton/plateau.rb +28 -0
- data/lib/relaton/un/bibdata.rb +8 -0
- data/lib/relaton/un/bibitem.rb +8 -0
- data/lib/relaton/un/bibliography.rb +48 -0
- data/lib/relaton/un/doctype.rb +10 -0
- data/lib/relaton/un/ext.rb +30 -0
- data/lib/relaton/un/hit.rb +56 -0
- data/lib/relaton/un/hit_collection.rb +61 -0
- data/lib/relaton/un/item.rb +11 -0
- data/lib/relaton/un/item_data.rb +6 -0
- data/lib/relaton/un/parser.rb +108 -0
- data/lib/relaton/un/processor.rb +38 -0
- data/lib/relaton/un/session.rb +25 -0
- data/lib/relaton/un/token_generator.rb +105 -0
- data/lib/relaton/un/util.rb +8 -0
- data/lib/relaton/un/wasm/decoder.rb +434 -0
- data/lib/relaton/un/wasm/instance.rb +101 -0
- data/lib/relaton/un/wasm/interpreter.rb +613 -0
- data/lib/relaton/un/wasm/memory.rb +112 -0
- data/lib/relaton/un/wasm/module.rb +47 -0
- data/lib/relaton/un/wasm.rb +17 -0
- data/lib/relaton/un/wasm_v_bg.wasm +0 -0
- data/lib/relaton/un.rb +28 -0
- data/lib/relaton/version.rb +1 -1
- data/lib/relaton/w3c/bibdata.rb +8 -0
- data/lib/relaton/w3c/bibitem.rb +8 -0
- data/lib/relaton/w3c/bibliography.rb +54 -0
- data/lib/relaton/w3c/data_fetcher.rb +309 -0
- data/lib/relaton/w3c/data_parser.rb +379 -0
- data/lib/relaton/w3c/doctype.rb +7 -0
- data/lib/relaton/w3c/ext.rb +11 -0
- data/lib/relaton/w3c/item.rb +12 -0
- data/lib/relaton/w3c/item_data.rb +6 -0
- data/lib/relaton/w3c/processor.rb +49 -0
- data/lib/relaton/w3c/pubid.rb +73 -0
- data/lib/relaton/w3c/safe_realize.rb +59 -0
- data/lib/relaton/w3c/util.rb +8 -0
- data/lib/relaton/w3c.rb +25 -0
- data/lib/relaton/xsf/bibdata.rb +8 -0
- data/lib/relaton/xsf/bibitem.rb +8 -0
- data/lib/relaton/xsf/bibliography.rb +24 -0
- data/lib/relaton/xsf/data_fetcher.rb +56 -0
- data/lib/relaton/xsf/hit.rb +17 -0
- data/lib/relaton/xsf/hit_collection.rb +24 -0
- data/lib/relaton/xsf/item.rb +7 -0
- data/lib/relaton/xsf/item_data.rb +6 -0
- data/lib/relaton/xsf/processor.rb +50 -0
- data/lib/relaton/xsf/util.rb +9 -0
- data/lib/relaton/xsf.rb +30 -0
- data/lib/relaton-core.rb +1 -0
- data/lib/relaton.rb +44 -9
- metadata +708 -150
- data/.github/workflows/rake.yml +0 -14
- data/.github/workflows/release.yml +0 -24
- data/.github/workflows/rubocop.yml +0 -48
- data/.gitignore +0 -12
- data/.rspec +0 -3
- data/.rubocop.yml +0 -12
- data/CLAUDE.md +0 -70
- data/Gemfile +0 -21
- data/Rakefile +0 -6
- data/docs/CHANGELOG.adoc +0 -16
- data/docs/VERSIONING_POLICY.adoc +0 -38
- data/docs/navigation.adoc +0 -6
- data/lib/relaton/config.rb +0 -24
- data/lib/relaton/db_cache.rb +0 -230
- data/lib/relaton/registry.rb +0 -118
- data/lib/relaton/util.rb +0 -7
- data/lib/relaton/workers_pool.rb +0 -21
- data/relaton.gemspec +0 -61
- data/spec/relaton/config_spec.rb +0 -10
- data/spec/relaton/db_cache_spec.rb +0 -51
- data/spec/relaton/db_spec.rb +0 -556
- data/spec/relaton/registry_spec.rb +0 -178
- data/spec/relaton/util_spec.rb +0 -3
- data/spec/relaton_spec.rb +0 -725
- data/spec/spec_helper.rb +0 -45
- data/spec/support/gb_t_20223_2006.xml +0 -33
- data/spec/support/iso_111111119115_1.xml +0 -0
- data/spec/support/iso_19115_1.xml +0 -115
- data/spec/support/iso_19115_2.xml +0 -95
- data/spec/support/rfc_8341.xml +0 -46
- data/spec/vcr_cassetes/3gpp_tr_00_01u_umts_3_0_0.yml +0 -12720
- data/spec/vcr_cassetes/api_relaton_org.yml +0 -121
- data/spec/vcr_cassetes/api_relaton_org_unavailable.yml +0 -143
- data/spec/vcr_cassetes/cc_dir_10005_2019.yml +0 -199
- data/spec/vcr_cassetes/cie_001_1980.yml +0 -401
- data/spec/vcr_cassetes/cipm_meeting_43.yml +0 -1513
- data/spec/vcr_cassetes/doi_10_6028_nist_ir_8245.yml +0 -86
- data/spec/vcr_cassetes/ecma_6.yml +0 -112
- data/spec/vcr_cassetes/en_10160_1999.yml +0 -13624
- data/spec/vcr_cassetes/gb_t_20223_2006.yml +0 -733
- data/spec/vcr_cassetes/ieee_528_2019.yml +0 -2786
- data/spec/vcr_cassetes/iso_111111119115_1.yml +0 -12951
- data/spec/vcr_cassetes/iso_19115_1.yml +0 -13177
- data/spec/vcr_cassetes/iso_19115_1_2.yml +0 -369
- data/spec/vcr_cassetes/iso_19115_1_std.yml +0 -13177
- data/spec/vcr_cassetes/iso_19115_all_parts.yml +0 -229
- data/spec/vcr_cassetes/iso_19133_2005.yml +0 -148
- data/spec/vcr_cassetes/iso_combined_applied.yml +0 -364
- data/spec/vcr_cassetes/iso_combined_included.yml +0 -364
- data/spec/vcr_cassetes/iso_dis.yml +0 -157
- data/spec/vcr_cassetes/ogc_19_025r1.yml +0 -371
- data/spec/vcr_cassetes/omg_ami4ccm_1_0.yml +0 -317
- data/spec/vcr_cassetes/rfc_8341.yml +0 -1272
data/.github/workflows/rake.yml
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Auto-generated by Cimas: Do not edit it manually!
|
|
2
|
-
# See https://github.com/metanorma/cimas
|
|
3
|
-
name: rake
|
|
4
|
-
|
|
5
|
-
on:
|
|
6
|
-
push:
|
|
7
|
-
branches: [ master, main ]
|
|
8
|
-
tags: [ v* ]
|
|
9
|
-
pull_request:
|
|
10
|
-
workflow_dispatch:
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
rake:
|
|
14
|
-
uses: relaton/support/.github/workflows/rake.yml@main
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Auto-generated by Cimas: Do not edit it manually!
|
|
2
|
-
# See https://github.com/metanorma/cimas
|
|
3
|
-
name: release
|
|
4
|
-
|
|
5
|
-
on:
|
|
6
|
-
workflow_dispatch:
|
|
7
|
-
inputs:
|
|
8
|
-
next_version:
|
|
9
|
-
description: |
|
|
10
|
-
Next release version. Possible values: x.y.z, major, minor, patch (or pre|rc|etc).
|
|
11
|
-
Also, you can pass 'skip' to skip 'git tag' and do 'gem push' for the current version
|
|
12
|
-
required: true
|
|
13
|
-
default: 'skip'
|
|
14
|
-
repository_dispatch:
|
|
15
|
-
types: [ do-release ]
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
jobs:
|
|
19
|
-
release:
|
|
20
|
-
uses: relaton/support/.github/workflows/release.yml@main
|
|
21
|
-
with:
|
|
22
|
-
next_version: ${{ github.event.inputs.next_version }}
|
|
23
|
-
secrets:
|
|
24
|
-
rubygems-api-key: ${{ secrets.RELATON_CI_RUBYGEMS_API_KEY }}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
name: Rubocop
|
|
2
|
-
|
|
3
|
-
on: pull_request
|
|
4
|
-
|
|
5
|
-
permissions:
|
|
6
|
-
contents: read
|
|
7
|
-
pull-requests: write
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
rubocop:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
steps:
|
|
13
|
-
- uses: actions/checkout@v4
|
|
14
|
-
with:
|
|
15
|
-
fetch-depth: 1
|
|
16
|
-
- name: Determine Ruby version for ruby/setup-ruby
|
|
17
|
-
shell: bash
|
|
18
|
-
run: |
|
|
19
|
-
RUBY_VERSION=${{ vars.RUBY_VERSION }}
|
|
20
|
-
|
|
21
|
-
if [[ -r .rubocop.yml ]]
|
|
22
|
-
then
|
|
23
|
-
RUBY_VERSION=$( \
|
|
24
|
-
command grep \
|
|
25
|
-
-E '^\s*TargetRubyVersion:\s*[0-9]+(\.[0-9]+)*' \
|
|
26
|
-
.rubocop.yml \
|
|
27
|
-
| command awk '{print $2}' \
|
|
28
|
-
)
|
|
29
|
-
fi
|
|
30
|
-
|
|
31
|
-
if [[ -z $RUBY_VERSION ]]
|
|
32
|
-
then
|
|
33
|
-
# Let setup-ruby determine the Ruby version if no .ruby-version,
|
|
34
|
-
# .tool-versions or mise.toml file exists
|
|
35
|
-
RUBY_VERSION=default
|
|
36
|
-
fi
|
|
37
|
-
|
|
38
|
-
echo "RUBY_VERSION=$RUBY_VERSION" >> $GITHUB_ENV
|
|
39
|
-
- uses: ruby/setup-ruby@v1
|
|
40
|
-
with:
|
|
41
|
-
# input ruby-version needs to be specified if no .ruby-version,
|
|
42
|
-
# .tool-versions or mise.toml file exists
|
|
43
|
-
#
|
|
44
|
-
# Use the version that matches the one in gemspec & .rubocop.yml
|
|
45
|
-
ruby-version: ${{ env.RUBY_VERSION }}
|
|
46
|
-
- uses: reclaim-the-stack/rubocop-action@v1.1.0
|
|
47
|
-
with:
|
|
48
|
-
gem_versions: rubocop:1.84.2 rubocop-performance:1.26.1 rubocop-rails:2.34.3
|
data/.gitignore
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
coverage/
|
|
2
|
-
.byebug_history
|
|
3
|
-
.rspec_status
|
|
4
|
-
|
|
5
|
-
testcache
|
|
6
|
-
testcache2
|
|
7
|
-
.rubocop-https---raw-githubusercontent-com-riboseinc-oss-guides-master-ci-rubocop-yml
|
|
8
|
-
.vscode/
|
|
9
|
-
pkg/
|
|
10
|
-
Gemfile.lock
|
|
11
|
-
.rubocop-remote-87c7cdd254a8d09d005ee06efac7acc0.yml
|
|
12
|
-
.claude/
|
data/.rspec
DELETED
data/.rubocop.yml
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# This project follows the Ribose OSS style guide.
|
|
2
|
-
# https://github.com/riboseinc/oss-guides
|
|
3
|
-
# All project-specific additions and overrides should be specified in this file.
|
|
4
|
-
|
|
5
|
-
plugins: rubocop-rails
|
|
6
|
-
|
|
7
|
-
inherit_from:
|
|
8
|
-
- https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
|
|
9
|
-
AllCops:
|
|
10
|
-
TargetRubyVersion: 3.2
|
|
11
|
-
Rails:
|
|
12
|
-
Enabled: false
|
data/CLAUDE.md
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
# CLAUDE.md
|
|
2
|
-
|
|
3
|
-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
-
|
|
5
|
-
## Commands
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
# Run full test suite
|
|
9
|
-
bundle exec rake # or: bundle exec rspec
|
|
10
|
-
|
|
11
|
-
# Run a single spec file
|
|
12
|
-
bundle exec rspec spec/relaton/db_spec.rb
|
|
13
|
-
|
|
14
|
-
# Run a specific test by line number
|
|
15
|
-
bundle exec rspec spec/relaton/db_spec.rb:234
|
|
16
|
-
|
|
17
|
-
# Lint
|
|
18
|
-
bundle exec rubocop
|
|
19
|
-
|
|
20
|
-
# Lint with auto-fix
|
|
21
|
-
bundle exec rubocop -a
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Architecture
|
|
25
|
-
|
|
26
|
-
Relaton is a Ruby gem that fetches, caches, and manages bibliographic references to technical standards from 25+ organizations (ISO, IEC, IETF, NIST, IEEE, etc.).
|
|
27
|
-
|
|
28
|
-
### Plugin Registry Pattern
|
|
29
|
-
|
|
30
|
-
**Relaton::Registry** (singleton) auto-discovers and manages backend processor gems (relaton-iso, relaton-iec, relaton-ietf, etc.). Each processor implements the **Relaton::Processor** interface (`get`, `from_xml`, `from_yaml`, `grammar_hash`, `prefix`, `defaultprefix`). The registry routes reference codes to the correct processor by matching prefixes (e.g., "ISO 19115" → `:relaton_iso`).
|
|
31
|
-
|
|
32
|
-
### Db (lib/relaton/db.rb) — Main Public API
|
|
33
|
-
|
|
34
|
-
`Relaton::Db#fetch(ref, year, opts)` is the primary entry point. It:
|
|
35
|
-
1. Identifies the processor via Registry prefix matching
|
|
36
|
-
2. Handles combined references (`+` for derivedFrom, `,` for amendments) in `combine_doc`
|
|
37
|
-
3. Delegates to `check_bibliocache` which manages the dual-cache lookup and network fetch flow
|
|
38
|
-
|
|
39
|
-
`Relaton::Db#fetch_all(text, edition, year)` searches cached entries, filtering by text content (via `match_xml_text?`), edition, and/or year. Returns an array of deserialized bibliographic items from both local and global caches.
|
|
40
|
-
|
|
41
|
-
The dual-cache strategy uses a **global cache** (`~/.relaton/cache`) and an optional **local cache** (project-level). `check_bibliocache` checks local first, falls back to global, and syncs between them.
|
|
42
|
-
|
|
43
|
-
### DbCache (lib/relaton/db_cache.rb) — File-based Storage
|
|
44
|
-
|
|
45
|
-
Stores entries as files under `{dir}/{prefix}/{filename}.{ext}` (e.g., `testcache/iso/iso_19115-1.xml`). Key behaviors:
|
|
46
|
-
- Cache keys are wrapped like `ISO(ISO 19115-1:2014)` and converted to filenames via regex
|
|
47
|
-
- Entries can be XML, "not_found {date}", or "redirection {target_key}"
|
|
48
|
-
- Undated references expire after 60 days; dated ones persist indefinitely
|
|
49
|
-
- Version tracking per prefix directory invalidates cache when processor grammar changes
|
|
50
|
-
- File locking (`LOCK_EX`) for thread-safe concurrent writes
|
|
51
|
-
|
|
52
|
-
### WorkersPool (lib/relaton/workers_pool.rb)
|
|
53
|
-
|
|
54
|
-
Thread pool for `fetch_async`. Default 10 threads per processor, overridable via `RELATON_FETCH_PARALLEL` env var.
|
|
55
|
-
|
|
56
|
-
### Cache Key Format
|
|
57
|
-
|
|
58
|
-
`std_id` builds keys like `ISO(ISO 19115-1:2014 (all parts) after-2020-01-01)`. The filename regex in `db_cache.rb` uses `[^)]+` — suffixes use `-` not parentheses to avoid breaking it.
|
|
59
|
-
|
|
60
|
-
## Testing
|
|
61
|
-
|
|
62
|
-
- RSpec with VCR cassettes in `spec/vcr_cassetes/` for recorded HTTP interactions
|
|
63
|
-
- Tests create `testcache`/`testcache2` directories and clean them in `before(:each)`
|
|
64
|
-
- Cache-related tests need `<fetched>` elements in XML for `valid_entry?` to return true
|
|
65
|
-
- Integration tests in `spec/relaton_spec.rb`; unit tests mirror `lib/` structure under `spec/relaton/`
|
|
66
|
-
|
|
67
|
-
## Style
|
|
68
|
-
|
|
69
|
-
- RuboCop config inherits from [Ribose OSS guides](https://github.com/riboseinc/oss-guides), target Ruby 3.2
|
|
70
|
-
- Thread safety via `@semaphore` (Mutex) around cache reads/writes in Db
|
data/Gemfile
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
source "https://rubygems.org"
|
|
2
|
-
|
|
3
|
-
# Specify your gem's dependencies in gemspec
|
|
4
|
-
gemspec
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
gem "byebug"
|
|
9
|
-
gem "equivalent-xml", "~> 0.6"
|
|
10
|
-
gem "guard", "~> 2.14"
|
|
11
|
-
gem "guard-rspec", "~> 4.7"
|
|
12
|
-
gem "pry-byebug"
|
|
13
|
-
gem "rake", "~> 13.0"
|
|
14
|
-
gem "rspec", "~> 3.6"
|
|
15
|
-
gem "rubocop"
|
|
16
|
-
gem "rubocop-performance"
|
|
17
|
-
gem "rubocop-rails"
|
|
18
|
-
gem "simplecov", "~> 0.15"
|
|
19
|
-
gem "timecop", "~> 0.9"
|
|
20
|
-
gem "vcr", "~> 6"
|
|
21
|
-
gem "webmock", "~> 3.18"
|
data/Rakefile
DELETED
data/docs/CHANGELOG.adoc
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
= Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on https://keepachangelog.com/en/1.0.0/[Keep a Changelog], and this project adheres to https://semver.org/[Semantic Versioning].
|
|
6
|
-
|
|
7
|
-
== [Unreleased]
|
|
8
|
-
|
|
9
|
-
== [1.19.2] - 2024-06-29
|
|
10
|
-
- Lazy load Relaton flavor gems dependencies.
|
|
11
|
-
|
|
12
|
-
== [1.19.1] - 2024-06-24
|
|
13
|
-
- Add `relaton-plateau` flavor gem.
|
|
14
|
-
|
|
15
|
-
== [1.19.0] - 2024-06-29
|
|
16
|
-
- Switch to using the `relaton-logger` gem for logging.
|
data/docs/VERSIONING_POLICY.adoc
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
= Versioning Policy
|
|
2
|
-
|
|
3
|
-
This document describes the versioning policy for the Relaton project. We follow the https://semver.org/[Semantic Versioning] scheme.
|
|
4
|
-
|
|
5
|
-
== Versioning Scheme
|
|
6
|
-
|
|
7
|
-
Version nubmers are in the form of `MAJOR.MINOR.PATCH`. The version number is incremented based on the following:
|
|
8
|
-
|
|
9
|
-
- `MAJOR` version is incremented when incompatible changes are made to the API.
|
|
10
|
-
- `MINOR` version is incremented when the Relaton data model is changed.
|
|
11
|
-
- `PATCH` version is incremented when backward-compatible bug fixes are made.
|
|
12
|
-
|
|
13
|
-
== Rules for incrementing version numbers
|
|
14
|
-
|
|
15
|
-
1. **MAJOR** version is incremented when incompatible changes are made to the API. Icrement the MAJOR version when:
|
|
16
|
-
- Removing or renaming classes or methods.
|
|
17
|
-
- Changing the signature of a method.
|
|
18
|
-
- Changing the behavior of a method.
|
|
19
|
-
|
|
20
|
-
2. **MINOR** version is incremented when the Relaton data model is changed. Increment the MINOR version when:
|
|
21
|
-
- Adding, remmoving or renaming attributes of data model classes.
|
|
22
|
-
- Adding new data model classes.
|
|
23
|
-
|
|
24
|
-
3. **PATCH** version is incremented when backward-compatible bug fixes are made. Increment the PATCH version when:
|
|
25
|
-
- Fixing a bug that does not change the behavior of the API.
|
|
26
|
-
- Improving the performance of the API.
|
|
27
|
-
|
|
28
|
-
== Additional Guidelines
|
|
29
|
-
|
|
30
|
-
For convenience, we use the same major and minor vesions for all the Relaton flavor gems that uses the same version of the Relaton data model.
|
|
31
|
-
|
|
32
|
-
== Exceptions
|
|
33
|
-
|
|
34
|
-
In some cases, we may increment the `PATCH` version for backward-incompatible changes. In such cases, we will update dependent gems to use the new version or higher. For example `"~> 1.19.2"` doen't allow to use version less than `1.19.2`.
|
|
35
|
-
|
|
36
|
-
== References
|
|
37
|
-
|
|
38
|
-
- https://semver.org/[Semantic Versioning]
|
data/docs/navigation.adoc
DELETED
data/lib/relaton/config.rb
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
module Relaton
|
|
2
|
-
module Config
|
|
3
|
-
def configure
|
|
4
|
-
yield configuration if block_given?
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
def configuration
|
|
8
|
-
@configuration ||= self::Configuration.new
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
# < RelatonBib::Configuration
|
|
13
|
-
class Configuration
|
|
14
|
-
attr_accessor :use_api, :api_host
|
|
15
|
-
|
|
16
|
-
def initialize
|
|
17
|
-
# super
|
|
18
|
-
@use_api = false
|
|
19
|
-
@api_host = "https://api.relaton.org"
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
extend Config
|
|
24
|
-
end
|
data/lib/relaton/db_cache.rb
DELETED
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
require "fileutils"
|
|
2
|
-
require "timeout"
|
|
3
|
-
|
|
4
|
-
module Relaton
|
|
5
|
-
class DbCache
|
|
6
|
-
# @return [String]
|
|
7
|
-
attr_reader :dir
|
|
8
|
-
|
|
9
|
-
# @param dir [String] DB directory
|
|
10
|
-
def initialize(dir, ext = "xml")
|
|
11
|
-
@dir = dir
|
|
12
|
-
@ext = ext
|
|
13
|
-
FileUtils::mkdir_p dir
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# Move caches to anothe dir
|
|
17
|
-
# @param new_dir [String, nil]
|
|
18
|
-
# @return [String, nil]
|
|
19
|
-
def mv(new_dir)
|
|
20
|
-
return unless new_dir && @ext == "xml"
|
|
21
|
-
|
|
22
|
-
if File.exist? new_dir
|
|
23
|
-
Util.info "target directory exists `#{new_dir}`"
|
|
24
|
-
return
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
FileUtils.mv dir, new_dir
|
|
28
|
-
@dir = new_dir
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
# Clear database
|
|
32
|
-
def clear
|
|
33
|
-
FileUtils.rm_rf Dir.glob "#{dir}/*"
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
# Save item
|
|
37
|
-
# @param key [String]
|
|
38
|
-
# @param value [String] Bibitem xml serialization
|
|
39
|
-
def []=(key, value)
|
|
40
|
-
if value.nil?
|
|
41
|
-
delete key
|
|
42
|
-
return
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
prefix_dir = "#{@dir}/#{prefix(key)}"
|
|
46
|
-
FileUtils::mkdir_p prefix_dir
|
|
47
|
-
set_version prefix_dir
|
|
48
|
-
file_safe_write "#{filename(key)}.#{ext(value)}", value
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
# @param value [String]
|
|
52
|
-
# @return [String]
|
|
53
|
-
def ext(value)
|
|
54
|
-
case value
|
|
55
|
-
when /^not_found/ then "notfound"
|
|
56
|
-
when /^redirection/ then "redirect"
|
|
57
|
-
else @ext
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
# Read item
|
|
62
|
-
# @param key [String]
|
|
63
|
-
# @return [String]
|
|
64
|
-
def [](key)
|
|
65
|
-
value = get(key)
|
|
66
|
-
if (code = redirect_code value)
|
|
67
|
-
self[code]
|
|
68
|
-
else
|
|
69
|
-
value
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
#
|
|
74
|
-
# Save entry from cache of `db` to this cache.
|
|
75
|
-
#
|
|
76
|
-
# @param [String] key key of the entry
|
|
77
|
-
# @param [Relaton::Db] db database
|
|
78
|
-
#
|
|
79
|
-
def clone_entry(key, db)
|
|
80
|
-
self[key] ||= db.get(key)
|
|
81
|
-
if (code = redirect_code get(key))
|
|
82
|
-
clone_entry code, db
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
# Return fetched date
|
|
87
|
-
# @param key [String]
|
|
88
|
-
# @return [String]
|
|
89
|
-
def fetched(key)
|
|
90
|
-
value = self[key]
|
|
91
|
-
return unless value
|
|
92
|
-
|
|
93
|
-
if value.match?(/^not_found/)
|
|
94
|
-
value.match(/\d{4}-\d{2}-\d{2}/).to_s
|
|
95
|
-
else
|
|
96
|
-
doc = Nokogiri::XML value
|
|
97
|
-
doc.at("/bibitem/fetched|bibdata/fetched")&.text
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
# Returns all items
|
|
102
|
-
# @return [Array<String>]
|
|
103
|
-
def all(&block)
|
|
104
|
-
Dir.glob("#{@dir}/**/*.{xml,yml,yaml}").map do |f|
|
|
105
|
-
content = File.read(f, encoding: "utf-8")
|
|
106
|
-
block ? yield(f, content) : content
|
|
107
|
-
end
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
# Delete item
|
|
111
|
-
# @param key [String]
|
|
112
|
-
def delete(key)
|
|
113
|
-
file = filename key
|
|
114
|
-
f = search_ext file
|
|
115
|
-
return unless f
|
|
116
|
-
|
|
117
|
-
if File.extname(f) == ".redirect"
|
|
118
|
-
code = redirect_code get(key)
|
|
119
|
-
delete code if code
|
|
120
|
-
end
|
|
121
|
-
File.delete f
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
# Check if version of the DB match to the gem grammar hash.
|
|
125
|
-
# @param fdir [String] dir pathe to flover cache
|
|
126
|
-
# @return [Boolean]
|
|
127
|
-
def check_version?(fdir)
|
|
128
|
-
version_dir = "#{fdir}/version"
|
|
129
|
-
return false unless File.exist? version_dir
|
|
130
|
-
|
|
131
|
-
v = File.read version_dir, encoding: "utf-8"
|
|
132
|
-
v.strip == self.class.grammar_hash(fdir)
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
# if cached reference is undated, expire it after 60 days
|
|
136
|
-
# @param key [String]
|
|
137
|
-
# @param year [String]
|
|
138
|
-
def valid_entry?(key, year)
|
|
139
|
-
datestr = fetched key
|
|
140
|
-
return false unless datestr
|
|
141
|
-
|
|
142
|
-
date = Date.parse datestr
|
|
143
|
-
year || Date.today - date < 60
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
# Reads file by a key
|
|
147
|
-
#
|
|
148
|
-
# @param key [String]
|
|
149
|
-
# @return [String, NilClass]
|
|
150
|
-
def get(key)
|
|
151
|
-
file = filename key
|
|
152
|
-
return unless (f = search_ext(file))
|
|
153
|
-
|
|
154
|
-
File.read(f, encoding: "utf-8")
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
# @param fdir [String] dir pathe to flover cache
|
|
158
|
-
# @return [String]
|
|
159
|
-
def self.grammar_hash(fdir)
|
|
160
|
-
type = fdir.split("/").last
|
|
161
|
-
Relaton::Registry.instance.by_type(type)&.grammar_hash
|
|
162
|
-
end
|
|
163
|
-
|
|
164
|
-
private
|
|
165
|
-
|
|
166
|
-
# @param value [String]
|
|
167
|
-
# @return [String]
|
|
168
|
-
def filename(key)
|
|
169
|
-
prefcode = key.downcase.match(/^(?<prefix>[^(]+)\((?<code>[^)]+)/)
|
|
170
|
-
fn = if prefcode
|
|
171
|
-
"#{prefcode[:prefix]}/#{prefcode[:code].gsub(/[:\s\/()]/,
|
|
172
|
-
'_').squeeze('_')}"
|
|
173
|
-
else
|
|
174
|
-
key.gsub(/[-:\s]/, "_")
|
|
175
|
-
end
|
|
176
|
-
"#{@dir}/#{fn.sub(/(,|_$)/, '')}"
|
|
177
|
-
end
|
|
178
|
-
|
|
179
|
-
#
|
|
180
|
-
# Checks if there is file with xml or txt extension and return filename with
|
|
181
|
-
# the extension.
|
|
182
|
-
#
|
|
183
|
-
# @param file [String]
|
|
184
|
-
# @return [String, NilClass]
|
|
185
|
-
def search_ext(file)
|
|
186
|
-
if File.exist?("#{file}.#{@ext}")
|
|
187
|
-
"#{file}.#{@ext}"
|
|
188
|
-
elsif File.exist? "#{file}.notfound"
|
|
189
|
-
"#{file}.notfound"
|
|
190
|
-
elsif File.exist? "#{file}.redirect"
|
|
191
|
-
"#{file}.redirect"
|
|
192
|
-
end
|
|
193
|
-
end
|
|
194
|
-
|
|
195
|
-
# Set version of the DB to the gem grammar hash.
|
|
196
|
-
# @param fdir [String] dir pathe to flover cache
|
|
197
|
-
def set_version(fdir)
|
|
198
|
-
file_version = "#{fdir}/version"
|
|
199
|
-
unless File.exist? file_version
|
|
200
|
-
file_safe_write file_version, self.class.grammar_hash(fdir)
|
|
201
|
-
end
|
|
202
|
-
end
|
|
203
|
-
|
|
204
|
-
# Return item's file name
|
|
205
|
-
# @param key [String]
|
|
206
|
-
# @return [String]
|
|
207
|
-
def prefix(key)
|
|
208
|
-
key.downcase.match(/^[^(]+(?=\()/).to_s
|
|
209
|
-
end
|
|
210
|
-
|
|
211
|
-
# Check if a file content is redirection
|
|
212
|
-
#
|
|
213
|
-
# @prarm value [String] file content
|
|
214
|
-
# @return [String, NilClass] redirection code or nil
|
|
215
|
-
def redirect_code(value)
|
|
216
|
-
%r{redirection\s(?<code>.*)} =~ value
|
|
217
|
-
code
|
|
218
|
-
end
|
|
219
|
-
|
|
220
|
-
# @param file [String]
|
|
221
|
-
# @content [String]
|
|
222
|
-
def file_safe_write(file, content)
|
|
223
|
-
File.open file, File::RDWR | File::CREAT, encoding: "UTF-8" do |f|
|
|
224
|
-
Timeout.timeout(10) { f.flock File::LOCK_EX }
|
|
225
|
-
f.write content
|
|
226
|
-
f.flock File::LOCK_UN
|
|
227
|
-
end
|
|
228
|
-
end
|
|
229
|
-
end
|
|
230
|
-
end
|
data/lib/relaton/registry.rb
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
require "singleton"
|
|
2
|
-
|
|
3
|
-
# class Error < StandardError
|
|
4
|
-
# end
|
|
5
|
-
|
|
6
|
-
module Relaton
|
|
7
|
-
class Registry
|
|
8
|
-
SUPPORTED_GEMS = %w[
|
|
9
|
-
relaton/gb relaton/iec relaton/ietf relaton/iso
|
|
10
|
-
relaton/itu relaton/nist relaton/ogc relaton/calconnect
|
|
11
|
-
relaton/omg relaton/un relaton/w3c relaton/ieee
|
|
12
|
-
relaton/iho relaton/bipm relaton/ecma relaton/cie
|
|
13
|
-
relaton/bsi relaton/cen relaton/iana relaton/3gpp
|
|
14
|
-
relaton/oasis relaton/doi relaton/jis relaton/xsf
|
|
15
|
-
relaton/ccsds relaton/etsi relaton/isbn relaton/plateau
|
|
16
|
-
].freeze
|
|
17
|
-
|
|
18
|
-
include Singleton
|
|
19
|
-
|
|
20
|
-
attr_reader :processors
|
|
21
|
-
|
|
22
|
-
def initialize
|
|
23
|
-
@processors = {}
|
|
24
|
-
register_gems
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def register_gems
|
|
28
|
-
# Util.info("Info: detecting backends:")
|
|
29
|
-
|
|
30
|
-
SUPPORTED_GEMS.each do |b|
|
|
31
|
-
require "#{b}/processor"
|
|
32
|
-
register Kernel.const_get "#{gem_to_module_path(b)}::Processor"
|
|
33
|
-
rescue LoadError => e
|
|
34
|
-
Util.error "backend #{b} not present\n" \
|
|
35
|
-
"#{e.message}\n#{e.backtrace.join "\n"}"
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def register(processor)
|
|
40
|
-
raise Error unless processor < Core::Processor
|
|
41
|
-
|
|
42
|
-
p = processor.new
|
|
43
|
-
return if processors[p.short]
|
|
44
|
-
|
|
45
|
-
Util.debug("processor \"#{p.short}\" registered")
|
|
46
|
-
processors[p.short] = p
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def find_processor(short)
|
|
50
|
-
processors[short.to_sym]
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
# @return [Array<Symbol>]
|
|
54
|
-
def supported_processors
|
|
55
|
-
processors.keys
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
#
|
|
59
|
-
# Search a rpocessos by dataset name
|
|
60
|
-
#
|
|
61
|
-
# @param [String] dataset
|
|
62
|
-
#
|
|
63
|
-
# @return [Relaton::Core::Processor, nil]
|
|
64
|
-
#
|
|
65
|
-
def find_processor_by_dataset(dataset)
|
|
66
|
-
processors.values.detect { |p| p.datasets&.include? dataset }
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
#
|
|
70
|
-
# Find processor by type
|
|
71
|
-
#
|
|
72
|
-
# @param type [String]
|
|
73
|
-
# @return [Relaton::Core::Processor]
|
|
74
|
-
def by_type(type)
|
|
75
|
-
processors.values.detect { |v| v.prefix == type&.upcase }
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
def [](stdclass)
|
|
79
|
-
processors[stdclass]
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
#
|
|
83
|
-
# Find processor by reference or prefix
|
|
84
|
-
#
|
|
85
|
-
# @param [String] ref reference or prefix
|
|
86
|
-
#
|
|
87
|
-
# @return [Relaton::Core::Processor] processor
|
|
88
|
-
#
|
|
89
|
-
def processor_by_ref(ref)
|
|
90
|
-
processors[class_by_ref(ref)]
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
#
|
|
94
|
-
# Find processor by refernce or prefix
|
|
95
|
-
#
|
|
96
|
-
# @param ref [String] reference or prefix
|
|
97
|
-
#
|
|
98
|
-
# @return [Symbol, nil] standard class name
|
|
99
|
-
#
|
|
100
|
-
def class_by_ref(ref)
|
|
101
|
-
ref = Regexp.last_match(1) if ref =~ /^\w+\((.*)\)$/
|
|
102
|
-
@processors.each do |class_name, processor|
|
|
103
|
-
return class_name if /^(urn:)?#{processor.prefix}\b/i.match?(ref) ||
|
|
104
|
-
processor.defaultprefix.match(ref)
|
|
105
|
-
end
|
|
106
|
-
Util.info "`#{ref}` does not have a recognised prefix", key: ref
|
|
107
|
-
nil
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
private
|
|
111
|
-
|
|
112
|
-
def gem_to_module_path(gem_name)
|
|
113
|
-
gem_name.split("/").map do |part|
|
|
114
|
-
part.capitalize.sub("3gpp", "ThreeGpp")
|
|
115
|
-
end.join("::")
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
|
-
end
|
data/lib/relaton/util.rb
DELETED
data/lib/relaton/workers_pool.rb
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Relaton
|
|
4
|
-
# Workers poll.
|
|
5
|
-
class WorkersPool
|
|
6
|
-
def initialize(workers = 2, &)
|
|
7
|
-
# num_workers = workers < 2 ? 2 : workers
|
|
8
|
-
@queue = SizedQueue.new(workers * 2)
|
|
9
|
-
@threads = Array.new workers do
|
|
10
|
-
Thread.new do
|
|
11
|
-
while item = @queue.pop; yield(item) end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def <<(item)
|
|
17
|
-
@queue << item
|
|
18
|
-
self
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|