activefacts-examples 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +1 -0
- data/.travis.yml +4 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +21 -0
- data/README.md +22 -0
- data/Rakefile +6 -0
- data/activefacts-examples.gemspec +26 -0
- data/cql/Address.cql +44 -0
- data/cql/Astronomy.cql +35 -0
- data/cql/Blog.cql +54 -0
- data/cql/CinemaBookings.cql +64 -0
- data/cql/CinemaTickets.cql +127 -0
- data/cql/CompanyDirectorEmployee.cql +56 -0
- data/cql/Death.cql +17 -0
- data/cql/Diplomacy.cql +48 -0
- data/cql/Genealogy.cql +98 -0
- data/cql/Health.cql +78 -0
- data/cql/Insurance.cql +320 -0
- data/cql/Marriage.cql +18 -0
- data/cql/Metamodel.cql +567 -0
- data/cql/Monogamy.cql +24 -0
- data/cql/MultiInheritance.cql +22 -0
- data/cql/MultipleSubtyping.cql +30 -0
- data/cql/NonRoleId.cql +14 -0
- data/cql/OddIdentifier.cql +18 -0
- data/cql/OilSupply.cql +53 -0
- data/cql/OneRoleNesting.cql +38 -0
- data/cql/OneToOnes.cql +17 -0
- data/cql/Orienteering.cql +111 -0
- data/cql/PartyModel.cql +38 -0
- data/cql/PersonPlaysGame.cql +18 -0
- data/cql/RedundantDependency.cql +34 -0
- data/cql/SchoolActivities.cql +33 -0
- data/cql/SeparateSubtype.cql +30 -0
- data/cql/ServiceDirector.cql +276 -0
- data/cql/SimplestUnary.cql +12 -0
- data/cql/Supervision.cql +34 -0
- data/cql/VenueSeating.cql +45 -0
- data/cql/WaiterTips.cql +33 -0
- data/cql/Warehousing.cql +101 -0
- data/cql/WindowInRoomInBldg.cql +28 -0
- data/cql/unit.cql +474 -0
- data/diagrams/json/Address.json +41 -0
- data/diagrams/json/Astronomy.json +31 -0
- data/diagrams/json/Blog.json +46 -0
- data/diagrams/json/CinemaBookings.json +53 -0
- data/diagrams/json/CinemaTickets.json +101 -0
- data/diagrams/json/CompanyDirectorEmployee.json +44 -0
- data/diagrams/json/Death.json +20 -0
- data/diagrams/json/Diplomacy.json +34 -0
- data/diagrams/json/Genealogy.json +78 -0
- data/diagrams/json/Insurance.json +259 -0
- data/diagrams/json/Marriage.json +21 -0
- data/diagrams/json/Metamodel.json +318 -0
- data/diagrams/json/Monogamy.json +22 -0
- data/diagrams/json/MultiInheritance.json +25 -0
- data/diagrams/json/MultipleSubtyping.json +22 -0
- data/diagrams/json/OilSupply.json +49 -0
- data/diagrams/json/OneRoleNesting.json +37 -0
- data/diagrams/json/Orienteering.json +94 -0
- data/diagrams/json/PersonPlaysGame.json +22 -0
- data/diagrams/json/RedundantDependency.json +33 -0
- data/diagrams/json/SchoolActivities.json +28 -0
- data/diagrams/json/SeparateSubtype.json +29 -0
- data/diagrams/json/SimplestUnary.json +15 -0
- data/diagrams/json/Supervision.json +27 -0
- data/diagrams/json/VenueSeating.json +40 -0
- data/diagrams/json/WaiterTips.json +29 -0
- data/diagrams/json/Warehousing.json +86 -0
- data/diagrams/json/WindowInRoomInBldg.json +31 -0
- data/images/Address.SQL.png +0 -0
- data/images/Address.png +0 -0
- data/images/Blog.png +0 -0
- data/images/CinemaBookings.png +0 -0
- data/images/CinemaTickets.png +0 -0
- data/images/CompanyDirectorEmployee.png +0 -0
- data/images/Death.png +0 -0
- data/images/Diplomacy.png +0 -0
- data/images/DumpMetamodel.bat +2 -0
- data/images/Genealogy.png +0 -0
- data/images/Insurance/Claim.png +0 -0
- data/images/Insurance/Insurance.png +0 -0
- data/images/Insurance/Person.png +0 -0
- data/images/Insurance/Policy.png +0 -0
- data/images/Insurance/Related.png +0 -0
- data/images/Insurance/VehicleIncident.png +0 -0
- data/images/Marriage.png +0 -0
- data/images/Metamodel/Concepts.png +0 -0
- data/images/Metamodel/Constraints.png +0 -0
- data/images/Metamodel/ContextNote.png +0 -0
- data/images/Metamodel/Diagrams.png +0 -0
- data/images/Metamodel/Language.png +0 -0
- data/images/Metamodel/Legacy.png +0 -0
- data/images/Metamodel/Objects.png +0 -0
- data/images/Metamodel/Populations.png +0 -0
- data/images/Metamodel/Query.png +0 -0
- data/images/Metamodel/Units.png +0 -0
- data/images/Metamodel/ValueConstraints.png +0 -0
- data/images/Metamodel/ValueTypes.png +0 -0
- data/images/MetamodelER.bcp +1 -0
- data/images/MetamodelER.pdf +0 -0
- data/images/MultiInheritance.png +0 -0
- data/images/NorthwindER.png +0 -0
- data/images/OilSupply.png +0 -0
- data/images/Orienteering/Administration.png +0 -0
- data/images/Orienteering/Registration.png +0 -0
- data/images/Orienteering/Scoring.png +0 -0
- data/images/PersonPlaysGame.png +0 -0
- data/images/RedundantDependency.png +0 -0
- data/images/SchoolActivities.png +0 -0
- data/images/SeparateSubtype.png +0 -0
- data/images/SimplestUnary.png +0 -0
- data/images/Supervision.png +0 -0
- data/images/VenueSeating.png +0 -0
- data/images/WaiterTips.png +0 -0
- data/images/Warehousing.png +0 -0
- data/images/WindowInRoomInBldg.png +0 -0
- data/metadata/json/Astronomy.json +175 -0
- data/metadata/json/CinemaBookings.json +354 -0
- data/metadata/json/CinemaTickets.json +768 -0
- data/metadata/json/CompanyDirectorEmployee.json +270 -0
- data/metadata/json/Diplomacy.json +186 -0
- data/metadata/json/Metamodel.json +3214 -0
- data/metadata/json/OilSupply.json +411 -0
- data/metadata/json/SeparateSubtype.json +157 -0
- data/metadata/json/Supervision.json +128 -0
- data/metadata/json/VenueSeating.json +209 -0
- data/orm/.gitignore +11 -0
- data/orm/Address.orm +1268 -0
- data/orm/Astronomy.orm +925 -0
- data/orm/Blog.orm +1711 -0
- data/orm/CinemaBookings.orm +1998 -0
- data/orm/CinemaTickets.orm +5060 -0
- data/orm/CompanyDirectorEmployee.orm +2094 -0
- data/orm/Death.orm +386 -0
- data/orm/Diplomacy.orm +1478 -0
- data/orm/ExampleModels2010.csproj +764 -0
- data/orm/ExampleModels2010.sln +16 -0
- data/orm/Genealogy.orm +3209 -0
- data/orm/Health.orm +2407 -0
- data/orm/Insurance.orm +12727 -0
- data/orm/Marriage.orm +493 -0
- data/orm/Metamodel.orm +20998 -0
- data/orm/Monogamy.orm +328 -0
- data/orm/MultiInheritance.orm +537 -0
- data/orm/MultipleSubtyping.orm +347 -0
- data/orm/OilSupply.orm +2533 -0
- data/orm/OneRoleNesting.orm +1237 -0
- data/orm/Orienteering.orm +3976 -0
- data/orm/PersonPlaysGame.orm +426 -0
- data/orm/RedundantDependency.orm +844 -0
- data/orm/SchoolActivities.orm +961 -0
- data/orm/SeparateSubtype.orm +821 -0
- data/orm/SimplestUnary.orm +172 -0
- data/orm/Supervision.orm +734 -0
- data/orm/VenueSeating.orm +1289 -0
- data/orm/WaiterTips.orm +789 -0
- data/orm/Warehousing.orm +3792 -0
- data/orm/WindowInRoomInBldg.orm +772 -0
- data/rails/models/Astronomy.models +17 -0
- data/rails/models/CinemaBookings.models +123 -0
- data/rails/models/CinemaTickets.models +192 -0
- data/rails/models/Diplomacy.models +126 -0
- data/rails/models/Metamodel.models +894 -0
- data/rails/models/OneRoleNesting.models +18 -0
- data/rails/models/SeparateSubtype.models +49 -0
- data/rails/models/VenueSeating.models +70 -0
- data/rails/schema/Astronomy.schema.rb +25 -0
- data/rails/schema/CinemaBookings.schema.rb +78 -0
- data/rails/schema/CinemaTickets.schema.rb +132 -0
- data/rails/schema/Diplomacy.schema.rb +74 -0
- data/rails/schema/Metamodel.schema.rb +538 -0
- data/rails/schema/OneRoleNesting.rb +20 -0
- data/rails/schema/SeparateSubtype.schema.rb +35 -0
- data/rails/schema/VenueSeating.schema.rb +46 -0
- data/rails/schema/Warehousing.schema.rb +145 -0
- data/ruby/Address.rb +68 -0
- data/ruby/Astronomy.rb +55 -0
- data/ruby/Blog.rb +84 -0
- data/ruby/CinemaBookings.rb +109 -0
- data/ruby/CinemaTickets.rb +218 -0
- data/ruby/CompanyDirectorEmployee.rb +73 -0
- data/ruby/Death.rb +26 -0
- data/ruby/Diplomacy.rb +59 -0
- data/ruby/Genealogy.rb +173 -0
- data/ruby/Insurance.rb +562 -0
- data/ruby/Marriage.rb +21 -0
- data/ruby/Metamodel.rb +621 -0
- data/ruby/Monogamy.rb +27 -0
- data/ruby/MultiInheritance.rb +38 -0
- data/ruby/OilSupply.rb +112 -0
- data/ruby/OneRoleNesting.rb +66 -0
- data/ruby/Orienteering.rb +216 -0
- data/ruby/PersonPlaysGame.rb +31 -0
- data/ruby/RedundantDependency.rb +53 -0
- data/ruby/SchoolActivities.rb +49 -0
- data/ruby/SeparateSubtype.rb +46 -0
- data/ruby/SimplestUnary.rb +10 -0
- data/ruby/Supervision.rb +33 -0
- data/ruby/TwoValues.rb +14 -0
- data/ruby/VenueSeating.rb +64 -0
- data/ruby/WaiterTips.rb +49 -0
- data/ruby/Warehousing.rb +167 -0
- data/ruby/WindowInRoomInBldg.rb +45 -0
- data/sql/server/Address.sql +40 -0
- data/sql/server/Astronomy.sql +36 -0
- data/sql/server/Blog.sql +78 -0
- data/sql/server/CinemaBookings.sql +95 -0
- data/sql/server/CinemaTickets.sql +191 -0
- data/sql/server/CompanyDirectorEmployee.sql +104 -0
- data/sql/server/Death.sql +11 -0
- data/sql/server/Diplomacy.sql +66 -0
- data/sql/server/Genealogy.sql +138 -0
- data/sql/server/Health.sql +169 -0
- data/sql/server/Insurance.sql +484 -0
- data/sql/server/Marriage.sql +30 -0
- data/sql/server/Metamodel.sql +1000 -0
- data/sql/server/Monogamy.sql +20 -0
- data/sql/server/MultiInheritance.sql +27 -0
- data/sql/server/OilSupply.sql +105 -0
- data/sql/server/OneRoleNesting.sql +29 -0
- data/sql/server/Orienteering.sql +186 -0
- data/sql/server/PersonPlaysGame.sql +9 -0
- data/sql/server/RedundantDependency.sql +54 -0
- data/sql/server/SchoolActivities.sql +30 -0
- data/sql/server/SeparateSubtype.sql +33 -0
- data/sql/server/SimplestUnary.sql +9 -0
- data/sql/server/Supervision.sql +30 -0
- data/sql/server/VenueSeating.sql +54 -0
- data/sql/server/WaiterTips.sql +31 -0
- data/sql/server/Warehousing.sql +203 -0
- data/sql/server/WindowInRoomInBldg.sql +13 -0
- data/transform/surrogate/Address.absorption +2 -0
- data/transform/surrogate/Blog.absorption +5 -0
- data/transform/surrogate/CinemaBookings.absorption +7 -0
- data/transform/surrogate/CompanyDirectorEmployee.absorption +7 -0
- data/transform/surrogate/Death.absorption +1 -0
- data/transform/surrogate/Diplomacy-revised.absorption +6 -0
- data/transform/surrogate/Diplomacy.absorption +6 -0
- data/transform/surrogate/Genealogy.absorption +8 -0
- data/transform/surrogate/Insurance.absorption +18 -0
- data/transform/surrogate/Marriage.absorption +2 -0
- data/transform/surrogate/Metamodel.absorption +25 -0
- data/transform/surrogate/Monogamy.absorption +1 -0
- data/transform/surrogate/MultiInheritance.absorption +1 -0
- data/transform/surrogate/MultipleSubtyping.absorption +1 -0
- data/transform/surrogate/OilSupply.absorption +8 -0
- data/transform/surrogate/OneRoleNesting.absorption +1 -0
- data/transform/surrogate/Orienteering.absorption +11 -0
- data/transform/surrogate/PersonPlaysGame.absorption +1 -0
- data/transform/surrogate/RedundantDependency.absorption +3 -0
- data/transform/surrogate/SchoolActivities.absorption +3 -0
- data/transform/surrogate/SeparateSubtype.absorption +3 -0
- data/transform/surrogate/SimplestUnary.absorption +1 -0
- data/transform/surrogate/Supervision.absorption +2 -0
- data/transform/surrogate/WaiterTips.absorption +3 -0
- data/transform/surrogate/Warehousing.absorption +12 -0
- data/transform/surrogate/WindowInRoomInBldg.absorption +1 -0
- data/transform/surrogate/unit.absorption +0 -0
- 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
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--format documentation
|
data/.travis.yml
ADDED
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,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;
|