relaton-w3c 1.9.0 → 1.9.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58a4044db1d46717f23268b36efff858fbfdccd7e8c3f2b47d98246831512d42
4
- data.tar.gz: bf87dbf1f5da70e68dc771f115363c531188b103a23bbf05872c68a8c47131a4
3
+ metadata.gz: c8892da64cad98a7f8a24fd16101660aa96c12ef980d0d83b96b4965b3b6a052
4
+ data.tar.gz: a92f5c36650a0e5b7bb3debe0c49139d28aeb67b23c22032755bf4f3d1d92a7b
5
5
  SHA512:
6
- metadata.gz: 6b2fae6c6cf119defdf15284f68eac82ccf50766a162889a2f09ca4c3f9e7ffa1705b9f71a2b4b0da20939948f59e424f5a18489bb5ec19d18cfdf742f150aa7
7
- data.tar.gz: c3ecafb387e50c47a93eeb3fde746420ee801667afe24a2277d0b4812d42a922a67e5374c919d1dff091bd0f02669f156609b0dcb383390f44d9fe6d245023d1
6
+ metadata.gz: 9e602df91cd13d130f803c8152c2c1c307f8727ae94c1511710f2f7e9b0b9cb34b96a88f1fcc7b7f3a72c768f290d7437f0a7d6b43d99cafc69bd1777828d7f0
7
+ data.tar.gz: 11e1da12c19f1c54e90e1e2ff4fc0a4b4863babb69fdb63fc7bfb360d91abc4dd1c34558c357c4b0ef406232d6a0ad4411974dfcb11b74bfbc909bcf1390b35d
data/Gemfile CHANGED
@@ -3,5 +3,5 @@ source "https://rubygems.org"
3
3
  # Specify your gem's dependencies in relaton_w3c.gemspec
4
4
  gemspec
5
5
 
6
- gem "rake", "~> 12.0"
6
+ gem "rake", "~> 13.0"
7
7
  gem "rspec", "~> 3.0"
data/README.adoc CHANGED
@@ -30,11 +30,10 @@ Or install it yourself as:
30
30
  require 'relaton_w3c'
31
31
  => true
32
32
 
33
- hits = RelatonW3c::W3cBibliography.search("W3C JSON-LD 1.1")
34
- => <RelatonW3c::HitCollection:0x007f93b5e4ff48 @ref=W3C JSON-LD 1.1 @fetched=false>
35
-
36
- item = hits[0].fetch
37
- => #<RelatonW3c::W3cBibliographicItem:0x007f93a58a0670
33
+ item = RelatonW3c::W3cBibliography.get "W3C REC-json-ld11-20200716"
34
+ [relaton-w3c] ("W3C REC-json-ld11-20200716") fetching...
35
+ [relaton-w3c] ("W3C REC-json-ld11-20200716") found JSON-LD 1.1
36
+ => #<RelatonW3c::W3cBibliographicItem:0x00007fc4ea03c6c0
38
37
  ...
39
38
  ----
40
39
 
@@ -43,16 +42,51 @@ item = hits[0].fetch
43
42
  [source,ruby]
44
43
  ----
45
44
  item.to_xml
46
- => "<bibitem id="CR-json-ld11-20200316" type="standard">
47
- <fetched>2020-04-07</fetched>
48
- <title type="main" format="text/plain" language="en" script="Latn">JSON-LD 1.1</title>
49
- <title format="text/plain" language="en" script="Latn">A JSON-based Serialization for Linked Data</title>
50
- <uri type="src">https://www.w3.org/TR/2020/CR-json-ld11-20200316/</uri>
51
- <date type="published">
52
- <on>2020</on>
53
- </date>
54
- ...
55
- </bibitem>"
45
+ => "<bibitem id="W3CREC-json-ld11-20200716" type="standard">
46
+ <fetched>2021-11-20</fetched>
47
+ <title format="text/plain">JSON-LD 1.1</title>
48
+ <uri type="src">https://www.w3.org/TR/2020/REC-json-ld11-20200716/</uri>
49
+ <docidentifier type="W3C">W3C REC-json-ld11-20200716</docidentifier>
50
+ <docnumber>REC-json-ld11-20200716</docnumber>
51
+ <date type="published">
52
+ <on>2020-07-16</on>
53
+ </date>
54
+ <contributor>
55
+ <role type="editor"/>
56
+ <person>
57
+ <name>
58
+ <completename language="en" script="Latn">Dave Longley</completename>
59
+ </name>
60
+ </person>
61
+ </contributor>
62
+ <contributor>
63
+ <role type="editor"/>
64
+ <person>
65
+ <name>
66
+ <completename language="en" script="Latn">Gregg Kellogg</completename>
67
+ </name>
68
+ </person>
69
+ </contributor>
70
+ <contributor>
71
+ <role type="editor"/>
72
+ <person>
73
+ <name>
74
+ <completename language="en" script="Latn">Pierre-Antoine Champin</completename>
75
+ </name>
76
+ </person>
77
+ </contributor>
78
+ <language>en</language>
79
+ <script>Latn</script>
80
+ <relation type="obsoletes">
81
+ <bibitem>
82
+ <formattedref format="text/plain">W3C PR-json-ld11-20200507</formattedref>
83
+ </bibitem>
84
+ </relation>
85
+ <series>
86
+ <title format="text/plain">W3C REC</title>
87
+ <number>REC-json-ld11-20200716</number>
88
+ </series>
89
+ </bibitem>"
56
90
  ----
57
91
 
58
92
  With argument `bibdata: true` it ouputs XML wrapped by `bibdata` element and adds flavour `ext` element.
@@ -61,58 +95,32 @@ With argument `bibdata: true` it ouputs XML wrapped by `bibdata` element and add
61
95
  ----
62
96
  item.to_xml bibdata: true
63
97
  => "<bibdata type="standard">
64
- <fetched>2020-04-07</fetched>
65
- <title type="main" format="text/plain" language="en" script="Latn">JSON-LD 1.1</title>
66
- <title format="text/plain" language="en" script="Latn">A JSON-based Serialization for Linked Data</title>
67
- <uri type="src">https://www.w3.org/TR/2020/CR-json-ld11-20200316/</uri>
68
- <date type="published">
69
- <on>2020</on>
70
- </date>
71
- ...
72
- <ext>
73
- <doctype>candidateRecommendation</doctype>
74
- </ext>
75
- </bibdata>"
76
- ----
77
-
78
- === Get document by title
79
- [source,ruby]
80
- ----
81
- RelatonW3c::W3cBibliography.get "W3C JSON-LD 1.1"
82
- [relaton-w3c] ("W3C JSON-LD 1.1") fetching...
83
- [relaton-w3c] ("W3C JSON-LD 1.1") found JSON-LD 1.1
84
- => #<RelatonW3c::W3cBibliographicItem:0x007f93b655bb48
85
- ...
98
+ <fetched>2021-11-20</fetched>
99
+ <title format="text/plain">JSON-LD 1.1</title>
100
+ <uri type="src">https://www.w3.org/TR/2020/REC-json-ld11-20200716/</uri>
101
+ <docidentifier type="W3C">W3C REC-json-ld11-20200716</docidentifier>
102
+ <docnumber>REC-json-ld11-20200716</docnumber>
103
+ ...
104
+ <ext>
105
+ <doctype>recommendation</doctype>
106
+ <editorialgroup>
107
+ <technical-committee>JSON-LD Working Group</technical-committee>
108
+ </editorialgroup>
109
+ </ext>
110
+ </bibdata>"
86
111
  ----
87
112
 
88
- === Get document by title and type
89
- [source,ruby]
90
- ----
91
- RelatonW3c::W3cBibliography.get "W3C Candidate Recommendation JSON-LD 1.1"
92
- [relaton-w3c] ("W3C Candidate Recommendation JSON-LD 1.1") fetching...
93
- [relaton-w3c] ("W3C Candidate Recommendation JSON-LD 1.1") found JSON-LD 1.1
94
- => #<RelatonW3c::W3cBibliographicItem:0x007f9357199b90
95
- ...
96
- ----
113
+ === Typed links
97
114
 
98
- === Get document by title and short type
99
- [source,ruby]
100
- ----
101
- RelatonW3c::W3cBibliography.get "W3C CR JSON-LD 1.1"
102
- [relaton-w3c] ("W3C CR JSON-LD 1.1") fetching...
103
- [relaton-w3c] ("W3C CR JSON-LD 1.1") found JSON-LD 1.1
104
- => #<RelatonW3c::W3cBibliographicItem:0x007f93b6d37dd0
105
- ...
106
- ----
115
+ Each W3C document has `src` type link.
107
116
 
108
- === Get document by title, type, and date
109
117
  [source,ruby]
110
118
  ----
111
- RelatonW3c::W3cBibliography.get "W3C WD JSON-LD 1.1 2019-10-18"
112
- [relaton-w3c] ("W3C WD JSON-LD 1.1 2019-10-18") fetching...
113
- [relaton-w3c] ("W3C WD JSON-LD 1.1 2019-10-18") found JSON-LD 1.1
114
- => #<RelatonW3c::W3cBibliographicItem:0x007f9345a198b8
115
- ...
119
+ item.link.first.type
120
+ => "src"
121
+
122
+ item.link.first.content
123
+ => #<Addressable::URI:0x75634 URI:https://www.w3.org/TR/2020/REC-json-ld11-20200716/>
116
124
  ----
117
125
 
118
126
  === Create bibliographic item from XML
@@ -136,11 +144,30 @@ bib_hash = RelatonW3c::HashConverter.hash_to_bib hash
136
144
  [{:type=>"main", :content=>"JSON-LD 1.1", :language=>"en", :script=>"Latn", :format=>"text/plain"},
137
145
  ...
138
146
 
139
- RelatonW3c::W3cBibliographicItem.new bib_hash
147
+ RelatonW3c::W3cBibliographicItem.new **bib_hash
140
148
  => #<RelatonW3c::W3cBibliographicItem:0x007f9381ec6a00
141
149
  ...
142
150
  ----
143
151
 
152
+ === Fetch data
153
+
154
+ There is a W3C dataset http://www.w3.org/2002/01/tr-automation/tr.rdf which can be converted into RelatonXML/BibXML/BibYAML formats.
155
+
156
+ The method `RelatonW3c::DataFetcher.fetch(output: "data", format: "yaml")` converts all the documents from the dataset and save them to the `./data` folder in YAML format.
157
+ Arguments:
158
+
159
+ - `output` - folder to save documents (default './data').
160
+ - `format` - format in which the documents are saved. Possimle formats are: `yaml`, `xml`, `bibxml` (default `yaml`).
161
+
162
+ [source,ruby]
163
+ ----
164
+ RelatonW3c::DataFetcher.fetch
165
+ Started at: 2021-11-19 13:32:05 +0100
166
+ Stopped at: 2021-11-19 13:34:40 +0100
167
+ Done in: 155 sec.
168
+ => nil
169
+ ----
170
+
144
171
  == Development
145
172
 
146
173
  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.