pho 0.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. data/CHANGES +9 -0
  2. data/Rakefile +2 -1
  3. data/bin/talis_store +263 -0
  4. data/doc/rdoc/classes/Pho.html +3 -21
  5. data/doc/rdoc/classes/Pho/Analyzers.html +22 -0
  6. data/doc/rdoc/classes/Pho/DatatypeProperty.html +42 -10
  7. data/doc/rdoc/classes/Pho/Etags.html +102 -30
  8. data/doc/rdoc/classes/Pho/Facet/Results.html +81 -7
  9. data/doc/rdoc/classes/Pho/Facet/Term.html +13 -2
  10. data/doc/rdoc/classes/Pho/FieldPredicateMap.html +233 -30
  11. data/doc/rdoc/classes/Pho/FieldWeighting.html +38 -10
  12. data/doc/rdoc/classes/Pho/Job.html +488 -9
  13. data/doc/rdoc/classes/Pho/JobUpdate.html +141 -0
  14. data/doc/rdoc/classes/Pho/Jobs.html +538 -0
  15. data/doc/rdoc/classes/Pho/Namespaces.html +33 -2
  16. data/doc/rdoc/classes/Pho/QueryProfile.html +162 -20
  17. data/doc/rdoc/classes/Pho/RDFCollection.html +200 -60
  18. data/doc/rdoc/classes/Pho/Snapshot.html +162 -36
  19. data/doc/rdoc/classes/Pho/Status.html +59 -8
  20. data/doc/rdoc/classes/Pho/Store.html +589 -253
  21. data/doc/rdoc/created.rid +1 -1
  22. data/doc/rdoc/files/CHANGES.html +24 -1
  23. data/doc/rdoc/files/lib/pho/field_predicate_map_rb.html +1 -1
  24. data/doc/rdoc/files/lib/pho/job_rb.html +1 -1
  25. data/doc/rdoc/files/lib/pho/snapshot_rb.html +2 -1
  26. data/doc/rdoc/files/lib/pho/status_rb.html +1 -1
  27. data/doc/rdoc/files/lib/pho/store_rb.html +1 -1
  28. data/doc/rdoc/files/lib/pho_rb.html +2 -1
  29. data/doc/rdoc/fr_class_index.html +2 -0
  30. data/doc/rdoc/fr_method_index.html +85 -68
  31. data/lib/pho.rb +18 -10
  32. data/lib/pho/field_predicate_map.rb +6 -1
  33. data/lib/pho/job.rb +326 -6
  34. data/lib/pho/snapshot.rb +46 -19
  35. data/lib/pho/store.rb +22 -56
  36. data/tests/tc_job.rb +262 -0
  37. data/tests/tc_jobcontrol.rb +159 -12
  38. data/tests/tc_snapshots.rb +57 -28
  39. data/tests/ts_pho.rb +1 -0
  40. metadata +9 -110
  41. data/doc/rdoc/classes/Pho/DatatypeProperty.src/M000034.html +0 -21
  42. data/doc/rdoc/classes/Pho/DatatypeProperty.src/M000035.html +0 -29
  43. data/doc/rdoc/classes/Pho/Etags.src/M000088.html +0 -23
  44. data/doc/rdoc/classes/Pho/Etags.src/M000089.html +0 -28
  45. data/doc/rdoc/classes/Pho/Etags.src/M000090.html +0 -21
  46. data/doc/rdoc/classes/Pho/Etags.src/M000091.html +0 -18
  47. data/doc/rdoc/classes/Pho/Etags.src/M000092.html +0 -18
  48. data/doc/rdoc/classes/Pho/Etags.src/M000093.html +0 -18
  49. data/doc/rdoc/classes/Pho/Facet/Results.src/M000001.html +0 -20
  50. data/doc/rdoc/classes/Pho/Facet/Results.src/M000002.html +0 -27
  51. data/doc/rdoc/classes/Pho/Facet/Results.src/M000003.html +0 -54
  52. data/doc/rdoc/classes/Pho/Facet/Term.src/M000004.html +0 -20
  53. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000005.html +0 -38
  54. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000006.html +0 -28
  55. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000007.html +0 -20
  56. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000008.html +0 -18
  57. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000009.html +0 -23
  58. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000010.html +0 -23
  59. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000011.html +0 -18
  60. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000012.html +0 -18
  61. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000013.html +0 -18
  62. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000014.html +0 -18
  63. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000015.html +0 -18
  64. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000016.html +0 -21
  65. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000017.html +0 -21
  66. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000018.html +0 -38
  67. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000019.html +0 -18
  68. data/doc/rdoc/classes/Pho/FieldWeighting.src/M000075.html +0 -20
  69. data/doc/rdoc/classes/Pho/FieldWeighting.src/M000076.html +0 -26
  70. data/doc/rdoc/classes/Pho/Job.src/M000074.html +0 -21
  71. data/doc/rdoc/classes/Pho/QueryProfile.src/M000024.html +0 -39
  72. data/doc/rdoc/classes/Pho/QueryProfile.src/M000025.html +0 -24
  73. data/doc/rdoc/classes/Pho/QueryProfile.src/M000026.html +0 -20
  74. data/doc/rdoc/classes/Pho/QueryProfile.src/M000027.html +0 -18
  75. data/doc/rdoc/classes/Pho/QueryProfile.src/M000028.html +0 -18
  76. data/doc/rdoc/classes/Pho/QueryProfile.src/M000029.html +0 -21
  77. data/doc/rdoc/classes/Pho/QueryProfile.src/M000030.html +0 -18
  78. data/doc/rdoc/classes/Pho/QueryProfile.src/M000031.html +0 -18
  79. data/doc/rdoc/classes/Pho/QueryProfile.src/M000032.html +0 -38
  80. data/doc/rdoc/classes/Pho/QueryProfile.src/M000033.html +0 -18
  81. data/doc/rdoc/classes/Pho/RDFCollection.src/M000077.html +0 -23
  82. data/doc/rdoc/classes/Pho/RDFCollection.src/M000078.html +0 -22
  83. data/doc/rdoc/classes/Pho/RDFCollection.src/M000079.html +0 -24
  84. data/doc/rdoc/classes/Pho/RDFCollection.src/M000080.html +0 -23
  85. data/doc/rdoc/classes/Pho/RDFCollection.src/M000081.html +0 -18
  86. data/doc/rdoc/classes/Pho/RDFCollection.src/M000082.html +0 -22
  87. data/doc/rdoc/classes/Pho/RDFCollection.src/M000083.html +0 -22
  88. data/doc/rdoc/classes/Pho/RDFCollection.src/M000084.html +0 -26
  89. data/doc/rdoc/classes/Pho/RDFCollection.src/M000085.html +0 -23
  90. data/doc/rdoc/classes/Pho/RDFCollection.src/M000086.html +0 -18
  91. data/doc/rdoc/classes/Pho/RDFCollection.src/M000087.html +0 -18
  92. data/doc/rdoc/classes/Pho/Snapshot.src/M000070.html +0 -31
  93. data/doc/rdoc/classes/Pho/Snapshot.src/M000071.html +0 -21
  94. data/doc/rdoc/classes/Pho/Snapshot.src/M000072.html +0 -18
  95. data/doc/rdoc/classes/Pho/Snapshot.src/M000073.html +0 -37
  96. data/doc/rdoc/classes/Pho/Status.src/M000020.html +0 -20
  97. data/doc/rdoc/classes/Pho/Status.src/M000021.html +0 -31
  98. data/doc/rdoc/classes/Pho/Status.src/M000022.html +0 -18
  99. data/doc/rdoc/classes/Pho/Status.src/M000023.html +0 -18
  100. data/doc/rdoc/classes/Pho/Store.src/M000036.html +0 -22
  101. data/doc/rdoc/classes/Pho/Store.src/M000037.html +0 -18
  102. data/doc/rdoc/classes/Pho/Store.src/M000038.html +0 -25
  103. data/doc/rdoc/classes/Pho/Store.src/M000039.html +0 -20
  104. data/doc/rdoc/classes/Pho/Store.src/M000040.html +0 -20
  105. data/doc/rdoc/classes/Pho/Store.src/M000041.html +0 -28
  106. data/doc/rdoc/classes/Pho/Store.src/M000042.html +0 -23
  107. data/doc/rdoc/classes/Pho/Store.src/M000043.html +0 -18
  108. data/doc/rdoc/classes/Pho/Store.src/M000044.html +0 -18
  109. data/doc/rdoc/classes/Pho/Store.src/M000045.html +0 -18
  110. data/doc/rdoc/classes/Pho/Store.src/M000046.html +0 -18
  111. data/doc/rdoc/classes/Pho/Store.src/M000047.html +0 -23
  112. data/doc/rdoc/classes/Pho/Store.src/M000048.html +0 -22
  113. data/doc/rdoc/classes/Pho/Store.src/M000049.html +0 -26
  114. data/doc/rdoc/classes/Pho/Store.src/M000050.html +0 -24
  115. data/doc/rdoc/classes/Pho/Store.src/M000051.html +0 -20
  116. data/doc/rdoc/classes/Pho/Store.src/M000052.html +0 -20
  117. data/doc/rdoc/classes/Pho/Store.src/M000053.html +0 -25
  118. data/doc/rdoc/classes/Pho/Store.src/M000054.html +0 -20
  119. data/doc/rdoc/classes/Pho/Store.src/M000055.html +0 -30
  120. data/doc/rdoc/classes/Pho/Store.src/M000056.html +0 -21
  121. data/doc/rdoc/classes/Pho/Store.src/M000057.html +0 -23
  122. data/doc/rdoc/classes/Pho/Store.src/M000058.html +0 -28
  123. data/doc/rdoc/classes/Pho/Store.src/M000059.html +0 -18
  124. data/doc/rdoc/classes/Pho/Store.src/M000060.html +0 -18
  125. data/doc/rdoc/classes/Pho/Store.src/M000061.html +0 -18
  126. data/doc/rdoc/classes/Pho/Store.src/M000062.html +0 -31
  127. data/doc/rdoc/classes/Pho/Store.src/M000063.html +0 -21
  128. data/doc/rdoc/classes/Pho/Store.src/M000064.html +0 -20
  129. data/doc/rdoc/classes/Pho/Store.src/M000065.html +0 -20
  130. data/doc/rdoc/classes/Pho/Store.src/M000066.html +0 -20
  131. data/doc/rdoc/classes/Pho/Store.src/M000067.html +0 -20
  132. data/doc/rdoc/classes/Pho/Store.src/M000068.html +0 -20
  133. data/doc/rdoc/classes/Pho/Store.src/M000069.html +0 -20
@@ -80,8 +80,9 @@
80
80
 
81
81
  <div id="description">
82
82
  <p>
83
- In the Talis Platform a &quot;snapshot&quot; is an backup of the contents
84
- of a <a href="Store.html">Store</a>
83
+ In the Talis Platform a &quot;snapshot&quot; is an <a
84
+ href="Snapshot.html#M000081">backup</a> of the contents of a <a
85
+ href="Store.html">Store</a>
85
86
  </p>
86
87
  <p>
87
88
  A snapshot consists of a tar file that contains all data (contentbox and
@@ -89,8 +90,7 @@ metabox) in the store. The snapshot also contains the store configuration
89
90
  but this is encrypted and not intended for reuse.
90
91
  </p>
91
92
  <p>
92
- A snapshot can be generated (or scheduled) using the <a
93
- href="Store.html#M000061">Store.snapshot</a> method.
93
+ A snapshot can be generated (or scheduled) using the Store.snapshot method.
94
94
  </p>
95
95
 
96
96
  </div>
@@ -102,10 +102,11 @@ href="Store.html#M000061">Store.snapshot</a> method.
102
102
  <h3 class="section-bar">Methods</h3>
103
103
 
104
104
  <div class="name-list">
105
- <a href="#M000073">download</a>&nbsp;&nbsp;
106
- <a href="#M000071">new</a>&nbsp;&nbsp;
107
- <a href="#M000070">parse</a>&nbsp;&nbsp;
108
- <a href="#M000072">read_md5</a>&nbsp;&nbsp;
105
+ <a href="#M000081">backup</a>&nbsp;&nbsp;
106
+ <a href="#M000079">new</a>&nbsp;&nbsp;
107
+ <a href="#M000078">parse</a>&nbsp;&nbsp;
108
+ <a href="#M000077">read_from_store</a>&nbsp;&nbsp;
109
+ <a href="#M000080">read_md5</a>&nbsp;&nbsp;
109
110
  </div>
110
111
  </div>
111
112
 
@@ -125,6 +126,14 @@ href="Store.html#M000061">Store.snapshot</a> method.
125
126
 
126
127
  <div class="name-list">
127
128
  <table>
129
+ <tr class="top-aligned-row context-row">
130
+ <td class="context-item-name">date</td>
131
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
132
+ <td class="context-item-desc">
133
+ Date when snapshot was taken
134
+
135
+ </td>
136
+ </tr>
128
137
  <tr class="top-aligned-row context-row">
129
138
  <td class="context-item-name">md5_url</td>
130
139
  <td class="context-item-value">&nbsp;[R]&nbsp;</td>
@@ -167,84 +176,191 @@ The URL from which the snapshot can be retrieved
167
176
  <div id="methods">
168
177
  <h3 class="section-bar">Public Class methods</h3>
169
178
 
170
- <div id="method-M000071" class="method-detail">
171
- <a name="M000071"></a>
179
+ <div id="method-M000079" class="method-detail">
180
+ <a name="M000079"></a>
172
181
 
173
182
  <div class="method-heading">
174
- <a href="Snapshot.src/M000071.html" target="Code" class="method-signature"
175
- onclick="popupCode('Snapshot.src/M000071.html');return false;">
176
- <span class="method-name">new</span><span class="method-args">(url, md5_url, size, units)</span>
183
+ <a href="#M000079" class="method-signature">
184
+ <span class="method-name">new</span><span class="method-args">(url, md5_url, size, units, date)</span>
177
185
  </a>
178
186
  </div>
179
187
 
180
188
  <div class="method-description">
189
+ <p><a class="source-toggle" href="#"
190
+ onclick="toggleCode('M000079-source');return false;">[Source]</a></p>
191
+ <div class="method-source-code" id="M000079-source">
192
+ <pre>
193
+ <span class="ruby-comment cmt"># File lib/pho/snapshot.rb, line 76</span>
194
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">md5_url</span>, <span class="ruby-identifier">size</span>, <span class="ruby-identifier">units</span>, <span class="ruby-identifier">date</span>)
195
+ <span class="ruby-ivar">@url</span> = <span class="ruby-identifier">url</span>
196
+ <span class="ruby-ivar">@md5_url</span> = <span class="ruby-identifier">md5_url</span>
197
+ <span class="ruby-ivar">@size</span> = <span class="ruby-identifier">size</span>
198
+ <span class="ruby-ivar">@units</span> = <span class="ruby-identifier">units</span>
199
+ <span class="ruby-ivar">@date</span> = <span class="ruby-identifier">date</span>
200
+ <span class="ruby-keyword kw">end</span>
201
+ </pre>
202
+ </div>
181
203
  </div>
182
204
  </div>
183
205
 
184
- <div id="method-M000070" class="method-detail">
185
- <a name="M000070"></a>
206
+ <div id="method-M000078" class="method-detail">
207
+ <a name="M000078"></a>
186
208
 
187
209
  <div class="method-heading">
188
- <a href="Snapshot.src/M000070.html" target="Code" class="method-signature"
189
- onclick="popupCode('Snapshot.src/M000070.html');return false;">
190
- <span class="method-name">parse</span><span class="method-args">(resp)</span>
210
+ <a href="#M000078" class="method-signature">
211
+ <span class="method-name">parse</span><span class="method-args">(storeuri, content)</span>
191
212
  </a>
192
213
  </div>
193
214
 
194
215
  <div class="method-description">
195
216
  <p>
196
- Class method to <a href="Snapshot.html#M000070">parse</a> the HTML response
197
- from API, e.g. as produced by the <a
198
- href="Store.html#M000065">Store.get_snapshots</a> method and create a <a
199
- href="Snapshot.html#M000071">new</a> <a href="Snapshot.html">Snapshot</a>
217
+ Class method to <a href="Snapshot.html#M000078">parse</a> the RDF response
218
+ from the API, e.g. as produced by the <a
219
+ href="Store.html#M000072">Store.get_snapshots</a> method and create a <a
220
+ href="Snapshot.html#M000079">new</a> <a href="Snapshot.html">Snapshot</a>
200
221
  object. At the moment the Platform only supports single snapshot.
201
222
  </p>
202
223
  <p>
203
224
  If the response was an error, then an exception will be thrown
204
225
  </p>
205
226
  <pre>
206
- resp:: HTTP response generated by the Store.get_snapshots method
227
+ storeuri:: URI of the store
228
+ content:: response from the API
229
+ </pre>
230
+ <p><a class="source-toggle" href="#"
231
+ onclick="toggleCode('M000078-source');return false;">[Source]</a></p>
232
+ <div class="method-source-code" id="M000078-source">
233
+ <pre>
234
+ <span class="ruby-comment cmt"># File lib/pho/snapshot.rb, line 52</span>
235
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Snapshot</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">storeuri</span>, <span class="ruby-identifier">content</span>)
236
+
237
+ <span class="ruby-identifier">doc</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">Document</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">content</span>)
238
+ <span class="ruby-identifier">root</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">root</span>
239
+
240
+ <span class="ruby-identifier">store</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">XPath</span>.<span class="ruby-identifier">first</span>(<span class="ruby-identifier">root</span>, <span class="ruby-node">&quot;//*[@rdf:about='#{storeuri}']&quot;</span>, <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Namespaces</span><span class="ruby-operator">::</span><span class="ruby-constant">MAPPING</span> )
241
+ <span class="ruby-identifier">snapshot</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">XPath</span>.<span class="ruby-identifier">first</span>(<span class="ruby-identifier">store</span>, <span class="ruby-value str">&quot;bf:snapshot&quot;</span>, <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Namespaces</span><span class="ruby-operator">::</span><span class="ruby-constant">MAPPING</span>)
242
+ <span class="ruby-identifier">snapshot_url</span> = <span class="ruby-identifier">snapshot</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">&quot;rdf:resource&quot;</span>]
243
+ <span class="ruby-identifier">snapshot_el</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">XPath</span>.<span class="ruby-identifier">first</span>(<span class="ruby-identifier">root</span>, <span class="ruby-node">&quot;//*[@rdf:about='#{snapshot_url}']&quot;</span>, <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Namespaces</span><span class="ruby-operator">::</span><span class="ruby-constant">MAPPING</span> )
244
+
245
+ <span class="ruby-identifier">el</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">XPath</span>.<span class="ruby-identifier">first</span>(<span class="ruby-identifier">snapshot_el</span>, <span class="ruby-value str">&quot;bf:md5&quot;</span>, <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Namespaces</span><span class="ruby-operator">::</span><span class="ruby-constant">MAPPING</span>)
246
+ <span class="ruby-identifier">snapshot_md5_url</span> = <span class="ruby-identifier">el</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">&quot;rdf:resource&quot;</span>]
247
+
248
+ <span class="ruby-identifier">el</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">XPath</span>.<span class="ruby-identifier">first</span>(<span class="ruby-identifier">snapshot_el</span>, <span class="ruby-value str">&quot;bf:filesize&quot;</span>, <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Namespaces</span><span class="ruby-operator">::</span><span class="ruby-constant">MAPPING</span>)
249
+ <span class="ruby-identifier">snapshot_size</span> = <span class="ruby-identifier">el</span>.<span class="ruby-identifier">text</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot; &quot;</span>)[<span class="ruby-value">0</span>]
250
+ <span class="ruby-identifier">snapshot_units</span> = <span class="ruby-identifier">el</span>.<span class="ruby-identifier">text</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot; &quot;</span>)[<span class="ruby-value">1</span>]
251
+
252
+ <span class="ruby-identifier">el</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">XPath</span>.<span class="ruby-identifier">first</span>(<span class="ruby-identifier">snapshot_el</span>, <span class="ruby-value str">&quot;dc:date&quot;</span>, <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Namespaces</span><span class="ruby-operator">::</span><span class="ruby-constant">MAPPING</span>)
253
+ <span class="ruby-identifier">snapshot_date</span> = <span class="ruby-identifier">el</span>.<span class="ruby-identifier">text</span>
254
+
255
+ <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Snapshot</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">snapshot_url</span>, <span class="ruby-identifier">snapshot_md5_url</span>, <span class="ruby-identifier">snapshot_size</span>, <span class="ruby-identifier">snapshot_units</span>, <span class="ruby-identifier">snapshot_date</span>)
256
+
257
+ <span class="ruby-keyword kw">end</span>
258
+ </pre>
259
+ </div>
260
+ </div>
261
+ </div>
262
+
263
+ <div id="method-M000077" class="method-detail">
264
+ <a name="M000077"></a>
265
+
266
+ <div class="method-heading">
267
+ <a href="#M000077" class="method-signature">
268
+ <span class="method-name">read_from_store</span><span class="method-args">(store)</span>
269
+ </a>
270
+ </div>
271
+
272
+ <div class="method-description">
273
+ <p>
274
+ Read snapshot data from the given store
275
+ </p>
276
+ <table>
277
+ <tr><td valign="top">store:</td><td>reference to a <a href="Store.html">Store</a> object
278
+
279
+ </td></tr>
280
+ </table>
281
+ <p><a class="source-toggle" href="#"
282
+ onclick="toggleCode('M000077-source');return false;">[Source]</a></p>
283
+ <div class="method-source-code" id="M000077-source">
284
+ <pre>
285
+ <span class="ruby-comment cmt"># File lib/pho/snapshot.rb, line 34</span>
286
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Snapshot</span>.<span class="ruby-identifier">read_from_store</span>(<span class="ruby-identifier">store</span>)
287
+ <span class="ruby-identifier">resp</span> = <span class="ruby-identifier">store</span>.<span class="ruby-identifier">get_snapshots</span>()
288
+
289
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">resp</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">200</span>)
290
+ <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Response was not successful. Status code was: #{resp.status}&quot;</span>
291
+ <span class="ruby-keyword kw">end</span>
292
+ <span class="ruby-identifier">content</span> = <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">content</span>
293
+
294
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">store</span>.<span class="ruby-identifier">storeuri</span>, <span class="ruby-identifier">content</span>)
295
+ <span class="ruby-keyword kw">end</span>
207
296
  </pre>
297
+ </div>
208
298
  </div>
209
299
  </div>
210
300
 
211
301
  <h3 class="section-bar">Public Instance methods</h3>
212
302
 
213
- <div id="method-M000073" class="method-detail">
214
- <a name="M000073"></a>
303
+ <div id="method-M000081" class="method-detail">
304
+ <a name="M000081"></a>
215
305
 
216
306
  <div class="method-heading">
217
- <a href="Snapshot.src/M000073.html" target="Code" class="method-signature"
218
- onclick="popupCode('Snapshot.src/M000073.html');return false;">
219
- <span class="method-name">download</span><span class="method-args">(dir, client=HTTPClient.new())</span>
307
+ <a href="#M000081" class="method-signature">
308
+ <span class="method-name">backup</span><span class="method-args">(store, dir=Dir.tmpdir)</span>
220
309
  </a>
221
310
  </div>
222
311
 
223
312
  <div class="method-description">
224
313
  <p>
225
314
  Download this snapshot to the specified directory. Will automatically
226
- calculate an MD5 checksum for the <a
227
- href="Snapshot.html#M000073">download</a> and compare it against the
315
+ calculate an MD5 checksum for the download and compare it against the
228
316
  published value. If they don&#8216;t match then a RuntimeError will be
229
317
  raised
230
318
  </p>
231
319
  <table>
232
- <tr><td valign="top">dir:</td><td>directory in which snapshot will be stored
320
+ <tr><td valign="top">store:</td><td>the store to <a href="Snapshot.html#M000081">backup</a>
233
321
 
234
322
  </td></tr>
235
- <tr><td valign="top">client:</td><td>specify a preconfigured client, e.g. to configure proxy servers, etc
323
+ <tr><td valign="top">dir:</td><td>directory in which snapshot will be stored
236
324
 
237
325
  </td></tr>
238
326
  </table>
327
+ <p><a class="source-toggle" href="#"
328
+ onclick="toggleCode('M000081-source');return false;">[Source]</a></p>
329
+ <div class="method-source-code" id="M000081-source">
330
+ <pre>
331
+ <span class="ruby-comment cmt"># File lib/pho/snapshot.rb, line 96</span>
332
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">backup</span>(<span class="ruby-identifier">store</span>, <span class="ruby-identifier">dir</span>=<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">tmpdir</span>)
333
+
334
+ <span class="ruby-identifier">published_md5</span> = <span class="ruby-identifier">read_md5</span>(<span class="ruby-identifier">store</span>.<span class="ruby-identifier">client</span>)
335
+
336
+ <span class="ruby-identifier">digest</span> = <span class="ruby-constant">Digest</span><span class="ruby-operator">::</span><span class="ruby-constant">MD5</span>.<span class="ruby-identifier">new</span>()
337
+
338
+ <span class="ruby-identifier">filename</span> = <span class="ruby-ivar">@url</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot;/&quot;</span>).<span class="ruby-identifier">last</span>
339
+ <span class="ruby-identifier">file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>( <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">dir</span>, <span class="ruby-identifier">filename</span>), <span class="ruby-value str">&quot;w&quot;</span> ) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
340
+
341
+ <span class="ruby-comment cmt">#FIXME: this is not efficient as the snapshot may be very large and this</span>
342
+ <span class="ruby-comment cmt">#will just read all of the data into memory</span>
343
+ <span class="ruby-identifier">content</span> = <span class="ruby-identifier">store</span>.<span class="ruby-identifier">client</span>.<span class="ruby-identifier">get_content</span>(<span class="ruby-ivar">@url</span>)
344
+ <span class="ruby-identifier">file</span>.<span class="ruby-identifier">print</span>(<span class="ruby-identifier">content</span>)
345
+ <span class="ruby-identifier">digest</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">content</span>
346
+
347
+ <span class="ruby-keyword kw">end</span>
348
+
349
+ <span class="ruby-identifier">calc_md5</span> = <span class="ruby-identifier">digest</span>.<span class="ruby-identifier">hexdigest</span>
350
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">calc_md5</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">published_md5</span>)
351
+ <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Calculated digest of #{calc_md5} but does not match published md5 #{published_md5}&quot;</span>
352
+ <span class="ruby-keyword kw">end</span>
353
+ <span class="ruby-keyword kw">end</span>
354
+ </pre>
355
+ </div>
239
356
  </div>
240
357
  </div>
241
358
 
242
- <div id="method-M000072" class="method-detail">
243
- <a name="M000072"></a>
359
+ <div id="method-M000080" class="method-detail">
360
+ <a name="M000080"></a>
244
361
 
245
362
  <div class="method-heading">
246
- <a href="Snapshot.src/M000072.html" target="Code" class="method-signature"
247
- onclick="popupCode('Snapshot.src/M000072.html');return false;">
363
+ <a href="#M000080" class="method-signature">
248
364
  <span class="method-name">read_md5</span><span class="method-args">(client=HttpClient.new())</span>
249
365
  </a>
250
366
  </div>
@@ -253,6 +369,16 @@ raised
253
369
  <p>
254
370
  Read the published MD5 value
255
371
  </p>
372
+ <p><a class="source-toggle" href="#"
373
+ onclick="toggleCode('M000080-source');return false;">[Source]</a></p>
374
+ <div class="method-source-code" id="M000080-source">
375
+ <pre>
376
+ <span class="ruby-comment cmt"># File lib/pho/snapshot.rb, line 86</span>
377
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">read_md5</span>(<span class="ruby-identifier">client</span>=<span class="ruby-constant">HttpClient</span>.<span class="ruby-identifier">new</span>())
378
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">client</span>.<span class="ruby-identifier">get_content</span>(<span class="ruby-ivar">@md5_url</span>)
379
+ <span class="ruby-keyword kw">end</span>
380
+ </pre>
381
+ </div>
256
382
  </div>
257
383
  </div>
258
384
 
@@ -157,13 +157,24 @@ Interval before status should be requested again.
157
157
  <a name="M000020"></a>
158
158
 
159
159
  <div class="method-heading">
160
- <a href="Status.src/M000020.html" target="Code" class="method-signature"
161
- onclick="popupCode('Status.src/M000020.html');return false;">
160
+ <a href="#M000020" class="method-signature">
162
161
  <span class="method-name">new</span><span class="method-args">(retry_interval, status_message, access_mode)</span>
163
162
  </a>
164
163
  </div>
165
164
 
166
165
  <div class="method-description">
166
+ <p><a class="source-toggle" href="#"
167
+ onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
168
+ <div class="method-source-code" id="M000020-source">
169
+ <pre>
170
+ <span class="ruby-comment cmt"># File lib/pho/status.rb, line 25</span>
171
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">retry_interval</span>, <span class="ruby-identifier">status_message</span>, <span class="ruby-identifier">access_mode</span>)
172
+ <span class="ruby-ivar">@retry_interval</span> = <span class="ruby-identifier">retry_interval</span>
173
+ <span class="ruby-ivar">@status_message</span> = <span class="ruby-identifier">status_message</span>
174
+ <span class="ruby-ivar">@access_mode</span> = <span class="ruby-identifier">access_mode</span>
175
+ <span class="ruby-keyword kw">end</span>
176
+ </pre>
177
+ </div>
167
178
  </div>
168
179
  </div>
169
180
 
@@ -171,8 +182,7 @@ Interval before status should be requested again.
171
182
  <a name="M000021"></a>
172
183
 
173
184
  <div class="method-heading">
174
- <a href="Status.src/M000021.html" target="Code" class="method-signature"
175
- onclick="popupCode('Status.src/M000021.html');return false;">
185
+ <a href="#M000021" class="method-signature">
176
186
  <span class="method-name">read_from_store</span><span class="method-args">(store)</span>
177
187
  </a>
178
188
  </div>
@@ -191,6 +201,29 @@ href="Status.html">Status</a> object.
191
201
 
192
202
  </td></tr>
193
203
  </table>
204
+ <p><a class="source-toggle" href="#"
205
+ onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
206
+ <div class="method-source-code" id="M000021-source">
207
+ <pre>
208
+ <span class="ruby-comment cmt"># File lib/pho/status.rb, line 36</span>
209
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Status</span>.<span class="ruby-identifier">read_from_store</span>(<span class="ruby-identifier">store</span>)
210
+ <span class="ruby-identifier">response</span> = <span class="ruby-identifier">store</span>.<span class="ruby-identifier">get_status</span>()
211
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">!=</span> <span class="ruby-value">200</span>)
212
+ <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Cannot read store status&quot;</span>
213
+ <span class="ruby-keyword kw">end</span>
214
+
215
+ <span class="ruby-identifier">u</span> = <span class="ruby-identifier">store</span>.<span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">&quot;/config/access-status&quot;</span>)
216
+ <span class="ruby-identifier">json</span> = <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>( <span class="ruby-identifier">response</span>.<span class="ruby-identifier">content</span> )
217
+ <span class="ruby-identifier">retry_interval</span> = <span class="ruby-identifier">json</span>[<span class="ruby-identifier">u</span>][<span class="ruby-value str">&quot;http:\/\/schemas.talis.com\/2006\/bigfoot\/configuration#retryInterval&quot;</span>][<span class="ruby-value">0</span>][<span class="ruby-value str">&quot;value&quot;</span>]
218
+ <span class="ruby-identifier">status_message</span> = <span class="ruby-identifier">json</span>[<span class="ruby-identifier">u</span>][<span class="ruby-value str">&quot;http:\/\/schemas.talis.com\/2006\/bigfoot\/configuration#statusMessage&quot;</span>][<span class="ruby-value">0</span>][<span class="ruby-value str">&quot;value&quot;</span>]
219
+ <span class="ruby-identifier">access_mode</span> = <span class="ruby-identifier">json</span>[<span class="ruby-identifier">u</span>][<span class="ruby-value str">&quot;http:\/\/schemas.talis.com\/2006\/bigfoot\/configuration#accessMode&quot;</span>][<span class="ruby-value">0</span>][<span class="ruby-value str">&quot;value&quot;</span>]
220
+
221
+ <span class="ruby-identifier">state</span> = <span class="ruby-constant">Status</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">retry_interval</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">status_message</span>, <span class="ruby-identifier">access_mode</span>)
222
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">state</span>
223
+
224
+ <span class="ruby-keyword kw">end</span>
225
+ </pre>
226
+ </div>
194
227
  </div>
195
228
  </div>
196
229
 
@@ -200,8 +233,7 @@ href="Status.html">Status</a> object.
200
233
  <a name="M000022"></a>
201
234
 
202
235
  <div class="method-heading">
203
- <a href="Status.src/M000022.html" target="Code" class="method-signature"
204
- onclick="popupCode('Status.src/M000022.html');return false;">
236
+ <a href="#M000022" class="method-signature">
205
237
  <span class="method-name">readable?</span><span class="method-args">()</span>
206
238
  </a>
207
239
  </div>
@@ -210,6 +242,16 @@ href="Status.html">Status</a> object.
210
242
  <p>
211
243
  Is the store <a href="Status.html#M000022">readable?</a>
212
244
  </p>
245
+ <p><a class="source-toggle" href="#"
246
+ onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
247
+ <div class="method-source-code" id="M000022-source">
248
+ <pre>
249
+ <span class="ruby-comment cmt"># File lib/pho/status.rb, line 54</span>
250
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">readable?</span>
251
+ <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@access_mode</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">UNAVAILABLE</span>
252
+ <span class="ruby-keyword kw">end</span>
253
+ </pre>
254
+ </div>
213
255
  </div>
214
256
  </div>
215
257
 
@@ -217,8 +259,7 @@ Is the store <a href="Status.html#M000022">readable?</a>
217
259
  <a name="M000023"></a>
218
260
 
219
261
  <div class="method-heading">
220
- <a href="Status.src/M000023.html" target="Code" class="method-signature"
221
- onclick="popupCode('Status.src/M000023.html');return false;">
262
+ <a href="#M000023" class="method-signature">
222
263
  <span class="method-name">writeable?</span><span class="method-args">()</span>
223
264
  </a>
224
265
  </div>
@@ -227,6 +268,16 @@ Is the store <a href="Status.html#M000022">readable?</a>
227
268
  <p>
228
269
  Is the store <a href="Status.html#M000023">writeable?</a>
229
270
  </p>
271
+ <p><a class="source-toggle" href="#"
272
+ onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
273
+ <div class="method-source-code" id="M000023-source">
274
+ <pre>
275
+ <span class="ruby-comment cmt"># File lib/pho/status.rb, line 59</span>
276
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">writeable?</span>
277
+ <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@access_mode</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">READ_WRITE</span>
278
+ <span class="ruby-keyword kw">end</span>
279
+ </pre>
280
+ </div>
230
281
  </div>
231
282
  </div>
232
283
 
@@ -109,40 +109,37 @@ See the examples directory in the distribution
109
109
  <h3 class="section-bar">Methods</h3>
110
110
 
111
111
  <div class="name-list">
112
- <a href="#M000052">augment</a>&nbsp;&nbsp;
113
- <a href="#M000051">augment_uri</a>&nbsp;&nbsp;
114
- <a href="#M000058">build_job_request</a>&nbsp;&nbsp;
115
- <a href="#M000038">build_uri</a>&nbsp;&nbsp;
116
- <a href="#M000053">configure_headers_for_conditional_get</a>&nbsp;&nbsp;
117
- <a href="#M000056">delete_item</a>&nbsp;&nbsp;
118
- <a href="#M000042">describe</a>&nbsp;&nbsp;
119
- <a href="#M000049">facet</a>&nbsp;&nbsp;
120
- <a href="#M000066">get_field_predicate_map</a>&nbsp;&nbsp;
121
- <a href="#M000057">get_item</a>&nbsp;&nbsp;
122
- <a href="#M000068">get_query_profile</a>&nbsp;&nbsp;
123
- <a href="#M000050">get_search_params</a>&nbsp;&nbsp;
124
- <a href="#M000065">get_snapshots</a>&nbsp;&nbsp;
125
- <a href="#M000064">get_status</a>&nbsp;&nbsp;
126
- <a href="#M000036">new</a>&nbsp;&nbsp;
127
- <a href="#M000067">put_field_predicate_map</a>&nbsp;&nbsp;
128
- <a href="#M000069">put_query_profile</a>&nbsp;&nbsp;
129
- <a href="#M000054">record_etags</a>&nbsp;&nbsp;
130
- <a href="#M000060">reindex</a>&nbsp;&nbsp;
131
- <a href="#M000059">reset</a>&nbsp;&nbsp;
132
- <a href="#M000062">restore</a>&nbsp;&nbsp;
133
- <a href="#M000048">search</a>&nbsp;&nbsp;
134
- <a href="#M000037">set_credentials</a>&nbsp;&nbsp;
135
- <a href="#M000061">snapshot</a>&nbsp;&nbsp;
136
- <a href="#M000047">sparql</a>&nbsp;&nbsp;
137
- <a href="#M000045">sparql_ask</a>&nbsp;&nbsp;
138
- <a href="#M000044">sparql_construct</a>&nbsp;&nbsp;
139
- <a href="#M000043">sparql_describe</a>&nbsp;&nbsp;
140
- <a href="#M000046">sparql_select</a>&nbsp;&nbsp;
141
- <a href="#M000039">store_data</a>&nbsp;&nbsp;
142
- <a href="#M000040">store_file</a>&nbsp;&nbsp;
143
- <a href="#M000041">store_url</a>&nbsp;&nbsp;
144
- <a href="#M000063">submit_job</a>&nbsp;&nbsp;
145
- <a href="#M000055">upload_item</a>&nbsp;&nbsp;
112
+ <a href="#M000062">augment</a>&nbsp;&nbsp;
113
+ <a href="#M000061">augment_uri</a>&nbsp;&nbsp;
114
+ <a href="#M000048">build_uri</a>&nbsp;&nbsp;
115
+ <a href="#M000063">configure_headers_for_conditional_get</a>&nbsp;&nbsp;
116
+ <a href="#M000066">delete_item</a>&nbsp;&nbsp;
117
+ <a href="#M000052">describe</a>&nbsp;&nbsp;
118
+ <a href="#M000059">facet</a>&nbsp;&nbsp;
119
+ <a href="#M000073">get_field_predicate_map</a>&nbsp;&nbsp;
120
+ <a href="#M000067">get_item</a>&nbsp;&nbsp;
121
+ <a href="#M000068">get_job</a>&nbsp;&nbsp;
122
+ <a href="#M000069">get_jobs</a>&nbsp;&nbsp;
123
+ <a href="#M000075">get_query_profile</a>&nbsp;&nbsp;
124
+ <a href="#M000060">get_search_params</a>&nbsp;&nbsp;
125
+ <a href="#M000072">get_snapshots</a>&nbsp;&nbsp;
126
+ <a href="#M000071">get_status</a>&nbsp;&nbsp;
127
+ <a href="#M000046">new</a>&nbsp;&nbsp;
128
+ <a href="#M000074">put_field_predicate_map</a>&nbsp;&nbsp;
129
+ <a href="#M000076">put_query_profile</a>&nbsp;&nbsp;
130
+ <a href="#M000064">record_etags</a>&nbsp;&nbsp;
131
+ <a href="#M000058">search</a>&nbsp;&nbsp;
132
+ <a href="#M000047">set_credentials</a>&nbsp;&nbsp;
133
+ <a href="#M000057">sparql</a>&nbsp;&nbsp;
134
+ <a href="#M000055">sparql_ask</a>&nbsp;&nbsp;
135
+ <a href="#M000054">sparql_construct</a>&nbsp;&nbsp;
136
+ <a href="#M000053">sparql_describe</a>&nbsp;&nbsp;
137
+ <a href="#M000056">sparql_select</a>&nbsp;&nbsp;
138
+ <a href="#M000049">store_data</a>&nbsp;&nbsp;
139
+ <a href="#M000050">store_file</a>&nbsp;&nbsp;
140
+ <a href="#M000051">store_url</a>&nbsp;&nbsp;
141
+ <a href="#M000070">submit_job</a>&nbsp;&nbsp;
142
+ <a href="#M000065">upload_item</a>&nbsp;&nbsp;
146
143
  </div>
147
144
  </div>
148
145
 
@@ -196,12 +193,11 @@ Retrieve the admin username configured in this instance
196
193
  <div id="methods">
197
194
  <h3 class="section-bar">Public Class methods</h3>
198
195
 
199
- <div id="method-M000036" class="method-detail">
200
- <a name="M000036"></a>
196
+ <div id="method-M000046" class="method-detail">
197
+ <a name="M000046"></a>
201
198
 
202
199
  <div class="method-heading">
203
- <a href="Store.src/M000036.html" target="Code" class="method-signature"
204
- onclick="popupCode('Store.src/M000036.html');return false;">
200
+ <a href="#M000046" class="method-signature">
205
201
  <span class="method-name">new</span><span class="method-args">(storeuri, username=nil, password=nil, client = HTTPClient.new() )</span>
206
202
  </a>
207
203
  </div>
@@ -224,17 +220,30 @@ Create an instance of the store class
224
220
 
225
221
  </td></tr>
226
222
  </table>
223
+ <p><a class="source-toggle" href="#"
224
+ onclick="toggleCode('M000046-source');return false;">[Source]</a></p>
225
+ <div class="method-source-code" id="M000046-source">
226
+ <pre>
227
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 45</span>
228
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">storeuri</span>, <span class="ruby-identifier">username</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">password</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">client</span> = <span class="ruby-constant">HTTPClient</span>.<span class="ruby-identifier">new</span>() )
229
+ <span class="ruby-ivar">@storeuri</span> = <span class="ruby-identifier">storeuri</span>.<span class="ruby-identifier">chomp</span>(<span class="ruby-value str">&quot;/&quot;</span>)
230
+ <span class="ruby-ivar">@username</span> = <span class="ruby-identifier">username</span>
231
+ <span class="ruby-ivar">@password</span> = <span class="ruby-identifier">password</span>
232
+ <span class="ruby-ivar">@client</span> = <span class="ruby-identifier">client</span>
233
+ <span class="ruby-identifier">set_credentials</span>(<span class="ruby-identifier">username</span>, <span class="ruby-identifier">password</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">username</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">password</span>
234
+ <span class="ruby-keyword kw">end</span>
235
+ </pre>
236
+ </div>
227
237
  </div>
228
238
  </div>
229
239
 
230
240
  <h3 class="section-bar">Public Instance methods</h3>
231
241
 
232
- <div id="method-M000052" class="method-detail">
233
- <a name="M000052"></a>
242
+ <div id="method-M000062" class="method-detail">
243
+ <a name="M000062"></a>
234
244
 
235
245
  <div class="method-heading">
236
- <a href="Store.src/M000052.html" target="Code" class="method-signature"
237
- onclick="popupCode('Store.src/M000052.html');return false;">
246
+ <a href="#M000062" class="method-signature">
238
247
  <span class="method-name">augment</span><span class="method-args">(data)</span>
239
248
  </a>
240
249
  </div>
@@ -249,15 +258,26 @@ Platform
249
258
 
250
259
  </td></tr>
251
260
  </table>
261
+ <p><a class="source-toggle" href="#"
262
+ onclick="toggleCode('M000062-source');return false;">[Source]</a></p>
263
+ <div class="method-source-code" id="M000062-source">
264
+ <pre>
265
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 254</span>
266
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">augment</span>(<span class="ruby-identifier">data</span>)
267
+ <span class="ruby-identifier">u</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">&quot;/services/augment&quot;</span>)
268
+ <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">post</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">data</span>, <span class="ruby-keyword kw">nil</span>)
269
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
270
+ <span class="ruby-keyword kw">end</span>
271
+ </pre>
272
+ </div>
252
273
  </div>
253
274
  </div>
254
275
 
255
- <div id="method-M000051" class="method-detail">
256
- <a name="M000051"></a>
276
+ <div id="method-M000061" class="method-detail">
277
+ <a name="M000061"></a>
257
278
 
258
279
  <div class="method-heading">
259
- <a href="Store.src/M000051.html" target="Code" class="method-signature"
260
- onclick="popupCode('Store.src/M000051.html');return false;">
280
+ <a href="#M000061" class="method-signature">
261
281
  <span class="method-name">augment_uri</span><span class="method-args">(uri)</span>
262
282
  </a>
263
283
  </div>
@@ -272,45 +292,26 @@ data in this store
272
292
 
273
293
  </td></tr>
274
294
  </table>
295
+ <p><a class="source-toggle" href="#"
296
+ onclick="toggleCode('M000061-source');return false;">[Source]</a></p>
297
+ <div class="method-source-code" id="M000061-source">
298
+ <pre>
299
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 245</span>
300
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">augment_uri</span>(<span class="ruby-identifier">uri</span>)
301
+ <span class="ruby-identifier">u</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">&quot;/services/augment&quot;</span>)
302
+ <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, {<span class="ruby-value str">&quot;data-uri&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">uri</span>}, <span class="ruby-keyword kw">nil</span>)
303
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
304
+ <span class="ruby-keyword kw">end</span>
305
+ </pre>
306
+ </div>
275
307
  </div>
276
308
  </div>
277
309
 
278
- <div id="method-M000058" class="method-detail">
279
- <a name="M000058"></a>
280
-
281
- <div class="method-heading">
282
- <a href="Store.src/M000058.html" target="Code" class="method-signature"
283
- onclick="popupCode('Store.src/M000058.html');return false;">
284
- <span class="method-name">build_job_request</span><span class="method-args">(t, joburi, label)</span>
285
- </a>
286
- </div>
287
-
288
- <div class="method-description">
289
- <p>
290
- Construct an RDF/XML document containing a job request for submitting to
291
- the Platform.
292
- </p>
293
- <table>
294
- <tr><td valign="top">t:</td><td>a Time object, specifying the time at which the request should be carried
295
- out
296
-
297
- </td></tr>
298
- <tr><td valign="top">joburi:</td><td>the URI for the JobType that should be created
299
-
300
- </td></tr>
301
- <tr><td valign="top">label:</td><td>a label for this job.
302
-
303
- </td></tr>
304
- </table>
305
- </div>
306
- </div>
307
-
308
- <div id="method-M000038" class="method-detail">
309
- <a name="M000038"></a>
310
+ <div id="method-M000048" class="method-detail">
311
+ <a name="M000048"></a>
310
312
 
311
313
  <div class="method-heading">
312
- <a href="Store.src/M000038.html" target="Code" class="method-signature"
313
- onclick="popupCode('Store.src/M000038.html');return false;">
314
+ <a href="#M000048" class="method-signature">
314
315
  <span class="method-name">build_uri</span><span class="method-args">(uri)</span>
315
316
  </a>
316
317
  </div>
@@ -324,15 +325,31 @@ Build a request uri, by concatenating it with the base uri of the store
324
325
 
325
326
  </td></tr>
326
327
  </table>
328
+ <p><a class="source-toggle" href="#"
329
+ onclick="toggleCode('M000048-source');return false;">[Source]</a></p>
330
+ <div class="method-source-code" id="M000048-source">
331
+ <pre>
332
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 63</span>
333
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build_uri</span>(<span class="ruby-identifier">uri</span>)
334
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">start_with?</span>(<span class="ruby-ivar">@storeuri</span>))
335
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">uri</span>
336
+ <span class="ruby-keyword kw">end</span>
337
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">start_with?</span>(<span class="ruby-value str">&quot;/&quot;</span>)
338
+ <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@storeuri</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">uri</span>
339
+ <span class="ruby-keyword kw">else</span>
340
+ <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@storeuri</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;/&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">uri</span>
341
+ <span class="ruby-keyword kw">end</span>
342
+ <span class="ruby-keyword kw">end</span>
343
+ </pre>
344
+ </div>
327
345
  </div>
328
346
  </div>
329
347
 
330
- <div id="method-M000053" class="method-detail">
331
- <a name="M000053"></a>
348
+ <div id="method-M000063" class="method-detail">
349
+ <a name="M000063"></a>
332
350
 
333
351
  <div class="method-heading">
334
- <a href="Store.src/M000053.html" target="Code" class="method-signature"
335
- onclick="popupCode('Store.src/M000053.html');return false;">
352
+ <a href="#M000063" class="method-signature">
336
353
  <span class="method-name">configure_headers_for_conditional_get</span><span class="method-args">(u, headers, etags, if_match)</span>
337
354
  </a>
338
355
  </div>
@@ -341,15 +358,31 @@ Build a request uri, by concatenating it with the base uri of the store
341
358
  <p>
342
359
  Added appropriate http header for conditional get requests
343
360
  </p>
361
+ <p><a class="source-toggle" href="#"
362
+ onclick="toggleCode('M000063-source');return false;">[Source]</a></p>
363
+ <div class="method-source-code" id="M000063-source">
364
+ <pre>
365
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 261</span>
366
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">configure_headers_for_conditional_get</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">etags</span>, <span class="ruby-identifier">if_match</span>)
367
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">etags</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">etags</span>.<span class="ruby-identifier">has_tag?</span>(<span class="ruby-identifier">u</span>)
368
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">if_match</span>
369
+ <span class="ruby-identifier">headers</span>[<span class="ruby-value str">&quot;If-Match&quot;</span>] = <span class="ruby-identifier">etags</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>)
370
+ <span class="ruby-keyword kw">else</span>
371
+ <span class="ruby-identifier">headers</span>[<span class="ruby-value str">&quot;If-None-Match&quot;</span>] = <span class="ruby-identifier">etags</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>)
372
+ <span class="ruby-keyword kw">end</span>
373
+ <span class="ruby-keyword kw">end</span>
374
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">headers</span>
375
+ <span class="ruby-keyword kw">end</span>
376
+ </pre>
377
+ </div>
344
378
  </div>
345
379
  </div>
346
380
 
347
- <div id="method-M000056" class="method-detail">
348
- <a name="M000056"></a>
381
+ <div id="method-M000066" class="method-detail">
382
+ <a name="M000066"></a>
349
383
 
350
384
  <div class="method-heading">
351
- <a href="Store.src/M000056.html" target="Code" class="method-signature"
352
- onclick="popupCode('Store.src/M000056.html');return false;">
385
+ <a href="#M000066" class="method-signature">
353
386
  <span class="method-name">delete_item</span><span class="method-args">(uri)</span>
354
387
  </a>
355
388
  </div>
@@ -366,15 +399,27 @@ Delete an item from the Contentbox in this <a href="Store.html">Store</a>
366
399
  <p>
367
400
  TODO: conditional deletes
368
401
  </p>
402
+ <p><a class="source-toggle" href="#"
403
+ onclick="toggleCode('M000066-source');return false;">[Source]</a></p>
404
+ <div class="method-source-code" id="M000066-source">
405
+ <pre>
406
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 310</span>
407
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete_item</span>(<span class="ruby-identifier">uri</span>)
408
+ <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">uri</span>.<span class="ruby-identifier">start_with?</span>(<span class="ruby-ivar">@storeuri</span>)
409
+ <span class="ruby-identifier">uri</span> = <span class="ruby-identifier">build_uri</span>(<span class="ruby-identifier">uri</span>)
410
+ <span class="ruby-keyword kw">end</span>
411
+ <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">uri</span>)
412
+ <span class="ruby-keyword kw">end</span>
413
+ </pre>
414
+ </div>
369
415
  </div>
370
416
  </div>
371
417
 
372
- <div id="method-M000042" class="method-detail">
373
- <a name="M000042"></a>
418
+ <div id="method-M000052" class="method-detail">
419
+ <a name="M000052"></a>
374
420
 
375
421
  <div class="method-heading">
376
- <a href="Store.src/M000042.html" target="Code" class="method-signature"
377
- onclick="popupCode('Store.src/M000042.html');return false;">
422
+ <a href="#M000052" class="method-signature">
378
423
  <span class="method-name">describe</span><span class="method-args">(uri, format=&quot;application/rdf+xml&quot;, etags=nil, if_match=false)</span>
379
424
  </a>
380
425
  </div>
@@ -386,7 +431,7 @@ be to retrieve an RDF/XML document, but other formats can be requested, as
386
431
  supported by the Talis Platform. E.g. application/json
387
432
  </p>
388
433
  <table>
389
- <tr><td valign="top">uri:</td><td>the URI of the resource to <a href="Store.html#M000042">describe</a>
434
+ <tr><td valign="top">uri:</td><td>the URI of the resource to <a href="Store.html#M000052">describe</a>
390
435
 
391
436
  </td></tr>
392
437
  <tr><td valign="top">format:</td><td>the preferred response format
@@ -403,31 +448,45 @@ false to perform a Conditional GET
403
448
  </table>
404
449
  <p>
405
450
  Note that this method is different from <a
406
- href="Store.html#M000043">sparql_describe</a> in that it is intended to be
451
+ href="Store.html#M000053">sparql_describe</a> in that it is intended to be
407
452
  used to generate a description of a single URI, using an separated service
408
453
  exposed by the Platform. This service is optimised for retrieval of
409
454
  descriptions for single resources and supports HTTP caching and conditional
410
- retrieval. The <a href="Store.html#M000043">sparql_describe</a> method
455
+ retrieval. The <a href="Store.html#M000053">sparql_describe</a> method
411
456
  should be used to submit more complex DESCRIBE queries to the Platform,
412
457
  e.g. to generate descriptions of resources matching a particular graph
413
458
  pattern.
414
459
  </p>
460
+ <p><a class="source-toggle" href="#"
461
+ onclick="toggleCode('M000052-source');return false;">[Source]</a></p>
462
+ <div class="method-source-code" id="M000052-source">
463
+ <pre>
464
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 128</span>
465
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">describe</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">format</span>=<span class="ruby-value str">&quot;application/rdf+xml&quot;</span>, <span class="ruby-identifier">etags</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">if_match</span>=<span class="ruby-keyword kw">false</span>)
466
+ <span class="ruby-identifier">u</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">&quot;/meta&quot;</span>)
467
+ <span class="ruby-identifier">headers</span> = {<span class="ruby-value str">&quot;Accept&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">format</span>}
468
+ <span class="ruby-identifier">headers</span> = <span class="ruby-identifier">configure_headers_for_conditional_get</span>(<span class="ruby-node">&quot;#{u}?about=#{uri}&quot;</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">etags</span>, <span class="ruby-identifier">if_match</span>)
469
+ <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, {<span class="ruby-value str">&quot;about&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">uri</span>}, <span class="ruby-identifier">headers</span> )
470
+ <span class="ruby-identifier">record_etags</span>(<span class="ruby-node">&quot;#{u}?about=#{uri}&quot;</span>, <span class="ruby-identifier">etags</span>, <span class="ruby-identifier">response</span>)
471
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
472
+ <span class="ruby-keyword kw">end</span>
473
+ </pre>
474
+ </div>
415
475
  </div>
416
476
  </div>
417
477
 
418
- <div id="method-M000049" class="method-detail">
419
- <a name="M000049"></a>
478
+ <div id="method-M000059" class="method-detail">
479
+ <a name="M000059"></a>
420
480
 
421
481
  <div class="method-heading">
422
- <a href="Store.src/M000049.html" target="Code" class="method-signature"
423
- onclick="popupCode('Store.src/M000049.html');return false;">
482
+ <a href="#M000059" class="method-signature">
424
483
  <span class="method-name">facet</span><span class="method-args">(query, facets, params=nil)</span>
425
484
  </a>
426
485
  </div>
427
486
 
428
487
  <div class="method-description">
429
488
  <p>
430
- Perform a facetted <a href="Store.html#M000048">search</a> against the
489
+ Perform a facetted <a href="Store.html#M000058">search</a> against the
431
490
  Metabox indexes.
432
491
  </p>
433
492
  <table>
@@ -446,7 +505,7 @@ The <em>params</em> hash can contain the following values:
446
505
  </p>
447
506
  <ul>
448
507
  <li><b>top</b>: the maximum number of results to return for each <a
449
- href="Store.html#M000049">facet</a>
508
+ href="Store.html#M000059">facet</a>
450
509
 
451
510
  </li>
452
511
  <li><b>output</b>: the preferred response format, can be html or xml (the
@@ -454,15 +513,32 @@ default)
454
513
 
455
514
  </li>
456
515
  </ul>
516
+ <p><a class="source-toggle" href="#"
517
+ onclick="toggleCode('M000059-source');return false;">[Source]</a></p>
518
+ <div class="method-source-code" id="M000059-source">
519
+ <pre>
520
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 220</span>
521
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">facet</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">facets</span>, <span class="ruby-identifier">params</span>=<span class="ruby-keyword kw">nil</span>)
522
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">facets</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">facets</span>.<span class="ruby-identifier">empty?</span>
523
+ <span class="ruby-comment cmt">#todo</span>
524
+ <span class="ruby-identifier">throw</span>
525
+ <span class="ruby-keyword kw">end</span>
526
+ <span class="ruby-identifier">u</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">&quot;/services/facet&quot;</span>)
527
+ <span class="ruby-identifier">search_params</span> = <span class="ruby-identifier">get_search_params</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">query</span>, <span class="ruby-identifier">params</span>)
528
+ <span class="ruby-identifier">search_params</span>[<span class="ruby-value str">&quot;fields&quot;</span>] = <span class="ruby-identifier">facets</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;,&quot;</span>)
529
+ <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">search_params</span>, <span class="ruby-keyword kw">nil</span>)
530
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
531
+ <span class="ruby-keyword kw">end</span>
532
+ </pre>
533
+ </div>
457
534
  </div>
458
535
  </div>
459
536
 
460
- <div id="method-M000066" class="method-detail">
461
- <a name="M000066"></a>
537
+ <div id="method-M000073" class="method-detail">
538
+ <a name="M000073"></a>
462
539
 
463
540
  <div class="method-heading">
464
- <a href="Store.src/M000066.html" target="Code" class="method-signature"
465
- onclick="popupCode('Store.src/M000066.html');return false;">
541
+ <a href="#M000073" class="method-signature">
466
542
  <span class="method-name">get_field_predicate_map</span><span class="method-args">(output=ACCEPT_JSON)</span>
467
543
  </a>
468
544
  </div>
@@ -482,15 +558,26 @@ specific stores&#8216;s configuration.
482
558
 
483
559
  </td></tr>
484
560
  </table>
561
+ <p><a class="source-toggle" href="#"
562
+ onclick="toggleCode('M000073-source');return false;">[Source]</a></p>
563
+ <div class="method-source-code" id="M000073-source">
564
+ <pre>
565
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 392</span>
566
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_field_predicate_map</span>(<span class="ruby-identifier">output</span>=<span class="ruby-constant">ACCEPT_JSON</span>)
567
+ <span class="ruby-identifier">u</span> = <span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">&quot;/config/fpmaps/1&quot;</span>)
568
+ <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">output</span>)
569
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
570
+ <span class="ruby-keyword kw">end</span>
571
+ </pre>
572
+ </div>
485
573
  </div>
486
574
  </div>
487
575
 
488
- <div id="method-M000057" class="method-detail">
489
- <a name="M000057"></a>
576
+ <div id="method-M000067" class="method-detail">
577
+ <a name="M000067"></a>
490
578
 
491
579
  <div class="method-heading">
492
- <a href="Store.src/M000057.html" target="Code" class="method-signature"
493
- onclick="popupCode('Store.src/M000057.html');return false;">
580
+ <a href="#M000067" class="method-signature">
494
581
  <span class="method-name">get_item</span><span class="method-args">(uri, etags=nil, if_match=false)</span>
495
582
  </a>
496
583
  </div>
@@ -512,6 +599,21 @@ the Metabox.
512
599
  <p>
513
600
  TODO: document etags, redirects
514
601
  </p>
602
+ <p><a class="source-toggle" href="#"
603
+ onclick="toggleCode('M000067-source');return false;">[Source]</a></p>
604
+ <div class="method-source-code" id="M000067-source">
605
+ <pre>
606
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 324</span>
607
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_item</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">etags</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">if_match</span>=<span class="ruby-keyword kw">false</span>)
608
+ <span class="ruby-identifier">u</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">build_uri</span>(<span class="ruby-identifier">uri</span>)
609
+ <span class="ruby-identifier">headers</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
610
+ <span class="ruby-identifier">headers</span> = <span class="ruby-identifier">configure_headers_for_conditional_get</span>(<span class="ruby-node">&quot;#{u}&quot;</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">etags</span>, <span class="ruby-identifier">if_match</span>)
611
+ <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">headers</span>)
612
+ <span class="ruby-identifier">record_etags</span>(<span class="ruby-node">&quot;#{u}&quot;</span>, <span class="ruby-identifier">etags</span>, <span class="ruby-identifier">response</span>)
613
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
614
+ <span class="ruby-keyword kw">end</span>
615
+ </pre>
616
+ </div>
515
617
  </div>
516
618
  </div>
517
619
 
@@ -519,8 +621,71 @@ TODO: document etags, redirects
519
621
  <a name="M000068"></a>
520
622
 
521
623
  <div class="method-heading">
522
- <a href="Store.src/M000068.html" target="Code" class="method-signature"
523
- onclick="popupCode('Store.src/M000068.html');return false;">
624
+ <a href="#M000068" class="method-signature">
625
+ <span class="method-name">get_job</span><span class="method-args">(uri)</span>
626
+ </a>
627
+ </div>
628
+
629
+ <div class="method-description">
630
+ <p>
631
+ Retrieve metadata about a single job. Use <a
632
+ href="Job.html#M000083">Job.read_from_store</a> as a convenience function
633
+ which will return a fully-populated <a href="Job.html">Job</a> object
634
+ </p>
635
+ <table>
636
+ <tr><td valign="top">uri:</td><td>the uri of the job to retrieve
637
+
638
+ </td></tr>
639
+ </table>
640
+ <p><a class="source-toggle" href="#"
641
+ onclick="toggleCode('M000068-source');return false;">[Source]</a></p>
642
+ <div class="method-source-code" id="M000068-source">
643
+ <pre>
644
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 341</span>
645
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_job</span>(<span class="ruby-identifier">uri</span>)
646
+ <span class="ruby-identifier">u</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">build_uri</span>(<span class="ruby-identifier">uri</span>)
647
+ <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-constant">ACCEPT_RDF</span>)
648
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
649
+ <span class="ruby-keyword kw">end</span>
650
+ </pre>
651
+ </div>
652
+ </div>
653
+ </div>
654
+
655
+ <div id="method-M000069" class="method-detail">
656
+ <a name="M000069"></a>
657
+
658
+ <div class="method-heading">
659
+ <a href="#M000069" class="method-signature">
660
+ <span class="method-name">get_jobs</span><span class="method-args">()</span>
661
+ </a>
662
+ </div>
663
+
664
+ <div class="method-description">
665
+ <p>
666
+ Retrieve metadata about the Scheduled <a href="Jobs.html">Jobs</a>
667
+ Collection from the store
668
+ </p>
669
+ <p><a class="source-toggle" href="#"
670
+ onclick="toggleCode('M000069-source');return false;">[Source]</a></p>
671
+ <div class="method-source-code" id="M000069-source">
672
+ <pre>
673
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 348</span>
674
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_jobs</span>()
675
+ <span class="ruby-identifier">u</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">&quot;/jobs&quot;</span>)
676
+ <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-constant">ACCEPT_RDF</span>)
677
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
678
+ <span class="ruby-keyword kw">end</span>
679
+ </pre>
680
+ </div>
681
+ </div>
682
+ </div>
683
+
684
+ <div id="method-M000075" class="method-detail">
685
+ <a name="M000075"></a>
686
+
687
+ <div class="method-heading">
688
+ <a href="#M000075" class="method-signature">
524
689
  <span class="method-name">get_query_profile</span><span class="method-args">(output=ACCEPT_JSON)</span>
525
690
  </a>
526
691
  </div>
@@ -540,29 +705,55 @@ stores&#8216;s configuration.
540
705
 
541
706
  </td></tr>
542
707
  </table>
708
+ <p><a class="source-toggle" href="#"
709
+ onclick="toggleCode('M000075-source');return false;">[Source]</a></p>
710
+ <div class="method-source-code" id="M000075-source">
711
+ <pre>
712
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 413</span>
713
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_query_profile</span>(<span class="ruby-identifier">output</span>=<span class="ruby-constant">ACCEPT_JSON</span>)
714
+ <span class="ruby-identifier">u</span> = <span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">&quot;/config/queryprofiles/1&quot;</span>)
715
+ <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">output</span>)
716
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
717
+ <span class="ruby-keyword kw">end</span>
718
+ </pre>
719
+ </div>
543
720
  </div>
544
721
  </div>
545
722
 
546
- <div id="method-M000050" class="method-detail">
547
- <a name="M000050"></a>
723
+ <div id="method-M000060" class="method-detail">
724
+ <a name="M000060"></a>
548
725
 
549
726
  <div class="method-heading">
550
- <a href="Store.src/M000050.html" target="Code" class="method-signature"
551
- onclick="popupCode('Store.src/M000050.html');return false;">
727
+ <a href="#M000060" class="method-signature">
552
728
  <span class="method-name">get_search_params</span><span class="method-args">(u, query, params)</span>
553
729
  </a>
554
730
  </div>
555
731
 
556
732
  <div class="method-description">
733
+ <p><a class="source-toggle" href="#"
734
+ onclick="toggleCode('M000060-source');return false;">[Source]</a></p>
735
+ <div class="method-source-code" id="M000060-source">
736
+ <pre>
737
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 232</span>
738
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_search_params</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">query</span>, <span class="ruby-identifier">params</span>)
739
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
740
+ <span class="ruby-identifier">search_params</span> = <span class="ruby-identifier">params</span>.<span class="ruby-identifier">clone</span>()
741
+ <span class="ruby-keyword kw">else</span>
742
+ <span class="ruby-identifier">search_params</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
743
+ <span class="ruby-keyword kw">end</span>
744
+ <span class="ruby-identifier">search_params</span>[<span class="ruby-value str">&quot;query&quot;</span>] = <span class="ruby-identifier">query</span>
745
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">search_params</span>
746
+ <span class="ruby-keyword kw">end</span>
747
+ </pre>
748
+ </div>
557
749
  </div>
558
750
  </div>
559
751
 
560
- <div id="method-M000065" class="method-detail">
561
- <a name="M000065"></a>
752
+ <div id="method-M000072" class="method-detail">
753
+ <a name="M000072"></a>
562
754
 
563
755
  <div class="method-heading">
564
- <a href="Store.src/M000065.html" target="Code" class="method-signature"
565
- onclick="popupCode('Store.src/M000065.html');return false;">
756
+ <a href="#M000072" class="method-signature">
566
757
  <span class="method-name">get_snapshots</span><span class="method-args">()</span>
567
758
  </a>
568
759
  </div>
@@ -573,18 +764,29 @@ Retrieve the list of snapshots for this store
573
764
  </p>
574
765
  <p>
575
766
  Currently the response will contain an HTML document. Use <a
576
- href="Snapshot.html#M000070">Snapshot.parse</a> to turn this into a <a
767
+ href="Snapshot.html#M000078">Snapshot.parse</a> to turn this into a <a
577
768
  href="Snapshot.html">Snapshot</a> object
578
769
  </p>
770
+ <p><a class="source-toggle" href="#"
771
+ onclick="toggleCode('M000072-source');return false;">[Source]</a></p>
772
+ <div class="method-source-code" id="M000072-source">
773
+ <pre>
774
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 377</span>
775
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_snapshots</span>()
776
+ <span class="ruby-identifier">u</span> = <span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">&quot;/snapshots&quot;</span>)
777
+ <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-constant">ACCEPT_RDF</span>)
778
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
779
+ <span class="ruby-keyword kw">end</span>
780
+ </pre>
781
+ </div>
579
782
  </div>
580
783
  </div>
581
784
 
582
- <div id="method-M000064" class="method-detail">
583
- <a name="M000064"></a>
785
+ <div id="method-M000071" class="method-detail">
786
+ <a name="M000071"></a>
584
787
 
585
788
  <div class="method-heading">
586
- <a href="Store.src/M000064.html" target="Code" class="method-signature"
587
- onclick="popupCode('Store.src/M000064.html');return false;">
789
+ <a href="#M000071" class="method-signature">
588
790
  <span class="method-name">get_status</span><span class="method-args">()</span>
589
791
  </a>
590
792
  </div>
@@ -593,15 +795,26 @@ href="Snapshot.html">Snapshot</a> object
593
795
  <p>
594
796
  ADMIN
595
797
  </p>
798
+ <p><a class="source-toggle" href="#"
799
+ onclick="toggleCode('M000071-source');return false;">[Source]</a></p>
800
+ <div class="method-source-code" id="M000071-source">
801
+ <pre>
802
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 367</span>
803
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_status</span>()
804
+ <span class="ruby-identifier">u</span> = <span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">&quot;/config/access-status&quot;</span>)
805
+ <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-constant">ACCEPT_JSON</span> )
806
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
807
+ <span class="ruby-keyword kw">end</span>
808
+ </pre>
809
+ </div>
596
810
  </div>
597
811
  </div>
598
812
 
599
- <div id="method-M000067" class="method-detail">
600
- <a name="M000067"></a>
813
+ <div id="method-M000074" class="method-detail">
814
+ <a name="M000074"></a>
601
815
 
602
816
  <div class="method-heading">
603
- <a href="Store.src/M000067.html" target="Code" class="method-signature"
604
- onclick="popupCode('Store.src/M000067.html');return false;">
817
+ <a href="#M000074" class="method-signature">
605
818
  <span class="method-name">put_field_predicate_map</span><span class="method-args">(data)</span>
606
819
  </a>
607
820
  </div>
@@ -618,15 +831,26 @@ convenience function
618
831
 
619
832
  </td></tr>
620
833
  </table>
834
+ <p><a class="source-toggle" href="#"
835
+ onclick="toggleCode('M000074-source');return false;">[Source]</a></p>
836
+ <div class="method-source-code" id="M000074-source">
837
+ <pre>
838
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 402</span>
839
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">put_field_predicate_map</span>(<span class="ruby-identifier">data</span>)
840
+ <span class="ruby-identifier">u</span> = <span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">&quot;/config/fpmaps/1&quot;</span>)
841
+ <span class="ruby-identifier">headers</span> = {<span class="ruby-value str">&quot;Content-Type&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;application/rdf+xml&quot;</span>}
842
+ <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">put</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">data</span>, <span class="ruby-identifier">headers</span>)
843
+ <span class="ruby-keyword kw">end</span>
844
+ </pre>
845
+ </div>
621
846
  </div>
622
847
  </div>
623
848
 
624
- <div id="method-M000069" class="method-detail">
625
- <a name="M000069"></a>
849
+ <div id="method-M000076" class="method-detail">
850
+ <a name="M000076"></a>
626
851
 
627
852
  <div class="method-heading">
628
- <a href="Store.src/M000069.html" target="Code" class="method-signature"
629
- onclick="popupCode('Store.src/M000069.html');return false;">
853
+ <a href="#M000076" class="method-signature">
630
854
  <span class="method-name">put_query_profile</span><span class="method-args">(data)</span>
631
855
  </a>
632
856
  </div>
@@ -643,82 +867,51 @@ function
643
867
 
644
868
  </td></tr>
645
869
  </table>
870
+ <p><a class="source-toggle" href="#"
871
+ onclick="toggleCode('M000076-source');return false;">[Source]</a></p>
872
+ <div class="method-source-code" id="M000076-source">
873
+ <pre>
874
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 423</span>
875
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">put_query_profile</span>(<span class="ruby-identifier">data</span>)
876
+ <span class="ruby-identifier">u</span> = <span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">&quot;/config/queryprofiles/1&quot;</span>)
877
+ <span class="ruby-identifier">headers</span> = {<span class="ruby-value str">&quot;Content-Type&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;application/rdf+xml&quot;</span>}
878
+ <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">put</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">data</span>, <span class="ruby-identifier">headers</span>)
879
+ <span class="ruby-keyword kw">end</span>
880
+ </pre>
881
+ </div>
646
882
  </div>
647
883
  </div>
648
884
 
649
- <div id="method-M000054" class="method-detail">
650
- <a name="M000054"></a>
885
+ <div id="method-M000064" class="method-detail">
886
+ <a name="M000064"></a>
651
887
 
652
888
  <div class="method-heading">
653
- <a href="Store.src/M000054.html" target="Code" class="method-signature"
654
- onclick="popupCode('Store.src/M000054.html');return false;">
889
+ <a href="#M000064" class="method-signature">
655
890
  <span class="method-name">record_etags</span><span class="method-args">(u, etags, response)</span>
656
891
  </a>
657
892
  </div>
658
893
 
659
894
  <div class="method-description">
895
+ <p><a class="source-toggle" href="#"
896
+ onclick="toggleCode('M000064-source');return false;">[Source]</a></p>
897
+ <div class="method-source-code" id="M000064-source">
898
+ <pre>
899
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 272</span>
900
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">record_etags</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">etags</span>, <span class="ruby-identifier">response</span>)
901
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">etags</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span> = <span class="ruby-value">200</span>)
902
+ <span class="ruby-identifier">etags</span>.<span class="ruby-identifier">add_from_response</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">response</span>)
903
+ <span class="ruby-keyword kw">end</span>
904
+ <span class="ruby-keyword kw">end</span>
905
+ </pre>
906
+ </div>
660
907
  </div>
661
908
  </div>
662
909
 
663
- <div id="method-M000060" class="method-detail">
664
- <a name="M000060"></a>
665
-
666
- <div class="method-heading">
667
- <a href="Store.src/M000060.html" target="Code" class="method-signature"
668
- onclick="popupCode('Store.src/M000060.html');return false;">
669
- <span class="method-name">reindex</span><span class="method-args">(t=Time.now)</span>
670
- </a>
671
- </div>
672
-
673
- <div class="method-description">
674
- </div>
675
- </div>
676
-
677
- <div id="method-M000059" class="method-detail">
678
- <a name="M000059"></a>
679
-
680
- <div class="method-heading">
681
- <a href="Store.src/M000059.html" target="Code" class="method-signature"
682
- onclick="popupCode('Store.src/M000059.html');return false;">
683
- <span class="method-name">reset</span><span class="method-args">(t=Time.now)</span>
684
- </a>
685
- </div>
686
-
687
- <div class="method-description">
688
- </div>
689
- </div>
690
-
691
- <div id="method-M000062" class="method-detail">
692
- <a name="M000062"></a>
693
-
694
- <div class="method-heading">
695
- <a href="Store.src/M000062.html" target="Code" class="method-signature"
696
- onclick="popupCode('Store.src/M000062.html');return false;">
697
- <span class="method-name">restore</span><span class="method-args">(snapshot_url, t=Time.now)</span>
698
- </a>
699
- </div>
700
-
701
- <div class="method-description">
702
- <p>
703
- Restore this store from a previously generated <a
704
- href="Snapshot.html">Snapshot</a> The Platform can <a
705
- href="Store.html#M000062">restore</a> from any <a
706
- href="Store.html#M000061">snapshot</a> that is web-accessible
707
- </p>
708
- <table>
709
- <tr><td valign="top">snapshot_url:</td><td>the URL of the <a href="Store.html#M000061">snapshot</a>
710
-
711
- </td></tr>
712
- </table>
713
- </div>
714
- </div>
715
-
716
- <div id="method-M000048" class="method-detail">
717
- <a name="M000048"></a>
910
+ <div id="method-M000058" class="method-detail">
911
+ <a name="M000058"></a>
718
912
 
719
913
  <div class="method-heading">
720
- <a href="Store.src/M000048.html" target="Code" class="method-signature"
721
- onclick="popupCode('Store.src/M000048.html');return false;">
914
+ <a href="#M000058" class="method-signature">
722
915
  <span class="method-name">search</span><span class="method-args">(query, params=nil)</span>
723
916
  </a>
724
917
  </div>
@@ -764,15 +957,28 @@ to the Platform. These parameters will only be used when an XSLT
764
957
  transformation is being applied, in which case they will be provided as
765
958
  parameters to the stylesheet.
766
959
  </p>
960
+ <p><a class="source-toggle" href="#"
961
+ onclick="toggleCode('M000058-source');return false;">[Source]</a></p>
962
+ <div class="method-source-code" id="M000058-source">
963
+ <pre>
964
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 203</span>
965
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">search</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">params</span>=<span class="ruby-keyword kw">nil</span>)
966
+ <span class="ruby-identifier">u</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">&quot;/items&quot;</span>)
967
+ <span class="ruby-identifier">search_params</span> = <span class="ruby-identifier">get_search_params</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">query</span>, <span class="ruby-identifier">params</span>)
968
+ <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">search_params</span>, <span class="ruby-keyword kw">nil</span>)
969
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
970
+
971
+ <span class="ruby-keyword kw">end</span>
972
+ </pre>
973
+ </div>
767
974
  </div>
768
975
  </div>
769
976
 
770
- <div id="method-M000037" class="method-detail">
771
- <a name="M000037"></a>
977
+ <div id="method-M000047" class="method-detail">
978
+ <a name="M000047"></a>
772
979
 
773
980
  <div class="method-heading">
774
- <a href="Store.src/M000037.html" target="Code" class="method-signature"
775
- onclick="popupCode('Store.src/M000037.html');return false;">
981
+ <a href="#M000047" class="method-signature">
776
982
  <span class="method-name">set_credentials</span><span class="method-args">(username, password)</span>
777
983
  </a>
778
984
  </div>
@@ -789,30 +995,25 @@ Set credentials that this store will use when carrying out authorization
789
995
 
790
996
  </td></tr>
791
997
  </table>
998
+ <p><a class="source-toggle" href="#"
999
+ onclick="toggleCode('M000047-source');return false;">[Source]</a></p>
1000
+ <div class="method-source-code" id="M000047-source">
1001
+ <pre>
1002
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 57</span>
1003
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_credentials</span>(<span class="ruby-identifier">username</span>, <span class="ruby-identifier">password</span>)
1004
+ <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">set_auth</span>(<span class="ruby-ivar">@storeuri</span>, <span class="ruby-identifier">username</span>, <span class="ruby-identifier">password</span>)
1005
+ <span class="ruby-keyword kw">end</span>
1006
+ </pre>
1007
+ </div>
792
1008
  </div>
793
1009
  </div>
794
1010
 
795
- <div id="method-M000061" class="method-detail">
796
- <a name="M000061"></a>
797
-
798
- <div class="method-heading">
799
- <a href="Store.src/M000061.html" target="Code" class="method-signature"
800
- onclick="popupCode('Store.src/M000061.html');return false;">
801
- <span class="method-name">snapshot</span><span class="method-args">(t=Time.now)</span>
802
- </a>
803
- </div>
804
-
805
- <div class="method-description">
806
- </div>
807
- </div>
808
-
809
- <div id="method-M000047" class="method-detail">
810
- <a name="M000047"></a>
1011
+ <div id="method-M000057" class="method-detail">
1012
+ <a name="M000057"></a>
811
1013
 
812
1014
  <div class="method-heading">
813
- <a href="Store.src/M000047.html" target="Code" class="method-signature"
814
- onclick="popupCode('Store.src/M000047.html');return false;">
815
- <span class="method-name">sparql</span><span class="method-args">(query, format)</span>
1015
+ <a href="#M000057" class="method-signature">
1016
+ <span class="method-name">sparql</span><span class="method-args">(query, format=nil)</span>
816
1017
  </a>
817
1018
  </div>
818
1019
 
@@ -824,15 +1025,31 @@ Perform a SPARQL query
824
1025
  query:: the SPARQL query
825
1026
  format:: the preferred response format
826
1027
  </pre>
1028
+ <p><a class="source-toggle" href="#"
1029
+ onclick="toggleCode('M000057-source');return false;">[Source]</a></p>
1030
+ <div class="method-source-code" id="M000057-source">
1031
+ <pre>
1032
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 177</span>
1033
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sparql</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>=<span class="ruby-keyword kw">nil</span>)
1034
+ <span class="ruby-identifier">u</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">&quot;/services/sparql&quot;</span>)
1035
+ <span class="ruby-identifier">params</span> = {}
1036
+ <span class="ruby-identifier">params</span>[<span class="ruby-value str">&quot;query&quot;</span>] = <span class="ruby-identifier">query</span>
1037
+ <span class="ruby-identifier">headers</span> = {}
1038
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">format</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
1039
+ <span class="ruby-identifier">headers</span>[<span class="ruby-value str">&quot;Accept&quot;</span>] = <span class="ruby-identifier">format</span>
1040
+ <span class="ruby-keyword kw">end</span>
1041
+ <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">params</span>, <span class="ruby-identifier">headers</span>)
1042
+ <span class="ruby-keyword kw">end</span>
1043
+ </pre>
1044
+ </div>
827
1045
  </div>
828
1046
  </div>
829
1047
 
830
- <div id="method-M000045" class="method-detail">
831
- <a name="M000045"></a>
1048
+ <div id="method-M000055" class="method-detail">
1049
+ <a name="M000055"></a>
832
1050
 
833
1051
  <div class="method-heading">
834
- <a href="Store.src/M000045.html" target="Code" class="method-signature"
835
- onclick="popupCode('Store.src/M000045.html');return false;">
1052
+ <a href="#M000055" class="method-signature">
836
1053
  <span class="method-name">sparql_ask</span><span class="method-args">(query, format=&quot;application/sparql-results+xml&quot;)</span>
837
1054
  </a>
838
1055
  </div>
@@ -845,15 +1062,24 @@ Perform a SPARQL ASK query.
845
1062
  query:: the SPARQL query
846
1063
  format:: the preferred response format
847
1064
  </pre>
1065
+ <p><a class="source-toggle" href="#"
1066
+ onclick="toggleCode('M000055-source');return false;">[Source]</a></p>
1067
+ <div class="method-source-code" id="M000055-source">
1068
+ <pre>
1069
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 161</span>
1070
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sparql_ask</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>=<span class="ruby-value str">&quot;application/sparql-results+xml&quot;</span>)
1071
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">sparql</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>)
1072
+ <span class="ruby-keyword kw">end</span>
1073
+ </pre>
1074
+ </div>
848
1075
  </div>
849
1076
  </div>
850
1077
 
851
- <div id="method-M000044" class="method-detail">
852
- <a name="M000044"></a>
1078
+ <div id="method-M000054" class="method-detail">
1079
+ <a name="M000054"></a>
853
1080
 
854
1081
  <div class="method-heading">
855
- <a href="Store.src/M000044.html" target="Code" class="method-signature"
856
- onclick="popupCode('Store.src/M000044.html');return false;">
1082
+ <a href="#M000054" class="method-signature">
857
1083
  <span class="method-name">sparql_construct</span><span class="method-args">(query, format=&quot;application/rdf+xml&quot;)</span>
858
1084
  </a>
859
1085
  </div>
@@ -866,15 +1092,24 @@ Perform a SPARQL CONSTRUCT query.
866
1092
  query:: the SPARQL query
867
1093
  format:: the preferred response format
868
1094
  </pre>
1095
+ <p><a class="source-toggle" href="#"
1096
+ onclick="toggleCode('M000054-source');return false;">[Source]</a></p>
1097
+ <div class="method-source-code" id="M000054-source">
1098
+ <pre>
1099
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 153</span>
1100
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sparql_construct</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>=<span class="ruby-value str">&quot;application/rdf+xml&quot;</span>)
1101
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">sparql</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>)
1102
+ <span class="ruby-keyword kw">end</span>
1103
+ </pre>
1104
+ </div>
869
1105
  </div>
870
1106
  </div>
871
1107
 
872
- <div id="method-M000043" class="method-detail">
873
- <a name="M000043"></a>
1108
+ <div id="method-M000053" class="method-detail">
1109
+ <a name="M000053"></a>
874
1110
 
875
1111
  <div class="method-heading">
876
- <a href="Store.src/M000043.html" target="Code" class="method-signature"
877
- onclick="popupCode('Store.src/M000043.html');return false;">
1112
+ <a href="#M000053" class="method-signature">
878
1113
  <span class="method-name">sparql_describe</span><span class="method-args">(query, format=&quot;application/rdf+xml&quot;)</span>
879
1114
  </a>
880
1115
  </div>
@@ -887,15 +1122,24 @@ Perform a SPARQL DESCRIBE query.
887
1122
  query:: the SPARQL query
888
1123
  format:: the preferred response format
889
1124
  </pre>
1125
+ <p><a class="source-toggle" href="#"
1126
+ onclick="toggleCode('M000053-source');return false;">[Source]</a></p>
1127
+ <div class="method-source-code" id="M000053-source">
1128
+ <pre>
1129
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 145</span>
1130
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sparql_describe</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>=<span class="ruby-value str">&quot;application/rdf+xml&quot;</span>)
1131
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">sparql</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>)
1132
+ <span class="ruby-keyword kw">end</span>
1133
+ </pre>
1134
+ </div>
890
1135
  </div>
891
1136
  </div>
892
1137
 
893
- <div id="method-M000046" class="method-detail">
894
- <a name="M000046"></a>
1138
+ <div id="method-M000056" class="method-detail">
1139
+ <a name="M000056"></a>
895
1140
 
896
1141
  <div class="method-heading">
897
- <a href="Store.src/M000046.html" target="Code" class="method-signature"
898
- onclick="popupCode('Store.src/M000046.html');return false;">
1142
+ <a href="#M000056" class="method-signature">
899
1143
  <span class="method-name">sparql_select</span><span class="method-args">(query, format=&quot;application/sparql-results+xml&quot;)</span>
900
1144
  </a>
901
1145
  </div>
@@ -908,15 +1152,24 @@ Perform a SPARQL SELECT query.
908
1152
  query:: the SPARQL query
909
1153
  format:: the preferred response format
910
1154
  </pre>
1155
+ <p><a class="source-toggle" href="#"
1156
+ onclick="toggleCode('M000056-source');return false;">[Source]</a></p>
1157
+ <div class="method-source-code" id="M000056-source">
1158
+ <pre>
1159
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 169</span>
1160
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sparql_select</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>=<span class="ruby-value str">&quot;application/sparql-results+xml&quot;</span>)
1161
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">sparql</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>)
1162
+ <span class="ruby-keyword kw">end</span>
1163
+ </pre>
1164
+ </div>
911
1165
  </div>
912
1166
  </div>
913
1167
 
914
- <div id="method-M000039" class="method-detail">
915
- <a name="M000039"></a>
1168
+ <div id="method-M000049" class="method-detail">
1169
+ <a name="M000049"></a>
916
1170
 
917
1171
  <div class="method-heading">
918
- <a href="Store.src/M000039.html" target="Code" class="method-signature"
919
- onclick="popupCode('Store.src/M000039.html');return false;">
1172
+ <a href="#M000049" class="method-signature">
920
1173
  <span class="method-name">store_data</span><span class="method-args">(data)</span>
921
1174
  </a>
922
1175
  </div>
@@ -931,15 +1184,26 @@ store
931
1184
 
932
1185
  </td></tr>
933
1186
  </table>
1187
+ <p><a class="source-toggle" href="#"
1188
+ onclick="toggleCode('M000049-source');return false;">[Source]</a></p>
1189
+ <div class="method-source-code" id="M000049-source">
1190
+ <pre>
1191
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 80</span>
1192
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">store_data</span>(<span class="ruby-identifier">data</span>)
1193
+ <span class="ruby-identifier">u</span> = <span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">&quot;/meta&quot;</span>)
1194
+ <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">post</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">data</span>, <span class="ruby-constant">RDF_XML</span> )
1195
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
1196
+ <span class="ruby-keyword kw">end</span>
1197
+ </pre>
1198
+ </div>
934
1199
  </div>
935
1200
  </div>
936
1201
 
937
- <div id="method-M000040" class="method-detail">
938
- <a name="M000040"></a>
1202
+ <div id="method-M000050" class="method-detail">
1203
+ <a name="M000050"></a>
939
1204
 
940
1205
  <div class="method-heading">
941
- <a href="Store.src/M000040.html" target="Code" class="method-signature"
942
- onclick="popupCode('Store.src/M000040.html');return false;">
1206
+ <a href="#M000050" class="method-signature">
943
1207
  <span class="method-name">store_file</span><span class="method-args">(file)</span>
944
1208
  </a>
945
1209
  </div>
@@ -956,15 +1220,26 @@ is submitted to the platform
956
1220
 
957
1221
  </td></tr>
958
1222
  </table>
1223
+ <p><a class="source-toggle" href="#"
1224
+ onclick="toggleCode('M000050-source');return false;">[Source]</a></p>
1225
+ <div class="method-source-code" id="M000050-source">
1226
+ <pre>
1227
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 89</span>
1228
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">store_file</span>(<span class="ruby-identifier">file</span>)
1229
+ <span class="ruby-identifier">data</span> = <span class="ruby-identifier">file</span>.<span class="ruby-identifier">read</span>()
1230
+ <span class="ruby-identifier">file</span>.<span class="ruby-identifier">close</span>()
1231
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">store_data</span>(<span class="ruby-identifier">data</span>)
1232
+ <span class="ruby-keyword kw">end</span>
1233
+ </pre>
1234
+ </div>
959
1235
  </div>
960
1236
  </div>
961
1237
 
962
- <div id="method-M000041" class="method-detail">
963
- <a name="M000041"></a>
1238
+ <div id="method-M000051" class="method-detail">
1239
+ <a name="M000051"></a>
964
1240
 
965
1241
  <div class="method-heading">
966
- <a href="Store.src/M000041.html" target="Code" class="method-signature"
967
- onclick="popupCode('Store.src/M000041.html');return false;">
1242
+ <a href="#M000051" class="method-signature">
968
1243
  <span class="method-name">store_url</span><span class="method-args">(u, parameters=nil)</span>
969
1244
  </a>
970
1245
  </div>
@@ -988,29 +1263,68 @@ URL
988
1263
 
989
1264
  </td></tr>
990
1265
  </table>
1266
+ <p><a class="source-toggle" href="#"
1267
+ onclick="toggleCode('M000051-source');return false;">[Source]</a></p>
1268
+ <div class="method-source-code" id="M000051-source">
1269
+ <pre>
1270
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 102</span>
1271
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">store_url</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">parameters</span>=<span class="ruby-keyword kw">nil</span>)
1272
+
1273
+ <span class="ruby-identifier">headers</span> = <span class="ruby-constant">ACCEPT_RDF</span>.<span class="ruby-identifier">clone</span>()
1274
+ <span class="ruby-identifier">dataresp</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">parameters</span>, <span class="ruby-identifier">headers</span> )
1275
+
1276
+ <span class="ruby-comment cmt">#TODO make this more robust</span>
1277
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">dataresp</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">!=</span> <span class="ruby-value">200</span>
1278
+ <span class="ruby-identifier">throw</span>
1279
+ <span class="ruby-keyword kw">end</span>
1280
+
1281
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">store_data</span>(<span class="ruby-identifier">dataresp</span>.<span class="ruby-identifier">content</span>)
1282
+
1283
+ <span class="ruby-keyword kw">end</span>
1284
+ </pre>
1285
+ </div>
991
1286
  </div>
992
1287
  </div>
993
1288
 
994
- <div id="method-M000063" class="method-detail">
995
- <a name="M000063"></a>
1289
+ <div id="method-M000070" class="method-detail">
1290
+ <a name="M000070"></a>
996
1291
 
997
1292
  <div class="method-heading">
998
- <a href="Store.src/M000063.html" target="Code" class="method-signature"
999
- onclick="popupCode('Store.src/M000063.html');return false;">
1000
- <span class="method-name">submit_job</span><span class="method-args">(joburi, label, t=Time.now)</span>
1293
+ <a href="#M000070" class="method-signature">
1294
+ <span class="method-name">submit_job</span><span class="method-args">(data)</span>
1001
1295
  </a>
1002
1296
  </div>
1003
1297
 
1004
1298
  <div class="method-description">
1299
+ <p>
1300
+ Submit a job to the platform.
1301
+ </p>
1302
+ <table>
1303
+ <tr><td valign="top">data:</td><td>RDF/XML representing the job request. See methods on <a
1304
+ href="Jobs.html">Jobs</a> class
1305
+
1306
+ </td></tr>
1307
+ </table>
1308
+ <p><a class="source-toggle" href="#"
1309
+ onclick="toggleCode('M000070-source');return false;">[Source]</a></p>
1310
+ <div class="method-source-code" id="M000070-source">
1311
+ <pre>
1312
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 357</span>
1313
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">submit_job</span>(<span class="ruby-identifier">data</span>)
1314
+ <span class="ruby-identifier">u</span> = <span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">&quot;/jobs&quot;</span>)
1315
+ <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">post</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">data</span>, <span class="ruby-constant">RDF_XML</span> )
1316
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
1317
+ <span class="ruby-keyword kw">end</span>
1318
+ </pre>
1319
+ </div>
1005
1320
  </div>
1006
1321
  </div>
1007
1322
 
1008
- <div id="method-M000055" class="method-detail">
1009
- <a name="M000055"></a>
1323
+ <div id="method-M000065" class="method-detail">
1324
+ <a name="M000065"></a>
1010
1325
 
1011
1326
  <div class="method-heading">
1012
- <a href="Store.src/M000055.html" target="Code" class="method-signature"
1013
- onclick="popupCode('Store.src/M000055.html');return false;">
1327
+ <a href="#M000065" class="method-signature">
1014
1328
  <span class="method-name">upload_item</span><span class="method-args">(f, mimetype, uri=nil)</span>
1015
1329
  </a>
1016
1330
  </div>
@@ -1037,6 +1351,28 @@ Created response with a Location header containing the URI of the newly
1037
1351
  stored item. If a URI is specified then a successful request will result in
1038
1352
  a 200 OK response.
1039
1353
  </p>
1354
+ <p><a class="source-toggle" href="#"
1355
+ onclick="toggleCode('M000065-source');return false;">[Source]</a></p>
1356
+ <div class="method-source-code" id="M000065-source">
1357
+ <pre>
1358
+ <span class="ruby-comment cmt"># File lib/pho/store.rb, line 291</span>
1359
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">upload_item</span>(<span class="ruby-identifier">f</span>, <span class="ruby-identifier">mimetype</span>, <span class="ruby-identifier">uri</span>=<span class="ruby-keyword kw">nil</span>)
1360
+ <span class="ruby-identifier">data</span> = <span class="ruby-identifier">f</span>.<span class="ruby-identifier">read</span>()
1361
+ <span class="ruby-identifier">f</span>.<span class="ruby-identifier">close</span>()
1362
+ <span class="ruby-identifier">headers</span> = {<span class="ruby-value str">&quot;Content-Type&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">mimetype</span>}
1363
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
1364
+ <span class="ruby-identifier">u</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">&quot;/items&quot;</span>)
1365
+ <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">post</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">data</span>, <span class="ruby-identifier">headers</span>)
1366
+ <span class="ruby-keyword kw">else</span>
1367
+ <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">uri</span>.<span class="ruby-identifier">start_with?</span>(<span class="ruby-ivar">@storeuri</span>)
1368
+ <span class="ruby-identifier">uri</span> = <span class="ruby-identifier">build_uri</span>(<span class="ruby-identifier">uri</span>)
1369
+ <span class="ruby-keyword kw">end</span>
1370
+ <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">put</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">data</span>, <span class="ruby-identifier">headers</span>)
1371
+ <span class="ruby-keyword kw">end</span>
1372
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
1373
+ <span class="ruby-keyword kw">end</span>
1374
+ </pre>
1375
+ </div>
1040
1376
  </div>
1041
1377
  </div>
1042
1378