activefacts 0.8.6 → 0.8.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. data/Manifest.txt +33 -2
  2. data/README.rdoc +30 -36
  3. data/Rakefile +16 -20
  4. data/bin/afgen +17 -11
  5. data/bin/cql +313 -36
  6. data/download.html +43 -19
  7. data/examples/CQL/Address.cql +15 -15
  8. data/examples/CQL/Blog.cql +8 -8
  9. data/examples/CQL/CompanyDirectorEmployee.cql +6 -5
  10. data/examples/CQL/Death.cql +3 -3
  11. data/examples/CQL/Diplomacy.cql +48 -0
  12. data/examples/CQL/Genealogy.cql +41 -41
  13. data/examples/CQL/Insurance.cql +311 -0
  14. data/examples/CQL/JoinEquality.cql +35 -0
  15. data/examples/CQL/Marriage.cql +1 -1
  16. data/examples/CQL/Metamodel.cql +290 -185
  17. data/examples/CQL/MetamodelNext.cql +420 -0
  18. data/examples/CQL/Monogamy.cql +24 -0
  19. data/examples/CQL/MonthInSeason.cql +27 -0
  20. data/examples/CQL/Moon.cql +23 -0
  21. data/examples/CQL/MultiInheritance.cql +4 -4
  22. data/examples/CQL/NonRoleId.cql +14 -0
  23. data/examples/CQL/OddIdentifier.cql +18 -0
  24. data/examples/CQL/OilSupply.cql +24 -24
  25. data/examples/CQL/OneToOnes.cql +17 -0
  26. data/examples/CQL/Orienteering.cql +55 -55
  27. data/examples/CQL/OrienteeringER.cql +58 -0
  28. data/examples/CQL/PersonPlaysGame.cql +2 -2
  29. data/examples/CQL/RedundantDependency.cql +34 -0
  30. data/examples/CQL/SchoolActivities.cql +5 -5
  31. data/examples/CQL/SeparateSubtype.cql +28 -0
  32. data/examples/CQL/ServiceDirector.cql +283 -0
  33. data/examples/CQL/SimplestUnary.cql +2 -2
  34. data/examples/CQL/SubtypePI.cql +11 -11
  35. data/examples/CQL/Supervision.cql +38 -0
  36. data/examples/CQL/Tests.Test5.Load.cql +38 -0
  37. data/examples/CQL/WaiterTips.cql +33 -0
  38. data/examples/CQL/Warehousing.cql +55 -53
  39. data/examples/CQL/WindowInRoomInBldg.cql +9 -9
  40. data/examples/CQL/unit.cql +433 -544
  41. data/examples/index.html +314 -170
  42. data/examples/intro.html +6 -176
  43. data/examples/local.css +8 -4
  44. data/index.html +40 -25
  45. data/lib/activefacts/api/concept.rb +2 -2
  46. data/lib/activefacts/api/constellation.rb +4 -4
  47. data/lib/activefacts/api/instance.rb +2 -2
  48. data/lib/activefacts/api/instance_index.rb +4 -0
  49. data/lib/activefacts/api/numeric.rb +3 -1
  50. data/lib/activefacts/api/role.rb +1 -1
  51. data/lib/activefacts/api/standard_types.rb +23 -16
  52. data/lib/activefacts/api/support.rb +3 -1
  53. data/lib/activefacts/api/vocabulary.rb +4 -0
  54. data/lib/activefacts/cql/CQLParser.treetop +87 -39
  55. data/lib/activefacts/cql/Concepts.treetop +95 -69
  56. data/lib/activefacts/cql/Context.treetop +11 -2
  57. data/lib/activefacts/cql/Expressions.treetop +23 -59
  58. data/lib/activefacts/cql/FactTypes.treetop +141 -95
  59. data/lib/activefacts/cql/Language/English.treetop +33 -21
  60. data/lib/activefacts/cql/LexicalRules.treetop +6 -1
  61. data/lib/activefacts/cql/Terms.treetop +75 -26
  62. data/lib/activefacts/cql/ValueTypes.treetop +52 -54
  63. data/lib/activefacts/cql/compiler.rb +46 -1691
  64. data/lib/activefacts/cql/compiler/constraint.rb +602 -0
  65. data/lib/activefacts/cql/compiler/entity_type.rb +425 -0
  66. data/lib/activefacts/cql/compiler/fact.rb +300 -0
  67. data/lib/activefacts/cql/compiler/fact_type.rb +230 -0
  68. data/lib/activefacts/cql/compiler/reading.rb +832 -0
  69. data/lib/activefacts/cql/compiler/shared.rb +109 -0
  70. data/lib/activefacts/cql/compiler/value_type.rb +104 -0
  71. data/lib/activefacts/cql/parser.rb +132 -81
  72. data/lib/activefacts/generate/cql.rb +397 -274
  73. data/lib/activefacts/generate/oo.rb +13 -12
  74. data/lib/activefacts/generate/ordered.rb +107 -117
  75. data/lib/activefacts/generate/ruby.rb +34 -38
  76. data/lib/activefacts/generate/sql/mysql.rb +62 -45
  77. data/lib/activefacts/generate/sql/server.rb +59 -42
  78. data/lib/activefacts/input/cql.rb +6 -3
  79. data/lib/activefacts/input/orm.rb +991 -557
  80. data/lib/activefacts/persistence/columns.rb +16 -12
  81. data/lib/activefacts/persistence/foreignkey.rb +7 -4
  82. data/lib/activefacts/persistence/index.rb +3 -4
  83. data/lib/activefacts/persistence/reference.rb +5 -2
  84. data/lib/activefacts/support.rb +20 -14
  85. data/lib/activefacts/version.rb +1 -1
  86. data/lib/activefacts/vocabulary.rb +1 -0
  87. data/lib/activefacts/vocabulary/extensions.rb +328 -44
  88. data/lib/activefacts/vocabulary/metamodel.rb +145 -20
  89. data/lib/activefacts/vocabulary/verbaliser.rb +621 -0
  90. data/spec/absorption_spec.rb +4 -4
  91. data/spec/api/value_type.rb +1 -1
  92. data/spec/cql/context_spec.rb +45 -22
  93. data/spec/cql/deontic_spec.rb +88 -0
  94. data/spec/cql/matching_spec.rb +517 -0
  95. data/spec/cql/samples_spec.rb +88 -31
  96. data/spec/cql/unit_spec.rb +58 -37
  97. data/spec/cql_cql_spec.rb +12 -7
  98. data/spec/cql_mysql_spec.rb +3 -7
  99. data/spec/cql_parse_spec.rb +0 -4
  100. data/spec/cql_ruby_spec.rb +1 -4
  101. data/spec/cql_sql_spec.rb +5 -18
  102. data/spec/cql_symbol_tables_spec.rb +3 -0
  103. data/spec/cqldump_spec.rb +0 -2
  104. data/spec/helpers/array_matcher.rb +35 -0
  105. data/spec/helpers/ctrl_c_support.rb +52 -0
  106. data/spec/helpers/diff_matcher.rb +38 -0
  107. data/spec/helpers/file_matcher.rb +5 -3
  108. data/spec/helpers/string_matcher.rb +39 -0
  109. data/spec/helpers/test_parser.rb +13 -0
  110. data/spec/norma_cql_spec.rb +13 -5
  111. data/spec/norma_ruby_spec.rb +11 -3
  112. data/spec/{absorption_ruby_spec.rb → norma_ruby_sql_spec.rb} +37 -32
  113. data/spec/norma_sql_spec.rb +11 -5
  114. data/spec/norma_tables_spec.rb +33 -29
  115. data/spec/spec_helper.rb +4 -1
  116. data/status.html +92 -23
  117. metadata +102 -36
  118. data/lib/activefacts/generate/cql/html.rb +0 -403
data/examples/index.html CHANGED
@@ -14,261 +14,405 @@
14
14
  <!-- Things to show only in the offline version -->
15
15
  <div class="localnav offline noprint">
16
16
  <ul>
17
- <li id="nav-home"><a href="/ActiveFacts/" title="Home">Home</a></li>
18
- <li><a title="CompanyDirectorEmployee" href="#CompanyDirectorEmployee"> Company and People </a></li>
19
- <li><a title="Blog" href="#Blog"> Blog </a></li>
20
- <li><a title="SchoolActivities" href="#SchoolActivities"> School Activities </a></li>
21
- <li><a title="Orienteering" href="#Orienteering"> Orienteering </a></li>
17
+ <li id="nav-home"><a href="/" title="Home">Home</a></li>
18
+ <li><a href="/ActiveFacts/" title="ActiveFacts Home">ActiveFacts Home</a></li>
19
+ <li><a title="Start Here" href="#CompanyDirectorEmployee"> Start Here </a></li>
22
20
  <li><a title="Metamodel" href="#Metamodel"> Metamodel </a></li>
23
21
  <li><a title="All Examples" href="#AllExamples"> Table of all examples </a></li>
24
22
  </ul>
25
23
  </div>
26
24
 
27
- <p>The example models presented here were created as Object Role Models
28
- using <a href="http://www.ormfoundation.org/files/">NORMA</a>. The
29
- ActiveFacts generator <em>afgen</em> was used to convert them from ORM2
30
- to CQL, SQL and Ruby code using ActiveFacts. They're all available here
31
- as PNG images and in the other formats.
25
+ <p> ActiveFacts converts fact-oriented models into matching object-oriented and
26
+ relational models. It accepts models in <a href="../CQLIntroduction.html">the Constellation Query Language</a> (CQL)
27
+ or <a href="http://www.ormfoundation.org/files/">NORMA</a>, and emits CQL,
28
+ Ruby, or SQL. This page contains many examples.</p>
32
29
 
33
- </p><p>
34
- To make a start learning Object Role Modeling, read the
35
- <a href="intro.html">Introduction to ORM2</a> or check the Resources page
36
- for other sites.
37
-
38
- </p><p>
39
- The CQL code here formatted and laid out is <em>exactly</em> as it was generated.
40
- It's interesting how cleverly the semantic clustering algorithm works!
41
-
42
- </p><p class="offline">
43
- If you're looking at a Subversion checkout of the project on Windows,
44
- and have Visual Studio (pro) with NORMA installed, you can open
45
- the solution <a href="norma/ExampleModels.sln">here</a>.
46
- Otherwise, you won't be able to edit the ORM2 files, but never fear,
47
- you can do all the same things by editing the CQL text.
30
+ <p>The CQL files look like hand-written code, but they aren't.
31
+ They're generated from the ORM2 files, and have not been edited.
32
+ You can of course write them by hand.
48
33
  </p>
49
34
 
50
- <a name="CompanyDirectorEmployee"></a>
51
- <h4>CompanyDirectorEmployee</h4>
52
- <p>This is my main introductory model. It shows the relationships of a person
53
- to a company of which they are a director or employee.
35
+ <p>
36
+ The ActiveFacts generator <em>afgen</em> does semantic analysis to convert these
37
+ input files to SQL or Ruby, using the relational and object-oriented mapping algorithms.
38
+ The Ruby code uses the Constellation API provided by the <em>activefacts</em> gem.
54
39
  </p>
55
40
 
56
- <a name="Blog"></a>
57
- <h4>Blog</h4>
58
- <p>The Blog model supports a hierarchy of topics, Posts by Authors, each Post
59
- consisting of a series of styled Paragraphs. Comments may be made on individual
60
- Paragraphs.
61
- </p>
62
-
63
- <a name="SchoolActivities"></a>
64
- <h4>SchoolActivities</h4>
65
- <p>This model represents students representing their school in school-sanctioned activities.
66
- It includes the ternary StudentParticipation <em>Fact Type</em>, which represents a student's
67
- participation in a school-sanctioned activity.
68
- The model has constraints that allow a given Student to participate only in a given
69
- Activity for a single School, only representing the School in which they're enrolled, and
70
- only if the School sanctions that activity.
71
- </p>
41
+ <p>
42
+ To make a start learning Object Role Modeling, read the
43
+ <a href="intro.html">Introduction to ORM2</a> or check the Resources page
44
+ for other sites.
72
45
 
73
- <a name="Orienteering"></a>
74
- <h4>Orienteering </h4>
75
- <p>A model for the sport of Orienteering, broken into three diagrams for
76
- administration, registration and scoring. These diagrams also reflect areas
77
- of interest to folk in different roles, an idea which could inspire the use
78
- of the division as security domains. However, for an object showing on multiple
79
- diagrams, ORM2 doesn't indicate with which diagram it has a primary affinity.
80
- In CQL, it might be better to structure this as three separate <em>vocabularies</em>.
81
-
82
- </p><p>
83
- The author is involved in orienteering in his local association (which publishes a
84
- program and results at <a href="http://street.orienteering.com.au">street.orienteering.com.au</a>
85
- and the <a href="http://www.vicorienteering.asn.au/parkstreet/"> Victorian Orienteering
86
- Association</a>) and he used this model to construct a scoring system using low-power
87
- microprocessors distributed around the course.
88
46
  </p>
89
47
 
90
- <a name="Metamodel"></a>
91
- <h4>Metamodel </h4>
92
- <p>The Metamodel encodes the meaning of an ORM2 or CQL model. All features of the
93
- ORM2 and CQL languages have a representation here, as well as a few CQL features
94
- that haven't yet been implemented yet. The generated Ruby code is <em>used as the
95
- intermediate form</em> inside the CQL language implementation.
48
+ <p class="offline">
49
+ If you're looking at a git clone of this project, and have Visual Studio (pro)
50
+ on Windows with NORMA installed, you can open the Visual Studio solution
51
+ <a href="norma/ExampleModels.sln">here</a>.
52
+ Otherwise, you won't be able to edit the ORM2 files, but never fear,
53
+ you can do all the same things by editing the CQL text.
96
54
  </p>
97
55
 
98
- <a name="AllExamples"></a>
56
+ <a id="AllExamples"></a>
99
57
 
100
- <h3>Table of all examples</h3>
101
- <!-- Table below here is generated automatically -->
58
+ <h3>Table of examples</h3>
102
59
  <table class="examples" width="100%">
103
- <tr>
60
+
61
+ <!--tr>
104
62
  <th>Model Name</th>
105
63
  <td></td>
106
64
  <td></td>
107
65
  <td></td>
108
- <th>Diagrams</th>
109
- </tr>
110
-
111
- <tr>
112
- <td>Address</td>
113
- <td><a href="CQL/Address.cql">CQL</a></td>
66
+ <th>ORM2 Diagrams</th-->
67
+
68
+ <tr class="odd">
69
+ <td class="title">
70
+ <a id="Address" href="CQL/Address.cql">CQL</a>
71
+ <span>Address</span>
72
+ <div class="diagrams">
73
+ <a href="images/Address.png">diagram</a>
74
+ </div>
75
+ </td>
114
76
  <td><a href="ruby/Address.rb">Ruby</a></td>
115
77
  <td><a href="SQL/Address.sql">SQL</a></td>
116
78
  <td>
117
- <a href="images/Address.png">Address</a><br>
118
79
  </tr>
119
-
120
- <tr>
121
- <td>Blog</td>
122
- <td><a href="CQL/Blog.cql">CQL</a></td>
80
+ <tr class="odd"><td colspan="5">
81
+ Shows how the relational mapping algorithm makes the minimum number of tables
82
+ <a href="norma/Address.orm">xml</a>
83
+ </td></tr>
84
+
85
+ <tr class="even">
86
+ <td class="title">
87
+ <a id="Blog" href="CQL/Blog.cql">CQL</a>
88
+ <span>Blog</span>
89
+ <div class="diagrams">
90
+ <a href="images/Blog.png">diagram</a>
91
+ </div>
92
+ </td>
123
93
  <td><a href="ruby/Blog.rb">Ruby</a></td>
124
94
  <td><a href="SQL/Blog.sql">SQL</a></td>
125
95
  <td>
126
- <a href="images/Blog.png">Blog</a><br>
127
96
  </tr>
128
-
129
- <tr>
130
- <td>CompanyDirectorEmployee</td>
131
- <td><a href="CQL/CompanyDirectorEmployee.cql">CQL</a></td>
97
+ <tr class="even"><td colspan="5">
98
+ The Blog model supports a hierarchy of topics, Posts by Authors, each Post
99
+ consisting of a series of styled Paragraphs. Comments may be made on individual
100
+ Paragraphs. <a href="norma/Blog.orm">xml</a>
101
+ </td></tr>
102
+
103
+ <tr class="odd">
104
+ <td class="title">
105
+ <a id="CompanyDirectorEmployee" href="CQL/CompanyDirectorEmployee.cql">CQL</a>
106
+ <span>CompanyDirectorEmployee</span>
107
+ <div class="diagrams">
108
+ <a href="images/CompanyDirectorEmployee.png">diagram</a>
109
+ </div>
110
+ </td>
132
111
  <td><a href="ruby/CompanyDirectorEmployee.rb">Ruby</a></td>
133
112
  <td><a href="SQL/CompanyDirectorEmployee.sql">SQL</a></td>
134
113
  <td>
135
- <a href="images/CompanyDirectorEmployee.png">CompanyDirectorEmployee</a><br>
136
114
  </tr>
137
-
138
- <tr>
139
- <td>Death</td>
140
- <td><a href="CQL/Death.cql">CQL</a></td>
115
+ <tr class="odd"><td colspan="5">
116
+ This model shows the relationships of a person to a company of which they are a director or employee. <a href="norma/CompanyDirectorEmployee.orm">xml</a>
117
+ </td></tr>
118
+
119
+ <tr class="even">
120
+ <td class="title">
121
+ <a id="Death" href="CQL/Death.cql">CQL</a>
122
+ <span>Death</span>
123
+ <div class="diagrams">
124
+ <a href="images/Death.png">diagram</a>
125
+ </div>
126
+ </td>
141
127
  <td><a href="ruby/Death.rb">Ruby</a></td>
142
128
  <td><a href="SQL/Death.sql">SQL</a></td>
143
129
  <td>
144
- <a href="images/Death.png">Death</a><br>
145
130
  </tr>
146
-
147
- <tr>
148
- <td>Genealogy</td>
149
- <td><a href="CQL/Genealogy.cql">CQL</a></td>
131
+ <tr class="even"><td colspan="5">
132
+ This model shows a objectified unary fact type. <a href="norma/Death.orm">xml</a>
133
+ </td></tr>
134
+
135
+ <tr class="odd">
136
+ <td class="title">
137
+ <a id="Genealogy" href="CQL/Genealogy.cql">CQL</a>
138
+ <span>Genealogy</span>
139
+ <div class="diagrams">
140
+ <a href="images/Genealogy.png">diagram</a>
141
+ </div>
142
+ </td>
150
143
  <td><a href="ruby/Genealogy.rb">Ruby</a></td>
151
144
  <td><a href="SQL/Genealogy.sql">SQL</a></td>
152
145
  <td>
153
- <a href="images/Genealogy.png">Genealogy</a><br>
154
146
  </tr>
155
-
156
- <tr>
157
- <td>Insurance</td>
158
- <td><a href="CQL/Insurance.cql">CQL</a></td>
147
+ <tr class="odd"><td colspan="5">
148
+ An event-based model for Genealogy which allows for different versions of the same fact
149
+ to be claimed by different sources, for use in reconciling contradictory information. <a href="norma/Genealogy.orm">xml</a>
150
+ </td></tr>
151
+
152
+ <tr class="even">
153
+ <td class="title">
154
+ <a id="Insurance" href="CQL/Insurance.cql">CQL</a>
155
+ <span>Insurance</span>
156
+ <div class="diagrams">
157
+ <a href="images/Insurance/Insurance.png">Insurance</a>
158
+ <a href="images/Insurance/Person.png">Person</a>
159
+ <a href="images/Insurance/Policy.png">Policy</a>
160
+ <a href="images/Insurance/Claim.png">Claim</a>
161
+ <a href="images/Insurance/VehicleIncident.png">VehicleIncident</a>
162
+ <a href="images/Insurance/Related.png">Related</a>
163
+ </div>
164
+ </td>
159
165
  <td><a href="ruby/Insurance.rb">Ruby</a></td>
160
166
  <td><a href="SQL/Insurance.sql">SQL</a></td>
167
+ <td></td>
168
+ </tr>
169
+ <tr class="even"><td colspan="5">
170
+ A partial model for an insurance company's claims management, extended into automotive insurance claims
171
+ </td></tr>
172
+
173
+ <tr class="odd">
174
+ <td class="title">
175
+ <a id="JoinEquality" href="CQL/JoinEquality.cql">CQL</a>
176
+ <span>JoinEquality</span>
177
+ <div class="diagrams">
178
+ <a href="images/JoinEquality.png">diagram</a>
179
+ </div>
180
+ </td>
181
+ <td><a href="ruby/JoinEquality.rb">Ruby</a></td>
182
+ <td><a href="SQL/JoinEquality.sql">SQL</a></td>
161
183
  <td>
162
- <a href="images/Insurance/Claim.png">Claim</a><br>
163
- <a href="images/Insurance/Insurance.png">Insurance</a><br>
164
- <a href="images/Insurance/Person.png">Person</a><br>
165
- <a href="images/Insurance/Policy.png">Policy</a><br>
166
184
  </tr>
167
-
168
- <tr>
169
- <td>Marriage</td>
170
- <td><a href="CQL/Marriage.cql">CQL</a></td>
185
+ <tr class="odd"><td colspan="5">
186
+ An example of a join equality constraint. The highlighted constraint requires that
187
+ tickets issued for an event are for a seat at the venue where that event will be held. <a href="norma/JoinEquality.orm">xml</a>
188
+ </td></tr>
189
+
190
+ <tr class="even">
191
+ <td class="title">
192
+ <a id="Marriage" href="CQL/Marriage.cql">CQL</a>
193
+ <span>Marriage</span>
194
+ <div class="diagrams">
195
+ <a href="images/Marriage.png">diagram</a>
196
+ </div>
197
+ </td>
171
198
  <td><a href="ruby/Marriage.rb">Ruby</a></td>
172
199
  <td><a href="SQL/Marriage.sql">SQL</a></td>
173
200
  <td>
174
- <a href="images/Marriage.png">Marriage</a><br>
175
201
  </tr>
176
-
177
- <tr>
178
- <td>Metamodel</td>
179
- <td><a href="CQL/Metamodel.cql">CQL</a></td>
202
+ <tr class="even"><td colspan="5">
203
+ This shows a conventional model of marriage, to demonstrate the relational mapping (view the SQL). <a href="norma/Marriage.orm">xml</a>
204
+ </td></tr>
205
+
206
+ <tr class="odd">
207
+ <td class="title">
208
+ <a id="Metamodel" href="CQL/Metamodel.cql">CQL</a>
209
+ <span>Metamodel</span>
210
+ <div class="diagrams">
211
+ <a href="images/Metamodel/Objects.png">Objects</a>
212
+ <a href="images/Metamodel/Terms.png">Terms</a>
213
+ <a href="images/Metamodel/ValueTypes.png">ValueTypes</a>
214
+ <a href="images/Metamodel/Constraints.png">Constraints</a>
215
+ <a href="images/Metamodel/Units.png">Units</a>
216
+ <a href="images/Metamodel/Joins.png">Joins</a>
217
+ <a href="images/Metamodel/ValueTypes.png">ValueTypes</a>
218
+ <a href="images/Metamodel/Populations.png">Populations</a>
219
+ <a href="images/Metamodel/Context.png">Context</a>
220
+ <a href="images/Metamodel/Diagrams.png">Diagrams</a>
221
+ </div>
222
+ </td>
180
223
  <td><a href="ruby/Metamodel.rb">Ruby</a></td>
181
224
  <td><a href="SQL/Metamodel.sql">SQL</a></td>
182
225
  <td>
183
- <a href="images/Metamodel/Constraints.png">Constraints</a><br>
184
- <a href="images/Metamodel/Import.png">Import</a><br>
185
- <a href="images/Metamodel/Objects.png">Objects</a><br>
186
- <a href="images/Metamodel/Populations.png">Populations</a><br>
187
- <a href="images/Metamodel/Values.png">Values</a><br>
188
226
  </tr>
189
-
190
- <tr>
191
- <td>MultiInheritance</td>
192
- <td><a href="CQL/MultiInheritance.cql">CQL</a></td>
227
+ <tr class="odd"><td colspan="5">
228
+ This is the metamodel of ActiveFacts itself.
229
+ The generated Ruby code provides the intermediate representation for the compiler!
230
+ <br>
231
+ <br>
232
+ The Metamodel encodes the meaning of an ORM2 or CQL model. All features of the
233
+ ORM2 and CQL languages have a representation here, as well as a few CQL features
234
+ that haven't yet been implemented yet.
235
+ </td></tr>
236
+
237
+ <tr class="even">
238
+ <td class="title">
239
+ <a id="MultiInheritance" href="CQL/MultiInheritance.cql">CQL</a>
240
+ <span>MultiInheritance</span>
241
+ <div class="diagrams">
242
+ <a href="images/MultiInheritance.png">diagram</a>
243
+ </div>
244
+ </td>
193
245
  <td><a href="ruby/MultiInheritance.rb">Ruby</a></td>
194
246
  <td><a href="SQL/MultiInheritance.sql">SQL</a></td>
195
247
  <td>
196
- <a href="images/MultiInheritance.png">MultiInheritance</a><br>
197
248
  </tr>
198
-
199
- <tr>
200
- <td>OilSupply</td>
201
- <td><a href="CQL/OilSupply.cql">CQL</a></td>
249
+ <tr class="even"><td colspan="5">
250
+ An example of multiple inheritance. The solid subtype connectors show the identification
251
+ path (for example, an AustralianEmployee is identified by his/her EmployeeID). <a href="norma/MultiInheritance.orm">xml</a>
252
+ </td></tr>
253
+
254
+ <tr class="odd">
255
+ <td class="title">
256
+ <a id="OilSupply" href="CQL/OilSupply.cql">CQL</a>
257
+ <span>OilSupply</span>
258
+ <div class="diagrams">
259
+ <a href="images/OilSupply.png">diagram</a><br>
260
+ </div>
261
+ </td>
202
262
  <td><a href="ruby/OilSupply.rb">Ruby</a></td>
203
263
  <td><a href="SQL/OilSupply.sql">SQL</a></td>
204
264
  <td>
205
- <a href="images/OilSupply.png">OilSupply</a><br>
206
265
  </tr>
207
-
208
- <tr>
209
- <td>Orienteering</td>
210
- <td><a href="CQL/Orienteering.cql">CQL</a></td>
266
+ <tr class="odd"><td colspan="5">
267
+ A model of the supply and demand for refined oil.
268
+ A populated database can be used to optimise profitability by minimising transport costs,
269
+ maximise supply by allowing substitution of compatible products (with compatibility depending on season)
270
+ and also to predict shortages. <a href="norma/OilSupply.orm">xml</a>
271
+ </td></tr>
272
+
273
+ <tr class="even">
274
+ <td class="title">
275
+ <a id="Orienteering" href="CQL/Orienteering.cql">CQL</a>
276
+ <span>Orienteering</span>
277
+ <div class="diagrams">
278
+ <a href="images/Orienteering/Administration.png">Administration</a>
279
+ <a href="images/Orienteering/Registration.png">Registration</a>
280
+ <a href="images/Orienteering/Scoring.png">Scoring</a>
281
+ </div>
282
+ </td>
211
283
  <td><a href="ruby/Orienteering.rb">Ruby</a></td>
212
284
  <td><a href="SQL/Orienteering.sql">SQL</a></td>
213
285
  <td>
214
- <a href="images/Orienteering/Administration.png">Administration</a><br>
215
- <a href="images/Orienteering/Registration.png">Registration</a><br>
216
- <a href="images/Orienteering/Scoring.png">Scoring</a><br>
217
286
  </tr>
218
-
219
- <tr>
220
- <td>OrienteeringER</td>
221
- <td><a href="CQL/OrienteeringER.cql">CQL</a></td>
287
+ <tr class="even"><td colspan="5">
288
+ A model for the sport of Orienteering, broken into three diagrams. <a href="norma/Orienteering.orm">xml</a>
289
+ </td></tr>
290
+
291
+ <tr class="odd">
292
+ <td class="title">
293
+ <a id="OrienteeringER" href="CQL/OrienteeringER.cql">CQL</a>
294
+ <span>OrienteeringER</span>
295
+ <div class="diagrams">
296
+ <a href="images/OrienteeringER.png">diagram</a>
297
+ </div>
298
+ </td>
222
299
  <td><a href="ruby/OrienteeringER.rb">Ruby</a></td>
223
300
  <td><a href="SQL/OrienteeringER.sql">SQL</a></td>
224
301
  <td>
225
- <a href="images/OrienteeringER.png">OrienteeringER</a><br>
226
302
  </tr>
227
-
228
- <tr>
229
- <td>PersonPlaysGame</td>
230
- <td><a href="CQL/PersonPlaysGame.cql">CQL</a></td>
303
+ <tr class="odd"><td colspan="5">
304
+ This is an illegal ORM2 model, for illustrative purposes. It contains a compound fact type. <a href="norma/OrienteeringER.orm">xml</a>
305
+ </td></tr>
306
+
307
+ <tr class="even">
308
+ <td class="title">
309
+ <a id="PersonPlaysGame" href="CQL/PersonPlaysGame.cql">CQL</a>
310
+ <span>PersonPlaysGame</span>
311
+ <div class="diagrams">
312
+ <a href="images/PersonPlaysGame.png">diagram</a>
313
+ </div>
314
+ </td>
231
315
  <td><a href="ruby/PersonPlaysGame.rb">Ruby</a></td>
232
316
  <td><a href="SQL/PersonPlaysGame.sql">SQL</a></td>
233
317
  <td>
234
- <a href="images/PersonPlaysGame.png">PersonPlaysGame</a><br>
235
318
  </tr>
236
-
237
- <tr>
238
- <td>SchoolActivities</td>
239
- <td><a href="CQL/SchoolActivities.cql">CQL</a></td>
240
- <td><a href="ruby/SchoolActivities.rb">Ruby</a></td>
241
- <td><a href="SQL/SchoolActivities.sql">SQL</a></td>
319
+ <tr class="even"><td colspan="5">
320
+ Perhaps the simplest possible model, which maps to a single table. <a href="norma/PersonPlaysGame.orm">xml</a>
321
+ </td></tr>
322
+
323
+ <tr class="odd">
324
+ <td class="title">
325
+ <a id="RedundantDependency" href="CQL/RedundantDependency.cql">CQL</a>
326
+ <span>RedundantDependency</span>
327
+ <div class="diagrams">
328
+ <a href="images/RedundantDependency.png">diagram</a>
329
+ </div>
330
+ </td>
331
+ <td><a href="ruby/RedundantDependency.rb">Ruby</a></td>
332
+ <td><a href="SQL/RedundantDependency.sql">SQL</a></td>
242
333
  <td>
243
- <a href="images/SchoolActivities.png">SchoolActivities</a><br>
244
334
  </tr>
245
-
246
- <tr>
247
- <td>SimplestUnary</td>
248
- <td><a href="CQL/SimplestUnary.cql">CQL</a></td>
249
- <td><a href="ruby/SimplestUnary.rb">Ruby</a></td>
250
- <td><a href="SQL/SimplestUnary.sql">SQL</a></td>
335
+ <tr class="odd"><td colspan="5">
336
+ This model illustrates an outstanding problem in some fact-oriented modelling
337
+ tools, including ActiveFacts. The problem is that the Address table contains
338
+ two copies of the same value, StateOrProvinceId. <a href="norma/RedundantDependency.orm">xml</a>
339
+ </td></tr>
340
+
341
+ <tr class="even">
342
+ <td class="title">
343
+ <a id="SchoolActivities" href="CQL/SchoolActivities.cql">CQL</a>
344
+ <span>SchoolActivities</span>
345
+ <div class="diagrams">
346
+ <a href="images/SchoolActivities.png">diagram</a>
347
+ </div>
348
+ </td>
349
+ <td><a href="ruby/SchoolActivities.rb">Ruby</a></td>
350
+ <td><a href="SQL/SchoolActivities.sql">SQL</a></td>
251
351
  <td>
252
- <a href="images/SimplestUnary.png">SimplestUnary</a><br>
253
352
  </tr>
254
-
255
- <tr>
256
- <td>Warehousing</td>
257
- <td><a href="CQL/Warehousing.cql">CQL</a></td>
353
+ <tr class="even"><td colspan="5">
354
+ This model represents students representing their school in school-sanctioned activities.
355
+ It includes the ternary StudentParticipation <em>Fact Type</em>, which represents a student's
356
+ participation in a school-sanctioned activity.
357
+ The model has constraints that allow a given Student to participate only in a given
358
+ Activity for a single School, only representing the School in which they're enrolled, and
359
+ only if the School sanctions that activity. <a href="norma/SchoolActivities.orm">xml</a>
360
+ </td></tr>
361
+
362
+ <tr class="odd">
363
+ <td class="title">
364
+ <a id="Warehousing" href="CQL/Warehousing.cql">CQL</a>
365
+ <span>Warehousing</span>
366
+ <div class="diagrams">
367
+ <a href="images/Warehousing.png">diagram</a>
368
+ </div>
369
+ </td>
258
370
  <td><a href="ruby/Warehousing.rb">Ruby</a></td>
259
371
  <td><a href="SQL/Warehousing.sql">SQL</a></td>
260
372
  <td>
261
- <a href="images/Warehousing.png">Warehousing</a><br>
262
373
  </tr>
263
-
264
- <tr>
265
- <td>WindowInRoomInBldg</td>
266
- <td><a href="CQL/WindowInRoomInBldg.cql">CQL</a></td>
374
+ <tr class="odd"><td colspan="5">
375
+ Based on a classic model of warehousing, it records stock levels for every product
376
+ in each bin in every warehouse, and allows incoming and outgoing products to be
377
+ allocated to be allocated to orders, including requests for transfers between
378
+ warehouses. An order does not have to be shipped in a single shipment, but each
379
+ item must be checked off for each shipment. <a href="norma/Warehousing.orm">xml</a>
380
+ </td></tr>
381
+
382
+ <tr class="even">
383
+ <td class="title">
384
+ <a id="Unit" href="unit.cql">CQL</a>
385
+ <span>Unit conversions</span>
386
+ </td>
387
+ <td></td>
388
+ <td></td>
389
+ <td>
390
+ </tr>
391
+ <tr class="even"><td colspan="5">
392
+ This CQL file contains an extensive library of fundamental units and unit conversions.
393
+ These definitions can be used with your value types, so that queries can convert values
394
+ from any compatible units.
395
+ </td></tr>
396
+
397
+ <tr class="odd">
398
+ <td class="title">
399
+ <a id="WindowInRoomInBldg" href="CQL/WindowInRoomInBldg.cql">CQL</a>
400
+ <span>WindowInRoomInBldg</span>
401
+ <div class="diagrams">
402
+ <a href="images/WindowInRoomInBldg.png">diagram</a>
403
+ </div>
404
+ </td>
267
405
  <td><a href="ruby/WindowInRoomInBldg.rb">Ruby</a></td>
268
406
  <td><a href="SQL/WindowInRoomInBldg.sql">SQL</a></td>
269
407
  <td>
270
- <a href="images/WindowInRoomInBldg.png">WindowInRoomInBldg</a><br>
271
408
  </tr>
409
+ <tr class="odd"><td colspan="5">
410
+ This model shows how object types can get absorbed into others for efficient storage.
411
+ In this case, every window is in a wall, every wall in a room, and every room in a
412
+ building - yet only one table is needed to store a record of all windows. Try adding
413
+ further properties to a room, and see what happens to the relational form! <a href="norma/WindowInRoomInBldg.orm">xml</a>
414
+ </td></tr>
415
+
272
416
  </table>
273
417
 
274
418
  </div>