fathom 0.3.7 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. data/.autotest +7 -5
  2. data/.document +2 -2
  3. data/Gemfile +9 -10
  4. data/{LICENSE → LICENSE.txt} +1 -1
  5. data/README.md +29 -90
  6. data/Rakefile +34 -32
  7. data/VERSION +1 -1
  8. data/fathom.gemspec +105 -0
  9. data/features/fathom.feature +26 -0
  10. data/features/step_definitions/fathom_steps.rb +23 -0
  11. data/features/support/env.rb +13 -0
  12. data/lib/ext/array.rb +6 -2
  13. data/lib/ext/string.rb +86 -7
  14. data/lib/fathom.rb +51 -88
  15. data/lib/fathom/behaviors/attribute_system.rb +91 -0
  16. data/lib/fathom/behaviors/context_behavior.rb +28 -0
  17. data/lib/fathom/behaviors/plugins.rb +16 -0
  18. data/lib/fathom/contexts/network_population.rb +47 -0
  19. data/lib/fathom/contexts/network_traversal.rb +4 -0
  20. data/lib/fathom/data/adjacency_matrix.rb +27 -0
  21. data/lib/fathom/data/definition.rb +22 -0
  22. data/lib/fathom/data/edge.rb +58 -0
  23. data/lib/fathom/data/network.rb +35 -0
  24. data/lib/fathom/data/outcome.rb +30 -0
  25. data/lib/fathom/data/property.rb +31 -0
  26. data/lib/fathom/data/variable.rb +59 -0
  27. data/lib/fathom/roles/general_graph_tools.rb +87 -0
  28. data/lib/fathom/roles/network_builder.rb +61 -0
  29. data/spec/fathom/behaviors/attribute_system_spec.rb +141 -0
  30. data/spec/fathom/behaviors/context_behavior_spec.rb +15 -0
  31. data/spec/fathom/behaviors/plugins_spec.rb +80 -0
  32. data/spec/fathom/contexts/network_population_spec.rb +55 -0
  33. data/spec/fathom/contexts/network_traversal_spec.rb +11 -0
  34. data/spec/fathom/data/adjacency_matrix_spec.rb +42 -0
  35. data/spec/fathom/data/definition_spec.rb +19 -0
  36. data/spec/fathom/data/edge_spec.rb +77 -0
  37. data/spec/fathom/data/network_spec.rb +72 -0
  38. data/spec/fathom/data/outcome_spec.rb +17 -0
  39. data/spec/fathom/data/property_spec.rb +17 -0
  40. data/spec/fathom/data/variable_spec.rb +101 -0
  41. data/spec/fathom/ext/array_spec.rb +17 -0
  42. data/spec/fathom/ext/string_spec.rb +90 -0
  43. data/spec/fathom/roles/general_graph_tools_spec.rb +95 -0
  44. data/spec/fathom/roles/network_builder_spec.rb +90 -0
  45. data/spec/fathom_spec.rb +28 -49
  46. data/spec/spec_helper.rb +7 -11
  47. data/spec/support/context_behavior.rb +14 -0
  48. data/spec/support/custom_matchers.rb +12 -0
  49. data/spec/support/files.rb +8 -0
  50. data/spec/support/network.yml +42 -0
  51. metadata +133 -174
  52. data/.bundle/config +0 -2
  53. data/.gitignore +0 -6
  54. data/Gemfile.lock +0 -42
  55. data/TODO.md +0 -127
  56. data/autotest/discover.rb +0 -1
  57. data/lib/ext/faster_csv.rb +0 -1
  58. data/lib/ext/open_struct.rb +0 -17
  59. data/lib/fathom/agent.rb +0 -48
  60. data/lib/fathom/agent/agent_cluster.rb +0 -23
  61. data/lib/fathom/agent/properties.rb +0 -48
  62. data/lib/fathom/archive/causal_graph.rb +0 -12
  63. data/lib/fathom/archive/concept.rb +0 -83
  64. data/lib/fathom/archive/conditional_probability_matrix.rb +0 -119
  65. data/lib/fathom/archive/inverter.rb +0 -20
  66. data/lib/fathom/archive/n2.rb +0 -198
  67. data/lib/fathom/archive/n3.rb +0 -119
  68. data/lib/fathom/archive/node.rb +0 -97
  69. data/lib/fathom/archive/noodle.rb +0 -136
  70. data/lib/fathom/archive/scratch.rb +0 -45
  71. data/lib/fathom/distributions.rb +0 -8
  72. data/lib/fathom/distributions/discrete_gaussian.rb +0 -44
  73. data/lib/fathom/distributions/discrete_uniform.rb +0 -25
  74. data/lib/fathom/distributions/gaussian.rb +0 -46
  75. data/lib/fathom/distributions/uniform.rb +0 -35
  76. data/lib/fathom/import.rb +0 -85
  77. data/lib/fathom/import/csv_import.rb +0 -59
  78. data/lib/fathom/import/import_node.rb +0 -17
  79. data/lib/fathom/import/yaml_import.rb +0 -74
  80. data/lib/fathom/knowledge_base.rb +0 -46
  81. data/lib/fathom/knowledge_base/search.rb +0 -19
  82. data/lib/fathom/monte_carlo_set.rb +0 -152
  83. data/lib/fathom/node.rb +0 -139
  84. data/lib/fathom/node/belief_node.rb +0 -121
  85. data/lib/fathom/node/cpm_node.rb +0 -100
  86. data/lib/fathom/node/data_collection.rb +0 -97
  87. data/lib/fathom/node/data_node.rb +0 -22
  88. data/lib/fathom/node/decision.rb +0 -11
  89. data/lib/fathom/node/discrete_node.rb +0 -41
  90. data/lib/fathom/node/fact.rb +0 -24
  91. data/lib/fathom/node/mc_node.rb +0 -70
  92. data/lib/fathom/node/node_extensions/enforced_name.rb +0 -12
  93. data/lib/fathom/node/node_extensions/numeric_methods.rb +0 -68
  94. data/lib/fathom/node/plausible_range.rb +0 -98
  95. data/lib/fathom/simulation.rb +0 -59
  96. data/lib/fathom/simulation/tick_methods.rb +0 -25
  97. data/lib/fathom/simulation/tick_simulation.rb +0 -12
  98. data/lib/fathom/value_description.rb +0 -79
  99. data/lib/options_hash.rb +0 -186
  100. data/spec/ext/array_spec.rb +0 -10
  101. data/spec/ext/faster_csv_spec.rb +0 -10
  102. data/spec/ext/open_struct_spec.rb +0 -20
  103. data/spec/ext/string_spec.rb +0 -7
  104. data/spec/fathom/agent/agent_cluster_spec.rb +0 -17
  105. data/spec/fathom/agent_spec.rb +0 -51
  106. data/spec/fathom/distributions/discrete_gaussian_spec.rb +0 -64
  107. data/spec/fathom/distributions/discrete_uniform_spec.rb +0 -0
  108. data/spec/fathom/distributions/gaussian_spec.rb +0 -64
  109. data/spec/fathom/distributions/uniform_spec.rb +0 -0
  110. data/spec/fathom/import/csv_import_spec.rb +0 -52
  111. data/spec/fathom/import/import_node_spec.rb +0 -10
  112. data/spec/fathom/import/yaml_import_spec.rb +0 -73
  113. data/spec/fathom/import_spec.rb +0 -36
  114. data/spec/fathom/knowledge_base_spec.rb +0 -20
  115. data/spec/fathom/monte_carlo_set_spec.rb +0 -149
  116. data/spec/fathom/node/belief_node_spec.rb +0 -180
  117. data/spec/fathom/node/cpm_node_spec.rb +0 -144
  118. data/spec/fathom/node/data_collection_spec.rb +0 -26
  119. data/spec/fathom/node/data_node_spec.rb +0 -102
  120. data/spec/fathom/node/decision_spec.rb +0 -15
  121. data/spec/fathom/node/discrete_node_spec.rb +0 -56
  122. data/spec/fathom/node/fact_spec.rb +0 -33
  123. data/spec/fathom/node/mc_node_spec.rb +0 -66
  124. data/spec/fathom/node/node_extensions/enforced_name_spec.rb +0 -15
  125. data/spec/fathom/node/node_extensions/numeric_methods_spec.rb +0 -124
  126. data/spec/fathom/node/plausible_range_spec.rb +0 -151
  127. data/spec/fathom/node_spec.rb +0 -172
  128. data/spec/fathom/simulation/tick_simulation_spec.rb +0 -32
  129. data/spec/fathom/simulation_spec.rb +0 -24
  130. data/spec/fathom/value_description_spec.rb +0 -70
  131. data/spec/support/demo.yml +0 -17
  132. data/spec/support/demo_agent.rb +0 -8
  133. data/spec/support/dummy_numeric_node.rb +0 -8
  134. data/spec/support/fact.yml +0 -11
@@ -1,15 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
-
3
- include Fathom::Distributions
4
-
5
- class DemoEnforcedNameNode < Fathom::Node
6
- include EnforcedName
7
- end
8
-
9
- describe EnforcedName do
10
-
11
- it "should ensure that we have a name as a UID if one is not provided" do
12
- n = DemoEnforcedNameNode.new
13
- n.name.should_not be_nil
14
- end
15
- end
@@ -1,124 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
-
3
- include Fathom
4
-
5
- describe NumericMethods do
6
-
7
- before(:all) do
8
- @values = [1,2,3]
9
- @vector = GSL::Vector.ary_to_gv(@values)
10
- @opts = {:values => @values}
11
- end
12
-
13
- before do
14
- @n = Distributions::DummyNumericNode.new(@opts)
15
- end
16
-
17
- it "should respond to a rand method" do
18
- @n = Distributions::DummyNumericNode.new
19
- @n.should be_respond_to(:rand)
20
- end
21
-
22
- it "should be able to construct a vector from the values" do
23
- @n.vector.should ==(@vector)
24
- end
25
-
26
- it "should have a standard deviation if it has a vector" do
27
- @n.standard_deviation.should eql(@vector.sd)
28
- end
29
-
30
- it "should have std and sd aliases for standard deviation" do
31
- @n.sd.should eql(@n.standard_deviation)
32
- @n.std.should eql(@n.standard_deviation)
33
- end
34
-
35
- it "should not raise an error when looking for a standard deviation and there is no vector" do
36
- @n = Distributions::DummyNumericNode.new
37
- @n.vector.should be_nil
38
- @n.sd.should be_nil
39
- end
40
-
41
- it "should have a mean if it has a vector" do
42
- @n.mean.should eql(@vector.mean)
43
- end
44
-
45
- it "should return nil for mean if it doesn't have a vector" do
46
- @n = Distributions::DummyNumericNode.new
47
- @n.mean.should be_nil
48
- end
49
-
50
- it "should provide rand, if it has a vector" do
51
- Distributions::Gaussian.should_receive(:rand).and_return(0.5)
52
- @n.rand
53
- end
54
-
55
- it "should return nil for rand if it doesn't have a vector" do
56
- @n = Distributions::DummyNumericNode.new
57
- @n.mean.should be_nil
58
- end
59
-
60
- it "should be able to calculate the inverse_cdf, lower_bound, upper_bound and interval_values" do
61
- lambda{@n.inverse_cdf}.should_not raise_error
62
- lambda{@n.lower_bound}.should_not raise_error
63
- lambda{@n.upper_bound}.should_not raise_error
64
- lambda{@n.interval_values}.should_not raise_error
65
- end
66
-
67
- it "should pass the mean and standard deviation to the distribution when calculating an inverse_cdf" do
68
- @n.inverse_cdf.should eql(Distributions::Gaussian.inverse_cdf(:mean => @n.mean, :sd => @n.sd))
69
- end
70
-
71
- it "should pass the mean and standard deviation to the distribution when calculating an lower_bound" do
72
- @n.lower_bound.should eql(Distributions::Gaussian.lower_bound(:mean => @n.mean, :sd => @n.sd))
73
- end
74
-
75
- it "should pass the mean and standard deviation to the distribution when calculating an upper_bound" do
76
- @n.upper_bound.should eql(Distributions::Gaussian.upper_bound(:mean => @n.mean, :sd => @n.sd))
77
- end
78
-
79
- it "should pass the mean and standard deviation to the distribution when calculating an interval_values" do
80
- @n.interval_values.should eql(Distributions::Gaussian.interval_values(:mean => @n.mean, :sd => @n.sd))
81
- end
82
-
83
- it "should have a coefficient_of_variation" do
84
- @n.coefficient_of_variation.should eql(@n.sd / @n.mean)
85
- end
86
-
87
- it "should have a cov alias for coefficient_of_variation" do
88
- @n.cov.should eql(@n.coefficient_of_variation)
89
- end
90
-
91
- it "should have a summary hash" do
92
- @n.should be_respond_to(:summary)
93
- @n.summary.should be_a(Hash)
94
- end
95
-
96
- it "should have a mean in the summary" do
97
- @n.summary[:mean].should eql(@n.mean)
98
- end
99
-
100
- it "should have a standard deviation in the summary" do
101
- @n.summary[:standard_deviation].should eql(@n.standard_deviation)
102
- end
103
-
104
- it "should have a min in the summary" do
105
- @n.summary[:min].should eql(@n.vector.min)
106
- end
107
-
108
- it "should have a max in the summary" do
109
- @n.summary[:max].should eql(@n.vector.max)
110
- end
111
-
112
- it "should have a lower_bound in the summary" do
113
- @n.summary[:lower_bound].should eql(@n.lower_bound)
114
- end
115
-
116
- it "should have an upper_bound in the summary" do
117
- @n.summary[:upper_bound].should eql(@n.upper_bound)
118
- end
119
-
120
- it "should have a coefficient_of_variation in the summary" do
121
- @n.summary[:coefficient_of_variation].should eql(@n.sd / @n.mean)
122
- end
123
-
124
- end
@@ -1,151 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
-
3
- include Fathom
4
-
5
- describe PlausibleRange do
6
-
7
- before do
8
- @d = {:upper_bound => 10, :lower_bound => 1}
9
- @pr = PlausibleRange.new(@d)
10
- end
11
-
12
- it "should require an upper and lower bound" do
13
- lambda{PlausibleRange.new}.should raise_error(/upper/)
14
- lambda{PlausibleRange.new(:upper_bound => 10)}.should raise_error(/lower/)
15
- lambda{PlausibleRange.new(:upper_bound => 10, :lower_bound => 1)}.should_not raise_error
16
- end
17
-
18
- it "should expose the upper bound and lower bound" do
19
- @pr.upper_bound.should eql(10)
20
- @pr.lower_bound.should eql(1)
21
- end
22
-
23
- it "should use min or max instead of lower_bound or upper_bound" do
24
- pr = PlausibleRange.new(:min => 1, :max => 10)
25
- pr.min.should eql(1)
26
- pr.max.should eql(10)
27
- pr.lower_bound.should eql(1)
28
- pr.upper_bound.should eql(10)
29
- end
30
-
31
- it "should allow an optional hard_lower_bound" do
32
- pr = PlausibleRange.new(@d.merge(:hard_lower_bound => 0))
33
- pr.hard_lower_bound.should eql(0)
34
- end
35
-
36
- it "should set the lower_bound to the hard_lower_bound if the hard_lower_bound is greater than the lower_bound" do
37
- pr = PlausibleRange.new(:lower_bound => 2, :hard_lower_bound => 3, :upper_bound => 4)
38
- pr.lower_bound.should eql(3)
39
- end
40
-
41
- it "should allow an optional hard_upper_bound" do
42
- pr = PlausibleRange.new(@d.merge(:hard_upper_bound => 20))
43
- pr.hard_upper_bound.should eql(20)
44
- end
45
-
46
- it "should set the upper_bound to the hard_upper_bound if the hard_upper_bound is less than the upper_bound" do
47
- pr = PlausibleRange.new(:lower_bound => 2, :hard_upper_bound => 3, :upper_bound => 4)
48
- pr.upper_bound.should eql(3)
49
- end
50
-
51
- it "should have a default confidence interval of 90%" do
52
- @pr.confidence_interval.should eql(0.9)
53
- end
54
-
55
- it "should be able to instantiate with confidence_interval" do
56
- pr = PlausibleRange.new(@d.merge(:confidence_interval => 0.8))
57
- pr.confidence_interval.should eql(0.8)
58
- end
59
-
60
- it "should be able to use ci instead of confidence_interval" do
61
- pr = PlausibleRange.new(@d.merge(:ci => 0.8))
62
- pr.ci.should eql(0.8)
63
- pr.confidence_interval.should eql(0.8)
64
- end
65
-
66
- it "should be able to calculate the midpoint" do
67
- @pr.midpoint.should eql(5.5)
68
- end
69
-
70
- it "should be able to calculate the standard deviation" do
71
- @pr.standard_deviation.should be_within(0.0001).of( 2.7358)
72
- end
73
-
74
- it "should be able to use std instead of standard_deviation" do
75
- @pr.std.should eql(@pr.standard_deviation)
76
- end
77
-
78
- it "should be able to produce a random value from within the distribution" do
79
- @pr.should be_respond_to(:rand)
80
- @pr.rand.should be_a(Float)
81
- end
82
-
83
- it "should be able to produce an array of random values" do
84
- @pr.array_of_random_values.should be_an(Array)
85
- @pr.array_of_random_values.length.should eql(10)
86
- @pr.array_of_random_values(13).length.should eql(13)
87
- end
88
-
89
- it "should alias array_of_random_values with to_a" do
90
- @pr.to_a.should be_an(Array)
91
- @pr.to_a.length.should eql(10)
92
- @pr.to_a(13).length.should eql(13)
93
- end
94
-
95
- it "should be able to produce a vector of random values" do
96
- @pr.vector_of_random_values.should be_a(GSL::Vector)
97
- @pr.vector_of_random_values.length.should eql(10)
98
- @pr.vector_of_random_values(12).length.should eql(12)
99
- end
100
-
101
- it "should alias vector_of_random_values with to_v" do
102
- @pr.to_v.should be_a(GSL::Vector)
103
- @pr.to_v.length.should eql(10)
104
- @pr.to_v(12).length.should eql(12)
105
- end
106
-
107
- it "should record the name, if one is provided" do
108
- pr = PlausibleRange.new(@d.merge(:name => 'pr1'))
109
- pr.name.should eql('pr1')
110
- end
111
-
112
- it "should record the description, if one is provided" do
113
- pr = PlausibleRange.new(@d.merge(:description => 'some description'))
114
- pr.description.should eql('some description')
115
- end
116
-
117
- it "should have no problems with a range with matching lower and upper bounds" do
118
- pr = PlausibleRange.new(:min => 1, :max => 1)
119
- pr.rand.should eql(1.0)
120
- pr.midpoint.should eql(1.0)
121
- pr.std.should eql(0.0)
122
- end
123
-
124
- it "should have a name_sym method" do
125
- pr = PlausibleRange.new(:min => 1, :max => 2, :name => "Demo Node")
126
- pr.name_sym.should eql(:demo_node)
127
- end
128
-
129
- it "should not exceed the lower bound if it is set", :slow => true do
130
- pr = PlausibleRange.new(:max => 100, :hard_lower_bound => 0)
131
- 1_000.times do
132
- (pr.rand >= 0).should eql(true)
133
- end
134
- end
135
-
136
- it "should not exceed the upper bound if it is set", :slow => true do
137
- pr = PlausibleRange.new(:min => 0, :hard_upper_bound => 100)
138
- 1_000.times do
139
- (pr.rand <= 100).should eql(true)
140
- end
141
- end
142
-
143
- it "should not exceed the lower bound or upper bound if both are set", :slow => true do
144
- pr = PlausibleRange.new(:hard_upper_bound => 100, :hard_lower_bound => 0)
145
- 1_000.times do
146
- r = pr.rand
147
- (r >= 0 and r <= 100).should eql(true)
148
- end
149
- end
150
-
151
- end
@@ -1,172 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
-
3
- include Fathom
4
-
5
- describe Node do
6
- it "should take an options hash to instantiate" do
7
- lambda{Node.new(:any_value => true)}.should_not raise_error
8
- end
9
-
10
- it "should take an optional name parameter" do
11
- node = Node.new(:name => "My Name")
12
- node.name.should eql("My Name")
13
- end
14
-
15
- it "should take an optional distribution parameter" do
16
- node = Node.new(:distribution => Fathom::Distributions::Gaussian)
17
- node.distribution.should eql(Fathom::Distributions::Gaussian)
18
- end
19
-
20
- it "should default to the standard distribution" do
21
- node = Node.new
22
- node.distribution.should eql(Fathom::Distributions::Gaussian)
23
- end
24
-
25
- it "should be able to take a symbol and find the appropriate distribution" do
26
- node = Node.new(:distribution => :gaussian)
27
- node.distribution.should eql(Fathom::Distributions::Gaussian)
28
- end
29
-
30
- it "should take an optional description" do
31
- node = Node.new(:description => "some description")
32
- node.description.should eql('some description')
33
- end
34
-
35
- it "should take an optional values parameter" do
36
- node = Node.new(:values => [1,2,3])
37
- node.values.should eql([1,2,3])
38
- end
39
-
40
- it "should provide name_sym, if a name is defined" do
41
- node = Node.new(:name => "Some name")
42
- node.name_sym.should eql(:some_name)
43
- end
44
-
45
- it "should change dashes to underscores for name_sym" do
46
- node = Node.new(:name => "Some-name")
47
- node.name_sym.should eql(:some_name)
48
- end
49
-
50
- it "should take an optional parents list" do
51
- n1 = Node.new
52
- n2 = Node.new(:parents => [n1])
53
- n2.parents.should eql([n1])
54
- end
55
-
56
- it "should allow a single node as a parent or parents and turn it into an array" do
57
- n1 = Node.new
58
- n2 = Node.new(:parents => n1)
59
- n2.parents.should eql([n1])
60
- n2 = Node.new(:parent => n1)
61
- n2.parents.should eql([n1])
62
- end
63
-
64
- it "should create an empty list of parents by default" do
65
- n1 = Node.new
66
- n1.parents.should eql([])
67
- end
68
-
69
- it "should be able to add a parent" do
70
- n1, n2 = Node.new, Node.new
71
- n3 = Node.new(:parent => n2)
72
- n3.add_parent(n1)
73
- n3.parents.should eql([n2, n1])
74
- end
75
-
76
- it "should register the receiving node when adding a parent" do
77
- n1 = Node.new
78
- n1.should_receive(:register_child).and_return(true)
79
- n2 = Node.new(:parent => n1)
80
-
81
- n1 = Node.new
82
- n1.should_receive(:register_child).and_return(true)
83
- n2 = Node.new
84
- n2.add_parent(n1)
85
- end
86
-
87
- it "should not allow a parent to be registered if it is not a child of the other node" do
88
- n1 = Node.new
89
- n2 = Node.new
90
- lambda{n2.register_parent(n1)}.should raise_error
91
- end
92
-
93
- it "should take an optional children list" do
94
- n1 = Node.new
95
- n2 = Node.new(:children => [n1])
96
- n2.children.should eql([n1])
97
- end
98
-
99
- it "should allow a single node as a child or children and turn it into an array" do
100
- n1 = Node.new
101
- n2 = Node.new(:children => n1)
102
- n2.children.should eql([n1])
103
- n2 = Node.new(:child => n1)
104
- n2.children.should eql([n1])
105
- end
106
-
107
- it "should create an empty list of children by default" do
108
- n1 = Node.new
109
- n1.children.should eql([])
110
- end
111
-
112
- it "should register the receiving node when adding a child" do
113
- n1 = Node.new
114
- n1.should_receive(:register_parent).and_return(true)
115
- n2 = Node.new(:child => n1)
116
-
117
- n1 = Node.new
118
- n1.should_receive(:register_parent).and_return(true)
119
- n2 = Node.new
120
- n2.add_child(n1)
121
- end
122
-
123
- it "should not allow a child to be registered if it is not a parent of the other node" do
124
- n1 = Node.new
125
- n2 = Node.new
126
- lambda{n2.register_child(n1)}.should raise_error
127
- end
128
-
129
- it "should define an accessor method for the child node when added" do
130
- n1 = Node.new(:name => 'n1')
131
- n2 = Node.new :name => 'n2', :child => n1
132
- n2.n1.should eql(n1)
133
- n1.should_not respond_to(:n1)
134
- end
135
-
136
- it "should define an accessor method for the parent node when added" do
137
- n1 = Node.new(:name => 'n1')
138
- n2 = Node.new :parent => n1
139
- n2.n1.should eql(n1)
140
- n1.should_not respond_to(:n1)
141
- end
142
-
143
- it "should have defined an accessor method for the added child to the parent" do
144
- n1 = Node.new(:name => 'n1')
145
- n2 = Node.new :name => 'n2', :child => n1
146
- n1.n2.should eql(n2)
147
- end
148
-
149
- it "should have defined an accessor method for the added parent to the child" do
150
- n1 = Node.new(:name => 'n1')
151
- n2 = Node.new :name => 'n2', :parent => n1
152
- n1.n2.should eql(n2)
153
- end
154
-
155
- # it "should have introduced the Spira infrastructure by now" do
156
- # Object.should be_const_defined(:Spira)
157
- # end
158
-
159
- # it "should have defined the spira repository" do
160
- # Spira.repositories[:default].should be_a(RDF::Repository)
161
- # end
162
-
163
- # This really changes the interface for everything. So, either I re-purpose a node, or something...
164
- # Next steps: read the Spira source and figure out what's easier to do: replace the functionality
165
- # or change my interfaces. (btw, 9 issues, only.
166
- # Mostly just tied to creating the node accessors (n1.n2 type thing))
167
-
168
- # it "should have Spira included" do
169
- # Node.included_modules.should be_include(Spira::Resource)
170
- # end
171
-
172
- end