pho 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +5 -0
- data/Rakefile +1 -1
- data/lib/pho/snapshot.rb +6 -1
- data/lib/pho/sparql.rb +4 -1
- data/tests/tc_snapshots.rb +14 -1
- data/tests/tc_sparql_helper.rb +23 -0
- metadata +60 -160
- data/doc/rdoc/classes/Pho/Analyzers.html +0 -310
- data/doc/rdoc/classes/Pho/CommandLine.html +0 -770
- data/doc/rdoc/classes/Pho/DatatypeProperty.html +0 -241
- data/doc/rdoc/classes/Pho/Enrichment/StoreEnricher.html +0 -410
- data/doc/rdoc/classes/Pho/Enrichment.html +0 -119
- data/doc/rdoc/classes/Pho/Etags.html +0 -310
- data/doc/rdoc/classes/Pho/Facet/Results.html +0 -299
- data/doc/rdoc/classes/Pho/Facet/Term.html +0 -177
- data/doc/rdoc/classes/Pho/Facet.html +0 -119
- data/doc/rdoc/classes/Pho/FieldPredicateMap.html +0 -668
- data/doc/rdoc/classes/Pho/FieldWeighting.html +0 -230
- data/doc/rdoc/classes/Pho/FileManagement/AbstractFileManager.html +0 -478
- data/doc/rdoc/classes/Pho/FileManagement/FileManager.html +0 -264
- data/doc/rdoc/classes/Pho/FileManagement/RDFManager.html +0 -259
- data/doc/rdoc/classes/Pho/FileManagement.html +0 -121
- data/doc/rdoc/classes/Pho/Job.html +0 -627
- data/doc/rdoc/classes/Pho/JobUpdate.html +0 -141
- data/doc/rdoc/classes/Pho/Jobs.html +0 -538
- data/doc/rdoc/classes/Pho/Namespaces.html +0 -164
- data/doc/rdoc/classes/Pho/OAI/Record.html +0 -165
- data/doc/rdoc/classes/Pho/OAI/Records.html +0 -331
- data/doc/rdoc/classes/Pho/OAI.html +0 -118
- data/doc/rdoc/classes/Pho/QueryProfile.html +0 -497
- data/doc/rdoc/classes/Pho/RDF/Parser.html +0 -279
- data/doc/rdoc/classes/Pho/RDF.html +0 -120
- data/doc/rdoc/classes/Pho/RDFCollection.html +0 -119
- data/doc/rdoc/classes/Pho/ResourceHash/Converter.html +0 -325
- data/doc/rdoc/classes/Pho/ResourceHash/SetAlgebra.html +0 -241
- data/doc/rdoc/classes/Pho/ResourceHash.html +0 -123
- data/doc/rdoc/classes/Pho/Snapshot.html +0 -397
- data/doc/rdoc/classes/Pho/Sparql/SparqlClient.html +0 -594
- data/doc/rdoc/classes/Pho/Sparql/SparqlHelper.html +0 -692
- data/doc/rdoc/classes/Pho/Sparql.html +0 -187
- data/doc/rdoc/classes/Pho/Status.html +0 -296
- data/doc/rdoc/classes/Pho/Store.html +0 -1560
- data/doc/rdoc/classes/Pho/StoreSparqlClient.html +0 -183
- data/doc/rdoc/classes/Pho/Update/Changeset.html +0 -521
- data/doc/rdoc/classes/Pho/Update/ChangesetBuilder.html +0 -330
- data/doc/rdoc/classes/Pho/Update/ChangesetHelper.html +0 -159
- data/doc/rdoc/classes/Pho/Update/Changesets.html +0 -205
- data/doc/rdoc/classes/Pho/Update/LiteralStatement.html +0 -257
- data/doc/rdoc/classes/Pho/Update/ResourceStatement.html +0 -237
- data/doc/rdoc/classes/Pho/Update/Statement.html +0 -303
- data/doc/rdoc/classes/Pho/Update.html +0 -128
- data/doc/rdoc/classes/Pho.html +0 -283
- data/doc/rdoc/classes/String.html +0 -146
- data/doc/rdoc/created.rid +0 -1
- data/doc/rdoc/files/CHANGES.html +0 -351
- data/doc/rdoc/files/README.html +0 -191
- data/doc/rdoc/files/lib/pho/changeset_builder_rb.html +0 -108
- data/doc/rdoc/files/lib/pho/changeset_rb.html +0 -108
- data/doc/rdoc/files/lib/pho/command_line_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/converter_rb.html +0 -108
- data/doc/rdoc/files/lib/pho/enrichment_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/etags_rb.html +0 -108
- data/doc/rdoc/files/lib/pho/facet_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/field_predicate_map_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/file_management_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/file_manager_rb.html +0 -108
- data/doc/rdoc/files/lib/pho/job_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/oai_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/query_profile_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/rdf_collection_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/rdf_rb.html +0 -108
- data/doc/rdoc/files/lib/pho/resource_hash_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/snapshot_rb.html +0 -109
- data/doc/rdoc/files/lib/pho/sparql_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/status_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/store_rb.html +0 -108
- data/doc/rdoc/files/lib/pho_rb.html +0 -133
- data/doc/rdoc/fr_class_index.html +0 -72
- data/doc/rdoc/fr_file_index.html +0 -49
- data/doc/rdoc/fr_method_index.html +0 -237
- data/doc/rdoc/index.html +0 -24
- 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>
|
96
|
-
<a href="#M000130">add_weight</a>
|
97
|
-
<a href="#M000118">backup</a>
|
98
|
-
<a href="#M000123">describe</a>
|
99
|
-
<a href="#M000127">fpmap</a>
|
100
|
-
<a href="#M000113">new</a>
|
101
|
-
<a href="#M000115">password</a>
|
102
|
-
<a href="#M000128">queryprofile</a>
|
103
|
-
<a href="#M000120">reindex</a>
|
104
|
-
<a href="#M000121">reset</a>
|
105
|
-
<a href="#M000122">restore</a>
|
106
|
-
<a href="#M000119">snapshot</a>
|
107
|
-
<a href="#M000124">sparql</a>
|
108
|
-
<a href="#M000117">status</a>
|
109
|
-
<a href="#M000125">store</a>
|
110
|
-
<a href="#M000116">storename</a>
|
111
|
-
<a href="#M000126">upload</a>
|
112
|
-
<a href="#M000114">username</a>
|
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">"no <username>"</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">"no <password>"</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">&&</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">"no <store>"</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">"predicate"</span>], <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">"field"</span>], <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">"analyzer"</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">"field"</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">"Replacing mapping for #{@opts["field"]}"</span>)
|
196
|
-
<span class="ruby-keyword kw">end</span>
|
197
|
-
<span class="ruby-identifier">fpmap</span> <span class="ruby-operator"><<</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">"Unable to update FieldPredicate map in store. Response code was #{resp.status}"</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">"FieldPredicate map successfully updated"</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">"field"</span>], <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">"weight"</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">"field"</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">"Replacing weighting for #{@opts["field"]}"</span>)
|
232
|
-
<span class="ruby-keyword kw">end</span>
|
233
|
-
<span class="ruby-identifier">qp</span> <span class="ruby-operator"><<</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">"Unable to update QueryProfile in store. Response code was #{resp.status}"</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">"QueryProfile successfully updated"</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">"Submitting Snapshot Job to Store #{@store.storeuri}"</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">"Reindex"</span>, <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>)
|
264
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Monitoring Snapshot Job: #{resp.header["Location"].first}"</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">"#{time} #{message}"</span>
|
267
|
-
<span class="ruby-keyword kw">end</span>
|
268
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"Job Completed"</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">"Retrieving #{snapshot.url}"</span>
|
271
|
-
<span class="ruby-identifier">dir</span> = <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">"dir"</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">"Download complete. MD5 OK."</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">"url"</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">"Error: #{resp.status} #{resp.reason}"</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">"raw"</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">"Unable to read Field Predicate Map from store. Response code was #{resp.status}"</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"><=></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">"#{mapping.name} -> #{mapping.property_uri}"</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">"#{mapping.name} -> #{mapping.property_uri} (#{mapping.analyzer})"</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">"password"</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">"password"</span>]
|
374
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value str">"TALIS_PASS"</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value str">"TALIS_PASS"</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">"raw"</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">"Unable to read Query Profile from store. Response code was #{resp.status}"</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"><=></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">"#{weighting.name} -> #{weighting.weight}"</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">"Submitting Reindex Job to Store #{@store.storeuri}"</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">"Reindex"</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">"Monitoring Reindex Job: #{resp.header["Location"].first}"</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">"#{time} #{message}"</span>
|
444
|
-
<span class="ruby-keyword kw">end</span>
|
445
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"Reindex Completed"</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">"Resetting Store #{@store.storeuri}"</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">"Reset"</span>, <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>)
|
470
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Monitoring Reset Job: #{resp.header["Location"].first}"</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">"#{time} #{message}"</span>
|
473
|
-
<span class="ruby-keyword kw">end</span>
|
474
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"Reset Completed"</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">"url"</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">"Restoring #{@store.storeuri} from latest snapshot"</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">"Restoring from #{url}"</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">"Reset"</span>, <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>)
|
505
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Monitoring Restore Job: #{resp.header["Location"].first}"</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">"#{time} #{message}"</span>
|
508
|
-
<span class="ruby-keyword kw">end</span>
|
509
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"Restore Completed"</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">"Submitting Snapshot Job to Store #{@store.storeuri}"</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">"Reindex"</span>, <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>)
|
534
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Monitoring Snapshot Job #{resp.header["Location"].first}"</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">"#{time} #{message}"</span>
|
537
|
-
<span class="ruby-keyword kw">end</span>
|
538
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"Snapshot Completed"</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">"file"</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">"Error: #{resp.status} #{resp.reason}"</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">"Status of Store #{@store.storeuri}:\nReadable: #{status.readable?}\nWritable: #{status.writeable?}"</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">"url"</span>]
|
617
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Storing remote data: #{@opts["url"]}"</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">"url"</span>] )
|
619
|
-
<span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">"file"</span>]
|
620
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Storing local file: #{@opts["file"]}"</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">"file"</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">"file"</span>] ) <span class="ruby-operator">==</span> <span class="ruby-value str">".nt"</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">"text/plain"</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">"file"</span>] ) <span class="ruby-operator">==</span> <span class="ruby-value str">".ttl"</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">"text/turtle"</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">"dir"</span>]
|
630
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Storing contents of directory: #{@opts["dir"]}"</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">"dir"</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">"Complete"</span>
|
641
|
-
<span class="ruby-keyword kw">else</span>
|
642
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Error: #{resp.status} #{resp.reason}"</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">"TALIS_STORE"</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value str">"TALIS_STORE"</span>]
|
670
|
-
<span class="ruby-identifier">store</span> = <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">"store"</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">"store"</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">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">store</span>.<span class="ruby-identifier">start_with?</span>(<span class="ruby-value str">"http"</span>)
|
672
|
-
<span class="ruby-identifier">store</span> = <span class="ruby-node">"http://api.talis.com/stores/#{store}"</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">"file"</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">"file"</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">"file"</span>] )
|
701
|
-
<span class="ruby-identifier">uri</span> = <span class="ruby-node">"#{@opts["base"]}/#{uri}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">"base"</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">"file"</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">"Uploading file: #{ @opts["file"] } to /items/#{ uri } as #{mime}"</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">"dir"</span>]
|
706
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Uploading contents of directory: #{@opts["dir"]}"</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">"dir"</span>], <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">"base"</span>])
|
708
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">"traverse"</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">"Complete"</span>
|
722
|
-
<span class="ruby-keyword kw">else</span>
|
723
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Error: #{resp.status} #{resp.reason}"</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">"username"</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">"username"</span>]
|
750
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value str">"TALIS_USER"</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value str">"TALIS_USER"</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>
|