README.adoc in relaton-ecma-1.14.0 vs README.adoc in relaton-ecma-1.14.1

- old
+ new

@@ -27,29 +27,68 @@ $ gem install relaton-ecma == Usage -=== Search document +=== Fetch documents +Documents can be fetched by reference. The structure of the reference depends on the type of the document. There are three types of documents: +- ECMA standards +- ECMA technical reports +- ECMA mementos + +ECMA standards have the following reference structure: `ECMA-{NUMBER}[ ed{EDITION}][ vol{VOLUME}]`. Where: `NUMBER` is a number of the standard, `EDITION` is an edition of the standard, and `VOLUME` is a volume of the standard. The `EDITION` and `VOLUME` are optional. If `EDITION` is not specified, the latest edition of the standard will be fetched. If `VOLUME` is not specified, the first volume of the standard will be fetched. + +ECMA technical reports have the following reference structure: `ECMA TR/{NUMBER}[ ed{EDITION}]`. Where: `NUMBER` is a number of the technical report, and `EDITION` is an edition of the technical report. The `EDITION` is optional. If `EDITION` is not specified, the latest edition of the technical report will be fetched. + +ECMA mementos have the following reference structure: `ECMA MEM/{YEAR}`. Where: `YEAR` is an year of the memento. + [source,ruby] ---- require 'relaton_ecma' => true +# fetch ECMA standard item = RelatonEcma::EcmaBibliography.get 'ECMA-6' [relaton-ecma] ("ECMA-6") fetching... [relaton-ecma] ("ECMA-6") found ECMA-6 #<RelatonEcma::BibliographicItem:0x00007fc645b11c10 ... +# fetch ECMA standard with edition and volume +RelatonEcma::EcmaBibliography.get "ECMA-269 ed3 vol2" +[relaton-ecma] ("ECMA-269 ed3 vol2") fetching... +[relaton-ecma] ("ECMA-269 ed3 vol2") found ECMA-269 +=> #<RelatonEcma::BibliographicItem:0x0000000106ac8210 +... + +# fetch the last edition of ECMA standard +bib = RelatonEcma::EcmaBibliography.get "ECMA-269" +[relaton-ecma] ("ECMA-269") fetching... +[relaton-ecma] ("ECMA-269") found ECMA-269 +=> #<RelatonEcma::BibliographicItem:0x000000010a408480 +... + +bib.edition.content +=> "9" + +# fetch the first volume of ECMA standard +bib = RelatonEcma::EcmaBibliography.get "ECMA-269 ed3" +[relaton-ecma] ("ECMA-269 ed3") fetching... +[relaton-ecma] ("ECMA-269 ed3") found ECMA-269 +=> #<RelatonEcma::BibliographicItem:0x000000010a3ed0e0 +... + +bib.extent.first.reference_from +=> "1" + +# fetch ECMA technical report RelatonEcma::EcmaBibliography.get 'ECMA TR/18' [relaton-ecma] ("ECMA TR/18") fetching... [relaton-ecma] ("ECMA TR/18") found ECMA TR/18 => #<RelatonEcma::BibliographicItem:0x00007fc645c00cc0 ... +# fetch ECMA memento RelatonEcma::EcmaBibliography.get "ECMA MEM/2021" [relaton-ecma] ("ECMA MEM/2021") fetching... [relaton-ecma] ("ECMA MEM/2021") found ECMA MEM/2021 => #<RelatonEcma::BibliographicItem:0x00007fc665b2f060 ... @@ -109,9 +148,28 @@ [source,ruby] ---- item = RelatonEcma::XMLParser.from_xml File.read("spec/fixtures/bibdata.xml") => #<RelatonEcma::BibliographicItem:0x00007fc645b3bf10 ... +---- + +=== Fetch data + +This gem uses a https://github.com/relaton/relaton-data-ecma[ecma-standards] prefetched dataset as a data source. The dataset contains documents from ECMA https://www.ecma-international.org/publications-and-standards/standards/[Standards], https://www.ecma-international.org/publications-and-standards/technical-reports/[Technical Reports], and https://www.ecma-international.org/publications-and-standards/mementos/[Mementos] pages. + +The method `RelatonEcma::DataFetcher.new(output: "data", format: "yaml").fetch` fetches all the documents from the pages and saves them to the `./data` folder in YAML format. +Arguments: + +- `output` - folder to save documents (default './data'). +- `format` - the format in which the documents are saved. Possible formats are: `yaml`, `xml`, `bibxxml` (default `yaml`). + +[source,ruby] +---- +RelatonEcma::DataFetcher.new.fetch +Started at: 2022-06-23 09:36:55 +0200 +Stopped at: 2022-06-23 09:36:58 +0200 +Done in: 752 sec. +=> nil ---- == Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.