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
data/tests/tc_sparql.rb
CHANGED
@@ -155,6 +155,16 @@ class SparqlTest < Test::Unit::TestCase
|
|
155
155
|
|
156
156
|
end
|
157
157
|
|
158
|
+
def test_store_sparql_client_overrides_describe_uri
|
159
|
+
|
160
|
+
mc = mock()
|
161
|
+
mc.expects(:describe).with("http://www.example.org", "application/rdf+xml")
|
162
|
+
|
163
|
+
sparql_client = Pho::StoreSparqlClient.new(mc, "http://api.talis.com/stores/testing/services/sparql")
|
164
|
+
resp = sparql_client.describe_uri("http://www.example.org")
|
165
|
+
|
166
|
+
end
|
167
|
+
|
158
168
|
def test_ask
|
159
169
|
mc = mock()
|
160
170
|
mc.expects(:get).with("http://api.talis.com/stores/testing/services/sparql", {"query" => "SPARQL"}, {"Accept" => "application/sparql-results+xml"} ).returns(
|
@@ -174,7 +184,7 @@ class SparqlTest < Test::Unit::TestCase
|
|
174
184
|
response = client.select("SPARQL")
|
175
185
|
assert_equal("RESULTS", response.content)
|
176
186
|
end
|
177
|
-
|
187
|
+
|
178
188
|
def test_construct
|
179
189
|
mc = mock()
|
180
190
|
mc.expects(:get).with("http://api.talis.com/stores/testing/services/sparql", {"query" => "SPARQL"}, {"Accept" => "application/rdf+xml"} ).returns(
|
@@ -209,5 +219,65 @@ class SparqlTest < Test::Unit::TestCase
|
|
209
219
|
assert_equal("RESULTS", response.content)
|
210
220
|
|
211
221
|
end
|
212
|
-
|
222
|
+
|
223
|
+
def test_describe_uri
|
224
|
+
mc = mock()
|
225
|
+
mc.expects(:get).with("http://api.talis.com/stores/testing/services/sparql", {"query" => "DESCRIBE <http://www.example.org>"}, {"Accept" => "application/rdf+xml"} ).returns(
|
226
|
+
HTTP::Message.new_response("RESULTS"))
|
227
|
+
|
228
|
+
client = Pho::Sparql::SparqlClient.new("http://api.talis.com/stores/testing/services/sparql", mc)
|
229
|
+
response = client.describe_uri("http://www.example.org")
|
230
|
+
assert_equal("RESULTS", response.content)
|
231
|
+
end
|
232
|
+
|
233
|
+
def test_describe_uri_using_cbd
|
234
|
+
mc = mock()
|
235
|
+
mc.expects(:get).with("http://api.talis.com/stores/testing/services/sparql", {"query" => "DESCRIBE <http://www.example.org>"}, {"Accept" => "application/rdf+xml"} ).returns(
|
236
|
+
HTTP::Message.new_response("RESULTS"))
|
237
|
+
|
238
|
+
client = Pho::Sparql::SparqlClient.new("http://api.talis.com/stores/testing/services/sparql", mc)
|
239
|
+
response = client.describe_uri("http://www.example.org", "application/rdf+xml", :cbd)
|
240
|
+
assert_equal("RESULTS", response.content)
|
241
|
+
end
|
242
|
+
|
243
|
+
def test_describe_uri_using_lcbd
|
244
|
+
mc = mock()
|
245
|
+
mc.expects(:get).with("http://api.talis.com/stores/testing/services/sparql", anything, {"Accept" => "application/rdf+xml"} ).returns(
|
246
|
+
HTTP::Message.new_response("RESULTS"))
|
247
|
+
|
248
|
+
client = Pho::Sparql::SparqlClient.new("http://api.talis.com/stores/testing/services/sparql", mc)
|
249
|
+
response = client.describe_uri("http://www.example.org", "application/rdf+xml", :lcbd)
|
250
|
+
assert_equal("RESULTS", response.content)
|
251
|
+
end
|
252
|
+
|
253
|
+
def test_describe_uri_using_scbd
|
254
|
+
mc = mock()
|
255
|
+
mc.expects(:get).with("http://api.talis.com/stores/testing/services/sparql", anything, {"Accept" => "application/rdf+xml"} ).returns(
|
256
|
+
HTTP::Message.new_response("RESULTS"))
|
257
|
+
|
258
|
+
client = Pho::Sparql::SparqlClient.new("http://api.talis.com/stores/testing/services/sparql", mc)
|
259
|
+
response = client.describe_uri("http://www.example.org", "application/rdf+xml", :scbd)
|
260
|
+
assert_equal("RESULTS", response.content)
|
261
|
+
end
|
262
|
+
|
263
|
+
def test_describe_uri_using_slcbd
|
264
|
+
mc = mock()
|
265
|
+
mc.expects(:get).with("http://api.talis.com/stores/testing/services/sparql", anything, {"Accept" => "application/rdf+xml"} ).returns(
|
266
|
+
HTTP::Message.new_response("RESULTS"))
|
267
|
+
|
268
|
+
client = Pho::Sparql::SparqlClient.new("http://api.talis.com/stores/testing/services/sparql", mc)
|
269
|
+
response = client.describe_uri("http://www.example.org", "application/rdf+xml", :slcbd)
|
270
|
+
assert_equal("RESULTS", response.content)
|
271
|
+
end
|
272
|
+
|
273
|
+
def test_describe_uri_using_unknown
|
274
|
+
mc = mock()
|
275
|
+
|
276
|
+
client = Pho::Sparql::SparqlClient.new("http://api.talis.com/stores/testing/services/sparql", mc)
|
277
|
+
assert_raises RuntimeError do
|
278
|
+
response = client.describe_uri("http://www.example.org", "application/rdf+xml", :unknown)
|
279
|
+
end
|
280
|
+
|
281
|
+
end
|
282
|
+
|
213
283
|
end
|
data/tests/tc_sparql_helper.rb
CHANGED
@@ -210,5 +210,21 @@ class SparqlHelperTest < Test::Unit::TestCase
|
|
210
210
|
assert_equal("<http://nasa.dataincubator.org/spacecraft/12345>", hash["uri"])
|
211
211
|
assert_equal("\"5000.5\"^^http://www.w3.org/2001/XMLSchema#float", hash["mass"])
|
212
212
|
end
|
213
|
+
|
214
|
+
def test_describe_uri
|
215
|
+
mc = mock()
|
216
|
+
mc.expects(:describe_uri).with("http://www.example.org", "application/json", :cbd).returns( HTTP::Message.new_response(RDF_JSON_RESULTS) )
|
217
|
+
result = Pho::Sparql::SparqlHelper.describe_uri("http://www.example.org", mc)
|
218
|
+
assert_not_nil(result)
|
219
|
+
assert_not_nil(result["http://www.example.org"])
|
220
|
+
end
|
221
|
+
|
222
|
+
def test_describe_uri_with_type
|
223
|
+
mc = mock()
|
224
|
+
mc.expects(:describe_uri).with("http://www.example.org", "application/json", :slcbd).returns( HTTP::Message.new_response(RDF_JSON_RESULTS) )
|
225
|
+
result = Pho::Sparql::SparqlHelper.describe_uri("http://www.example.org", mc, :slcbd)
|
226
|
+
assert_not_nil(result)
|
227
|
+
assert_not_nil(result["http://www.example.org"])
|
228
|
+
end
|
213
229
|
|
214
230
|
end
|
data/tests/ts_pho.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pho
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: "0.
|
4
|
+
version: "0.6"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leigh Dodds
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-12 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -74,14 +74,19 @@ files:
|
|
74
74
|
- doc/rdoc/fr_class_index.html
|
75
75
|
- doc/rdoc/classes
|
76
76
|
- doc/rdoc/classes/Pho
|
77
|
+
- doc/rdoc/classes/Pho/RDF.html
|
77
78
|
- doc/rdoc/classes/Pho/Etags.html
|
78
79
|
- doc/rdoc/classes/Pho/FileManagement.html
|
79
80
|
- doc/rdoc/classes/Pho/Jobs.html
|
81
|
+
- doc/rdoc/classes/Pho/RDF
|
82
|
+
- doc/rdoc/classes/Pho/RDF/Parser.html
|
83
|
+
- doc/rdoc/classes/Pho/StoreSparqlClient.html
|
80
84
|
- doc/rdoc/classes/Pho/DatatypeProperty.html
|
81
85
|
- doc/rdoc/classes/Pho/Facet.html
|
82
86
|
- doc/rdoc/classes/Pho/JobUpdate.html
|
83
87
|
- doc/rdoc/classes/Pho/Enrichment.html
|
84
88
|
- doc/rdoc/classes/Pho/RDFCollection.html
|
89
|
+
- doc/rdoc/classes/Pho/CommandLine.html
|
85
90
|
- doc/rdoc/classes/Pho/Job.html
|
86
91
|
- doc/rdoc/classes/Pho/Status.html
|
87
92
|
- doc/rdoc/classes/Pho/QueryProfile.html
|
@@ -98,7 +103,7 @@ files:
|
|
98
103
|
- doc/rdoc/classes/Pho/FileManagement/RDFManager.html
|
99
104
|
- doc/rdoc/classes/Pho/Sparql.html
|
100
105
|
- doc/rdoc/classes/Pho/Enrichment
|
101
|
-
- doc/rdoc/classes/Pho/Enrichment/
|
106
|
+
- doc/rdoc/classes/Pho/Enrichment/StoreEnricher.html
|
102
107
|
- doc/rdoc/classes/Pho/Store.html
|
103
108
|
- doc/rdoc/classes/Pho/Facet
|
104
109
|
- doc/rdoc/classes/Pho/Facet/Results.html
|
@@ -131,6 +136,7 @@ files:
|
|
131
136
|
- doc/rdoc/files/lib/pho/job_rb.html
|
132
137
|
- doc/rdoc/files/lib/pho/sparql_rb.html
|
133
138
|
- doc/rdoc/files/lib/pho/rdf_collection_rb.html
|
139
|
+
- doc/rdoc/files/lib/pho/rdf_rb.html
|
134
140
|
- doc/rdoc/files/lib/pho/query_profile_rb.html
|
135
141
|
- doc/rdoc/files/lib/pho/etags_rb.html
|
136
142
|
- doc/rdoc/files/lib/pho/snapshot_rb.html
|
@@ -140,6 +146,7 @@ files:
|
|
140
146
|
- doc/rdoc/files/lib/pho/facet_rb.html
|
141
147
|
- doc/rdoc/files/lib/pho/converter_rb.html
|
142
148
|
- doc/rdoc/files/lib/pho/status_rb.html
|
149
|
+
- doc/rdoc/files/lib/pho/command_line_rb.html
|
143
150
|
- doc/rdoc/files/CHANGES.html
|
144
151
|
- doc/rdoc/index.html
|
145
152
|
- doc/rdoc/created.rid
|
@@ -152,6 +159,7 @@ files:
|
|
152
159
|
- tests/tc_sparql.rb
|
153
160
|
- tests/tc_changeset_builder.rb
|
154
161
|
- tests/tc_rdf_collection.rb
|
162
|
+
- tests/tc_rdf_parser.rb
|
155
163
|
- tests/ts_pho.rb
|
156
164
|
- tests/tc_resource_hash.rb
|
157
165
|
- tests/tc_sparql_helper.rb
|
@@ -167,16 +175,25 @@ files:
|
|
167
175
|
- tests/tc_field_predicate_map.rb
|
168
176
|
- tests/tc_query_profile.rb
|
169
177
|
- examples/sparql_select.rb
|
178
|
+
- examples/calais
|
179
|
+
- examples/calais/dump.rb
|
180
|
+
- examples/calais/enlighten.rb
|
181
|
+
- examples/calais/bio.txt
|
182
|
+
- examples/calais/output.rdf
|
170
183
|
- examples/status.rb
|
171
184
|
- examples/sparql.rb
|
185
|
+
- examples/sinatra
|
186
|
+
- examples/sinatra/viewer.rb
|
172
187
|
- examples/sparql_construct_hash.rb
|
173
188
|
- examples/contentbox.rb
|
174
189
|
- lib/pho.rb
|
175
190
|
- lib/pho
|
176
191
|
- lib/pho/changeset_builder.rb
|
192
|
+
- lib/pho/rdf.rb
|
177
193
|
- lib/pho/file_manager.rb
|
178
194
|
- lib/pho/etags.rb
|
179
195
|
- lib/pho/enrichment.rb
|
196
|
+
- lib/pho/command_line.rb
|
180
197
|
- lib/pho/status.rb
|
181
198
|
- lib/pho/rdf_collection.rb
|
182
199
|
- lib/pho/converter.rb
|