bio-publisci 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/Gemfile +1 -1
  2. data/Rakefile +1 -1
  3. data/features/orm_steps.rb +4 -4
  4. data/features/reader.feature +3 -3
  5. data/features/reader_steps.rb +1 -0
  6. data/features/writer.feature +7 -2
  7. data/features/writer_steps.rb +8 -1
  8. data/lib/bio-publisci.rb +3 -1
  9. data/lib/bio-publisci/datacube_model.rb +46 -20
  10. data/lib/bio-publisci/dataset/ORM/data_cube_orm.rb +196 -194
  11. data/lib/bio-publisci/dataset/ORM/observation.rb +15 -13
  12. data/lib/bio-publisci/dataset/data_cube.rb +3 -3
  13. data/lib/bio-publisci/dataset/dataset_for.rb +25 -4
  14. data/lib/bio-publisci/dsl/dataset_dsl.rb +4 -2
  15. data/lib/bio-publisci/dsl/dsl.rb +3 -0
  16. data/lib/bio-publisci/metadata/generator.rb +1 -1
  17. data/lib/bio-publisci/metadata/metadata_model.rb +27 -0
  18. data/lib/bio-publisci/metadata/prov/activity.rb +1 -0
  19. data/lib/bio-publisci/metadata/prov/model/prov_models.rb +33 -2
  20. data/lib/bio-publisci/query/query_helper.rb +5 -1
  21. data/lib/bio-publisci/readers/arff.rb +2 -40
  22. data/lib/bio-publisci/readers/dataframe.rb +1 -1
  23. data/lib/bio-publisci/writers/arff.rb +42 -16
  24. data/lib/bio-publisci/writers/base.rb +77 -0
  25. data/lib/bio-publisci/writers/csv.rb +31 -0
  26. data/lib/bio-publisci/writers/dataframe.rb +2 -2
  27. data/resources/queries/codes.rq +10 -5
  28. data/resources/queries/dimensions.rq +9 -4
  29. data/resources/queries/measures.rq +7 -2
  30. data/resources/queries/observations.rq +5 -4
  31. data/resources/weather.numeric.arff +26 -21
  32. data/spec/ORM/data_cube_orm_spec.rb +23 -3
  33. data/spec/ORM/prov_model_spec.rb +53 -0
  34. data/spec/dataset_for_spec.rb +21 -0
  35. data/spec/dsl_spec.rb +5 -2
  36. data/spec/metadata/metadata_dsl_spec.rb +1 -1
  37. data/spec/r_builder_spec.rb +2 -2
  38. data/spec/turtle/bacon +1 -1
  39. data/spec/turtle/reference +1 -1
  40. data/spec/turtle/weather +275 -0
  41. data/spec/writer_spec.rb +61 -0
  42. metadata +66 -28
  43. checksums.yaml +0 -7
@@ -0,0 +1,61 @@
1
+ require_relative '../lib/bio-publisci.rb'
2
+
3
+ describe PubliSci::Writers do
4
+ before(:each) do
5
+
6
+ end
7
+
8
+ it "should create reference CSV from turtle" do
9
+ writer = PubliSci::Writers::CSV.new
10
+ out = writer.from_turtle('spec/turtle/bacon')
11
+
12
+ out.should == IO.read('spec/csv/bacon.csv')
13
+ end
14
+
15
+ it "can use store as an input" do
16
+ writer = PubliSci::Writers::CSV.new
17
+ repo = RDF::Repository.load('spec/turtle/bacon')
18
+ out = writer.from_store(repo)
19
+
20
+ out.should == IO.read('spec/csv/bacon.csv')
21
+ end
22
+
23
+ it "can output Wekka ARFF from turtle string" do
24
+ writer = PubliSci::Writers::ARFF.new
25
+ out = writer.from_turtle('spec/turtle/weather')
26
+ out.should == IO.read('resources/weather.numeric.arff')
27
+ end
28
+
29
+ it "can output Wekka ARFF from a store" do
30
+ writer = PubliSci::Writers::ARFF.new
31
+ repo = RDF::Repository.load('spec/turtle/weather')
32
+ out = writer.from_store(repo)
33
+
34
+ # minor hack since metadata isn't the same
35
+ out = out.gsub(/%.*\n/,'')
36
+
37
+ out.should == IO.read('resources/weather.numeric.arff').gsub(/%.*\n/,'')
38
+ end
39
+
40
+ context "can restrict to a particular dataset" do
41
+ it "for arff" do
42
+ writer = PubliSci::Writers::ARFF.new
43
+ repo = RDF::Repository.load('spec/turtle/weather')
44
+ repo.load('spec/turtle/bacon')
45
+ out = writer.from_store(repo, 'http://www.rqtl.org/ns/dataset/weather/dataset-weather','weather')
46
+
47
+ out = out.gsub(/%.*\n/,'')
48
+
49
+ out.should == IO.read('resources/weather.numeric.arff').gsub(/%.*\n/,'')
50
+ end
51
+
52
+ it "for csv" do
53
+ writer = PubliSci::Writers::CSV.new
54
+ repo = RDF::Repository.load('spec/turtle/reference')
55
+ repo.load('spec/turtle/bacon')
56
+ out = writer.from_store(repo,'http://www.rqtl.org/ns/dataset/bacon/dataset-bacon')
57
+
58
+ out.should == IO.read('spec/csv/bacon.csv')
59
+ end
60
+ end
61
+ end
metadata CHANGED
@@ -1,88 +1,100 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bio-publisci
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Will Strinz
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-08-09 00:00:00.000000000 Z
12
+ date: 2013-08-21 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: rdf
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - '>='
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: '0'
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - '>='
27
+ - - ! '>='
25
28
  - !ruby/object:Gem::Version
26
29
  version: '0'
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: rdf-4store
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - '>='
35
+ - - ! '>='
32
36
  - !ruby/object:Gem::Version
33
37
  version: '0'
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - '>='
43
+ - - ! '>='
39
44
  - !ruby/object:Gem::Version
40
45
  version: '0'
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: rdf-turtle
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - '>='
51
+ - - ! '>='
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - '>='
59
+ - - ! '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: rserve-client
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
- - - '>='
67
+ - - ! '>='
60
68
  - !ruby/object:Gem::Version
61
69
  version: '0'
62
70
  type: :runtime
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
- - - '>='
75
+ - - ! '>='
67
76
  - !ruby/object:Gem::Version
68
77
  version: '0'
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: sparql
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
- - - '>='
83
+ - - ! '>='
74
84
  - !ruby/object:Gem::Version
75
85
  version: '0'
76
86
  type: :runtime
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
- - - '>='
91
+ - - ! '>='
81
92
  - !ruby/object:Gem::Version
82
93
  version: '0'
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: rspec
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
99
  - - ~>
88
100
  - !ruby/object:Gem::Version
@@ -90,6 +102,7 @@ dependencies:
90
102
  type: :development
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
107
  - - ~>
95
108
  - !ruby/object:Gem::Version
@@ -97,6 +110,7 @@ dependencies:
97
110
  - !ruby/object:Gem::Dependency
98
111
  name: rdoc
99
112
  requirement: !ruby/object:Gem::Requirement
113
+ none: false
100
114
  requirements:
101
115
  - - ~>
102
116
  - !ruby/object:Gem::Version
@@ -104,6 +118,7 @@ dependencies:
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
107
122
  requirements:
108
123
  - - ~>
109
124
  - !ruby/object:Gem::Version
@@ -111,20 +126,23 @@ dependencies:
111
126
  - !ruby/object:Gem::Dependency
112
127
  name: cucumber
113
128
  requirement: !ruby/object:Gem::Requirement
129
+ none: false
114
130
  requirements:
115
- - - '>='
131
+ - - ! '>='
116
132
  - !ruby/object:Gem::Version
117
133
  version: '0'
118
134
  type: :development
119
135
  prerelease: false
120
136
  version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
121
138
  requirements:
122
- - - '>='
139
+ - - ! '>='
123
140
  - !ruby/object:Gem::Version
124
141
  version: '0'
125
142
  - !ruby/object:Gem::Dependency
126
143
  name: jeweler
127
144
  requirement: !ruby/object:Gem::Requirement
145
+ none: false
128
146
  requirements:
129
147
  - - ~>
130
148
  - !ruby/object:Gem::Version
@@ -132,6 +150,7 @@ dependencies:
132
150
  type: :development
133
151
  prerelease: false
134
152
  version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
135
154
  requirements:
136
155
  - - ~>
137
156
  - !ruby/object:Gem::Version
@@ -139,34 +158,39 @@ dependencies:
139
158
  - !ruby/object:Gem::Dependency
140
159
  name: bundler
141
160
  requirement: !ruby/object:Gem::Requirement
161
+ none: false
142
162
  requirements:
143
- - - '>='
163
+ - - ! '>='
144
164
  - !ruby/object:Gem::Version
145
165
  version: 1.0.21
146
166
  type: :development
147
167
  prerelease: false
148
168
  version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
149
170
  requirements:
150
- - - '>='
171
+ - - ! '>='
151
172
  - !ruby/object:Gem::Version
152
173
  version: 1.0.21
153
174
  - !ruby/object:Gem::Dependency
154
175
  name: bio
155
176
  requirement: !ruby/object:Gem::Requirement
177
+ none: false
156
178
  requirements:
157
- - - '>='
179
+ - - ! '>='
158
180
  - !ruby/object:Gem::Version
159
181
  version: 1.4.2
160
182
  type: :development
161
183
  prerelease: false
162
184
  version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
163
186
  requirements:
164
- - - '>='
187
+ - - ! '>='
165
188
  - !ruby/object:Gem::Version
166
189
  version: 1.4.2
167
190
  - !ruby/object:Gem::Dependency
168
191
  name: rdoc
169
192
  requirement: !ruby/object:Gem::Requirement
193
+ none: false
170
194
  requirements:
171
195
  - - ~>
172
196
  - !ruby/object:Gem::Version
@@ -174,6 +198,7 @@ dependencies:
174
198
  type: :development
175
199
  prerelease: false
176
200
  version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
177
202
  requirements:
178
203
  - - ~>
179
204
  - !ruby/object:Gem::Version
@@ -181,32 +206,36 @@ dependencies:
181
206
  - !ruby/object:Gem::Dependency
182
207
  name: spoon
183
208
  requirement: !ruby/object:Gem::Requirement
209
+ none: false
184
210
  requirements:
185
- - - '>='
211
+ - - ! '>='
186
212
  - !ruby/object:Gem::Version
187
213
  version: '0'
188
214
  type: :development
189
215
  prerelease: false
190
216
  version_requirements: !ruby/object:Gem::Requirement
217
+ none: false
191
218
  requirements:
192
- - - '>='
219
+ - - ! '>='
193
220
  - !ruby/object:Gem::Version
194
221
  version: '0'
195
222
  - !ruby/object:Gem::Dependency
196
223
  name: spira
197
224
  requirement: !ruby/object:Gem::Requirement
225
+ none: false
198
226
  requirements:
199
- - - '>='
227
+ - - ! '>='
200
228
  - !ruby/object:Gem::Version
201
229
  version: '0'
202
230
  type: :development
203
231
  prerelease: false
204
232
  version_requirements: !ruby/object:Gem::Requirement
233
+ none: false
205
234
  requirements:
206
- - - '>='
235
+ - - ! '>='
207
236
  - !ruby/object:Gem::Version
208
237
  version: '0'
209
- description: 'A toolkit for publishing scientific results and datasets using RDF,
238
+ description: ! 'A toolkit for publishing scientific results and datasets using RDF,
210
239
  OWL, and related technologies '
211
240
  email: wstrinz@gmail.com
212
241
  executables:
@@ -271,6 +300,7 @@ files:
271
300
  - lib/bio-publisci/dsl/prov_dsl.rb
272
301
  - lib/bio-publisci/metadata/generator.rb
273
302
  - lib/bio-publisci/metadata/metadata.rb
303
+ - lib/bio-publisci/metadata/metadata_model.rb
274
304
  - lib/bio-publisci/metadata/prov/activity.rb
275
305
  - lib/bio-publisci/metadata/prov/agent.rb
276
306
  - lib/bio-publisci/metadata/prov/association.rb
@@ -299,6 +329,8 @@ files:
299
329
  - lib/bio-publisci/readers/r_matrix.rb
300
330
  - lib/bio-publisci/store.rb
301
331
  - lib/bio-publisci/writers/arff.rb
332
+ - lib/bio-publisci/writers/base.rb
333
+ - lib/bio-publisci/writers/csv.rb
302
334
  - lib/bio-publisci/writers/dataframe.rb
303
335
  - lib/r2rdf.rb
304
336
  - lib/template_bak.rb
@@ -373,28 +405,34 @@ files:
373
405
  - spec/spec_helper.rb
374
406
  - spec/turtle/bacon
375
407
  - spec/turtle/reference
408
+ - spec/turtle/weather
409
+ - spec/writer_spec.rb
376
410
  homepage: http://github.com/wstrinz/bioruby-publisci
377
411
  licenses:
378
412
  - MIT
379
- metadata: {}
380
413
  post_install_message:
381
414
  rdoc_options: []
382
415
  require_paths:
383
416
  - lib
384
417
  required_ruby_version: !ruby/object:Gem::Requirement
418
+ none: false
385
419
  requirements:
386
- - - '>='
420
+ - - ! '>='
387
421
  - !ruby/object:Gem::Version
388
422
  version: '0'
423
+ segments:
424
+ - 0
425
+ hash: -2716100516942950987
389
426
  required_rubygems_version: !ruby/object:Gem::Requirement
427
+ none: false
390
428
  requirements:
391
- - - '>='
429
+ - - ! '>='
392
430
  - !ruby/object:Gem::Version
393
431
  version: '0'
394
432
  requirements: []
395
433
  rubyforge_project:
396
- rubygems_version: 2.0.3
434
+ rubygems_version: 1.8.25
397
435
  signing_key:
398
- specification_version: 4
436
+ specification_version: 3
399
437
  summary: Publish scientific results to the semantic web
400
438
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 84c3e7a1f4ffe93284a75856a424d4f86624032f
4
- data.tar.gz: 834eb95f1ef0e2353d3aab93bcf4d9c35f34a1d4
5
- SHA512:
6
- metadata.gz: b1c7a7e6f43f26f089a871fffafc10b0f6eb35b6367dde310e1e2df09c9ab40d725048d6291c5e67c12d32454d36a5539342f71130a90121bd4dd19946050f2b
7
- data.tar.gz: 91a1bf68f52d3477d5fa5a89762619cdf7b038d3af49042cf34ce1b6f90e833324cea537bc60e9c6afc23c86163f44855f739e1838266cf0b905f5c20b2a9679