activefacts 0.8.8 → 0.8.9
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/cql +90 -31
- data/download.html +2 -1
- data/examples/CQL/Diplomacy.cql +8 -8
- data/examples/CQL/Insurance.cql +3 -3
- data/examples/CQL/Metamodel.cql +31 -16
- data/examples/CQL/MetamodelNext.cql +30 -18
- data/examples/CQL/Orienteering.cql +2 -2
- data/examples/CQL/OrienteeringER.cql +6 -6
- data/examples/CQL/SchoolActivities.cql +1 -1
- data/examples/CQL/ServiceDirector.cql +3 -3
- data/examples/CQL/Supervision.cql +3 -2
- data/examples/CQL/Tests.Test5.Load.cql +1 -1
- data/examples/CQL/WaiterTips.cql +1 -1
- data/lib/activefacts/cql/FactTypes.treetop +14 -2
- data/lib/activefacts/cql/compiler/constraint.rb +69 -36
- data/lib/activefacts/cql/compiler/fact.rb +142 -71
- data/lib/activefacts/cql/compiler/fact_type.rb +1 -1
- data/lib/activefacts/cql/compiler/reading.rb +35 -8
- data/lib/activefacts/cql/compiler/shared.rb +4 -3
- data/lib/activefacts/generate/cql.rb +16 -5
- data/lib/activefacts/generate/ordered.rb +1 -1
- data/lib/activefacts/input/orm.rb +136 -57
- data/lib/activefacts/support.rb +40 -16
- data/lib/activefacts/version.rb +1 -1
- data/lib/activefacts/vocabulary/extensions.rb +149 -58
- data/lib/activefacts/vocabulary/metamodel.rb +23 -11
- data/lib/activefacts/vocabulary/verbaliser.rb +223 -105
- data/spec/cql/samples_spec.rb +30 -6
- data/spec/cql_mysql_spec.rb +1 -2
- data/spec/norma_ruby_sql_spec.rb +0 -1
- metadata +4 -4
data/spec/cql/samples_spec.rb
CHANGED
@@ -14,10 +14,12 @@ describe "Sample data" do
|
|
14
14
|
vocabulary V;
|
15
15
|
|
16
16
|
Company Name is written as String;
|
17
|
+
Date is written as Date;
|
17
18
|
Company is identified by its Name;
|
18
19
|
Person is identified by its Name where Person is called Person Name;
|
19
20
|
Directorship is where
|
20
21
|
Company is directed by Person;
|
22
|
+
Directorship began on appointment-Date;
|
21
23
|
}
|
22
24
|
|
23
25
|
GoodSamples = [
|
@@ -75,9 +77,13 @@ describe "Sample data" do
|
|
75
77
|
],
|
76
78
|
|
77
79
|
# Objectification examples
|
78
|
-
[
|
80
|
+
[
|
79
81
|
"Directorship (where Company 'Microsoft' is directed by Person 'Gates');",
|
80
|
-
|
82
|
+
[{:facts=>Set["Company has Company Name 'Microsoft'", "Company is directed by Person", "Person is called Person Name 'Gates'"], :instances=>Set["Person is identified by Person Name where Person is called Person Name 'Gates'", "Company is identified by Company Name where Company has Company Name 'Microsoft'", "Company Name 'Microsoft'", "Directorship where Company is directed by Person", "Person Name 'Gates'"]}]
|
83
|
+
],
|
84
|
+
[
|
85
|
+
"Directorship (where Company 'Microsoft' is directed by Person 'Gates') began on appointment Date '20/02/1981';",
|
86
|
+
[{:facts=>Set["Company has Company Name 'Microsoft'", "Company is directed by Person", "Directorship began on appointment-Date '20/02/1981'", "Person is called Person Name 'Gates'"], :instances=>Set["Person is identified by Person Name where Person is called Person Name 'Gates'", "Company is identified by Company Name where Company has Company Name 'Microsoft'", "Company Name 'Microsoft'", "Directorship where Company is directed by Person", "Person Name 'Gates'", "Date '20/02/1981'"]}]
|
81
87
|
],
|
82
88
|
]
|
83
89
|
|
@@ -160,9 +166,18 @@ describe "Sample data" do
|
|
160
166
|
|
161
167
|
it "should handle #{source.inspect}" do
|
162
168
|
@text = SamplePrefix+source
|
163
|
-
pending if expected == :pending
|
169
|
+
#pending if expected == [:pending]
|
170
|
+
exception = nil
|
164
171
|
lambda do
|
165
|
-
|
172
|
+
begin
|
173
|
+
@vocabulary = ActiveFacts::Input::CQL.readstring(@text)
|
174
|
+
rescue => exception
|
175
|
+
if debug :exception
|
176
|
+
puts "#{exception.message}"
|
177
|
+
puts "\t#{exception.backtrace*"\n\t"}"
|
178
|
+
end
|
179
|
+
raise
|
180
|
+
end
|
166
181
|
end.should_not raise_error
|
167
182
|
result = instance_data(@vocabulary)
|
168
183
|
|
@@ -176,9 +191,18 @@ describe "Sample data" do
|
|
176
191
|
it "should de-duplicate #{source.inspect}" do
|
177
192
|
# Make sure you don't get anything duplicated
|
178
193
|
@text = SamplePrefix+source+source
|
179
|
-
pending if expected == :pending
|
194
|
+
#pending if expected == [:pending]
|
195
|
+
exception = nil
|
180
196
|
lambda do
|
181
|
-
|
197
|
+
begin
|
198
|
+
@vocabulary = ActiveFacts::Input::CQL.readstring(@text)
|
199
|
+
rescue => exception
|
200
|
+
if debug :exception
|
201
|
+
puts "#{exception.message}"
|
202
|
+
puts "\t#{exception.backtrace*"\n\t"}"
|
203
|
+
end
|
204
|
+
raise
|
205
|
+
end
|
182
206
|
end.should_not raise_error
|
183
207
|
result = instance_data(@vocabulary)
|
184
208
|
result[0].should == expected[0]
|
data/spec/cql_mysql_spec.rb
CHANGED
@@ -48,8 +48,7 @@ describe "CQL Loader with SQL output" do
|
|
48
48
|
sql_text = sql(vocabulary)
|
49
49
|
File.open(actual_file, "w") { |f| f.write sql_text }
|
50
50
|
|
51
|
-
|
52
|
-
# ("expected output file #{expected_file} not found")
|
51
|
+
pending("expected output file #{expected_file} not found") unless File.exists? expected_file
|
53
52
|
|
54
53
|
expected_text = File.open(expected_file) {|f| f.read }
|
55
54
|
broken = cql_mysql_failures[File.basename(actual_file, ".cql")]
|
data/spec/norma_ruby_sql_spec.rb
CHANGED
@@ -18,7 +18,6 @@ describe "Column lists from absorption compared with Ruby's" do
|
|
18
18
|
norma_ruby_failures = {
|
19
19
|
"UnaryIdentification" => "No PI for VisitStatus",
|
20
20
|
"BPMN" => "Has duplicate column names",
|
21
|
-
"Diplomacy" => "Has duplicate column names",
|
22
21
|
}
|
23
22
|
|
24
23
|
# Generate and return the Ruby for the given vocabulary
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activefacts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 45
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
|
-
-
|
10
|
-
version: 0.8.
|
9
|
+
- 9
|
10
|
+
version: 0.8.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Clifford Heath
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-27 00:00:00 +10:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|