pho 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +6 -0
- data/README +9 -1
- data/Rakefile +1 -1
- data/doc/index.html +3 -1
- data/doc/rdoc/classes/Pho/Analyzers.html +310 -0
- data/doc/rdoc/classes/Pho/CommandLine.html +770 -0
- data/doc/rdoc/classes/Pho/DatatypeProperty.html +241 -0
- data/doc/rdoc/classes/Pho/Enrichment/StoreEnricher.html +410 -0
- data/doc/rdoc/classes/Pho/Enrichment.html +119 -0
- data/doc/rdoc/classes/Pho/Etags.html +310 -0
- data/doc/rdoc/classes/Pho/Facet/Results.html +299 -0
- data/doc/rdoc/classes/Pho/Facet/Term.html +177 -0
- data/doc/rdoc/classes/Pho/Facet.html +119 -0
- data/doc/rdoc/classes/Pho/FieldPredicateMap.html +695 -0
- data/doc/rdoc/classes/Pho/FieldWeighting.html +230 -0
- data/doc/rdoc/classes/Pho/FileManagement/AbstractFileManager.html +478 -0
- data/doc/rdoc/classes/Pho/FileManagement/FileManager.html +264 -0
- data/doc/rdoc/classes/Pho/FileManagement/RDFManager.html +259 -0
- data/doc/rdoc/classes/Pho/FileManagement.html +121 -0
- data/doc/rdoc/classes/Pho/Job.html +627 -0
- data/doc/rdoc/classes/Pho/JobUpdate.html +141 -0
- data/doc/rdoc/classes/Pho/Jobs.html +538 -0
- data/doc/rdoc/classes/Pho/Namespaces.html +164 -0
- data/doc/rdoc/classes/Pho/OAI/Record.html +165 -0
- data/doc/rdoc/classes/Pho/OAI/Records.html +331 -0
- data/doc/rdoc/classes/Pho/OAI.html +118 -0
- data/doc/rdoc/classes/Pho/QueryProfile.html +524 -0
- data/doc/rdoc/classes/Pho/RDF/Parser.html +279 -0
- data/doc/rdoc/classes/Pho/RDF.html +120 -0
- data/doc/rdoc/classes/Pho/RDFCollection.html +119 -0
- data/doc/rdoc/classes/Pho/ResourceHash/Converter.html +325 -0
- data/doc/rdoc/classes/Pho/ResourceHash/SetAlgebra.html +241 -0
- data/doc/rdoc/classes/Pho/ResourceHash.html +123 -0
- data/doc/rdoc/classes/Pho/Snapshot.html +402 -0
- data/doc/rdoc/classes/Pho/Sparql/SparqlClient.html +594 -0
- data/doc/rdoc/classes/Pho/Sparql/SparqlHelper.html +696 -0
- data/doc/rdoc/classes/Pho/Sparql.html +187 -0
- data/doc/rdoc/classes/Pho/Status.html +296 -0
- data/doc/rdoc/classes/Pho/Store.html +1569 -0
- data/doc/rdoc/classes/Pho/StoreSparqlClient.html +183 -0
- data/doc/rdoc/classes/Pho/Update/Changeset.html +521 -0
- data/doc/rdoc/classes/Pho/Update/ChangesetBuilder.html +330 -0
- data/doc/rdoc/classes/Pho/Update/ChangesetHelper.html +159 -0
- data/doc/rdoc/classes/Pho/Update/Changesets.html +205 -0
- data/doc/rdoc/classes/Pho/Update/LiteralStatement.html +257 -0
- data/doc/rdoc/classes/Pho/Update/ResourceStatement.html +237 -0
- data/doc/rdoc/classes/Pho/Update/Statement.html +303 -0
- data/doc/rdoc/classes/Pho/Update.html +128 -0
- data/doc/rdoc/classes/Pho.html +283 -0
- data/doc/rdoc/classes/String.html +146 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/CHANGES.html +373 -0
- data/doc/rdoc/files/README.html +204 -0
- data/doc/rdoc/files/lib/pho/changeset_builder_rb.html +108 -0
- data/doc/rdoc/files/lib/pho/changeset_rb.html +108 -0
- data/doc/rdoc/files/lib/pho/command_line_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/converter_rb.html +108 -0
- data/doc/rdoc/files/lib/pho/enrichment_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/etags_rb.html +108 -0
- data/doc/rdoc/files/lib/pho/facet_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/field_predicate_map_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/file_management_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/file_manager_rb.html +108 -0
- data/doc/rdoc/files/lib/pho/job_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/oai_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/query_profile_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/rdf_collection_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/rdf_rb.html +108 -0
- data/doc/rdoc/files/lib/pho/resource_hash_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/snapshot_rb.html +109 -0
- data/doc/rdoc/files/lib/pho/sparql_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/status_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/store_rb.html +108 -0
- data/doc/rdoc/files/lib/pho_rb.html +133 -0
- data/doc/rdoc/fr_class_index.html +72 -0
- data/doc/rdoc/fr_file_index.html +49 -0
- data/doc/rdoc/fr_method_index.html +239 -0
- data/doc/rdoc/index.html +24 -0
- data/doc/rdoc/rdoc-style.css +208 -0
- data/lib/pho/enrichment.rb +1 -0
- data/lib/pho/field_predicate_map.rb +5 -0
- data/lib/pho/query_profile.rb +5 -0
- data/lib/pho/store.rb +4 -1
- data/tests/tc_field_predicate_map.rb +7 -1
- data/tests/tc_query_profile.rb +6 -0
- data/tests/tc_store_util.rb +7 -0
- metadata +134 -21
@@ -0,0 +1,1569 @@
|
|
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::Store</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::Store</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/pho/store_rb.html">
|
59
|
+
lib/pho/store.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
|
+
The <a href="Store.html">Store</a> class acts as a lightweight client
|
84
|
+
interface to the Talis Platform API (<a
|
85
|
+
href="http://n2.talis.com/wiki/Platform_API">n2.talis.com/wiki/Platform_API</a>).
|
86
|
+
The class provides methods for interacting with each of the core platform
|
87
|
+
services, e.g. retrieving and storing <a href="RDF.html">RDF</a>,
|
88
|
+
performing searches, SPARQL queries, etc.
|
89
|
+
</p>
|
90
|
+
<h2>Usage</h2>
|
91
|
+
<pre>
|
92
|
+
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass")
|
93
|
+
store.store_file( File.new("/tmp/example.rdf") )
|
94
|
+
store.store_url( "http://www.example.org/example.rdf" )
|
95
|
+
store.describe( "http://www.example.org/thing" )
|
96
|
+
store.reset
|
97
|
+
</pre>
|
98
|
+
<h2>Examples</h2>
|
99
|
+
<p>
|
100
|
+
See the examples directory in the distribution
|
101
|
+
</p>
|
102
|
+
|
103
|
+
</div>
|
104
|
+
|
105
|
+
|
106
|
+
</div>
|
107
|
+
|
108
|
+
<div id="method-list">
|
109
|
+
<h3 class="section-bar">Methods</h3>
|
110
|
+
|
111
|
+
<div class="name-list">
|
112
|
+
<a href="#M000175">augment</a>
|
113
|
+
<a href="#M000174">augment_uri</a>
|
114
|
+
<a href="#M000159">build_uri</a>
|
115
|
+
<a href="#M000176">configure_headers_for_conditional_get</a>
|
116
|
+
<a href="#M000179">delete_item</a>
|
117
|
+
<a href="#M000163">describe</a>
|
118
|
+
<a href="#M000172">facet</a>
|
119
|
+
<a href="#M000187">get_field_predicate_map</a>
|
120
|
+
<a href="#M000180">get_item</a>
|
121
|
+
<a href="#M000181">get_job</a>
|
122
|
+
<a href="#M000182">get_jobs</a>
|
123
|
+
<a href="#M000189">get_query_profile</a>
|
124
|
+
<a href="#M000173">get_search_params</a>
|
125
|
+
<a href="#M000185">get_snapshots</a>
|
126
|
+
<a href="#M000184">get_status</a>
|
127
|
+
<a href="#M000186">list_records</a>
|
128
|
+
<a href="#M000157">new</a>
|
129
|
+
<a href="#M000188">put_field_predicate_map</a>
|
130
|
+
<a href="#M000190">put_query_profile</a>
|
131
|
+
<a href="#M000177">record_etags</a>
|
132
|
+
<a href="#M000171">search</a>
|
133
|
+
<a href="#M000158">set_credentials</a>
|
134
|
+
<a href="#M000170">sparql</a>
|
135
|
+
<a href="#M000168">sparql_ask</a>
|
136
|
+
<a href="#M000165">sparql_client</a>
|
137
|
+
<a href="#M000167">sparql_construct</a>
|
138
|
+
<a href="#M000166">sparql_describe</a>
|
139
|
+
<a href="#M000169">sparql_select</a>
|
140
|
+
<a href="#M000160">store_data</a>
|
141
|
+
<a href="#M000161">store_file</a>
|
142
|
+
<a href="#M000162">store_url</a>
|
143
|
+
<a href="#M000164">submit_changeset</a>
|
144
|
+
<a href="#M000183">submit_job</a>
|
145
|
+
<a href="#M000178">upload_item</a>
|
146
|
+
</div>
|
147
|
+
</div>
|
148
|
+
|
149
|
+
</div>
|
150
|
+
|
151
|
+
|
152
|
+
<!-- if includes -->
|
153
|
+
|
154
|
+
<div id="section">
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
<div id="attribute-list">
|
161
|
+
<h3 class="section-bar">Attributes</h3>
|
162
|
+
|
163
|
+
<div class="name-list">
|
164
|
+
<table>
|
165
|
+
<tr class="top-aligned-row context-row">
|
166
|
+
<td class="context-item-name">client</td>
|
167
|
+
<td class="context-item-value"> [R] </td>
|
168
|
+
<td class="context-item-desc">
|
169
|
+
Retrieve the HTTPClient instance being used by this object
|
170
|
+
|
171
|
+
</td>
|
172
|
+
</tr>
|
173
|
+
<tr class="top-aligned-row context-row">
|
174
|
+
<td class="context-item-name">name</td>
|
175
|
+
<td class="context-item-value"> [R] </td>
|
176
|
+
<td class="context-item-desc">
|
177
|
+
Name of store
|
178
|
+
|
179
|
+
</td>
|
180
|
+
</tr>
|
181
|
+
<tr class="top-aligned-row context-row">
|
182
|
+
<td class="context-item-name">storeuri</td>
|
183
|
+
<td class="context-item-value"> [R] </td>
|
184
|
+
<td class="context-item-desc">
|
185
|
+
Retrieve the base uri of this store
|
186
|
+
|
187
|
+
</td>
|
188
|
+
</tr>
|
189
|
+
<tr class="top-aligned-row context-row">
|
190
|
+
<td class="context-item-name">username</td>
|
191
|
+
<td class="context-item-value"> [R] </td>
|
192
|
+
<td class="context-item-desc">
|
193
|
+
Retrieve the admin username configured in this instance
|
194
|
+
|
195
|
+
</td>
|
196
|
+
</tr>
|
197
|
+
</table>
|
198
|
+
</div>
|
199
|
+
</div>
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
<!-- if method_list -->
|
204
|
+
<div id="methods">
|
205
|
+
<h3 class="section-bar">Public Class methods</h3>
|
206
|
+
|
207
|
+
<div id="method-M000157" class="method-detail">
|
208
|
+
<a name="M000157"></a>
|
209
|
+
|
210
|
+
<div class="method-heading">
|
211
|
+
<a href="#M000157" class="method-signature">
|
212
|
+
<span class="method-name">new</span><span class="method-args">(storeuri, username=nil, password=nil, client = HTTPClient.new() )</span>
|
213
|
+
</a>
|
214
|
+
</div>
|
215
|
+
|
216
|
+
<div class="method-description">
|
217
|
+
<p>
|
218
|
+
Create an instance of the store class
|
219
|
+
</p>
|
220
|
+
<table>
|
221
|
+
<tr><td valign="top">storeuri:</td><td>base uri for the Platform store to be accessed
|
222
|
+
|
223
|
+
</td></tr>
|
224
|
+
<tr><td valign="top">username:</td><td>admin username, may be nil
|
225
|
+
|
226
|
+
</td></tr>
|
227
|
+
<tr><td valign="top">password:</td><td>admin password, may be nil
|
228
|
+
|
229
|
+
</td></tr>
|
230
|
+
<tr><td valign="top">client:</td><td>an instance of HTTPClient
|
231
|
+
|
232
|
+
</td></tr>
|
233
|
+
</table>
|
234
|
+
<p><a class="source-toggle" href="#"
|
235
|
+
onclick="toggleCode('M000157-source');return false;">[Source]</a></p>
|
236
|
+
<div class="method-source-code" id="M000157-source">
|
237
|
+
<pre>
|
238
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 45</span>
|
239
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">storeuri</span>, <span class="ruby-identifier">username</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">password</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">client</span> = <span class="ruby-constant">HTTPClient</span>.<span class="ruby-identifier">new</span>() )
|
240
|
+
<span class="ruby-ivar">@storeuri</span> = <span class="ruby-identifier">storeuri</span>.<span class="ruby-identifier">chomp</span>(<span class="ruby-value str">"/"</span>)
|
241
|
+
<span class="ruby-ivar">@name</span> = <span class="ruby-identifier">storeuri</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">"/"</span>).<span class="ruby-identifier">last</span>
|
242
|
+
<span class="ruby-ivar">@username</span> = <span class="ruby-identifier">username</span>
|
243
|
+
<span class="ruby-ivar">@password</span> = <span class="ruby-identifier">password</span>
|
244
|
+
<span class="ruby-ivar">@client</span> = <span class="ruby-identifier">client</span>
|
245
|
+
<span class="ruby-identifier">set_credentials</span>(<span class="ruby-identifier">username</span>, <span class="ruby-identifier">password</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">username</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">password</span>
|
246
|
+
<span class="ruby-keyword kw">end</span>
|
247
|
+
</pre>
|
248
|
+
</div>
|
249
|
+
</div>
|
250
|
+
</div>
|
251
|
+
|
252
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
253
|
+
|
254
|
+
<div id="method-M000175" class="method-detail">
|
255
|
+
<a name="M000175"></a>
|
256
|
+
|
257
|
+
<div class="method-heading">
|
258
|
+
<a href="#M000175" class="method-signature">
|
259
|
+
<span class="method-name">augment</span><span class="method-args">(data)</span>
|
260
|
+
</a>
|
261
|
+
</div>
|
262
|
+
|
263
|
+
<div class="method-description">
|
264
|
+
<p>
|
265
|
+
Augment an RSS feed against data int this store by POSTing it to the
|
266
|
+
Platform
|
267
|
+
</p>
|
268
|
+
<table>
|
269
|
+
<tr><td valign="top">data:</td><td>a <a href="../String.html">String</a> containing the RSS feed
|
270
|
+
|
271
|
+
</td></tr>
|
272
|
+
</table>
|
273
|
+
<p><a class="source-toggle" href="#"
|
274
|
+
onclick="toggleCode('M000175-source');return false;">[Source]</a></p>
|
275
|
+
<div class="method-source-code" id="M000175-source">
|
276
|
+
<pre>
|
277
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 310</span>
|
278
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">augment</span>(<span class="ruby-identifier">data</span>)
|
279
|
+
<span class="ruby-identifier">u</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">"/services/augment"</span>)
|
280
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">post</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">data</span>, {<span class="ruby-value str">"Content-Type"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"application/rss+xml"</span>})
|
281
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
|
282
|
+
<span class="ruby-keyword kw">end</span>
|
283
|
+
</pre>
|
284
|
+
</div>
|
285
|
+
</div>
|
286
|
+
</div>
|
287
|
+
|
288
|
+
<div id="method-M000174" class="method-detail">
|
289
|
+
<a name="M000174"></a>
|
290
|
+
|
291
|
+
<div class="method-heading">
|
292
|
+
<a href="#M000174" class="method-signature">
|
293
|
+
<span class="method-name">augment_uri</span><span class="method-args">(uri)</span>
|
294
|
+
</a>
|
295
|
+
</div>
|
296
|
+
|
297
|
+
<div class="method-description">
|
298
|
+
<p>
|
299
|
+
Augment an RSS feed that can be retrieved from the specified URL, against
|
300
|
+
data in this store
|
301
|
+
</p>
|
302
|
+
<table>
|
303
|
+
<tr><td valign="top">uri:</td><td>the URL for the RSS 1.0 feed
|
304
|
+
|
305
|
+
</td></tr>
|
306
|
+
</table>
|
307
|
+
<p><a class="source-toggle" href="#"
|
308
|
+
onclick="toggleCode('M000174-source');return false;">[Source]</a></p>
|
309
|
+
<div class="method-source-code" id="M000174-source">
|
310
|
+
<pre>
|
311
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 301</span>
|
312
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">augment_uri</span>(<span class="ruby-identifier">uri</span>)
|
313
|
+
<span class="ruby-identifier">u</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">"/services/augment"</span>)
|
314
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, {<span class="ruby-value str">"data-uri"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">uri</span>})
|
315
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
|
316
|
+
<span class="ruby-keyword kw">end</span>
|
317
|
+
</pre>
|
318
|
+
</div>
|
319
|
+
</div>
|
320
|
+
</div>
|
321
|
+
|
322
|
+
<div id="method-M000159" class="method-detail">
|
323
|
+
<a name="M000159"></a>
|
324
|
+
|
325
|
+
<div class="method-heading">
|
326
|
+
<a href="#M000159" class="method-signature">
|
327
|
+
<span class="method-name">build_uri</span><span class="method-args">(uri)</span>
|
328
|
+
</a>
|
329
|
+
</div>
|
330
|
+
|
331
|
+
<div class="method-description">
|
332
|
+
<p>
|
333
|
+
Build a request uri, by concatenating it with the base uri of the store
|
334
|
+
</p>
|
335
|
+
<table>
|
336
|
+
<tr><td valign="top">uri:</td><td>relative URI to store service, e.g. "/service/sparql"
|
337
|
+
|
338
|
+
</td></tr>
|
339
|
+
</table>
|
340
|
+
<p><a class="source-toggle" href="#"
|
341
|
+
onclick="toggleCode('M000159-source');return false;">[Source]</a></p>
|
342
|
+
<div class="method-source-code" id="M000159-source">
|
343
|
+
<pre>
|
344
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 64</span>
|
345
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build_uri</span>(<span class="ruby-identifier">uri</span>)
|
346
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">start_with?</span>(<span class="ruby-ivar">@storeuri</span>))
|
347
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">uri</span>
|
348
|
+
<span class="ruby-keyword kw">end</span>
|
349
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">start_with?</span>(<span class="ruby-value str">"/"</span>)
|
350
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@storeuri</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">uri</span>
|
351
|
+
<span class="ruby-keyword kw">else</span>
|
352
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@storeuri</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"/"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">uri</span>
|
353
|
+
<span class="ruby-keyword kw">end</span>
|
354
|
+
<span class="ruby-keyword kw">end</span>
|
355
|
+
</pre>
|
356
|
+
</div>
|
357
|
+
</div>
|
358
|
+
</div>
|
359
|
+
|
360
|
+
<div id="method-M000176" class="method-detail">
|
361
|
+
<a name="M000176"></a>
|
362
|
+
|
363
|
+
<div class="method-heading">
|
364
|
+
<a href="#M000176" class="method-signature">
|
365
|
+
<span class="method-name">configure_headers_for_conditional_get</span><span class="method-args">(u, headers, etags, if_match)</span>
|
366
|
+
</a>
|
367
|
+
</div>
|
368
|
+
|
369
|
+
<div class="method-description">
|
370
|
+
<p>
|
371
|
+
Added appropriate http header for conditional get requests
|
372
|
+
</p>
|
373
|
+
<p><a class="source-toggle" href="#"
|
374
|
+
onclick="toggleCode('M000176-source');return false;">[Source]</a></p>
|
375
|
+
<div class="method-source-code" id="M000176-source">
|
376
|
+
<pre>
|
377
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 317</span>
|
378
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">configure_headers_for_conditional_get</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">etags</span>, <span class="ruby-identifier">if_match</span>)
|
379
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">etags</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">etags</span>.<span class="ruby-identifier">has_tag?</span>(<span class="ruby-identifier">u</span>)
|
380
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">if_match</span>
|
381
|
+
<span class="ruby-identifier">headers</span>[<span class="ruby-value str">"If-Match"</span>] = <span class="ruby-identifier">etags</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>)
|
382
|
+
<span class="ruby-keyword kw">else</span>
|
383
|
+
<span class="ruby-identifier">headers</span>[<span class="ruby-value str">"If-None-Match"</span>] = <span class="ruby-identifier">etags</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>)
|
384
|
+
<span class="ruby-keyword kw">end</span>
|
385
|
+
<span class="ruby-keyword kw">end</span>
|
386
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">headers</span>
|
387
|
+
<span class="ruby-keyword kw">end</span>
|
388
|
+
</pre>
|
389
|
+
</div>
|
390
|
+
</div>
|
391
|
+
</div>
|
392
|
+
|
393
|
+
<div id="method-M000179" class="method-detail">
|
394
|
+
<a name="M000179"></a>
|
395
|
+
|
396
|
+
<div class="method-heading">
|
397
|
+
<a href="#M000179" class="method-signature">
|
398
|
+
<span class="method-name">delete_item</span><span class="method-args">(uri)</span>
|
399
|
+
</a>
|
400
|
+
</div>
|
401
|
+
|
402
|
+
<div class="method-description">
|
403
|
+
<p>
|
404
|
+
Delete an item from the Contentbox in this <a href="Store.html">Store</a>
|
405
|
+
</p>
|
406
|
+
<table>
|
407
|
+
<tr><td valign="top">uri:</td><td>the URL of the item, can be relative
|
408
|
+
|
409
|
+
</td></tr>
|
410
|
+
</table>
|
411
|
+
<p>
|
412
|
+
TODO: conditional deletes
|
413
|
+
</p>
|
414
|
+
<p><a class="source-toggle" href="#"
|
415
|
+
onclick="toggleCode('M000179-source');return false;">[Source]</a></p>
|
416
|
+
<div class="method-source-code" id="M000179-source">
|
417
|
+
<pre>
|
418
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 372</span>
|
419
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete_item</span>(<span class="ruby-identifier">uri</span>)
|
420
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">uri</span>.<span class="ruby-identifier">start_with?</span>(<span class="ruby-ivar">@storeuri</span>)
|
421
|
+
<span class="ruby-identifier">uri</span> = <span class="ruby-identifier">build_uri</span>(<span class="ruby-identifier">uri</span>)
|
422
|
+
<span class="ruby-keyword kw">end</span>
|
423
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">uri</span>)
|
424
|
+
<span class="ruby-keyword kw">end</span>
|
425
|
+
</pre>
|
426
|
+
</div>
|
427
|
+
</div>
|
428
|
+
</div>
|
429
|
+
|
430
|
+
<div id="method-M000163" class="method-detail">
|
431
|
+
<a name="M000163"></a>
|
432
|
+
|
433
|
+
<div class="method-heading">
|
434
|
+
<a href="#M000163" class="method-signature">
|
435
|
+
<span class="method-name">describe</span><span class="method-args">(uri, format="application/rdf+xml", etags=nil, if_match=false)</span>
|
436
|
+
</a>
|
437
|
+
</div>
|
438
|
+
|
439
|
+
<div class="method-description">
|
440
|
+
<p>
|
441
|
+
Retrieve an <a href="RDF.html">RDF</a> description of a specific URI. The
|
442
|
+
default behaviour will be to retrieve an <a href="RDF.html">RDF</a>/XML
|
443
|
+
document, but other formats can be requested, as supported by the Talis
|
444
|
+
Platform. E.g. application/json
|
445
|
+
</p>
|
446
|
+
<table>
|
447
|
+
<tr><td valign="top">uri:</td><td>the URI of the resource to <a href="Store.html#M000163">describe</a>
|
448
|
+
|
449
|
+
</td></tr>
|
450
|
+
<tr><td valign="top">format:</td><td>the preferred response format
|
451
|
+
|
452
|
+
</td></tr>
|
453
|
+
<tr><td valign="top">etags:</td><td>an instance of the <a href="Etags.html">Pho::Etags</a> class to support
|
454
|
+
conditional GETs
|
455
|
+
|
456
|
+
</td></tr>
|
457
|
+
<tr><td valign="top">if_match:</td><td>specify true to retrieve data only if the version matches a known ETag,
|
458
|
+
false to perform a Conditional GET
|
459
|
+
|
460
|
+
</td></tr>
|
461
|
+
</table>
|
462
|
+
<p>
|
463
|
+
Note that this method is different from <a
|
464
|
+
href="Store.html#M000166">sparql_describe</a> in that it is intended to be
|
465
|
+
used to generate a description of a single URI, using an separated service
|
466
|
+
exposed by the Platform. This service is optimised for retrieval of
|
467
|
+
descriptions for single resources and supports HTTP caching and conditional
|
468
|
+
retrieval. The <a href="Store.html#M000166">sparql_describe</a> method
|
469
|
+
should be used to submit more complex DESCRIBE queries to the Platform,
|
470
|
+
e.g. to generate descriptions of resources matching a particular graph
|
471
|
+
pattern.
|
472
|
+
</p>
|
473
|
+
<p><a class="source-toggle" href="#"
|
474
|
+
onclick="toggleCode('M000163-source');return false;">[Source]</a></p>
|
475
|
+
<div class="method-source-code" id="M000163-source">
|
476
|
+
<pre>
|
477
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 151</span>
|
478
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">describe</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">format</span>=<span class="ruby-value str">"application/rdf+xml"</span>, <span class="ruby-identifier">etags</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">if_match</span>=<span class="ruby-keyword kw">false</span>)
|
479
|
+
<span class="ruby-identifier">u</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">"/meta"</span>)
|
480
|
+
<span class="ruby-identifier">headers</span> = {<span class="ruby-value str">"Accept"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">format</span>}
|
481
|
+
<span class="ruby-identifier">headers</span> = <span class="ruby-identifier">configure_headers_for_conditional_get</span>(<span class="ruby-node">"#{u}?about=#{uri}"</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">etags</span>, <span class="ruby-identifier">if_match</span>)
|
482
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, {<span class="ruby-value str">"about"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">uri</span>}, <span class="ruby-identifier">headers</span> )
|
483
|
+
<span class="ruby-identifier">record_etags</span>(<span class="ruby-node">"#{u}?about=#{uri}"</span>, <span class="ruby-identifier">etags</span>, <span class="ruby-identifier">response</span>)
|
484
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
|
485
|
+
<span class="ruby-keyword kw">end</span>
|
486
|
+
</pre>
|
487
|
+
</div>
|
488
|
+
</div>
|
489
|
+
</div>
|
490
|
+
|
491
|
+
<div id="method-M000172" class="method-detail">
|
492
|
+
<a name="M000172"></a>
|
493
|
+
|
494
|
+
<div class="method-heading">
|
495
|
+
<a href="#M000172" class="method-signature">
|
496
|
+
<span class="method-name">facet</span><span class="method-args">(query, facets, params=nil)</span>
|
497
|
+
</a>
|
498
|
+
</div>
|
499
|
+
|
500
|
+
<div class="method-description">
|
501
|
+
<p>
|
502
|
+
Perform a facetted <a href="Store.html#M000171">search</a> against the
|
503
|
+
Metabox indexes.
|
504
|
+
</p>
|
505
|
+
<table>
|
506
|
+
<tr><td valign="top">query:</td><td>the query to perform. See XXXX for query syntax
|
507
|
+
|
508
|
+
</td></tr>
|
509
|
+
<tr><td valign="top">facets:</td><td>an ordered list of facets to be used
|
510
|
+
|
511
|
+
</td></tr>
|
512
|
+
<tr><td valign="top">params:</td><td>additional query parameters (see below)
|
513
|
+
|
514
|
+
</td></tr>
|
515
|
+
</table>
|
516
|
+
<p>
|
517
|
+
The <em>params</em> hash can contain the following values:
|
518
|
+
</p>
|
519
|
+
<ul>
|
520
|
+
<li><b>top</b>: the maximum number of results to return for each <a
|
521
|
+
href="Store.html#M000172">facet</a>
|
522
|
+
|
523
|
+
</li>
|
524
|
+
<li><b>output</b>: the preferred response format, can be html or xml (the
|
525
|
+
default)
|
526
|
+
|
527
|
+
</li>
|
528
|
+
</ul>
|
529
|
+
<p><a class="source-toggle" href="#"
|
530
|
+
onclick="toggleCode('M000172-source');return false;">[Source]</a></p>
|
531
|
+
<div class="method-source-code" id="M000172-source">
|
532
|
+
<pre>
|
533
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 276</span>
|
534
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">facet</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">facets</span>, <span class="ruby-identifier">params</span>=<span class="ruby-keyword kw">nil</span>)
|
535
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">facets</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">facets</span>.<span class="ruby-identifier">empty?</span>
|
536
|
+
<span class="ruby-comment cmt">#todo</span>
|
537
|
+
<span class="ruby-identifier">throw</span>
|
538
|
+
<span class="ruby-keyword kw">end</span>
|
539
|
+
<span class="ruby-identifier">u</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">"/services/facet"</span>)
|
540
|
+
<span class="ruby-identifier">search_params</span> = <span class="ruby-identifier">get_search_params</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">query</span>, <span class="ruby-identifier">params</span>)
|
541
|
+
<span class="ruby-identifier">search_params</span>[<span class="ruby-value str">"fields"</span>] = <span class="ruby-identifier">facets</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">","</span>)
|
542
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">search_params</span>)
|
543
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
|
544
|
+
<span class="ruby-keyword kw">end</span>
|
545
|
+
</pre>
|
546
|
+
</div>
|
547
|
+
</div>
|
548
|
+
</div>
|
549
|
+
|
550
|
+
<div id="method-M000187" class="method-detail">
|
551
|
+
<a name="M000187"></a>
|
552
|
+
|
553
|
+
<div class="method-heading">
|
554
|
+
<a href="#M000187" class="method-signature">
|
555
|
+
<span class="method-name">get_field_predicate_map</span><span class="method-args">(output=ACCEPT_JSON)</span>
|
556
|
+
</a>
|
557
|
+
</div>
|
558
|
+
|
559
|
+
<div class="method-description">
|
560
|
+
<p>
|
561
|
+
Read the field predicate map configuration for this store. The config can
|
562
|
+
be requested in any format supported by the platform, but the default will
|
563
|
+
return JSON. See <a
|
564
|
+
href="FieldPredicateMap.html#M000094">FieldPredicateMap.read_from_store</a>
|
565
|
+
for a convenient way to quickly create a <a
|
566
|
+
href="FieldPredicateMap.html">FieldPredicateMap</a> object based on a
|
567
|
+
specific stores‘s configuration.
|
568
|
+
</p>
|
569
|
+
<table>
|
570
|
+
<tr><td valign="top">output:</td><td>mimetype to use in request
|
571
|
+
|
572
|
+
</td></tr>
|
573
|
+
</table>
|
574
|
+
<p><a class="source-toggle" href="#"
|
575
|
+
onclick="toggleCode('M000187-source');return false;">[Source]</a></p>
|
576
|
+
<div class="method-source-code" id="M000187-source">
|
577
|
+
<pre>
|
578
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 474</span>
|
579
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_field_predicate_map</span>(<span class="ruby-identifier">output</span>=<span class="ruby-constant">ACCEPT_JSON</span>)
|
580
|
+
<span class="ruby-identifier">u</span> = <span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">"/config/fpmaps/1"</span>)
|
581
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">output</span>)
|
582
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
|
583
|
+
<span class="ruby-keyword kw">end</span>
|
584
|
+
</pre>
|
585
|
+
</div>
|
586
|
+
</div>
|
587
|
+
</div>
|
588
|
+
|
589
|
+
<div id="method-M000180" class="method-detail">
|
590
|
+
<a name="M000180"></a>
|
591
|
+
|
592
|
+
<div class="method-heading">
|
593
|
+
<a href="#M000180" class="method-signature">
|
594
|
+
<span class="method-name">get_item</span><span class="method-args">(uri, etags=nil, if_match=false)</span>
|
595
|
+
</a>
|
596
|
+
</div>
|
597
|
+
|
598
|
+
<div class="method-description">
|
599
|
+
<p>
|
600
|
+
Get an item from the Contebtbox.
|
601
|
+
</p>
|
602
|
+
<table>
|
603
|
+
<tr><td valign="top">uri:</td><td>the URL of the item, can be relative.
|
604
|
+
|
605
|
+
</td></tr>
|
606
|
+
</table>
|
607
|
+
<p>
|
608
|
+
If the provided URL of the item is not in the Contentbox, then the response
|
609
|
+
will be a redirect to the <a href="RDF.html">RDF</a> description of this
|
610
|
+
item, as available from the Metabox.
|
611
|
+
</p>
|
612
|
+
<p>
|
613
|
+
TODO: document etags, redirects
|
614
|
+
</p>
|
615
|
+
<p><a class="source-toggle" href="#"
|
616
|
+
onclick="toggleCode('M000180-source');return false;">[Source]</a></p>
|
617
|
+
<div class="method-source-code" id="M000180-source">
|
618
|
+
<pre>
|
619
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 386</span>
|
620
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_item</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">etags</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">if_match</span>=<span class="ruby-keyword kw">false</span>)
|
621
|
+
<span class="ruby-identifier">u</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">build_uri</span>(<span class="ruby-identifier">uri</span>)
|
622
|
+
<span class="ruby-identifier">headers</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
623
|
+
<span class="ruby-identifier">headers</span> = <span class="ruby-identifier">configure_headers_for_conditional_get</span>(<span class="ruby-node">"#{u}"</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">etags</span>, <span class="ruby-identifier">if_match</span>)
|
624
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">headers</span>)
|
625
|
+
<span class="ruby-identifier">record_etags</span>(<span class="ruby-node">"#{u}"</span>, <span class="ruby-identifier">etags</span>, <span class="ruby-identifier">response</span>)
|
626
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
|
627
|
+
<span class="ruby-keyword kw">end</span>
|
628
|
+
</pre>
|
629
|
+
</div>
|
630
|
+
</div>
|
631
|
+
</div>
|
632
|
+
|
633
|
+
<div id="method-M000181" class="method-detail">
|
634
|
+
<a name="M000181"></a>
|
635
|
+
|
636
|
+
<div class="method-heading">
|
637
|
+
<a href="#M000181" class="method-signature">
|
638
|
+
<span class="method-name">get_job</span><span class="method-args">(uri)</span>
|
639
|
+
</a>
|
640
|
+
</div>
|
641
|
+
|
642
|
+
<div class="method-description">
|
643
|
+
<p>
|
644
|
+
Retrieve metadata about a single job. Use <a
|
645
|
+
href="Job.html#M000199">Job.read_from_store</a> as a convenience function
|
646
|
+
which will return a fully-populated <a href="Job.html">Job</a> object
|
647
|
+
</p>
|
648
|
+
<table>
|
649
|
+
<tr><td valign="top">uri:</td><td>the uri of the job to retrieve
|
650
|
+
|
651
|
+
</td></tr>
|
652
|
+
</table>
|
653
|
+
<p><a class="source-toggle" href="#"
|
654
|
+
onclick="toggleCode('M000181-source');return false;">[Source]</a></p>
|
655
|
+
<div class="method-source-code" id="M000181-source">
|
656
|
+
<pre>
|
657
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 403</span>
|
658
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_job</span>(<span class="ruby-identifier">uri</span>)
|
659
|
+
<span class="ruby-identifier">u</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">build_uri</span>(<span class="ruby-identifier">uri</span>)
|
660
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-constant">ACCEPT_RDF</span>)
|
661
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
|
662
|
+
<span class="ruby-keyword kw">end</span>
|
663
|
+
</pre>
|
664
|
+
</div>
|
665
|
+
</div>
|
666
|
+
</div>
|
667
|
+
|
668
|
+
<div id="method-M000182" class="method-detail">
|
669
|
+
<a name="M000182"></a>
|
670
|
+
|
671
|
+
<div class="method-heading">
|
672
|
+
<a href="#M000182" class="method-signature">
|
673
|
+
<span class="method-name">get_jobs</span><span class="method-args">()</span>
|
674
|
+
</a>
|
675
|
+
</div>
|
676
|
+
|
677
|
+
<div class="method-description">
|
678
|
+
<p>
|
679
|
+
Retrieve metadata about the Scheduled <a href="Jobs.html">Jobs</a>
|
680
|
+
Collection from the store
|
681
|
+
</p>
|
682
|
+
<p><a class="source-toggle" href="#"
|
683
|
+
onclick="toggleCode('M000182-source');return false;">[Source]</a></p>
|
684
|
+
<div class="method-source-code" id="M000182-source">
|
685
|
+
<pre>
|
686
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 410</span>
|
687
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_jobs</span>()
|
688
|
+
<span class="ruby-identifier">u</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">"/jobs"</span>)
|
689
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-constant">ACCEPT_RDF</span>)
|
690
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
|
691
|
+
<span class="ruby-keyword kw">end</span>
|
692
|
+
</pre>
|
693
|
+
</div>
|
694
|
+
</div>
|
695
|
+
</div>
|
696
|
+
|
697
|
+
<div id="method-M000189" class="method-detail">
|
698
|
+
<a name="M000189"></a>
|
699
|
+
|
700
|
+
<div class="method-heading">
|
701
|
+
<a href="#M000189" class="method-signature">
|
702
|
+
<span class="method-name">get_query_profile</span><span class="method-args">(output=ACCEPT_JSON)</span>
|
703
|
+
</a>
|
704
|
+
</div>
|
705
|
+
|
706
|
+
<div class="method-description">
|
707
|
+
<p>
|
708
|
+
Read the query profile configuration for this store. The config can be
|
709
|
+
requested in any format supported by the platform, but the default will
|
710
|
+
return JSON. See <a
|
711
|
+
href="QueryProfile.html#M000132">QueryProfile.read_from_store</a> for a
|
712
|
+
convenient way to quickly create a <a
|
713
|
+
href="QueryProfile.html">QueryProfile</a> object based on a specific
|
714
|
+
stores‘s configuration.
|
715
|
+
</p>
|
716
|
+
<table>
|
717
|
+
<tr><td valign="top">output:</td><td>mimetype to use in request
|
718
|
+
|
719
|
+
</td></tr>
|
720
|
+
</table>
|
721
|
+
<p><a class="source-toggle" href="#"
|
722
|
+
onclick="toggleCode('M000189-source');return false;">[Source]</a></p>
|
723
|
+
<div class="method-source-code" id="M000189-source">
|
724
|
+
<pre>
|
725
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 495</span>
|
726
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_query_profile</span>(<span class="ruby-identifier">output</span>=<span class="ruby-constant">ACCEPT_JSON</span>)
|
727
|
+
<span class="ruby-identifier">u</span> = <span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">"/config/queryprofiles/1"</span>)
|
728
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">output</span>)
|
729
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
|
730
|
+
<span class="ruby-keyword kw">end</span>
|
731
|
+
</pre>
|
732
|
+
</div>
|
733
|
+
</div>
|
734
|
+
</div>
|
735
|
+
|
736
|
+
<div id="method-M000173" class="method-detail">
|
737
|
+
<a name="M000173"></a>
|
738
|
+
|
739
|
+
<div class="method-heading">
|
740
|
+
<a href="#M000173" class="method-signature">
|
741
|
+
<span class="method-name">get_search_params</span><span class="method-args">(u, query, params)</span>
|
742
|
+
</a>
|
743
|
+
</div>
|
744
|
+
|
745
|
+
<div class="method-description">
|
746
|
+
<p><a class="source-toggle" href="#"
|
747
|
+
onclick="toggleCode('M000173-source');return false;">[Source]</a></p>
|
748
|
+
<div class="method-source-code" id="M000173-source">
|
749
|
+
<pre>
|
750
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 288</span>
|
751
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_search_params</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">query</span>, <span class="ruby-identifier">params</span>)
|
752
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
|
753
|
+
<span class="ruby-identifier">search_params</span> = <span class="ruby-identifier">params</span>.<span class="ruby-identifier">clone</span>()
|
754
|
+
<span class="ruby-keyword kw">else</span>
|
755
|
+
<span class="ruby-identifier">search_params</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
756
|
+
<span class="ruby-keyword kw">end</span>
|
757
|
+
<span class="ruby-identifier">search_params</span>[<span class="ruby-value str">"query"</span>] = <span class="ruby-identifier">query</span>
|
758
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">search_params</span>
|
759
|
+
<span class="ruby-keyword kw">end</span>
|
760
|
+
</pre>
|
761
|
+
</div>
|
762
|
+
</div>
|
763
|
+
</div>
|
764
|
+
|
765
|
+
<div id="method-M000185" class="method-detail">
|
766
|
+
<a name="M000185"></a>
|
767
|
+
|
768
|
+
<div class="method-heading">
|
769
|
+
<a href="#M000185" class="method-signature">
|
770
|
+
<span class="method-name">get_snapshots</span><span class="method-args">()</span>
|
771
|
+
</a>
|
772
|
+
</div>
|
773
|
+
|
774
|
+
<div class="method-description">
|
775
|
+
<p>
|
776
|
+
Retrieve the list of snapshots for this store
|
777
|
+
</p>
|
778
|
+
<p>
|
779
|
+
Currently the response will contain an HTML document. Use <a
|
780
|
+
href="Snapshot.html#M000192">Snapshot.parse</a> to turn this into a <a
|
781
|
+
href="Snapshot.html">Snapshot</a> object
|
782
|
+
</p>
|
783
|
+
<p><a class="source-toggle" href="#"
|
784
|
+
onclick="toggleCode('M000185-source');return false;">[Source]</a></p>
|
785
|
+
<div class="method-source-code" id="M000185-source">
|
786
|
+
<pre>
|
787
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 439</span>
|
788
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_snapshots</span>()
|
789
|
+
<span class="ruby-identifier">u</span> = <span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">"/snapshots"</span>)
|
790
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-constant">ACCEPT_RDF</span>)
|
791
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
|
792
|
+
<span class="ruby-keyword kw">end</span>
|
793
|
+
</pre>
|
794
|
+
</div>
|
795
|
+
</div>
|
796
|
+
</div>
|
797
|
+
|
798
|
+
<div id="method-M000184" class="method-detail">
|
799
|
+
<a name="M000184"></a>
|
800
|
+
|
801
|
+
<div class="method-heading">
|
802
|
+
<a href="#M000184" class="method-signature">
|
803
|
+
<span class="method-name">get_status</span><span class="method-args">()</span>
|
804
|
+
</a>
|
805
|
+
</div>
|
806
|
+
|
807
|
+
<div class="method-description">
|
808
|
+
<p>
|
809
|
+
ADMIN
|
810
|
+
</p>
|
811
|
+
<p><a class="source-toggle" href="#"
|
812
|
+
onclick="toggleCode('M000184-source');return false;">[Source]</a></p>
|
813
|
+
<div class="method-source-code" id="M000184-source">
|
814
|
+
<pre>
|
815
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 429</span>
|
816
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_status</span>()
|
817
|
+
<span class="ruby-identifier">u</span> = <span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">"/config/access-status"</span>)
|
818
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-constant">ACCEPT_JSON</span> )
|
819
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
|
820
|
+
<span class="ruby-keyword kw">end</span>
|
821
|
+
</pre>
|
822
|
+
</div>
|
823
|
+
</div>
|
824
|
+
</div>
|
825
|
+
|
826
|
+
<div id="method-M000186" class="method-detail">
|
827
|
+
<a name="M000186"></a>
|
828
|
+
|
829
|
+
<div class="method-heading">
|
830
|
+
<a href="#M000186" class="method-signature">
|
831
|
+
<span class="method-name">list_records</span><span class="method-args">(from=nil, to=nil, resumption_token=nil)</span>
|
832
|
+
</a>
|
833
|
+
</div>
|
834
|
+
|
835
|
+
<div class="method-description">
|
836
|
+
<p>
|
837
|
+
<a href="OAI.html">OAI</a>
|
838
|
+
</p>
|
839
|
+
<p><a class="source-toggle" href="#"
|
840
|
+
onclick="toggleCode('M000186-source');return false;">[Source]</a></p>
|
841
|
+
<div class="method-source-code" id="M000186-source">
|
842
|
+
<pre>
|
843
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 449</span>
|
844
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">list_records</span>(<span class="ruby-identifier">from</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">to</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">resumption_token</span>=<span class="ruby-keyword kw">nil</span>)
|
845
|
+
<span class="ruby-identifier">u</span> = <span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">"/services/oai-pmh"</span>)
|
846
|
+
<span class="ruby-identifier">params</span> = {<span class="ruby-value str">"verb"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"ListRecords"</span>, <span class="ruby-value str">"metadataPrefix"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"oai_dc"</span>}
|
847
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">from</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
|
848
|
+
<span class="ruby-identifier">params</span>[<span class="ruby-value str">"from"</span>] = <span class="ruby-identifier">from</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">"%Y-%m-%dT%H:%M:%SZ"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">from</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:strftime</span>
|
849
|
+
<span class="ruby-identifier">params</span>[<span class="ruby-value str">"from"</span>] = <span class="ruby-identifier">from</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">from</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:strftime</span>
|
850
|
+
<span class="ruby-keyword kw">end</span>
|
851
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">to</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
|
852
|
+
<span class="ruby-identifier">params</span>[<span class="ruby-value str">"until"</span>] = <span class="ruby-identifier">to</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">"%Y-%m-%dT%H:%M:%SZ"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">to</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:strftime</span>
|
853
|
+
<span class="ruby-identifier">params</span>[<span class="ruby-value str">"until"</span>] = <span class="ruby-identifier">to</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">to</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:strftime</span>
|
854
|
+
<span class="ruby-keyword kw">end</span>
|
855
|
+
<span class="ruby-identifier">params</span>[<span class="ruby-value str">"resumptionToken"</span>] = <span class="ruby-identifier">resumption_token</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">resumption_token</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
|
856
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">params</span>)
|
857
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
|
858
|
+
<span class="ruby-keyword kw">end</span>
|
859
|
+
</pre>
|
860
|
+
</div>
|
861
|
+
</div>
|
862
|
+
</div>
|
863
|
+
|
864
|
+
<div id="method-M000188" class="method-detail">
|
865
|
+
<a name="M000188"></a>
|
866
|
+
|
867
|
+
<div class="method-heading">
|
868
|
+
<a href="#M000188" class="method-signature">
|
869
|
+
<span class="method-name">put_field_predicate_map</span><span class="method-args">(data)</span>
|
870
|
+
</a>
|
871
|
+
</div>
|
872
|
+
|
873
|
+
<div class="method-description">
|
874
|
+
<p>
|
875
|
+
<a href="Update.html">Update</a>/replace the current Field Predicate map
|
876
|
+
configuration in the store. Assumes that the provided data is valid <a
|
877
|
+
href="RDF.html">RDF</a>/XML. Use <a
|
878
|
+
href="FieldPredicateMap.html#M000109">FieldPredicateMap.upload</a> as a
|
879
|
+
convenience function
|
880
|
+
</p>
|
881
|
+
<table>
|
882
|
+
<tr><td valign="top">data:</td><td>a string containing an <a href="RDF.html">RDF</a>/XML document
|
883
|
+
|
884
|
+
</td></tr>
|
885
|
+
</table>
|
886
|
+
<p><a class="source-toggle" href="#"
|
887
|
+
onclick="toggleCode('M000188-source');return false;">[Source]</a></p>
|
888
|
+
<div class="method-source-code" id="M000188-source">
|
889
|
+
<pre>
|
890
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 484</span>
|
891
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">put_field_predicate_map</span>(<span class="ruby-identifier">data</span>)
|
892
|
+
<span class="ruby-identifier">u</span> = <span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">"/config/fpmaps/1"</span>)
|
893
|
+
<span class="ruby-identifier">headers</span> = {<span class="ruby-value str">"Content-Type"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"application/rdf+xml"</span>}
|
894
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">put</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">data</span>, <span class="ruby-identifier">headers</span>)
|
895
|
+
<span class="ruby-keyword kw">end</span>
|
896
|
+
</pre>
|
897
|
+
</div>
|
898
|
+
</div>
|
899
|
+
</div>
|
900
|
+
|
901
|
+
<div id="method-M000190" class="method-detail">
|
902
|
+
<a name="M000190"></a>
|
903
|
+
|
904
|
+
<div class="method-heading">
|
905
|
+
<a href="#M000190" class="method-signature">
|
906
|
+
<span class="method-name">put_query_profile</span><span class="method-args">(data)</span>
|
907
|
+
</a>
|
908
|
+
</div>
|
909
|
+
|
910
|
+
<div class="method-description">
|
911
|
+
<p>
|
912
|
+
<a href="Update.html">Update</a>/replace the current Query Profile
|
913
|
+
configuration in the store. Assumes that the provided data is valid <a
|
914
|
+
href="RDF.html">RDF</a>/XML. Use <a
|
915
|
+
href="QueryProfile.html#M000142">QueryProfile.upload</a> as a convenience
|
916
|
+
function
|
917
|
+
</p>
|
918
|
+
<table>
|
919
|
+
<tr><td valign="top">data:</td><td>a string containing an <a href="RDF.html">RDF</a>/XML document
|
920
|
+
|
921
|
+
</td></tr>
|
922
|
+
</table>
|
923
|
+
<p><a class="source-toggle" href="#"
|
924
|
+
onclick="toggleCode('M000190-source');return false;">[Source]</a></p>
|
925
|
+
<div class="method-source-code" id="M000190-source">
|
926
|
+
<pre>
|
927
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 505</span>
|
928
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">put_query_profile</span>(<span class="ruby-identifier">data</span>)
|
929
|
+
<span class="ruby-identifier">u</span> = <span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">"/config/queryprofiles/1"</span>)
|
930
|
+
<span class="ruby-identifier">headers</span> = {<span class="ruby-value str">"Content-Type"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"application/rdf+xml"</span>}
|
931
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">put</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">data</span>, <span class="ruby-identifier">headers</span>)
|
932
|
+
<span class="ruby-keyword kw">end</span>
|
933
|
+
</pre>
|
934
|
+
</div>
|
935
|
+
</div>
|
936
|
+
</div>
|
937
|
+
|
938
|
+
<div id="method-M000177" class="method-detail">
|
939
|
+
<a name="M000177"></a>
|
940
|
+
|
941
|
+
<div class="method-heading">
|
942
|
+
<a href="#M000177" class="method-signature">
|
943
|
+
<span class="method-name">record_etags</span><span class="method-args">(u, etags, response)</span>
|
944
|
+
</a>
|
945
|
+
</div>
|
946
|
+
|
947
|
+
<div class="method-description">
|
948
|
+
<p><a class="source-toggle" href="#"
|
949
|
+
onclick="toggleCode('M000177-source');return false;">[Source]</a></p>
|
950
|
+
<div class="method-source-code" id="M000177-source">
|
951
|
+
<pre>
|
952
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 328</span>
|
953
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">record_etags</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">etags</span>, <span class="ruby-identifier">response</span>)
|
954
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">etags</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span> = <span class="ruby-value">200</span>)
|
955
|
+
<span class="ruby-identifier">etags</span>.<span class="ruby-identifier">add_from_response</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">response</span>)
|
956
|
+
<span class="ruby-keyword kw">end</span>
|
957
|
+
<span class="ruby-keyword kw">end</span>
|
958
|
+
</pre>
|
959
|
+
</div>
|
960
|
+
</div>
|
961
|
+
</div>
|
962
|
+
|
963
|
+
<div id="method-M000171" class="method-detail">
|
964
|
+
<a name="M000171"></a>
|
965
|
+
|
966
|
+
<div class="method-heading">
|
967
|
+
<a href="#M000171" class="method-signature">
|
968
|
+
<span class="method-name">search</span><span class="method-args">(query, params=nil)</span>
|
969
|
+
</a>
|
970
|
+
</div>
|
971
|
+
|
972
|
+
<div class="method-description">
|
973
|
+
<p>
|
974
|
+
Search the Metabox indexes.
|
975
|
+
</p>
|
976
|
+
<table>
|
977
|
+
<tr><td valign="top">query:</td><td>the query to perform. See XXXX for query syntax
|
978
|
+
|
979
|
+
</td></tr>
|
980
|
+
<tr><td valign="top">params:</td><td>additional query parameters (see below)
|
981
|
+
|
982
|
+
</td></tr>
|
983
|
+
</table>
|
984
|
+
<p>
|
985
|
+
The <em>params</em> hash can contain the following values:
|
986
|
+
</p>
|
987
|
+
<ul>
|
988
|
+
<li><b>max</b>: The maximum number of results to return (default is 10)
|
989
|
+
|
990
|
+
</li>
|
991
|
+
<li><b>offset</b>: Offset into the query results (for paging; default is 0)
|
992
|
+
|
993
|
+
</li>
|
994
|
+
<li><b>sort</b>: ordered list of fields to be used when applying sorting
|
995
|
+
|
996
|
+
</li>
|
997
|
+
<li>*xsl-uri*: URL of an XSLT transform to be applied to the results,
|
998
|
+
transforming the default RSS 1.0 results format into an alternative
|
999
|
+
representation
|
1000
|
+
|
1001
|
+
</li>
|
1002
|
+
<li>*content-type*: when applying an XSLT transform, the content type to use
|
1003
|
+
when returning the results
|
1004
|
+
|
1005
|
+
</li>
|
1006
|
+
</ul>
|
1007
|
+
<p>
|
1008
|
+
Any additional entries in the <em>params</em> hash will be passed through
|
1009
|
+
to the Platform. These parameters will only be used when an XSLT
|
1010
|
+
transformation is being applied, in which case they will be provided as
|
1011
|
+
parameters to the stylesheet.
|
1012
|
+
</p>
|
1013
|
+
<p><a class="source-toggle" href="#"
|
1014
|
+
onclick="toggleCode('M000171-source');return false;">[Source]</a></p>
|
1015
|
+
<div class="method-source-code" id="M000171-source">
|
1016
|
+
<pre>
|
1017
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 259</span>
|
1018
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">search</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">params</span>=<span class="ruby-keyword kw">nil</span>)
|
1019
|
+
<span class="ruby-identifier">u</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">"/items"</span>)
|
1020
|
+
<span class="ruby-identifier">search_params</span> = <span class="ruby-identifier">get_search_params</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">query</span>, <span class="ruby-identifier">params</span>)
|
1021
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">search_params</span>)
|
1022
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
|
1023
|
+
|
1024
|
+
<span class="ruby-keyword kw">end</span>
|
1025
|
+
</pre>
|
1026
|
+
</div>
|
1027
|
+
</div>
|
1028
|
+
</div>
|
1029
|
+
|
1030
|
+
<div id="method-M000158" class="method-detail">
|
1031
|
+
<a name="M000158"></a>
|
1032
|
+
|
1033
|
+
<div class="method-heading">
|
1034
|
+
<a href="#M000158" class="method-signature">
|
1035
|
+
<span class="method-name">set_credentials</span><span class="method-args">(username, password)</span>
|
1036
|
+
</a>
|
1037
|
+
</div>
|
1038
|
+
|
1039
|
+
<div class="method-description">
|
1040
|
+
<p>
|
1041
|
+
Set credentials that this store will use when carrying out authorization
|
1042
|
+
</p>
|
1043
|
+
<table>
|
1044
|
+
<tr><td valign="top">username:</td><td>admin username
|
1045
|
+
|
1046
|
+
</td></tr>
|
1047
|
+
<tr><td valign="top">password:</td><td>admin password
|
1048
|
+
|
1049
|
+
</td></tr>
|
1050
|
+
</table>
|
1051
|
+
<p><a class="source-toggle" href="#"
|
1052
|
+
onclick="toggleCode('M000158-source');return false;">[Source]</a></p>
|
1053
|
+
<div class="method-source-code" id="M000158-source">
|
1054
|
+
<pre>
|
1055
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 58</span>
|
1056
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_credentials</span>(<span class="ruby-identifier">username</span>, <span class="ruby-identifier">password</span>)
|
1057
|
+
<span class="ruby-ivar">@client</span>.<span class="ruby-identifier">set_auth</span>(<span class="ruby-ivar">@storeuri</span>, <span class="ruby-identifier">username</span>, <span class="ruby-identifier">password</span>)
|
1058
|
+
<span class="ruby-keyword kw">end</span>
|
1059
|
+
</pre>
|
1060
|
+
</div>
|
1061
|
+
</div>
|
1062
|
+
</div>
|
1063
|
+
|
1064
|
+
<div id="method-M000170" class="method-detail">
|
1065
|
+
<a name="M000170"></a>
|
1066
|
+
|
1067
|
+
<div class="method-heading">
|
1068
|
+
<a href="#M000170" class="method-signature">
|
1069
|
+
<span class="method-name">sparql</span><span class="method-args">(query, format=nil, multisparql=false)</span>
|
1070
|
+
</a>
|
1071
|
+
</div>
|
1072
|
+
|
1073
|
+
<div class="method-description">
|
1074
|
+
<p>
|
1075
|
+
Perform a SPARQL query
|
1076
|
+
</p>
|
1077
|
+
<pre>
|
1078
|
+
query:: the SPARQL query
|
1079
|
+
format:: the preferred response format
|
1080
|
+
multisparql:: use default sparql service or multisparql service
|
1081
|
+
</pre>
|
1082
|
+
<p><a class="source-toggle" href="#"
|
1083
|
+
onclick="toggleCode('M000170-source');return false;">[Source]</a></p>
|
1084
|
+
<div class="method-source-code" id="M000170-source">
|
1085
|
+
<pre>
|
1086
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 240</span>
|
1087
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sparql</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">multisparql</span>=<span class="ruby-keyword kw">false</span>)
|
1088
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">sparql_client</span>(<span class="ruby-identifier">multisparql</span>).<span class="ruby-identifier">query</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>)
|
1089
|
+
<span class="ruby-keyword kw">end</span>
|
1090
|
+
</pre>
|
1091
|
+
</div>
|
1092
|
+
</div>
|
1093
|
+
</div>
|
1094
|
+
|
1095
|
+
<div id="method-M000168" class="method-detail">
|
1096
|
+
<a name="M000168"></a>
|
1097
|
+
|
1098
|
+
<div class="method-heading">
|
1099
|
+
<a href="#M000168" class="method-signature">
|
1100
|
+
<span class="method-name">sparql_ask</span><span class="method-args">(query, format="application/sparql-results+xml", multisparql=false)</span>
|
1101
|
+
</a>
|
1102
|
+
</div>
|
1103
|
+
|
1104
|
+
<div class="method-description">
|
1105
|
+
<p>
|
1106
|
+
Perform a SPARQL ASK query.
|
1107
|
+
</p>
|
1108
|
+
<pre>
|
1109
|
+
query:: the SPARQL query
|
1110
|
+
format:: the preferred response format
|
1111
|
+
</pre>
|
1112
|
+
<p><a class="source-toggle" href="#"
|
1113
|
+
onclick="toggleCode('M000168-source');return false;">[Source]</a></p>
|
1114
|
+
<div class="method-source-code" id="M000168-source">
|
1115
|
+
<pre>
|
1116
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 223</span>
|
1117
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sparql_ask</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>=<span class="ruby-value str">"application/sparql-results+xml"</span>, <span class="ruby-identifier">multisparql</span>=<span class="ruby-keyword kw">false</span>)
|
1118
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">sparql</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>, <span class="ruby-identifier">multisparql</span>)
|
1119
|
+
<span class="ruby-keyword kw">end</span>
|
1120
|
+
</pre>
|
1121
|
+
</div>
|
1122
|
+
</div>
|
1123
|
+
</div>
|
1124
|
+
|
1125
|
+
<div id="method-M000165" class="method-detail">
|
1126
|
+
<a name="M000165"></a>
|
1127
|
+
|
1128
|
+
<div class="method-heading">
|
1129
|
+
<a href="#M000165" class="method-signature">
|
1130
|
+
<span class="method-name">sparql_client</span><span class="method-args">(multisparql=false)</span>
|
1131
|
+
</a>
|
1132
|
+
</div>
|
1133
|
+
|
1134
|
+
<div class="method-description">
|
1135
|
+
<p>
|
1136
|
+
Retrieve a SparqlClient object for interacting with the endpoint for this
|
1137
|
+
store
|
1138
|
+
</p>
|
1139
|
+
<pre>
|
1140
|
+
multisparql:: optional, set to true to retrieve client for multisparql endpoint
|
1141
|
+
</pre>
|
1142
|
+
<p><a class="source-toggle" href="#"
|
1143
|
+
onclick="toggleCode('M000165-source');return false;">[Source]</a></p>
|
1144
|
+
<div class="method-source-code" id="M000165-source">
|
1145
|
+
<pre>
|
1146
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 189</span>
|
1147
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sparql_client</span>(<span class="ruby-identifier">multisparql</span>=<span class="ruby-keyword kw">false</span>)
|
1148
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">multisparql</span>
|
1149
|
+
<span class="ruby-identifier">u</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">"/services/multisparql"</span>)
|
1150
|
+
<span class="ruby-keyword kw">else</span>
|
1151
|
+
<span class="ruby-identifier">u</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">"/services/sparql"</span>)
|
1152
|
+
<span class="ruby-keyword kw">end</span>
|
1153
|
+
|
1154
|
+
<span class="ruby-identifier">sparql_client</span> = <span class="ruby-constant">StoreSparqlClient</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@self</span>, <span class="ruby-identifier">u</span>, <span class="ruby-ivar">@client</span>)
|
1155
|
+
<span class="ruby-identifier">sparql_client</span>.<span class="ruby-identifier">supports_rdf_json</span> = <span class="ruby-keyword kw">true</span>
|
1156
|
+
<span class="ruby-identifier">sparql_client</span>.<span class="ruby-identifier">supports_sparql_json</span> = <span class="ruby-keyword kw">true</span>
|
1157
|
+
|
1158
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">sparql_client</span>
|
1159
|
+
<span class="ruby-keyword kw">end</span>
|
1160
|
+
</pre>
|
1161
|
+
</div>
|
1162
|
+
</div>
|
1163
|
+
</div>
|
1164
|
+
|
1165
|
+
<div id="method-M000167" class="method-detail">
|
1166
|
+
<a name="M000167"></a>
|
1167
|
+
|
1168
|
+
<div class="method-heading">
|
1169
|
+
<a href="#M000167" class="method-signature">
|
1170
|
+
<span class="method-name">sparql_construct</span><span class="method-args">(query, format="application/rdf+xml", multisparql=false)</span>
|
1171
|
+
</a>
|
1172
|
+
</div>
|
1173
|
+
|
1174
|
+
<div class="method-description">
|
1175
|
+
<p>
|
1176
|
+
Perform a SPARQL CONSTRUCT query.
|
1177
|
+
</p>
|
1178
|
+
<pre>
|
1179
|
+
query:: the SPARQL query
|
1180
|
+
format:: the preferred response format
|
1181
|
+
</pre>
|
1182
|
+
<p><a class="source-toggle" href="#"
|
1183
|
+
onclick="toggleCode('M000167-source');return false;">[Source]</a></p>
|
1184
|
+
<div class="method-source-code" id="M000167-source">
|
1185
|
+
<pre>
|
1186
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 215</span>
|
1187
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sparql_construct</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>=<span class="ruby-value str">"application/rdf+xml"</span>, <span class="ruby-identifier">multisparql</span>=<span class="ruby-keyword kw">false</span>)
|
1188
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">sparql</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>, <span class="ruby-identifier">multisparql</span>)
|
1189
|
+
<span class="ruby-keyword kw">end</span>
|
1190
|
+
</pre>
|
1191
|
+
</div>
|
1192
|
+
</div>
|
1193
|
+
</div>
|
1194
|
+
|
1195
|
+
<div id="method-M000166" class="method-detail">
|
1196
|
+
<a name="M000166"></a>
|
1197
|
+
|
1198
|
+
<div class="method-heading">
|
1199
|
+
<a href="#M000166" class="method-signature">
|
1200
|
+
<span class="method-name">sparql_describe</span><span class="method-args">(query, format="application/rdf+xml", multisparql=false)</span>
|
1201
|
+
</a>
|
1202
|
+
</div>
|
1203
|
+
|
1204
|
+
<div class="method-description">
|
1205
|
+
<p>
|
1206
|
+
Perform a SPARQL DESCRIBE query.
|
1207
|
+
</p>
|
1208
|
+
<pre>
|
1209
|
+
query:: the SPARQL query
|
1210
|
+
format:: the preferred response format
|
1211
|
+
</pre>
|
1212
|
+
<p><a class="source-toggle" href="#"
|
1213
|
+
onclick="toggleCode('M000166-source');return false;">[Source]</a></p>
|
1214
|
+
<div class="method-source-code" id="M000166-source">
|
1215
|
+
<pre>
|
1216
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 207</span>
|
1217
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sparql_describe</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>=<span class="ruby-value str">"application/rdf+xml"</span>, <span class="ruby-identifier">multisparql</span>=<span class="ruby-keyword kw">false</span>)
|
1218
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">sparql</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>, <span class="ruby-identifier">multisparql</span>)
|
1219
|
+
<span class="ruby-keyword kw">end</span>
|
1220
|
+
</pre>
|
1221
|
+
</div>
|
1222
|
+
</div>
|
1223
|
+
</div>
|
1224
|
+
|
1225
|
+
<div id="method-M000169" class="method-detail">
|
1226
|
+
<a name="M000169"></a>
|
1227
|
+
|
1228
|
+
<div class="method-heading">
|
1229
|
+
<a href="#M000169" class="method-signature">
|
1230
|
+
<span class="method-name">sparql_select</span><span class="method-args">(query, format="application/sparql-results+xml", multisparql=false)</span>
|
1231
|
+
</a>
|
1232
|
+
</div>
|
1233
|
+
|
1234
|
+
<div class="method-description">
|
1235
|
+
<p>
|
1236
|
+
Perform a SPARQL SELECT query.
|
1237
|
+
</p>
|
1238
|
+
<pre>
|
1239
|
+
query:: the SPARQL query
|
1240
|
+
format:: the preferred response format
|
1241
|
+
</pre>
|
1242
|
+
<p><a class="source-toggle" href="#"
|
1243
|
+
onclick="toggleCode('M000169-source');return false;">[Source]</a></p>
|
1244
|
+
<div class="method-source-code" id="M000169-source">
|
1245
|
+
<pre>
|
1246
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 231</span>
|
1247
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sparql_select</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>=<span class="ruby-value str">"application/sparql-results+xml"</span>, <span class="ruby-identifier">multisparql</span>=<span class="ruby-keyword kw">false</span>)
|
1248
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">sparql</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>, <span class="ruby-identifier">multisparql</span>)
|
1249
|
+
<span class="ruby-keyword kw">end</span>
|
1250
|
+
</pre>
|
1251
|
+
</div>
|
1252
|
+
</div>
|
1253
|
+
</div>
|
1254
|
+
|
1255
|
+
<div id="method-M000160" class="method-detail">
|
1256
|
+
<a name="M000160"></a>
|
1257
|
+
|
1258
|
+
<div class="method-heading">
|
1259
|
+
<a href="#M000160" class="method-signature">
|
1260
|
+
<span class="method-name">store_data</span><span class="method-args">(data, graph_name=nil, format="application/rdf+xml")</span>
|
1261
|
+
</a>
|
1262
|
+
</div>
|
1263
|
+
|
1264
|
+
<div class="method-description">
|
1265
|
+
<table>
|
1266
|
+
<tr><td valign="top">data:</td><td>a <a href="../String.html">String</a> containing the data to store
|
1267
|
+
|
1268
|
+
</td></tr>
|
1269
|
+
<tr><td valign="top">graph_name:</td><td>name of a private graph in which to store the data. E.g. "1" or
|
1270
|
+
"private". Resolves to /meta/graphs/graph_name
|
1271
|
+
|
1272
|
+
</td></tr>
|
1273
|
+
<tr><td valign="top">format:</td><td>mimetype of <a href="RDF.html">RDF</a> serialization
|
1274
|
+
|
1275
|
+
</td></tr>
|
1276
|
+
</table>
|
1277
|
+
<p><a class="source-toggle" href="#"
|
1278
|
+
onclick="toggleCode('M000160-source');return false;">[Source]</a></p>
|
1279
|
+
<div class="method-source-code" id="M000160-source">
|
1280
|
+
<pre>
|
1281
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 85</span>
|
1282
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">store_data</span>(<span class="ruby-identifier">data</span>, <span class="ruby-identifier">graph_name</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">format</span>=<span class="ruby-value str">"application/rdf+xml"</span>)
|
1283
|
+
<span class="ruby-identifier">u</span> = <span class="ruby-keyword kw">nil</span>
|
1284
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">graph_name</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
|
1285
|
+
<span class="ruby-identifier">u</span> = <span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">"/meta"</span>)
|
1286
|
+
<span class="ruby-keyword kw">else</span>
|
1287
|
+
<span class="ruby-identifier">u</span> = <span class="ruby-identifier">build_uri</span>(<span class="ruby-node">"/meta/graphs/#{graph_name}"</span>)
|
1288
|
+
<span class="ruby-keyword kw">end</span>
|
1289
|
+
|
1290
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">format</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"text/plain"</span>
|
1291
|
+
<span class="ruby-identifier">format</span> = <span class="ruby-value str">"text/turtle"</span>
|
1292
|
+
<span class="ruby-keyword kw">end</span>
|
1293
|
+
|
1294
|
+
<span class="ruby-identifier">content_type</span> = {<span class="ruby-value str">"Content-Type"</span>=<span class="ruby-operator">></span> <span class="ruby-identifier">format</span> }
|
1295
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">post</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">data</span>, <span class="ruby-identifier">content_type</span> )
|
1296
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
|
1297
|
+
<span class="ruby-keyword kw">end</span>
|
1298
|
+
</pre>
|
1299
|
+
</div>
|
1300
|
+
</div>
|
1301
|
+
</div>
|
1302
|
+
|
1303
|
+
<div id="method-M000161" class="method-detail">
|
1304
|
+
<a name="M000161"></a>
|
1305
|
+
|
1306
|
+
<div class="method-heading">
|
1307
|
+
<a href="#M000161" class="method-signature">
|
1308
|
+
<span class="method-name">store_file</span><span class="method-args">(file, graph_name=nil, format="application/rdf+xml")</span>
|
1309
|
+
</a>
|
1310
|
+
</div>
|
1311
|
+
|
1312
|
+
<div class="method-description">
|
1313
|
+
<p>
|
1314
|
+
<a href="Store.html">Store</a> the contents of a File (or any IO stream) in
|
1315
|
+
the Metabox associated with this store The client does not support
|
1316
|
+
streaming submissions of data, so the stream will be fully read before data
|
1317
|
+
is submitted to the platform
|
1318
|
+
</p>
|
1319
|
+
<table>
|
1320
|
+
<tr><td valign="top">file:</td><td>an IO object
|
1321
|
+
|
1322
|
+
</td></tr>
|
1323
|
+
<tr><td valign="top">graph_name:</td><td>name of a private graph in which to store teh data. E.g. "1" or
|
1324
|
+
"private". Resolves to /meta/graphs/graph_name
|
1325
|
+
|
1326
|
+
</td></tr>
|
1327
|
+
<tr><td valign="top">format:</td><td>mimetype of <a href="RDF.html">RDF</a> serialization
|
1328
|
+
|
1329
|
+
</td></tr>
|
1330
|
+
</table>
|
1331
|
+
<p><a class="source-toggle" href="#"
|
1332
|
+
onclick="toggleCode('M000161-source');return false;">[Source]</a></p>
|
1333
|
+
<div class="method-source-code" id="M000161-source">
|
1334
|
+
<pre>
|
1335
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 107</span>
|
1336
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">store_file</span>(<span class="ruby-identifier">file</span>, <span class="ruby-identifier">graph_name</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">format</span>=<span class="ruby-value str">"application/rdf+xml"</span>)
|
1337
|
+
<span class="ruby-identifier">data</span> = <span class="ruby-identifier">file</span>.<span class="ruby-identifier">read</span>()
|
1338
|
+
<span class="ruby-identifier">file</span>.<span class="ruby-identifier">close</span>()
|
1339
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">store_data</span>(<span class="ruby-identifier">data</span>, <span class="ruby-identifier">graph_name</span>, <span class="ruby-identifier">format</span>)
|
1340
|
+
<span class="ruby-keyword kw">end</span>
|
1341
|
+
</pre>
|
1342
|
+
</div>
|
1343
|
+
</div>
|
1344
|
+
</div>
|
1345
|
+
|
1346
|
+
<div id="method-M000162" class="method-detail">
|
1347
|
+
<a name="M000162"></a>
|
1348
|
+
|
1349
|
+
<div class="method-heading">
|
1350
|
+
<a href="#M000162" class="method-signature">
|
1351
|
+
<span class="method-name">store_url</span><span class="method-args">(u, parameters=nil, graph_name=nil)</span>
|
1352
|
+
</a>
|
1353
|
+
</div>
|
1354
|
+
|
1355
|
+
<div class="method-description">
|
1356
|
+
<p>
|
1357
|
+
Retrieve <a href="RDF.html">RDF</a> data from the specified URL and store
|
1358
|
+
it in the <a href="Store.html">Store</a> Metabox
|
1359
|
+
</p>
|
1360
|
+
<p>
|
1361
|
+
An Accept header of "application/rdf+xml" will be sent in the
|
1362
|
+
request to support retrieval of <a href="RDF.html">RDF</a> from URLs that
|
1363
|
+
support Content Negotiation.
|
1364
|
+
</p>
|
1365
|
+
<p>
|
1366
|
+
NOTE: Currently this method doesn‘t properly handle base uris of
|
1367
|
+
retrieved data. i.e. the data isn‘t parsed and there is no way to
|
1368
|
+
pass a base uri to the Platform. Be warned!
|
1369
|
+
</p>
|
1370
|
+
<p>
|
1371
|
+
The default is to store the data in the Metabox. But a private graph name
|
1372
|
+
can also be specified
|
1373
|
+
</p>
|
1374
|
+
<table>
|
1375
|
+
<tr><td valign="top">u:</td><td>the url of the data
|
1376
|
+
|
1377
|
+
</td></tr>
|
1378
|
+
<tr><td valign="top">parameters:</td><td>a Hash of url parameters to pass when requesting data from the specified
|
1379
|
+
URL
|
1380
|
+
|
1381
|
+
</td></tr>
|
1382
|
+
<tr><td valign="top">graph_name:</td><td>name of a private graph in which to store the data. E.g. "1" or
|
1383
|
+
"private". Resolves to /meta/graphs/graph_name
|
1384
|
+
|
1385
|
+
</td></tr>
|
1386
|
+
</table>
|
1387
|
+
<p><a class="source-toggle" href="#"
|
1388
|
+
onclick="toggleCode('M000162-source');return false;">[Source]</a></p>
|
1389
|
+
<div class="method-source-code" id="M000162-source">
|
1390
|
+
<pre>
|
1391
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 125</span>
|
1392
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">store_url</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">parameters</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">graph_name</span>=<span class="ruby-keyword kw">nil</span>)
|
1393
|
+
|
1394
|
+
<span class="ruby-identifier">headers</span> = <span class="ruby-constant">ACCEPT_RDF</span>.<span class="ruby-identifier">clone</span>()
|
1395
|
+
<span class="ruby-identifier">dataresp</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">parameters</span>, <span class="ruby-identifier">headers</span> )
|
1396
|
+
|
1397
|
+
<span class="ruby-comment cmt">#TODO make this more robust</span>
|
1398
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">dataresp</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">!=</span> <span class="ruby-value">200</span>
|
1399
|
+
<span class="ruby-identifier">throw</span>
|
1400
|
+
<span class="ruby-keyword kw">end</span>
|
1401
|
+
|
1402
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">store_data</span>(<span class="ruby-identifier">dataresp</span>.<span class="ruby-identifier">content</span>, <span class="ruby-identifier">graph_name</span>)
|
1403
|
+
|
1404
|
+
<span class="ruby-keyword kw">end</span>
|
1405
|
+
</pre>
|
1406
|
+
</div>
|
1407
|
+
</div>
|
1408
|
+
</div>
|
1409
|
+
|
1410
|
+
<div id="method-M000164" class="method-detail">
|
1411
|
+
<a name="M000164"></a>
|
1412
|
+
|
1413
|
+
<div class="method-heading">
|
1414
|
+
<a href="#M000164" class="method-signature">
|
1415
|
+
<span class="method-name">submit_changeset</span><span class="method-args">(rdf, versioned=false, graph_name=nil)</span>
|
1416
|
+
</a>
|
1417
|
+
</div>
|
1418
|
+
|
1419
|
+
<div class="method-description">
|
1420
|
+
<p>
|
1421
|
+
Submit a Changeset to the Platform to update the metabox
|
1422
|
+
</p>
|
1423
|
+
<p>
|
1424
|
+
Default behaviour is to update the metabox with an unversioned name However
|
1425
|
+
using the optional parameters, changes can be made versioned, and can also
|
1426
|
+
be submitted to private graphs.
|
1427
|
+
</p>
|
1428
|
+
<table>
|
1429
|
+
<tr><td valign="top">rdf:</td><td>the <a href="RDF.html">RDF</a>/XML describing the changes
|
1430
|
+
|
1431
|
+
</td></tr>
|
1432
|
+
<tr><td valign="top">versioned:</td><td>true or false to indicate this is a versioned change
|
1433
|
+
|
1434
|
+
</td></tr>
|
1435
|
+
<tr><td valign="top">graph_name:</td><td>name of private graph to update instead of metabox
|
1436
|
+
|
1437
|
+
</td></tr>
|
1438
|
+
</table>
|
1439
|
+
<p><a class="source-toggle" href="#"
|
1440
|
+
onclick="toggleCode('M000164-source');return false;">[Source]</a></p>
|
1441
|
+
<div class="method-source-code" id="M000164-source">
|
1442
|
+
<pre>
|
1443
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 169</span>
|
1444
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">submit_changeset</span>(<span class="ruby-identifier">rdf</span>, <span class="ruby-identifier">versioned</span>=<span class="ruby-keyword kw">false</span>, <span class="ruby-identifier">graph_name</span>=<span class="ruby-keyword kw">nil</span>)
|
1445
|
+
<span class="ruby-identifier">uri</span> = <span class="ruby-value str">"/meta"</span>
|
1446
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">graph_name</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
|
1447
|
+
<span class="ruby-identifier">uri</span> = <span class="ruby-identifier">uri</span> <span class="ruby-operator">+</span> <span class="ruby-node">"/graphs/#{graph_name}"</span>
|
1448
|
+
<span class="ruby-keyword kw">end</span>
|
1449
|
+
<span class="ruby-identifier">uri</span> = <span class="ruby-identifier">uri</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"/changesets"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">versioned</span>
|
1450
|
+
|
1451
|
+
<span class="ruby-identifier">u</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">build_uri</span>( <span class="ruby-identifier">uri</span> )
|
1452
|
+
<span class="ruby-identifier">headers</span> = {<span class="ruby-value str">"Content-Type"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"application/vnd.talis.changeset+xml"</span>}
|
1453
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">post</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">rdf</span>, <span class="ruby-identifier">headers</span>)
|
1454
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
|
1455
|
+
<span class="ruby-keyword kw">end</span>
|
1456
|
+
</pre>
|
1457
|
+
</div>
|
1458
|
+
</div>
|
1459
|
+
</div>
|
1460
|
+
|
1461
|
+
<div id="method-M000183" class="method-detail">
|
1462
|
+
<a name="M000183"></a>
|
1463
|
+
|
1464
|
+
<div class="method-heading">
|
1465
|
+
<a href="#M000183" class="method-signature">
|
1466
|
+
<span class="method-name">submit_job</span><span class="method-args">(data)</span>
|
1467
|
+
</a>
|
1468
|
+
</div>
|
1469
|
+
|
1470
|
+
<div class="method-description">
|
1471
|
+
<p>
|
1472
|
+
Submit a job to the platform.
|
1473
|
+
</p>
|
1474
|
+
<table>
|
1475
|
+
<tr><td valign="top">data:</td><td><a href="RDF.html">RDF</a>/XML representing the job request. See methods on
|
1476
|
+
<a href="Jobs.html">Jobs</a> class
|
1477
|
+
|
1478
|
+
</td></tr>
|
1479
|
+
</table>
|
1480
|
+
<p><a class="source-toggle" href="#"
|
1481
|
+
onclick="toggleCode('M000183-source');return false;">[Source]</a></p>
|
1482
|
+
<div class="method-source-code" id="M000183-source">
|
1483
|
+
<pre>
|
1484
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 419</span>
|
1485
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">submit_job</span>(<span class="ruby-identifier">data</span>)
|
1486
|
+
<span class="ruby-identifier">u</span> = <span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">"/jobs"</span>)
|
1487
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">post</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">data</span>, <span class="ruby-constant">RDF_XML</span> )
|
1488
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
|
1489
|
+
<span class="ruby-keyword kw">end</span>
|
1490
|
+
</pre>
|
1491
|
+
</div>
|
1492
|
+
</div>
|
1493
|
+
</div>
|
1494
|
+
|
1495
|
+
<div id="method-M000178" class="method-detail">
|
1496
|
+
<a name="M000178"></a>
|
1497
|
+
|
1498
|
+
<div class="method-heading">
|
1499
|
+
<a href="#M000178" class="method-signature">
|
1500
|
+
<span class="method-name">upload_item</span><span class="method-args">(f, mimetype, uri=nil)</span>
|
1501
|
+
</a>
|
1502
|
+
</div>
|
1503
|
+
|
1504
|
+
<div class="method-description">
|
1505
|
+
<p>
|
1506
|
+
<a href="Store.html">Store</a> an item in the Contentbox for this store
|
1507
|
+
</p>
|
1508
|
+
<table>
|
1509
|
+
<tr><td valign="top">f:</td><td>a File or other IO object from which data will be read
|
1510
|
+
|
1511
|
+
</td></tr>
|
1512
|
+
<tr><td valign="top">mimetype:</td><td>the mimetype of the object to record in the Platform
|
1513
|
+
|
1514
|
+
</td></tr>
|
1515
|
+
<tr><td valign="top">uri:</td><td>the URI at which to store the item (relative to base uri for the store). If
|
1516
|
+
nil, then a URI will be assigned by the Platform
|
1517
|
+
|
1518
|
+
</td></tr>
|
1519
|
+
</table>
|
1520
|
+
<p>
|
1521
|
+
When a <em>uri</em> is not specified, then the Platform will return a 201
|
1522
|
+
Created response with a Location header containing the URI of the newly
|
1523
|
+
stored item. If a URI is specified then a successful request will result in
|
1524
|
+
a 200 OK response.
|
1525
|
+
</p>
|
1526
|
+
<p><a class="source-toggle" href="#"
|
1527
|
+
onclick="toggleCode('M000178-source');return false;">[Source]</a></p>
|
1528
|
+
<div class="method-source-code" id="M000178-source">
|
1529
|
+
<pre>
|
1530
|
+
<span class="ruby-comment cmt"># File lib/pho/store.rb, line 347</span>
|
1531
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">upload_item</span>(<span class="ruby-identifier">f</span>, <span class="ruby-identifier">mimetype</span>, <span class="ruby-identifier">uri</span>=<span class="ruby-keyword kw">nil</span>)
|
1532
|
+
<span class="ruby-identifier">data</span> = <span class="ruby-identifier">f</span>.<span class="ruby-identifier">read</span>()
|
1533
|
+
<span class="ruby-identifier">f</span>.<span class="ruby-identifier">close</span>()
|
1534
|
+
<span class="ruby-identifier">headers</span> = {<span class="ruby-value str">"Content-Type"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">mimetype</span>}
|
1535
|
+
|
1536
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
|
1537
|
+
<span class="ruby-identifier">u</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">"/items"</span>)
|
1538
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">post</span>(<span class="ruby-identifier">u</span>, <span class="ruby-identifier">data</span>, <span class="ruby-identifier">headers</span>)
|
1539
|
+
<span class="ruby-keyword kw">else</span>
|
1540
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">uri</span>.<span class="ruby-identifier">start_with?</span>(<span class="ruby-ivar">@storeuri</span>)
|
1541
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">start_with?</span>(<span class="ruby-value str">"/"</span>)
|
1542
|
+
<span class="ruby-identifier">uri</span> = <span class="ruby-identifier">build_uri</span>(<span class="ruby-node">"/items#{uri}"</span>)
|
1543
|
+
<span class="ruby-keyword kw">else</span>
|
1544
|
+
<span class="ruby-identifier">uri</span> = <span class="ruby-identifier">build_uri</span>(<span class="ruby-node">"/items/#{uri}"</span>)
|
1545
|
+
<span class="ruby-keyword kw">end</span>
|
1546
|
+
|
1547
|
+
<span class="ruby-keyword kw">end</span>
|
1548
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">put</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">data</span>, <span class="ruby-identifier">headers</span>)
|
1549
|
+
<span class="ruby-keyword kw">end</span>
|
1550
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
|
1551
|
+
<span class="ruby-keyword kw">end</span>
|
1552
|
+
</pre>
|
1553
|
+
</div>
|
1554
|
+
</div>
|
1555
|
+
</div>
|
1556
|
+
|
1557
|
+
|
1558
|
+
</div>
|
1559
|
+
|
1560
|
+
|
1561
|
+
</div>
|
1562
|
+
|
1563
|
+
|
1564
|
+
<div id="validator-badges">
|
1565
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
1566
|
+
</div>
|
1567
|
+
|
1568
|
+
</body>
|
1569
|
+
</html>
|