pho 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. data/CHANGES +5 -0
  2. data/Rakefile +1 -1
  3. data/lib/pho/snapshot.rb +6 -1
  4. data/lib/pho/sparql.rb +4 -1
  5. data/tests/tc_snapshots.rb +14 -1
  6. data/tests/tc_sparql_helper.rb +23 -0
  7. metadata +60 -160
  8. data/doc/rdoc/classes/Pho/Analyzers.html +0 -310
  9. data/doc/rdoc/classes/Pho/CommandLine.html +0 -770
  10. data/doc/rdoc/classes/Pho/DatatypeProperty.html +0 -241
  11. data/doc/rdoc/classes/Pho/Enrichment/StoreEnricher.html +0 -410
  12. data/doc/rdoc/classes/Pho/Enrichment.html +0 -119
  13. data/doc/rdoc/classes/Pho/Etags.html +0 -310
  14. data/doc/rdoc/classes/Pho/Facet/Results.html +0 -299
  15. data/doc/rdoc/classes/Pho/Facet/Term.html +0 -177
  16. data/doc/rdoc/classes/Pho/Facet.html +0 -119
  17. data/doc/rdoc/classes/Pho/FieldPredicateMap.html +0 -668
  18. data/doc/rdoc/classes/Pho/FieldWeighting.html +0 -230
  19. data/doc/rdoc/classes/Pho/FileManagement/AbstractFileManager.html +0 -478
  20. data/doc/rdoc/classes/Pho/FileManagement/FileManager.html +0 -264
  21. data/doc/rdoc/classes/Pho/FileManagement/RDFManager.html +0 -259
  22. data/doc/rdoc/classes/Pho/FileManagement.html +0 -121
  23. data/doc/rdoc/classes/Pho/Job.html +0 -627
  24. data/doc/rdoc/classes/Pho/JobUpdate.html +0 -141
  25. data/doc/rdoc/classes/Pho/Jobs.html +0 -538
  26. data/doc/rdoc/classes/Pho/Namespaces.html +0 -164
  27. data/doc/rdoc/classes/Pho/OAI/Record.html +0 -165
  28. data/doc/rdoc/classes/Pho/OAI/Records.html +0 -331
  29. data/doc/rdoc/classes/Pho/OAI.html +0 -118
  30. data/doc/rdoc/classes/Pho/QueryProfile.html +0 -497
  31. data/doc/rdoc/classes/Pho/RDF/Parser.html +0 -279
  32. data/doc/rdoc/classes/Pho/RDF.html +0 -120
  33. data/doc/rdoc/classes/Pho/RDFCollection.html +0 -119
  34. data/doc/rdoc/classes/Pho/ResourceHash/Converter.html +0 -325
  35. data/doc/rdoc/classes/Pho/ResourceHash/SetAlgebra.html +0 -241
  36. data/doc/rdoc/classes/Pho/ResourceHash.html +0 -123
  37. data/doc/rdoc/classes/Pho/Snapshot.html +0 -397
  38. data/doc/rdoc/classes/Pho/Sparql/SparqlClient.html +0 -594
  39. data/doc/rdoc/classes/Pho/Sparql/SparqlHelper.html +0 -692
  40. data/doc/rdoc/classes/Pho/Sparql.html +0 -187
  41. data/doc/rdoc/classes/Pho/Status.html +0 -296
  42. data/doc/rdoc/classes/Pho/Store.html +0 -1560
  43. data/doc/rdoc/classes/Pho/StoreSparqlClient.html +0 -183
  44. data/doc/rdoc/classes/Pho/Update/Changeset.html +0 -521
  45. data/doc/rdoc/classes/Pho/Update/ChangesetBuilder.html +0 -330
  46. data/doc/rdoc/classes/Pho/Update/ChangesetHelper.html +0 -159
  47. data/doc/rdoc/classes/Pho/Update/Changesets.html +0 -205
  48. data/doc/rdoc/classes/Pho/Update/LiteralStatement.html +0 -257
  49. data/doc/rdoc/classes/Pho/Update/ResourceStatement.html +0 -237
  50. data/doc/rdoc/classes/Pho/Update/Statement.html +0 -303
  51. data/doc/rdoc/classes/Pho/Update.html +0 -128
  52. data/doc/rdoc/classes/Pho.html +0 -283
  53. data/doc/rdoc/classes/String.html +0 -146
  54. data/doc/rdoc/created.rid +0 -1
  55. data/doc/rdoc/files/CHANGES.html +0 -351
  56. data/doc/rdoc/files/README.html +0 -191
  57. data/doc/rdoc/files/lib/pho/changeset_builder_rb.html +0 -108
  58. data/doc/rdoc/files/lib/pho/changeset_rb.html +0 -108
  59. data/doc/rdoc/files/lib/pho/command_line_rb.html +0 -101
  60. data/doc/rdoc/files/lib/pho/converter_rb.html +0 -108
  61. data/doc/rdoc/files/lib/pho/enrichment_rb.html +0 -101
  62. data/doc/rdoc/files/lib/pho/etags_rb.html +0 -108
  63. data/doc/rdoc/files/lib/pho/facet_rb.html +0 -101
  64. data/doc/rdoc/files/lib/pho/field_predicate_map_rb.html +0 -101
  65. data/doc/rdoc/files/lib/pho/file_management_rb.html +0 -101
  66. data/doc/rdoc/files/lib/pho/file_manager_rb.html +0 -108
  67. data/doc/rdoc/files/lib/pho/job_rb.html +0 -101
  68. data/doc/rdoc/files/lib/pho/oai_rb.html +0 -101
  69. data/doc/rdoc/files/lib/pho/query_profile_rb.html +0 -101
  70. data/doc/rdoc/files/lib/pho/rdf_collection_rb.html +0 -101
  71. data/doc/rdoc/files/lib/pho/rdf_rb.html +0 -108
  72. data/doc/rdoc/files/lib/pho/resource_hash_rb.html +0 -101
  73. data/doc/rdoc/files/lib/pho/snapshot_rb.html +0 -109
  74. data/doc/rdoc/files/lib/pho/sparql_rb.html +0 -101
  75. data/doc/rdoc/files/lib/pho/status_rb.html +0 -101
  76. data/doc/rdoc/files/lib/pho/store_rb.html +0 -108
  77. data/doc/rdoc/files/lib/pho_rb.html +0 -133
  78. data/doc/rdoc/fr_class_index.html +0 -72
  79. data/doc/rdoc/fr_file_index.html +0 -49
  80. data/doc/rdoc/fr_method_index.html +0 -237
  81. data/doc/rdoc/index.html +0 -24
  82. data/doc/rdoc/rdoc-style.css +0 -208
@@ -1,770 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Class: Pho::CommandLine</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Class</strong></td>
53
- <td class="class-name-in-header">Pho::CommandLine</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../../files/lib/pho/command_line_rb.html">
59
- lib/pho/command_line.rb
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- <tr class="top-aligned-row">
66
- <td><strong>Parent:</strong></td>
67
- <td>
68
- Object
69
- </td>
70
- </tr>
71
- </table>
72
- </div>
73
- <!-- banner header -->
74
-
75
- <div id="bodyContent">
76
-
77
-
78
-
79
- <div id="contextContent">
80
-
81
- <div id="description">
82
- <p>
83
- Class that implements the command-line behaviour
84
- </p>
85
-
86
- </div>
87
-
88
-
89
- </div>
90
-
91
- <div id="method-list">
92
- <h3 class="section-bar">Methods</h3>
93
-
94
- <div class="name-list">
95
- <a href="#M000129">add_mapping</a>&nbsp;&nbsp;
96
- <a href="#M000130">add_weight</a>&nbsp;&nbsp;
97
- <a href="#M000118">backup</a>&nbsp;&nbsp;
98
- <a href="#M000123">describe</a>&nbsp;&nbsp;
99
- <a href="#M000127">fpmap</a>&nbsp;&nbsp;
100
- <a href="#M000113">new</a>&nbsp;&nbsp;
101
- <a href="#M000115">password</a>&nbsp;&nbsp;
102
- <a href="#M000128">queryprofile</a>&nbsp;&nbsp;
103
- <a href="#M000120">reindex</a>&nbsp;&nbsp;
104
- <a href="#M000121">reset</a>&nbsp;&nbsp;
105
- <a href="#M000122">restore</a>&nbsp;&nbsp;
106
- <a href="#M000119">snapshot</a>&nbsp;&nbsp;
107
- <a href="#M000124">sparql</a>&nbsp;&nbsp;
108
- <a href="#M000117">status</a>&nbsp;&nbsp;
109
- <a href="#M000125">store</a>&nbsp;&nbsp;
110
- <a href="#M000116">storename</a>&nbsp;&nbsp;
111
- <a href="#M000126">upload</a>&nbsp;&nbsp;
112
- <a href="#M000114">username</a>&nbsp;&nbsp;
113
- </div>
114
- </div>
115
-
116
- </div>
117
-
118
-
119
- <!-- if includes -->
120
-
121
- <div id="section">
122
-
123
-
124
-
125
-
126
-
127
-
128
-
129
-
130
- <!-- if method_list -->
131
- <div id="methods">
132
- <h3 class="section-bar">Public Class methods</h3>
133
-
134
- <div id="method-M000113" class="method-detail">
135
- <a name="M000113"></a>
136
-
137
- <div class="method-heading">
138
- <a href="#M000113" class="method-signature">
139
- <span class="method-name">new</span><span class="method-args">(opts, env, store=nil)</span>
140
- </a>
141
- </div>
142
-
143
- <div class="method-description">
144
- <p><a class="source-toggle" href="#"
145
- onclick="toggleCode('M000113-source');return false;">[Source]</a></p>
146
- <div class="method-source-code" id="M000113-source">
147
- <pre>
148
- <span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 6</span>
149
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">opts</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">store</span>=<span class="ruby-keyword kw">nil</span>)
150
- <span class="ruby-ivar">@opts</span> = <span class="ruby-identifier">opts</span>
151
- <span class="ruby-ivar">@env</span> = <span class="ruby-identifier">env</span>
152
-
153
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">username</span>() <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
154
- <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;no &lt;username&gt;&quot;</span>
155
- <span class="ruby-keyword kw">end</span>
156
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">password</span>() <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
157
- <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;no &lt;password&gt;&quot;</span>
158
- <span class="ruby-keyword kw">end</span>
159
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">storename</span>() <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">store</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
160
- <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;no &lt;store&gt;&quot;</span>
161
- <span class="ruby-keyword kw">end</span>
162
-
163
- <span class="ruby-ivar">@store</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Store</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">storename</span>(), <span class="ruby-identifier">username</span>(), <span class="ruby-identifier">password</span>()) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">store</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
164
- <span class="ruby-ivar">@store</span> = <span class="ruby-identifier">store</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">store</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
165
-
166
- <span class="ruby-keyword kw">end</span>
167
- </pre>
168
- </div>
169
- </div>
170
- </div>
171
-
172
- <h3 class="section-bar">Public Instance methods</h3>
173
-
174
- <div id="method-M000129" class="method-detail">
175
- <a name="M000129"></a>
176
-
177
- <div class="method-heading">
178
- <a href="#M000129" class="method-signature">
179
- <span class="method-name">add_mapping</span><span class="method-args">(out=$stdout)</span>
180
- </a>
181
- </div>
182
-
183
- <div class="method-description">
184
- <p><a class="source-toggle" href="#"
185
- onclick="toggleCode('M000129-source');return false;">[Source]</a></p>
186
- <div class="method-source-code" id="M000129-source">
187
- <pre>
188
- <span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 252</span>
189
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_mapping</span>(<span class="ruby-identifier">out</span>=<span class="ruby-identifier">$stdout</span>)
190
- <span class="ruby-identifier">fpmap</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">FieldPredicateMap</span>.<span class="ruby-identifier">read_from_store</span>(<span class="ruby-ivar">@store</span>)
191
- <span class="ruby-identifier">mapping</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">FieldPredicateMap</span>.<span class="ruby-identifier">create_mapping</span>(<span class="ruby-ivar">@store</span>, <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;predicate&quot;</span>], <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;field&quot;</span>], <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;analyzer&quot;</span>])
192
-
193
- <span class="ruby-identifier">removed</span> = <span class="ruby-identifier">fpmap</span>.<span class="ruby-identifier">remove_by_name</span>(<span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;field&quot;</span>])
194
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">removed</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
195
- <span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span>(<span class="ruby-node">&quot;Replacing mapping for #{@opts[&quot;field&quot;]}&quot;</span>)
196
- <span class="ruby-keyword kw">end</span>
197
- <span class="ruby-identifier">fpmap</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">mapping</span>
198
- <span class="ruby-identifier">resp</span> = <span class="ruby-identifier">fpmap</span>.<span class="ruby-identifier">upload</span>(<span class="ruby-ivar">@store</span>)
199
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">!=</span> <span class="ruby-value">200</span>
200
- <span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Unable to update FieldPredicate map in store. Response code was #{resp.status}&quot;</span>
201
- <span class="ruby-keyword kw">else</span>
202
- <span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;FieldPredicate map successfully updated&quot;</span>
203
- <span class="ruby-keyword kw">end</span>
204
- <span class="ruby-keyword kw">end</span>
205
- </pre>
206
- </div>
207
- </div>
208
- </div>
209
-
210
- <div id="method-M000130" class="method-detail">
211
- <a name="M000130"></a>
212
-
213
- <div class="method-heading">
214
- <a href="#M000130" class="method-signature">
215
- <span class="method-name">add_weight</span><span class="method-args">(out=$stdout)</span>
216
- </a>
217
- </div>
218
-
219
- <div class="method-description">
220
- <p><a class="source-toggle" href="#"
221
- onclick="toggleCode('M000130-source');return false;">[Source]</a></p>
222
- <div class="method-source-code" id="M000130-source">
223
- <pre>
224
- <span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 269</span>
225
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_weight</span>(<span class="ruby-identifier">out</span>=<span class="ruby-identifier">$stdout</span>)
226
- <span class="ruby-identifier">qp</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">QueryProfile</span>.<span class="ruby-identifier">read_from_store</span>(<span class="ruby-ivar">@store</span>)
227
- <span class="ruby-identifier">weight</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">QueryProfile</span>.<span class="ruby-identifier">create_weighting</span>(<span class="ruby-ivar">@store</span>, <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;field&quot;</span>], <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;weight&quot;</span>])
228
-
229
- <span class="ruby-identifier">removed</span> = <span class="ruby-identifier">qp</span>.<span class="ruby-identifier">remove_by_name</span>( <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;field&quot;</span>] )
230
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">removed</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
231
- <span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span>(<span class="ruby-node">&quot;Replacing weighting for #{@opts[&quot;field&quot;]}&quot;</span>)
232
- <span class="ruby-keyword kw">end</span>
233
- <span class="ruby-identifier">qp</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">weight</span>
234
- <span class="ruby-identifier">resp</span> = <span class="ruby-identifier">qp</span>.<span class="ruby-identifier">upload</span>(<span class="ruby-ivar">@store</span>)
235
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">!=</span> <span class="ruby-value">200</span>
236
- <span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Unable to update QueryProfile in store. Response code was #{resp.status}&quot;</span>
237
- <span class="ruby-keyword kw">else</span>
238
- <span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;QueryProfile successfully updated&quot;</span>
239
- <span class="ruby-keyword kw">end</span>
240
- <span class="ruby-keyword kw">end</span>
241
- </pre>
242
- </div>
243
- </div>
244
- </div>
245
-
246
- <div id="method-M000118" class="method-detail">
247
- <a name="M000118"></a>
248
-
249
- <div class="method-heading">
250
- <a href="#M000118" class="method-signature">
251
- <span class="method-name">backup</span><span class="method-args">()</span>
252
- </a>
253
- </div>
254
-
255
- <div class="method-description">
256
- <p><a class="source-toggle" href="#"
257
- onclick="toggleCode('M000118-source');return false;">[Source]</a></p>
258
- <div class="method-source-code" id="M000118-source">
259
- <pre>
260
- <span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 52</span>
261
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">backup</span>()
262
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Submitting Snapshot Job to Store #{@store.storeuri}&quot;</span>
263
- <span class="ruby-identifier">resp</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Jobs</span>.<span class="ruby-identifier">submit_snapshot</span>(<span class="ruby-ivar">@store</span>, <span class="ruby-value str">&quot;Reindex&quot;</span>, <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>)
264
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Monitoring Snapshot Job: #{resp.header[&quot;Location&quot;].first}&quot;</span>
265
- <span class="ruby-identifier">job</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Jobs</span>.<span class="ruby-identifier">wait_for_submitted</span>(<span class="ruby-identifier">resp</span>, <span class="ruby-ivar">@store</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">job</span>, <span class="ruby-identifier">message</span>, <span class="ruby-identifier">time</span><span class="ruby-operator">|</span>
266
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{time} #{message}&quot;</span>
267
- <span class="ruby-keyword kw">end</span>
268
- <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;Job Completed&quot;</span>
269
- <span class="ruby-identifier">snapshot</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Snapshot</span>.<span class="ruby-identifier">read_from_store</span>(<span class="ruby-ivar">@store</span>)
270
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Retrieving #{snapshot.url}&quot;</span>
271
- <span class="ruby-identifier">dir</span> = <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;dir&quot;</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">tmpdir</span>
272
- <span class="ruby-identifier">snapshot</span>.<span class="ruby-identifier">backup</span>(<span class="ruby-ivar">@store</span>, <span class="ruby-identifier">dir</span>)
273
- <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;Download complete. MD5 OK.&quot;</span>
274
- <span class="ruby-keyword kw">end</span>
275
- </pre>
276
- </div>
277
- </div>
278
- </div>
279
-
280
- <div id="method-M000123" class="method-detail">
281
- <a name="M000123"></a>
282
-
283
- <div class="method-heading">
284
- <a href="#M000123" class="method-signature">
285
- <span class="method-name">describe</span><span class="method-args">()</span>
286
- </a>
287
- </div>
288
-
289
- <div class="method-description">
290
- <p><a class="source-toggle" href="#"
291
- onclick="toggleCode('M000123-source');return false;">[Source]</a></p>
292
- <div class="method-source-code" id="M000123-source">
293
- <pre>
294
- <span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 115</span>
295
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">describe</span>()
296
- <span class="ruby-identifier">resp</span> = <span class="ruby-ivar">@store</span>.<span class="ruby-identifier">describe</span>( <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;url&quot;</span>] )
297
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">200</span>
298
- <span class="ruby-identifier">puts</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">content</span>
299
- <span class="ruby-keyword kw">else</span>
300
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Error: #{resp.status} #{resp.reason}&quot;</span>
301
- <span class="ruby-identifier">puts</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">content</span>
302
- <span class="ruby-keyword kw">end</span>
303
- <span class="ruby-keyword kw">end</span>
304
- </pre>
305
- </div>
306
- </div>
307
- </div>
308
-
309
- <div id="method-M000127" class="method-detail">
310
- <a name="M000127"></a>
311
-
312
- <div class="method-heading">
313
- <a href="#M000127" class="method-signature">
314
- <span class="method-name">fpmap</span><span class="method-args">(out=$stdout)</span>
315
- </a>
316
- </div>
317
-
318
- <div class="method-description">
319
- <p><a class="source-toggle" href="#"
320
- onclick="toggleCode('M000127-source');return false;">[Source]</a></p>
321
- <div class="method-source-code" id="M000127-source">
322
- <pre>
323
- <span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 203</span>
324
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fpmap</span>(<span class="ruby-identifier">out</span>=<span class="ruby-identifier">$stdout</span>)
325
-
326
- <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;raw&quot;</span>]
327
- <span class="ruby-identifier">resp</span> = <span class="ruby-ivar">@store</span>.<span class="ruby-identifier">get_field_predicate_map</span>(<span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">ACCEPT_RDF</span>)
328
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">!=</span> <span class="ruby-value">200</span>
329
- <span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Unable to read Field Predicate Map from store. Response code was #{resp.status}&quot;</span>
330
- <span class="ruby-keyword kw">else</span>
331
- <span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">content</span>
332
- <span class="ruby-keyword kw">end</span>
333
- <span class="ruby-keyword kw">else</span>
334
- <span class="ruby-identifier">fpmap</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">FieldPredicateMap</span>.<span class="ruby-identifier">read_from_store</span>(<span class="ruby-ivar">@store</span>)
335
- <span class="ruby-identifier">mappings</span> = <span class="ruby-identifier">fpmap</span>.<span class="ruby-identifier">datatype_properties</span>.<span class="ruby-identifier">sort</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span>,<span class="ruby-identifier">y</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">y</span>.<span class="ruby-identifier">name</span> }
336
- <span class="ruby-identifier">mappings</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">mapping</span><span class="ruby-operator">|</span>
337
- <span class="ruby-identifier">analyzer</span> = <span class="ruby-identifier">mapping</span>.<span class="ruby-identifier">analyzer</span>
338
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">analyzer</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
339
- <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Analyzers</span>.<span class="ruby-identifier">constants</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span>
340
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">analyzer</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Analyzers</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">c</span>)
341
- <span class="ruby-identifier">analyzer</span> = <span class="ruby-identifier">c</span>
342
- <span class="ruby-keyword kw">end</span>
343
- <span class="ruby-keyword kw">end</span>
344
- <span class="ruby-keyword kw">end</span>
345
- <span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{mapping.name} -&gt; #{mapping.property_uri}&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">analyzer</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
346
- <span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{mapping.name} -&gt; #{mapping.property_uri} (#{mapping.analyzer})&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">analyzer</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
347
- <span class="ruby-keyword kw">end</span>
348
-
349
- <span class="ruby-keyword kw">end</span>
350
-
351
- <span class="ruby-keyword kw">end</span>
352
- </pre>
353
- </div>
354
- </div>
355
- </div>
356
-
357
- <div id="method-M000115" class="method-detail">
358
- <a name="M000115"></a>
359
-
360
- <div class="method-heading">
361
- <a href="#M000115" class="method-signature">
362
- <span class="method-name">password</span><span class="method-args">()</span>
363
- </a>
364
- </div>
365
-
366
- <div class="method-description">
367
- <p><a class="source-toggle" href="#"
368
- onclick="toggleCode('M000115-source');return false;">[Source]</a></p>
369
- <div class="method-source-code" id="M000115-source">
370
- <pre>
371
- <span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 31</span>
372
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">password</span>()
373
- <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;password&quot;</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;password&quot;</span>]
374
- <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value str">&quot;TALIS_PASS&quot;</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value str">&quot;TALIS_PASS&quot;</span>]
375
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
376
- <span class="ruby-keyword kw">end</span>
377
- </pre>
378
- </div>
379
- </div>
380
- </div>
381
-
382
- <div id="method-M000128" class="method-detail">
383
- <a name="M000128"></a>
384
-
385
- <div class="method-heading">
386
- <a href="#M000128" class="method-signature">
387
- <span class="method-name">queryprofile</span><span class="method-args">(out=$stdout)</span>
388
- </a>
389
- </div>
390
-
391
- <div class="method-description">
392
- <p><a class="source-toggle" href="#"
393
- onclick="toggleCode('M000128-source');return false;">[Source]</a></p>
394
- <div class="method-source-code" id="M000128-source">
395
- <pre>
396
- <span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 232</span>
397
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">queryprofile</span>(<span class="ruby-identifier">out</span>=<span class="ruby-identifier">$stdout</span>)
398
-
399
- <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;raw&quot;</span>]
400
- <span class="ruby-identifier">resp</span> = <span class="ruby-ivar">@store</span>.<span class="ruby-identifier">get_query_profile</span>(<span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">ACCEPT_RDF</span>)
401
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">!=</span> <span class="ruby-value">200</span>
402
- <span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Unable to read Query Profile from store. Response code was #{resp.status}&quot;</span>
403
- <span class="ruby-keyword kw">else</span>
404
- <span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">content</span>
405
- <span class="ruby-keyword kw">end</span>
406
- <span class="ruby-keyword kw">else</span>
407
- <span class="ruby-identifier">queryprofile</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">QueryProfile</span>.<span class="ruby-identifier">read_from_store</span>(<span class="ruby-ivar">@store</span>)
408
- <span class="ruby-identifier">field_weights</span> = <span class="ruby-identifier">queryprofile</span>.<span class="ruby-identifier">field_weights</span>()
409
- <span class="ruby-identifier">field_weights</span> = <span class="ruby-identifier">field_weights</span>.<span class="ruby-identifier">sort</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span>,<span class="ruby-identifier">y</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">y</span>.<span class="ruby-identifier">name</span> }
410
- <span class="ruby-identifier">field_weights</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">weighting</span><span class="ruby-operator">|</span>
411
- <span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{weighting.name} -&gt; #{weighting.weight}&quot;</span>
412
- <span class="ruby-keyword kw">end</span>
413
- <span class="ruby-keyword kw">end</span>
414
-
415
- <span class="ruby-keyword kw">end</span>
416
- </pre>
417
- </div>
418
- </div>
419
- </div>
420
-
421
- <div id="method-M000120" class="method-detail">
422
- <a name="M000120"></a>
423
-
424
- <div class="method-heading">
425
- <a href="#M000120" class="method-signature">
426
- <span class="method-name">reindex</span><span class="method-args">()</span>
427
- </a>
428
- </div>
429
-
430
- <div class="method-description">
431
- <p><a class="source-toggle" href="#"
432
- onclick="toggleCode('M000120-source');return false;">[Source]</a></p>
433
- <div class="method-source-code" id="M000120-source">
434
- <pre>
435
- <span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 77</span>
436
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reindex</span>()
437
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Submitting Reindex Job to Store #{@store.storeuri}&quot;</span>
438
- <span class="ruby-identifier">resp</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Jobs</span>.<span class="ruby-identifier">submit_reindex</span>(<span class="ruby-ivar">@store</span>, <span class="ruby-value str">&quot;Reindex&quot;</span>, <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>)
439
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">201</span>
440
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Monitoring Reindex Job: #{resp.header[&quot;Location&quot;].first}&quot;</span>
441
- <span class="ruby-keyword kw">end</span>
442
- <span class="ruby-identifier">job</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Jobs</span>.<span class="ruby-identifier">wait_for_submitted</span>(<span class="ruby-identifier">resp</span>, <span class="ruby-ivar">@store</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">job</span>, <span class="ruby-identifier">message</span>, <span class="ruby-identifier">time</span><span class="ruby-operator">|</span>
443
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{time} #{message}&quot;</span>
444
- <span class="ruby-keyword kw">end</span>
445
- <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;Reindex Completed&quot;</span>
446
- <span class="ruby-keyword kw">end</span>
447
- </pre>
448
- </div>
449
- </div>
450
- </div>
451
-
452
- <div id="method-M000121" class="method-detail">
453
- <a name="M000121"></a>
454
-
455
- <div class="method-heading">
456
- <a href="#M000121" class="method-signature">
457
- <span class="method-name">reset</span><span class="method-args">()</span>
458
- </a>
459
- </div>
460
-
461
- <div class="method-description">
462
- <p><a class="source-toggle" href="#"
463
- onclick="toggleCode('M000121-source');return false;">[Source]</a></p>
464
- <div class="method-source-code" id="M000121-source">
465
- <pre>
466
- <span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 89</span>
467
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset</span>()
468
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Resetting Store #{@store.storeuri}&quot;</span>
469
- <span class="ruby-identifier">resp</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Jobs</span>.<span class="ruby-identifier">submit_reset</span>(<span class="ruby-ivar">@store</span>, <span class="ruby-value str">&quot;Reset&quot;</span>, <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>)
470
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Monitoring Reset Job: #{resp.header[&quot;Location&quot;].first}&quot;</span>
471
- <span class="ruby-identifier">job</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Jobs</span>.<span class="ruby-identifier">wait_for_submitted</span>(<span class="ruby-identifier">resp</span>, <span class="ruby-ivar">@store</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">job</span>, <span class="ruby-identifier">message</span>, <span class="ruby-identifier">time</span><span class="ruby-operator">|</span>
472
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{time} #{message}&quot;</span>
473
- <span class="ruby-keyword kw">end</span>
474
- <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;Reset Completed&quot;</span>
475
- <span class="ruby-keyword kw">end</span>
476
- </pre>
477
- </div>
478
- </div>
479
- </div>
480
-
481
- <div id="method-M000122" class="method-detail">
482
- <a name="M000122"></a>
483
-
484
- <div class="method-heading">
485
- <a href="#M000122" class="method-signature">
486
- <span class="method-name">restore</span><span class="method-args">()</span>
487
- </a>
488
- </div>
489
-
490
- <div class="method-description">
491
- <p><a class="source-toggle" href="#"
492
- onclick="toggleCode('M000122-source');return false;">[Source]</a></p>
493
- <div class="method-source-code" id="M000122-source">
494
- <pre>
495
- <span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 99</span>
496
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">restore</span>()
497
- <span class="ruby-identifier">url</span> = <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;url&quot;</span>]
498
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">url</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
499
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Restoring #{@store.storeuri} from latest snapshot&quot;</span>
500
- <span class="ruby-identifier">snapshot</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Snapshot</span>.<span class="ruby-identifier">read_from_store</span>(<span class="ruby-ivar">@store</span>)
501
- <span class="ruby-identifier">url</span> = <span class="ruby-identifier">snapshot</span>.<span class="ruby-identifier">url</span>
502
- <span class="ruby-keyword kw">end</span>
503
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Restoring from #{url}&quot;</span>
504
- <span class="ruby-identifier">resp</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Jobs</span>.<span class="ruby-identifier">submit_restore</span>(<span class="ruby-ivar">@store</span>, <span class="ruby-identifier">url</span>, <span class="ruby-value str">&quot;Reset&quot;</span>, <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>)
505
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Monitoring Restore Job: #{resp.header[&quot;Location&quot;].first}&quot;</span>
506
- <span class="ruby-identifier">job</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Jobs</span>.<span class="ruby-identifier">wait_for_submitted</span>(<span class="ruby-identifier">resp</span>, <span class="ruby-ivar">@store</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">job</span>, <span class="ruby-identifier">message</span>, <span class="ruby-identifier">time</span><span class="ruby-operator">|</span>
507
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{time} #{message}&quot;</span>
508
- <span class="ruby-keyword kw">end</span>
509
- <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;Restore Completed&quot;</span>
510
- <span class="ruby-keyword kw">end</span>
511
- </pre>
512
- </div>
513
- </div>
514
- </div>
515
-
516
- <div id="method-M000119" class="method-detail">
517
- <a name="M000119"></a>
518
-
519
- <div class="method-heading">
520
- <a href="#M000119" class="method-signature">
521
- <span class="method-name">snapshot</span><span class="method-args">()</span>
522
- </a>
523
- </div>
524
-
525
- <div class="method-description">
526
- <p><a class="source-toggle" href="#"
527
- onclick="toggleCode('M000119-source');return false;">[Source]</a></p>
528
- <div class="method-source-code" id="M000119-source">
529
- <pre>
530
- <span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 67</span>
531
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">snapshot</span>()
532
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Submitting Snapshot Job to Store #{@store.storeuri}&quot;</span>
533
- <span class="ruby-identifier">resp</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Jobs</span>.<span class="ruby-identifier">submit_snapshot</span>(<span class="ruby-ivar">@store</span>, <span class="ruby-value str">&quot;Reindex&quot;</span>, <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>)
534
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Monitoring Snapshot Job #{resp.header[&quot;Location&quot;].first}&quot;</span>
535
- <span class="ruby-identifier">job</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Jobs</span>.<span class="ruby-identifier">wait_for_submitted</span>(<span class="ruby-identifier">resp</span>, <span class="ruby-ivar">@store</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">job</span>, <span class="ruby-identifier">message</span>, <span class="ruby-identifier">time</span><span class="ruby-operator">|</span>
536
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{time} #{message}&quot;</span>
537
- <span class="ruby-keyword kw">end</span>
538
- <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;Snapshot Completed&quot;</span>
539
- <span class="ruby-keyword kw">end</span>
540
- </pre>
541
- </div>
542
- </div>
543
- </div>
544
-
545
- <div id="method-M000124" class="method-detail">
546
- <a name="M000124"></a>
547
-
548
- <div class="method-heading">
549
- <a href="#M000124" class="method-signature">
550
- <span class="method-name">sparql</span><span class="method-args">()</span>
551
- </a>
552
- </div>
553
-
554
- <div class="method-description">
555
- <p><a class="source-toggle" href="#"
556
- onclick="toggleCode('M000124-source');return false;">[Source]</a></p>
557
- <div class="method-source-code" id="M000124-source">
558
- <pre>
559
- <span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 125</span>
560
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sparql</span>()
561
- <span class="ruby-identifier">query</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">new</span>( <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;file&quot;</span>] ).<span class="ruby-identifier">read</span>()
562
- <span class="ruby-identifier">resp</span> = <span class="ruby-ivar">@store</span>.<span class="ruby-identifier">sparql</span>(<span class="ruby-identifier">query</span>)
563
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">200</span>
564
- <span class="ruby-identifier">puts</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">content</span>
565
- <span class="ruby-keyword kw">else</span>
566
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Error: #{resp.status} #{resp.reason}&quot;</span>
567
- <span class="ruby-identifier">puts</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">content</span>
568
- <span class="ruby-keyword kw">end</span>
569
- <span class="ruby-keyword kw">end</span>
570
- </pre>
571
- </div>
572
- </div>
573
- </div>
574
-
575
- <div id="method-M000117" class="method-detail">
576
- <a name="M000117"></a>
577
-
578
- <div class="method-heading">
579
- <a href="#M000117" class="method-signature">
580
- <span class="method-name">status</span><span class="method-args">()</span>
581
- </a>
582
- </div>
583
-
584
- <div class="method-description">
585
- <p><a class="source-toggle" href="#"
586
- onclick="toggleCode('M000117-source');return false;">[Source]</a></p>
587
- <div class="method-source-code" id="M000117-source">
588
- <pre>
589
- <span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 47</span>
590
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">status</span>()
591
- <span class="ruby-identifier">status</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Status</span>.<span class="ruby-identifier">read_from_store</span>(<span class="ruby-ivar">@store</span>)
592
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Status of Store #{@store.storeuri}:\nReadable: #{status.readable?}\nWritable: #{status.writeable?}&quot;</span>
593
- <span class="ruby-keyword kw">end</span>
594
- </pre>
595
- </div>
596
- </div>
597
- </div>
598
-
599
- <div id="method-M000125" class="method-detail">
600
- <a name="M000125"></a>
601
-
602
- <div class="method-heading">
603
- <a href="#M000125" class="method-signature">
604
- <span class="method-name">store</span><span class="method-args">()</span>
605
- </a>
606
- </div>
607
-
608
- <div class="method-description">
609
- <p><a class="source-toggle" href="#"
610
- onclick="toggleCode('M000125-source');return false;">[Source]</a></p>
611
- <div class="method-source-code" id="M000125-source">
612
- <pre>
613
- <span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 136</span>
614
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">store</span>()
615
- <span class="ruby-identifier">resp</span> = <span class="ruby-keyword kw">nil</span>
616
- <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;url&quot;</span>]
617
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Storing remote data: #{@opts[&quot;url&quot;]}&quot;</span>
618
- <span class="ruby-identifier">resp</span> = <span class="ruby-ivar">@store</span>.<span class="ruby-identifier">store_url</span>( <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;url&quot;</span>] )
619
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;file&quot;</span>]
620
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Storing local file: #{@opts[&quot;file&quot;]}&quot;</span>
621
- <span class="ruby-identifier">f</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">new</span>( <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;file&quot;</span>] )
622
- <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">extname</span>( <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;file&quot;</span>] ) <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;.nt&quot;</span>
623
- <span class="ruby-identifier">resp</span> = <span class="ruby-ivar">@store</span>.<span class="ruby-identifier">store_file</span>( <span class="ruby-identifier">f</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-value str">&quot;text/plain&quot;</span> )
624
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">extname</span>( <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;file&quot;</span>] ) <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;.ttl&quot;</span>
625
- <span class="ruby-identifier">resp</span> = <span class="ruby-ivar">@store</span>.<span class="ruby-identifier">store_file</span>( <span class="ruby-identifier">f</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-value str">&quot;text/turtle&quot;</span> )
626
- <span class="ruby-keyword kw">else</span>
627
- <span class="ruby-identifier">resp</span> = <span class="ruby-ivar">@store</span>.<span class="ruby-identifier">store_file</span>( <span class="ruby-identifier">f</span> )
628
- <span class="ruby-keyword kw">end</span>
629
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;dir&quot;</span>]
630
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Storing contents of directory: #{@opts[&quot;dir&quot;]}&quot;</span>
631
- <span class="ruby-identifier">collection</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">RDFCollection</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@store</span>, <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;dir&quot;</span>])
632
- <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">store</span>()
633
- <span class="ruby-identifier">puts</span> <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">summary</span>()
634
- <span class="ruby-keyword kw">else</span>
635
- <span class="ruby-comment cmt">#noop</span>
636
- <span class="ruby-keyword kw">end</span>
637
-
638
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">resp</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
639
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">204</span>
640
- <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;Complete&quot;</span>
641
- <span class="ruby-keyword kw">else</span>
642
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Error: #{resp.status} #{resp.reason}&quot;</span>
643
- <span class="ruby-identifier">puts</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">content</span>
644
- <span class="ruby-keyword kw">end</span>
645
- <span class="ruby-keyword kw">end</span>
646
- <span class="ruby-keyword kw">end</span>
647
- </pre>
648
- </div>
649
- </div>
650
- </div>
651
-
652
- <div id="method-M000116" class="method-detail">
653
- <a name="M000116"></a>
654
-
655
- <div class="method-heading">
656
- <a href="#M000116" class="method-signature">
657
- <span class="method-name">storename</span><span class="method-args">()</span>
658
- </a>
659
- </div>
660
-
661
- <div class="method-description">
662
- <p><a class="source-toggle" href="#"
663
- onclick="toggleCode('M000116-source');return false;">[Source]</a></p>
664
- <div class="method-source-code" id="M000116-source">
665
- <pre>
666
- <span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 37</span>
667
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">storename</span>()
668
- <span class="ruby-identifier">store</span> = <span class="ruby-keyword kw">nil</span>
669
- <span class="ruby-identifier">store</span> = <span class="ruby-ivar">@env</span>[<span class="ruby-value str">&quot;TALIS_STORE&quot;</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value str">&quot;TALIS_STORE&quot;</span>]
670
- <span class="ruby-identifier">store</span> = <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;store&quot;</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;store&quot;</span>]
671
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">store</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">store</span>.<span class="ruby-identifier">start_with?</span>(<span class="ruby-value str">&quot;http&quot;</span>)
672
- <span class="ruby-identifier">store</span> = <span class="ruby-node">&quot;http://api.talis.com/stores/#{store}&quot;</span>
673
- <span class="ruby-keyword kw">end</span>
674
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">store</span>
675
- <span class="ruby-keyword kw">end</span>
676
- </pre>
677
- </div>
678
- </div>
679
- </div>
680
-
681
- <div id="method-M000126" class="method-detail">
682
- <a name="M000126"></a>
683
-
684
- <div class="method-heading">
685
- <a href="#M000126" class="method-signature">
686
- <span class="method-name">upload</span><span class="method-args">()</span>
687
- </a>
688
- </div>
689
-
690
- <div class="method-description">
691
- <p><a class="source-toggle" href="#"
692
- onclick="toggleCode('M000126-source');return false;">[Source]</a></p>
693
- <div class="method-source-code" id="M000126-source">
694
- <pre>
695
- <span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 170</span>
696
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">upload</span>()
697
- <span class="ruby-identifier">resp</span> = <span class="ruby-keyword kw">nil</span>
698
- <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;file&quot;</span>]
699
- <span class="ruby-identifier">f</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">new</span>( <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;file&quot;</span>] )
700
- <span class="ruby-identifier">uri</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>( <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;file&quot;</span>] )
701
- <span class="ruby-identifier">uri</span> = <span class="ruby-node">&quot;#{@opts[&quot;base&quot;]}/#{uri}&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;base&quot;</span>]
702
- <span class="ruby-identifier">mime</span> = <span class="ruby-constant">MIME</span><span class="ruby-operator">::</span><span class="ruby-constant">Types</span>.<span class="ruby-identifier">type_for</span>( <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;file&quot;</span>] )[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_s</span>
703
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Uploading file: #{ @opts[&quot;file&quot;] } to /items/#{ uri } as #{mime}&quot;</span>
704
- <span class="ruby-identifier">resp</span> = <span class="ruby-ivar">@store</span>.<span class="ruby-identifier">upload_item</span>( <span class="ruby-identifier">f</span> , <span class="ruby-identifier">mime</span> , <span class="ruby-identifier">uri</span> )
705
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;dir&quot;</span>]
706
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Uploading contents of directory: #{@opts[&quot;dir&quot;]}&quot;</span>
707
- <span class="ruby-identifier">collection</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">FileManagement</span><span class="ruby-operator">::</span><span class="ruby-constant">FileManager</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@store</span>, <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;dir&quot;</span>], <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;base&quot;</span>])
708
- <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;traverse&quot;</span>]
709
- <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">store</span>(<span class="ruby-identifier">:traverse</span>)
710
- <span class="ruby-identifier">puts</span> <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">summary</span>(<span class="ruby-identifier">:traverse</span>)
711
- <span class="ruby-keyword kw">else</span>
712
- <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">store</span>()
713
- <span class="ruby-identifier">puts</span> <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">summary</span>()
714
- <span class="ruby-keyword kw">end</span>
715
- <span class="ruby-keyword kw">else</span>
716
- <span class="ruby-comment cmt">#noop</span>
717
- <span class="ruby-keyword kw">end</span>
718
-
719
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">resp</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
720
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">204</span>
721
- <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;Complete&quot;</span>
722
- <span class="ruby-keyword kw">else</span>
723
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Error: #{resp.status} #{resp.reason}&quot;</span>
724
- <span class="ruby-identifier">puts</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">content</span>
725
- <span class="ruby-keyword kw">end</span>
726
- <span class="ruby-keyword kw">end</span>
727
- <span class="ruby-keyword kw">end</span>
728
- </pre>
729
- </div>
730
- </div>
731
- </div>
732
-
733
- <div id="method-M000114" class="method-detail">
734
- <a name="M000114"></a>
735
-
736
- <div class="method-heading">
737
- <a href="#M000114" class="method-signature">
738
- <span class="method-name">username</span><span class="method-args">()</span>
739
- </a>
740
- </div>
741
-
742
- <div class="method-description">
743
- <p><a class="source-toggle" href="#"
744
- onclick="toggleCode('M000114-source');return false;">[Source]</a></p>
745
- <div class="method-source-code" id="M000114-source">
746
- <pre>
747
- <span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 25</span>
748
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">username</span>()
749
- <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;username&quot;</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">&quot;username&quot;</span>]
750
- <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value str">&quot;TALIS_USER&quot;</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value str">&quot;TALIS_USER&quot;</span>]
751
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
752
- <span class="ruby-keyword kw">end</span>
753
- </pre>
754
- </div>
755
- </div>
756
- </div>
757
-
758
-
759
- </div>
760
-
761
-
762
- </div>
763
-
764
-
765
- <div id="validator-badges">
766
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
767
- </div>
768
-
769
- </body>
770
- </html>