pho 0.6.2 → 0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +12 -0
- data/Rakefile +1 -1
- data/bin/talis_store +98 -24
- data/doc/rdoc/classes/Pho.html +15 -0
- data/doc/rdoc/classes/Pho/CommandLine.html +353 -91
- data/doc/rdoc/classes/Pho/DatatypeProperty.html +12 -12
- data/doc/rdoc/classes/Pho/Enrichment/StoreEnricher.html +29 -29
- data/doc/rdoc/classes/Pho/Etags.html +36 -36
- data/doc/rdoc/classes/Pho/Facet/Results.html +19 -19
- data/doc/rdoc/classes/Pho/Facet/Term.html +6 -6
- data/doc/rdoc/classes/Pho/FieldPredicateMap.html +105 -106
- data/doc/rdoc/classes/Pho/FieldWeighting.html +12 -12
- data/doc/rdoc/classes/Pho/FileManagement/RDFManager.html +31 -8
- data/doc/rdoc/classes/Pho/Job.html +64 -64
- data/doc/rdoc/classes/Pho/Jobs.html +60 -60
- data/doc/rdoc/classes/Pho/QueryProfile.html +60 -60
- data/doc/rdoc/classes/Pho/RDF/Parser.html +28 -26
- data/doc/rdoc/classes/Pho/ResourceHash/Converter.html +36 -36
- data/doc/rdoc/classes/Pho/ResourceHash/SetAlgebra.html +12 -12
- data/doc/rdoc/classes/Pho/Snapshot.html +35 -35
- data/doc/rdoc/classes/Pho/Status.html +26 -26
- data/doc/rdoc/classes/Pho/Store.html +289 -245
- data/doc/rdoc/classes/Pho/StoreSparqlClient.html +14 -14
- data/doc/rdoc/classes/String.html +1 -1
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/CHANGES.html +35 -1
- data/doc/rdoc/files/lib/pho/command_line_rb.html +1 -1
- data/doc/rdoc/files/lib/pho/converter_rb.html +1 -1
- data/doc/rdoc/files/lib/pho/field_predicate_map_rb.html +1 -1
- data/doc/rdoc/files/lib/pho/rdf_collection_rb.html +1 -1
- data/doc/rdoc/files/lib/pho/rdf_rb.html +1 -1
- data/doc/rdoc/files/lib/pho/store_rb.html +1 -1
- data/doc/rdoc/files/lib/pho_rb.html +2 -1
- data/doc/rdoc/fr_class_index.html +3 -0
- data/doc/rdoc/fr_file_index.html +1 -0
- data/doc/rdoc/fr_method_index.html +153 -141
- data/lib/pho.rb +3 -0
- data/lib/pho/command_line.rb +139 -14
- data/lib/pho/field_predicate_map.rb +1 -2
- data/lib/pho/oai.rb +58 -0
- data/lib/pho/rdf.rb +2 -0
- data/lib/pho/rdf_collection.rb +16 -4
- data/lib/pho/store.rb +23 -5
- data/tests/tc_command_line.rb +229 -0
- data/tests/tc_field_predicate_map.rb +5 -1
- data/tests/tc_metabox.rb +29 -1
- data/tests/tc_oai.rb +31 -0
- data/tests/tc_rdf_collection.rb +80 -15
- data/tests/ts_pho.rb +3 -1
- metadata +5 -2
data/CHANGES
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
Brief notes on significant changes and additions in each release
|
2
2
|
|
3
|
+
== Version 0.7
|
4
|
+
|
5
|
+
* Started on OAI client
|
6
|
+
* New commandline options: add_mapping and add_weight
|
7
|
+
* Updated talis_store so that it now supports environment variables for user, pass, store (TALIS_USER, TALIS_PASS, TALIS_STORE)
|
8
|
+
* Added getfpmap and getqueryprofile methods to command-line application for retrieving either a summary or the raw data
|
9
|
+
* Updated command-line job control functions so that the Job URI is echoed to command-line.
|
10
|
+
* Updated RDFManager so that it will now automatically upload all .rdf, .ttl and .nt files in directory. An array of extension can be provided to
|
11
|
+
configure this behaviour
|
12
|
+
* Updated command-line tool so that it will now handle uploads of turtle (.ttl) and ntriples (.nt) files correctly
|
13
|
+
* Updated Store class to allow mimetype of files and data to be specified when uploading to metabox. Useful now that the platform supports turtle
|
14
|
+
|
3
15
|
== Version 0.6.1
|
4
16
|
|
5
17
|
* Added examples/linkeddata/proxy.rb
|
data/Rakefile
CHANGED
data/bin/talis_store
CHANGED
@@ -18,6 +18,20 @@ DESCRIPTION
|
|
18
18
|
|
19
19
|
MODE
|
20
20
|
|
21
|
+
add_mapping
|
22
|
+
Add an entry to the field predicate map
|
23
|
+
|
24
|
+
example :
|
25
|
+
|
26
|
+
#{ PROGRAM } add_mapping -u user -p pass -s my-dev1 --field name --predicate http://xmlns.com/foaf/0.1/name
|
27
|
+
|
28
|
+
add_weight
|
29
|
+
Add a field weight to the query profile
|
30
|
+
|
31
|
+
example :
|
32
|
+
|
33
|
+
#{ PROGRAM } add_mapping -u user -p pass -s my-dev1 --field name --weight 2.0
|
34
|
+
|
21
35
|
backup
|
22
36
|
Take a snapshot of a store and then download that new snapshot to the local system
|
23
37
|
By default the snapshot is downloaded into /tmp, but can be specified on the command-line
|
@@ -34,6 +48,22 @@ MODE
|
|
34
48
|
|
35
49
|
#{ PROGRAM } describe -u user -p pass -s my-dev1 -r http://www.example.org/foo
|
36
50
|
|
51
|
+
getfpmap
|
52
|
+
Fetch and display FieldPredicate map from store
|
53
|
+
|
54
|
+
example :
|
55
|
+
|
56
|
+
#{ PROGRAM } getfpmap -u user -p pass -s my-dev1
|
57
|
+
#{ PROGRAM } getfpmap -u user -p pass -s my-dev1 --raw
|
58
|
+
|
59
|
+
getqueryprofile
|
60
|
+
Fetch and display QueryProfile from store
|
61
|
+
|
62
|
+
example :
|
63
|
+
|
64
|
+
#{ PROGRAM } getqueryprofile -u user -p pass -s my-dev1
|
65
|
+
#{ PROGRAM } getqueryprofile -u user -p pass -s my-dev1 --raw
|
66
|
+
|
37
67
|
reindex
|
38
68
|
Trigger a reindex job on the store
|
39
69
|
|
@@ -41,6 +71,13 @@ MODE
|
|
41
71
|
|
42
72
|
#{ PROGRAM } reindex -u user -p pass -s my-dev1
|
43
73
|
|
74
|
+
remove_mapping
|
75
|
+
Remove a mapping from both the field predicate map and the query profile
|
76
|
+
|
77
|
+
example :
|
78
|
+
|
79
|
+
#{ PROGRAM } remove_mapping -u user -p pass -s my-dev1 --field name
|
80
|
+
|
44
81
|
reset
|
45
82
|
Reset the store. THIS WILL DELETE ALL DATA.
|
46
83
|
|
@@ -77,7 +114,7 @@ MODE
|
|
77
114
|
store
|
78
115
|
Upload some RDF data to the metabox in a Platform store. Can either specify a local file, or a URL
|
79
116
|
When a url is specified, then the data is retrieved and then submitted to the Platform
|
80
|
-
Can also be used to store an entire directory of RDF/XML using the --dir option.
|
117
|
+
Can also be used to store an entire directory of RDF/XML, Turtle and ntriples using the --dir option.
|
81
118
|
|
82
119
|
example :
|
83
120
|
|
@@ -116,7 +153,17 @@ OPTIONS
|
|
116
153
|
--traverse
|
117
154
|
recursively store files or RDF
|
118
155
|
--base
|
119
|
-
base path for uploading files to content box
|
156
|
+
base path for uploading files to content box
|
157
|
+
--raw
|
158
|
+
output raw API response, e.g. for fpmap and queryprofile
|
159
|
+
--field
|
160
|
+
name of a field for fpmap or query profile
|
161
|
+
--predicate
|
162
|
+
predicate uri
|
163
|
+
--weight
|
164
|
+
weighting for a field in query profile
|
165
|
+
--analyzer
|
166
|
+
name or uri of analyzer
|
120
167
|
EOL
|
121
168
|
|
122
169
|
mode = ARGV.shift
|
@@ -130,7 +177,12 @@ opts = GetoptLong::new(
|
|
130
177
|
[ "--file" , "-f" , GetoptLong::REQUIRED_ARGUMENT ],
|
131
178
|
[ "--dir" , "-d" , GetoptLong::REQUIRED_ARGUMENT ],
|
132
179
|
[ "--traverse" , "-t" , GetoptLong::NO_ARGUMENT ],
|
133
|
-
[ "--base" , "-b" , GetoptLong::REQUIRED_ARGUMENT ]
|
180
|
+
[ "--base" , "-b" , GetoptLong::REQUIRED_ARGUMENT ],
|
181
|
+
[ "--raw" , GetoptLong::NO_ARGUMENT ],
|
182
|
+
[ "--field" , GetoptLong::REQUIRED_ARGUMENT ],
|
183
|
+
[ "--predicate" , GetoptLong::REQUIRED_ARGUMENT ],
|
184
|
+
[ "--weight" , GetoptLong::REQUIRED_ARGUMENT ],
|
185
|
+
[ "--analyzer" , GetoptLong::REQUIRED_ARGUMENT ]
|
134
186
|
).enum_for.inject({}) { |h, (k, v)| h.update k.delete('-') => v }
|
135
187
|
|
136
188
|
mode = "help" if opts["--help"]
|
@@ -139,30 +191,50 @@ if mode == "help"
|
|
139
191
|
USAGE.display
|
140
192
|
else
|
141
193
|
|
142
|
-
if !opts["username"]
|
143
|
-
puts "no <username>"
|
144
|
-
abort USAGE
|
145
|
-
end
|
146
|
-
if !opts["password"]
|
147
|
-
puts "no <password>"
|
148
|
-
abort USAGE
|
149
|
-
end
|
150
|
-
if !opts["store"]
|
151
|
-
puts "no <store>"
|
152
|
-
abort USAGE
|
153
|
-
end
|
154
|
-
|
155
|
-
storename = opts["store"]
|
156
|
-
if !storename.start_with?("http")
|
157
|
-
storename = "http://api.talis.com/stores/#{storename}"
|
158
|
-
end
|
159
194
|
|
160
|
-
|
161
|
-
|
195
|
+
# if !opts["username"]
|
196
|
+
# puts "no <username>"
|
197
|
+
# abort USAGE
|
198
|
+
# end
|
199
|
+
# if !opts["password"]
|
200
|
+
# puts "no <password>"
|
201
|
+
# abort USAGE
|
202
|
+
# end
|
203
|
+
# if !opts["store"]
|
204
|
+
# puts "no <store>"
|
205
|
+
# abort USAGE
|
206
|
+
# end
|
207
|
+
#
|
208
|
+
# storename = opts["store"]
|
209
|
+
# if !storename.start_with?("http")
|
210
|
+
# storename = "http://api.talis.com/stores/#{storename}"
|
211
|
+
# end
|
212
|
+
#
|
213
|
+
# store = Pho::Store.new(storename, opts["username"], opts["password"])
|
162
214
|
|
215
|
+
cmds = nil
|
216
|
+
begin
|
217
|
+
cmds = Pho::CommandLine.new(opts, ENV)
|
218
|
+
rescue RuntimeError => e
|
219
|
+
puts e
|
220
|
+
abort USAGE
|
221
|
+
end
|
222
|
+
|
163
223
|
#begin
|
164
224
|
|
165
|
-
|
225
|
+
#TODO
|
226
|
+
#remove_mapping
|
227
|
+
case mode
|
228
|
+
when "add_mapping"
|
229
|
+
if opts["predicate"] == nil || opts["field"] == nil
|
230
|
+
abort USAGE
|
231
|
+
end
|
232
|
+
cmds.add_mapping()
|
233
|
+
when "add_weight"
|
234
|
+
if opts["weight"] == nil || opts["field"] == nil
|
235
|
+
abort USAGE
|
236
|
+
end
|
237
|
+
cmds.add_weight()
|
166
238
|
when "status"
|
167
239
|
cmds.status()
|
168
240
|
when "backup"
|
@@ -194,7 +266,9 @@ else
|
|
194
266
|
if opts["file"] == nil
|
195
267
|
abort USAGE
|
196
268
|
end
|
197
|
-
cmds.sparql()
|
269
|
+
cmds.sparql()
|
270
|
+
when "getfpmap"
|
271
|
+
cmds.fpmap()
|
198
272
|
else
|
199
273
|
abort USAGE
|
200
274
|
end
|
data/doc/rdoc/classes/Pho.html
CHANGED
@@ -114,6 +114,10 @@
|
|
114
114
|
<a href="../files/lib/pho/changeset_rb.html">
|
115
115
|
lib/pho/changeset.rb
|
116
116
|
</a>
|
117
|
+
<br />
|
118
|
+
<a href="../files/lib/pho/oai_rb.html">
|
119
|
+
lib/pho/oai.rb
|
120
|
+
</a>
|
117
121
|
<br />
|
118
122
|
<a href="../files/lib/pho/file_management_rb.html">
|
119
123
|
lib/pho/file_management.rb
|
@@ -172,6 +176,7 @@ TODO put together proper test suite for this
|
|
172
176
|
Module <a href="Pho/Enrichment.html" class="link">Pho::Enrichment</a><br />
|
173
177
|
Module <a href="Pho/Facet.html" class="link">Pho::Facet</a><br />
|
174
178
|
Module <a href="Pho/FileManagement.html" class="link">Pho::FileManagement</a><br />
|
179
|
+
Module <a href="Pho/OAI.html" class="link">Pho::OAI</a><br />
|
175
180
|
Module <a href="Pho/RDF.html" class="link">Pho::RDF</a><br />
|
176
181
|
Module <a href="Pho/ResourceHash.html" class="link">Pho::ResourceHash</a><br />
|
177
182
|
Module <a href="Pho/Sparql.html" class="link">Pho::Sparql</a><br />
|
@@ -215,6 +220,16 @@ Class <a href="Pho/StoreSparqlClient.html" class="link">Pho::StoreSparqlClient</
|
|
215
220
|
<td>=</td>
|
216
221
|
<td class="context-item-value">{"Content-Type"=>"application/rdf+xml"}.freeze</td>
|
217
222
|
</tr>
|
223
|
+
<tr class="top-aligned-row context-row">
|
224
|
+
<td class="context-item-name">TURTLE</td>
|
225
|
+
<td>=</td>
|
226
|
+
<td class="context-item-value">{"Content-Type"=>"text/turtle"}.freeze</td>
|
227
|
+
</tr>
|
228
|
+
<tr class="top-aligned-row context-row">
|
229
|
+
<td class="context-item-name">NTRIPLES</td>
|
230
|
+
<td>=</td>
|
231
|
+
<td class="context-item-value">{"Content-Type"=>"text/plain"}.freeze</td>
|
232
|
+
</tr>
|
218
233
|
<tr class="top-aligned-row context-row">
|
219
234
|
<td class="context-item-name">READ_ONLY</td>
|
220
235
|
<td>=</td>
|
@@ -92,17 +92,24 @@ Class that implements the command-line behaviour
|
|
92
92
|
<h3 class="section-bar">Methods</h3>
|
93
93
|
|
94
94
|
<div class="name-list">
|
95
|
-
<a href="#
|
96
|
-
<a href="#
|
97
|
-
<a href="#
|
98
|
-
<a href="#
|
99
|
-
<a href="#
|
100
|
-
<a href="#
|
101
|
-
<a href="#
|
102
|
-
<a href="#
|
103
|
-
<a href="#
|
104
|
-
<a href="#
|
105
|
-
<a href="#
|
95
|
+
<a href="#M000128">add_mapping</a>
|
96
|
+
<a href="#M000129">add_weight</a>
|
97
|
+
<a href="#M000117">backup</a>
|
98
|
+
<a href="#M000122">describe</a>
|
99
|
+
<a href="#M000126">fpmap</a>
|
100
|
+
<a href="#M000112">new</a>
|
101
|
+
<a href="#M000114">password</a>
|
102
|
+
<a href="#M000127">queryprofile</a>
|
103
|
+
<a href="#M000119">reindex</a>
|
104
|
+
<a href="#M000120">reset</a>
|
105
|
+
<a href="#M000121">restore</a>
|
106
|
+
<a href="#M000118">snapshot</a>
|
107
|
+
<a href="#M000123">sparql</a>
|
108
|
+
<a href="#M000116">status</a>
|
109
|
+
<a href="#M000124">store</a>
|
110
|
+
<a href="#M000115">storename</a>
|
111
|
+
<a href="#M000125">upload</a>
|
112
|
+
<a href="#M000113">username</a>
|
106
113
|
</div>
|
107
114
|
</div>
|
108
115
|
|
@@ -124,24 +131,38 @@ Class that implements the command-line behaviour
|
|
124
131
|
<div id="methods">
|
125
132
|
<h3 class="section-bar">Public Class methods</h3>
|
126
133
|
|
127
|
-
<div id="method-
|
128
|
-
<a name="
|
134
|
+
<div id="method-M000112" class="method-detail">
|
135
|
+
<a name="M000112"></a>
|
129
136
|
|
130
137
|
<div class="method-heading">
|
131
|
-
<a href="#
|
132
|
-
<span class="method-name">new</span><span class="method-args">(
|
138
|
+
<a href="#M000112" class="method-signature">
|
139
|
+
<span class="method-name">new</span><span class="method-args">(opts, env, store=nil)</span>
|
133
140
|
</a>
|
134
141
|
</div>
|
135
142
|
|
136
143
|
<div class="method-description">
|
137
144
|
<p><a class="source-toggle" href="#"
|
138
|
-
onclick="toggleCode('
|
139
|
-
<div class="method-source-code" id="
|
145
|
+
onclick="toggleCode('M000112-source');return false;">[Source]</a></p>
|
146
|
+
<div class="method-source-code" id="M000112-source">
|
140
147
|
<pre>
|
141
148
|
<span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 6</span>
|
142
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">
|
143
|
-
|
144
|
-
|
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
|
+
|
145
166
|
<span class="ruby-keyword kw">end</span>
|
146
167
|
</pre>
|
147
168
|
</div>
|
@@ -150,25 +171,97 @@ Class that implements the command-line behaviour
|
|
150
171
|
|
151
172
|
<h3 class="section-bar">Public Instance methods</h3>
|
152
173
|
|
153
|
-
<div id="method-
|
154
|
-
<a name="
|
174
|
+
<div id="method-M000128" class="method-detail">
|
175
|
+
<a name="M000128"></a>
|
176
|
+
|
177
|
+
<div class="method-heading">
|
178
|
+
<a href="#M000128" 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('M000128-source');return false;">[Source]</a></p>
|
186
|
+
<div class="method-source-code" id="M000128-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-M000129" class="method-detail">
|
211
|
+
<a name="M000129"></a>
|
155
212
|
|
156
213
|
<div class="method-heading">
|
157
|
-
<a href="#
|
214
|
+
<a href="#M000129" 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('M000129-source');return false;">[Source]</a></p>
|
222
|
+
<div class="method-source-code" id="M000129-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-M000117" class="method-detail">
|
247
|
+
<a name="M000117"></a>
|
248
|
+
|
249
|
+
<div class="method-heading">
|
250
|
+
<a href="#M000117" class="method-signature">
|
158
251
|
<span class="method-name">backup</span><span class="method-args">()</span>
|
159
252
|
</a>
|
160
253
|
</div>
|
161
254
|
|
162
255
|
<div class="method-description">
|
163
256
|
<p><a class="source-toggle" href="#"
|
164
|
-
onclick="toggleCode('
|
165
|
-
<div class="method-source-code" id="
|
257
|
+
onclick="toggleCode('M000117-source');return false;">[Source]</a></p>
|
258
|
+
<div class="method-source-code" id="M000117-source">
|
166
259
|
<pre>
|
167
|
-
<span class="ruby-comment cmt"># File lib/pho/command_line.rb, line
|
260
|
+
<span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 52</span>
|
168
261
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">backup</span>()
|
169
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-
|
262
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Submitting Snapshot Job to Store #{@store.storeuri}"</span>
|
170
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>)
|
171
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-
|
264
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Monitoring Snapshot Job: #{resp.header["Location"].first}"</span>
|
172
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>
|
173
266
|
<span class="ruby-identifier">puts</span> <span class="ruby-node">"#{time} #{message}"</span>
|
174
267
|
<span class="ruby-keyword kw">end</span>
|
@@ -184,21 +277,21 @@ Class that implements the command-line behaviour
|
|
184
277
|
</div>
|
185
278
|
</div>
|
186
279
|
|
187
|
-
<div id="method-
|
188
|
-
<a name="
|
280
|
+
<div id="method-M000122" class="method-detail">
|
281
|
+
<a name="M000122"></a>
|
189
282
|
|
190
283
|
<div class="method-heading">
|
191
|
-
<a href="#
|
284
|
+
<a href="#M000122" class="method-signature">
|
192
285
|
<span class="method-name">describe</span><span class="method-args">()</span>
|
193
286
|
</a>
|
194
287
|
</div>
|
195
288
|
|
196
289
|
<div class="method-description">
|
197
290
|
<p><a class="source-toggle" href="#"
|
198
|
-
onclick="toggleCode('
|
199
|
-
<div class="method-source-code" id="
|
291
|
+
onclick="toggleCode('M000122-source');return false;">[Source]</a></p>
|
292
|
+
<div class="method-source-code" id="M000122-source">
|
200
293
|
<pre>
|
201
|
-
<span class="ruby-comment cmt"># File lib/pho/command_line.rb, line
|
294
|
+
<span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 115</span>
|
202
295
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">describe</span>()
|
203
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>] )
|
204
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>
|
@@ -213,23 +306,135 @@ Class that implements the command-line behaviour
|
|
213
306
|
</div>
|
214
307
|
</div>
|
215
308
|
|
216
|
-
<div id="method-
|
217
|
-
<a name="
|
309
|
+
<div id="method-M000126" class="method-detail">
|
310
|
+
<a name="M000126"></a>
|
218
311
|
|
219
312
|
<div class="method-heading">
|
220
|
-
<a href="#
|
313
|
+
<a href="#M000126" 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('M000126-source');return false;">[Source]</a></p>
|
321
|
+
<div class="method-source-code" id="M000126-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-M000114" class="method-detail">
|
358
|
+
<a name="M000114"></a>
|
359
|
+
|
360
|
+
<div class="method-heading">
|
361
|
+
<a href="#M000114" 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('M000114-source');return false;">[Source]</a></p>
|
369
|
+
<div class="method-source-code" id="M000114-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-M000127" class="method-detail">
|
383
|
+
<a name="M000127"></a>
|
384
|
+
|
385
|
+
<div class="method-heading">
|
386
|
+
<a href="#M000127" 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('M000127-source');return false;">[Source]</a></p>
|
394
|
+
<div class="method-source-code" id="M000127-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-M000119" class="method-detail">
|
422
|
+
<a name="M000119"></a>
|
423
|
+
|
424
|
+
<div class="method-heading">
|
425
|
+
<a href="#M000119" class="method-signature">
|
221
426
|
<span class="method-name">reindex</span><span class="method-args">()</span>
|
222
427
|
</a>
|
223
428
|
</div>
|
224
429
|
|
225
430
|
<div class="method-description">
|
226
431
|
<p><a class="source-toggle" href="#"
|
227
|
-
onclick="toggleCode('
|
228
|
-
<div class="method-source-code" id="
|
432
|
+
onclick="toggleCode('M000119-source');return false;">[Source]</a></p>
|
433
|
+
<div class="method-source-code" id="M000119-source">
|
229
434
|
<pre>
|
230
|
-
<span class="ruby-comment cmt"># File lib/pho/command_line.rb, line
|
435
|
+
<span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 77</span>
|
231
436
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reindex</span>()
|
232
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-
|
437
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Submitting Reindex Job to Store #{@store.storeuri}"</span>
|
233
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>)
|
234
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>
|
235
440
|
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Monitoring Reindex Job: #{resp.header["Location"].first}"</span>
|
@@ -244,25 +449,25 @@ Class that implements the command-line behaviour
|
|
244
449
|
</div>
|
245
450
|
</div>
|
246
451
|
|
247
|
-
<div id="method-
|
248
|
-
<a name="
|
452
|
+
<div id="method-M000120" class="method-detail">
|
453
|
+
<a name="M000120"></a>
|
249
454
|
|
250
455
|
<div class="method-heading">
|
251
|
-
<a href="#
|
456
|
+
<a href="#M000120" class="method-signature">
|
252
457
|
<span class="method-name">reset</span><span class="method-args">()</span>
|
253
458
|
</a>
|
254
459
|
</div>
|
255
460
|
|
256
461
|
<div class="method-description">
|
257
462
|
<p><a class="source-toggle" href="#"
|
258
|
-
onclick="toggleCode('
|
259
|
-
<div class="method-source-code" id="
|
463
|
+
onclick="toggleCode('M000120-source');return false;">[Source]</a></p>
|
464
|
+
<div class="method-source-code" id="M000120-source">
|
260
465
|
<pre>
|
261
|
-
<span class="ruby-comment cmt"># File lib/pho/command_line.rb, line
|
466
|
+
<span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 89</span>
|
262
467
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset</span>()
|
263
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-
|
468
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Resetting Store #{@store.storeuri}"</span>
|
264
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>)
|
265
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-
|
470
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Monitoring Reset Job: #{resp.header["Location"].first}"</span>
|
266
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>
|
267
472
|
<span class="ruby-identifier">puts</span> <span class="ruby-node">"#{time} #{message}"</span>
|
268
473
|
<span class="ruby-keyword kw">end</span>
|
@@ -273,30 +478,31 @@ Class that implements the command-line behaviour
|
|
273
478
|
</div>
|
274
479
|
</div>
|
275
480
|
|
276
|
-
<div id="method-
|
277
|
-
<a name="
|
481
|
+
<div id="method-M000121" class="method-detail">
|
482
|
+
<a name="M000121"></a>
|
278
483
|
|
279
484
|
<div class="method-heading">
|
280
|
-
<a href="#
|
485
|
+
<a href="#M000121" class="method-signature">
|
281
486
|
<span class="method-name">restore</span><span class="method-args">()</span>
|
282
487
|
</a>
|
283
488
|
</div>
|
284
489
|
|
285
490
|
<div class="method-description">
|
286
491
|
<p><a class="source-toggle" href="#"
|
287
|
-
onclick="toggleCode('
|
288
|
-
<div class="method-source-code" id="
|
492
|
+
onclick="toggleCode('M000121-source');return false;">[Source]</a></p>
|
493
|
+
<div class="method-source-code" id="M000121-source">
|
289
494
|
<pre>
|
290
|
-
<span class="ruby-comment cmt"># File lib/pho/command_line.rb, line
|
495
|
+
<span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 99</span>
|
291
496
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">restore</span>()
|
292
497
|
<span class="ruby-identifier">url</span> = <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">"url"</span>]
|
293
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>
|
294
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-
|
499
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Restoring #{@store.storeuri} from latest snapshot"</span>
|
295
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>)
|
296
501
|
<span class="ruby-identifier">url</span> = <span class="ruby-identifier">snapshot</span>.<span class="ruby-identifier">url</span>
|
297
502
|
<span class="ruby-keyword kw">end</span>
|
298
503
|
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Restoring from #{url}"</span>
|
299
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>
|
300
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>
|
301
507
|
<span class="ruby-identifier">puts</span> <span class="ruby-node">"#{time} #{message}"</span>
|
302
508
|
<span class="ruby-keyword kw">end</span>
|
@@ -307,25 +513,25 @@ Class that implements the command-line behaviour
|
|
307
513
|
</div>
|
308
514
|
</div>
|
309
515
|
|
310
|
-
<div id="method-
|
311
|
-
<a name="
|
516
|
+
<div id="method-M000118" class="method-detail">
|
517
|
+
<a name="M000118"></a>
|
312
518
|
|
313
519
|
<div class="method-heading">
|
314
|
-
<a href="#
|
520
|
+
<a href="#M000118" class="method-signature">
|
315
521
|
<span class="method-name">snapshot</span><span class="method-args">()</span>
|
316
522
|
</a>
|
317
523
|
</div>
|
318
524
|
|
319
525
|
<div class="method-description">
|
320
526
|
<p><a class="source-toggle" href="#"
|
321
|
-
onclick="toggleCode('
|
322
|
-
<div class="method-source-code" id="
|
527
|
+
onclick="toggleCode('M000118-source');return false;">[Source]</a></p>
|
528
|
+
<div class="method-source-code" id="M000118-source">
|
323
529
|
<pre>
|
324
|
-
<span class="ruby-comment cmt"># File lib/pho/command_line.rb, line
|
530
|
+
<span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 67</span>
|
325
531
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">snapshot</span>()
|
326
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-
|
532
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Submitting Snapshot Job to Store #{@store.storeuri}"</span>
|
327
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>)
|
328
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-
|
534
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Monitoring Snapshot Job #{resp.header["Location"].first}"</span>
|
329
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>
|
330
536
|
<span class="ruby-identifier">puts</span> <span class="ruby-node">"#{time} #{message}"</span>
|
331
537
|
<span class="ruby-keyword kw">end</span>
|
@@ -336,21 +542,21 @@ Class that implements the command-line behaviour
|
|
336
542
|
</div>
|
337
543
|
</div>
|
338
544
|
|
339
|
-
<div id="method-
|
340
|
-
<a name="
|
545
|
+
<div id="method-M000123" class="method-detail">
|
546
|
+
<a name="M000123"></a>
|
341
547
|
|
342
548
|
<div class="method-heading">
|
343
|
-
<a href="#
|
549
|
+
<a href="#M000123" class="method-signature">
|
344
550
|
<span class="method-name">sparql</span><span class="method-args">()</span>
|
345
551
|
</a>
|
346
552
|
</div>
|
347
553
|
|
348
554
|
<div class="method-description">
|
349
555
|
<p><a class="source-toggle" href="#"
|
350
|
-
onclick="toggleCode('
|
351
|
-
<div class="method-source-code" id="
|
556
|
+
onclick="toggleCode('M000123-source');return false;">[Source]</a></p>
|
557
|
+
<div class="method-source-code" id="M000123-source">
|
352
558
|
<pre>
|
353
|
-
<span class="ruby-comment cmt"># File lib/pho/command_line.rb, line
|
559
|
+
<span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 125</span>
|
354
560
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sparql</span>()
|
355
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>()
|
356
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>)
|
@@ -366,45 +572,45 @@ Class that implements the command-line behaviour
|
|
366
572
|
</div>
|
367
573
|
</div>
|
368
574
|
|
369
|
-
<div id="method-
|
370
|
-
<a name="
|
575
|
+
<div id="method-M000116" class="method-detail">
|
576
|
+
<a name="M000116"></a>
|
371
577
|
|
372
578
|
<div class="method-heading">
|
373
|
-
<a href="#
|
579
|
+
<a href="#M000116" class="method-signature">
|
374
580
|
<span class="method-name">status</span><span class="method-args">()</span>
|
375
581
|
</a>
|
376
582
|
</div>
|
377
583
|
|
378
584
|
<div class="method-description">
|
379
585
|
<p><a class="source-toggle" href="#"
|
380
|
-
onclick="toggleCode('
|
381
|
-
<div class="method-source-code" id="
|
586
|
+
onclick="toggleCode('M000116-source');return false;">[Source]</a></p>
|
587
|
+
<div class="method-source-code" id="M000116-source">
|
382
588
|
<pre>
|
383
|
-
<span class="ruby-comment cmt"># File lib/pho/command_line.rb, line
|
589
|
+
<span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 47</span>
|
384
590
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">status</span>()
|
385
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>)
|
386
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Store
|
592
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Status of Store #{@store.storeuri}:\nReadable: #{status.readable?}\nWritable: #{status.writeable?}"</span>
|
387
593
|
<span class="ruby-keyword kw">end</span>
|
388
594
|
</pre>
|
389
595
|
</div>
|
390
596
|
</div>
|
391
597
|
</div>
|
392
598
|
|
393
|
-
<div id="method-
|
394
|
-
<a name="
|
599
|
+
<div id="method-M000124" class="method-detail">
|
600
|
+
<a name="M000124"></a>
|
395
601
|
|
396
602
|
<div class="method-heading">
|
397
|
-
<a href="#
|
603
|
+
<a href="#M000124" class="method-signature">
|
398
604
|
<span class="method-name">store</span><span class="method-args">()</span>
|
399
605
|
</a>
|
400
606
|
</div>
|
401
607
|
|
402
608
|
<div class="method-description">
|
403
609
|
<p><a class="source-toggle" href="#"
|
404
|
-
onclick="toggleCode('
|
405
|
-
<div class="method-source-code" id="
|
610
|
+
onclick="toggleCode('M000124-source');return false;">[Source]</a></p>
|
611
|
+
<div class="method-source-code" id="M000124-source">
|
406
612
|
<pre>
|
407
|
-
<span class="ruby-comment cmt"># File lib/pho/command_line.rb, line
|
613
|
+
<span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 136</span>
|
408
614
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">store</span>()
|
409
615
|
<span class="ruby-identifier">resp</span> = <span class="ruby-keyword kw">nil</span>
|
410
616
|
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">"url"</span>]
|
@@ -414,7 +620,9 @@ Class that implements the command-line behaviour
|
|
414
620
|
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Storing local file: #{@opts["file"]}"</span>
|
415
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>] )
|
416
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>
|
417
|
-
<span class="ruby-
|
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> )
|
418
626
|
<span class="ruby-keyword kw">else</span>
|
419
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> )
|
420
628
|
<span class="ruby-keyword kw">end</span>
|
@@ -441,27 +649,56 @@ Class that implements the command-line behaviour
|
|
441
649
|
</div>
|
442
650
|
</div>
|
443
651
|
|
444
|
-
<div id="method-
|
445
|
-
<a name="
|
652
|
+
<div id="method-M000115" class="method-detail">
|
653
|
+
<a name="M000115"></a>
|
446
654
|
|
447
655
|
<div class="method-heading">
|
448
|
-
<a href="#
|
656
|
+
<a href="#M000115" 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('M000115-source');return false;">[Source]</a></p>
|
664
|
+
<div class="method-source-code" id="M000115-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-M000125" class="method-detail">
|
682
|
+
<a name="M000125"></a>
|
683
|
+
|
684
|
+
<div class="method-heading">
|
685
|
+
<a href="#M000125" class="method-signature">
|
449
686
|
<span class="method-name">upload</span><span class="method-args">()</span>
|
450
687
|
</a>
|
451
688
|
</div>
|
452
689
|
|
453
690
|
<div class="method-description">
|
454
691
|
<p><a class="source-toggle" href="#"
|
455
|
-
onclick="toggleCode('
|
456
|
-
<div class="method-source-code" id="
|
692
|
+
onclick="toggleCode('M000125-source');return false;">[Source]</a></p>
|
693
|
+
<div class="method-source-code" id="M000125-source">
|
457
694
|
<pre>
|
458
|
-
<span class="ruby-comment cmt"># File lib/pho/command_line.rb, line
|
695
|
+
<span class="ruby-comment cmt"># File lib/pho/command_line.rb, line 170</span>
|
459
696
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">upload</span>()
|
460
697
|
<span class="ruby-identifier">resp</span> = <span class="ruby-keyword kw">nil</span>
|
461
698
|
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@opts</span>[<span class="ruby-value str">"file"</span>]
|
462
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>] )
|
463
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>] )
|
464
|
-
<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>]
|
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>]
|
465
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>
|
466
703
|
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Uploading file: #{ @opts["file"] } to /items/#{ uri } as #{mime}"</span>
|
467
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> )
|
@@ -493,6 +730,31 @@ Class that implements the command-line behaviour
|
|
493
730
|
</div>
|
494
731
|
</div>
|
495
732
|
|
733
|
+
<div id="method-M000113" class="method-detail">
|
734
|
+
<a name="M000113"></a>
|
735
|
+
|
736
|
+
<div class="method-heading">
|
737
|
+
<a href="#M000113" 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('M000113-source');return false;">[Source]</a></p>
|
745
|
+
<div class="method-source-code" id="M000113-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
|
+
|
496
758
|
|
497
759
|
</div>
|
498
760
|
|