relaton-plateau 1.19.2 → 1.19.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +41 -18
- data/lib/relaton/plateau/bibitem.rb +20 -6
- data/lib/relaton/plateau/bibliography.rb +7 -12
- data/lib/relaton/plateau/docidentifier.rb +9 -0
- data/lib/relaton/plateau/handbook_parser.rb +3 -3
- data/lib/relaton/plateau/hash_converter.rb +4 -0
- data/lib/relaton/plateau/hit.rb +27 -0
- data/lib/relaton/plateau/parser.rb +9 -4
- data/lib/relaton/plateau/technical_report_parser.rb +2 -2
- data/lib/relaton/plateau/version.rb +1 -1
- data/lib/relaton/plateau/xml_parser.rb +4 -0
- data/lib/relaton/plateau.rb +2 -0
- data/{relaton-plateau.gemspec → relaton_plateau.gemspec} +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9440584ea13e611d6139c74cd9ba79bbde532c76e2ba43d2fbc47c4fbe00388c
|
4
|
+
data.tar.gz: cdb45b8fbb9a1d27d7c3580788056a3f9fa38b727d69444b1789ada6bd203e8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ea8f22a10154239a499e018756b3cfb8d84a7647860881f3b81c7ba4732d374d6a6db5f464d916fd6ceda68aaed023e7b5914399cbdbc8c07d3992906ce9914
|
7
|
+
data.tar.gz: b380d9c2cdd1e311fd5e66948aedcf95e1645aa8c14abdb3d4140289cf48b3523325aa401fc34a85d8a22b1d41670f78e1b0a9083af91d1415ec43d67c9695a7
|
data/README.adoc
CHANGED
@@ -33,13 +33,36 @@ Or install it yourself as:
|
|
33
33
|
|
34
34
|
=== Fetching
|
35
35
|
|
36
|
+
==== Fetching Technical Reports
|
37
|
+
|
36
38
|
[source,ruby]
|
37
39
|
----
|
38
40
|
require "relaton/plateau"
|
41
|
+
Relaton::Plateau::Bibliography.get("PLATEAU Technical Report #00")
|
42
|
+
[relaton-plateau] INFO: (PLATEAU Technical Report #00) Fetching ...
|
43
|
+
[relaton-plateau] INFO: (PLATEAU Technical Report #00) Found `PLATEAU Technical Report #00`
|
44
|
+
=> #<Relaton::Plateau::BibItem:0x00000001238cfc98
|
45
|
+
...
|
46
|
+
----
|
47
|
+
|
48
|
+
==== Fetching Handbooks unversioned
|
49
|
+
|
50
|
+
[source,ruby]
|
51
|
+
----
|
52
|
+
Relaton::Plateau::Bibliography.get("PLATEAU Handbook #00")
|
53
|
+
[relaton-plateau] INFO: (PLATEAU Handbook #00) Fetching ...
|
54
|
+
[relaton-plateau] INFO: (PLATEAU Handbook #00) Found `PLATEAU Handbook #00`
|
55
|
+
=> #<Relaton::Plateau::BibItem:0x00000001238c7598
|
56
|
+
...
|
57
|
+
----
|
39
58
|
|
40
|
-
|
41
|
-
|
42
|
-
[
|
59
|
+
==== Fetching Handbooks versioned
|
60
|
+
|
61
|
+
[source,ruby]
|
62
|
+
----
|
63
|
+
bib = Relaton::Plateau::Bibliography.get("PLATEAU Handbook #00 1.0")
|
64
|
+
[relaton-plateau] INFO: (PLATEAU Handbook #00 1.0) Fetching ...
|
65
|
+
[relaton-plateau] INFO: (PLATEAU Handbook #00 1.0) Found `PLATEAU Handbook #00 1.0`
|
43
66
|
=> #<Relaton::Plateau::BibItem:0x0000000104afbcc0
|
44
67
|
...
|
45
68
|
----
|
@@ -52,15 +75,15 @@ bib = Relaton::Plateau::Bibliography.get("PLATEAU Handbook #00 第1.0版")
|
|
52
75
|
----
|
53
76
|
# Render bibitem
|
54
77
|
puts bib.to_xml
|
55
|
-
<bibitem id="PLATEAUHandbook#
|
78
|
+
<bibitem id="PLATEAUHandbook#001.0" type="standard" schema-version="v1.2.9">
|
56
79
|
<title type="main" format="text/plain" language="ja" script="Jpan">3D都市モデルの導入ガイダンス</title>
|
57
80
|
<title type="main" format="text/plain" language="en" script="Latn">Guidance on the Installation for 3D City Model</title>
|
58
81
|
<uri type="pdf">https://www.mlit.go.jp/plateau/file/libraries/doc/plateau_doc_0000_ver01.pdf</uri>
|
59
|
-
<docidentifier type="PLATEAU" primary="true">PLATEAU Handbook #00
|
82
|
+
<docidentifier type="PLATEAU" primary="true">PLATEAU Handbook #00 1.0</docidentifier>
|
60
83
|
<date type="published">
|
61
84
|
<on>2021-03-26</on>
|
62
85
|
</date>
|
63
|
-
<edition number="1.0"
|
86
|
+
<edition number="1.0">1.0</edition>
|
64
87
|
<abstract format="text/plain" language="ja" script="Jpan">地方自治体担当者や民間事業者等に向けた 3D都市モデル導入のためのガイダンス</abstract>
|
65
88
|
</bibitem>
|
66
89
|
|
@@ -70,18 +93,18 @@ puts bib.to_xml(bibdata: true)
|
|
70
93
|
<title type="main" format="text/plain" language="ja" script="Jpan">3D都市モデルの導入ガイダンス</title>
|
71
94
|
<title type="main" format="text/plain" language="en" script="Latn">Guidance on the Installation for 3D City Model</title>
|
72
95
|
<uri type="pdf">https://www.mlit.go.jp/plateau/file/libraries/doc/plateau_doc_0000_ver01.pdf</uri>
|
73
|
-
<docidentifier type="PLATEAU" primary="true">PLATEAU Handbook #00
|
96
|
+
<docidentifier type="PLATEAU" primary="true">PLATEAU Handbook #00 1.</docidentifier>
|
74
97
|
<date type="published">
|
75
98
|
<on>2021-03-26</on>
|
76
99
|
</date>
|
77
|
-
<edition number="1.0"
|
100
|
+
<edition number="1.0">1.0</edition>
|
78
101
|
<abstract format="text/plain" language="ja" script="Jpan">地方自治体担当者や民間事業者等に向けた 3D都市モデル導入のためのガイダンス</abstract>
|
79
102
|
<ext>
|
80
103
|
<doctype>handbook</doctype>
|
81
104
|
<structuredidentifier type="Handbook">
|
82
105
|
<agency>PLATEAU</agency>
|
83
106
|
<docnumber>00</docnumber>
|
84
|
-
<edition
|
107
|
+
<edition>1.0</edition>
|
85
108
|
</structuredidentifier>
|
86
109
|
<cover>
|
87
110
|
<image src="https://www.mlit.go.jp//plateau/uploads/2022/06/1@2x.jpg" mimetype="image/jpeg"/>
|
@@ -97,7 +120,7 @@ puts bib.to_xml(bibdata: true)
|
|
97
120
|
puts bib.to_hash.to_yaml
|
98
121
|
---
|
99
122
|
schema-version: v1.2.9
|
100
|
-
id: PLATEAUHandbook#
|
123
|
+
id: PLATEAUHandbook#001.0
|
101
124
|
title:
|
102
125
|
- content: 3D都市モデルの導入ガイダンス
|
103
126
|
language:
|
@@ -118,14 +141,14 @@ link:
|
|
118
141
|
type: pdf
|
119
142
|
type: standard
|
120
143
|
docid:
|
121
|
-
- id: 'PLATEAU Handbook #00
|
144
|
+
- id: 'PLATEAU Handbook #00 1.0'
|
122
145
|
type: PLATEAU
|
123
146
|
primary: true
|
124
147
|
date:
|
125
148
|
- type: published
|
126
149
|
value: '2021-03-26'
|
127
150
|
edition:
|
128
|
-
content:
|
151
|
+
content: 1.0
|
129
152
|
number: '1.0'
|
130
153
|
revdate: '2021-03-26'
|
131
154
|
abstract:
|
@@ -142,7 +165,7 @@ structuredidentifier:
|
|
142
165
|
type: Handbook
|
143
166
|
agency:
|
144
167
|
- PLATEAU
|
145
|
-
edition:
|
168
|
+
edition: 1.0
|
146
169
|
ext:
|
147
170
|
cover:
|
148
171
|
image:
|
@@ -156,7 +179,7 @@ ext:
|
|
156
179
|
[source,ruby]
|
157
180
|
----
|
158
181
|
puts bib.to_bibxml
|
159
|
-
<reference anchor="PLATEAU.Handbook.#00
|
182
|
+
<reference anchor="PLATEAU.Handbook.#00.1.0">
|
160
183
|
<front>
|
161
184
|
<title>3D都市モデルの導入ガイダンス</title>
|
162
185
|
<date year="2021" month="March" day="26"/>
|
@@ -172,7 +195,7 @@ puts bib.to_bibxml
|
|
172
195
|
puts bib.to_asciibib
|
173
196
|
[%bibitem]
|
174
197
|
== {blank}
|
175
|
-
id:: PLATEAUHandbook#
|
198
|
+
id:: PLATEAUHandbook#001.0
|
176
199
|
title::
|
177
200
|
title.type:: main
|
178
201
|
title.content:: 3D都市モデルの導入ガイダンス
|
@@ -188,8 +211,8 @@ title.format:: text/plain
|
|
188
211
|
type:: standard
|
189
212
|
docid.type:: PLATEAU
|
190
213
|
docid.primary:: true
|
191
|
-
docid.id:: PLATEAU Handbook #00
|
192
|
-
edition.content::
|
214
|
+
docid.id:: PLATEAU Handbook #00 1.0
|
215
|
+
edition.content:: 1.0
|
193
216
|
edition.number:: 1.0
|
194
217
|
date.type:: published
|
195
218
|
date.on:: 2021-03-26
|
@@ -203,7 +226,7 @@ doctype.type:: handbook
|
|
203
226
|
structured_identifier.docnumber:: 00
|
204
227
|
structured_identifier.agency:: PLATEAU
|
205
228
|
structured_identifier.type:: Handbook
|
206
|
-
structured_identifier.edition::
|
229
|
+
structured_identifier.edition:: 1.0
|
207
230
|
cover.image.src:: https://www.mlit.go.jp//plateau/uploads/2022/06/1@2x.jpg
|
208
231
|
cover.image.mimetype:: image/jpeg
|
209
232
|
filesize:: 18381880
|
@@ -4,14 +4,14 @@ require_relative "stagename"
|
|
4
4
|
module Relaton
|
5
5
|
module Plateau
|
6
6
|
class BibItem < RelatonBib::BibliographicItem
|
7
|
-
# @return [Relaton::Plateau::Cover]
|
7
|
+
# @return [Relaton::Plateau::Cover, nil]
|
8
8
|
attr_reader :cover
|
9
9
|
|
10
|
-
# @return [Relaton::Plateau::Stagename]
|
10
|
+
# @return [Relaton::Plateau::Stagename, nil]
|
11
11
|
attr_reader :stagename
|
12
12
|
|
13
|
-
# @return [Integer]
|
14
|
-
|
13
|
+
# @return [Integer, nil]
|
14
|
+
attr_accessor :filesize
|
15
15
|
|
16
16
|
def initialize(**args)
|
17
17
|
@cover = args.delete(:cover)
|
@@ -44,8 +44,8 @@ module Relaton
|
|
44
44
|
ics.each { |i| b.ics i }
|
45
45
|
structuredidentifier&.to_xml b
|
46
46
|
stagename&.to_xml b
|
47
|
-
cover
|
48
|
-
b.filesize filesize
|
47
|
+
cover&.to_xml b
|
48
|
+
b.filesize filesize if filesize
|
49
49
|
end
|
50
50
|
ext["schema-version"] = ext_schema if !opts[:embedded] && respond_to?(:ext_schema) && ext_schema
|
51
51
|
end
|
@@ -72,6 +72,20 @@ module Relaton
|
|
72
72
|
output
|
73
73
|
end
|
74
74
|
|
75
|
+
def to_all_editions(hits)
|
76
|
+
me = deep_clone
|
77
|
+
me.docidentifier.each(&:remove_edition)
|
78
|
+
me.id.sub!(/#{Regexp.escape(me.edition.content)}$/, "")
|
79
|
+
me.instance_variable_set :@edition, nil
|
80
|
+
me.date = []
|
81
|
+
me.instance_variable_set :@link, []
|
82
|
+
me.filesize = nil
|
83
|
+
hits.each do |h|
|
84
|
+
me.relation << RelatonBib::DocumentRelation.new(type: "hasEdition", bibitem: h.bibitem)
|
85
|
+
end
|
86
|
+
me
|
87
|
+
end
|
88
|
+
|
75
89
|
private
|
76
90
|
|
77
91
|
def has_ext_data?
|
@@ -24,20 +24,15 @@ module Relaton
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def search(code)
|
27
|
-
|
27
|
+
all_editions = code.match?(/Handbook #\d+$/)
|
28
|
+
rows = index.search do |r|
|
29
|
+
id = all_editions ? r[:id].sub(/ \d+\.\d+$/, "") : r[:id]
|
30
|
+
id == code
|
31
|
+
end
|
28
32
|
return unless rows.any?
|
29
33
|
|
30
|
-
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
def fetch_doc(code, id:, file:)
|
35
|
-
resp = Net::HTTP.get_response URI("#{GHURL}#{file}")
|
36
|
-
return unless resp.is_a? Net::HTTPSuccess
|
37
|
-
|
38
|
-
hash = YAML.load(resp.body)
|
39
|
-
args = HashConverter.hash_to_bib hash
|
40
|
-
BibItem.new(**args)
|
34
|
+
hits = rows.map { |r| Hit.new(**r) }
|
35
|
+
all_editions ? hits[0].bibitem.to_all_editions(hits) : hits[0].bibitem
|
41
36
|
end
|
42
37
|
end
|
43
38
|
end
|
@@ -15,11 +15,11 @@ module Relaton
|
|
15
15
|
private
|
16
16
|
|
17
17
|
def edition
|
18
|
-
@edition ||= @version["title"].split.first
|
18
|
+
@edition ||= @version["title"].split.first.match(/[\d.]+/).to_s
|
19
19
|
end
|
20
20
|
|
21
|
-
def
|
22
|
-
|
21
|
+
def parse_docnumber
|
22
|
+
"Handbook ##{@entry["slug"]} #{edition}"
|
23
23
|
end
|
24
24
|
|
25
25
|
def parse_title
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Relaton
|
2
|
+
module Plateau
|
3
|
+
class Hit
|
4
|
+
def initialize(**args)
|
5
|
+
@id = args[:id]
|
6
|
+
@file = args[:file]
|
7
|
+
end
|
8
|
+
|
9
|
+
def bibitem
|
10
|
+
return @bibitem if defined? @bibitem
|
11
|
+
@bibitem = fetch_doc
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def fetch_doc
|
17
|
+
resp = Net::HTTP.get_response URI("#{Bibliography::GHURL}#{@file}")
|
18
|
+
return unless resp.is_a? Net::HTTPSuccess
|
19
|
+
|
20
|
+
hash = YAML.load(resp.body)
|
21
|
+
args = HashConverter.hash_to_bib hash
|
22
|
+
args[:fetched] = Date.today.to_s
|
23
|
+
BibItem.new(**args)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module Relaton
|
2
2
|
module Plateau
|
3
|
+
# Base class for Plateau parsers
|
3
4
|
class Parser
|
4
|
-
ATTRIS = %i[docid title abstract cover edition type doctype subdoctype
|
5
|
+
ATTRIS = %i[docid docnumber title abstract cover edition type doctype subdoctype
|
5
6
|
date link contributor filesize keyword structuredidentifier].freeze
|
6
7
|
|
7
8
|
def initialize(item)
|
@@ -17,10 +18,14 @@ module Relaton
|
|
17
18
|
|
18
19
|
private
|
19
20
|
|
20
|
-
def parse_docid
|
21
|
+
def parse_docid
|
22
|
+
[create_docid("PLATEAU #{parse_docnumber}")]
|
23
|
+
end
|
24
|
+
|
25
|
+
def parse_docnumber; end
|
21
26
|
|
22
27
|
def create_docid(id)
|
23
|
-
|
28
|
+
Docidentifier.new(type: "PLATEAU", id: id, primary: true)
|
24
29
|
end
|
25
30
|
|
26
31
|
def create_formatted_string(content, lang = "ja", script = "Jpan")
|
@@ -55,7 +60,7 @@ module Relaton
|
|
55
60
|
|
56
61
|
def parse_contributor
|
57
62
|
name = [
|
58
|
-
{ content: "
|
63
|
+
{ content: "国土交通省", language: "ja", script: "Jpan" },
|
59
64
|
{
|
60
65
|
content: "Japanese Ministry of Land, Infrastructure, Transport and Tourism",
|
61
66
|
language: "en",
|
data/lib/relaton/plateau.rb
CHANGED
@@ -4,8 +4,10 @@ require "relaton/index"
|
|
4
4
|
require "relaton_bib"
|
5
5
|
require_relative "plateau/version"
|
6
6
|
require_relative "plateau/util"
|
7
|
+
require_relative "plateau/docidentifier"
|
7
8
|
require_relative "plateau/document_type"
|
8
9
|
require_relative "plateau/bibitem"
|
10
|
+
require_relative "plateau/hit"
|
9
11
|
require_relative "plateau/bibliography"
|
10
12
|
require_relative "plateau/xml_parser"
|
11
13
|
require_relative "plateau/hash_converter"
|
@@ -27,5 +27,5 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_dependency "base64"
|
28
28
|
spec.add_dependency "relaton-index", "~> 0.2.12"
|
29
29
|
spec.add_dependency "relaton-logger", "~> 0.2.0"
|
30
|
-
spec.add_dependency "relaton-bib", "~> 1.19.
|
30
|
+
spec.add_dependency "relaton-bib", "~> 1.19.4"
|
31
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-plateau
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.19.
|
4
|
+
version: 1.19.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base64
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.19.
|
61
|
+
version: 1.19.4
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.19.
|
68
|
+
version: 1.19.4
|
69
69
|
description: Retrieve Project PLATEAU bibliographic items.
|
70
70
|
email:
|
71
71
|
- open.source@ribose.com
|
@@ -93,10 +93,12 @@ files:
|
|
93
93
|
- lib/relaton/plateau/bibitem.rb
|
94
94
|
- lib/relaton/plateau/bibliography.rb
|
95
95
|
- lib/relaton/plateau/cover.rb
|
96
|
+
- lib/relaton/plateau/docidentifier.rb
|
96
97
|
- lib/relaton/plateau/document_type.rb
|
97
98
|
- lib/relaton/plateau/fetcher.rb
|
98
99
|
- lib/relaton/plateau/handbook_parser.rb
|
99
100
|
- lib/relaton/plateau/hash_converter.rb
|
101
|
+
- lib/relaton/plateau/hit.rb
|
100
102
|
- lib/relaton/plateau/parser.rb
|
101
103
|
- lib/relaton/plateau/processor.rb
|
102
104
|
- lib/relaton/plateau/stagename.rb
|
@@ -104,7 +106,7 @@ files:
|
|
104
106
|
- lib/relaton/plateau/util.rb
|
105
107
|
- lib/relaton/plateau/version.rb
|
106
108
|
- lib/relaton/plateau/xml_parser.rb
|
107
|
-
-
|
109
|
+
- relaton_plateau.gemspec
|
108
110
|
- sig/relaton/plateau.rbs
|
109
111
|
homepage: https://github.com/relaton/relaton-plateau
|
110
112
|
licenses:
|