activefacts-examples 1.7.1

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.
Files changed (262) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.rspec +1 -0
  4. data/.travis.yml +4 -0
  5. data/Gemfile +10 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +22 -0
  8. data/Rakefile +6 -0
  9. data/activefacts-examples.gemspec +26 -0
  10. data/cql/Address.cql +44 -0
  11. data/cql/Astronomy.cql +35 -0
  12. data/cql/Blog.cql +54 -0
  13. data/cql/CinemaBookings.cql +64 -0
  14. data/cql/CinemaTickets.cql +127 -0
  15. data/cql/CompanyDirectorEmployee.cql +56 -0
  16. data/cql/Death.cql +17 -0
  17. data/cql/Diplomacy.cql +48 -0
  18. data/cql/Genealogy.cql +98 -0
  19. data/cql/Health.cql +78 -0
  20. data/cql/Insurance.cql +320 -0
  21. data/cql/Marriage.cql +18 -0
  22. data/cql/Metamodel.cql +567 -0
  23. data/cql/Monogamy.cql +24 -0
  24. data/cql/MultiInheritance.cql +22 -0
  25. data/cql/MultipleSubtyping.cql +30 -0
  26. data/cql/NonRoleId.cql +14 -0
  27. data/cql/OddIdentifier.cql +18 -0
  28. data/cql/OilSupply.cql +53 -0
  29. data/cql/OneRoleNesting.cql +38 -0
  30. data/cql/OneToOnes.cql +17 -0
  31. data/cql/Orienteering.cql +111 -0
  32. data/cql/PartyModel.cql +38 -0
  33. data/cql/PersonPlaysGame.cql +18 -0
  34. data/cql/RedundantDependency.cql +34 -0
  35. data/cql/SchoolActivities.cql +33 -0
  36. data/cql/SeparateSubtype.cql +30 -0
  37. data/cql/ServiceDirector.cql +276 -0
  38. data/cql/SimplestUnary.cql +12 -0
  39. data/cql/Supervision.cql +34 -0
  40. data/cql/VenueSeating.cql +45 -0
  41. data/cql/WaiterTips.cql +33 -0
  42. data/cql/Warehousing.cql +101 -0
  43. data/cql/WindowInRoomInBldg.cql +28 -0
  44. data/cql/unit.cql +474 -0
  45. data/diagrams/json/Address.json +41 -0
  46. data/diagrams/json/Astronomy.json +31 -0
  47. data/diagrams/json/Blog.json +46 -0
  48. data/diagrams/json/CinemaBookings.json +53 -0
  49. data/diagrams/json/CinemaTickets.json +101 -0
  50. data/diagrams/json/CompanyDirectorEmployee.json +44 -0
  51. data/diagrams/json/Death.json +20 -0
  52. data/diagrams/json/Diplomacy.json +34 -0
  53. data/diagrams/json/Genealogy.json +78 -0
  54. data/diagrams/json/Insurance.json +259 -0
  55. data/diagrams/json/Marriage.json +21 -0
  56. data/diagrams/json/Metamodel.json +318 -0
  57. data/diagrams/json/Monogamy.json +22 -0
  58. data/diagrams/json/MultiInheritance.json +25 -0
  59. data/diagrams/json/MultipleSubtyping.json +22 -0
  60. data/diagrams/json/OilSupply.json +49 -0
  61. data/diagrams/json/OneRoleNesting.json +37 -0
  62. data/diagrams/json/Orienteering.json +94 -0
  63. data/diagrams/json/PersonPlaysGame.json +22 -0
  64. data/diagrams/json/RedundantDependency.json +33 -0
  65. data/diagrams/json/SchoolActivities.json +28 -0
  66. data/diagrams/json/SeparateSubtype.json +29 -0
  67. data/diagrams/json/SimplestUnary.json +15 -0
  68. data/diagrams/json/Supervision.json +27 -0
  69. data/diagrams/json/VenueSeating.json +40 -0
  70. data/diagrams/json/WaiterTips.json +29 -0
  71. data/diagrams/json/Warehousing.json +86 -0
  72. data/diagrams/json/WindowInRoomInBldg.json +31 -0
  73. data/images/Address.SQL.png +0 -0
  74. data/images/Address.png +0 -0
  75. data/images/Blog.png +0 -0
  76. data/images/CinemaBookings.png +0 -0
  77. data/images/CinemaTickets.png +0 -0
  78. data/images/CompanyDirectorEmployee.png +0 -0
  79. data/images/Death.png +0 -0
  80. data/images/Diplomacy.png +0 -0
  81. data/images/DumpMetamodel.bat +2 -0
  82. data/images/Genealogy.png +0 -0
  83. data/images/Insurance/Claim.png +0 -0
  84. data/images/Insurance/Insurance.png +0 -0
  85. data/images/Insurance/Person.png +0 -0
  86. data/images/Insurance/Policy.png +0 -0
  87. data/images/Insurance/Related.png +0 -0
  88. data/images/Insurance/VehicleIncident.png +0 -0
  89. data/images/Marriage.png +0 -0
  90. data/images/Metamodel/Concepts.png +0 -0
  91. data/images/Metamodel/Constraints.png +0 -0
  92. data/images/Metamodel/ContextNote.png +0 -0
  93. data/images/Metamodel/Diagrams.png +0 -0
  94. data/images/Metamodel/Language.png +0 -0
  95. data/images/Metamodel/Legacy.png +0 -0
  96. data/images/Metamodel/Objects.png +0 -0
  97. data/images/Metamodel/Populations.png +0 -0
  98. data/images/Metamodel/Query.png +0 -0
  99. data/images/Metamodel/Units.png +0 -0
  100. data/images/Metamodel/ValueConstraints.png +0 -0
  101. data/images/Metamodel/ValueTypes.png +0 -0
  102. data/images/MetamodelER.bcp +1 -0
  103. data/images/MetamodelER.pdf +0 -0
  104. data/images/MultiInheritance.png +0 -0
  105. data/images/NorthwindER.png +0 -0
  106. data/images/OilSupply.png +0 -0
  107. data/images/Orienteering/Administration.png +0 -0
  108. data/images/Orienteering/Registration.png +0 -0
  109. data/images/Orienteering/Scoring.png +0 -0
  110. data/images/PersonPlaysGame.png +0 -0
  111. data/images/RedundantDependency.png +0 -0
  112. data/images/SchoolActivities.png +0 -0
  113. data/images/SeparateSubtype.png +0 -0
  114. data/images/SimplestUnary.png +0 -0
  115. data/images/Supervision.png +0 -0
  116. data/images/VenueSeating.png +0 -0
  117. data/images/WaiterTips.png +0 -0
  118. data/images/Warehousing.png +0 -0
  119. data/images/WindowInRoomInBldg.png +0 -0
  120. data/metadata/json/Astronomy.json +175 -0
  121. data/metadata/json/CinemaBookings.json +354 -0
  122. data/metadata/json/CinemaTickets.json +768 -0
  123. data/metadata/json/CompanyDirectorEmployee.json +270 -0
  124. data/metadata/json/Diplomacy.json +186 -0
  125. data/metadata/json/Metamodel.json +3214 -0
  126. data/metadata/json/OilSupply.json +411 -0
  127. data/metadata/json/SeparateSubtype.json +157 -0
  128. data/metadata/json/Supervision.json +128 -0
  129. data/metadata/json/VenueSeating.json +209 -0
  130. data/orm/.gitignore +11 -0
  131. data/orm/Address.orm +1268 -0
  132. data/orm/Astronomy.orm +925 -0
  133. data/orm/Blog.orm +1711 -0
  134. data/orm/CinemaBookings.orm +1998 -0
  135. data/orm/CinemaTickets.orm +5060 -0
  136. data/orm/CompanyDirectorEmployee.orm +2094 -0
  137. data/orm/Death.orm +386 -0
  138. data/orm/Diplomacy.orm +1478 -0
  139. data/orm/ExampleModels2010.csproj +764 -0
  140. data/orm/ExampleModels2010.sln +16 -0
  141. data/orm/Genealogy.orm +3209 -0
  142. data/orm/Health.orm +2407 -0
  143. data/orm/Insurance.orm +12727 -0
  144. data/orm/Marriage.orm +493 -0
  145. data/orm/Metamodel.orm +20998 -0
  146. data/orm/Monogamy.orm +328 -0
  147. data/orm/MultiInheritance.orm +537 -0
  148. data/orm/MultipleSubtyping.orm +347 -0
  149. data/orm/OilSupply.orm +2533 -0
  150. data/orm/OneRoleNesting.orm +1237 -0
  151. data/orm/Orienteering.orm +3976 -0
  152. data/orm/PersonPlaysGame.orm +426 -0
  153. data/orm/RedundantDependency.orm +844 -0
  154. data/orm/SchoolActivities.orm +961 -0
  155. data/orm/SeparateSubtype.orm +821 -0
  156. data/orm/SimplestUnary.orm +172 -0
  157. data/orm/Supervision.orm +734 -0
  158. data/orm/VenueSeating.orm +1289 -0
  159. data/orm/WaiterTips.orm +789 -0
  160. data/orm/Warehousing.orm +3792 -0
  161. data/orm/WindowInRoomInBldg.orm +772 -0
  162. data/rails/models/Astronomy.models +17 -0
  163. data/rails/models/CinemaBookings.models +123 -0
  164. data/rails/models/CinemaTickets.models +192 -0
  165. data/rails/models/Diplomacy.models +126 -0
  166. data/rails/models/Metamodel.models +894 -0
  167. data/rails/models/OneRoleNesting.models +18 -0
  168. data/rails/models/SeparateSubtype.models +49 -0
  169. data/rails/models/VenueSeating.models +70 -0
  170. data/rails/schema/Astronomy.schema.rb +25 -0
  171. data/rails/schema/CinemaBookings.schema.rb +78 -0
  172. data/rails/schema/CinemaTickets.schema.rb +132 -0
  173. data/rails/schema/Diplomacy.schema.rb +74 -0
  174. data/rails/schema/Metamodel.schema.rb +538 -0
  175. data/rails/schema/OneRoleNesting.rb +20 -0
  176. data/rails/schema/SeparateSubtype.schema.rb +35 -0
  177. data/rails/schema/VenueSeating.schema.rb +46 -0
  178. data/rails/schema/Warehousing.schema.rb +145 -0
  179. data/ruby/Address.rb +68 -0
  180. data/ruby/Astronomy.rb +55 -0
  181. data/ruby/Blog.rb +84 -0
  182. data/ruby/CinemaBookings.rb +109 -0
  183. data/ruby/CinemaTickets.rb +218 -0
  184. data/ruby/CompanyDirectorEmployee.rb +73 -0
  185. data/ruby/Death.rb +26 -0
  186. data/ruby/Diplomacy.rb +59 -0
  187. data/ruby/Genealogy.rb +173 -0
  188. data/ruby/Insurance.rb +562 -0
  189. data/ruby/Marriage.rb +21 -0
  190. data/ruby/Metamodel.rb +621 -0
  191. data/ruby/Monogamy.rb +27 -0
  192. data/ruby/MultiInheritance.rb +38 -0
  193. data/ruby/OilSupply.rb +112 -0
  194. data/ruby/OneRoleNesting.rb +66 -0
  195. data/ruby/Orienteering.rb +216 -0
  196. data/ruby/PersonPlaysGame.rb +31 -0
  197. data/ruby/RedundantDependency.rb +53 -0
  198. data/ruby/SchoolActivities.rb +49 -0
  199. data/ruby/SeparateSubtype.rb +46 -0
  200. data/ruby/SimplestUnary.rb +10 -0
  201. data/ruby/Supervision.rb +33 -0
  202. data/ruby/TwoValues.rb +14 -0
  203. data/ruby/VenueSeating.rb +64 -0
  204. data/ruby/WaiterTips.rb +49 -0
  205. data/ruby/Warehousing.rb +167 -0
  206. data/ruby/WindowInRoomInBldg.rb +45 -0
  207. data/sql/server/Address.sql +40 -0
  208. data/sql/server/Astronomy.sql +36 -0
  209. data/sql/server/Blog.sql +78 -0
  210. data/sql/server/CinemaBookings.sql +95 -0
  211. data/sql/server/CinemaTickets.sql +191 -0
  212. data/sql/server/CompanyDirectorEmployee.sql +104 -0
  213. data/sql/server/Death.sql +11 -0
  214. data/sql/server/Diplomacy.sql +66 -0
  215. data/sql/server/Genealogy.sql +138 -0
  216. data/sql/server/Health.sql +169 -0
  217. data/sql/server/Insurance.sql +484 -0
  218. data/sql/server/Marriage.sql +30 -0
  219. data/sql/server/Metamodel.sql +1000 -0
  220. data/sql/server/Monogamy.sql +20 -0
  221. data/sql/server/MultiInheritance.sql +27 -0
  222. data/sql/server/OilSupply.sql +105 -0
  223. data/sql/server/OneRoleNesting.sql +29 -0
  224. data/sql/server/Orienteering.sql +186 -0
  225. data/sql/server/PersonPlaysGame.sql +9 -0
  226. data/sql/server/RedundantDependency.sql +54 -0
  227. data/sql/server/SchoolActivities.sql +30 -0
  228. data/sql/server/SeparateSubtype.sql +33 -0
  229. data/sql/server/SimplestUnary.sql +9 -0
  230. data/sql/server/Supervision.sql +30 -0
  231. data/sql/server/VenueSeating.sql +54 -0
  232. data/sql/server/WaiterTips.sql +31 -0
  233. data/sql/server/Warehousing.sql +203 -0
  234. data/sql/server/WindowInRoomInBldg.sql +13 -0
  235. data/transform/surrogate/Address.absorption +2 -0
  236. data/transform/surrogate/Blog.absorption +5 -0
  237. data/transform/surrogate/CinemaBookings.absorption +7 -0
  238. data/transform/surrogate/CompanyDirectorEmployee.absorption +7 -0
  239. data/transform/surrogate/Death.absorption +1 -0
  240. data/transform/surrogate/Diplomacy-revised.absorption +6 -0
  241. data/transform/surrogate/Diplomacy.absorption +6 -0
  242. data/transform/surrogate/Genealogy.absorption +8 -0
  243. data/transform/surrogate/Insurance.absorption +18 -0
  244. data/transform/surrogate/Marriage.absorption +2 -0
  245. data/transform/surrogate/Metamodel.absorption +25 -0
  246. data/transform/surrogate/Monogamy.absorption +1 -0
  247. data/transform/surrogate/MultiInheritance.absorption +1 -0
  248. data/transform/surrogate/MultipleSubtyping.absorption +1 -0
  249. data/transform/surrogate/OilSupply.absorption +8 -0
  250. data/transform/surrogate/OneRoleNesting.absorption +1 -0
  251. data/transform/surrogate/Orienteering.absorption +11 -0
  252. data/transform/surrogate/PersonPlaysGame.absorption +1 -0
  253. data/transform/surrogate/RedundantDependency.absorption +3 -0
  254. data/transform/surrogate/SchoolActivities.absorption +3 -0
  255. data/transform/surrogate/SeparateSubtype.absorption +3 -0
  256. data/transform/surrogate/SimplestUnary.absorption +1 -0
  257. data/transform/surrogate/Supervision.absorption +2 -0
  258. data/transform/surrogate/WaiterTips.absorption +3 -0
  259. data/transform/surrogate/Warehousing.absorption +12 -0
  260. data/transform/surrogate/WindowInRoomInBldg.absorption +1 -0
  261. data/transform/surrogate/unit.absorption +0 -0
  262. metadata +374 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 99975f58e454642230bf7ef45aa340f3e44f47c0
4
+ data.tar.gz: ccc97e26ea574a6da65a6a43c6d3c6a724e1ca37
5
+ SHA512:
6
+ metadata.gz: f7225f4579a1d56e83dabe311d5eac60b88170d2908c8b1f6180d8c371634b0a691c4da0778ed8e1f0b572d44d08d22793bfa55a3bdf2f919877690f89faee7c
7
+ data.tar.gz: 81df7583700c754e0b7114f3dfcb6dc27365a98c48d39a629fc14eec605408459d2290d3118d20d938cd3cb75dff0f6516c1db2caf004ba26dbf5ab010490271
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /actual
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --format documentation
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.5
4
+ before_install: gem install bundler -v 1.10.0.rc
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in activefacts-examples.gemspec
4
+ gemspec
5
+
6
+ if ENV['PWD'] =~ %r{\A/Users/cjh/work/activefacts}
7
+ gem 'activefacts-cql', path: '/Users/cjh/work/activefacts/cql'
8
+ #gem 'activefacts-orm', path: '/Users/cjh/work/activefacts/orm'
9
+ gem 'activefacts-generators', path: '/Users/cjh/work/activefacts/generators'
10
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Clifford Heath
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # Activefacts::Examples
2
+
3
+ This gem contains example models (and generated output) for the ActiveFacts suite.
4
+ The models are written in the Constellation Query Language and also in ORM (for NORMA).
5
+
6
+ ## Installation
7
+
8
+ $ gem install activefacts-examples
9
+
10
+ ## Usage
11
+
12
+ You can use the <i>afgen<i> command from the activefacts gem to process the CQL and ORM
13
+ files under this directory and to run any of the available generators from them.
14
+
15
+ ## Contributing
16
+
17
+ Bug reports and pull requests are welcome on GitHub at https://github.com/cjheath/activefacts-examples.
18
+
19
+ ## License
20
+
21
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
22
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "activefacts-examples"
7
+ spec.version = "1.7.1"
8
+ spec.authors = ["Clifford Heath"]
9
+ spec.email = ["clifford.heath@gmail.com"]
10
+
11
+ spec.summary = %q{Example models in the Constellation Query Language for use with ActiveFacts}
12
+ spec.description = %q{Example models in the Constellation Query Language for use with ActiveFacts}
13
+ spec.homepage = "http://github.com/cjheath/activefacts-examples"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.require_paths = ["lib"]
18
+
19
+ spec.add_development_dependency "bundler", "~> 1.10.a"
20
+ spec.add_development_dependency "rake", "~> 10.0"
21
+ spec.add_development_dependency "rspec"
22
+
23
+ spec.add_runtime_dependency "activefacts-cql"
24
+ #spec.add_runtime_dependency "activefacts-orm"
25
+ spec.add_runtime_dependency "activefacts-generators"
26
+ end
data/cql/Address.cql ADDED
@@ -0,0 +1,44 @@
1
+ vocabulary Address;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ City is written as String(64);
7
+ Company Name is written as String;
8
+ Family Name is written as String(20);
9
+ Given Names is written as String(20);
10
+ Number is written as String(12);
11
+ Postcode is written as String;
12
+ Street Line is written as String(64);
13
+
14
+ /*
15
+ * Entity Types
16
+ */
17
+ Company is identified by its Name;
18
+
19
+ Family is identified by its Name;
20
+
21
+ Person is identified by Family and Given Names where
22
+ Person is of one Family,
23
+ Family includes Person,
24
+ Person has one Given Names;
25
+
26
+ Street is identified by first-Street Line and second-Street Line and third-Street Line where
27
+ Street includes one first-Street Line,
28
+ Street includes at most one second-Street Line,
29
+ Street includes at most one third-Street Line;
30
+
31
+ Address is identified by street-Number and Street and City and Postcode where
32
+ Address is at at most one street-Number,
33
+ Address is at one Street,
34
+ Address is in one City,
35
+ Address is in at most one Postcode restricted to {1000..9999},
36
+ Postcode is of Address;
37
+ Company has head office at at most one Address;
38
+ Person lives at at most one Address;
39
+
40
+ /*
41
+ * Constraints:
42
+ */
43
+ Street includes third Street Line
44
+ only if Street includes second Street Line;
data/cql/Astronomy.cql ADDED
@@ -0,0 +1,35 @@
1
+ vocabulary Astronomy;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ AstronomicalObject Code is written as String(12);
7
+ Mass is written as Real(32);
8
+ Moon Name is written as String(256);
9
+ Nr Days is written as Real(32);
10
+ Planet Name is written as String(256);
11
+
12
+ /*
13
+ * Entity Types
14
+ */
15
+ AstronomicalObject is identified by its Code;
16
+ AstronomicalObject has at most one Mass;
17
+
18
+ Moon is a kind of AstronomicalObject identified by its Name;
19
+
20
+ Orbit is where
21
+ AstronomicalObject is in orbit;
22
+ Orbit is around one AstronomicalObject (as Center) /* [acyclic, stronglyintransitive] */;
23
+ Orbit has a synodic period of at most one Nr Days;
24
+
25
+ Planet is a kind of AstronomicalObject identified by its Name;
26
+
27
+ Star is a kind of AstronomicalObject;
28
+
29
+ /*
30
+ * Constraints:
31
+ */
32
+ for each AstronomicalObject exactly one of these holds:
33
+ AstronomicalObject is a Star,
34
+ AstronomicalObject is a Planet,
35
+ AstronomicalObject is a Moon;
data/cql/Blog.cql ADDED
@@ -0,0 +1,54 @@
1
+ vocabulary Blog;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ Author Id is written as Auto Counter;
7
+ Comment Id is written as Auto Counter;
8
+ Name is written as String(64);
9
+ Ordinal is written as Unsigned Integer(32);
10
+ Post Id is written as Auto Counter;
11
+ Style is written as String(20);
12
+ Text is written as Text;
13
+ Topic Id is written as Auto Counter;
14
+
15
+ /*
16
+ * Entity Types
17
+ */
18
+ Author is identified by its Id;
19
+ author-Name is of at most one Author,
20
+ Author is called one Name;
21
+
22
+ Comment is identified by its Id;
23
+ Author wrote Comment,
24
+ Comment was written by one Author;
25
+
26
+ Content is identified by Style and Text where
27
+ Content is of at most one Style,
28
+ Content has one Text,
29
+ Text is of Content;
30
+ Content provides text of Comment,
31
+ Comment consists of one text-Content;
32
+
33
+ Post is identified by its Id;
34
+ Post was written by one Author,
35
+ Author wrote Post;
36
+
37
+ Topic is identified by its Id;
38
+ Post belongs to one Topic,
39
+ Topic contains Post;
40
+ Topic belongs to at most one parent-Topic [acyclic];
41
+ Topic is called one topic-Name,
42
+ Name is of at most one Topic;
43
+
44
+ Paragraph is where
45
+ Post includes Ordinal paragraph;
46
+ Content is of Paragraph,
47
+ Paragraph contains one Content;
48
+ Paragraph has Comment,
49
+ Comment is on one Paragraph;
50
+
51
+ /*
52
+ * Constraints:
53
+ */
54
+ either Content provides text of Comment or Content is of Paragraph but not both;
@@ -0,0 +1,64 @@
1
+ vocabulary CinemaBookings;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ Cinema ID is written as Auto Counter;
7
+ DateTime Value is written as Date Time;
8
+ Film ID is written as Auto Counter;
9
+ Name is written as String;
10
+ Number is written as Unsigned Integer(16) restricted to {1..};
11
+ Person ID is written as Auto Counter;
12
+ Row Nr is written as Char(2);
13
+ Seat Number is written as Unsigned Integer(16);
14
+ Section Name is written as String;
15
+
16
+ /*
17
+ * Entity Types
18
+ */
19
+ Cinema is identified by its ID;
20
+
21
+ DateTime is identified by its Value;
22
+
23
+ Film is identified by its ID;
24
+ Film has at most one Name;
25
+
26
+ Person is identified by its ID;
27
+ Person has one login-Name,
28
+ Name is of at most one Person;
29
+
30
+ Row is identified by Cinema and Row Nr where
31
+ Row is in one Cinema,
32
+ Cinema contains Row,
33
+ Row has one Row Nr,
34
+ Row Nr is of Row;
35
+
36
+ Seat is identified by Row and Seat Number where
37
+ Seat is in one Row,
38
+ Row contains Seat,
39
+ Seat has one Seat Number,
40
+ Seat Number is of Seat;
41
+
42
+ Section is identified by its Name;
43
+ Seat is in at most one Section,
44
+ Section contains Seat;
45
+
46
+ Session is where
47
+ Cinema shows Film on DateTime,
48
+ Film is showing on DateTime at Cinema,
49
+ Cinema at DateTime is showing one Film;
50
+
51
+ Booking is where
52
+ Person booked Session for one Number of seats,
53
+ Person booked Number of seats for Session;
54
+ Booking is confirmed;
55
+
56
+ Seat Allocation is where
57
+ Booking has allocated-Seat,
58
+ Seat is allocated to Booking;
59
+
60
+ /*
61
+ * Constraints:
62
+ */
63
+ Booking (in which Person booked Session (in which Cinema shows Film on DateTime) for Number of seats) has allocated Seat
64
+ only if Cinema contains Row that contains Seat;
@@ -0,0 +1,127 @@
1
+ vocabulary CinemaTickets;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ Address Text is written as Text;
7
+ Booking Nr is written as Signed Integer(32);
8
+ Cinema ID is written as Auto Counter;
9
+ Collection Code is written as Signed Integer(32);
10
+ Day is written as Signed Integer(32) restricted to {1..31};
11
+ Encrypted Password is written as String;
12
+ Film ID is written as Auto Counter;
13
+ High Demand is written as Boolean;
14
+ Hour is written as Signed Integer(32) restricted to {0..23};
15
+ Minute is written as Signed Integer(32) restricted to {0..59};
16
+ Month Nr is written as Signed Integer(32) restricted to {1..12};
17
+ Name is written as String;
18
+ Number is written as Unsigned Integer(16) restricted to {1..};
19
+ Payment Method Code is written as String;
20
+ Person ID is written as Auto Counter;
21
+ Price is written as Money;
22
+ Row Nr is written as Char(2);
23
+ Seat Number is written as Unsigned Integer(16);
24
+ Section Name is written as String;
25
+ Year Nr is written as Signed Integer(32) restricted to {1900..9999};
26
+
27
+ /*
28
+ * Entity Types
29
+ */
30
+ Address is identified by its Text;
31
+
32
+ Cinema is identified by its ID;
33
+ Cinema has one Name,
34
+ Name is of at most one Cinema;
35
+
36
+ Film is identified by its ID;
37
+ Film has one Name;
38
+
39
+ Month is identified by its Nr;
40
+
41
+ Payment Method is identified by its Code restricted to {'Card', 'Cash', 'Gift Voucher', 'Loyalty Voucher'};
42
+
43
+ Person is identified by its ID;
44
+ Person has at most one Encrypted Password;
45
+ Person has at most one login-Name,
46
+ Name is of at most one Person;
47
+
48
+ Row is identified by Cinema and Row Nr where
49
+ Row is in one Cinema,
50
+ Cinema contains Row,
51
+ Row has one Row Nr,
52
+ Row Nr is of Row;
53
+
54
+ Seat is identified by Row and Seat Number where
55
+ Seat is in one Row,
56
+ Row contains Seat,
57
+ Seat has one Seat Number,
58
+ Seat Number is of Seat;
59
+
60
+ Section is identified by its Name;
61
+ Seat is in at most one Section,
62
+ Section contains Seat;
63
+
64
+ Year is identified by its Nr;
65
+ Film was made in at most one Year;
66
+
67
+ AllocatableCinemaSection is where
68
+ Cinema provides allocated seating in Section,
69
+ Section of Cinema uses allocated seating;
70
+
71
+ Session Time is identified by Year and Month and Day and Hour and Minute where
72
+ Session Time is in one Year,
73
+ Session Time is in one Month,
74
+ Session Time is on one Day,
75
+ Session Time is at one Hour,
76
+ Session Time is at one Minute;
77
+
78
+ Ticket Pricing is where
79
+ tickets on Session Time at Cinema in Section for High Demand have one Price;
80
+
81
+ Session is where
82
+ Cinema shows Film on Session Time,
83
+ Film is showing on Session Time at Cinema,
84
+ Cinema at Session Time is showing one Film;
85
+ /*
86
+ some Session (where some Cinema shows some Film on some Session Time) has some Seat where
87
+ that Cinema contains some Row that contains that Seat;
88
+ */
89
+ Session is high-demand;
90
+ Session uses allocated seating;
91
+
92
+ Booking is identified by its Nr where
93
+ Person booked Session for one Number of places,
94
+ Person booked Number of places for Session;
95
+ tickets for Booking are being mailed to at most one Address;
96
+ Booking has at most one Collection Code;
97
+ Booking is for seats in at most one Section;
98
+ tickets for Booking have been issued;
99
+
100
+ Places Paid is where
101
+ Number of places for Booking have been paid for by Payment Method,
102
+ Booking applied Payment Method for one Number of places;
103
+
104
+ Seat Allocation is where
105
+ Booking has allocated-Seat,
106
+ Seat is allocated to Booking;
107
+
108
+ /*
109
+ * Constraints:
110
+ */
111
+ for each Booking at most one of these holds:
112
+ Booking has Collection Code,
113
+ tickets for Booking are being mailed to Address;
114
+ Booking has allocated Seat
115
+ only if Booking applied Payment Method for Number of places;
116
+ tickets for Booking are being mailed to Address
117
+ only if tickets for Booking have been issued;
118
+ Person has login Name
119
+ only if Person has Encrypted Password;
120
+ each combination Name, Year occurs at most one time in
121
+ Film has Name,
122
+ Film was made in Year;
123
+ Booking
124
+ (in which Person booked Number of places for Session
125
+ (in which Film is showing on Session Time at Cinema))
126
+ has allocated-Seat
127
+ only if Seat is in Row that is in Cinema;
@@ -0,0 +1,56 @@
1
+ vocabulary CompanyDirectorEmployee;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ Company Name is written as String(48);
7
+ Date is written as Date;
8
+ Employee Nr is written as Signed Integer(32);
9
+ Name is written as String(48);
10
+
11
+ /*
12
+ * Entity Types
13
+ */
14
+ Company is identified by its Name where
15
+ Company is called Company Name;
16
+ Company is listed;
17
+
18
+ Employee is identified by its Nr;
19
+ Employee works at one Company,
20
+ Company employs Employee;
21
+
22
+ Manager is a kind of Employee;
23
+ Employee is supervised by at most one Manager [acyclic],
24
+ Manager supervises Employee;
25
+ Manager is ceo;
26
+
27
+ Meeting is independent identified by Company and Date and Meeting is board meeting where
28
+ Meeting is held by one Company,
29
+ Company held Meeting,
30
+ Meeting is held on one Date,
31
+ Meeting is board meeting;
32
+
33
+ Person is identified by given-Name and family-Name where
34
+ Person has one given-Name,
35
+ given-Name is of Person,
36
+ family-Name is of Person,
37
+ Person is called at most one family-Name;
38
+ Person was born on at most one birth-Date restricted to {'1900/01/01'..};
39
+
40
+ Attendance is where
41
+ Person (as Attendee) attended Meeting,
42
+ Meeting was attended by Attendee;
43
+
44
+ Directorship is where
45
+ Person (as Director) directs Company,
46
+ Company is directed by at least one Director;
47
+ Directorship began on one appointment-Date;
48
+
49
+ Employment is where
50
+ Person works as Employee,
51
+ Employee role is assigned to at least one Person;
52
+
53
+ /*
54
+ * Constraints:
55
+ */
56
+ either Employee is supervised by Manager(1) or Employee is a Manager(2) that is ceo but not both;
data/cql/Death.cql ADDED
@@ -0,0 +1,17 @@
1
+ vocabulary Death;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ Cause Of Death is written as String;
7
+ Person Name is written as String(40);
8
+
9
+ /*
10
+ * Entity Types
11
+ */
12
+ Person is independent identified by its Name;
13
+
14
+ Death is where
15
+ Person is dead;
16
+ Death was due to at most one Cause Of Death;
17
+
data/cql/Diplomacy.cql ADDED
@@ -0,0 +1,48 @@
1
+ vocabulary Diplomacy;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ CountryName is written as String;
7
+ DiplomatName is written as String;
8
+ LanguageName is written as String;
9
+
10
+ /*
11
+ * Entity Types
12
+ */
13
+ Country is independent identified by its Name;
14
+
15
+ Diplomat is identified by its Name;
16
+ Diplomat represents one Country (as Represented Country);
17
+ Diplomat serves in one Country (as Served Country);
18
+
19
+ Language is independent identified by its Name;
20
+
21
+ LanguageUse is where
22
+ Language is spoken in Country,
23
+ Country uses Language;
24
+
25
+ Ambassador is a kind of Diplomat;
26
+
27
+ Fluency is where
28
+ Diplomat speaks at least one Language,
29
+ Language is spoken by Diplomat;
30
+
31
+ Representation is where
32
+ Ambassador is from Country (as Represented Country) to Country,
33
+ Represented Country is represented in Country by one Ambassador;
34
+
35
+ /*
36
+ * Constraints:
37
+ */
38
+ for each Diplomat, Country at most one of these holds:
39
+ Diplomat serves in Country,
40
+ Diplomat represents Country;
41
+ Diplomat is an Ambassador that is from Country(1) to Country(2)
42
+ only if Diplomat represents Country(1);
43
+ Diplomat is an Ambassador that is from Country(2) to Country(1)
44
+ only if Diplomat serves in Country(1);
45
+ Diplomat serves in Country
46
+ only if Diplomat speaks Language that is spoken in Country;
47
+ each Ambassador occurs at least one time in
48
+ Ambassador is from Country(1) to Country(2);
data/cql/Genealogy.cql ADDED
@@ -0,0 +1,98 @@
1
+ vocabulary Genealogy;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ Address is written as String(128);
7
+ Certificate is written as String(64);
8
+ Day is written as Unsigned Integer(32) restricted to {1..31};
9
+ Email is written as String(64);
10
+ Event ID is written as Auto Counter;
11
+ Event Location is written as String(128);
12
+ Event Role Name is written as String restricted to {'Celebrant', 'Father', 'Husband', 'Mother', 'Subject', 'Wife'};
13
+ Event Type ID is written as Auto Counter;
14
+ Event Type Name is written as String(16) restricted to {'Birth', 'Burial', 'Christening', 'Death', 'Divorce', 'Marriage'};
15
+ Gender is written as Char(1) restricted to {'F', 'M'};
16
+ Month is written as Unsigned Integer(32) restricted to {1..12};
17
+ Name is written as String(128);
18
+ Occupation is written as String(128);
19
+ Official is written as String(64);
20
+ Person ID is written as Auto Counter;
21
+ Picture is written as Image;
22
+ Role ID is written as Auto Counter;
23
+ Source ID is written as Auto Counter;
24
+ Source Name is written as String(128);
25
+ User ID is written as Auto Counter;
26
+ Year is written as Unsigned Integer(32);
27
+
28
+ /*
29
+ * Entity Types
30
+ */
31
+ Event is identified by its ID;
32
+ Event is certified by at most one Certificate;
33
+ Event occurred at at most one Event Location;
34
+ Event was confirmed by at most one Official;
35
+
36
+ Event Date is identified by min-Year and max-Year and Month and Day where
37
+ Event Date wasnt before at most one min-Year,
38
+ Event Date wasnt after at most one max-Year,
39
+ Event Date occurred in at most one Month,
40
+ Event Date occurred on at most one Day;
41
+ Event occurred on at most one Event Date;
42
+
43
+ Event Type is identified by its ID;
44
+ Event is of at most one Event Type;
45
+ Event Type is called one Event Type Name,
46
+ Event Type Name is name of at most one Event Type;
47
+
48
+ Person is identified by its ID;
49
+ Address is of Person,
50
+ Person lives at at most one Address;
51
+ Email is of Person,
52
+ Person has at most one Email;
53
+ Occupation is of Person,
54
+ Person is employed in at most one Occupation;
55
+ Person is of at most one Gender;
56
+ Person is called at most one family-Name,
57
+ family-Name is of Person;
58
+ given-Name is name of Person; // Avoid ambiguity; this is a new fact type
59
+ given-Name is name of Person,
60
+ Person is called at most one given-Name;
61
+ preferred-Picture is of Person,
62
+ Person has at most one preferred-Picture;
63
+
64
+ Role is identified by its ID;
65
+ Role is called one Event Role Name,
66
+ Event Role Name is name of at most one Role;
67
+
68
+ Source is identified by its ID;
69
+ Source has one Source Name,
70
+ Source Name is of at most one Source;
71
+
72
+ User is identified by its ID;
73
+ Email is of User,
74
+ User has at most one Email;
75
+ User provided Source,
76
+ Source was provided by one User;
77
+
78
+ Friendship is where
79
+ User is friendly with other-User [symmetric];
80
+ Friendship is confirmed;
81
+
82
+ Participation is where
83
+ Person played Role in Event according to Source,
84
+ Person was involved in Event according to Source in Role,
85
+ Source claims Person played Role in Event;
86
+
87
+ /*
88
+ * Constraints:
89
+ */
90
+ each Event Date occurs at least one time in
91
+ Event Date wasnt before min Year(2),
92
+ Event Date wasnt after max Year(1),
93
+ Event Date occurred in Month,
94
+ Event Date occurred on Day;
95
+ each Event occurs at least one time in
96
+ Person played Role in Event according to Source;
97
+ each Person occurs at least one time in
98
+ Person played Role in Event according to Source;