relaton 2.2.0.pre.alpha.1 → 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/registry.rb +4 -4
- data/lib/relaton/db.rb +0 -1
- 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 +43 -0
- metadata +673 -170
- 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,64 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Bib
|
|
3
|
+
module FullNameType
|
|
4
|
+
class Forename < LocalizedString
|
|
5
|
+
attribute :initial, :string
|
|
6
|
+
|
|
7
|
+
xml do
|
|
8
|
+
map_attribute "initial", to: :initial
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
key_value do
|
|
12
|
+
map "initial", to: :initial
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self.included(base) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
17
|
+
base.instance_eval do
|
|
18
|
+
attribute :abbreviation, LocalizedString
|
|
19
|
+
attribute :prefix, LocalizedString, collection: true, initialize_empty: true
|
|
20
|
+
attribute :forename, Forename, collection: true, initialize_empty: true
|
|
21
|
+
attribute :formatted_initials, LocalizedString
|
|
22
|
+
attribute :surname, LocalizedString
|
|
23
|
+
attribute :addition, LocalizedString, collection: true, initialize_empty: true
|
|
24
|
+
attribute :completename, LocalizedString
|
|
25
|
+
attribute :note, Note, collection: true, initialize_empty: true
|
|
26
|
+
attribute :variant, Variant, collection: true, initialize_empty: true
|
|
27
|
+
|
|
28
|
+
xml do
|
|
29
|
+
map_element "abbreviation", to: :abbreviation
|
|
30
|
+
map_element "prefix", to: :prefix
|
|
31
|
+
map_element "forename", to: :forename
|
|
32
|
+
map_element "formatted-initials", to: :formatted_initials
|
|
33
|
+
map_element "surname", to: :surname
|
|
34
|
+
map_element "addition", to: :addition
|
|
35
|
+
map_element "completename", to: :completename
|
|
36
|
+
map_element "note", to: :note
|
|
37
|
+
map_element "variant", to: :variant
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# def content_from_xml(model, node)
|
|
43
|
+
# model.content = Content.of_xml node.instance_variable_get(:@node) || node
|
|
44
|
+
# end
|
|
45
|
+
|
|
46
|
+
# def content_to_xml(model, parent, _doc)
|
|
47
|
+
# model.content.add_to_xml parent
|
|
48
|
+
# end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
module FullNameType
|
|
52
|
+
class Variant < Lutaml::Model::Serializable
|
|
53
|
+
include FullNameType
|
|
54
|
+
|
|
55
|
+
attribute :type, :string
|
|
56
|
+
|
|
57
|
+
xml do
|
|
58
|
+
root "variant"
|
|
59
|
+
map_attribute "type", to: :type
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
require "isoics"
|
|
2
|
+
|
|
3
|
+
module Relaton
|
|
4
|
+
module Bib
|
|
5
|
+
class ICS < Lutaml::Model::Serializable
|
|
6
|
+
attribute :code, :string
|
|
7
|
+
attribute :text, :string
|
|
8
|
+
|
|
9
|
+
xml do
|
|
10
|
+
root "ics"
|
|
11
|
+
map_element "code", to: :code
|
|
12
|
+
map_element "text", to: :text
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Returns the explicit text if set, else the Isoics description for
|
|
16
|
+
# `code`. Kept for consumers that read `.text` directly.
|
|
17
|
+
def text
|
|
18
|
+
return @text if @text.is_a?(String) && !@text.empty?
|
|
19
|
+
|
|
20
|
+
Isoics.fetch(code)&.description if code.is_a?(String) && !code.empty?
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# When code is assigned, eagerly populate text from Isoics if no
|
|
24
|
+
# explicit text has been set. Going through the public writer
|
|
25
|
+
# registers the value with the lutaml-model `value_set_for` tracker
|
|
26
|
+
# so the attribute is emitted on serialization.
|
|
27
|
+
def code=(val)
|
|
28
|
+
super
|
|
29
|
+
return unless val.is_a?(String) && !val.empty?
|
|
30
|
+
return if @text.is_a?(String) && !@text.empty?
|
|
31
|
+
|
|
32
|
+
description = Isoics.fetch(val)&.description
|
|
33
|
+
self.text = description if description
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# When the deserializer reaches the end of the XML element and
|
|
37
|
+
# records that <text> was absent, it calls `using_default_for(:text)`
|
|
38
|
+
# to mark the attribute as default-valued (suppressing serialization).
|
|
39
|
+
# Refuse that mark if we've already populated text from Isoics so the
|
|
40
|
+
# value survives round-trip. See #112.
|
|
41
|
+
def using_default_for(attribute_name)
|
|
42
|
+
return if attribute_name == :text &&
|
|
43
|
+
@text.is_a?(String) && !@text.empty?
|
|
44
|
+
|
|
45
|
+
super
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Bib
|
|
3
|
+
class Image < Lutaml::Model::Serializable
|
|
4
|
+
attribute :id, :string
|
|
5
|
+
attribute :src, :string # anyURI
|
|
6
|
+
attribute :mimetype, :string
|
|
7
|
+
attribute :filename, :string
|
|
8
|
+
attribute :width, :string
|
|
9
|
+
attribute :height, :string
|
|
10
|
+
attribute :alt, :string
|
|
11
|
+
attribute :title, :string
|
|
12
|
+
attribute :longdesc, :string # anyURI
|
|
13
|
+
|
|
14
|
+
xml do
|
|
15
|
+
root "image"
|
|
16
|
+
map_attribute "id", to: :id
|
|
17
|
+
map_attribute "src", to: :src
|
|
18
|
+
map_attribute "mimetype", to: :mimetype
|
|
19
|
+
map_attribute "filename", to: :filename
|
|
20
|
+
map_attribute "width", to: :width
|
|
21
|
+
map_attribute "height", to: :height
|
|
22
|
+
map_attribute "alt", to: :alt
|
|
23
|
+
map_attribute "title", to: :title
|
|
24
|
+
map_attribute "longdesc", to: :longdesc
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
require "lutaml/model"
|
|
2
|
+
require "lutaml/xml"
|
|
3
|
+
|
|
4
|
+
# lutaml/xml registers :doctype as an attr_accessor on Serializable (for the
|
|
5
|
+
# <!DOCTYPE …> XML declaration) and adds it to the override-warning list.
|
|
6
|
+
# Relaton's :doctype attribute models the document-type field
|
|
7
|
+
# (international-standard, technical-report, …); the override is intentional.
|
|
8
|
+
Lutaml::Model::Attribute.format_specific_warn_names.delete(:doctype)
|
|
9
|
+
|
|
10
|
+
require_relative "localized_string_attrs"
|
|
11
|
+
require_relative "localized_string"
|
|
12
|
+
require_relative "formattedref"
|
|
13
|
+
require_relative "abstract"
|
|
14
|
+
require_relative "date"
|
|
15
|
+
require_relative "locality"
|
|
16
|
+
require_relative "locality_stack"
|
|
17
|
+
require_relative "image"
|
|
18
|
+
require_relative "title"
|
|
19
|
+
require_relative "docidentifier"
|
|
20
|
+
require_relative "note"
|
|
21
|
+
require_relative "full_name_type"
|
|
22
|
+
require_relative "fullname"
|
|
23
|
+
require_relative "contact"
|
|
24
|
+
require_relative "logo"
|
|
25
|
+
require_relative "organization"
|
|
26
|
+
require_relative "affiliation"
|
|
27
|
+
require_relative "person"
|
|
28
|
+
require_relative "contribution_info"
|
|
29
|
+
require_relative "contributor"
|
|
30
|
+
require_relative "edition"
|
|
31
|
+
require_relative "version"
|
|
32
|
+
require_relative "status"
|
|
33
|
+
require_relative "copyright"
|
|
34
|
+
require_relative "place"
|
|
35
|
+
require_relative "series"
|
|
36
|
+
require_relative "medium"
|
|
37
|
+
require_relative "uri"
|
|
38
|
+
require_relative "price"
|
|
39
|
+
require_relative "extent"
|
|
40
|
+
require_relative "size"
|
|
41
|
+
require_relative "keyword"
|
|
42
|
+
require_relative "validity"
|
|
43
|
+
require_relative "depiction"
|
|
44
|
+
require_relative "source_locality_stack"
|
|
45
|
+
require_relative "ext"
|
|
46
|
+
require_relative "item_shared"
|
|
47
|
+
require_relative "type/plain_date"
|
|
48
|
+
|
|
49
|
+
Lutaml::Model::Config.configure do |config|
|
|
50
|
+
config.xml_adapter_type = :nokogiri
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
module Relaton
|
|
54
|
+
module Bib
|
|
55
|
+
class Relation < Lutaml::Model::Serializable
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Item class repesents bibliographic item metadata.
|
|
59
|
+
# Used for YAML/JSON parsing and as the XML dispatch entry point.
|
|
60
|
+
class Item < Lutaml::Model::Serializable
|
|
61
|
+
include NamespaceHelper
|
|
62
|
+
|
|
63
|
+
attr_accessor :type # in some cases mehod type is unavailable
|
|
64
|
+
|
|
65
|
+
model ItemData
|
|
66
|
+
|
|
67
|
+
def self.from_xml(xml, options = {})
|
|
68
|
+
return super unless self == namespace::Item
|
|
69
|
+
|
|
70
|
+
# lutaml-model has no built-in dispatch on root element name
|
|
71
|
+
# (polymorphic_map only works on attribute discriminators), so we
|
|
72
|
+
# peek at the root tag with Nokogiri and forward to the right class.
|
|
73
|
+
root_name = Nokogiri::XML(xml.to_s).root&.name
|
|
74
|
+
klass = root_name == "bibdata" ? namespace::Bibdata : namespace::Bibitem
|
|
75
|
+
klass.from_xml(xml, options)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
attribute :id, :string
|
|
79
|
+
attribute :schema_version, :string, method: :get_schema_version
|
|
80
|
+
attribute :fetched, PlainDate
|
|
81
|
+
instance_exec(&ItemShared::ATTRIBUTES)
|
|
82
|
+
attribute :ext, Ext
|
|
83
|
+
|
|
84
|
+
xml do
|
|
85
|
+
map_attribute "id", to: :id
|
|
86
|
+
map_attribute "type", to: :type
|
|
87
|
+
map_attribute "schema-version", to: :schema_version, render_default: true
|
|
88
|
+
map_element "fetched", to: :fetched
|
|
89
|
+
instance_exec(&ItemShared::XML_BODY)
|
|
90
|
+
map_element "ext", to: :ext
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def get_schema_version = Relaton.schema_versions["relaton-models"]
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Bib
|
|
3
|
+
# Bibliographic item used as a nested element inside Relation.
|
|
4
|
+
# Has neither id, schema_version, fetched, nor ext.
|
|
5
|
+
class ItemBase < Lutaml::Model::Serializable
|
|
6
|
+
include NamespaceHelper
|
|
7
|
+
|
|
8
|
+
attr_accessor :type
|
|
9
|
+
|
|
10
|
+
model ItemData
|
|
11
|
+
|
|
12
|
+
instance_exec(&ItemShared::ATTRIBUTES)
|
|
13
|
+
|
|
14
|
+
xml do
|
|
15
|
+
map_attribute "type", to: :type
|
|
16
|
+
instance_exec(&ItemShared::XML_BODY)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Bib
|
|
3
|
+
# Shared attribute and XML mapping declarations for Item/Bibitem/Bibdata/ItemBase.
|
|
4
|
+
# Each class composes these with its own header (id/schema_version/fetched/ext)
|
|
5
|
+
# via instance_exec, so subtractive monkey-patching of inherited mappings is
|
|
6
|
+
# not needed.
|
|
7
|
+
module ItemShared
|
|
8
|
+
ATTRIBUTES = lambda do # rubocop:disable Metrics/BlockLength
|
|
9
|
+
attribute :type, :string, values: %W[
|
|
10
|
+
article book booklet manual proceedings presentation thesis techreport standard
|
|
11
|
+
unpublished map electronic\sresource audiovisual film video boradcast software
|
|
12
|
+
graphic_work music patent inbook incollection inproceedings journal website
|
|
13
|
+
webresource dataset archival social_media alert message convesation misc
|
|
14
|
+
]
|
|
15
|
+
attribute :formattedref, Formattedref
|
|
16
|
+
attribute :title, Title, collection: true, initialize_empty: true
|
|
17
|
+
attribute :source, Uri, collection: true, initialize_empty: true
|
|
18
|
+
attribute :docidentifier, Docidentifier, collection: true, initialize_empty: true
|
|
19
|
+
attribute :docnumber, :string
|
|
20
|
+
attribute :date, Date, collection: true, initialize_empty: true
|
|
21
|
+
attribute :contributor, Contributor, collection: true, initialize_empty: true
|
|
22
|
+
attribute :edition, Edition
|
|
23
|
+
attribute :version, Version, collection: true, initialize_empty: true
|
|
24
|
+
attribute :note, Note, collection: true, initialize_empty: true
|
|
25
|
+
attribute :language, :string, collection: true, initialize_empty: true
|
|
26
|
+
attribute :locale, :string, collection: true, initialize_empty: true
|
|
27
|
+
attribute :script, :string, collection: true, initialize_empty: true
|
|
28
|
+
attribute :abstract, Abstract, collection: true, initialize_empty: true
|
|
29
|
+
attribute :status, Status
|
|
30
|
+
attribute :copyright, Copyright, collection: true, initialize_empty: true
|
|
31
|
+
attribute :relation, Relation, collection: true, initialize_empty: true
|
|
32
|
+
attribute :series, Series, collection: true, initialize_empty: true
|
|
33
|
+
attribute :medium, Medium
|
|
34
|
+
attribute :place, Place, collection: true, initialize_empty: true
|
|
35
|
+
attribute :price, Price, collection: true, initialize_empty: true
|
|
36
|
+
attribute :extent, Extent, collection: true, initialize_empty: true
|
|
37
|
+
attribute :size, Size
|
|
38
|
+
attribute :accesslocation, :string, collection: true, initialize_empty: true
|
|
39
|
+
attribute :license, :string, collection: true, initialize_empty: true
|
|
40
|
+
attribute :classification, Docidentifier, collection: true, initialize_empty: true
|
|
41
|
+
attribute :keyword, Keyword, collection: true, initialize_empty: true
|
|
42
|
+
attribute :validity, Validity
|
|
43
|
+
attribute :depiction, Depiction, collection: true, initialize_empty: true
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.prune_attribute(base, attr_name, xml_name)
|
|
47
|
+
return unless base.attributes.key?(attr_name)
|
|
48
|
+
|
|
49
|
+
xml_mapping = base.mappings[:xml]
|
|
50
|
+
xml_mapping.instance_variable_get(:@elements).delete(xml_name)
|
|
51
|
+
xml_mapping.instance_variable_get(:@attributes).delete(xml_name)
|
|
52
|
+
base.attributes.delete(attr_name)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
XML_BODY = lambda do # rubocop:disable Metrics/BlockLength
|
|
56
|
+
map_element "formattedref", to: :formattedref
|
|
57
|
+
map_element "title", to: :title
|
|
58
|
+
map_element "uri", to: :source
|
|
59
|
+
map_element "docidentifier", to: :docidentifier
|
|
60
|
+
map_element "docnumber", to: :docnumber
|
|
61
|
+
map_element "date", to: :date
|
|
62
|
+
map_element "contributor", to: :contributor
|
|
63
|
+
map_element "edition", to: :edition
|
|
64
|
+
map_element "version", to: :version
|
|
65
|
+
map_element "note", to: :note
|
|
66
|
+
map_element "language", to: :language
|
|
67
|
+
map_element "locale", to: :locale
|
|
68
|
+
map_element "script", to: :script
|
|
69
|
+
map_element "abstract", to: :abstract
|
|
70
|
+
map_element "status", to: :status
|
|
71
|
+
map_element "copyright", to: :copyright
|
|
72
|
+
map_element "relation", to: :relation
|
|
73
|
+
map_element "series", to: :series
|
|
74
|
+
map_element "medium", to: :medium
|
|
75
|
+
map_element "place", to: :place
|
|
76
|
+
map_element "price", to: :price
|
|
77
|
+
map_element "extent", to: :extent
|
|
78
|
+
map_element "size", to: :size
|
|
79
|
+
map_element "accesslocation", to: :accesslocation
|
|
80
|
+
map_element "license", to: :license
|
|
81
|
+
map_element "classification", to: :classification
|
|
82
|
+
map_element "keyword", to: :keyword
|
|
83
|
+
map_element "validity", to: :validity
|
|
84
|
+
map_element "depiction", to: :depiction
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Bib
|
|
3
|
+
class Keyword < Lutaml::Model::Serializable
|
|
4
|
+
class Vocabid < Lutaml::Model::Serializable
|
|
5
|
+
attribute :type, :string
|
|
6
|
+
attribute :uri, :string
|
|
7
|
+
attribute :code, :string
|
|
8
|
+
attribute :term, :string
|
|
9
|
+
|
|
10
|
+
xml do
|
|
11
|
+
map_attribute "type", to: :type
|
|
12
|
+
map_attribute "uri", to: :uri
|
|
13
|
+
map_element "code", to: :code
|
|
14
|
+
map_element "term", to: :term
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
attribute :vocab, LocalizedString
|
|
19
|
+
attribute :taxon, LocalizedString, collection: true, initialize_empty: true
|
|
20
|
+
attribute :vocabid, Vocabid, collection: true, initialize_empty: true
|
|
21
|
+
|
|
22
|
+
xml do
|
|
23
|
+
root "keyword"
|
|
24
|
+
map_element "vocab", to: :vocab
|
|
25
|
+
map_element "taxon", to: :taxon
|
|
26
|
+
map_element "vocabid", to: :vocabid
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Bib
|
|
3
|
+
class Locality < Lutaml::Model::Serializable
|
|
4
|
+
attribute :type, :string, pattern: %r{
|
|
5
|
+
section|clause|part|paragraph|chapter|page|title|line|whole|table|annex|
|
|
6
|
+
figure|note|list|example|volume|issue|time|anchor|locality:[a-zA-Z0-9_]+
|
|
7
|
+
}x
|
|
8
|
+
attribute :reference_from, :string
|
|
9
|
+
attribute :reference_to, :string
|
|
10
|
+
|
|
11
|
+
xml do
|
|
12
|
+
map_attribute "type", to: :type
|
|
13
|
+
map_element "referenceFrom", to: :reference_from
|
|
14
|
+
map_element "referenceTo", to: :reference_to
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Bib
|
|
3
|
+
class LocalityStack < Lutaml::Model::Serializable
|
|
4
|
+
attribute :connective, :string, values: %w[and or from to]
|
|
5
|
+
attribute :locality, Locality, collection: true, initialize_empty: true
|
|
6
|
+
|
|
7
|
+
xml do
|
|
8
|
+
root "localityStack"
|
|
9
|
+
map_attribute "connective", to: :connective
|
|
10
|
+
map_element "locality", to: :locality
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Bib
|
|
3
|
+
class LocalizedString < LocalizedStringAttrs
|
|
4
|
+
attribute :content, :string
|
|
5
|
+
|
|
6
|
+
xml do
|
|
7
|
+
map_content to: :content
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
key_value do
|
|
11
|
+
map "content", to: :content
|
|
12
|
+
map "language", to: :language
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
class TypedLocalizedString < LocalizedString
|
|
17
|
+
attribute :type, :string
|
|
18
|
+
|
|
19
|
+
xml do
|
|
20
|
+
map_attribute "type", to: :type
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
key_value do
|
|
24
|
+
map "type", to: :type
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
class LocalizedMarkedUpString < LocalizedStringAttrs
|
|
29
|
+
module ContentSanitization
|
|
30
|
+
def content=(value)
|
|
31
|
+
super(Relaton::Bib::Sanitizer.sanitize(value))
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
attribute :content, :string, raw: true
|
|
36
|
+
prepend ContentSanitization
|
|
37
|
+
|
|
38
|
+
xml do
|
|
39
|
+
map_all to: :content
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
key_value do
|
|
43
|
+
map "content", to: :content
|
|
44
|
+
map "language", to: :language
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Bib
|
|
3
|
+
class LocalizedStringAttrs < Lutaml::Model::Serializable
|
|
4
|
+
attribute :language, :string
|
|
5
|
+
attribute :locale, :string
|
|
6
|
+
attribute :script, :string
|
|
7
|
+
|
|
8
|
+
# def self.inherited(base)
|
|
9
|
+
# super
|
|
10
|
+
# base.class_eval do
|
|
11
|
+
xml do
|
|
12
|
+
map_attribute "language", to: :language
|
|
13
|
+
map_attribute "locale", to: :locale
|
|
14
|
+
map_attribute "script", to: :script
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
key_value do
|
|
18
|
+
map "language", to: :language
|
|
19
|
+
map "locale", to: :locale
|
|
20
|
+
map "script", to: :script
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Bib
|
|
3
|
+
class Medium < Lutaml::Model::Serializable
|
|
4
|
+
attribute :content, :string
|
|
5
|
+
attribute :genre, :string
|
|
6
|
+
attribute :form, :string
|
|
7
|
+
attribute :carrier, :string
|
|
8
|
+
attribute :size, :string
|
|
9
|
+
attribute :scale, :string
|
|
10
|
+
|
|
11
|
+
xml do
|
|
12
|
+
root "medium"
|
|
13
|
+
map_element "content", to: :content
|
|
14
|
+
map_element "genre", to: :genre
|
|
15
|
+
map_element "form", to: :form
|
|
16
|
+
map_element "carrier", to: :carrier
|
|
17
|
+
map_element "size", to: :size
|
|
18
|
+
map_element "scale", to: :scale
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Bib
|
|
3
|
+
module OrganizationType
|
|
4
|
+
class Identifier < Lutaml::Model::Serializable
|
|
5
|
+
attribute :type, :string
|
|
6
|
+
attribute :content, :string
|
|
7
|
+
|
|
8
|
+
xml do
|
|
9
|
+
root "identifier"
|
|
10
|
+
map_attribute "type", to: :type
|
|
11
|
+
map_content to: :content
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.included(base) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
16
|
+
require_relative "subdivision"
|
|
17
|
+
|
|
18
|
+
base.instance_eval do
|
|
19
|
+
include Contact
|
|
20
|
+
|
|
21
|
+
attribute :name, TypedLocalizedString, collection: true, initialize_empty: true
|
|
22
|
+
attribute :subdivision, Subdivision, collection: true, initialize_empty: true
|
|
23
|
+
attribute :abbreviation, LocalizedString
|
|
24
|
+
attribute :identifier, Identifier, collection: true, initialize_empty: true
|
|
25
|
+
attribute :logo, Logo, collection: true, initialize_empty: true
|
|
26
|
+
|
|
27
|
+
xml do
|
|
28
|
+
map_element "name", to: :name
|
|
29
|
+
map_element "subdivision", to: :subdivision
|
|
30
|
+
map_element "abbreviation", to: :abbreviation
|
|
31
|
+
map_element "identifier", to: :identifier
|
|
32
|
+
map_element "address", to: :address
|
|
33
|
+
map_element "phone", to: :phone
|
|
34
|
+
map_element "email", to: :email
|
|
35
|
+
map_element "uri", to: :uri
|
|
36
|
+
map_element "logo", to: :logo
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Bib
|
|
3
|
+
class Person < Lutaml::Model::Serializable
|
|
4
|
+
class Identifier < Lutaml::Model::Serializable
|
|
5
|
+
attribute :type, :string
|
|
6
|
+
attribute :content, :string
|
|
7
|
+
|
|
8
|
+
xml do
|
|
9
|
+
root "identifier"
|
|
10
|
+
map_attribute "type", to: :type
|
|
11
|
+
map_content to: :content
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
include Contact
|
|
16
|
+
|
|
17
|
+
attribute :name, FullName
|
|
18
|
+
attribute :credential, :string, collection: true, initialize_empty: true
|
|
19
|
+
attribute :affiliation, Affiliation, collection: true, initialize_empty: true
|
|
20
|
+
attribute :identifier, Identifier, collection: true, initialize_empty: true
|
|
21
|
+
|
|
22
|
+
xml do
|
|
23
|
+
root "person"
|
|
24
|
+
|
|
25
|
+
map_element "name", to: :name
|
|
26
|
+
map_element "credential", to: :credential
|
|
27
|
+
map_element "affiliation", to: :affiliation
|
|
28
|
+
map_element "identifier", to: :identifier
|
|
29
|
+
map_element "address", to: :address
|
|
30
|
+
map_element "phone", to: :phone
|
|
31
|
+
map_element "email", to: :email
|
|
32
|
+
map_element "uri", to: :uri
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|