simple_bioc 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +13 -0
- data/html/BioCMerger.html +748 -0
- data/html/BioCReader.html +138 -146
- data/html/BioCWriter.html +84 -131
- data/html/README_md.html +79 -100
- data/html/SimpleBioC/Annotation.html +70 -113
- data/html/SimpleBioC/Collection.html +70 -113
- data/html/SimpleBioC/Document.html +76 -119
- data/html/SimpleBioC/Location.html +70 -113
- data/html/SimpleBioC/Node.html +72 -115
- data/html/SimpleBioC/NodeBase.html +63 -108
- data/html/SimpleBioC/Passage.html +74 -117
- data/html/SimpleBioC/Relation.html +85 -115
- data/html/SimpleBioC/Sentence.html +74 -117
- data/html/SimpleBioC.html +221 -129
- data/html/created.rid +16 -15
- data/html/css/fonts.css +167 -0
- data/html/css/rdoc.css +590 -0
- data/html/fonts/Lato-Light.ttf +0 -0
- data/html/fonts/Lato-LightItalic.ttf +0 -0
- data/html/fonts/Lato-Regular.ttf +0 -0
- data/html/fonts/Lato-RegularItalic.ttf +0 -0
- data/html/fonts/SourceCodePro-Bold.ttf +0 -0
- data/html/fonts/SourceCodePro-Regular.ttf +0 -0
- data/html/index.html +71 -53
- data/html/js/darkfish.js +32 -26
- data/html/js/jquery.js +4 -18
- data/html/js/navigation.js.gz +0 -0
- data/html/js/search.js +20 -5
- data/html/js/search_index.js +1 -1
- data/html/js/search_index.js.gz +0 -0
- data/html/js/searcher.js.gz +0 -0
- data/html/table_of_contents.html +379 -136
- data/lib/simple_bioc/bioc_merger.rb +209 -0
- data/lib/simple_bioc/relation.rb +1 -1
- data/lib/simple_bioc/version.rb +1 -1
- data/lib/simple_bioc.rb +8 -4
- data/spec/file_check_spec.rb +14 -1
- data/xml/PMC2133144.xml +3 -0
- data/xml/merge/9864355.xml +1 -0
- data/xml/merge/9864355_1.xml +1 -0
- data/xml/merge/9864355_2.xml +1974 -0
- data/xml/merge/9864355_3.xml +1 -0
- data/xml/merge/output.xml +6742 -0
- metadata +21 -2
data/html/BioCReader.html
CHANGED
|
@@ -2,70 +2,66 @@
|
|
|
2
2
|
|
|
3
3
|
<html>
|
|
4
4
|
<head>
|
|
5
|
-
<meta
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
6
|
|
|
7
7
|
<title>module BioCReader - RDoc Documentation</title>
|
|
8
8
|
|
|
9
|
-
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
|
|
10
|
-
|
|
11
9
|
<script type="text/javascript">
|
|
12
10
|
var rdoc_rel_prefix = "./";
|
|
13
11
|
</script>
|
|
14
12
|
|
|
15
|
-
<script
|
|
16
|
-
<script
|
|
17
|
-
|
|
18
|
-
<
|
|
19
|
-
<
|
|
20
|
-
|
|
13
|
+
<script src="./js/jquery.js"></script>
|
|
14
|
+
<script src="./js/darkfish.js"></script>
|
|
15
|
+
|
|
16
|
+
<link href="./css/fonts.css" rel="stylesheet">
|
|
17
|
+
<link href="./css/rdoc.css" rel="stylesheet">
|
|
18
|
+
|
|
21
19
|
|
|
22
20
|
|
|
23
|
-
<body id="top" class="module">
|
|
24
|
-
<nav
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
<body id="top" role="document" class="module">
|
|
22
|
+
<nav role="navigation">
|
|
23
|
+
<div id="project-navigation">
|
|
24
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
|
25
|
+
<h2>
|
|
26
|
+
<a href="./index.html" rel="home">Home</a>
|
|
27
|
+
</h2>
|
|
28
|
+
|
|
29
|
+
<div id="table-of-contents-navigation">
|
|
30
|
+
<a href="./table_of_contents.html#pages">Pages</a>
|
|
28
31
|
<a href="./table_of_contents.html#classes">Classes</a>
|
|
29
32
|
<a href="./table_of_contents.html#methods">Methods</a>
|
|
30
|
-
</
|
|
31
|
-
</
|
|
32
|
-
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
|
35
37
|
<form action="#" method="get" accept-charset="utf-8">
|
|
36
|
-
<
|
|
37
|
-
<input
|
|
38
|
+
<div id="search-field-wrapper">
|
|
39
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
|
40
|
+
aria-autocomplete="list" aria-controls="search-results"
|
|
41
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
|
38
42
|
title="Type to search, Up and Down to navigate, Enter to load">
|
|
39
|
-
</
|
|
40
|
-
</form>
|
|
43
|
+
</div>
|
|
41
44
|
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
<ul id="search-results" aria-label="Search Results"
|
|
46
|
+
aria-busy="false" aria-expanded="false"
|
|
47
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
|
48
|
+
</form>
|
|
49
|
+
</div>
|
|
44
50
|
|
|
51
|
+
</div>
|
|
45
52
|
|
|
46
53
|
|
|
47
54
|
|
|
48
|
-
<div id="file-metadata">
|
|
49
|
-
<nav id="file-list-section" class="section">
|
|
50
|
-
<h3 class="section-header">Defined In</h3>
|
|
51
|
-
<ul>
|
|
52
|
-
<li>lib/simple_bioc/bioc_reader.rb
|
|
53
|
-
</ul>
|
|
54
|
-
</nav>
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
</div>
|
|
58
|
-
|
|
59
55
|
<div id="class-metadata">
|
|
60
56
|
|
|
61
57
|
|
|
62
58
|
|
|
63
59
|
|
|
64
60
|
<!-- Method Quickref -->
|
|
65
|
-
<
|
|
66
|
-
<h3
|
|
61
|
+
<div id="method-list-section" class="nav-section">
|
|
62
|
+
<h3>Methods</h3>
|
|
67
63
|
|
|
68
|
-
<ul class="link-list">
|
|
64
|
+
<ul class="link-list" role="directory">
|
|
69
65
|
|
|
70
66
|
<li ><a href="#method-i-read">#read</a>
|
|
71
67
|
|
|
@@ -75,6 +71,8 @@
|
|
|
75
71
|
|
|
76
72
|
<li ><a href="#method-i-read_document">#read_document</a>
|
|
77
73
|
|
|
74
|
+
<li ><a href="#method-i-read_from_file_or_string">#read_from_file_or_string</a>
|
|
75
|
+
|
|
78
76
|
<li ><a href="#method-i-read_infon">#read_infon</a>
|
|
79
77
|
|
|
80
78
|
<li ><a href="#method-i-read_int">#read_int</a>
|
|
@@ -94,62 +92,19 @@
|
|
|
94
92
|
<li ><a href="#method-i-read_text">#read_text</a>
|
|
95
93
|
|
|
96
94
|
</ul>
|
|
97
|
-
</
|
|
95
|
+
</div>
|
|
98
96
|
|
|
99
97
|
</div>
|
|
100
|
-
|
|
101
|
-
<div id="project-metadata">
|
|
102
|
-
<nav id="fileindex-section" class="section project-section">
|
|
103
|
-
<h3 class="section-header">Pages</h3>
|
|
104
|
-
|
|
105
|
-
<ul>
|
|
106
|
-
|
|
107
|
-
<li class="file"><a href="./README_md.html">README</a>
|
|
108
|
-
|
|
109
|
-
</ul>
|
|
110
98
|
</nav>
|
|
111
99
|
|
|
112
|
-
|
|
113
|
-
<
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
<li><a href="./BioCReader.html">BioCReader</a>
|
|
118
|
-
|
|
119
|
-
<li><a href="./BioCWriter.html">BioCWriter</a>
|
|
120
|
-
|
|
121
|
-
<li><a href="./SimpleBioC.html">SimpleBioC</a>
|
|
122
|
-
|
|
123
|
-
<li><a href="./SimpleBioC/Annotation.html">SimpleBioC::Annotation</a>
|
|
124
|
-
|
|
125
|
-
<li><a href="./SimpleBioC/Collection.html">SimpleBioC::Collection</a>
|
|
126
|
-
|
|
127
|
-
<li><a href="./SimpleBioC/Document.html">SimpleBioC::Document</a>
|
|
128
|
-
|
|
129
|
-
<li><a href="./SimpleBioC/Location.html">SimpleBioC::Location</a>
|
|
130
|
-
|
|
131
|
-
<li><a href="./SimpleBioC/Node.html">SimpleBioC::Node</a>
|
|
132
|
-
|
|
133
|
-
<li><a href="./SimpleBioC/NodeBase.html">SimpleBioC::NodeBase</a>
|
|
134
|
-
|
|
135
|
-
<li><a href="./SimpleBioC/Passage.html">SimpleBioC::Passage</a>
|
|
136
|
-
|
|
137
|
-
<li><a href="./SimpleBioC/Relation.html">SimpleBioC::Relation</a>
|
|
138
|
-
|
|
139
|
-
<li><a href="./SimpleBioC/Sentence.html">SimpleBioC::Sentence</a>
|
|
140
|
-
|
|
141
|
-
</ul>
|
|
142
|
-
</nav>
|
|
100
|
+
<main role="main" aria-labelledby="module-BioCReader">
|
|
101
|
+
<h1 id="module-BioCReader" class="module">
|
|
102
|
+
module BioCReader
|
|
103
|
+
</h1>
|
|
143
104
|
|
|
144
|
-
|
|
145
|
-
</nav>
|
|
146
|
-
|
|
147
|
-
<div id="documentation">
|
|
148
|
-
<h1 class="module">module BioCReader</h1>
|
|
149
|
-
|
|
150
|
-
<div id="description" class="description">
|
|
105
|
+
<section class="description">
|
|
151
106
|
|
|
152
|
-
</
|
|
107
|
+
</section>
|
|
153
108
|
|
|
154
109
|
|
|
155
110
|
|
|
@@ -163,10 +118,11 @@
|
|
|
163
118
|
|
|
164
119
|
|
|
165
120
|
|
|
166
|
-
<!-- Methods -->
|
|
167
121
|
|
|
168
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section
|
|
169
|
-
|
|
122
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
|
123
|
+
<header>
|
|
124
|
+
<h3>Public Instance Methods</h3>
|
|
125
|
+
</header>
|
|
170
126
|
|
|
171
127
|
|
|
172
128
|
<div id="method-i-read" class="method-detail ">
|
|
@@ -192,27 +148,19 @@
|
|
|
192
148
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">read</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">options</span>)
|
|
193
149
|
<span class="ruby-identifier">collection</span> = <span class="ruby-keyword">nil</span>
|
|
194
150
|
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">path</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
|
|
195
|
-
<span class="ruby-identifier">
|
|
196
|
-
<span class="ruby-identifier">config</span>.<span class="ruby-identifier">noent</span>.<span class="ruby-identifier">strict</span>.<span class="ruby-identifier">noblanks</span>
|
|
197
|
-
<span class="ruby-keyword">end</span>
|
|
198
|
-
<span class="ruby-identifier">xml</span> = <span class="ruby-identifier">xml_doc</span>.<span class="ruby-identifier">at_xpath</span>(<span class="ruby-string">"//collection"</span>)
|
|
199
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">xml</span>.<span class="ruby-identifier">nil?</span>
|
|
200
|
-
<span class="ruby-identifier">fail</span> <span class="ruby-string">'Wrong format'</span>
|
|
201
|
-
<span class="ruby-keyword">end</span>
|
|
202
|
-
<span class="ruby-identifier">collection</span> = <span class="ruby-constant">SimpleBioC</span><span class="ruby-operator">::</span><span class="ruby-constant">Collection</span>.<span class="ruby-identifier">new</span>
|
|
203
|
-
<span class="ruby-identifier">read_collection</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">collection</span>, <span class="ruby-identifier">options</span>)
|
|
151
|
+
<span class="ruby-identifier">collection</span> = <span class="ruby-identifier">read_from_file_or_string</span>(<span class="ruby-identifier">file</span>, <span class="ruby-identifier">options</span>)
|
|
204
152
|
<span class="ruby-keyword">end</span>
|
|
205
153
|
|
|
206
154
|
<span class="ruby-identifier">collection</span>
|
|
207
155
|
<span class="ruby-keyword">end</span></pre>
|
|
208
|
-
</div
|
|
156
|
+
</div>
|
|
209
157
|
|
|
210
158
|
</div>
|
|
211
159
|
|
|
212
160
|
|
|
213
161
|
|
|
214
162
|
|
|
215
|
-
</div
|
|
163
|
+
</div>
|
|
216
164
|
|
|
217
165
|
|
|
218
166
|
<div id="method-i-read_annotation" class="method-detail ">
|
|
@@ -234,7 +182,7 @@
|
|
|
234
182
|
|
|
235
183
|
|
|
236
184
|
<div class="method-source-code" id="read_annotation-source">
|
|
237
|
-
<pre><span class="ruby-comment"># File lib/simple_bioc/bioc_reader.rb, line
|
|
185
|
+
<pre><span class="ruby-comment"># File lib/simple_bioc/bioc_reader.rb, line 94</span>
|
|
238
186
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">read_annotation</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">annotation</span>, <span class="ruby-identifier">options</span> = {})
|
|
239
187
|
<span class="ruby-identifier">annotation</span>.<span class="ruby-identifier">id</span> = <span class="ruby-identifier">xml</span>[<span class="ruby-string">"id"</span>]
|
|
240
188
|
<span class="ruby-identifier">annotation</span>.<span class="ruby-identifier">text</span> = <span class="ruby-identifier">read_text</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-string">"text"</span>)
|
|
@@ -242,14 +190,14 @@
|
|
|
242
190
|
<span class="ruby-identifier">read_recursive</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">annotation</span>, <span class="ruby-string">"location"</span>)
|
|
243
191
|
<span class="ruby-keyword">true</span>
|
|
244
192
|
<span class="ruby-keyword">end</span></pre>
|
|
245
|
-
</div
|
|
193
|
+
</div>
|
|
246
194
|
|
|
247
195
|
</div>
|
|
248
196
|
|
|
249
197
|
|
|
250
198
|
|
|
251
199
|
|
|
252
|
-
</div
|
|
200
|
+
</div>
|
|
253
201
|
|
|
254
202
|
|
|
255
203
|
<div id="method-i-read_collection" class="method-detail ">
|
|
@@ -271,7 +219,7 @@
|
|
|
271
219
|
|
|
272
220
|
|
|
273
221
|
<div class="method-source-code" id="read_collection-source">
|
|
274
|
-
<pre><span class="ruby-comment"># File lib/simple_bioc/bioc_reader.rb, line
|
|
222
|
+
<pre><span class="ruby-comment"># File lib/simple_bioc/bioc_reader.rb, line 55</span>
|
|
275
223
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">read_collection</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">collection</span>, <span class="ruby-identifier">options</span> = {})
|
|
276
224
|
<span class="ruby-identifier">collection</span>.<span class="ruby-identifier">source</span> = <span class="ruby-identifier">read_text</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-string">"source"</span>)
|
|
277
225
|
<span class="ruby-identifier">collection</span>.<span class="ruby-identifier">date</span> = <span class="ruby-identifier">read_text</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-string">"date"</span>)
|
|
@@ -279,14 +227,14 @@
|
|
|
279
227
|
<span class="ruby-identifier">read_infon</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">collection</span>)
|
|
280
228
|
<span class="ruby-identifier">read_recursive</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">collection</span>, <span class="ruby-string">"document"</span>, <span class="ruby-identifier">options</span>)
|
|
281
229
|
<span class="ruby-keyword">end</span></pre>
|
|
282
|
-
</div
|
|
230
|
+
</div>
|
|
283
231
|
|
|
284
232
|
</div>
|
|
285
233
|
|
|
286
234
|
|
|
287
235
|
|
|
288
236
|
|
|
289
|
-
</div
|
|
237
|
+
</div>
|
|
290
238
|
|
|
291
239
|
|
|
292
240
|
<div id="method-i-read_document" class="method-detail ">
|
|
@@ -308,7 +256,7 @@
|
|
|
308
256
|
|
|
309
257
|
|
|
310
258
|
<div class="method-source-code" id="read_document-source">
|
|
311
|
-
<pre><span class="ruby-comment"># File lib/simple_bioc/bioc_reader.rb, line
|
|
259
|
+
<pre><span class="ruby-comment"># File lib/simple_bioc/bioc_reader.rb, line 63</span>
|
|
312
260
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">read_document</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">document</span>, <span class="ruby-identifier">options</span> = {})
|
|
313
261
|
<span class="ruby-identifier">document</span>.<span class="ruby-identifier">id</span> = <span class="ruby-identifier">read_text</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-string">"id"</span>)
|
|
314
262
|
<span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:documents</span>].<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Array</span>) <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">options</span>[<span class="ruby-value">:documents</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">document</span>.<span class="ruby-identifier">id</span>)
|
|
@@ -320,14 +268,59 @@
|
|
|
320
268
|
<span class="ruby-identifier">document</span>.<span class="ruby-identifier">adjust_ref</span>
|
|
321
269
|
<span class="ruby-keyword">true</span>
|
|
322
270
|
<span class="ruby-keyword">end</span></pre>
|
|
323
|
-
</div
|
|
271
|
+
</div>
|
|
324
272
|
|
|
325
273
|
</div>
|
|
326
274
|
|
|
327
275
|
|
|
328
276
|
|
|
329
277
|
|
|
330
|
-
</div
|
|
278
|
+
</div>
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
<div id="method-i-read_from_file_or_string" class="method-detail ">
|
|
282
|
+
|
|
283
|
+
<div class="method-heading">
|
|
284
|
+
<span class="method-name">read_from_file_or_string</span><span
|
|
285
|
+
class="method-args">(file_or_string, options)</span>
|
|
286
|
+
|
|
287
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
288
|
+
|
|
289
|
+
</div>
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
<div class="method-description">
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
<div class="method-source-code" id="read_from_file_or_string-source">
|
|
300
|
+
<pre><span class="ruby-comment"># File lib/simple_bioc/bioc_reader.rb, line 16</span>
|
|
301
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">read_from_file_or_string</span>(<span class="ruby-identifier">file_or_string</span>, <span class="ruby-identifier">options</span>)
|
|
302
|
+
<span class="ruby-identifier">collection</span> = <span class="ruby-keyword">nil</span>
|
|
303
|
+
|
|
304
|
+
<span class="ruby-identifier">xml_doc</span> = <span class="ruby-constant">Nokogiri</span><span class="ruby-operator">::</span><span class="ruby-constant">XML</span>(<span class="ruby-identifier">file_or_string</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">config</span><span class="ruby-operator">|</span>
|
|
305
|
+
<span class="ruby-identifier">config</span>.<span class="ruby-identifier">noent</span>.<span class="ruby-identifier">strict</span>.<span class="ruby-identifier">noblanks</span>
|
|
306
|
+
<span class="ruby-keyword">end</span>
|
|
307
|
+
<span class="ruby-identifier">xml</span> = <span class="ruby-identifier">xml_doc</span>.<span class="ruby-identifier">at_xpath</span>(<span class="ruby-string">"//collection"</span>)
|
|
308
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">xml</span>.<span class="ruby-identifier">nil?</span>
|
|
309
|
+
<span class="ruby-identifier">fail</span> <span class="ruby-string">'Wrong format'</span>
|
|
310
|
+
<span class="ruby-keyword">end</span>
|
|
311
|
+
<span class="ruby-identifier">collection</span> = <span class="ruby-constant">SimpleBioC</span><span class="ruby-operator">::</span><span class="ruby-constant">Collection</span>.<span class="ruby-identifier">new</span>
|
|
312
|
+
<span class="ruby-identifier">read_collection</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">collection</span>, <span class="ruby-identifier">options</span>)
|
|
313
|
+
|
|
314
|
+
<span class="ruby-identifier">collection</span>
|
|
315
|
+
<span class="ruby-keyword">end</span></pre>
|
|
316
|
+
</div>
|
|
317
|
+
|
|
318
|
+
</div>
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
</div>
|
|
331
324
|
|
|
332
325
|
|
|
333
326
|
<div id="method-i-read_infon" class="method-detail ">
|
|
@@ -349,18 +342,18 @@
|
|
|
349
342
|
|
|
350
343
|
|
|
351
344
|
<div class="method-source-code" id="read_infon-source">
|
|
352
|
-
<pre><span class="ruby-comment"># File lib/simple_bioc/bioc_reader.rb, line
|
|
345
|
+
<pre><span class="ruby-comment"># File lib/simple_bioc/bioc_reader.rb, line 42</span>
|
|
353
346
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">read_infon</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">obj</span>)
|
|
354
347
|
<span class="ruby-identifier">xml</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-string">"infon"</span>).<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">infons</span>[<span class="ruby-identifier">i</span>[<span class="ruby-string">"key"</span>]] = <span class="ruby-identifier">i</span>.<span class="ruby-identifier">content</span>}
|
|
355
348
|
<span class="ruby-keyword">end</span></pre>
|
|
356
|
-
</div
|
|
349
|
+
</div>
|
|
357
350
|
|
|
358
351
|
</div>
|
|
359
352
|
|
|
360
353
|
|
|
361
354
|
|
|
362
355
|
|
|
363
|
-
</div
|
|
356
|
+
</div>
|
|
364
357
|
|
|
365
358
|
|
|
366
359
|
<div id="method-i-read_int" class="method-detail ">
|
|
@@ -382,19 +375,19 @@
|
|
|
382
375
|
|
|
383
376
|
|
|
384
377
|
<div class="method-source-code" id="read_int-source">
|
|
385
|
-
<pre><span class="ruby-comment"># File lib/simple_bioc/bioc_reader.rb, line
|
|
378
|
+
<pre><span class="ruby-comment"># File lib/simple_bioc/bioc_reader.rb, line 37</span>
|
|
386
379
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">read_int</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">name</span>)
|
|
387
380
|
<span class="ruby-identifier">val</span> = <span class="ruby-identifier">read_text</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">name</span>)
|
|
388
381
|
<span class="ruby-identifier">val</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">to_i</span>
|
|
389
382
|
<span class="ruby-keyword">end</span></pre>
|
|
390
|
-
</div
|
|
383
|
+
</div>
|
|
391
384
|
|
|
392
385
|
</div>
|
|
393
386
|
|
|
394
387
|
|
|
395
388
|
|
|
396
389
|
|
|
397
|
-
</div
|
|
390
|
+
</div>
|
|
398
391
|
|
|
399
392
|
|
|
400
393
|
<div id="method-i-read_location" class="method-detail ">
|
|
@@ -416,20 +409,20 @@
|
|
|
416
409
|
|
|
417
410
|
|
|
418
411
|
<div class="method-source-code" id="read_location-source">
|
|
419
|
-
<pre><span class="ruby-comment"># File lib/simple_bioc/bioc_reader.rb, line
|
|
412
|
+
<pre><span class="ruby-comment"># File lib/simple_bioc/bioc_reader.rb, line 109</span>
|
|
420
413
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">read_location</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">location</span>, <span class="ruby-identifier">options</span> = {})
|
|
421
414
|
<span class="ruby-identifier">location</span>.<span class="ruby-identifier">offset</span> = <span class="ruby-identifier">xml</span>[<span class="ruby-string">"offset"</span>]
|
|
422
415
|
<span class="ruby-identifier">location</span>.<span class="ruby-identifier">length</span> = <span class="ruby-identifier">xml</span>[<span class="ruby-string">"length"</span>]
|
|
423
416
|
<span class="ruby-keyword">true</span>
|
|
424
417
|
<span class="ruby-keyword">end</span></pre>
|
|
425
|
-
</div
|
|
418
|
+
</div>
|
|
426
419
|
|
|
427
420
|
</div>
|
|
428
421
|
|
|
429
422
|
|
|
430
423
|
|
|
431
424
|
|
|
432
|
-
</div
|
|
425
|
+
</div>
|
|
433
426
|
|
|
434
427
|
|
|
435
428
|
<div id="method-i-read_node" class="method-detail ">
|
|
@@ -451,20 +444,20 @@
|
|
|
451
444
|
|
|
452
445
|
|
|
453
446
|
<div class="method-source-code" id="read_node-source">
|
|
454
|
-
<pre><span class="ruby-comment"># File lib/simple_bioc/bioc_reader.rb, line
|
|
447
|
+
<pre><span class="ruby-comment"># File lib/simple_bioc/bioc_reader.rb, line 115</span>
|
|
455
448
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">read_node</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">node</span>, <span class="ruby-identifier">options</span> = {})
|
|
456
449
|
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">refid</span> = <span class="ruby-identifier">xml</span>[<span class="ruby-string">"refid"</span>]
|
|
457
450
|
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">role</span> = <span class="ruby-identifier">xml</span>[<span class="ruby-string">"role"</span>]
|
|
458
451
|
<span class="ruby-keyword">true</span>
|
|
459
452
|
<span class="ruby-keyword">end</span></pre>
|
|
460
|
-
</div
|
|
453
|
+
</div>
|
|
461
454
|
|
|
462
455
|
</div>
|
|
463
456
|
|
|
464
457
|
|
|
465
458
|
|
|
466
459
|
|
|
467
|
-
</div
|
|
460
|
+
</div>
|
|
468
461
|
|
|
469
462
|
|
|
470
463
|
<div id="method-i-read_passage" class="method-detail ">
|
|
@@ -486,7 +479,7 @@
|
|
|
486
479
|
|
|
487
480
|
|
|
488
481
|
<div class="method-source-code" id="read_passage-source">
|
|
489
|
-
<pre><span class="ruby-comment"># File lib/simple_bioc/bioc_reader.rb, line
|
|
482
|
+
<pre><span class="ruby-comment"># File lib/simple_bioc/bioc_reader.rb, line 75</span>
|
|
490
483
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">read_passage</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">passage</span>, <span class="ruby-identifier">options</span> = {})
|
|
491
484
|
<span class="ruby-identifier">passage</span>.<span class="ruby-identifier">text</span> = <span class="ruby-identifier">read_text</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-string">"text"</span>)
|
|
492
485
|
<span class="ruby-identifier">passage</span>.<span class="ruby-identifier">offset</span> = <span class="ruby-identifier">read_int</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-string">"offset"</span>)
|
|
@@ -496,14 +489,14 @@
|
|
|
496
489
|
<span class="ruby-identifier">read_recursive</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">passage</span>, <span class="ruby-string">"relation"</span>)
|
|
497
490
|
<span class="ruby-keyword">true</span>
|
|
498
491
|
<span class="ruby-keyword">end</span></pre>
|
|
499
|
-
</div
|
|
492
|
+
</div>
|
|
500
493
|
|
|
501
494
|
</div>
|
|
502
495
|
|
|
503
496
|
|
|
504
497
|
|
|
505
498
|
|
|
506
|
-
</div
|
|
499
|
+
</div>
|
|
507
500
|
|
|
508
501
|
|
|
509
502
|
<div id="method-i-read_recursive" class="method-detail ">
|
|
@@ -525,7 +518,7 @@
|
|
|
525
518
|
|
|
526
519
|
|
|
527
520
|
<div class="method-source-code" id="read_recursive-source">
|
|
528
|
-
<pre><span class="ruby-comment"># File lib/simple_bioc/bioc_reader.rb, line
|
|
521
|
+
<pre><span class="ruby-comment"># File lib/simple_bioc/bioc_reader.rb, line 46</span>
|
|
529
522
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">read_recursive</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">obj</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span> = {})
|
|
530
523
|
<span class="ruby-identifier">target_class</span> = <span class="ruby-constant">SimpleBioC</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">name</span>.<span class="ruby-identifier">capitalize</span>)
|
|
531
524
|
<span class="ruby-identifier">xml</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-identifier">name</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">node</span><span class="ruby-operator">|</span>
|
|
@@ -534,14 +527,14 @@
|
|
|
534
527
|
<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-value">:"@#{name}s"</span>) <span class="ruby-operator"><<</span> <span class="ruby-identifier">instance</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">ret</span>
|
|
535
528
|
<span class="ruby-keyword">end</span>
|
|
536
529
|
<span class="ruby-keyword">end</span></pre>
|
|
537
|
-
</div
|
|
530
|
+
</div>
|
|
538
531
|
|
|
539
532
|
</div>
|
|
540
533
|
|
|
541
534
|
|
|
542
535
|
|
|
543
536
|
|
|
544
|
-
</div
|
|
537
|
+
</div>
|
|
545
538
|
|
|
546
539
|
|
|
547
540
|
<div id="method-i-read_relation" class="method-detail ">
|
|
@@ -563,21 +556,21 @@
|
|
|
563
556
|
|
|
564
557
|
|
|
565
558
|
<div class="method-source-code" id="read_relation-source">
|
|
566
|
-
<pre><span class="ruby-comment"># File lib/simple_bioc/bioc_reader.rb, line
|
|
559
|
+
<pre><span class="ruby-comment"># File lib/simple_bioc/bioc_reader.rb, line 102</span>
|
|
567
560
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">read_relation</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">relation</span>, <span class="ruby-identifier">options</span> = {})
|
|
568
561
|
<span class="ruby-identifier">relation</span>.<span class="ruby-identifier">id</span> = <span class="ruby-identifier">xml</span>[<span class="ruby-string">"id"</span>]
|
|
569
562
|
<span class="ruby-identifier">read_infon</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">relation</span>)
|
|
570
563
|
<span class="ruby-identifier">read_recursive</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">relation</span>, <span class="ruby-string">"node"</span>)
|
|
571
564
|
<span class="ruby-keyword">true</span>
|
|
572
565
|
<span class="ruby-keyword">end</span></pre>
|
|
573
|
-
</div
|
|
566
|
+
</div>
|
|
574
567
|
|
|
575
568
|
</div>
|
|
576
569
|
|
|
577
570
|
|
|
578
571
|
|
|
579
572
|
|
|
580
|
-
</div
|
|
573
|
+
</div>
|
|
581
574
|
|
|
582
575
|
|
|
583
576
|
<div id="method-i-read_sentence" class="method-detail ">
|
|
@@ -599,7 +592,7 @@
|
|
|
599
592
|
|
|
600
593
|
|
|
601
594
|
<div class="method-source-code" id="read_sentence-source">
|
|
602
|
-
<pre><span class="ruby-comment"># File lib/simple_bioc/bioc_reader.rb, line
|
|
595
|
+
<pre><span class="ruby-comment"># File lib/simple_bioc/bioc_reader.rb, line 85</span>
|
|
603
596
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">read_sentence</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">sentence</span>, <span class="ruby-identifier">options</span> = {})
|
|
604
597
|
<span class="ruby-identifier">sentence</span>.<span class="ruby-identifier">text</span> = <span class="ruby-identifier">read_text</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-string">"text"</span>)
|
|
605
598
|
<span class="ruby-identifier">sentence</span>.<span class="ruby-identifier">offset</span> = <span class="ruby-identifier">read_int</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-string">"offset"</span>)
|
|
@@ -608,14 +601,14 @@
|
|
|
608
601
|
<span class="ruby-identifier">read_recursive</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">sentence</span>, <span class="ruby-string">"relation"</span>)
|
|
609
602
|
<span class="ruby-keyword">true</span>
|
|
610
603
|
<span class="ruby-keyword">end</span></pre>
|
|
611
|
-
</div
|
|
604
|
+
</div>
|
|
612
605
|
|
|
613
606
|
</div>
|
|
614
607
|
|
|
615
608
|
|
|
616
609
|
|
|
617
610
|
|
|
618
|
-
</div
|
|
611
|
+
</div>
|
|
619
612
|
|
|
620
613
|
|
|
621
614
|
<div id="method-i-read_text" class="method-detail ">
|
|
@@ -637,31 +630,30 @@
|
|
|
637
630
|
|
|
638
631
|
|
|
639
632
|
<div class="method-source-code" id="read_text-source">
|
|
640
|
-
<pre><span class="ruby-comment"># File lib/simple_bioc/bioc_reader.rb, line
|
|
633
|
+
<pre><span class="ruby-comment"># File lib/simple_bioc/bioc_reader.rb, line 32</span>
|
|
641
634
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">read_text</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">name</span>)
|
|
642
635
|
<span class="ruby-identifier">node</span> = <span class="ruby-identifier">xml</span>.<span class="ruby-identifier">at_xpath</span>(<span class="ruby-identifier">name</span>)
|
|
643
636
|
<span class="ruby-identifier">node</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">content</span>
|
|
644
637
|
<span class="ruby-keyword">end</span></pre>
|
|
645
|
-
</div
|
|
638
|
+
</div>
|
|
646
639
|
|
|
647
640
|
</div>
|
|
648
641
|
|
|
649
642
|
|
|
650
643
|
|
|
651
644
|
|
|
652
|
-
</div
|
|
645
|
+
</div>
|
|
653
646
|
|
|
654
647
|
|
|
655
|
-
</section
|
|
648
|
+
</section>
|
|
656
649
|
|
|
657
|
-
</section
|
|
658
|
-
|
|
659
|
-
</div><!-- documentation -->
|
|
650
|
+
</section>
|
|
651
|
+
</main>
|
|
660
652
|
|
|
661
653
|
|
|
662
|
-
<footer id="validator-badges">
|
|
663
|
-
<p><a href="http://validator.w3.org/check/referer">
|
|
664
|
-
<p>Generated by <a href="
|
|
665
|
-
<p>
|
|
654
|
+
<footer id="validator-badges" role="contentinfo">
|
|
655
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
|
656
|
+
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
|
|
657
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
|
666
658
|
</footer>
|
|
667
659
|
|