relaton-3gpp 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2cb4d367d6487eb29deffcb0805e874e089ee23b296879ab64e0d0697e3d29f4
4
+ data.tar.gz: 520706a92250b455c31e8ed63def3573da3c67d8d7329c027186e5ab66330cbc
5
+ SHA512:
6
+ metadata.gz: 0350b940358a6fe6793e6c18361a61befd891b7efa814d73c88fd612123b174f7ffea185ccfdd65711873a3f75697108c60a15d85446a2d8091bf3f1c97c377a
7
+ data.tar.gz: e0a8e4c26623f84b997862ebc3c66c0f2c665dfea62cef07d0db8601431b0340d2778b782ee730d6cf248411b6056f7f5073be7823580bd7e60072ce79137b91
@@ -0,0 +1,36 @@
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
+
11
+ jobs:
12
+ rake:
13
+ name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
14
+ runs-on: ${{ matrix.os }}
15
+ continue-on-error: ${{ matrix.experimental }}
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ ruby: [ '3.0', '2.7', '2.6', '2.5' ]
20
+ os: [ ubuntu-latest, windows-latest, macos-latest ]
21
+ experimental: [ false ]
22
+ steps:
23
+ - uses: actions/checkout@v2
24
+ with:
25
+ submodules: true
26
+
27
+ # https://github.com/ruby-debug/debase/issues/89#issuecomment-686827382
28
+ - if: matrix.os == 'macos-latest' && matrix.ruby == '2.5'
29
+ run: echo BUNDLE_BUILD__DEBASE="--with-cflags=\"-Wno-error=implicit-function-declaration\"" >> $GITHUB_ENV
30
+
31
+ - uses: ruby/setup-ruby@v1
32
+ with:
33
+ ruby-version: ${{ matrix.ruby }}
34
+ bundler-cache: true
35
+
36
+ - run: bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rubocop-https---raw-githubusercontent-com-riboseinc-oss-guides-master-ci-rubocop-yml
12
+ Gemfile.lock
13
+ .vscode/
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,12 @@
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
+ require: rubocop-rails
6
+
7
+ inherit_from:
8
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
9
+ AllCops:
10
+ TargetRubyVersion: 2.5
11
+ Rails:
12
+ Enabled: false
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in relaton_3gpp.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
11
+
12
+ gem "rubocop", "~> 1.7"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Andrei Kislichenko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.adoc ADDED
@@ -0,0 +1,170 @@
1
+ = Relaton3gpp
2
+
3
+ Relaton3gpp is a Ruby gem that implements the https://github.com/metanorma/metanorma-model-iso#iso-bibliographic-item[IsoBibliographicItem model].
4
+
5
+ You can use it to retrieve metadata of W3C Standards from https://w3.org, and access such metadata through the `W3cBibliographicItem` object.
6
+
7
+ == Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ [source,ruby]
12
+ ----
13
+ gem 'relaton-3gpp'
14
+ ----
15
+
16
+ And then execute:
17
+
18
+ $ bundle install
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install relaton-3gpp
23
+
24
+ == Usage
25
+
26
+ === Search for a standard using keywords
27
+
28
+ [source,ruby]
29
+ ----
30
+ require 'relaton_3gpp'
31
+ => true
32
+
33
+ item = Relaton3gpp::Bibliography.get "3GPP TR 00.01U:UMTS/3.0.0"
34
+ [relaton-3gpp] ("3GPP TR 00.01U:UMTS/3.0.0") fetching...
35
+ [relaton-3gpp] ("3GPP TR 00.01U:UMTS/3.0.0") found 3GPP TR 00.01U:UMTS/3.0.0
36
+ => #<Relaton3gpp::BibliographicItem:0x00007f92d94264e0
37
+ ...
38
+ ----
39
+
40
+ === XML serialization
41
+
42
+ [source,ruby]
43
+ ----
44
+ item.to_xml
45
+ => "<bibitem id="3GPPTR00.01U-UMTS/3.0.0" type="standard">
46
+ <fetched>2021-12-09</fetched>
47
+ <title type="main" format="text/plain">Work programme for the standardization of Universal Mobile Telecommunications System (UMTS)</title>
48
+ <uri type="src">http://www.3gpp.org/ftp/Specs/archive/00_series/00.01U/0001U-300.zip</uri>
49
+ <docidentifier type="3GPP">3GPP TR 00.01U:UMTS/3.0.0</docidentifier>
50
+ <docidentifier type="rapporteurId">2261</docidentifier>
51
+ <docnumber>TR 00.01U:UMTS/3.0.0</docnumber>
52
+ <language>en</language>
53
+ <script>Latn</script>
54
+ <status>
55
+ <stage>withdrawn</stage>
56
+ </status>
57
+ </bibitem>"
58
+ ----
59
+
60
+ With argument `bibdata: true` it ouputs XML wrapped by `bibdata` element and adds flavour `ext` element.
61
+
62
+ [source,ruby]
63
+ ----
64
+ item.to_xml bibdata: true
65
+ => "<bibdata type="standard">
66
+ <fetched>2021-12-09</fetched>
67
+ <title type="main" format="text/plain">Work programme for the standardization of Universal Mobile Telecommunications System (UMTS)</title>
68
+ <uri type="src">http://www.3gpp.org/ftp/Specs/archive/00_series/00.01U/0001U-300.zip</uri>
69
+ <docidentifier type="3GPP">3GPP TR 00.01U:UMTS/3.0.0</docidentifier>
70
+ <docidentifier type="rapporteurId">2261</docidentifier>
71
+ <docnumber>TR 00.01U:UMTS/3.0.0</docnumber>
72
+ <language>en</language>
73
+ <script>Latn</script>
74
+ <status>
75
+ <stage>withdrawn</stage>
76
+ </status>
77
+ <ext>
78
+ <doctype>TR</doctype>
79
+ <editorialgroup>
80
+ <technical-committee type="prime">SMG5</technical-committee>
81
+ </editorialgroup>
82
+ <radiotechnology>3G</radiotechnology>
83
+ <release>
84
+ <version2G>3</version2G>
85
+ <version3G>3</version3G>
86
+ <defunct>true</defunct>
87
+ <freeze-meeting>SMG-28</freeze-meeting>
88
+ <freeze-stage1-meeting>SMG-28</freeze-stage1-meeting>
89
+ <freeze-stage2-meeting>SMG-28</freeze-stage2-meeting>
90
+ <freeze-stage3-meeting>SMG-28</freeze-stage3-meeting>
91
+ <close-meeting>SP-28</close-meeting>
92
+ <project-end>1999-02-12</project-end>
93
+ </release>
94
+ </ext>
95
+ </bibdata>"
96
+ ----
97
+
98
+ === Typed links
99
+
100
+ Some of 3GPP documents have `src` type link.
101
+
102
+ [source,ruby]
103
+ ----
104
+ item.link.first.type
105
+ => "src"
106
+
107
+ item.link.first.content
108
+ ==> #<Addressable::URI:0x320 URI:http://www.3gpp.org/ftp/Specs/archive/00_series/00.01U/0001U-300.zip>
109
+ ----
110
+
111
+ === Create bibliographic item from XML
112
+ [source,ruby]
113
+ ----
114
+ RelatonW3c::XMLParser.from_xml File.read('spec/fixtures/cr_json_ld11.xml')
115
+ => #<RelatonW3c::W3cBibliographicItem:0x007f9381efce98
116
+ ...
117
+ ----
118
+
119
+ === Create bibliographic item from YAML
120
+ [source,ruby]
121
+ ----
122
+ hash = YAML.load_file 'spec/fixtures/bib.yaml'
123
+ => {"id"=>"3GPPTR00.01U-UMTS/3.0.0",
124
+ "title"=>{"type"=>"main", "content"=>"Work programme for the standardization of Universal Mobile Telecommunications System (UMTS)", "format"=>"text/plain"},
125
+ ...
126
+
127
+ bib_hash = Relaton3gpp::HashConverter.hash_to_bib hash
128
+ => {:id=>"3GPPTR00.01U-UMTS/3.0.0",
129
+ :title=>
130
+ #<RelatonBib::TypedTitleStringCollection:0x00007f92aa8cdf40
131
+ @array=[{:type=>"main", :content=>"Work programme for the standardization of Universal Mobile Telecommunications System (UMTS)", :format=>"text/plain"}]>,
132
+ ...
133
+
134
+ Relaton3gpp::BibliographicItem.new(**bib_hash)
135
+ => #<Relaton3gpp::BibliographicItem:0x00007f92d953cbe0
136
+ ...
137
+ ----
138
+
139
+ === Fetch data
140
+
141
+ There is a 3GPP dataset ftp://www.3gpp.org/Information/Databases/Spec_Status/[latest *.zip] which can be converted into RelatonXML/BibXML/BibYAML formats.
142
+
143
+ The method `Relaton3GPP::DataFetcher.fetch(output: "data", format: "yaml")` converts all the documents from the dataset and save them to the `./data` folder in YAML format.
144
+ Arguments:
145
+
146
+ - `output` - folder to save documents (default './data').
147
+ - `format` - format in which the documents are saved. Possimle formats are: `yaml`, `xml`, `bibxml` (default `yaml`).
148
+
149
+ [source,ruby]
150
+ ----
151
+ Relaton3GPP::DataFetcher.fetch
152
+ Started at: 2021-12-10 19:58:46 +0100
153
+ Stopped at: 2021-12-10 20:08:03 +0100
154
+ Done in: 557 sec.
155
+ => nil
156
+ ----
157
+
158
+ == Development
159
+
160
+ 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.
161
+
162
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
163
+
164
+ == Contributing
165
+
166
+ Bug reports and pull requests are welcome on GitHub at https://github.com/relaton/relaton_3gpp.
167
+
168
+ == License
169
+
170
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "relaton_3gpp"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/rspec ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rspec-core", "rspec")
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/grammars/3gpp.rng ADDED
@@ -0,0 +1,105 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
+ <include href="isodoc.rng">
4
+ <start>
5
+ <ref name="iso-standard"/>
6
+ </start>
7
+ <define name="DocumentType">
8
+ <choice>
9
+ <value>TR</value>
10
+ <value>TS</value>
11
+ </choice>
12
+ </define>
13
+ <define name="DocumentSubtype">
14
+ <choice>
15
+ <value>spec</value>
16
+ <value>release</value>
17
+ </choice>
18
+ </define>
19
+ <define name="BibDataExtensionType">
20
+ <ref name="doctype"/>
21
+ <optional>
22
+ <ref name="docsubtype"/>
23
+ </optional>
24
+ <ref name="editorialgroup"/>
25
+ <zeroOrMore>
26
+ <ref name="ics"/>
27
+ </zeroOrMore>
28
+ <optional>
29
+ <ref name="radiotechnology"/>
30
+ </optional>
31
+ <optional>
32
+ <ref name="common-ims-spec"/>
33
+ </optional>
34
+ <optional>
35
+ <ref name="internal"/>
36
+ </optional>
37
+ <optional>
38
+ <ref name="release"/>
39
+ </optional>
40
+ </define>
41
+ </include>
42
+ <define name="RadioTechnologyType">
43
+ <choice>
44
+ <value>2G</value>
45
+ <value>3G</value>
46
+ <value>LTE</value>
47
+ <value>5G</value>
48
+ </choice>
49
+ </define>
50
+ <define name="radiotechnology">
51
+ <element name="radiotechnology">
52
+ <ref name="RadioTechnologyType"/>
53
+ </element>
54
+ </define>
55
+ <define name="common-ims-spec">
56
+ <element name="common-ims-spec">
57
+ <data type="boolean"/>
58
+ </element>
59
+ </define>
60
+ <define name="internal">
61
+ <element name="internal">
62
+ <data type="boolean"/>
63
+ </element>
64
+ </define>
65
+ <define name="release">
66
+ <element name="release">
67
+ <element name="version2G">
68
+ <text/>
69
+ </element>
70
+ <element name="version3G">
71
+ <text/>
72
+ </element>
73
+ <element name="defunct">
74
+ <data type="boolean"/>
75
+ </element>
76
+ <element name="wpm-code-2G">
77
+ <text/>
78
+ </element>
79
+ <element name="wpm-code-3G">
80
+ <text/>
81
+ </element>
82
+ <element name="freeze-meeting">
83
+ <text/>
84
+ </element>
85
+ <element name="freeze-stage1-meeting">
86
+ <text/>
87
+ </element>
88
+ <element name="freeze-stage2-meeting">
89
+ <text/>
90
+ </element>
91
+ <element name="freeze-stage3-meeting">
92
+ <text/>
93
+ </element>
94
+ <element name="close-meeting">
95
+ <text/>
96
+ </element>
97
+ <element name="project-start">
98
+ <data type="date"/>
99
+ </element>
100
+ <element name="project-end">
101
+ <data type="date"/>
102
+ </element>
103
+ </element>
104
+ </define>
105
+ </grammar>