pho 0.5 → 0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +17 -0
- data/Rakefile +10 -2
- data/bin/talis_store +37 -92
- data/doc/rdoc/classes/Pho.html +11 -0
- data/doc/rdoc/classes/Pho/CommandLine.html +508 -0
- data/doc/rdoc/classes/Pho/DatatypeProperty.html +15 -15
- data/doc/rdoc/classes/Pho/Enrichment.html +1 -1
- data/doc/rdoc/classes/Pho/Enrichment/{ResourceEnricher.html → StoreEnricher.html} +158 -58
- data/doc/rdoc/classes/Pho/Etags.html +36 -36
- data/doc/rdoc/classes/Pho/Facet/Results.html +19 -19
- data/doc/rdoc/classes/Pho/Facet/Term.html +6 -6
- data/doc/rdoc/classes/Pho/FieldPredicateMap.html +94 -94
- data/doc/rdoc/classes/Pho/FieldWeighting.html +14 -14
- data/doc/rdoc/classes/Pho/FileManagement/AbstractFileManager.html +126 -91
- data/doc/rdoc/classes/Pho/FileManagement/FileManager.html +68 -62
- data/doc/rdoc/classes/Pho/FileManagement/RDFManager.html +22 -57
- data/doc/rdoc/classes/Pho/Job.html +68 -67
- data/doc/rdoc/classes/Pho/Jobs.html +62 -62
- data/doc/rdoc/classes/Pho/QueryProfile.html +64 -64
- data/doc/rdoc/classes/Pho/RDF.html +120 -0
- data/doc/rdoc/classes/Pho/RDF/Parser.html +277 -0
- data/doc/rdoc/classes/Pho/ResourceHash.html +1 -1
- data/doc/rdoc/classes/Pho/ResourceHash/Converter.html +48 -46
- data/doc/rdoc/classes/Pho/ResourceHash/SetAlgebra.html +15 -14
- data/doc/rdoc/classes/Pho/Snapshot.html +36 -36
- data/doc/rdoc/classes/Pho/Sparql.html +50 -0
- data/doc/rdoc/classes/Pho/Sparql/SparqlClient.html +147 -68
- data/doc/rdoc/classes/Pho/Sparql/SparqlHelper.html +195 -114
- data/doc/rdoc/classes/Pho/Status.html +26 -26
- data/doc/rdoc/classes/Pho/Store.html +271 -264
- data/doc/rdoc/classes/Pho/StoreSparqlClient.html +183 -0
- data/doc/rdoc/classes/Pho/Update.html +1 -0
- data/doc/rdoc/classes/Pho/Update/Changeset.html +69 -68
- data/doc/rdoc/classes/Pho/Update/ChangesetBuilder.html +24 -24
- data/doc/rdoc/classes/Pho/Update/Changesets.html +15 -14
- data/doc/rdoc/classes/Pho/Update/LiteralStatement.html +18 -18
- data/doc/rdoc/classes/Pho/Update/ResourceStatement.html +24 -24
- data/doc/rdoc/classes/Pho/Update/Statement.html +28 -27
- data/doc/rdoc/classes/String.html +1 -1
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/CHANGES.html +53 -1
- data/doc/rdoc/files/lib/pho/changeset_rb.html +1 -1
- data/doc/rdoc/files/lib/pho/command_line_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/converter_rb.html +1 -1
- data/doc/rdoc/files/lib/pho/enrichment_rb.html +1 -1
- data/doc/rdoc/files/lib/pho/file_management_rb.html +1 -1
- data/doc/rdoc/files/lib/pho/file_manager_rb.html +1 -1
- data/doc/rdoc/files/lib/pho/rdf_collection_rb.html +1 -1
- data/doc/rdoc/files/lib/pho/rdf_rb.html +108 -0
- data/doc/rdoc/files/lib/pho/sparql_rb.html +1 -1
- data/doc/rdoc/files/lib/pho/store_rb.html +8 -1
- data/doc/rdoc/files/lib/pho_rb.html +4 -2
- data/doc/rdoc/fr_class_index.html +6 -1
- data/doc/rdoc/fr_file_index.html +2 -0
- data/doc/rdoc/fr_method_index.html +192 -172
- data/examples/calais/bio.txt +7 -0
- data/examples/calais/dump.rb +17 -0
- data/examples/calais/enlighten.rb +23 -0
- data/examples/calais/output.rdf +25 -0
- data/examples/sinatra/viewer.rb +20 -0
- data/lib/pho.rb +4 -1
- data/lib/pho/changeset.rb +17 -1
- data/lib/pho/command_line.rb +166 -0
- data/lib/pho/converter.rb +8 -3
- data/lib/pho/enrichment.rb +93 -28
- data/lib/pho/file_management.rb +32 -19
- data/lib/pho/file_manager.rb +22 -26
- data/lib/pho/rdf.rb +74 -0
- data/lib/pho/rdf_collection.rb +2 -17
- data/lib/pho/sparql.rb +150 -38
- data/lib/pho/store.rb +28 -2
- data/tests/tc_contentbox.rb +41 -0
- data/tests/tc_enrichment.rb +41 -4
- data/tests/tc_file_manager.rb +97 -7
- data/tests/tc_rdf_collection.rb +25 -13
- data/tests/tc_rdf_parser.rb +37 -0
- data/tests/tc_sparql.rb +72 -2
- data/tests/tc_sparql_helper.rb +16 -0
- data/tests/ts_pho.rb +2 -1
- metadata +20 -3
@@ -92,8 +92,8 @@ Class providing set algebra methods over triple hashes
|
|
92
92
|
<h3 class="section-bar">Methods</h3>
|
93
93
|
|
94
94
|
<div class="name-list">
|
95
|
-
<a href="#
|
96
|
-
<a href="#
|
95
|
+
<a href="#M000082">minus</a>
|
96
|
+
<a href="#M000083">object_in_array?</a>
|
97
97
|
</div>
|
98
98
|
</div>
|
99
99
|
|
@@ -115,19 +115,20 @@ Class providing set algebra methods over triple hashes
|
|
115
115
|
<div id="methods">
|
116
116
|
<h3 class="section-bar">Public Class methods</h3>
|
117
117
|
|
118
|
-
<div id="method-
|
119
|
-
<a name="
|
118
|
+
<div id="method-M000082" class="method-detail">
|
119
|
+
<a name="M000082"></a>
|
120
120
|
|
121
121
|
<div class="method-heading">
|
122
|
-
<a href="#
|
122
|
+
<a href="#M000082" class="method-signature">
|
123
123
|
<span class="method-name">minus</span><span class="method-args">(first, second)</span>
|
124
124
|
</a>
|
125
125
|
</div>
|
126
126
|
|
127
127
|
<div class="method-description">
|
128
128
|
<p>
|
129
|
-
Accepts two triple hashes, expressed as
|
130
|
-
|
129
|
+
Accepts two triple hashes, expressed as <a
|
130
|
+
href="../RDF.html">RDF</a>-in-JSON and returns a new Ruby data structure
|
131
|
+
that constitutes the different between the two graphs
|
131
132
|
</p>
|
132
133
|
<p>
|
133
134
|
i.e. the return value will be a hash containing the triples that are in the
|
@@ -138,8 +139,8 @@ first graph but which are not present in the second.
|
|
138
139
|
second:: the second graph.
|
139
140
|
</pre>
|
140
141
|
<p><a class="source-toggle" href="#"
|
141
|
-
onclick="toggleCode('
|
142
|
-
<div class="method-source-code" id="
|
142
|
+
onclick="toggleCode('M000082-source');return false;">[Source]</a></p>
|
143
|
+
<div class="method-source-code" id="M000082-source">
|
143
144
|
<pre>
|
144
145
|
<span class="ruby-comment cmt"># File lib/pho/resource_hash.rb, line 20</span>
|
145
146
|
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">SetAlgebra</span>.<span class="ruby-identifier">minus</span>(<span class="ruby-identifier">first</span>, <span class="ruby-identifier">second</span>)
|
@@ -182,11 +183,11 @@ first graph but which are not present in the second.
|
|
182
183
|
</div>
|
183
184
|
</div>
|
184
185
|
|
185
|
-
<div id="method-
|
186
|
-
<a name="
|
186
|
+
<div id="method-M000083" class="method-detail">
|
187
|
+
<a name="M000083"></a>
|
187
188
|
|
188
189
|
<div class="method-heading">
|
189
|
-
<a href="#
|
190
|
+
<a href="#M000083" class="method-signature">
|
190
191
|
<span class="method-name">object_in_array?</span><span class="method-args">(array, val)</span>
|
191
192
|
</a>
|
192
193
|
</div>
|
@@ -197,8 +198,8 @@ Is there an object in the specified array, that matches the provided
|
|
197
198
|
description
|
198
199
|
</p>
|
199
200
|
<p><a class="source-toggle" href="#"
|
200
|
-
onclick="toggleCode('
|
201
|
-
<div class="method-source-code" id="
|
201
|
+
onclick="toggleCode('M000083-source');return false;">[Source]</a></p>
|
202
|
+
<div class="method-source-code" id="M000083-source">
|
202
203
|
<pre>
|
203
204
|
<span class="ruby-comment cmt"># File lib/pho/resource_hash.rb, line 57</span>
|
204
205
|
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">SetAlgebra</span>.<span class="ruby-identifier">object_in_array?</span>(<span class="ruby-identifier">array</span>, <span class="ruby-identifier">val</span>)
|
@@ -81,7 +81,7 @@
|
|
81
81
|
<div id="description">
|
82
82
|
<p>
|
83
83
|
In the Talis Platform a "snapshot" is an <a
|
84
|
-
href="Snapshot.html#
|
84
|
+
href="Snapshot.html#M000179">backup</a> of the contents of a <a
|
85
85
|
href="Store.html">Store</a>
|
86
86
|
</p>
|
87
87
|
<p>
|
@@ -102,11 +102,11 @@ A snapshot can be generated (or scheduled) using the Store.snapshot method.
|
|
102
102
|
<h3 class="section-bar">Methods</h3>
|
103
103
|
|
104
104
|
<div class="name-list">
|
105
|
-
<a href="#
|
106
|
-
<a href="#
|
107
|
-
<a href="#
|
108
|
-
<a href="#
|
109
|
-
<a href="#
|
105
|
+
<a href="#M000179">backup</a>
|
106
|
+
<a href="#M000177">new</a>
|
107
|
+
<a href="#M000176">parse</a>
|
108
|
+
<a href="#M000175">read_from_store</a>
|
109
|
+
<a href="#M000178">read_md5</a>
|
110
110
|
</div>
|
111
111
|
</div>
|
112
112
|
|
@@ -176,19 +176,19 @@ The URL from which the snapshot can be retrieved
|
|
176
176
|
<div id="methods">
|
177
177
|
<h3 class="section-bar">Public Class methods</h3>
|
178
178
|
|
179
|
-
<div id="method-
|
180
|
-
<a name="
|
179
|
+
<div id="method-M000177" class="method-detail">
|
180
|
+
<a name="M000177"></a>
|
181
181
|
|
182
182
|
<div class="method-heading">
|
183
|
-
<a href="#
|
183
|
+
<a href="#M000177" class="method-signature">
|
184
184
|
<span class="method-name">new</span><span class="method-args">(url, md5_url, size, units, date)</span>
|
185
185
|
</a>
|
186
186
|
</div>
|
187
187
|
|
188
188
|
<div class="method-description">
|
189
189
|
<p><a class="source-toggle" href="#"
|
190
|
-
onclick="toggleCode('
|
191
|
-
<div class="method-source-code" id="
|
190
|
+
onclick="toggleCode('M000177-source');return false;">[Source]</a></p>
|
191
|
+
<div class="method-source-code" id="M000177-source">
|
192
192
|
<pre>
|
193
193
|
<span class="ruby-comment cmt"># File lib/pho/snapshot.rb, line 76</span>
|
194
194
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">md5_url</span>, <span class="ruby-identifier">size</span>, <span class="ruby-identifier">units</span>, <span class="ruby-identifier">date</span>)
|
@@ -203,21 +203,21 @@ The URL from which the snapshot can be retrieved
|
|
203
203
|
</div>
|
204
204
|
</div>
|
205
205
|
|
206
|
-
<div id="method-
|
207
|
-
<a name="
|
206
|
+
<div id="method-M000176" class="method-detail">
|
207
|
+
<a name="M000176"></a>
|
208
208
|
|
209
209
|
<div class="method-heading">
|
210
|
-
<a href="#
|
210
|
+
<a href="#M000176" class="method-signature">
|
211
211
|
<span class="method-name">parse</span><span class="method-args">(storeuri, content)</span>
|
212
212
|
</a>
|
213
213
|
</div>
|
214
214
|
|
215
215
|
<div class="method-description">
|
216
216
|
<p>
|
217
|
-
Class method to <a href="Snapshot.html#
|
218
|
-
from the API, e.g. as produced by the <a
|
219
|
-
href="Store.html#
|
220
|
-
href="Snapshot.html#
|
217
|
+
Class method to <a href="Snapshot.html#M000176">parse</a> the <a
|
218
|
+
href="RDF.html">RDF</a> response from the API, e.g. as produced by the <a
|
219
|
+
href="Store.html#M000170">Store.get_snapshots</a> method and create a <a
|
220
|
+
href="Snapshot.html#M000177">new</a> <a href="Snapshot.html">Snapshot</a>
|
221
221
|
object. At the moment the Platform only supports single snapshot.
|
222
222
|
</p>
|
223
223
|
<p>
|
@@ -228,8 +228,8 @@ If the response was an error, then an exception will be thrown
|
|
228
228
|
content:: response from the API
|
229
229
|
</pre>
|
230
230
|
<p><a class="source-toggle" href="#"
|
231
|
-
onclick="toggleCode('
|
232
|
-
<div class="method-source-code" id="
|
231
|
+
onclick="toggleCode('M000176-source');return false;">[Source]</a></p>
|
232
|
+
<div class="method-source-code" id="M000176-source">
|
233
233
|
<pre>
|
234
234
|
<span class="ruby-comment cmt"># File lib/pho/snapshot.rb, line 52</span>
|
235
235
|
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Snapshot</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">storeuri</span>, <span class="ruby-identifier">content</span>)
|
@@ -260,11 +260,11 @@ If the response was an error, then an exception will be thrown
|
|
260
260
|
</div>
|
261
261
|
</div>
|
262
262
|
|
263
|
-
<div id="method-
|
264
|
-
<a name="
|
263
|
+
<div id="method-M000175" class="method-detail">
|
264
|
+
<a name="M000175"></a>
|
265
265
|
|
266
266
|
<div class="method-heading">
|
267
|
-
<a href="#
|
267
|
+
<a href="#M000175" class="method-signature">
|
268
268
|
<span class="method-name">read_from_store</span><span class="method-args">(store)</span>
|
269
269
|
</a>
|
270
270
|
</div>
|
@@ -279,8 +279,8 @@ Read snapshot data from the given store
|
|
279
279
|
</td></tr>
|
280
280
|
</table>
|
281
281
|
<p><a class="source-toggle" href="#"
|
282
|
-
onclick="toggleCode('
|
283
|
-
<div class="method-source-code" id="
|
282
|
+
onclick="toggleCode('M000175-source');return false;">[Source]</a></p>
|
283
|
+
<div class="method-source-code" id="M000175-source">
|
284
284
|
<pre>
|
285
285
|
<span class="ruby-comment cmt"># File lib/pho/snapshot.rb, line 34</span>
|
286
286
|
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Snapshot</span>.<span class="ruby-identifier">read_from_store</span>(<span class="ruby-identifier">store</span>)
|
@@ -300,11 +300,11 @@ Read snapshot data from the given store
|
|
300
300
|
|
301
301
|
<h3 class="section-bar">Public Instance methods</h3>
|
302
302
|
|
303
|
-
<div id="method-
|
304
|
-
<a name="
|
303
|
+
<div id="method-M000179" class="method-detail">
|
304
|
+
<a name="M000179"></a>
|
305
305
|
|
306
306
|
<div class="method-heading">
|
307
|
-
<a href="#
|
307
|
+
<a href="#M000179" class="method-signature">
|
308
308
|
<span class="method-name">backup</span><span class="method-args">(store, dir=Dir.tmpdir)</span>
|
309
309
|
</a>
|
310
310
|
</div>
|
@@ -317,7 +317,7 @@ published value. If they don‘t match then a RuntimeError will be
|
|
317
317
|
raised
|
318
318
|
</p>
|
319
319
|
<table>
|
320
|
-
<tr><td valign="top">store:</td><td>the store to <a href="Snapshot.html#
|
320
|
+
<tr><td valign="top">store:</td><td>the store to <a href="Snapshot.html#M000179">backup</a>
|
321
321
|
|
322
322
|
</td></tr>
|
323
323
|
<tr><td valign="top">dir:</td><td>directory in which snapshot will be stored
|
@@ -325,8 +325,8 @@ raised
|
|
325
325
|
</td></tr>
|
326
326
|
</table>
|
327
327
|
<p><a class="source-toggle" href="#"
|
328
|
-
onclick="toggleCode('
|
329
|
-
<div class="method-source-code" id="
|
328
|
+
onclick="toggleCode('M000179-source');return false;">[Source]</a></p>
|
329
|
+
<div class="method-source-code" id="M000179-source">
|
330
330
|
<pre>
|
331
331
|
<span class="ruby-comment cmt"># File lib/pho/snapshot.rb, line 96</span>
|
332
332
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">backup</span>(<span class="ruby-identifier">store</span>, <span class="ruby-identifier">dir</span>=<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">tmpdir</span>)
|
@@ -356,11 +356,11 @@ raised
|
|
356
356
|
</div>
|
357
357
|
</div>
|
358
358
|
|
359
|
-
<div id="method-
|
360
|
-
<a name="
|
359
|
+
<div id="method-M000178" class="method-detail">
|
360
|
+
<a name="M000178"></a>
|
361
361
|
|
362
362
|
<div class="method-heading">
|
363
|
-
<a href="#
|
363
|
+
<a href="#M000178" class="method-signature">
|
364
364
|
<span class="method-name">read_md5</span><span class="method-args">(client=HttpClient.new())</span>
|
365
365
|
</a>
|
366
366
|
</div>
|
@@ -370,8 +370,8 @@ raised
|
|
370
370
|
Read the published MD5 value
|
371
371
|
</p>
|
372
372
|
<p><a class="source-toggle" href="#"
|
373
|
-
onclick="toggleCode('
|
374
|
-
<div class="method-source-code" id="
|
373
|
+
onclick="toggleCode('M000178-source');return false;">[Source]</a></p>
|
374
|
+
<div class="method-source-code" id="M000178-source">
|
375
375
|
<pre>
|
376
376
|
<span class="ruby-comment cmt"># File lib/pho/snapshot.rb, line 86</span>
|
377
377
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">read_md5</span>(<span class="ruby-identifier">client</span>=<span class="ruby-constant">HttpClient</span>.<span class="ruby-identifier">new</span>())
|
@@ -114,6 +114,56 @@ Class <a href="Sparql/SparqlHelper.html" class="link">Pho::Sparql::SparqlHelper<
|
|
114
114
|
<td>=</td>
|
115
115
|
<td class="context-item-value">"application/sparql-results+json"</td>
|
116
116
|
</tr>
|
117
|
+
<tr class="top-aligned-row context-row">
|
118
|
+
<td class="context-item-name">SYMMETRIC_BOUNDED_DESCRIPTION</td>
|
119
|
+
<td>=</td>
|
120
|
+
<td class="context-item-value"><<-EOL CONSTRUCT {?uri ?p ?o . ?s ?p2 ?uri .} WHERE { {?uri ?p ?o .} UNION {?s ?p2 ?uri .} } EOL</td>
|
121
|
+
<td width="3em"> </td>
|
122
|
+
<td class="context-item-desc">
|
123
|
+
Includes all statements along both in-bound and out-bound arc paths
|
124
|
+
|
125
|
+
<p>
|
126
|
+
See <a
|
127
|
+
href="http://n2.talis.com/wiki/Bounded_Descriptions_in_RDF">n2.talis.com/wiki/Bounded_Descriptions_in_RDF</a>
|
128
|
+
</p>
|
129
|
+
</td>
|
130
|
+
</tr>
|
131
|
+
<tr class="top-aligned-row context-row">
|
132
|
+
<td class="context-item-name">LABELLED_BOUNDED_DESCRIPTION</td>
|
133
|
+
<td>=</td>
|
134
|
+
<td class="context-item-value"><<-EOL PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> CONSTRUCT { ?uri ?p ?o . ?o rdfs:label ?label . ?o rdfs:comment ?comment . ?o <http://www.w3.org/2004/02/skos/core#prefLabel> ?plabel . ?o rdfs:seeAlso ?seealso. } WHERE { ?uri ?p ?o . OPTIONAL { ?o rdfs:label ?label . } OPTIONAL { ?o <http://www.w3.org/2004/02/skos/core#prefLabel> ?plabel . } OPTIONAL { ?o rdfs:comment ?comment . } OPTIONAL { ?o rdfs:seeAlso ?seealso. } } EOL</td>
|
135
|
+
<td width="3em"> </td>
|
136
|
+
<td class="context-item-desc">
|
137
|
+
Similar to Concise Bounded Description but includes labels for referenced
|
138
|
+
resources
|
139
|
+
|
140
|
+
<p>
|
141
|
+
See <a
|
142
|
+
href="http://n2.talis.com/wiki/Bounded_Descriptions_in_RDF">n2.talis.com/wiki/Bounded_Descriptions_in_RDF</a>
|
143
|
+
</p>
|
144
|
+
</td>
|
145
|
+
</tr>
|
146
|
+
<tr class="top-aligned-row context-row">
|
147
|
+
<td class="context-item-name">SYMMETRIC_LABELLED_BOUNDED_DESCRIPTION</td>
|
148
|
+
<td>=</td>
|
149
|
+
<td class="context-item-value"><<-EOL PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> CONSTRUCT { ?uri ?p ?o . ?o rdfs:label ?label . ?o rdfs:comment ?comment . ?o rdfs:seeAlso ?seealso. ?s ?p2 ?uri . ?s rdfs:label ?label . ?s rdfs:comment ?comment . ?s rdfs:seeAlso ?seealso. } WHERE { { ?uri ?p ?o . OPTIONAL { ?o rdfs:label ?label . } OPTIONAL { ?o rdfs:comment ?comment . } OPTIONAL { ?o rdfs:seeAlso ?seealso. } } UNION { ?s ?p2 ?uri . OPTIONAL { ?s rdfs:label ?label . } OPTIONAL { ?s rdfs:comment ?comment . } OPTIONAL { ?s rdfs:seeAlso ?seealso. } } } EOL</td>
|
150
|
+
<td width="3em"> </td>
|
151
|
+
<td class="context-item-desc">
|
152
|
+
Derived from both the Symmetric and Labelled Bounded Descriptions. Includes
|
153
|
+
all in-bound and out-bound arc paths, with labels for any referenced
|
154
|
+
resources.
|
155
|
+
|
156
|
+
<p>
|
157
|
+
See <a
|
158
|
+
href="http://n2.talis.com/wiki/Bounded_Descriptions_in_RDF">n2.talis.com/wiki/Bounded_Descriptions_in_RDF</a>
|
159
|
+
</p>
|
160
|
+
</td>
|
161
|
+
</tr>
|
162
|
+
<tr class="top-aligned-row context-row">
|
163
|
+
<td class="context-item-name">DESCRIPTIONS</td>
|
164
|
+
<td>=</td>
|
165
|
+
<td class="context-item-value">{ :cbd => "DESCRIBE ?uri", :scbd => SYMMETRIC_BOUNDED_DESCRIPTION, :lcbd => LABELLED_BOUNDED_DESCRIPTION, :slcbd => SYMMETRIC_LABELLED_BOUNDED_DESCRIPTION</td>
|
166
|
+
</tr>
|
117
167
|
</table>
|
118
168
|
</div>
|
119
169
|
</div>
|
@@ -94,13 +94,14 @@ A simple SPARQL client that handles the basic HTTP traffic
|
|
94
94
|
<div class="name-list">
|
95
95
|
<a href="#M000003">add_default_graph</a>
|
96
96
|
<a href="#M000004">add_named_graph</a>
|
97
|
-
<a href="#
|
98
|
-
<a href="#
|
99
|
-
<a href="#
|
100
|
-
<a href="#
|
97
|
+
<a href="#M000010">ask</a>
|
98
|
+
<a href="#M000009">construct</a>
|
99
|
+
<a href="#M000007">describe</a>
|
100
|
+
<a href="#M000006">describe_uri</a>
|
101
|
+
<a href="#M000008">multi_describe</a>
|
101
102
|
<a href="#M000002">new</a>
|
102
103
|
<a href="#M000005">query</a>
|
103
|
-
<a href="#
|
104
|
+
<a href="#M000011">select</a>
|
104
105
|
</div>
|
105
106
|
</div>
|
106
107
|
|
@@ -161,8 +162,9 @@ Content Negotiation
|
|
161
162
|
<td class="context-item-name">supports_rdf_json</td>
|
162
163
|
<td class="context-item-value"> [RW] </td>
|
163
164
|
<td class="context-item-desc">
|
164
|
-
Configures whether the remote endpoint supports the
|
165
|
-
specification for serializing
|
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.
|
166
168
|
|
167
169
|
</td>
|
168
170
|
</tr>
|
@@ -198,15 +200,19 @@ Will default to true.
|
|
198
200
|
<p>
|
199
201
|
Initialize a client for a specific endpoint
|
200
202
|
</p>
|
201
|
-
<
|
202
|
-
endpoint
|
203
|
-
|
204
|
-
</
|
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>
|
205
211
|
<p><a class="source-toggle" href="#"
|
206
212
|
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
|
207
213
|
<div class="method-source-code" id="M000002-source">
|
208
214
|
<pre>
|
209
|
-
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line
|
215
|
+
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line 121</span>
|
210
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>() )
|
211
217
|
<span class="ruby-ivar">@endpoint</span> = <span class="ruby-identifier">endpoint</span>
|
212
218
|
<span class="ruby-ivar">@graphs</span> = <span class="ruby-keyword kw">nil</span>
|
@@ -241,7 +247,7 @@ protocol
|
|
241
247
|
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
|
242
248
|
<div class="method-source-code" id="M000003-source">
|
243
249
|
<pre>
|
244
|
-
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line
|
250
|
+
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line 132</span>
|
245
251
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_default_graph</span>(<span class="ruby-identifier">graph_uri</span>)
|
246
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>
|
247
253
|
<span class="ruby-ivar">@graphs</span> = []
|
@@ -271,7 +277,7 @@ protocol
|
|
271
277
|
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
272
278
|
<div class="method-source-code" id="M000004-source">
|
273
279
|
<pre>
|
274
|
-
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line
|
280
|
+
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line 140</span>
|
275
281
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_named_graph</span>(<span class="ruby-identifier">graph_uri</span>)
|
276
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>
|
277
283
|
<span class="ruby-ivar">@named_graphs</span> = []
|
@@ -283,11 +289,11 @@ protocol
|
|
283
289
|
</div>
|
284
290
|
</div>
|
285
291
|
|
286
|
-
<div id="method-
|
287
|
-
<a name="
|
292
|
+
<div id="method-M000010" class="method-detail">
|
293
|
+
<a name="M000010"></a>
|
288
294
|
|
289
295
|
<div class="method-heading">
|
290
|
-
<a href="#
|
296
|
+
<a href="#M000010" class="method-signature">
|
291
297
|
<span class="method-name">ask</span><span class="method-args">(query, format=Pho::Sparql::SPARQL_RESULTS_XML)</span>
|
292
298
|
</a>
|
293
299
|
</div>
|
@@ -296,15 +302,19 @@ protocol
|
|
296
302
|
<p>
|
297
303
|
Perform a SPARQL ASK <a href="SparqlClient.html#M000005">query</a>.
|
298
304
|
</p>
|
299
|
-
<
|
300
|
-
query
|
301
|
-
|
302
|
-
</
|
305
|
+
<table>
|
306
|
+
<tr><td valign="top"><a href="SparqlClient.html#M000005">query</a>:</td><td>the SPARQL <a href="SparqlClient.html#M000005">query</a>
|
307
|
+
|
308
|
+
</td></tr>
|
309
|
+
<tr><td valign="top">format:</td><td>the preferred response format
|
310
|
+
|
311
|
+
</td></tr>
|
312
|
+
</table>
|
303
313
|
<p><a class="source-toggle" href="#"
|
304
|
-
onclick="toggleCode('
|
305
|
-
<div class="method-source-code" id="
|
314
|
+
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
315
|
+
<div class="method-source-code" id="M000010-source">
|
306
316
|
<pre>
|
307
|
-
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line
|
317
|
+
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line 231</span>
|
308
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>)
|
309
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>)
|
310
320
|
<span class="ruby-keyword kw">end</span>
|
@@ -313,11 +323,11 @@ Perform a SPARQL ASK <a href="SparqlClient.html#M000005">query</a>.
|
|
313
323
|
</div>
|
314
324
|
</div>
|
315
325
|
|
316
|
-
<div id="method-
|
317
|
-
<a name="
|
326
|
+
<div id="method-M000009" class="method-detail">
|
327
|
+
<a name="M000009"></a>
|
318
328
|
|
319
329
|
<div class="method-heading">
|
320
|
-
<a href="#
|
330
|
+
<a href="#M000009" class="method-signature">
|
321
331
|
<span class="method-name">construct</span><span class="method-args">(query, format="application/rdf+xml")</span>
|
322
332
|
</a>
|
323
333
|
</div>
|
@@ -326,15 +336,19 @@ Perform a SPARQL ASK <a href="SparqlClient.html#M000005">query</a>.
|
|
326
336
|
<p>
|
327
337
|
Perform a SPARQL CONSTRUCT <a href="SparqlClient.html#M000005">query</a>.
|
328
338
|
</p>
|
329
|
-
<
|
330
|
-
query
|
331
|
-
|
332
|
-
</
|
339
|
+
<table>
|
340
|
+
<tr><td valign="top"><a href="SparqlClient.html#M000005">query</a>:</td><td>the SPARQL <a href="SparqlClient.html#M000005">query</a>
|
341
|
+
|
342
|
+
</td></tr>
|
343
|
+
<tr><td valign="top">format:</td><td>the preferred response format
|
344
|
+
|
345
|
+
</td></tr>
|
346
|
+
</table>
|
333
347
|
<p><a class="source-toggle" href="#"
|
334
|
-
onclick="toggleCode('
|
335
|
-
<div class="method-source-code" id="
|
348
|
+
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
349
|
+
<div class="method-source-code" id="M000009-source">
|
336
350
|
<pre>
|
337
|
-
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line
|
351
|
+
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line 223</span>
|
338
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>)
|
339
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>)
|
340
354
|
<span class="ruby-keyword kw">end</span>
|
@@ -343,11 +357,11 @@ Perform a SPARQL CONSTRUCT <a href="SparqlClient.html#M000005">query</a>.
|
|
343
357
|
</div>
|
344
358
|
</div>
|
345
359
|
|
346
|
-
<div id="method-
|
347
|
-
<a name="
|
360
|
+
<div id="method-M000007" class="method-detail">
|
361
|
+
<a name="M000007"></a>
|
348
362
|
|
349
363
|
<div class="method-heading">
|
350
|
-
<a href="#
|
364
|
+
<a href="#M000007" class="method-signature">
|
351
365
|
<span class="method-name">describe</span><span class="method-args">(query, format="application/rdf+xml")</span>
|
352
366
|
</a>
|
353
367
|
</div>
|
@@ -356,28 +370,75 @@ Perform a SPARQL CONSTRUCT <a href="SparqlClient.html#M000005">query</a>.
|
|
356
370
|
<p>
|
357
371
|
Perform a SPARQL DESCRIBE <a href="SparqlClient.html#M000005">query</a>.
|
358
372
|
</p>
|
373
|
+
<table>
|
374
|
+
<tr><td valign="top"><a href="SparqlClient.html#M000005">query</a>:</td><td>the SPARQL <a href="SparqlClient.html#M000005">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('M000007-source');return false;">[Source]</a></p>
|
383
|
+
<div class="method-source-code" id="M000007-source">
|
359
384
|
<pre>
|
360
|
-
|
361
|
-
|
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>
|
362
389
|
</pre>
|
390
|
+
</div>
|
391
|
+
</div>
|
392
|
+
</div>
|
393
|
+
|
394
|
+
<div id="method-M000006" class="method-detail">
|
395
|
+
<a name="M000006"></a>
|
396
|
+
|
397
|
+
<div class="method-heading">
|
398
|
+
<a href="#M000006" 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#M000007">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>
|
363
419
|
<p><a class="source-toggle" href="#"
|
364
420
|
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
365
421
|
<div class="method-source-code" id="M000006-source">
|
366
422
|
<pre>
|
367
|
-
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line
|
368
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
369
|
-
<span class="ruby-
|
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>)
|
370
431
|
<span class="ruby-keyword kw">end</span>
|
371
432
|
</pre>
|
372
433
|
</div>
|
373
434
|
</div>
|
374
435
|
</div>
|
375
436
|
|
376
|
-
<div id="method-
|
377
|
-
<a name="
|
437
|
+
<div id="method-M000008" class="method-detail">
|
438
|
+
<a name="M000008"></a>
|
378
439
|
|
379
440
|
<div class="method-heading">
|
380
|
-
<a href="#
|
441
|
+
<a href="#M000008" class="method-signature">
|
381
442
|
<span class="method-name">multi_describe</span><span class="method-args">(uris, format="application/rdf+xml")</span>
|
382
443
|
</a>
|
383
444
|
</div>
|
@@ -393,15 +454,20 @@ This will generate a <a href="SparqlClient.html#M000005">query</a> like:
|
|
393
454
|
</p>
|
394
455
|
<pre>
|
395
456
|
DESCRIBE <http://www.example.org> <http://www.example.com> ...
|
396
|
-
|
397
|
-
uris:: list of the uris to be described
|
398
|
-
format:: the preferred response format. Default is RDF/XML
|
399
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>
|
400
466
|
<p><a class="source-toggle" href="#"
|
401
|
-
onclick="toggleCode('
|
402
|
-
<div class="method-source-code" id="
|
467
|
+
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
468
|
+
<div class="method-source-code" id="M000008-source">
|
403
469
|
<pre>
|
404
|
-
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line
|
470
|
+
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line 214</span>
|
405
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>)
|
406
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>)
|
407
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>)
|
@@ -424,17 +490,26 @@ This will generate a <a href="SparqlClient.html#M000005">query</a> like:
|
|
424
490
|
<p>
|
425
491
|
Perform a sparql <a href="SparqlClient.html#M000005">query</a>
|
426
492
|
</p>
|
427
|
-
<
|
428
|
-
sparql
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
493
|
+
<table>
|
494
|
+
<tr><td valign="top">sparql:</td><td>a valid SPARQL <a href="SparqlClient.html#M000005">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>
|
433
508
|
<p><a class="source-toggle" href="#"
|
434
509
|
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
435
510
|
<div class="method-source-code" id="M000005-source">
|
436
511
|
<pre>
|
437
|
-
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line
|
512
|
+
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line 153</span>
|
438
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>)
|
439
514
|
|
440
515
|
<span class="ruby-identifier">params</span> = {}
|
@@ -470,11 +545,11 @@ Perform a sparql <a href="SparqlClient.html#M000005">query</a>
|
|
470
545
|
</div>
|
471
546
|
</div>
|
472
547
|
|
473
|
-
<div id="method-
|
474
|
-
<a name="
|
548
|
+
<div id="method-M000011" class="method-detail">
|
549
|
+
<a name="M000011"></a>
|
475
550
|
|
476
551
|
<div class="method-heading">
|
477
|
-
<a href="#
|
552
|
+
<a href="#M000011" class="method-signature">
|
478
553
|
<span class="method-name">select</span><span class="method-args">(query, format=Pho::Sparql::SPARQL_RESULTS_XML)</span>
|
479
554
|
</a>
|
480
555
|
</div>
|
@@ -483,15 +558,19 @@ Perform a sparql <a href="SparqlClient.html#M000005">query</a>
|
|
483
558
|
<p>
|
484
559
|
Perform a SPARQL SELECT <a href="SparqlClient.html#M000005">query</a>.
|
485
560
|
</p>
|
486
|
-
<
|
487
|
-
query
|
488
|
-
|
489
|
-
</
|
561
|
+
<table>
|
562
|
+
<tr><td valign="top"><a href="SparqlClient.html#M000005">query</a>:</td><td>the SPARQL <a href="SparqlClient.html#M000005">query</a>
|
563
|
+
|
564
|
+
</td></tr>
|
565
|
+
<tr><td valign="top">format:</td><td>the preferred response format
|
566
|
+
|
567
|
+
</td></tr>
|
568
|
+
</table>
|
490
569
|
<p><a class="source-toggle" href="#"
|
491
|
-
onclick="toggleCode('
|
492
|
-
<div class="method-source-code" id="
|
570
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
571
|
+
<div class="method-source-code" id="M000011-source">
|
493
572
|
<pre>
|
494
|
-
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line
|
573
|
+
<span class="ruby-comment cmt"># File lib/pho/sparql.rb, line 239</span>
|
495
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>)
|
496
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>)
|
497
576
|
<span class="ruby-keyword kw">end</span>
|