relaton-ogc 1.9.0 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/README.adoc +31 -2
- data/bin/rspec +29 -0
- data/grammars/biblio.rng +2 -2
- data/grammars/isodoc.rng +617 -89
- data/grammars/ogc.rng +13 -13
- data/grammars/reqt.rng +15 -4
- data/lib/relaton_ogc/data_fetcher.rb +98 -0
- data/lib/relaton_ogc/hash_converter.rb +1 -1
- data/lib/relaton_ogc/hit.rb +12 -1
- data/lib/relaton_ogc/hit_collection.rb +44 -59
- data/lib/relaton_ogc/ogc_bibliographic_item.rb +17 -21
- data/lib/relaton_ogc/ogc_bibliography.rb +2 -1
- data/lib/relaton_ogc/processor.rb +14 -1
- data/lib/relaton_ogc/scrapper.rb +5 -3
- data/lib/relaton_ogc/version.rb +1 -1
- data/lib/relaton_ogc/xml_parser.rb +7 -7
- data/lib/relaton_ogc.rb +1 -0
- data/relaton_ogc.gemspec +2 -2
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e799bd4fcdccd9eff861bfa1681dc1c3cffb5722bd6e4857911fa31ab135a75a
|
4
|
+
data.tar.gz: cd3cc2d1b72a10ed0d13095a65f6b2ccd585f68794c3a3a2e4498f6a17d0fc82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae581db75d46459cba905dc4e22709f27d880130467ff9572cbd87d3bbc92a48d37c8a7c47c949e99e18496888068f82c16a5574caec1d0f1b3a4c8f5123d253
|
7
|
+
data.tar.gz: d26863aa5daef59cce7b2d6b1ae2993415805f99db62ce8f3c935155f5831e3ec494b9f4c079d338ce441f17bd997e06bdc48797924894d7820cc8f129a00db9
|
data/.rubocop.yml
CHANGED
data/README.adoc
CHANGED
@@ -39,9 +39,9 @@ require 'relaton_ogc'
|
|
39
39
|
=> true
|
40
40
|
|
41
41
|
hits = RelatonOgc::OgcBibliography.search("OGC 19-025r1")
|
42
|
-
=> <RelatonOgc::HitCollection:0x007fcc8e085ba8 @ref=OGC 19-025r1 @fetched=
|
42
|
+
=> <RelatonOgc::HitCollection:0x007fcc8e085ba8 @ref=OGC 19-025r1 @fetched=true>
|
43
43
|
|
44
|
-
|
44
|
+
item = hits[0].fetch
|
45
45
|
=> #<RelatonOgc::OgcBibliographicItem:0x007fcab3cb4758
|
46
46
|
...
|
47
47
|
----
|
@@ -101,6 +101,16 @@ RelatonOgc::XMLParser.from_xml File.read('spec/fixtures/ogc_bib_item.xml')
|
|
101
101
|
...
|
102
102
|
----
|
103
103
|
|
104
|
+
=== Typed links
|
105
|
+
|
106
|
+
Each OGC document has `obp` type link.
|
107
|
+
|
108
|
+
[source,ruby]
|
109
|
+
----
|
110
|
+
item.link
|
111
|
+
=> [#<RelatonBib::TypedUri:0x00007fc848994568 @content=#<Addressable::URI:0x8e8 URI:https://portal.ogc.org/files/?artifact_id=88037>, @type="obp">]
|
112
|
+
----
|
113
|
+
|
104
114
|
=== Create bibliographic item from YAML
|
105
115
|
[source,ruby]
|
106
116
|
----
|
@@ -113,6 +123,25 @@ RelatonOgc::OgcBibliographicItem.from_hash hash
|
|
113
123
|
...
|
114
124
|
----
|
115
125
|
|
126
|
+
=== Fetch data
|
127
|
+
|
128
|
+
This gem uses the https://raw.githubusercontent.com/opengeospatial/NamingAuthority/master/incubation/bibliography/bibliography.json dataset as a data sources.
|
129
|
+
|
130
|
+
The method `RelatonOgc::DataFetcher.fetch(output: "data", format: "yaml")` fetches all the documents from the datast and save them to the `./data` folder in YAML format.
|
131
|
+
Arguments:
|
132
|
+
|
133
|
+
- `output` - folder to save documents (default './data').
|
134
|
+
- `format` - format in which the documents are saved. Possimle formats are: `yaml`, `xml` (default `yaml`).
|
135
|
+
|
136
|
+
[source,ruby]
|
137
|
+
----
|
138
|
+
RelatonOgc::DataFetcher.fetch
|
139
|
+
Started at: 2021-09-14 11:21:46 +0200
|
140
|
+
[relaton-ogc] WARNING Duplicated documents: 15-113r5, 08-094r1, 10-025r1, 12-128r14, 16-079, 16-007r3, 13-026r8, 12-128r12, 15-078r6, 12-176r7, 09-102r3, 14-095, 14-115, 07-147r2, 12-000, 12-006, 09-025r1, 07-036, 07-110r4, 03-105r1, 06-042, 07-165r1, 12-066, 06-104r4, 11-122r1, 09-000, 04-094, 07-006r1, 06-035r1, 03-006r3, 05-134, 04-021r3, 02-058, 01-009
|
141
|
+
Stopped at: 2021-09-14 11:21:48 +0200
|
142
|
+
=> nil
|
143
|
+
----
|
144
|
+
|
116
145
|
== Development
|
117
146
|
|
118
147
|
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.
|
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")
|