activefacts 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/Rakefile +2 -2
- data/bin/afgen +1 -1
- data/bin/cql +118 -27
- data/examples/CQL/Insurance.cql +2 -2
- data/examples/CQL/Metamodel.cql +3 -3
- data/examples/CQL/SchoolActivities.cql +1 -1
- data/examples/CQL/Warehousing.cql +5 -4
- data/lib/activefacts/cql.rb +1 -1
- data/lib/activefacts/cql/Language/English.treetop +2 -1
- data/lib/activefacts/cql/compiler.rb +6 -6
- data/lib/activefacts/cql/compiler/clause.rb +69 -46
- data/lib/activefacts/cql/compiler/constraint.rb +14 -14
- data/lib/activefacts/cql/compiler/entity_type.rb +24 -24
- data/lib/activefacts/cql/compiler/fact.rb +40 -27
- data/lib/activefacts/cql/compiler/fact_type.rb +16 -16
- data/lib/activefacts/cql/compiler/query.rb +12 -12
- data/lib/activefacts/cql/compiler/shared.rb +9 -0
- data/lib/activefacts/cql/compiler/value_type.rb +4 -4
- data/lib/activefacts/cql/parser.rb +9 -9
- data/lib/activefacts/generate/cql.rb +41 -20
- data/lib/activefacts/generate/helpers/oo.rb +33 -70
- data/lib/activefacts/generate/helpers/ordered.rb +61 -87
- data/lib/activefacts/generate/ruby.rb +12 -72
- data/lib/activefacts/generate/transform/surrogate.rb +13 -13
- data/lib/activefacts/input/orm.rb +72 -71
- data/lib/activefacts/persistence/columns.rb +66 -31
- data/lib/activefacts/persistence/foreignkey.rb +6 -6
- data/lib/activefacts/persistence/index.rb +12 -12
- data/lib/activefacts/persistence/object_type.rb +15 -12
- data/lib/activefacts/persistence/reference.rb +20 -18
- data/lib/activefacts/persistence/tables.rb +40 -36
- data/lib/activefacts/support.rb +69 -123
- data/lib/activefacts/version.rb +2 -2
- data/lib/activefacts/vocabulary/extensions.rb +42 -39
- data/lib/activefacts/vocabulary/metamodel.rb +11 -1
- data/lib/activefacts/vocabulary/verbaliser.rb +28 -28
- data/spec/cql/contractions_spec.rb +1 -1
- data/spec/cql/entity_type_spec.rb +1 -1
- data/spec/cql/fact_type_matching_spec.rb +3 -3
- data/spec/cql/role_matching_spec.rb +4 -4
- data/spec/cql/samples_spec.rb +2 -2
- data/spec/cql_cql_spec.rb +1 -1
- data/spec/helpers/array_matcher.rb +1 -1
- data/spec/norma_ruby_sql_spec.rb +2 -2
- data/spec/norma_tables_spec.rb +3 -2
- metadata +47 -68
@@ -176,7 +176,7 @@ describe "When compiling a query, " do
|
|
176
176
|
end
|
177
177
|
|
178
178
|
it "and should project the fact type roles from the query" do
|
179
|
-
|
179
|
+
skip "Plays are not yet projected" do
|
180
180
|
query = derivation(fact_type)
|
181
181
|
queries = fact_type.all_role.map{|r| r.all_play.map{|play| play.query}}.flatten.uniq
|
182
182
|
queries.size == 1
|
@@ -307,7 +307,7 @@ describe "When compiling an entity type, " do
|
|
307
307
|
test.call(@compiler.vocabulary.constellation)
|
308
308
|
rescue RSpec::Expectations::ExpectationNotMetError
|
309
309
|
raise
|
310
|
-
rescue RSpec::Core::Pending::PendingDeclaredInExample
|
310
|
+
rescue RSpec::Core::Pending::PendingDeclaredInExample
|
311
311
|
raise
|
312
312
|
rescue => e
|
313
313
|
puts "Failed on\n\t"+tests.select{|t| t.is_a?(String)}*" "
|
@@ -69,7 +69,7 @@ describe "When matching a reading" do
|
|
69
69
|
end
|
70
70
|
|
71
71
|
it "should remove duplicate new readings" do
|
72
|
-
|
72
|
+
skip("duplicate new clauses cause an error") do
|
73
73
|
compile %q{
|
74
74
|
Girl is going out with Boy,
|
75
75
|
Girl is going out with Boy,
|
@@ -99,7 +99,7 @@ describe "When matching a reading" do
|
|
99
99
|
}
|
100
100
|
(new_fact_types = fact_types).size.should == 1
|
101
101
|
(readings = (fact_type = new_fact_types[0]).all_reading.to_a).size.should == 2
|
102
|
-
readings.detect{|r| r.text =~ /semi-trailer/}.should
|
102
|
+
readings.detect{|r| r.text =~ /semi-trailer/}.should be_truthy
|
103
103
|
(pcs = fact_pcs(fact_type)).size.should == 1
|
104
104
|
end
|
105
105
|
|
@@ -112,7 +112,7 @@ describe "When matching a reading" do
|
|
112
112
|
end
|
113
113
|
|
114
114
|
it "should match role names" do
|
115
|
-
|
115
|
+
skip("duplicate new clauses cause an error") do
|
116
116
|
compile %q{
|
117
117
|
Girl (as Girlfriend) is going out with Boy,
|
118
118
|
Boy is going out with Girlfriend;
|
@@ -78,7 +78,7 @@ describe "When comparing roles of a reading with an existing reading" do
|
|
78
78
|
side_effects.size.should == 2
|
79
79
|
side_effects[0].should_not be_nil
|
80
80
|
side_effects[1].should be_nil
|
81
|
-
|
81
|
+
skip side_effects[0].to_s
|
82
82
|
side_effects[0].to_s.should == '[{bad- Boy} absorbs 0/0 at 0 with residual adjectives, {Girl} absorbs 0/0 at 5] with residual adjectives'
|
83
83
|
#side_effects[1].to_s.should == ''
|
84
84
|
end
|
@@ -91,7 +91,7 @@ describe "When comparing roles of a reading with an existing reading" do
|
|
91
91
|
@asts.size.should == 1
|
92
92
|
side_effects = match_readings_to_existing(@asts[0], @ugly_ft.all_reading.single)
|
93
93
|
side_effects.size.should == 2
|
94
|
-
|
94
|
+
skip "Matched adjectives must be removed and the role rebound before deciding whether residual adjectives have a purpose" do
|
95
95
|
side_effects[0].should_not be_nil
|
96
96
|
puts side_effects[0].to_s
|
97
97
|
#side_effects.to_s.should == ''
|
@@ -103,7 +103,7 @@ describe "When comparing roles of a reading with an existing reading" do
|
|
103
103
|
parse %q{Boy-monster hurts Girl;}
|
104
104
|
@asts.size.should == 1
|
105
105
|
side_effects = match_readings_to_existing(@asts[0], @hurts_ft.all_reading.single)
|
106
|
-
|
106
|
+
skip "Thinks trailing adjectives are always residual"
|
107
107
|
side_effects[0].should_not be_nil
|
108
108
|
side_effects[0].to_s.should == ''
|
109
109
|
end
|
@@ -137,7 +137,7 @@ describe "When comparing roles of a reading with an existing reading" do
|
|
137
137
|
side_effects = match_readings_to_existing(@asts[0], @hurts_ft.all_reading.single)
|
138
138
|
side_effects.size.should == 2
|
139
139
|
|
140
|
-
|
140
|
+
skip "Matched adjectives must be removed and the role rebound before deciding whether residual adjectives have a purpose" do
|
141
141
|
side_effects[0].should_not be_nil
|
142
142
|
puts side_effects.to_s
|
143
143
|
# side_effects.to_s.should == ''
|
data/spec/cql/samples_spec.rb
CHANGED
@@ -181,7 +181,7 @@ describe "Sample data" do
|
|
181
181
|
@vocabulary = ActiveFacts::Input::CQL.readstring(@text)
|
182
182
|
@vocabulary.finalise
|
183
183
|
rescue => exception
|
184
|
-
if
|
184
|
+
if trace :exception
|
185
185
|
puts "#{exception.message}"
|
186
186
|
puts "\t#{exception.backtrace*"\n\t"}"
|
187
187
|
end
|
@@ -206,7 +206,7 @@ describe "Sample data" do
|
|
206
206
|
begin
|
207
207
|
@vocabulary = ActiveFacts::Input::CQL.readstring(@text)
|
208
208
|
rescue => exception
|
209
|
-
if
|
209
|
+
if trace :exception
|
210
210
|
puts "#{exception.message}"
|
211
211
|
puts "\t#{exception.backtrace*"\n\t"}"
|
212
212
|
end
|
data/spec/cql_cql_spec.rb
CHANGED
data/spec/norma_ruby_sql_spec.rb
CHANGED
@@ -65,7 +65,7 @@ describe "Column lists from absorption compared with Ruby's" do
|
|
65
65
|
begin
|
66
66
|
eval_it.call
|
67
67
|
rescue => exception
|
68
|
-
if
|
68
|
+
if trace :exception
|
69
69
|
puts exception.to_s+": \n\t"+exception.backtrace*"\n\t"
|
70
70
|
end
|
71
71
|
raise
|
@@ -77,7 +77,7 @@ describe "Column lists from absorption compared with Ruby's" do
|
|
77
77
|
begin
|
78
78
|
eval_it.call
|
79
79
|
rescue => exception
|
80
|
-
if
|
80
|
+
if trace :exception
|
81
81
|
puts exception.to_s+": \n\t"+exception.backtrace*"\n\t"
|
82
82
|
end
|
83
83
|
raise
|
data/spec/norma_tables_spec.rb
CHANGED
@@ -18,12 +18,13 @@ require 'activefacts/input/orm'
|
|
18
18
|
orm_failures = {
|
19
19
|
}
|
20
20
|
norma_table_exceptions = {
|
21
|
-
"
|
21
|
+
"Corporate" => [%w{}, %w{Comment ContactReport ID Money Name Nr Photo ReferenceCheck Resource TimeDivision}], # ActiveFacts absorbs Agreement into ContextNote, Enforcement into Constraint, lots into Concept
|
22
|
+
"Metamodel" => [%w{Query}, %w{Agreement Enforcement Comment ContactReport ID Money Nr Photo ReferenceCheck Resource TimeDivision Constraint ContextNote Fact Instance Query Unit}], # ActiveFacts absorbs Agreement into ContextNote, Enforcement into Constraint, lots into Concept
|
22
23
|
"MetamodelNext" => [[], %w{Agreement Enforcement TypeInheritance}],
|
23
24
|
"Orienteering" => [%w{Punch}, []], # NORMA doesn't make a table for the IDENTITY field
|
24
25
|
"OrienteeringER" => [%w{SeriesEvent}, []], # NORMA doesn't make a table for the IDENTITY field
|
25
26
|
"RedundantDependency" => [%w{Politician StateOrProvince}, %w{LegislativeDistrict}], # NORMA doesn't make a table for the 3 IDENTITY fields
|
26
|
-
"Warehousing" => [%w{Product Warehouse},
|
27
|
+
"Warehousing" => [%w{Product Warehouse}, %w{Dispatch Receipt}], # NORMA doesn't make a table for the IDENTITY field
|
27
28
|
"ServiceDirector" => [%w{DataStoreService MonitorNotificationUser}, %w{DataStoreFileHostSystem }],
|
28
29
|
"SeparateSubtype" => [%w{Claim}, %w{Incident}],
|
29
30
|
}
|
metadata
CHANGED
@@ -1,236 +1,216 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activefacts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clifford Heath
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activefacts-api
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
20
|
-
- - ~>
|
19
|
+
version: '1.7'
|
20
|
+
- - "~>"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '1.
|
30
|
-
- - ~>
|
29
|
+
version: '1.7'
|
30
|
+
- - "~>"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rbtree-pure
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- -
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: 0.1.1
|
40
|
-
- - ~>
|
40
|
+
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '0'
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- -
|
47
|
+
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: 0.1.1
|
50
|
-
- - ~>
|
50
|
+
- - "~>"
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '0'
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: treetop
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- -
|
57
|
+
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: 1.4.14
|
60
|
-
- - ~>
|
60
|
+
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '1.4'
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: 1.4.14
|
70
|
-
- - ~>
|
70
|
+
- - "~>"
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: '1.4'
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: nokogiri
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
76
76
|
requirements:
|
77
|
-
- -
|
77
|
+
- - ">="
|
78
78
|
- !ruby/object:Gem::Version
|
79
79
|
version: '1.6'
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1'
|
83
83
|
type: :runtime
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '1.6'
|
90
|
-
- - ~>
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
version: '1'
|
93
|
-
- !ruby/object:Gem::Dependency
|
94
|
-
name: debugger
|
95
|
-
requirement: !ruby/object:Gem::Requirement
|
96
|
-
requirements:
|
97
|
-
- - ~>
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
version: '1'
|
100
|
-
type: :development
|
101
|
-
prerelease: false
|
102
|
-
version_requirements: !ruby/object:Gem::Requirement
|
103
|
-
requirements:
|
104
|
-
- - ~>
|
90
|
+
- - "~>"
|
105
91
|
- !ruby/object:Gem::Version
|
106
92
|
version: '1'
|
107
93
|
- !ruby/object:Gem::Dependency
|
108
94
|
name: activesupport
|
109
95
|
requirement: !ruby/object:Gem::Requirement
|
110
96
|
requirements:
|
111
|
-
- - ~>
|
97
|
+
- - "~>"
|
112
98
|
- !ruby/object:Gem::Version
|
113
99
|
version: '4'
|
114
100
|
type: :development
|
115
101
|
prerelease: false
|
116
102
|
version_requirements: !ruby/object:Gem::Requirement
|
117
103
|
requirements:
|
118
|
-
- - ~>
|
104
|
+
- - "~>"
|
119
105
|
- !ruby/object:Gem::Version
|
120
106
|
version: '4'
|
121
107
|
- !ruby/object:Gem::Dependency
|
122
108
|
name: dm-core
|
123
109
|
requirement: !ruby/object:Gem::Requirement
|
124
110
|
requirements:
|
125
|
-
- -
|
111
|
+
- - ">="
|
126
112
|
- !ruby/object:Gem::Version
|
127
113
|
version: '1.2'
|
128
|
-
- - ~>
|
114
|
+
- - "~>"
|
129
115
|
- !ruby/object:Gem::Version
|
130
116
|
version: '1'
|
131
117
|
type: :development
|
132
118
|
prerelease: false
|
133
119
|
version_requirements: !ruby/object:Gem::Requirement
|
134
120
|
requirements:
|
135
|
-
- -
|
121
|
+
- - ">="
|
136
122
|
- !ruby/object:Gem::Version
|
137
123
|
version: '1.2'
|
138
|
-
- - ~>
|
124
|
+
- - "~>"
|
139
125
|
- !ruby/object:Gem::Version
|
140
126
|
version: '1'
|
141
127
|
- !ruby/object:Gem::Dependency
|
142
128
|
name: dm-constraints
|
143
129
|
requirement: !ruby/object:Gem::Requirement
|
144
130
|
requirements:
|
145
|
-
- -
|
131
|
+
- - ">="
|
146
132
|
- !ruby/object:Gem::Version
|
147
133
|
version: '1.2'
|
148
|
-
- - ~>
|
134
|
+
- - "~>"
|
149
135
|
- !ruby/object:Gem::Version
|
150
136
|
version: '1'
|
151
137
|
type: :development
|
152
138
|
prerelease: false
|
153
139
|
version_requirements: !ruby/object:Gem::Requirement
|
154
140
|
requirements:
|
155
|
-
- -
|
141
|
+
- - ">="
|
156
142
|
- !ruby/object:Gem::Version
|
157
143
|
version: '1.2'
|
158
|
-
- - ~>
|
144
|
+
- - "~>"
|
159
145
|
- !ruby/object:Gem::Version
|
160
146
|
version: '1'
|
161
147
|
- !ruby/object:Gem::Dependency
|
162
148
|
name: dm-migrations
|
163
149
|
requirement: !ruby/object:Gem::Requirement
|
164
150
|
requirements:
|
165
|
-
- -
|
151
|
+
- - ">="
|
166
152
|
- !ruby/object:Gem::Version
|
167
153
|
version: '1.2'
|
168
|
-
- - ~>
|
154
|
+
- - "~>"
|
169
155
|
- !ruby/object:Gem::Version
|
170
156
|
version: '1'
|
171
157
|
type: :development
|
172
158
|
prerelease: false
|
173
159
|
version_requirements: !ruby/object:Gem::Requirement
|
174
160
|
requirements:
|
175
|
-
- -
|
161
|
+
- - ">="
|
176
162
|
- !ruby/object:Gem::Version
|
177
163
|
version: '1.2'
|
178
|
-
- - ~>
|
164
|
+
- - "~>"
|
179
165
|
- !ruby/object:Gem::Version
|
180
166
|
version: '1'
|
181
167
|
- !ruby/object:Gem::Dependency
|
182
168
|
name: jeweler
|
183
169
|
requirement: !ruby/object:Gem::Requirement
|
184
170
|
requirements:
|
185
|
-
- -
|
171
|
+
- - ">="
|
186
172
|
- !ruby/object:Gem::Version
|
187
173
|
version: '2.0'
|
188
|
-
- - ~>
|
174
|
+
- - "~>"
|
189
175
|
- !ruby/object:Gem::Version
|
190
176
|
version: '2'
|
191
177
|
type: :development
|
192
178
|
prerelease: false
|
193
179
|
version_requirements: !ruby/object:Gem::Requirement
|
194
180
|
requirements:
|
195
|
-
- -
|
181
|
+
- - ">="
|
196
182
|
- !ruby/object:Gem::Version
|
197
183
|
version: '2.0'
|
198
|
-
- - ~>
|
184
|
+
- - "~>"
|
199
185
|
- !ruby/object:Gem::Version
|
200
186
|
version: '2'
|
201
187
|
- !ruby/object:Gem::Dependency
|
202
188
|
name: rspec
|
203
189
|
requirement: !ruby/object:Gem::Requirement
|
204
190
|
requirements:
|
205
|
-
- -
|
191
|
+
- - ">="
|
206
192
|
- !ruby/object:Gem::Version
|
207
193
|
version: 2.11.0
|
208
|
-
- - ~>
|
194
|
+
- - "~>"
|
209
195
|
- !ruby/object:Gem::Version
|
210
196
|
version: '2.11'
|
211
197
|
type: :development
|
212
198
|
prerelease: false
|
213
199
|
version_requirements: !ruby/object:Gem::Requirement
|
214
200
|
requirements:
|
215
|
-
- -
|
201
|
+
- - ">="
|
216
202
|
- !ruby/object:Gem::Version
|
217
203
|
version: 2.11.0
|
218
|
-
- - ~>
|
204
|
+
- - "~>"
|
219
205
|
- !ruby/object:Gem::Version
|
220
206
|
version: '2.11'
|
221
|
-
description:
|
207
|
+
description: |2
|
222
208
|
|
223
209
|
ActiveFacts provides a semantic modeling language, the Constellation
|
224
|
-
|
225
210
|
Query Language (CQL). CQL combines natural language verbalisation and
|
226
|
-
|
227
211
|
formal logic, producing a formal language that reads like plain
|
228
|
-
|
229
212
|
English. ActiveFacts converts semantic models from CQL to relational
|
230
|
-
|
231
213
|
and object models in SQL, Ruby and other languages.
|
232
|
-
|
233
|
-
'
|
234
214
|
email: cjh@dataconstellation.com
|
235
215
|
executables:
|
236
216
|
- afgen
|
@@ -395,21 +375,20 @@ licenses:
|
|
395
375
|
metadata: {}
|
396
376
|
post_install_message:
|
397
377
|
rdoc_options:
|
398
|
-
- -
|
399
|
-
- -x
|
378
|
+
- "-x"
|
400
379
|
- lib/activefacts/cql/.*.rb
|
401
|
-
- -x
|
380
|
+
- "-x"
|
402
381
|
- lib/activefacts/vocabulary/.*.rb
|
403
382
|
require_paths:
|
404
383
|
- lib
|
405
384
|
required_ruby_version: !ruby/object:Gem::Requirement
|
406
385
|
requirements:
|
407
|
-
- -
|
386
|
+
- - ">="
|
408
387
|
- !ruby/object:Gem::Version
|
409
388
|
version: '0'
|
410
389
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
411
390
|
requirements:
|
412
|
-
- -
|
391
|
+
- - ">="
|
413
392
|
- !ruby/object:Gem::Version
|
414
393
|
version: '0'
|
415
394
|
requirements: []
|