relaton-calconnect 1.9.0 → 1.10.1
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 +39 -0
- data/grammars/basicdoc.rng +26 -7
- data/grammars/biblio.rng +7 -5
- data/grammars/isodoc.rng +617 -89
- data/grammars/reqt.rng +34 -5
- data/lib/relaton_calconnect/data_fetcher.rb +93 -0
- data/lib/relaton_calconnect/processor.rb +14 -1
- data/lib/relaton_calconnect/scrapper.rb +63 -12
- data/lib/relaton_calconnect/version.rb +1 -1
- data/lib/relaton_calconnect.rb +1 -0
- data/relaton_calconnect.gemspec +2 -2
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28f0818beb318356e6c98999c461cfa4abfd2582f22771e42c93679b79acc0b6
|
4
|
+
data.tar.gz: 629eec258bb6b2ab488cb50731ec8a49248ea2b52fea97d8628f51dca3a495ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c2ee52411505f9e208aee08277ba956d66c74ddce6cdaa4b78700ac906ddc1caeaf10951f05e20a9e3666486d24c4fe5f4a763217ca0e5a073326f3ccc668e4
|
7
|
+
data.tar.gz: 83c61bb0b56e315db85647b46a889d8ec506905d9019ed675d4de31d1508500340d0b61a8df6ddcad21f29df828323c3b624694434f62f23fc0e2509c4854144
|
data/.rubocop.yml
CHANGED
data/README.adoc
CHANGED
@@ -76,6 +76,26 @@ item.to_xml bibdata: true
|
|
76
76
|
</bibdata>"
|
77
77
|
----
|
78
78
|
|
79
|
+
=== Typed links
|
80
|
+
|
81
|
+
Each Calconnect document has link types:
|
82
|
+
|
83
|
+
* `xml` - XML format
|
84
|
+
* `pdf` - PDF format
|
85
|
+
* `doc` - Microsoft Word document format
|
86
|
+
* `html` - HTML format
|
87
|
+
* `rxl` - RelatonXML format
|
88
|
+
|
89
|
+
[source,ruby]
|
90
|
+
----
|
91
|
+
item.link
|
92
|
+
=> [#<RelatonBib::TypedUri:0x00007ff2d4b009e0 @content=#<Addressable::URI:0x668 URI:https://standards.calconnect.org/csd/cc-10005.xml>, @type="xml">,
|
93
|
+
#<RelatonBib::TypedUri:0x00007ff2d4b00378 @content=#<Addressable::URI:0x67c URI:https://standards.calconnect.org/csd/cc-10005.pdf>, @type="pdf">,
|
94
|
+
#<RelatonBib::TypedUri:0x00007ff2d4b00058 @content=#<Addressable::URI:0x690 URI:https://standards.calconnect.org/csd/cc-10005.doc>, @type="doc">,
|
95
|
+
#<RelatonBib::TypedUri:0x00007ff2d4b23d28 @content=#<Addressable::URI:0x6a4 URI:https://standards.calconnect.org/csd/cc-10005.html>, @type="html">,
|
96
|
+
#<RelatonBib::TypedUri:0x00007ff2d4b23a08 @content=#<Addressable::URI:0x6b8 URI:https://standards.calconnect.org/csd/cc-10005.rxl>, @type="rxl">]
|
97
|
+
----
|
98
|
+
|
79
99
|
=== Get code, and year
|
80
100
|
[source,ruby]
|
81
101
|
----
|
@@ -106,6 +126,25 @@ RelatonCalconnect::CcBibliographicItem.from_hash hash
|
|
106
126
|
...
|
107
127
|
----
|
108
128
|
|
129
|
+
=== Fetch data
|
130
|
+
|
131
|
+
This gem uses the https://raw.githubusercontent.com/usnistgov/NIST-Tech-Pubs/nist-pages/xml/allrecords.xml dataset as one of data sources.
|
132
|
+
|
133
|
+
The method `RelatonCalconnect::DataFetcher.fetch(output: "data", format: "yaml")` fetches all the documents from the datast and save them to the `./data` folder in YAML format.
|
134
|
+
Arguments:
|
135
|
+
|
136
|
+
- `output` - folder to save documents (default './data').
|
137
|
+
- `format` - format in which the documents are saved. Possimle formats are: `yaml`, `xml` (default `yaml`).
|
138
|
+
|
139
|
+
[source,ruby]
|
140
|
+
----
|
141
|
+
RelatonCalconnect::DataFetcher.fetch
|
142
|
+
Started at: 2021-09-09 16:03:51 +0200
|
143
|
+
Stopped at: 2021-09-09 16:04:12 +0200
|
144
|
+
Done in: 20 sec.
|
145
|
+
=> nil
|
146
|
+
----
|
147
|
+
|
109
148
|
== Development
|
110
149
|
|
111
150
|
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/grammars/basicdoc.rng
CHANGED
@@ -173,9 +173,11 @@
|
|
173
173
|
<data type="dateTime"/>
|
174
174
|
</attribute>
|
175
175
|
</optional>
|
176
|
-
<
|
177
|
-
<
|
178
|
-
|
176
|
+
<optional>
|
177
|
+
<attribute name="from">
|
178
|
+
<data type="IDREF"/>
|
179
|
+
</attribute>
|
180
|
+
</optional>
|
179
181
|
<optional>
|
180
182
|
<attribute name="to">
|
181
183
|
<data type="IDREF"/>
|
@@ -624,6 +626,9 @@
|
|
624
626
|
<choice>
|
625
627
|
<ref name="PureTextElement"/>
|
626
628
|
<ref name="stem"/>
|
629
|
+
<ref name="eref"/>
|
630
|
+
<ref name="xref"/>
|
631
|
+
<ref name="hyperlink"/>
|
627
632
|
</choice>
|
628
633
|
</zeroOrMore>
|
629
634
|
</element>
|
@@ -634,6 +639,9 @@
|
|
634
639
|
<choice>
|
635
640
|
<ref name="PureTextElement"/>
|
636
641
|
<ref name="stem"/>
|
642
|
+
<ref name="eref"/>
|
643
|
+
<ref name="xref"/>
|
644
|
+
<ref name="hyperlink"/>
|
637
645
|
</choice>
|
638
646
|
</zeroOrMore>
|
639
647
|
</element>
|
@@ -641,7 +649,12 @@
|
|
641
649
|
<define name="tt">
|
642
650
|
<element name="tt">
|
643
651
|
<zeroOrMore>
|
644
|
-
<
|
652
|
+
<choice>
|
653
|
+
<ref name="PureTextElement"/>
|
654
|
+
<ref name="eref"/>
|
655
|
+
<ref name="xref"/>
|
656
|
+
<ref name="hyperlink"/>
|
657
|
+
</choice>
|
645
658
|
</zeroOrMore>
|
646
659
|
</element>
|
647
660
|
</define>
|
@@ -822,7 +835,9 @@
|
|
822
835
|
<attribute name="alt"/>
|
823
836
|
</optional>
|
824
837
|
<ref name="CitationType"/>
|
825
|
-
<
|
838
|
+
<oneOrMore>
|
839
|
+
<ref name="PureTextElement"/>
|
840
|
+
</oneOrMore>
|
826
841
|
</define>
|
827
842
|
<define name="hyperlink">
|
828
843
|
<element name="link">
|
@@ -835,7 +850,9 @@
|
|
835
850
|
<optional>
|
836
851
|
<attribute name="alt"/>
|
837
852
|
</optional>
|
838
|
-
<
|
853
|
+
<oneOrMore>
|
854
|
+
<ref name="PureTextElement"/>
|
855
|
+
</oneOrMore>
|
839
856
|
</element>
|
840
857
|
</define>
|
841
858
|
<define name="xref">
|
@@ -849,7 +866,9 @@
|
|
849
866
|
<optional>
|
850
867
|
<attribute name="alt"/>
|
851
868
|
</optional>
|
852
|
-
<
|
869
|
+
<oneOrMore>
|
870
|
+
<ref name="PureTextElement"/>
|
871
|
+
</oneOrMore>
|
853
872
|
</element>
|
854
873
|
</define>
|
855
874
|
<define name="fn">
|
data/grammars/biblio.rng
CHANGED
@@ -209,9 +209,6 @@
|
|
209
209
|
<zeroOrMore>
|
210
210
|
<ref name="contact"/>
|
211
211
|
</zeroOrMore>
|
212
|
-
<zeroOrMore>
|
213
|
-
<ref name="uri"/>
|
214
|
-
</zeroOrMore>
|
215
212
|
</element>
|
216
213
|
</define>
|
217
214
|
<define name="fullname">
|
@@ -401,9 +398,9 @@
|
|
401
398
|
<choice>
|
402
399
|
<!-- iso191606 TODO -->
|
403
400
|
<group>
|
404
|
-
<
|
401
|
+
<zeroOrMore>
|
405
402
|
<ref name="street"/>
|
406
|
-
</
|
403
|
+
</zeroOrMore>
|
407
404
|
<ref name="city"/>
|
408
405
|
<optional>
|
409
406
|
<ref name="state"/>
|
@@ -828,6 +825,11 @@
|
|
828
825
|
<optional>
|
829
826
|
<attribute name="scope"/>
|
830
827
|
</optional>
|
828
|
+
<optional>
|
829
|
+
<attribute name="primary">
|
830
|
+
<data type="boolean"/>
|
831
|
+
</attribute>
|
832
|
+
</optional>
|
831
833
|
<text/>
|
832
834
|
</element>
|
833
835
|
</define>
|