relaton-omg 1.0.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ubuntu.yml +1 -0
- data/.rubocop.yml +2 -2
- data/README.adoc +4 -3
- data/grammars/biblio.rng +89 -32
- data/lib/relaton_omg/omg_bibliographic_item.rb +1 -24
- data/lib/relaton_omg/version.rb +1 -1
- data/lib/relaton_omg/xml_parser.rb +12 -17
- data/relaton_omg.gemspec +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd4e8a789f4c1e5802bd5624316c2e8b454b1f5b0e0eb98db65ff5aebf0396f0
|
4
|
+
data.tar.gz: b18bcf491a31d4ae72225eb575e698e5fe57da04f96bd9d0d84afcec9be42eb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0554f97818d7c0fce8faa682d6a618910ff014c04563cc0333024b4925f1f20209994c7174a2d0f9df9e5d8facd4b9eb82941865a835657426fc7e77b01c5116
|
7
|
+
data.tar.gz: 104dda7962b4846bf162708bce0aa745f816a2ffe4e6f768a65224e20f3b30788f89c77d2d26cfea3ed9f28db440f843f87cb34e3562fc396658851f8d0d911d
|
data/.rubocop.yml
CHANGED
data/README.adoc
CHANGED
@@ -36,6 +36,7 @@ Or install it yourself as:
|
|
36
36
|
[source,ruby]
|
37
37
|
----
|
38
38
|
require 'relaton_omg'
|
39
|
+
=> true
|
39
40
|
|
40
41
|
item = RelatonOmg::OmgBibliography.search 'OMG AMI4CCM 1.0'
|
41
42
|
=> #<RelatonOmg::OmgBibliographicItem:0x007fda17eab2f0
|
@@ -52,7 +53,7 @@ RelatonOmg::OmgBibliography.search 'OMG 1111'
|
|
52
53
|
[source,ruby]
|
53
54
|
----
|
54
55
|
item.to_xml
|
55
|
-
|
56
|
+
=>"<bibitem id="AMI4CCM1.0">
|
56
57
|
<fetched>2020-02-17</fetched>
|
57
58
|
<title type="main" format="text/plain" language="en" script="Latn">Asynchronous Method Invocation for CCM</title>
|
58
59
|
<uri type="src">https://www.omg.org/spec/AMI4CCM/1.0/</uri>
|
@@ -87,7 +88,7 @@ item = RelatonOmg::OmgBibliographicItem.from_xml 'spec/fixtures/omg_ami4ccm_1_0.
|
|
87
88
|
=== Create bibliographic item form Hash
|
88
89
|
[source,ruby]
|
89
90
|
----
|
90
|
-
hash = YAML.load_file 'spec/fixtures/omg_ami4ccm_1_0.
|
91
|
+
hash = YAML.load_file 'spec/fixtures/omg_ami4ccm_1_0.yaml'
|
91
92
|
=> {"id"=>"AMI4CCM1.0",
|
92
93
|
...
|
93
94
|
|
@@ -106,7 +107,7 @@ item = RelatonOmg::OmgBibliographicItem.from_yaml 'spec/fixtures/omg_ami4ccm_1_0
|
|
106
107
|
|
107
108
|
== Contributing
|
108
109
|
|
109
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
110
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/relaton/relaton-ietf.
|
110
111
|
|
111
112
|
== License
|
112
113
|
|
data/grammars/biblio.rng
CHANGED
@@ -88,7 +88,7 @@
|
|
88
88
|
<text/>
|
89
89
|
</element>
|
90
90
|
</define>
|
91
|
-
<define name="
|
91
|
+
<define name="LocalizedString1">
|
92
92
|
<optional>
|
93
93
|
<!-- multiple languages and scripts possible: comma delimit them if so -->
|
94
94
|
<attribute name="language"/>
|
@@ -98,6 +98,16 @@
|
|
98
98
|
</optional>
|
99
99
|
<text/>
|
100
100
|
</define>
|
101
|
+
<define name="LocalizedString">
|
102
|
+
<choice>
|
103
|
+
<ref name="LocalizedString1"/>
|
104
|
+
<oneOrMore>
|
105
|
+
<element name="variant">
|
106
|
+
<ref name="LocalizedString1"/>
|
107
|
+
</element>
|
108
|
+
</oneOrMore>
|
109
|
+
</choice>
|
110
|
+
</define>
|
101
111
|
<!--
|
102
112
|
Unlike UML, change type to format: type is overloaded
|
103
113
|
Would be need if plain were default value and could omit the attribute
|
@@ -121,7 +131,7 @@
|
|
121
131
|
</optional>
|
122
132
|
<ref name="LocalizedStringOrXsAny"/>
|
123
133
|
</define>
|
124
|
-
<define name="
|
134
|
+
<define name="LocalizedStringOrXsAny1">
|
125
135
|
<optional>
|
126
136
|
<!-- multiple languages and scripts possible: comma delimit them if so -->
|
127
137
|
<attribute name="language"/>
|
@@ -136,6 +146,16 @@
|
|
136
146
|
</choice>
|
137
147
|
</oneOrMore>
|
138
148
|
</define>
|
149
|
+
<define name="LocalizedStringOrXsAny">
|
150
|
+
<choice>
|
151
|
+
<ref name="LocalizedStringOrXsAny1"/>
|
152
|
+
<oneOrMore>
|
153
|
+
<element name="variant">
|
154
|
+
<ref name="LocalizedStringOrXsAny1"/>
|
155
|
+
</element>
|
156
|
+
</oneOrMore>
|
157
|
+
</choice>
|
158
|
+
</define>
|
139
159
|
<define name="contributor">
|
140
160
|
<element name="contributor">
|
141
161
|
<zeroOrMore>
|
@@ -512,7 +532,7 @@
|
|
512
532
|
</define>
|
513
533
|
<define name="LocalityType">
|
514
534
|
<data type="string">
|
515
|
-
<param name="pattern">section|clause|part|paragraph|chapter|page|whole|table|annex|figure|note|list|example|volume|issue|time|locality:[a-zA-Z0-9_]+</param>
|
535
|
+
<param name="pattern">section|clause|part|paragraph|chapter|page|whole|table|annex|figure|note|list|example|volume|issue|time|anchor|locality:[a-zA-Z0-9_]+</param>
|
516
536
|
</data>
|
517
537
|
</define>
|
518
538
|
<define name="referenceFrom">
|
@@ -641,9 +661,9 @@
|
|
641
661
|
<optional>
|
642
662
|
<ref name="status"/>
|
643
663
|
</optional>
|
644
|
-
<
|
664
|
+
<zeroOrMore>
|
645
665
|
<ref name="copyright"/>
|
646
|
-
</
|
666
|
+
</zeroOrMore>
|
647
667
|
<zeroOrMore>
|
648
668
|
<ref name="docrelation"/>
|
649
669
|
</zeroOrMore>
|
@@ -767,6 +787,8 @@
|
|
767
787
|
<value>unchanged</value>
|
768
788
|
<value>circulated</value>
|
769
789
|
<value>adapted</value>
|
790
|
+
<value>vote-started</value>
|
791
|
+
<value>vote-ended</value>
|
770
792
|
</choice>
|
771
793
|
</define>
|
772
794
|
<define name="bdate">
|
@@ -999,7 +1021,17 @@
|
|
999
1021
|
<optional>
|
1000
1022
|
<ref name="to"/>
|
1001
1023
|
</optional>
|
1002
|
-
<
|
1024
|
+
<oneOrMore>
|
1025
|
+
<ref name="owner"/>
|
1026
|
+
</oneOrMore>
|
1027
|
+
<optional>
|
1028
|
+
<ref name="copyright_scope"/>
|
1029
|
+
</optional>
|
1030
|
+
</element>
|
1031
|
+
</define>
|
1032
|
+
<define name="copyright_scope">
|
1033
|
+
<element name="scope">
|
1034
|
+
<text/>
|
1003
1035
|
</element>
|
1004
1036
|
</define>
|
1005
1037
|
<define name="from">
|
@@ -1019,38 +1051,63 @@
|
|
1019
1051
|
</define>
|
1020
1052
|
<define name="DocRelationType">
|
1021
1053
|
<choice>
|
1022
|
-
<value>obsoletes</value>
|
1023
|
-
<value>obsoletedBy</value>
|
1024
|
-
<value>supersedes</value>
|
1025
|
-
<value>supersededBy</value>
|
1026
|
-
<value>updates</value>
|
1027
|
-
<value>updatedBy</value>
|
1028
|
-
<value>complements</value>
|
1029
|
-
<value>derivedFrom</value>
|
1030
|
-
<value>translatedFrom</value>
|
1031
|
-
<value>hasTranslation</value>
|
1032
|
-
<value>adoptedFrom</value>
|
1033
|
-
<value>equivalent</value>
|
1034
|
-
<value>identical</value>
|
1035
|
-
<value>nonequivalent</value>
|
1036
|
-
<value>includedIn</value>
|
1037
1054
|
<value>includes</value>
|
1038
|
-
<value>
|
1039
|
-
<value>instanceOf</value>
|
1040
|
-
<value>partOf</value>
|
1055
|
+
<value>includedIn</value>
|
1041
1056
|
<value>hasPart</value>
|
1042
|
-
<value>
|
1043
|
-
<value>draftOf</value>
|
1057
|
+
<value>partOf</value>
|
1044
1058
|
<value>merges</value>
|
1059
|
+
<value>mergedInto</value>
|
1045
1060
|
<value>splits</value>
|
1046
|
-
<value>
|
1047
|
-
<value>
|
1048
|
-
<value>
|
1049
|
-
<value>
|
1050
|
-
<value>
|
1051
|
-
<value>
|
1061
|
+
<value>splitInto</value>
|
1062
|
+
<value>instance</value>
|
1063
|
+
<value>hasInstance</value>
|
1064
|
+
<value>exemplarOf</value>
|
1065
|
+
<value>hasExemplar</value>
|
1066
|
+
<value>manifestationOf</value>
|
1067
|
+
<value>hasManifestation</value>
|
1068
|
+
<value>reproductionOf</value>
|
1069
|
+
<value>hasReproduction</value>
|
1070
|
+
<value>reprintOf</value>
|
1071
|
+
<value>hasReprint</value>
|
1072
|
+
<value>expressionOf</value>
|
1073
|
+
<value>hasExpression</value>
|
1074
|
+
<value>translatedFrom</value>
|
1075
|
+
<value>hasTranslation</value>
|
1076
|
+
<value>arrangementOf</value>
|
1077
|
+
<value>hasArrangement</value>
|
1078
|
+
<value>abridgementOf</value>
|
1079
|
+
<value>hasAbridgement</value>
|
1080
|
+
<value>annotationOf</value>
|
1081
|
+
<value>hasAnnotation</value>
|
1082
|
+
<value>draftOf</value>
|
1083
|
+
<value>hasDraft</value>
|
1084
|
+
<value>editionOf</value>
|
1085
|
+
<value>hasEdition</value>
|
1086
|
+
<value>updates</value>
|
1087
|
+
<value>updatedBy</value>
|
1088
|
+
<value>derivedFrom</value>
|
1089
|
+
<value>derives</value>
|
1052
1090
|
<value>describes</value>
|
1053
1091
|
<value>describedBy</value>
|
1092
|
+
<value>catalogues</value>
|
1093
|
+
<value>cataloguedBy</value>
|
1094
|
+
<value>hasSuccessor</value>
|
1095
|
+
<value>successorOf</value>
|
1096
|
+
<value>adaptedFrom</value>
|
1097
|
+
<value>hasAdaptation</value>
|
1098
|
+
<value>adoptedFrom</value>
|
1099
|
+
<value>adoptedAs</value>
|
1100
|
+
<value>reviewOf</value>
|
1101
|
+
<value>hasReview</value>
|
1102
|
+
<value>commentaryOf</value>
|
1103
|
+
<value>hasCommentary</value>
|
1104
|
+
<value>related</value>
|
1105
|
+
<value>complements</value>
|
1106
|
+
<value>complementOf</value>
|
1107
|
+
<value>obsoletes</value>
|
1108
|
+
<value>obsoletedBy</value>
|
1109
|
+
<value>cited</value>
|
1110
|
+
<value>isCitedIn</value>
|
1054
1111
|
</choice>
|
1055
1112
|
</define>
|
1056
1113
|
<define name="docrelation">
|
@@ -1,16 +1,6 @@
|
|
1
1
|
module RelatonOmg
|
2
2
|
class OmgBibliographicItem < RelatonBib::BibliographicItem
|
3
3
|
# @return [String, NilClass]
|
4
|
-
attr_reader :doctype
|
5
|
-
|
6
|
-
# @param doctype [String]
|
7
|
-
# @param keyword [Array<String>]
|
8
|
-
def initialize(**args)
|
9
|
-
@doctype = args.delete :doctype
|
10
|
-
# @keyword = args.delete(:keyword) || []
|
11
|
-
super
|
12
|
-
end
|
13
|
-
|
14
4
|
class << self
|
15
5
|
# @param file [String] path to YAML file
|
16
6
|
# @return [RelatonOmg::OmgBibliographicItem]
|
@@ -36,20 +26,7 @@ module RelatonOmg
|
|
36
26
|
# @option opts [Symbol, NilClass] :date_format (:short), :full
|
37
27
|
def to_xml(builder = nil, **opts)
|
38
28
|
opts[:date_format] ||= :short
|
39
|
-
super
|
40
|
-
# if opts[:bibdata]
|
41
|
-
# b.ext do
|
42
|
-
# b.doctype doctype if doctype
|
43
|
-
# end
|
44
|
-
# end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
# @return [Hash]
|
49
|
-
def to_hash
|
50
|
-
hash = super
|
51
|
-
hash["doctype"] = doctype if doctype
|
52
|
-
hash
|
29
|
+
super
|
53
30
|
end
|
54
31
|
end
|
55
32
|
end
|
data/lib/relaton_omg/version.rb
CHANGED
@@ -3,26 +3,21 @@ require "nokogiri"
|
|
3
3
|
module RelatonOmg
|
4
4
|
class XMLParser < RelatonBib::XMLParser
|
5
5
|
class << self
|
6
|
-
def from_xml(xml)
|
7
|
-
doc = Nokogiri::XML(xml)
|
8
|
-
doc.remove_namespaces!
|
9
|
-
item = doc.at("/bibitem|/bibdata")
|
10
|
-
if item
|
11
|
-
RelatonOmg::OmgBibliographicItem.new(item_data(item))
|
12
|
-
else
|
13
|
-
warn "[relato-omg] can't find bibitem or bibdata element in the XML"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
6
|
private
|
18
7
|
|
19
|
-
def item_data(ietfitem)
|
20
|
-
|
21
|
-
|
22
|
-
|
8
|
+
# def item_data(ietfitem)
|
9
|
+
# data = super
|
10
|
+
# ext = ietfitem.at "./ext"
|
11
|
+
# return data unless ext
|
12
|
+
|
13
|
+
# data[:doctype] = ext.at("./doctype")&.text
|
14
|
+
# data
|
15
|
+
# end
|
23
16
|
|
24
|
-
|
25
|
-
|
17
|
+
# @param item_hash [Hash]
|
18
|
+
# @return [RelatonOmg::OmgBibliographicItem]
|
19
|
+
def bib_item(item_hash)
|
20
|
+
OmgBibliographicItem.new item_hash
|
26
21
|
end
|
27
22
|
end
|
28
23
|
end
|
data/relaton_omg.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-omg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -156,14 +156,14 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 1.
|
159
|
+
version: 1.4.0
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: 1.
|
166
|
+
version: 1.4.0
|
167
167
|
description: 'RelatonOmg: retrieve OMG Standards for bibliographic using the IsoBibliographicItem
|
168
168
|
model'
|
169
169
|
email:
|
@@ -201,7 +201,7 @@ licenses:
|
|
201
201
|
metadata:
|
202
202
|
homepage_uri: https://github.com/relaton/relaton-ogn
|
203
203
|
source_code_uri: https://github.com/relaton/relaton-ogn
|
204
|
-
post_install_message:
|
204
|
+
post_install_message:
|
205
205
|
rdoc_options: []
|
206
206
|
require_paths:
|
207
207
|
- lib
|
@@ -217,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
217
217
|
version: '0'
|
218
218
|
requirements: []
|
219
219
|
rubygems_version: 3.0.6
|
220
|
-
signing_key:
|
220
|
+
signing_key:
|
221
221
|
specification_version: 4
|
222
222
|
summary: 'RelatonOmg: retrieve OMG Standards for bibliographic using the IsoBibliographicItem
|
223
223
|
model'
|