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