pho 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +6 -0
- data/README +9 -1
- data/Rakefile +1 -1
- data/doc/index.html +3 -1
- data/doc/rdoc/classes/Pho/Analyzers.html +310 -0
- data/doc/rdoc/classes/Pho/CommandLine.html +770 -0
- data/doc/rdoc/classes/Pho/DatatypeProperty.html +241 -0
- data/doc/rdoc/classes/Pho/Enrichment/StoreEnricher.html +410 -0
- data/doc/rdoc/classes/Pho/Enrichment.html +119 -0
- data/doc/rdoc/classes/Pho/Etags.html +310 -0
- data/doc/rdoc/classes/Pho/Facet/Results.html +299 -0
- data/doc/rdoc/classes/Pho/Facet/Term.html +177 -0
- data/doc/rdoc/classes/Pho/Facet.html +119 -0
- data/doc/rdoc/classes/Pho/FieldPredicateMap.html +695 -0
- data/doc/rdoc/classes/Pho/FieldWeighting.html +230 -0
- data/doc/rdoc/classes/Pho/FileManagement/AbstractFileManager.html +478 -0
- data/doc/rdoc/classes/Pho/FileManagement/FileManager.html +264 -0
- data/doc/rdoc/classes/Pho/FileManagement/RDFManager.html +259 -0
- data/doc/rdoc/classes/Pho/FileManagement.html +121 -0
- data/doc/rdoc/classes/Pho/Job.html +627 -0
- data/doc/rdoc/classes/Pho/JobUpdate.html +141 -0
- data/doc/rdoc/classes/Pho/Jobs.html +538 -0
- data/doc/rdoc/classes/Pho/Namespaces.html +164 -0
- data/doc/rdoc/classes/Pho/OAI/Record.html +165 -0
- data/doc/rdoc/classes/Pho/OAI/Records.html +331 -0
- data/doc/rdoc/classes/Pho/OAI.html +118 -0
- data/doc/rdoc/classes/Pho/QueryProfile.html +524 -0
- data/doc/rdoc/classes/Pho/RDF/Parser.html +279 -0
- data/doc/rdoc/classes/Pho/RDF.html +120 -0
- data/doc/rdoc/classes/Pho/RDFCollection.html +119 -0
- data/doc/rdoc/classes/Pho/ResourceHash/Converter.html +325 -0
- data/doc/rdoc/classes/Pho/ResourceHash/SetAlgebra.html +241 -0
- data/doc/rdoc/classes/Pho/ResourceHash.html +123 -0
- data/doc/rdoc/classes/Pho/Snapshot.html +402 -0
- data/doc/rdoc/classes/Pho/Sparql/SparqlClient.html +594 -0
- data/doc/rdoc/classes/Pho/Sparql/SparqlHelper.html +696 -0
- data/doc/rdoc/classes/Pho/Sparql.html +187 -0
- data/doc/rdoc/classes/Pho/Status.html +296 -0
- data/doc/rdoc/classes/Pho/Store.html +1569 -0
- data/doc/rdoc/classes/Pho/StoreSparqlClient.html +183 -0
- data/doc/rdoc/classes/Pho/Update/Changeset.html +521 -0
- data/doc/rdoc/classes/Pho/Update/ChangesetBuilder.html +330 -0
- data/doc/rdoc/classes/Pho/Update/ChangesetHelper.html +159 -0
- data/doc/rdoc/classes/Pho/Update/Changesets.html +205 -0
- data/doc/rdoc/classes/Pho/Update/LiteralStatement.html +257 -0
- data/doc/rdoc/classes/Pho/Update/ResourceStatement.html +237 -0
- data/doc/rdoc/classes/Pho/Update/Statement.html +303 -0
- data/doc/rdoc/classes/Pho/Update.html +128 -0
- data/doc/rdoc/classes/Pho.html +283 -0
- data/doc/rdoc/classes/String.html +146 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/CHANGES.html +373 -0
- data/doc/rdoc/files/README.html +204 -0
- data/doc/rdoc/files/lib/pho/changeset_builder_rb.html +108 -0
- data/doc/rdoc/files/lib/pho/changeset_rb.html +108 -0
- data/doc/rdoc/files/lib/pho/command_line_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/converter_rb.html +108 -0
- data/doc/rdoc/files/lib/pho/enrichment_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/etags_rb.html +108 -0
- data/doc/rdoc/files/lib/pho/facet_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/field_predicate_map_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/file_management_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/file_manager_rb.html +108 -0
- data/doc/rdoc/files/lib/pho/job_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/oai_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/query_profile_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/rdf_collection_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/rdf_rb.html +108 -0
- data/doc/rdoc/files/lib/pho/resource_hash_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/snapshot_rb.html +109 -0
- data/doc/rdoc/files/lib/pho/sparql_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/status_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/store_rb.html +108 -0
- data/doc/rdoc/files/lib/pho_rb.html +133 -0
- data/doc/rdoc/fr_class_index.html +72 -0
- data/doc/rdoc/fr_file_index.html +49 -0
- data/doc/rdoc/fr_method_index.html +239 -0
- data/doc/rdoc/index.html +24 -0
- data/doc/rdoc/rdoc-style.css +208 -0
- data/lib/pho/enrichment.rb +1 -0
- data/lib/pho/field_predicate_map.rb +5 -0
- data/lib/pho/query_profile.rb +5 -0
- data/lib/pho/store.rb +4 -1
- data/tests/tc_field_predicate_map.rb +7 -1
- data/tests/tc_query_profile.rb +6 -0
- data/tests/tc_store_util.rb +7 -0
- metadata +134 -21
@@ -0,0 +1,594 @@
|
|
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::Sparql::SparqlClient</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::Sparql::SparqlClient</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/pho/sparql_rb.html">
|
59
|
+
lib/pho/sparql.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
|
+
A simple SPARQL client that handles the basic HTTP traffic
|
84
|
+
</p>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div id="method-list">
|
92
|
+
<h3 class="section-bar">Methods</h3>
|
93
|
+
|
94
|
+
<div class="name-list">
|
95
|
+
<a href="#M000048">add_default_graph</a>
|
96
|
+
<a href="#M000049">add_named_graph</a>
|
97
|
+
<a href="#M000055">ask</a>
|
98
|
+
<a href="#M000054">construct</a>
|
99
|
+
<a href="#M000052">describe</a>
|
100
|
+
<a href="#M000051">describe_uri</a>
|
101
|
+
<a href="#M000053">multi_describe</a>
|
102
|
+
<a href="#M000047">new</a>
|
103
|
+
<a href="#M000050">query</a>
|
104
|
+
<a href="#M000056">select</a>
|
105
|
+
</div>
|
106
|
+
</div>
|
107
|
+
|
108
|
+
</div>
|
109
|
+
|
110
|
+
|
111
|
+
<!-- if includes -->
|
112
|
+
|
113
|
+
<div id="section">
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
<div id="attribute-list">
|
120
|
+
<h3 class="section-bar">Attributes</h3>
|
121
|
+
|
122
|
+
<div class="name-list">
|
123
|
+
<table>
|
124
|
+
<tr class="top-aligned-row context-row">
|
125
|
+
<td class="context-item-name">client</td>
|
126
|
+
<td class="context-item-value"> [R] </td>
|
127
|
+
<td class="context-item-desc">
|
128
|
+
HTTPClient object
|
129
|
+
|
130
|
+
</td>
|
131
|
+
</tr>
|
132
|
+
<tr class="top-aligned-row context-row">
|
133
|
+
<td class="context-item-name">endpoint</td>
|
134
|
+
<td class="context-item-value"> [R] </td>
|
135
|
+
<td class="context-item-desc">
|
136
|
+
URI of the endpoint
|
137
|
+
|
138
|
+
</td>
|
139
|
+
</tr>
|
140
|
+
<tr class="top-aligned-row context-row">
|
141
|
+
<td class="context-item-name">graphs</td>
|
142
|
+
<td class="context-item-value"> [R] </td>
|
143
|
+
<td class="context-item-desc"></td>
|
144
|
+
</tr>
|
145
|
+
<tr class="top-aligned-row context-row">
|
146
|
+
<td class="context-item-name">named_graphs</td>
|
147
|
+
<td class="context-item-value"> [R] </td>
|
148
|
+
<td class="context-item-desc"></td>
|
149
|
+
</tr>
|
150
|
+
<tr class="top-aligned-row context-row">
|
151
|
+
<td class="context-item-name">output_parameter_name</td>
|
152
|
+
<td class="context-item-value"> [RW] </td>
|
153
|
+
<td class="context-item-desc">
|
154
|
+
Name of output parameter to use to control response format. If set then
|
155
|
+
this parameter is added to the <a
|
156
|
+
href="SparqlClient.html#M000050">query</a> string, rather than using
|
157
|
+
Content Negotiation
|
158
|
+
|
159
|
+
</td>
|
160
|
+
</tr>
|
161
|
+
<tr class="top-aligned-row context-row">
|
162
|
+
<td class="context-item-name">supports_rdf_json</td>
|
163
|
+
<td class="context-item-value"> [RW] </td>
|
164
|
+
<td class="context-item-desc">
|
165
|
+
Configures whether the remote endpoint supports the <a
|
166
|
+
href="../RDF.html">RDF</a>-in-JSON specification for serializing <a
|
167
|
+
href="../RDF.html">RDF</a> graphs as JSON. Will default to false.
|
168
|
+
|
169
|
+
</td>
|
170
|
+
</tr>
|
171
|
+
<tr class="top-aligned-row context-row">
|
172
|
+
<td class="context-item-name">supports_sparql_json</td>
|
173
|
+
<td class="context-item-value"> [RW] </td>
|
174
|
+
<td class="context-item-desc">
|
175
|
+
Configures whether the remote endpoint supports SPARQL JSON Results format
|
176
|
+
Will default to true.
|
177
|
+
|
178
|
+
</td>
|
179
|
+
</tr>
|
180
|
+
</table>
|
181
|
+
</div>
|
182
|
+
</div>
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
<!-- if method_list -->
|
187
|
+
<div id="methods">
|
188
|
+
<h3 class="section-bar">Public Class methods</h3>
|
189
|
+
|
190
|
+
<div id="method-M000047" class="method-detail">
|
191
|
+
<a name="M000047"></a>
|
192
|
+
|
193
|
+
<div class="method-heading">
|
194
|
+
<a href="#M000047" class="method-signature">
|
195
|
+
<span class="method-name">new</span><span class="method-args">(endpoint, client=HTTPClient.new() )</span>
|
196
|
+
</a>
|
197
|
+
</div>
|
198
|
+
|
199
|
+
<div class="method-description">
|
200
|
+
<p>
|
201
|
+
Initialize a client for a specific endpoint
|
202
|
+
</p>
|
203
|
+
<table>
|
204
|
+
<tr><td valign="top">endpoint:</td><td>uri of the SPARQL endpoint
|
205
|
+
|
206
|
+
</td></tr>
|
207
|
+
<tr><td valign="top">client:</td><td>optionally, a reference to an existing HTTPClient object instance
|
208
|
+
|
209
|
+
</td></tr>
|
210
|
+
</table>
|
211
|
+
<p><a class="source-toggle" href="#"
|
212
|
+
onclick="toggleCode('M000047-source');return false;">[Source]</a></p>
|
213
|
+
<div class="method-source-code" id="M000047-source">
|
214
|
+
<pre>
|
215
|
+
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line 121</span>
|
216
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">endpoint</span>, <span class="ruby-identifier">client</span>=<span class="ruby-constant">HTTPClient</span>.<span class="ruby-identifier">new</span>() )
|
217
|
+
<span class="ruby-ivar">@endpoint</span> = <span class="ruby-identifier">endpoint</span>
|
218
|
+
<span class="ruby-ivar">@graphs</span> = <span class="ruby-keyword kw">nil</span>
|
219
|
+
<span class="ruby-ivar">@named_graphs</span> = <span class="ruby-keyword kw">nil</span>
|
220
|
+
<span class="ruby-ivar">@client</span> = <span class="ruby-identifier">client</span>
|
221
|
+
<span class="ruby-ivar">@output_parameter_name</span> = <span class="ruby-keyword kw">nil</span>
|
222
|
+
<span class="ruby-ivar">@supports_rdf_json</span> = <span class="ruby-keyword kw">false</span>
|
223
|
+
<span class="ruby-ivar">@supports_sparql_json</span> = <span class="ruby-keyword kw">true</span>
|
224
|
+
<span class="ruby-keyword kw">end</span>
|
225
|
+
</pre>
|
226
|
+
</div>
|
227
|
+
</div>
|
228
|
+
</div>
|
229
|
+
|
230
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
231
|
+
|
232
|
+
<div id="method-M000048" class="method-detail">
|
233
|
+
<a name="M000048"></a>
|
234
|
+
|
235
|
+
<div class="method-heading">
|
236
|
+
<a href="#M000048" class="method-signature">
|
237
|
+
<span class="method-name">add_default_graph</span><span class="method-args">(graph_uri)</span>
|
238
|
+
</a>
|
239
|
+
</div>
|
240
|
+
|
241
|
+
<div class="method-description">
|
242
|
+
<p>
|
243
|
+
Add a default graph. This will be added as a default graph in the request
|
244
|
+
protocol
|
245
|
+
</p>
|
246
|
+
<p><a class="source-toggle" href="#"
|
247
|
+
onclick="toggleCode('M000048-source');return false;">[Source]</a></p>
|
248
|
+
<div class="method-source-code" id="M000048-source">
|
249
|
+
<pre>
|
250
|
+
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line 132</span>
|
251
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_default_graph</span>(<span class="ruby-identifier">graph_uri</span>)
|
252
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@graphs</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
|
253
|
+
<span class="ruby-ivar">@graphs</span> = []
|
254
|
+
<span class="ruby-keyword kw">end</span>
|
255
|
+
<span class="ruby-ivar">@graphs</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">graph_uri</span>
|
256
|
+
<span class="ruby-keyword kw">end</span>
|
257
|
+
</pre>
|
258
|
+
</div>
|
259
|
+
</div>
|
260
|
+
</div>
|
261
|
+
|
262
|
+
<div id="method-M000049" class="method-detail">
|
263
|
+
<a name="M000049"></a>
|
264
|
+
|
265
|
+
<div class="method-heading">
|
266
|
+
<a href="#M000049" class="method-signature">
|
267
|
+
<span class="method-name">add_named_graph</span><span class="method-args">(graph_uri)</span>
|
268
|
+
</a>
|
269
|
+
</div>
|
270
|
+
|
271
|
+
<div class="method-description">
|
272
|
+
<p>
|
273
|
+
Add a named graph. This will be added as a named graph in the request
|
274
|
+
protocol
|
275
|
+
</p>
|
276
|
+
<p><a class="source-toggle" href="#"
|
277
|
+
onclick="toggleCode('M000049-source');return false;">[Source]</a></p>
|
278
|
+
<div class="method-source-code" id="M000049-source">
|
279
|
+
<pre>
|
280
|
+
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line 140</span>
|
281
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_named_graph</span>(<span class="ruby-identifier">graph_uri</span>)
|
282
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@named_graphs</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
|
283
|
+
<span class="ruby-ivar">@named_graphs</span> = []
|
284
|
+
<span class="ruby-keyword kw">end</span>
|
285
|
+
<span class="ruby-ivar">@named_graphs</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">graph_uri</span>
|
286
|
+
<span class="ruby-keyword kw">end</span>
|
287
|
+
</pre>
|
288
|
+
</div>
|
289
|
+
</div>
|
290
|
+
</div>
|
291
|
+
|
292
|
+
<div id="method-M000055" class="method-detail">
|
293
|
+
<a name="M000055"></a>
|
294
|
+
|
295
|
+
<div class="method-heading">
|
296
|
+
<a href="#M000055" class="method-signature">
|
297
|
+
<span class="method-name">ask</span><span class="method-args">(query, format=Pho::Sparql::SPARQL_RESULTS_XML)</span>
|
298
|
+
</a>
|
299
|
+
</div>
|
300
|
+
|
301
|
+
<div class="method-description">
|
302
|
+
<p>
|
303
|
+
Perform a SPARQL ASK <a href="SparqlClient.html#M000050">query</a>.
|
304
|
+
</p>
|
305
|
+
<table>
|
306
|
+
<tr><td valign="top"><a href="SparqlClient.html#M000050">query</a>:</td><td>the SPARQL <a href="SparqlClient.html#M000050">query</a>
|
307
|
+
|
308
|
+
</td></tr>
|
309
|
+
<tr><td valign="top">format:</td><td>the preferred response format
|
310
|
+
|
311
|
+
</td></tr>
|
312
|
+
</table>
|
313
|
+
<p><a class="source-toggle" href="#"
|
314
|
+
onclick="toggleCode('M000055-source');return false;">[Source]</a></p>
|
315
|
+
<div class="method-source-code" id="M000055-source">
|
316
|
+
<pre>
|
317
|
+
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line 231</span>
|
318
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ask</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>=<span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Sparql</span><span class="ruby-operator">::</span><span class="ruby-constant">SPARQL_RESULTS_XML</span>)
|
319
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">query</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>)
|
320
|
+
<span class="ruby-keyword kw">end</span>
|
321
|
+
</pre>
|
322
|
+
</div>
|
323
|
+
</div>
|
324
|
+
</div>
|
325
|
+
|
326
|
+
<div id="method-M000054" class="method-detail">
|
327
|
+
<a name="M000054"></a>
|
328
|
+
|
329
|
+
<div class="method-heading">
|
330
|
+
<a href="#M000054" class="method-signature">
|
331
|
+
<span class="method-name">construct</span><span class="method-args">(query, format="application/rdf+xml")</span>
|
332
|
+
</a>
|
333
|
+
</div>
|
334
|
+
|
335
|
+
<div class="method-description">
|
336
|
+
<p>
|
337
|
+
Perform a SPARQL CONSTRUCT <a href="SparqlClient.html#M000050">query</a>.
|
338
|
+
</p>
|
339
|
+
<table>
|
340
|
+
<tr><td valign="top"><a href="SparqlClient.html#M000050">query</a>:</td><td>the SPARQL <a href="SparqlClient.html#M000050">query</a>
|
341
|
+
|
342
|
+
</td></tr>
|
343
|
+
<tr><td valign="top">format:</td><td>the preferred response format
|
344
|
+
|
345
|
+
</td></tr>
|
346
|
+
</table>
|
347
|
+
<p><a class="source-toggle" href="#"
|
348
|
+
onclick="toggleCode('M000054-source');return false;">[Source]</a></p>
|
349
|
+
<div class="method-source-code" id="M000054-source">
|
350
|
+
<pre>
|
351
|
+
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line 223</span>
|
352
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">construct</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>=<span class="ruby-value str">"application/rdf+xml"</span>)
|
353
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">query</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>)
|
354
|
+
<span class="ruby-keyword kw">end</span>
|
355
|
+
</pre>
|
356
|
+
</div>
|
357
|
+
</div>
|
358
|
+
</div>
|
359
|
+
|
360
|
+
<div id="method-M000052" class="method-detail">
|
361
|
+
<a name="M000052"></a>
|
362
|
+
|
363
|
+
<div class="method-heading">
|
364
|
+
<a href="#M000052" class="method-signature">
|
365
|
+
<span class="method-name">describe</span><span class="method-args">(query, format="application/rdf+xml")</span>
|
366
|
+
</a>
|
367
|
+
</div>
|
368
|
+
|
369
|
+
<div class="method-description">
|
370
|
+
<p>
|
371
|
+
Perform a SPARQL DESCRIBE <a href="SparqlClient.html#M000050">query</a>.
|
372
|
+
</p>
|
373
|
+
<table>
|
374
|
+
<tr><td valign="top"><a href="SparqlClient.html#M000050">query</a>:</td><td>the SPARQL <a href="SparqlClient.html#M000050">query</a>
|
375
|
+
|
376
|
+
</td></tr>
|
377
|
+
<tr><td valign="top">format:</td><td>the preferred response format
|
378
|
+
|
379
|
+
</td></tr>
|
380
|
+
</table>
|
381
|
+
<p><a class="source-toggle" href="#"
|
382
|
+
onclick="toggleCode('M000052-source');return false;">[Source]</a></p>
|
383
|
+
<div class="method-source-code" id="M000052-source">
|
384
|
+
<pre>
|
385
|
+
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line 202</span>
|
386
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">describe</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>=<span class="ruby-value str">"application/rdf+xml"</span>)
|
387
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">query</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>)
|
388
|
+
<span class="ruby-keyword kw">end</span>
|
389
|
+
</pre>
|
390
|
+
</div>
|
391
|
+
</div>
|
392
|
+
</div>
|
393
|
+
|
394
|
+
<div id="method-M000051" class="method-detail">
|
395
|
+
<a name="M000051"></a>
|
396
|
+
|
397
|
+
<div class="method-heading">
|
398
|
+
<a href="#M000051" class="method-signature">
|
399
|
+
<span class="method-name">describe_uri</span><span class="method-args">(uri, format="application/rdf+xml", type=:cbd)</span>
|
400
|
+
</a>
|
401
|
+
</div>
|
402
|
+
|
403
|
+
<div class="method-description">
|
404
|
+
<p>
|
405
|
+
Describe a uri, optionally specifying a form of bounded description
|
406
|
+
</p>
|
407
|
+
<table>
|
408
|
+
<tr><td valign="top">uri:</td><td>the uri to <a href="SparqlClient.html#M000052">describe</a>
|
409
|
+
|
410
|
+
</td></tr>
|
411
|
+
<tr><td valign="top">format:</td><td>mimetype for results
|
412
|
+
|
413
|
+
</td></tr>
|
414
|
+
<tr><td valign="top">type:</td><td>symbol indicating type of description, i.e. +:cbd+, +:scbd+, +:lcbd+, or
|
415
|
+
+:slcbd+
|
416
|
+
|
417
|
+
</td></tr>
|
418
|
+
</table>
|
419
|
+
<p><a class="source-toggle" href="#"
|
420
|
+
onclick="toggleCode('M000051-source');return false;">[Source]</a></p>
|
421
|
+
<div class="method-source-code" id="M000051-source">
|
422
|
+
<pre>
|
423
|
+
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line 189</span>
|
424
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">describe_uri</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">type</span>=<span class="ruby-identifier">:cbd</span>)
|
425
|
+
<span class="ruby-identifier">template</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Sparql</span><span class="ruby-operator">::</span><span class="ruby-constant">DESCRIPTIONS</span>[<span class="ruby-identifier">type</span>]
|
426
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">template</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
|
427
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-value str">"Unknown description type"</span>
|
428
|
+
<span class="ruby-keyword kw">end</span>
|
429
|
+
<span class="ruby-identifier">query</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Sparql</span><span class="ruby-operator">::</span><span class="ruby-constant">SparqlHelper</span>.<span class="ruby-identifier">apply_initial_bindings</span>(<span class="ruby-identifier">template</span>, {<span class="ruby-value str">"uri"</span> =<span class="ruby-operator">></span> <span class="ruby-node">"<#{uri}>"</span>} )
|
430
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">describe</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>)
|
431
|
+
<span class="ruby-keyword kw">end</span>
|
432
|
+
</pre>
|
433
|
+
</div>
|
434
|
+
</div>
|
435
|
+
</div>
|
436
|
+
|
437
|
+
<div id="method-M000053" class="method-detail">
|
438
|
+
<a name="M000053"></a>
|
439
|
+
|
440
|
+
<div class="method-heading">
|
441
|
+
<a href="#M000053" class="method-signature">
|
442
|
+
<span class="method-name">multi_describe</span><span class="method-args">(uris, format="application/rdf+xml")</span>
|
443
|
+
</a>
|
444
|
+
</div>
|
445
|
+
|
446
|
+
<div class="method-description">
|
447
|
+
<p>
|
448
|
+
DESCRIBE multiple resources in a single <a
|
449
|
+
href="SparqlClient.html#M000050">query</a>. The provided array should
|
450
|
+
contain the uris that are to be described
|
451
|
+
</p>
|
452
|
+
<p>
|
453
|
+
This will generate a <a href="SparqlClient.html#M000050">query</a> like:
|
454
|
+
</p>
|
455
|
+
<pre>
|
456
|
+
DESCRIBE <http://www.example.org> <http://www.example.com> ...
|
457
|
+
</pre>
|
458
|
+
<table>
|
459
|
+
<tr><td valign="top">uris:</td><td>list of the uris to be described
|
460
|
+
|
461
|
+
</td></tr>
|
462
|
+
<tr><td valign="top">format:</td><td>the preferred response format. Default is <a href="../RDF.html">RDF</a>/XML
|
463
|
+
|
464
|
+
</td></tr>
|
465
|
+
</table>
|
466
|
+
<p><a class="source-toggle" href="#"
|
467
|
+
onclick="toggleCode('M000053-source');return false;">[Source]</a></p>
|
468
|
+
<div class="method-source-code" id="M000053-source">
|
469
|
+
<pre>
|
470
|
+
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line 214</span>
|
471
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">multi_describe</span>(<span class="ruby-identifier">uris</span>, <span class="ruby-identifier">format</span>=<span class="ruby-value str">"application/rdf+xml"</span>)
|
472
|
+
<span class="ruby-identifier">query</span> = <span class="ruby-value str">"DESCRIBE "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">uris</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">u</span><span class="ruby-operator">|</span> <span class="ruby-node">"<#{u}>"</span> }.<span class="ruby-identifier">join</span>(<span class="ruby-value str">" "</span>)
|
473
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">query</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>)
|
474
|
+
<span class="ruby-keyword kw">end</span>
|
475
|
+
</pre>
|
476
|
+
</div>
|
477
|
+
</div>
|
478
|
+
</div>
|
479
|
+
|
480
|
+
<div id="method-M000050" class="method-detail">
|
481
|
+
<a name="M000050"></a>
|
482
|
+
|
483
|
+
<div class="method-heading">
|
484
|
+
<a href="#M000050" class="method-signature">
|
485
|
+
<span class="method-name">query</span><span class="method-args">(sparql, format=nil, graphs=nil, named_graphs=nil)</span>
|
486
|
+
</a>
|
487
|
+
</div>
|
488
|
+
|
489
|
+
<div class="method-description">
|
490
|
+
<p>
|
491
|
+
Perform a sparql <a href="SparqlClient.html#M000050">query</a>
|
492
|
+
</p>
|
493
|
+
<table>
|
494
|
+
<tr><td valign="top">sparql:</td><td>a valid SPARQL <a href="SparqlClient.html#M000050">query</a>
|
495
|
+
|
496
|
+
</td></tr>
|
497
|
+
<tr><td valign="top">format:</td><td>specific a request format. Usually a media-type, but may be a name for a
|
498
|
+
type, if not using Conneg
|
499
|
+
|
500
|
+
</td></tr>
|
501
|
+
<tr><td valign="top">graphs:</td><td>an array of default graphs
|
502
|
+
|
503
|
+
</td></tr>
|
504
|
+
<tr><td valign="top">named_graphs:</td><td>an array of named graphs
|
505
|
+
|
506
|
+
</td></tr>
|
507
|
+
</table>
|
508
|
+
<p><a class="source-toggle" href="#"
|
509
|
+
onclick="toggleCode('M000050-source');return false;">[Source]</a></p>
|
510
|
+
<div class="method-source-code" id="M000050-source">
|
511
|
+
<pre>
|
512
|
+
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line 153</span>
|
513
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">query</span>(<span class="ruby-identifier">sparql</span>, <span class="ruby-identifier">format</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">graphs</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">named_graphs</span>=<span class="ruby-keyword kw">nil</span>)
|
514
|
+
|
515
|
+
<span class="ruby-identifier">params</span> = {}
|
516
|
+
<span class="ruby-identifier">params</span>[<span class="ruby-value str">"query"</span>] = <span class="ruby-identifier">sparql</span>
|
517
|
+
|
518
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">graphs</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
|
519
|
+
<span class="ruby-identifier">params</span>[<span class="ruby-value str">"default-graph-uri"</span>] = <span class="ruby-identifier">graphs</span>
|
520
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@graphs</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
|
521
|
+
<span class="ruby-identifier">params</span>[<span class="ruby-value str">"default-graph-uri"</span>] = <span class="ruby-ivar">@graphs</span>
|
522
|
+
<span class="ruby-keyword kw">end</span>
|
523
|
+
|
524
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">named_graphs</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
|
525
|
+
<span class="ruby-identifier">params</span>[<span class="ruby-value str">"named-graph-uri"</span>] = <span class="ruby-identifier">named_graphs</span>
|
526
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@named_graphs</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
|
527
|
+
<span class="ruby-identifier">params</span>[<span class="ruby-value str">"named-graph-uri"</span>] = <span class="ruby-ivar">@named_graphs</span>
|
528
|
+
<span class="ruby-keyword kw">end</span>
|
529
|
+
|
530
|
+
<span class="ruby-identifier">headers</span> = {}
|
531
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">format</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
|
532
|
+
|
533
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@output_parameter_name</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
|
534
|
+
<span class="ruby-identifier">params</span>[<span class="ruby-ivar">@output_parameter_name</span>] = <span class="ruby-identifier">format</span>
|
535
|
+
<span class="ruby-keyword kw">else</span>
|
536
|
+
<span class="ruby-identifier">headers</span>[<span class="ruby-value str">"Accept"</span>] = <span class="ruby-identifier">format</span>
|
537
|
+
<span class="ruby-keyword kw">end</span>
|
538
|
+
|
539
|
+
<span class="ruby-keyword kw">end</span>
|
540
|
+
|
541
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>( <span class="ruby-ivar">@endpoint</span>, <span class="ruby-identifier">params</span>, <span class="ruby-identifier">headers</span> )
|
542
|
+
<span class="ruby-keyword kw">end</span>
|
543
|
+
</pre>
|
544
|
+
</div>
|
545
|
+
</div>
|
546
|
+
</div>
|
547
|
+
|
548
|
+
<div id="method-M000056" class="method-detail">
|
549
|
+
<a name="M000056"></a>
|
550
|
+
|
551
|
+
<div class="method-heading">
|
552
|
+
<a href="#M000056" class="method-signature">
|
553
|
+
<span class="method-name">select</span><span class="method-args">(query, format=Pho::Sparql::SPARQL_RESULTS_XML)</span>
|
554
|
+
</a>
|
555
|
+
</div>
|
556
|
+
|
557
|
+
<div class="method-description">
|
558
|
+
<p>
|
559
|
+
Perform a SPARQL SELECT <a href="SparqlClient.html#M000050">query</a>.
|
560
|
+
</p>
|
561
|
+
<table>
|
562
|
+
<tr><td valign="top"><a href="SparqlClient.html#M000050">query</a>:</td><td>the SPARQL <a href="SparqlClient.html#M000050">query</a>
|
563
|
+
|
564
|
+
</td></tr>
|
565
|
+
<tr><td valign="top">format:</td><td>the preferred response format
|
566
|
+
|
567
|
+
</td></tr>
|
568
|
+
</table>
|
569
|
+
<p><a class="source-toggle" href="#"
|
570
|
+
onclick="toggleCode('M000056-source');return false;">[Source]</a></p>
|
571
|
+
<div class="method-source-code" id="M000056-source">
|
572
|
+
<pre>
|
573
|
+
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line 239</span>
|
574
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">select</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>=<span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Sparql</span><span class="ruby-operator">::</span><span class="ruby-constant">SPARQL_RESULTS_XML</span>)
|
575
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">query</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">format</span>)
|
576
|
+
<span class="ruby-keyword kw">end</span>
|
577
|
+
</pre>
|
578
|
+
</div>
|
579
|
+
</div>
|
580
|
+
</div>
|
581
|
+
|
582
|
+
|
583
|
+
</div>
|
584
|
+
|
585
|
+
|
586
|
+
</div>
|
587
|
+
|
588
|
+
|
589
|
+
<div id="validator-badges">
|
590
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
591
|
+
</div>
|
592
|
+
|
593
|
+
</body>
|
594
|
+
</html>
|