pho 0.7.7 → 0.7.8
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +21 -0
- data/README +1 -2
- data/Rakefile +1 -1
- data/bin/talis_store +13 -22
- data/doc/rdoc/classes/Pho/CommandLine.html +162 -124
- data/doc/rdoc/classes/Pho/DatatypeProperty.html +12 -12
- data/doc/rdoc/classes/Pho/Enrichment/StoreEnricher.html +29 -29
- 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 +102 -102
- data/doc/rdoc/classes/Pho/FieldWeighting.html +12 -12
- data/doc/rdoc/classes/Pho/FileManagement/AbstractFileManager.html +262 -103
- data/doc/rdoc/classes/Pho/FileManagement/FileManager.html +34 -14
- data/doc/rdoc/classes/Pho/FileManagement/RDFManager.html +10 -5
- data/doc/rdoc/classes/Pho/Job.html +64 -64
- data/doc/rdoc/classes/Pho/Jobs.html +60 -60
- data/doc/rdoc/classes/Pho/OAI/Record.html +6 -6
- data/doc/rdoc/classes/Pho/OAI/Records.html +24 -24
- data/doc/rdoc/classes/Pho/OAI/Statistics.html +12 -12
- data/doc/rdoc/classes/Pho/QueryProfile.html +66 -66
- data/doc/rdoc/classes/Pho/ResourceHash/Converter.html +36 -36
- data/doc/rdoc/classes/Pho/ResourceHash/SetAlgebra.html +12 -12
- data/doc/rdoc/classes/Pho/Snapshot.html +35 -35
- data/doc/rdoc/classes/Pho/Sparql/SparqlClient.html +74 -74
- data/doc/rdoc/classes/Pho/Sparql/SparqlHelper.html +78 -78
- data/doc/rdoc/classes/Pho/Status.html +26 -26
- data/doc/rdoc/classes/Pho/Store.html +215 -215
- data/doc/rdoc/classes/Pho/StoreSparqlClient.html +12 -12
- data/doc/rdoc/classes/Pho/Update/Changeset.html +63 -63
- data/doc/rdoc/classes/Pho/Update/ChangesetBuilder.html +24 -24
- data/doc/rdoc/classes/Pho/Update/ChangesetHelper.html +6 -6
- data/doc/rdoc/classes/Pho/Update/Changesets.html +12 -12
- 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 +24 -24
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/CHANGES.html +34 -1
- data/doc/rdoc/files/README.html +3 -4
- data/doc/rdoc/files/lib/pho/command_line_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/fr_method_index.html +212 -205
- data/lib/pho/command_line.rb +29 -11
- data/lib/pho/file_management.rb +85 -29
- data/lib/pho/file_manager.rb +10 -11
- data/lib/pho/rdf_collection.rb +8 -3
- data/tests/tc_file_manager.rb +144 -26
- data/tests/tc_rdf_collection.rb +76 -68
- metadata +4 -4
data/tests/tc_rdf_collection.rb
CHANGED
@@ -6,126 +6,126 @@ require 'mocha'
|
|
6
6
|
#TODO factor out tests for AbstractFileManager
|
7
7
|
class RDFCollectionTest < Test::Unit::TestCase
|
8
8
|
|
9
|
-
def setup()
|
9
|
+
def setup()
|
10
|
+
Dir.mkdir("/tmp/rdf") unless File.exists?("/tmp/rdf")
|
10
11
|
10.times do |i|
|
11
|
-
file = File.new( File.join("/tmp", "#{i}.rdf"), "w" )
|
12
|
+
file = File.new( File.join("/tmp/rdf", "#{i}.rdf"), "w" )
|
12
13
|
file.write("RDF#{i}")
|
13
14
|
file.close()
|
14
15
|
end
|
16
|
+
Dir.mkdir("/tmp/rdf/.pho") unless File.exists?("/tmp/rdf/.pho")
|
15
17
|
4.times do |i|
|
16
|
-
file = File.new( File.join("/tmp", "#{i}.ok"), "w" )
|
18
|
+
file = File.new( File.join("/tmp/rdf/.pho", "#{i}.rdf.ok"), "w" )
|
17
19
|
file.write("OK")
|
18
20
|
file.close()
|
19
21
|
end
|
20
22
|
3.times do |i|
|
21
23
|
num = 4 + i
|
22
|
-
file = File.new( File.join("/tmp", "#{num}.fail"), "w" )
|
24
|
+
file = File.new( File.join("/tmp/rdf/.pho", "#{num}.rdf.fail"), "w" )
|
23
25
|
file.write("FAIL")
|
24
26
|
file.close()
|
25
27
|
end
|
26
28
|
3.times do |i|
|
27
29
|
num = 10 + i
|
28
|
-
file = File.new( File.join("/tmp", "#{num}.ttl"), "w" )
|
30
|
+
file = File.new( File.join("/tmp/rdf", "#{num}.ttl"), "w" )
|
29
31
|
file.write("TTL#{num}")
|
30
32
|
file.close()
|
31
33
|
end
|
32
34
|
end
|
33
35
|
|
34
36
|
def teardown()
|
35
|
-
Dir.glob("/tmp/*.rdf") do |file|
|
37
|
+
Dir.glob("/tmp/rdf/*.rdf") do |file|
|
36
38
|
File.delete(file)
|
37
39
|
end
|
38
|
-
Dir.glob("/tmp
|
40
|
+
Dir.glob("/tmp/rdf/.pho/*.*") do |file|
|
39
41
|
File.delete(file)
|
40
42
|
end
|
41
|
-
Dir.glob("/tmp/*.
|
43
|
+
Dir.glob("/tmp/rdf/*.ttl") do |file|
|
42
44
|
File.delete(file)
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
|
-
|
45
|
+
end
|
46
|
+
delete("/tmp/rdf/.pho")
|
47
|
+
delete("/tmp/rdf")
|
48
|
+
|
47
49
|
end
|
48
50
|
|
49
|
-
def
|
50
|
-
|
51
|
-
collection = Pho::FileManagement::RDFManager.new(store, "/tmp", ["rdf"])
|
52
|
-
|
53
|
-
assert_equal("foo.fail", collection.get_fail_file_for("foo.rdf") )
|
51
|
+
def delete(dir)
|
52
|
+
Dir.delete(dir) if File.exists?(dir)
|
54
53
|
end
|
55
|
-
|
56
|
-
def
|
54
|
+
|
55
|
+
def test_get_fail_file_for()
|
57
56
|
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass")
|
58
57
|
collection = Pho::FileManagement::RDFManager.new(store, "/tmp/rdf", ["rdf"])
|
59
58
|
|
60
|
-
assert_equal("/tmp/rdf/foo.fail", collection.get_fail_file_for("/tmp/rdf/foo.rdf") )
|
59
|
+
assert_equal("/tmp/rdf/.pho/foo.rdf.fail", collection.get_fail_file_for("/tmp/rdf/foo.rdf") )
|
61
60
|
end
|
62
|
-
|
61
|
+
|
63
62
|
def test_get_ok_file_for()
|
64
63
|
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass")
|
65
|
-
collection = Pho::FileManagement::RDFManager.new(store, "/tmp", ["rdf"])
|
64
|
+
collection = Pho::FileManagement::RDFManager.new(store, "/tmp/rdf", ["rdf"])
|
66
65
|
|
67
|
-
assert_equal("foo.ok", collection.get_ok_file_for("foo.rdf") )
|
66
|
+
assert_equal("/tmp/rdf/.pho/foo.rdf.ok", collection.get_ok_file_for("/tmp/rdf/foo.rdf") )
|
68
67
|
end
|
69
68
|
|
70
|
-
def
|
71
|
-
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass")
|
72
|
-
collection = Pho::FileManagement::RDFManager.new(store, "/tmp/
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
69
|
+
def test_stored()
|
70
|
+
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass")
|
71
|
+
collection = Pho::FileManagement::RDFManager.new(store, "/tmp/rdf", ["rdf"])
|
72
|
+
7.times do |i|
|
73
|
+
assert_equal( true, collection.stored?("/tmp/rdf/#{i}.rdf"), "#{i}.rdf should be stored" )
|
74
|
+
end
|
75
|
+
end
|
77
76
|
|
77
|
+
|
78
78
|
def test_successes()
|
79
79
|
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass")
|
80
|
-
collection = Pho::FileManagement::RDFManager.new(store, "/tmp", ["rdf"])
|
80
|
+
collection = Pho::FileManagement::RDFManager.new(store, "/tmp/rdf", ["rdf"])
|
81
81
|
|
82
82
|
success = collection.successes()
|
83
83
|
success.sort!
|
84
84
|
|
85
85
|
assert_equal(4, success.size)
|
86
|
-
assert_equal("/tmp/0.rdf", success[0])
|
87
|
-
assert_equal("/tmp/1.rdf", success[1])
|
88
|
-
assert_equal("/tmp/2.rdf", success[2])
|
89
|
-
assert_equal("/tmp/3.rdf", success[3])
|
86
|
+
assert_equal("/tmp/rdf/0.rdf", success[0])
|
87
|
+
assert_equal("/tmp/rdf/1.rdf", success[1])
|
88
|
+
assert_equal("/tmp/rdf/2.rdf", success[2])
|
89
|
+
assert_equal("/tmp/rdf/3.rdf", success[3])
|
90
90
|
end
|
91
91
|
|
92
92
|
def test_failures()
|
93
93
|
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass")
|
94
|
-
collection = Pho::FileManagement::RDFManager.new(store, "/tmp", ["rdf"])
|
94
|
+
collection = Pho::FileManagement::RDFManager.new(store, "/tmp/rdf", ["rdf"])
|
95
95
|
|
96
96
|
fails = collection.failures()
|
97
97
|
fails.sort!
|
98
98
|
assert_equal(3, fails.size)
|
99
|
-
assert_equal("/tmp/4.rdf", fails[0])
|
100
|
-
assert_equal("/tmp/5.rdf", fails[1])
|
101
|
-
assert_equal("/tmp/6.rdf", fails[2])
|
99
|
+
assert_equal("/tmp/rdf/4.rdf", fails[0])
|
100
|
+
assert_equal("/tmp/rdf/5.rdf", fails[1])
|
101
|
+
assert_equal("/tmp/rdf/6.rdf", fails[2])
|
102
102
|
end
|
103
103
|
|
104
104
|
def test_new_files()
|
105
105
|
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass")
|
106
|
-
collection = Pho::FileManagement::RDFManager.new(store, "/tmp", ["rdf"])
|
106
|
+
collection = Pho::FileManagement::RDFManager.new(store, "/tmp/rdf", ["rdf"])
|
107
107
|
|
108
108
|
newfiles = collection.new_files()
|
109
109
|
newfiles.sort!
|
110
110
|
assert_equal(3, newfiles.size)
|
111
|
-
assert_equal("/tmp/7.rdf", newfiles[0])
|
112
|
-
assert_equal("/tmp/8.rdf", newfiles[1])
|
113
|
-
assert_equal("/tmp/9.rdf", newfiles[2])
|
111
|
+
assert_equal("/tmp/rdf/7.rdf", newfiles[0])
|
112
|
+
assert_equal("/tmp/rdf/8.rdf", newfiles[1])
|
113
|
+
assert_equal("/tmp/rdf/9.rdf", newfiles[2])
|
114
114
|
end
|
115
115
|
|
116
116
|
def test_new_files_all_serializations()
|
117
117
|
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass")
|
118
|
-
collection = Pho::FileManagement::RDFManager.new(store, "/tmp")
|
118
|
+
collection = Pho::FileManagement::RDFManager.new(store, "/tmp/rdf")
|
119
119
|
|
120
120
|
newfiles = collection.new_files()
|
121
121
|
newfiles.sort!
|
122
122
|
assert_equal(6, newfiles.size)
|
123
|
-
assert_equal("/tmp/10.ttl", newfiles[0])
|
124
|
-
assert_equal("/tmp/11.ttl", newfiles[1])
|
125
|
-
assert_equal("/tmp/12.ttl", newfiles[2])
|
126
|
-
assert_equal("/tmp/7.rdf", newfiles[3])
|
127
|
-
assert_equal("/tmp/8.rdf", newfiles[4])
|
128
|
-
assert_equal("/tmp/9.rdf", newfiles[5])
|
123
|
+
assert_equal("/tmp/rdf/10.ttl", newfiles[0])
|
124
|
+
assert_equal("/tmp/rdf/11.ttl", newfiles[1])
|
125
|
+
assert_equal("/tmp/rdf/12.ttl", newfiles[2])
|
126
|
+
assert_equal("/tmp/rdf/7.rdf", newfiles[3])
|
127
|
+
assert_equal("/tmp/rdf/8.rdf", newfiles[4])
|
128
|
+
assert_equal("/tmp/rdf/9.rdf", newfiles[5])
|
129
129
|
end
|
130
130
|
|
131
131
|
def test_store()
|
@@ -136,12 +136,12 @@ class RDFCollectionTest < Test::Unit::TestCase
|
|
136
136
|
mc.expects(:post).with("http://api.talis.com/stores/testing/meta", "RDF9", {"Content-Type" => "application/rdf+xml"}).returns( HTTP::Message.new_response("OK"))
|
137
137
|
|
138
138
|
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
|
139
|
-
collection = Pho::FileManagement::RDFManager.new(store, "/tmp", ["rdf"])
|
139
|
+
collection = Pho::FileManagement::RDFManager.new(store, "/tmp/rdf", ["rdf"])
|
140
140
|
collection.store()
|
141
141
|
|
142
|
-
assert_equal(true, File.exists?("/tmp/7.ok") )
|
143
|
-
assert_equal(true, File.exists?("/tmp/8.ok") )
|
144
|
-
assert_equal(true, File.exists?("/tmp/9.ok") )
|
142
|
+
assert_equal(true, File.exists?("/tmp/rdf/.pho/7.rdf.ok") )
|
143
|
+
assert_equal(true, File.exists?("/tmp/rdf/.pho/8.rdf.ok") )
|
144
|
+
assert_equal(true, File.exists?("/tmp/rdf/.pho/9.rdf.ok") )
|
145
145
|
|
146
146
|
end
|
147
147
|
|
@@ -154,12 +154,12 @@ class RDFCollectionTest < Test::Unit::TestCase
|
|
154
154
|
mc.expects(:post).with("http://api.talis.com/stores/testing/meta", "TTL12", {"Content-Type" => "text/turtle"}).returns( HTTP::Message.new_response("OK") )
|
155
155
|
|
156
156
|
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
|
157
|
-
collection = Pho::FileManagement::RDFManager.new(store, "/tmp", ["ttl"])
|
157
|
+
collection = Pho::FileManagement::RDFManager.new(store, "/tmp/rdf", ["ttl"])
|
158
158
|
collection.store()
|
159
159
|
|
160
|
-
assert_equal(true, File.exists?("/tmp/10.ok") )
|
161
|
-
assert_equal(true, File.exists?("/tmp/11.ok") )
|
162
|
-
assert_equal(true, File.exists?("/tmp/12.ok") )
|
160
|
+
assert_equal(true, File.exists?("/tmp/rdf/.pho/10.ttl.ok") )
|
161
|
+
assert_equal(true, File.exists?("/tmp/rdf/.pho/11.ttl.ok") )
|
162
|
+
assert_equal(true, File.exists?("/tmp/rdf/.pho/12.ttl.ok") )
|
163
163
|
end
|
164
164
|
|
165
165
|
def test_store_all_serializations()
|
@@ -174,21 +174,21 @@ class RDFCollectionTest < Test::Unit::TestCase
|
|
174
174
|
mc.expects(:post).with("http://api.talis.com/stores/testing/meta", "RDF9", {"Content-Type" => "application/rdf+xml"}).returns( HTTP::Message.new_response("OK"))
|
175
175
|
|
176
176
|
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
|
177
|
-
collection = Pho::FileManagement::RDFManager.new(store, "/tmp")
|
177
|
+
collection = Pho::FileManagement::RDFManager.new(store, "/tmp/rdf")
|
178
178
|
collection.store()
|
179
179
|
|
180
|
-
assert_equal(true, File.exists?("/tmp/10.ok") )
|
181
|
-
assert_equal(true, File.exists?("/tmp/11.ok") )
|
182
|
-
assert_equal(true, File.exists?("/tmp/12.ok") )
|
183
|
-
assert_equal(true, File.exists?("/tmp/7.ok") )
|
184
|
-
assert_equal(true, File.exists?("/tmp/8.ok") )
|
185
|
-
assert_equal(true, File.exists?("/tmp/9.ok") )
|
180
|
+
assert_equal(true, File.exists?("/tmp/rdf/.pho/10.ttl.ok") )
|
181
|
+
assert_equal(true, File.exists?("/tmp/rdf/.pho/11.ttl.ok") )
|
182
|
+
assert_equal(true, File.exists?("/tmp/rdf/.pho/12.ttl.ok") )
|
183
|
+
assert_equal(true, File.exists?("/tmp/rdf/.pho/7.rdf.ok") )
|
184
|
+
assert_equal(true, File.exists?("/tmp/rdf/.pho/8.rdf.ok") )
|
185
|
+
assert_equal(true, File.exists?("/tmp/rdf/.pho/9.rdf.ok") )
|
186
186
|
|
187
187
|
end
|
188
188
|
|
189
189
|
def test_reset()
|
190
190
|
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass")
|
191
|
-
collection = Pho::FileManagement::RDFManager.new(store, "/tmp", ["rdf"])
|
191
|
+
collection = Pho::FileManagement::RDFManager.new(store, "/tmp/rdf", ["rdf"])
|
192
192
|
|
193
193
|
collection.reset()
|
194
194
|
newfiles = collection.new_files()
|
@@ -197,15 +197,23 @@ class RDFCollectionTest < Test::Unit::TestCase
|
|
197
197
|
|
198
198
|
def test_list()
|
199
199
|
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass")
|
200
|
-
collection = Pho::FileManagement::RDFManager.new(store, "/tmp", ["rdf"])
|
200
|
+
collection = Pho::FileManagement::RDFManager.new(store, "/tmp/rdf", ["rdf"])
|
201
201
|
|
202
202
|
files = collection.list()
|
203
203
|
assert_equal(10, files.size)
|
204
204
|
end
|
205
205
|
|
206
|
+
def test_list_recursive()
|
207
|
+
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass")
|
208
|
+
collection = Pho::FileManagement::RDFManager.new(store, "/tmp/rdf", ["rdf"])
|
209
|
+
|
210
|
+
files = collection.list(:recurse)
|
211
|
+
assert_equal(10, files.size)
|
212
|
+
end
|
213
|
+
|
206
214
|
def test_summary()
|
207
215
|
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass")
|
208
|
-
collection = Pho::FileManagement::RDFManager.new(store, "/tmp", ["rdf"])
|
216
|
+
collection = Pho::FileManagement::RDFManager.new(store, "/tmp/rdf", ["rdf"])
|
209
217
|
end
|
210
218
|
|
211
219
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pho
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 7
|
9
|
-
-
|
10
|
-
version: 0.7.
|
9
|
+
- 8
|
10
|
+
version: 0.7.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Leigh Dodds
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-20 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|