pho 0.6 → 0.6.1

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.
Files changed (41) hide show
  1. data/CHANGES +6 -0
  2. data/Rakefile +1 -1
  3. data/doc/rdoc/classes/Pho/CommandLine.html +67 -67
  4. data/doc/rdoc/classes/Pho/DatatypeProperty.html +12 -12
  5. data/doc/rdoc/classes/Pho/Enrichment/StoreEnricher.html +29 -29
  6. data/doc/rdoc/classes/Pho/Etags.html +36 -36
  7. data/doc/rdoc/classes/Pho/Facet/Results.html +19 -19
  8. data/doc/rdoc/classes/Pho/Facet/Term.html +6 -6
  9. data/doc/rdoc/classes/Pho/FieldPredicateMap.html +90 -90
  10. data/doc/rdoc/classes/Pho/FieldWeighting.html +12 -12
  11. data/doc/rdoc/classes/Pho/FileManagement/AbstractFileManager.html +63 -63
  12. data/doc/rdoc/classes/Pho/FileManagement/FileManager.html +24 -24
  13. data/doc/rdoc/classes/Pho/FileManagement/RDFManager.html +18 -18
  14. data/doc/rdoc/classes/Pho/Job.html +64 -64
  15. data/doc/rdoc/classes/Pho/Jobs.html +60 -60
  16. data/doc/rdoc/classes/Pho/QueryProfile.html +60 -60
  17. data/doc/rdoc/classes/Pho/RDF/Parser.html +24 -24
  18. data/doc/rdoc/classes/Pho/ResourceHash/Converter.html +36 -36
  19. data/doc/rdoc/classes/Pho/ResourceHash/SetAlgebra.html +12 -12
  20. data/doc/rdoc/classes/Pho/Snapshot.html +35 -35
  21. data/doc/rdoc/classes/Pho/Sparql/SparqlHelper.html +78 -42
  22. data/doc/rdoc/classes/Pho/Status.html +26 -26
  23. data/doc/rdoc/classes/Pho/Store.html +209 -209
  24. data/doc/rdoc/classes/Pho/StoreSparqlClient.html +12 -12
  25. data/doc/rdoc/classes/Pho/Update/Changeset.html +63 -63
  26. data/doc/rdoc/classes/Pho/Update/ChangesetBuilder.html +24 -24
  27. data/doc/rdoc/classes/Pho/Update/ChangesetHelper.html +159 -0
  28. data/doc/rdoc/classes/Pho/Update/Changesets.html +12 -12
  29. data/doc/rdoc/classes/Pho/Update/LiteralStatement.html +18 -18
  30. data/doc/rdoc/classes/Pho/Update/ResourceStatement.html +24 -24
  31. data/doc/rdoc/classes/Pho/Update/Statement.html +24 -24
  32. data/doc/rdoc/created.rid +1 -1
  33. data/doc/rdoc/files/CHANGES.html +13 -1
  34. data/doc/rdoc/files/lib/pho/command_line_rb.html +1 -1
  35. data/doc/rdoc/files/lib/pho/sparql_rb.html +1 -1
  36. data/doc/rdoc/fr_method_index.html +183 -182
  37. data/examples/linkeddata/proxy.rb +74 -0
  38. data/lib/pho/command_line.rb +1 -1
  39. data/lib/pho/sparql.rb +9 -0
  40. data/tests/tc_sparql_helper.rb +10 -1
  41. metadata +5 -2
@@ -104,7 +104,7 @@ module Pho
104
104
  elsif @opts["file"]
105
105
  puts "Storing local file: #{@opts["file"]}"
106
106
  f = File.new( @opts["file"] )
107
- if File.extname(f) == ".nt"
107
+ if File.extname( @opts["file"] ) == ".nt"
108
108
  Pho::RDF::Parser.store_ntriples(f, @store)
109
109
  else
110
110
  resp = @store.store_file( f )
@@ -342,6 +342,15 @@ module Pho
342
342
  return json["boolean"] == "true"
343
343
  end
344
344
 
345
+ #Performs an ASK query on the SPARQL endpoint to test whether there are any statements
346
+ #in the triple store about the specified uri.
347
+ #
348
+ #uri:: the uri to test for
349
+ #sparql_client:: a configured SparqlClient object
350
+ def SparqlHelper.exists(uri, sparql_client)
351
+ return SparqlHelper.ask("ASK { <#{uri}> ?p ?o }", sparql_client)
352
+ end
353
+
345
354
  #Perform a simple SELECT query on an endpoint and return a simple array of values
346
355
  #
347
356
  #Will request the results using the SPARQL JSON results format, and parse the
@@ -226,5 +226,14 @@ class SparqlHelperTest < Test::Unit::TestCase
226
226
  assert_not_nil(result)
227
227
  assert_not_nil(result["http://www.example.org"])
228
228
  end
229
-
229
+
230
+ def test_exists
231
+ mc = mock()
232
+ mc.expects(:select).with("ASK { <http://www.example.org> ?p ?o }", Pho::Sparql::SPARQL_RESULTS_JSON).returns(
233
+ HTTP::Message.new_response(ASK_RESULTS) )
234
+ result = Pho::Sparql::SparqlHelper.exists("http://www.example.org", mc)
235
+ assert_equal( true, result )
236
+
237
+ end
238
+
230
239
  end
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.6"
4
+ version: 0.6.1
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-08-12 00:00:00 +01:00
12
+ date: 2009-08-27 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -121,6 +121,7 @@ files:
121
121
  - doc/rdoc/classes/Pho/Update/Statement.html
122
122
  - doc/rdoc/classes/Pho/Update/LiteralStatement.html
123
123
  - doc/rdoc/classes/Pho/Update/ResourceStatement.html
124
+ - doc/rdoc/classes/Pho/Update/ChangesetHelper.html
124
125
  - doc/rdoc/classes/String.html
125
126
  - doc/rdoc/classes/Pho.html
126
127
  - doc/rdoc/files
@@ -174,6 +175,8 @@ files:
174
175
  - tests/tc_etags.rb
175
176
  - tests/tc_field_predicate_map.rb
176
177
  - tests/tc_query_profile.rb
178
+ - examples/linkeddata
179
+ - examples/linkeddata/proxy.rb
177
180
  - examples/sparql_select.rb
178
181
  - examples/calais
179
182
  - examples/calais/dump.rb