relaton-ogc 1.16.2 → 1.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +14 -3
- data/docs.json +29488 -0
- data/grammars/basicdoc.rng +18 -2
- data/grammars/biblio.rng +1 -0
- data/lib/relaton_ogc/document_type.rb +22 -0
- data/lib/relaton_ogc/hash_converter.rb +19 -14
- data/lib/relaton_ogc/ogc_bibliographic_item.rb +2 -11
- data/lib/relaton_ogc/ogc_bibliography.rb +4 -5
- data/lib/relaton_ogc/scrapper.rb +6 -1
- data/lib/relaton_ogc/version.rb +1 -1
- data/lib/relaton_ogc.rb +1 -0
- data/relaton_ogc.gemspec +1 -1
- metadata +6 -4
data/grammars/basicdoc.rng
CHANGED
@@ -346,6 +346,8 @@
|
|
346
346
|
<ref name="keyword"/>
|
347
347
|
<ref name="xref"/>
|
348
348
|
<ref name="hyperlink"/>
|
349
|
+
<ref name="index"/>
|
350
|
+
<ref name="index-xref"/>
|
349
351
|
</choice>
|
350
352
|
</oneOrMore>
|
351
353
|
</element>
|
@@ -623,6 +625,8 @@
|
|
623
625
|
<ref name="eref"/>
|
624
626
|
<ref name="xref"/>
|
625
627
|
<ref name="hyperlink"/>
|
628
|
+
<ref name="index"/>
|
629
|
+
<ref name="index-xref"/>
|
626
630
|
</choice>
|
627
631
|
</zeroOrMore>
|
628
632
|
</element>
|
@@ -636,6 +640,8 @@
|
|
636
640
|
<ref name="eref"/>
|
637
641
|
<ref name="xref"/>
|
638
642
|
<ref name="hyperlink"/>
|
643
|
+
<ref name="index"/>
|
644
|
+
<ref name="index-xref"/>
|
639
645
|
</choice>
|
640
646
|
</zeroOrMore>
|
641
647
|
</element>
|
@@ -648,6 +654,8 @@
|
|
648
654
|
<ref name="eref"/>
|
649
655
|
<ref name="xref"/>
|
650
656
|
<ref name="hyperlink"/>
|
657
|
+
<ref name="index"/>
|
658
|
+
<ref name="index-xref"/>
|
651
659
|
</choice>
|
652
660
|
</zeroOrMore>
|
653
661
|
</element>
|
@@ -655,7 +663,11 @@
|
|
655
663
|
<define name="keyword">
|
656
664
|
<element name="keyword">
|
657
665
|
<zeroOrMore>
|
658
|
-
<
|
666
|
+
<choice>
|
667
|
+
<ref name="PureTextElement"/>
|
668
|
+
<ref name="index"/>
|
669
|
+
<ref name="index-xref"/>
|
670
|
+
</choice>
|
659
671
|
</zeroOrMore>
|
660
672
|
</element>
|
661
673
|
</define>
|
@@ -676,7 +688,11 @@
|
|
676
688
|
<define name="strike">
|
677
689
|
<element name="strike">
|
678
690
|
<zeroOrMore>
|
679
|
-
<
|
691
|
+
<choice>
|
692
|
+
<ref name="PureTextElement"/>
|
693
|
+
<ref name="index"/>
|
694
|
+
<ref name="index-xref"/>
|
695
|
+
</choice>
|
680
696
|
</zeroOrMore>
|
681
697
|
</element>
|
682
698
|
</define>
|
data/grammars/biblio.rng
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
module RelatonOgc
|
2
|
+
class DocumentType < RelatonBib::DocumentType
|
3
|
+
DOCTYPES = %w[
|
4
|
+
abstract-specification-topic best-practice
|
5
|
+
change-request-supporting-document
|
6
|
+
community-practice community-standard discussion-paper engineering-report
|
7
|
+
other policy reference-model release-notes standard user-guide white-paper
|
8
|
+
test-suite draft-standard
|
9
|
+
].freeze
|
10
|
+
|
11
|
+
def initialize(type:, abbreviation: nil)
|
12
|
+
check_type type
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def check_type(type)
|
17
|
+
unless DOCTYPES.include? type
|
18
|
+
Util.warn "WARNING: invalid doctype: `#{type}`"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,20 +1,25 @@
|
|
1
1
|
module RelatonOgc
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
module HashConverter
|
3
|
+
include RelatonBib::HashConverter
|
4
|
+
extend self
|
5
5
|
|
6
|
-
|
7
|
-
def editorialgroup_hash_to_bib(ret)
|
8
|
-
eg = ret[:editorialgroup]
|
9
|
-
return unless eg
|
6
|
+
private
|
10
7
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
8
|
+
# @param ret [Hash]
|
9
|
+
def editorialgroup_hash_to_bib(ret)
|
10
|
+
eg = ret[:editorialgroup]
|
11
|
+
return unless eg
|
12
|
+
|
13
|
+
ret[:editorialgroup] = EditorialGroup.new(
|
14
|
+
committee: eg[:committee],
|
15
|
+
subcommittee: eg[:subcommittee],
|
16
|
+
workgroup: eg[:workgroup],
|
17
|
+
secretariat: eg[:secretariat],
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
def create_doctype(**args)
|
22
|
+
DocumentType.new(**args)
|
18
23
|
end
|
19
24
|
end
|
20
25
|
end
|
@@ -1,13 +1,5 @@
|
|
1
1
|
module RelatonOgc
|
2
2
|
class OgcBibliographicItem < RelatonBib::BibliographicItem
|
3
|
-
TYPES = %w[
|
4
|
-
abstract-specification-topic best-practice
|
5
|
-
change-request-supporting-document
|
6
|
-
community-practice community-standard discussion-paper engineering-report
|
7
|
-
other policy reference-model release-notes standard user-guide white-paper
|
8
|
-
test-suite
|
9
|
-
].freeze
|
10
|
-
|
11
3
|
SUBTYPES = %w[
|
12
4
|
conceptual-model conceptual-model-and-encoding
|
13
5
|
conceptual-model-and-implementation encoding extension implementation
|
@@ -16,8 +8,7 @@ module RelatonOgc
|
|
16
8
|
|
17
9
|
def initialize(**args)
|
18
10
|
if args[:subdoctype] && !SUBTYPES.include?(args[:subdoctype])
|
19
|
-
warn "
|
20
|
-
"subtype: #{args[:subdoctype]}"
|
11
|
+
Util.warn "WARNING: Invalid document subtype: `#{args[:subdoctype]}`"
|
21
12
|
end
|
22
13
|
|
23
14
|
# @docsubtype = args.delete :docsubtype
|
@@ -57,7 +48,7 @@ module RelatonOgc
|
|
57
48
|
def to_xml(**opts) # rubocop:disable Metrics/AbcSize
|
58
49
|
super(**opts) do |b|
|
59
50
|
ext = b.ext do
|
60
|
-
|
51
|
+
doctype&.to_xml b
|
61
52
|
b.subdoctype subdoctype if subdoctype
|
62
53
|
editorialgroup&.to_xml b
|
63
54
|
ics.each { |i| i.to_xml b }
|
@@ -20,10 +20,11 @@ module RelatonOgc
|
|
20
20
|
#
|
21
21
|
# @return [String] Relaton XML serialisation of reference
|
22
22
|
def get(code, year = nil, opts = {})
|
23
|
+
# id = year ? "`#{code}` year `#{year}`" : "#`{code}`"
|
23
24
|
result = bib_search_filter(code, year, opts) || (return nil)
|
24
25
|
ret = bib_results_filter(result, year)
|
25
26
|
if ret[:ret]
|
26
|
-
Util.warn "(#{code})
|
27
|
+
Util.warn "(#{code}) Found: `#{ret[:ret].docidentifier.first.id}`"
|
27
28
|
ret[:ret]
|
28
29
|
else
|
29
30
|
fetch_ref_err(code, year, ret[:years])
|
@@ -33,7 +34,7 @@ module RelatonOgc
|
|
33
34
|
private
|
34
35
|
|
35
36
|
def bib_search_filter(code, year, opts)
|
36
|
-
Util.warn "(#{code})
|
37
|
+
Util.warn "(#{code}) Fetching from Relaton repository ..."
|
37
38
|
search(code, year, opts)
|
38
39
|
end
|
39
40
|
|
@@ -67,9 +68,7 @@ module RelatonOgc
|
|
67
68
|
# @param year [String]
|
68
69
|
# @param missed_years [Array<Strig>]
|
69
70
|
def fetch_ref_err(code, year, missed_years)
|
70
|
-
|
71
|
-
Util.warn "WARNING: no match found online for #{id}. " \
|
72
|
-
"The code must be exactly like it is on the standards website."
|
71
|
+
Util.warn "(#{code}) Not found."
|
73
72
|
unless missed_years.empty?
|
74
73
|
Util.warn "There was no match for `#{year}`, though there " \
|
75
74
|
"were matches found for `#{missed_years.join('`, `')}`."
|
data/lib/relaton_ogc/scrapper.rb
CHANGED
@@ -41,7 +41,7 @@ module RelatonOgc
|
|
41
41
|
title: fetch_title(hit["title"]),
|
42
42
|
docid: fetch_docid(hit["identifier"]),
|
43
43
|
link: fetch_link(hit["URL"]),
|
44
|
-
doctype: type[:type],
|
44
|
+
doctype: fetch_doctype(type[:type]),
|
45
45
|
subdoctype: type[:subtype],
|
46
46
|
docstatus: fetch_status(type[:stage]),
|
47
47
|
edition: fetch_edition(hit["identifier"]),
|
@@ -75,9 +75,14 @@ module RelatonOgc
|
|
75
75
|
# @param url [String]
|
76
76
|
# @return [Array>RelatonBib::TypedUri>]
|
77
77
|
def fetch_link(url)
|
78
|
+
# type = url.end_with?("pdf") ? "pdf" : "src"
|
78
79
|
[RelatonBib::TypedUri.new(type: "obp", content: url)]
|
79
80
|
end
|
80
81
|
|
82
|
+
def fetch_doctype(type)
|
83
|
+
DocumentType.new(type: type)
|
84
|
+
end
|
85
|
+
|
81
86
|
# @param type [String]
|
82
87
|
# @return [String]
|
83
88
|
def fetch_type(type)
|
data/lib/relaton_ogc/version.rb
CHANGED
data/lib/relaton_ogc.rb
CHANGED
@@ -3,6 +3,7 @@ require "relaton_iso_bib"
|
|
3
3
|
require "relaton_ogc/version"
|
4
4
|
require "relaton_ogc/config"
|
5
5
|
require "relaton_ogc/util"
|
6
|
+
require "relaton_ogc/document_type"
|
6
7
|
require "relaton_ogc/ogc_bibliographic_item"
|
7
8
|
require "relaton_ogc/ogc_bibliography"
|
8
9
|
require "relaton_ogc/data_fetcher"
|
data/relaton_ogc.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-ogc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.17.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.17.0
|
55
55
|
description: 'RelatonOgc: retrieve OGC Standards for bibliographic use using the OgcBibliographicItem
|
56
56
|
model'
|
57
57
|
email:
|
@@ -72,6 +72,7 @@ files:
|
|
72
72
|
- bin/console
|
73
73
|
- bin/rspec
|
74
74
|
- bin/setup
|
75
|
+
- docs.json
|
75
76
|
- grammars/basicdoc.rng
|
76
77
|
- grammars/biblio-standoc.rng
|
77
78
|
- grammars/biblio.rng
|
@@ -80,6 +81,7 @@ files:
|
|
80
81
|
- lib/relaton_ogc.rb
|
81
82
|
- lib/relaton_ogc/config.rb
|
82
83
|
- lib/relaton_ogc/data_fetcher.rb
|
84
|
+
- lib/relaton_ogc/document_type.rb
|
83
85
|
- lib/relaton_ogc/editorial_group.rb
|
84
86
|
- lib/relaton_ogc/hash_converter.rb
|
85
87
|
- lib/relaton_ogc/hit.rb
|