bio-publisci 0.0.5 → 0.0.6

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.
@@ -0,0 +1,53 @@
1
+ require_relative '../../lib/bio-publisci.rb'
2
+ include PubliSci::Prov::DSL
3
+ include PubliSci::Prov
4
+
5
+ describe PubliSci::Prov::Entity do
6
+ before(:each) do
7
+ @evaluator = PubliSci::Prov::DSL::Singleton.new
8
+ end
9
+
10
+ it "can generate entity fields from symbol" do
11
+ e = entity :name
12
+ e.is_a?(Entity).should be true
13
+ e.subject.should == "http://rqtl.org/ns/entity/name"
14
+ end
15
+
16
+ it "can specify fields manually" do
17
+ e = entity :name, subject: "http://example.org/name"
18
+ e.subject.should == "http://example.org/name"
19
+ end
20
+
21
+ it "can be created with a block" do
22
+ e = entity :ent do
23
+ subject "http://things.com/stuff"
24
+ source "/somefile.txt"
25
+ end
26
+ e.is_a?(Entity).should be true
27
+ e.subject.should == "http://things.com/stuff"
28
+ e.source[0].should == "/somefile.txt"
29
+ end
30
+
31
+ it "raises an exception when derivation does not refer to an entity" do
32
+ e = entity :name, derived_from: :dataset
33
+ expect {e.derived_from[0]}.to raise_error
34
+ end
35
+
36
+ it "raises an exception when attribution does not refer to an agent" do
37
+ e = entity :name, attributed_to: :person
38
+ expect {e.attributed_to[0]}.to raise_error
39
+ end
40
+
41
+ it "raises an exception when generated_by does not refer to an activity" do
42
+ e = entity :name, generated_by: :act
43
+ expect {e.generated_by[0]}.to raise_error
44
+ end
45
+
46
+ it "lazy loads other objects, so declaration order doesn't usually matter" do
47
+ e = entity :name, derived_from: :other
48
+ f = entity :other
49
+
50
+
51
+ e.derived_from[0].should == f
52
+ end
53
+ end
@@ -0,0 +1,95 @@
1
+ require_relative '../../lib/bio-publisci.rb'
2
+ include PubliSci::Prov::DSL
3
+ include PubliSci::Prov
4
+
5
+ describe PubliSci::Prov::Role do
6
+
7
+ before(:each) do
8
+ @evaluator = PubliSci::Prov::DSL::Singleton.new
9
+ end
10
+
11
+ it "creates a role in a used block" do
12
+ ent1 = @ev.entity :some_data
13
+ ent2 = @ev.entity :other_data
14
+ ag = @ev.agent :some_guy
15
+ act = @ev.activity :do_things do
16
+ generated :some_data
17
+ associated_with :some_guy
18
+ used do
19
+ entity :other_data
20
+ role :plagirized
21
+ end
22
+ end
23
+ act.used[0].role.to_n3["a prov:Role"].size.should > 0
24
+ end
25
+
26
+ it "can have a comment attached" do
27
+ ent1 = @ev.entity :some_data
28
+ ent2 = @ev.entity :other_data
29
+ ag = @ev.agent :some_guy
30
+ act = @ev.activity :do_things do
31
+ generated :some_data
32
+ associated_with :some_guy
33
+ used do
34
+ entity :other_data
35
+ role :plagirized do
36
+ comment "I stole all of this data"
37
+ end
38
+ end
39
+ end
40
+ act.used[0].role.to_n3["rdfs:comment"].size.should > 0
41
+ end
42
+
43
+ # it "can be created with a block" do
44
+ # e = entity :data
45
+ # a = activity :ag do
46
+ # subject "http://things.com/stuff"
47
+ # generated :data
48
+ # end
49
+ # a.is_a?(Activity).should be true
50
+ # a.subject.should == "http://things.com/stuff"
51
+ # end
52
+
53
+ # it "lazy loads other objects" do
54
+ # a = activity :ag do
55
+ # subject "http://things.com/stuff"
56
+ # generated :data
57
+ # end
58
+ # e = entity :data
59
+
60
+ # a.generated[0].should == e
61
+ # end
62
+
63
+ # it "raises an exception when used does not refer to an entity" do
64
+ # a = activity :name, used: :some_data
65
+ # expect {a.used[0]}.to raise_error
66
+ # end
67
+
68
+ # it "raises an exception when generated does not refer to an entity" do
69
+ # a = activity :name, generated: :other_data
70
+ # expect {a.generated[0]}.to raise_error
71
+ # end
72
+
73
+ # it "lazy loads generated relationships" do
74
+ # a = activity :act, generated: :data
75
+ # e = entity :data
76
+
77
+ # a.generated[0].should == e
78
+ # end
79
+
80
+ # it "lazy loads used relationships" do
81
+ # a = activity :act, generated: :data, used: :other_data
82
+ # e = entity :data
83
+ # f = entity :other_data
84
+
85
+ # a.used[0].should == f
86
+ # end
87
+
88
+ # it "lazy loads other objects, so declaration order doesn't usually matter" do
89
+ # a = activity :name, on_behalf_of: :other
90
+ # b = activity :other
91
+
92
+ # a.on_behalf_of.should == b
93
+ # end
94
+
95
+ end
@@ -0,0 +1,99 @@
1
+ require_relative '../../lib/bio-publisci.rb'
2
+ include PubliSci::Prov::DSL
3
+ include PubliSci::Prov
4
+
5
+ describe PubliSci::Prov::Usage do
6
+
7
+ before(:each) do
8
+ @evaluator = PubliSci::Prov::DSL::Singleton.new
9
+ end
10
+
11
+ it "can create simple associations" do
12
+ ent1 = @ev.entity :some_data
13
+ ent2 = @ev.entity :other_data
14
+ ag = @ev.agent :some_guy
15
+ act = @ev.activity :do_things do
16
+ generated :some_data
17
+ associated_with :some_guy
18
+ used do
19
+ entity :other_data
20
+ role :plagirized
21
+ end
22
+ end
23
+ act.used[0].entity.should == ent2
24
+ end
25
+
26
+ it "can generate n3" do
27
+ ent1 = @ev.entity :some_data
28
+ ent2 = @ev.entity :other_data
29
+ ag = @ev.agent :some_guy
30
+ act = @ev.activity :do_things do
31
+ generated :some_data
32
+ associated_with :some_guy
33
+ used do
34
+ entity :other_data
35
+ role :plagirized
36
+ end
37
+ end
38
+ act.to_n3["prov:qualifiedUsage"].size.should > 0
39
+ act.used[0].to_n3["a prov:Usage"].size.should > 0
40
+ end
41
+
42
+ # it "can specify fields manually" do
43
+ # a = activity :name, subject: "http://example.org/name"
44
+ # a.subject.should == "http://example.org/name"
45
+ # end
46
+
47
+ # it "can be created with a block" do
48
+ # e = entity :data
49
+ # a = activity :ag do
50
+ # subject "http://things.com/stuff"
51
+ # generated :data
52
+ # end
53
+ # a.is_a?(Activity).should be true
54
+ # a.subject.should == "http://things.com/stuff"
55
+ # end
56
+
57
+ # it "lazy loads other objects" do
58
+ # a = activity :ag do
59
+ # subject "http://things.com/stuff"
60
+ # generated :data
61
+ # end
62
+ # e = entity :data
63
+
64
+ # a.generated[0].should == e
65
+ # end
66
+
67
+ # it "raises an exception when used does not refer to an entity" do
68
+ # a = activity :name, used: :some_data
69
+ # expect {a.used[0]}.to raise_error
70
+ # end
71
+
72
+ # it "raises an exception when generated does not refer to an entity" do
73
+ # a = activity :name, generated: :other_data
74
+ # expect {a.generated[0]}.to raise_error
75
+ # end
76
+
77
+ # it "lazy loads generated relationships" do
78
+ # a = activity :act, generated: :data
79
+ # e = entity :data
80
+
81
+ # a.generated[0].should == e
82
+ # end
83
+
84
+ # it "lazy loads used relationships" do
85
+ # a = activity :act, generated: :data, used: :other_data
86
+ # e = entity :data
87
+ # f = entity :other_data
88
+
89
+ # a.used[0].should == f
90
+ # end
91
+
92
+ # it "lazy loads other objects, so declaration order doesn't usually matter" do
93
+ # a = activity :name, on_behalf_of: :other
94
+ # b = activity :other
95
+
96
+ # a.on_behalf_of.should == b
97
+ # end
98
+
99
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bio-publisci
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Will Strinz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-31 00:00:00.000000000 Z
11
+ date: 2013-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdf
@@ -214,6 +214,9 @@ files:
214
214
  - bin/bio-publisci
215
215
  - examples/bio-band_integration.rb
216
216
  - examples/no_magic.prov
217
+ - examples/no_magic.rb
218
+ - examples/orm.prov
219
+ - examples/primer-full.prov
217
220
  - examples/primer.prov
218
221
  - examples/prov_dsl.prov
219
222
  - features/create_generator.feature
@@ -248,9 +251,13 @@ files:
248
251
  - lib/bio-publisci/metadata/prov/dsl.rb
249
252
  - lib/bio-publisci/metadata/prov/element.rb
250
253
  - lib/bio-publisci/metadata/prov/entity.rb
254
+ - lib/bio-publisci/metadata/prov/model/prov_models.rb
251
255
  - lib/bio-publisci/metadata/prov/plan.rb
252
256
  - lib/bio-publisci/metadata/prov/prov.rb
257
+ - lib/bio-publisci/metadata/prov/role.rb
258
+ - lib/bio-publisci/metadata/prov/usage.rb
253
259
  - lib/bio-publisci/mixins/custom_predicate.rb
260
+ - lib/bio-publisci/mixins/dereferencable.rb
254
261
  - lib/bio-publisci/mixins/vocabulary.rb
255
262
  - lib/bio-publisci/output.rb
256
263
  - lib/bio-publisci/parser.rb
@@ -311,6 +318,12 @@ files:
311
318
  - spec/generators/dataframe_spec.rb
312
319
  - spec/generators/r_cross_spec.rb
313
320
  - spec/generators/r_matrix_spec.rb
321
+ - spec/prov/activity_spec.rb
322
+ - spec/prov/agent_spec.rb
323
+ - spec/prov/association_spec.rb
324
+ - spec/prov/entity_spec.rb
325
+ - spec/prov/role_spec.rb
326
+ - spec/prov/usage_spec.rb
314
327
  - spec/queries/integrity/1.rq
315
328
  - spec/queries/integrity/11.rq
316
329
  - spec/queries/integrity/12.rq