activefacts 0.8.16 → 0.8.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +15 -0
  2. data/Manifest.txt +10 -4
  3. data/bin/afgen +26 -20
  4. data/bin/cql +1 -1
  5. data/css/orm2.css +89 -9
  6. data/examples/CQL/CompanyDirectorEmployee.cql +4 -4
  7. data/examples/CQL/Genealogy.cql +5 -5
  8. data/examples/CQL/Metamodel.cql +121 -91
  9. data/examples/CQL/MonthInSeason.cql +2 -6
  10. data/examples/CQL/SeparateSubtype.cql +11 -9
  11. data/examples/CQL/ServiceDirector.cql +21 -33
  12. data/examples/CQL/Supervision.cql +0 -3
  13. data/examples/CQL/WindowInRoomInBldg.cql +10 -4
  14. data/examples/CQL/unit.cql +1 -1
  15. data/lib/activefacts.rb +1 -0
  16. data/lib/activefacts/cql/CQLParser.treetop +5 -1
  17. data/lib/activefacts/cql/Context.treetop +2 -7
  18. data/lib/activefacts/cql/Expressions.treetop +2 -2
  19. data/lib/activefacts/cql/FactTypes.treetop +37 -31
  20. data/lib/activefacts/cql/Language/English.treetop +21 -4
  21. data/lib/activefacts/cql/LexicalRules.treetop +59 -1
  22. data/lib/activefacts/cql/ObjectTypes.treetop +22 -12
  23. data/lib/activefacts/cql/Terms.treetop +13 -9
  24. data/lib/activefacts/cql/ValueTypes.treetop +30 -11
  25. data/lib/activefacts/cql/compiler.rb +34 -5
  26. data/lib/activefacts/cql/compiler/clause.rb +207 -116
  27. data/lib/activefacts/cql/compiler/constraint.rb +129 -105
  28. data/lib/activefacts/cql/compiler/entity_type.rb +49 -27
  29. data/lib/activefacts/cql/compiler/expression.rb +71 -42
  30. data/lib/activefacts/cql/compiler/fact.rb +70 -64
  31. data/lib/activefacts/cql/compiler/fact_type.rb +108 -57
  32. data/lib/activefacts/cql/compiler/query.rb +178 -0
  33. data/lib/activefacts/cql/compiler/shared.rb +13 -12
  34. data/lib/activefacts/cql/compiler/value_type.rb +10 -4
  35. data/lib/activefacts/cql/nodes.rb +1 -1
  36. data/lib/activefacts/cql/parser.rb +6 -2
  37. data/lib/activefacts/generate/absorption.rb +6 -3
  38. data/lib/activefacts/generate/cql.rb +140 -84
  39. data/lib/activefacts/generate/dm.rb +12 -6
  40. data/lib/activefacts/generate/help.rb +25 -6
  41. data/lib/activefacts/generate/helpers/oo.rb +195 -0
  42. data/lib/activefacts/generate/helpers/ordered.rb +589 -0
  43. data/lib/activefacts/generate/helpers/rails.rb +57 -0
  44. data/lib/activefacts/generate/html/glossary.rb +274 -54
  45. data/lib/activefacts/generate/json.rb +25 -22
  46. data/lib/activefacts/generate/null.rb +1 -0
  47. data/lib/activefacts/generate/rails/models.rb +244 -0
  48. data/lib/activefacts/generate/rails/schema.rb +185 -0
  49. data/lib/activefacts/generate/records.rb +1 -0
  50. data/lib/activefacts/generate/ruby.rb +51 -30
  51. data/lib/activefacts/generate/sql/mysql.rb +5 -3
  52. data/lib/activefacts/generate/sql/server.rb +8 -4
  53. data/lib/activefacts/generate/text.rb +1 -0
  54. data/lib/activefacts/generate/transform/surrogate.rb +209 -0
  55. data/lib/activefacts/generate/version.rb +1 -0
  56. data/lib/activefacts/input/orm.rb +234 -181
  57. data/lib/activefacts/mapping/rails.rb +122 -0
  58. data/lib/activefacts/persistence/columns.rb +34 -18
  59. data/lib/activefacts/persistence/foreignkey.rb +129 -71
  60. data/lib/activefacts/persistence/index.rb +42 -12
  61. data/lib/activefacts/persistence/reference.rb +37 -23
  62. data/lib/activefacts/persistence/tables.rb +53 -19
  63. data/lib/activefacts/registry.rb +11 -0
  64. data/lib/activefacts/support.rb +28 -10
  65. data/lib/activefacts/version.rb +1 -1
  66. data/lib/activefacts/vocabulary/extensions.rb +246 -117
  67. data/lib/activefacts/vocabulary/metamodel.rb +105 -65
  68. data/lib/activefacts/vocabulary/verbaliser.rb +226 -194
  69. data/spec/absorption_spec.rb +1 -0
  70. data/spec/cql/comparison_spec.rb +8 -8
  71. data/spec/cql/contractions_spec.rb +16 -43
  72. data/spec/cql/entity_type_spec.rb +2 -1
  73. data/spec/cql/expressions_spec.rb +2 -2
  74. data/spec/cql/fact_type_matching_spec.rb +4 -1
  75. data/spec/cql/parser/bad_literals_spec.rb +30 -30
  76. data/spec/cql/parser/entity_types_spec.rb +6 -6
  77. data/spec/cql/parser/expressions_spec.rb +25 -19
  78. data/spec/cql/samples_spec.rb +5 -4
  79. data/spec/cql_cql_spec.rb +2 -1
  80. data/spec/cql_dm_spec.rb +4 -0
  81. data/spec/cql_mysql_spec.rb +4 -0
  82. data/spec/cql_parse_spec.rb +2 -0
  83. data/spec/cql_ruby_spec.rb +4 -0
  84. data/spec/cql_sql_spec.rb +4 -0
  85. data/spec/cqldump_spec.rb +7 -4
  86. data/spec/helpers/parse_to_ast_matcher.rb +7 -3
  87. data/spec/helpers/test_parser.rb +2 -0
  88. data/spec/norma_cql_spec.rb +5 -2
  89. data/spec/norma_ruby_spec.rb +4 -1
  90. data/spec/norma_ruby_sql_spec.rb +4 -1
  91. data/spec/norma_sql_spec.rb +4 -1
  92. data/spec/norma_tables_spec.rb +2 -2
  93. data/spec/ruby_api_spec.rb +1 -1
  94. data/spec/spec_helper.rb +2 -0
  95. data/spec/transform_surrogate_spec.rb +59 -0
  96. metadata +70 -60
  97. data/TODO +0 -308
  98. data/lib/activefacts/cql/compiler/join.rb +0 -162
  99. data/lib/activefacts/generate/oo.rb +0 -176
  100. data/lib/activefacts/generate/ordered.rb +0 -602
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MmQ1ZmI4YjNlNGZhMjJhZDQwODcwNDNkMWM1ZTQ5YWE2NjNkZTRiNA==
5
+ data.tar.gz: !binary |-
6
+ YzkzY2M3MDkzMDc5MGNmMTkyNGNmY2U2ZWUyNjQ2MjljODI5YmFkYw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZDgxMzZkODViOWE2MDU1MTdiODMwZDhjMzVjN2E2NmUwNjRlOTczZTJlMTU4
10
+ M2YxM2M5ZWUzZWQ1NWEwYjc5ZTIxNjg2MjQ0MjJmMzYwZjE1MmMwZGIyODFh
11
+ MTVlODhiNWY0ZTNiNWQ3ZmUzZDFhMTUzYzhmMGE0YTM1Y2YyNTg=
12
+ data.tar.gz: !binary |-
13
+ YWU2OTdlNTcxYTRjYjNjMzAxNjYzNTk0NDM1YmY3YzQ1NWI4YTczZDc2Nzlk
14
+ NTgxMmEwZWUyNzc2ZmU4MTAwYjNmMzBkNGM3M2I2OTM0M2MyZDM1NTcxZjNi
15
+ OGQzODQwMWQxNTFhNTRkYWU5M2QzODMyNDUwZTE1MjhjNTdiNWQ=
@@ -21,7 +21,6 @@ examples/CQL/Insurance.cql
21
21
  examples/CQL/JoinEquality.cql
22
22
  examples/CQL/Marriage.cql
23
23
  examples/CQL/Metamodel.cql
24
- examples/CQL/MetamodelNext.cql
25
24
  examples/CQL/Monogamy.cql
26
25
  examples/CQL/MonthInSeason.cql
27
26
  examples/CQL/Moon.cql
@@ -67,7 +66,7 @@ lib/activefacts/cql/compiler/entity_type.rb
67
66
  lib/activefacts/cql/compiler/expression.rb
68
67
  lib/activefacts/cql/compiler/fact.rb
69
68
  lib/activefacts/cql/compiler/fact_type.rb
70
- lib/activefacts/cql/compiler/join.rb
69
+ lib/activefacts/cql/compiler/query.rb
71
70
  lib/activefacts/cql/compiler/shared.rb
72
71
  lib/activefacts/cql/compiler/value_type.rb
73
72
  lib/activefacts/cql/nodes.rb
@@ -76,19 +75,24 @@ lib/activefacts/generate/absorption.rb
76
75
  lib/activefacts/generate/cql.rb
77
76
  lib/activefacts/generate/dm.rb
78
77
  lib/activefacts/generate/help.rb
78
+ lib/activefacts/generate/helpers/oo.rb
79
+ lib/activefacts/generate/helpers/ordered.rb
80
+ lib/activefacts/generate/helpers/rails.rb
79
81
  lib/activefacts/generate/html/glossary.rb
80
82
  lib/activefacts/generate/json.rb
81
83
  lib/activefacts/generate/null.rb
82
- lib/activefacts/generate/oo.rb
83
- lib/activefacts/generate/ordered.rb
84
84
  lib/activefacts/generate/records.rb
85
85
  lib/activefacts/generate/ruby.rb
86
86
  lib/activefacts/generate/sql/mysql.rb
87
87
  lib/activefacts/generate/sql/server.rb
88
+ lib/activefacts/generate/rails/schema.rb
89
+ lib/activefacts/generate/rails/models.rb
88
90
  lib/activefacts/generate/text.rb
91
+ lib/activefacts/generate/transform/surrogate.rb
89
92
  lib/activefacts/generate/version.rb
90
93
  lib/activefacts/input/cql.rb
91
94
  lib/activefacts/input/orm.rb
95
+ lib/activefacts/mapping/rails.rb
92
96
  lib/activefacts/persistence.rb
93
97
  lib/activefacts/persistence/columns.rb
94
98
  lib/activefacts/persistence/foreignkey.rb
@@ -96,6 +100,7 @@ lib/activefacts/persistence/index.rb
96
100
  lib/activefacts/persistence/object_type.rb
97
101
  lib/activefacts/persistence/reference.rb
98
102
  lib/activefacts/persistence/tables.rb
103
+ lib/activefacts/registry.rb
99
104
  lib/activefacts/support.rb
100
105
  lib/activefacts/version.rb
101
106
  lib/activefacts/vocabulary.rb
@@ -144,5 +149,6 @@ spec/helpers/parse_to_ast_matcher.rb
144
149
  spec/helpers/string_matcher.rb
145
150
  spec/helpers/test_parser.rb
146
151
  spec/spec_helper.rb
152
+ spec/transform_surrogate_spec.rb
147
153
  status.html
148
154
  why.html
data/bin/afgen CHANGED
@@ -6,32 +6,32 @@
6
6
  #
7
7
  $:.unshift File.dirname(File.expand_path(__FILE__))+"/../lib"
8
8
 
9
- require 'rubygems'
10
-
11
9
  require 'activefacts'
12
10
  require 'activefacts/vocabulary'
13
11
 
12
+ # Load the generators:
13
+ generators = []
14
14
  arg = ARGV.shift || "--help"
15
+ while arg =~ /^--([^=]*)(?:=(.*))?/
16
+ module_name, options = $1, ($2||"").split(/,/)
17
+ begin
18
+ base_generators = ActiveFacts::Registry.generators.keys
15
19
 
16
- # Load the required generator, or the default "text" generator:
17
- generator = "text"
18
- generator_options = []
19
- if arg =~ /^--([^=]*)(?:=(.*))?/
20
- generator = $1
21
- generator_options = ($2||"").split(/,/)
22
- arg = ARGV.shift
23
- end
20
+ require "activefacts/generate/#{module_name}"
24
21
 
25
- output_handler = "activefacts/generate/#{generator.downcase}"
26
- begin
27
- require output_handler
28
- rescue LoadError
29
- $stderr.puts "Could not find output generator #{generator}. Try --help"
30
- exit 1
22
+ # One require may load more than one generator. Extract new ones.
23
+ new_generators = ActiveFacts::Registry.generators
24
+ generators += (new_generators.keys-base_generators).map do |gn|
25
+ [new_generators[gn], options]
26
+ end
27
+
28
+ rescue LoadError => e
29
+ $stderr.puts "Could not find output module #{module_name}. Try --help"
30
+ exit 1
31
+ end
32
+
33
+ arg = ARGV.shift
31
34
  end
32
- output_class = generator.upcase.gsub(%r{[/\\]+},'::')
33
- output_klass = eval("ActiveFacts::Generate::#{output_class}")
34
- raise "Expected #{output_handler} to define #{output_class}" unless output_klass
35
35
 
36
36
  # Load the file type input method
37
37
  if arg
@@ -53,8 +53,14 @@ begin
53
53
  vocabulary = true
54
54
  end
55
55
 
56
+ exit 0 unless vocabulary
57
+
58
+ vocabulary.finalise unless vocabulary == true
59
+
56
60
  # Generate the output:
57
- output_klass.new(vocabulary, *generator_options).generate if vocabulary
61
+ generators.each do |generator, options|
62
+ generator.new(vocabulary, *options).generate
63
+ end
58
64
  rescue => e
59
65
  $stderr.puts "#{e.message}"
60
66
  # puts "\t#{e.backtrace*"\n\t"}"
data/bin/cql CHANGED
@@ -141,7 +141,7 @@ class InteractiveCQL < ActiveFacts::CQL::Compiler
141
141
  begin
142
142
  @results = []
143
143
  compile(statement)
144
- if @results.size == 1 && @results[0].is_a?(ActiveFacts::Metamodel::Join)
144
+ if @results.size == 1 && @results[0].is_a?(ActiveFacts::Metamodel::Query)
145
145
  process_query(@results[0])
146
146
  else
147
147
  puts(@results.map{|r| "\t"+r.inspect}*"\n")
@@ -1,3 +1,7 @@
1
+ a:link, a:visited {
2
+ color: #8A0092; text-decoration: underline;
3
+ }
4
+
1
5
  ul {
2
6
  margin: 0px 0px 0px 2em;
3
7
  -webkit-margin-before: 0px;
@@ -6,7 +10,7 @@ ul {
6
10
  padding: 0px;
7
11
  }
8
12
 
9
- pre {
13
+ pre.slide {
10
14
  background-color: #000;
11
15
  padding: 5px;
12
16
  display: table-cell;
@@ -20,20 +24,18 @@ span {
20
24
  }
21
25
 
22
26
  .keyword {
23
- Xcolor: #00F;
24
- color: #66F;
27
+ color: #0000CC;
25
28
  }
26
29
  .term, .concept {
27
- Xcolor: #808;
28
- color: #E0E;
30
+ /* Xcolor: #6A0072; The color used by NORMA */
31
+ color: #8A0092;
29
32
  }
30
33
  .vocabulary, .object_type {
31
- Xcolor: #808;
32
- color: #E0E;
34
+ /* Xcolor: #6A0072; The color used by NORMA */
35
+ color: #8A0092;
33
36
  }
34
37
  .linking, .copula {
35
- Xcolor: #060;
36
- color: #0C0;
38
+ color: #0E5400;
37
39
  }
38
40
  .literal, .value {
39
41
  color: #FF990E;
@@ -41,4 +43,82 @@ span {
41
43
 
42
44
  dd {
43
45
  margin-bottom: 0.5em;
46
+ margin-left: 60px;
47
+ text-indent: -20px;
48
+ }
49
+
50
+ dd ul {
51
+ margin-left: -80px;
52
+ text-indent: 80px;
53
+ }
54
+
55
+
56
+ .glossary-sidebar {
57
+ position: absolute;
58
+ top: 0px;
59
+ bottom: 0px;
60
+ right: 0px;
61
+ width: 240px;
62
+ display: block;
63
+ margin: 0;
64
+ padding: 0 16px;
65
+ border-right: solid #DDD 3px;
66
+ background: #EEE;
67
+ }
68
+
69
+ .glossary-toc {
70
+ position: absolute;
71
+ top: 0px;
72
+ bottom: 24px;
73
+ overflow: auto;
74
+ margin: 0;
75
+ padding: 0 0;
76
+ list-style: none;
77
+ font-family: Menlo, Consolas, Monaco, "Lucida Console", monospace;
78
+ }
79
+
80
+ .glossary-controls {
81
+ position: absolute; bottom: 0px;
82
+ }
83
+
84
+ .glossary-doc {
85
+ position: absolute;
86
+ display: block;
87
+ background: #FFF;
88
+ border-right: solid #EEE 3px;
89
+ font: 300 16px/1.4 "Myriad Pro", "Helvetica Neue", Helvetica, "Arial Unicode MS", Arial, sans-serif;
90
+ overflow: auto;
91
+ padding: 0 0 0 30px;
92
+ top: 0px;
93
+ bottom: 0px;
94
+ left: 0px;
95
+ right: 270px;
96
+ }
97
+
98
+ .glossary-toc li {
99
+ margin-left: 20px;
100
+ text-indent: -20px;
101
+ }
102
+
103
+ .glossary-doc dl {
104
+ margin-bottom: 1600px;
105
+ }
106
+
107
+ .glossary-doc dd {
108
+ margin-bottom: 30px;
109
+ }
110
+
111
+ .glossary-constraint {
112
+ background: #EDC;
113
+ }
114
+
115
+ .value {
116
+ display: inline;
117
+ }
118
+
119
+ .keyword,
120
+ .glossary-facttype,
121
+ .glossary-reading {
122
+ display: inline;
123
+ XXbackground: #E8E8E8;
44
124
  }
@@ -15,11 +15,11 @@ Company is identified by its Name where
15
15
  Company is called Company Name;
16
16
  Company is listed;
17
17
 
18
- Meeting is independent identified by Date and Meeting is board meeting and Company where
19
- Meeting is held on one Date,
20
- Meeting is board meeting,
18
+ Meeting is independent identified by Company and Date and Meeting is board meeting where
19
+ Meeting is held by one Company,
21
20
  Company held Meeting,
22
- Meeting is held by one Company;
21
+ Meeting is held on one Date,
22
+ Meeting is board meeting;
23
23
 
24
24
  Person is identified by given-Name and family-Name where
25
25
  Person has one given-Name,
@@ -18,7 +18,7 @@ Name is written as String(128);
18
18
  Occupation is written as String(128);
19
19
  Official is written as String(64);
20
20
  Person ID is written as Auto Counter;
21
- Picture is written as Image(20);
21
+ Picture is written as Image;
22
22
  Role ID is written as Auto Counter;
23
23
  Source ID is written as Auto Counter;
24
24
  Source Name is written as String(128);
@@ -63,7 +63,7 @@ preferred-Picture is of Person,
63
63
 
64
64
  Role is identified by its ID;
65
65
  Role is called one Event Role Name,
66
- Event Role Name is name of one Role;
66
+ Event Role Name is name of at most one Role;
67
67
 
68
68
  Source is identified by its ID;
69
69
  Source has one Source Name,
@@ -75,9 +75,9 @@ Email is of User,
75
75
  User provided Source,
76
76
  Source was provided by one User;
77
77
 
78
- Friend is where
79
- User is friend of other-User [symmetric];
80
- Friend is confirmed;
78
+ Friendship is where
79
+ User is friendly with other-User [symmetric];
80
+ Friendship is confirmed;
81
81
 
82
82
  Participation is where
83
83
  Person played Role in Event according to Source,
@@ -5,7 +5,8 @@ vocabulary Metamodel;
5
5
  */
6
6
  Adjective is written as String(64);
7
7
  Agent Name is written as String;
8
- Assimilation is written as String restricted to {'partitioned', 'separate'};
8
+ Aggregate Code is written as String(32);
9
+ Assimilation is written as String restricted to {'absorbed', 'partitioned', 'separate'};
9
10
  Context Note Kind is written as String restricted to {'as_opposed_to', 'because', 'so_that', 'to_avoid'};
10
11
  Date is written as Date;
11
12
  Denominator is written as Unsigned Integer(32);
@@ -16,6 +17,7 @@ Ephemera URL is written as String;
16
17
  Exponent is written as Signed Integer(16);
17
18
  Frequency is written as Unsigned Integer(32);
18
19
  Guid is written as Guid;
20
+ Implication Rule Name is written as String;
19
21
  Length is written as Unsigned Integer(32);
20
22
  Literal is written as String;
21
23
  Name is written as String(64);
@@ -23,6 +25,7 @@ Numerator is written as Decimal;
23
25
  Offset is written as Decimal;
24
26
  Ordinal is written as Unsigned Integer(16);
25
27
  Pronoun is written as String(20) restricted to {'feminine', 'masculine', 'neuter', 'personal'};
28
+ Regular Expression is written as String;
26
29
  Ring Type is written as String;
27
30
  Rotation Setting is written as String restricted to {'left', 'right'};
28
31
  Scale is written as Unsigned Integer(32);
@@ -37,9 +40,12 @@ Y is written as Signed Integer(32);
37
40
  */
38
41
  Agent is identified by its Name;
39
42
 
43
+ Aggregate is identified by its Code;
44
+
40
45
  Alternative Set is identified by Guid where
41
46
  Alternative Set has one Guid,
42
47
  Guid is of at most one Alternative Set;
48
+ Alternative Set members are exclusive;
43
49
 
44
50
  Coefficient is identified by Numerator and Denominator and Coefficient is precise where
45
51
  Coefficient has one Numerator,
@@ -55,12 +61,12 @@ Name is of Constraint,
55
61
  Constraint is called at most one Name;
56
62
 
57
63
  Context Note is a kind of Concept [partitioned];
58
- Concept has Context Note,
59
- Context Note applies to at most one Concept;
60
64
  Context Note has one Context Note Kind,
61
65
  Context Note Kind is of Context Note;
62
66
  Context Note has one Discussion,
63
67
  Discussion is for Context Note;
68
+ Context Note applies to at most one relevant-Concept [acyclic, stronglyintransitive],
69
+ Concept has Context Note;
64
70
 
65
71
  Enforcement is identified by Constraint where
66
72
  Constraint requires at most one Enforcement,
@@ -74,26 +80,18 @@ Fact is a kind of Concept [partitioned];
74
80
  Fact Type is a kind of Concept [partitioned];
75
81
  Fact is of one Fact Type;
76
82
 
77
- Implicit Fact Type is a kind of Fact Type;
83
+ Implication Rule is identified by its Name;
84
+ Concept is implied by at most one Implication Rule;
78
85
 
79
86
  Instance is a kind of Concept [partitioned];
80
87
  Instance objectifies at most one Fact,
81
88
  Fact is objectified as at most one Instance;
82
89
 
83
- Join is a kind of Concept [partitioned];
84
-
85
- Join Node is identified by Join and Ordinal where
86
- Join includes Join Node,
87
- Join Node is in one Join,
88
- Join Node has one Ordinal position;
89
- Join Node has at most one Subscript,
90
- Subscript is of Join Node;
91
- Join Node has at most one role-Name,
92
- Name is of Join Node;
90
+ Link Fact Type is a kind of Fact Type;
93
91
 
94
- Position is identified by X and Y where
95
- Position is at one X,
96
- Position is at one Y;
92
+ Location is identified by X and Y where
93
+ Location is at one X,
94
+ Location is at one Y;
97
95
 
98
96
  Presence Constraint is a kind of Constraint;
99
97
  Presence Constraint has at most one max-Frequency restricted to {1..};
@@ -101,12 +99,15 @@ Presence Constraint has at most one min-Frequency restricted to {2..};
101
99
  Presence Constraint is mandatory;
102
100
  Presence Constraint is preferred identifier;
103
101
 
102
+ Query is a kind of Concept [partitioned];
103
+
104
104
  Reading is identified by Fact Type and Ordinal where
105
105
  Fact Type has Reading,
106
106
  Reading is for one Fact Type,
107
107
  Reading is in one Ordinal position,
108
108
  Ordinal reading for fact type is Reading;
109
109
  Reading has one Text;
110
+ Reading is negative;
110
111
 
111
112
  Ring Constraint is a kind of Constraint;
112
113
  Ring Constraint is of one Ring Type;
@@ -116,8 +117,6 @@ Role is a kind of Concept identified by Fact Type and Ordinal [partitioned] wher
116
117
  Fact Type contains Role,
117
118
  Role fills one Ordinal,
118
119
  Ordinal applies to Role;
119
- Implicit Fact Type is implied by one Role (as Implying Role),
120
- Implying Role implies at most one Implicit Fact Type;
121
120
  Ring Constraint has at most one other-Role,
122
121
  other-Role is of Ring Constraint;
123
122
  Role is of Ring Constraint; // Avoid ambiguity; this is a new fact type
@@ -126,6 +125,12 @@ Role is of Ring Constraint,
126
125
  Role has at most one role-Name,
127
126
  role-Name is name of at least one Role;
128
127
 
128
+ Role Proxy is a kind of Role;
129
+ Link Fact Type has one Role Proxy,
130
+ Role Proxy is of at most one Link Fact Type;
131
+ Role Proxy is for at most one Role,
132
+ Role has at most one Role Proxy;
133
+
129
134
  Role Sequence is identified by Guid where
130
135
  Role Sequence has one Guid,
131
136
  Guid is of at most one Role Sequence;
@@ -134,19 +139,19 @@ Reading is in one Role Sequence,
134
139
  Role Sequence is for Reading;
135
140
  Role Sequence has unused dependency to force table in norma;
136
141
 
137
- Role Value is identified by Instance and Fact where
138
- Instance plays Role Value,
139
- Role Value is of one Instance,
142
+ Role Value is identified by Fact and Role where
140
143
  Role Value fulfils one Fact,
141
- Fact includes at least one Role Value;
142
- Role Value is of one Role;
144
+ Fact includes at least one Role Value,
145
+ Role Value is of one Role;
146
+ Instance plays Role Value,
147
+ Role Value is of one Instance;
143
148
 
144
149
  Set Constraint is a kind of Constraint;
145
150
 
146
151
  Shape is identified by Guid where
147
152
  Shape has one Guid,
148
153
  Guid is of at most one Shape;
149
- Shape is at at most one Position;
154
+ Shape is at at most one Location;
150
155
  Shape is expanded;
151
156
 
152
157
  Subset Constraint is a kind of Set Constraint;
@@ -160,22 +165,35 @@ Name is of at most one Unit,
160
165
  Unit is called one Name;
161
166
  Unit has at most one Coefficient;
162
167
  Unit has at most one Offset;
168
+ Unit has plural-Name; // Avoid ambiguity; this is a new fact type
163
169
  Unit has at most one plural-Name,
164
- plural-Name id of at most one Unit;
170
+ plural-Name is of at most one Unit;
165
171
  Unit is fundamental;
166
172
 
167
- Value is identified by Literal and Value is a string and Unit where
173
+ Value is identified by Literal and Value is literal string and Unit where
168
174
  Value is represented by one Literal,
169
175
  Literal represents Value,
170
- Value is a string,
176
+ Value is literal string,
171
177
  Value is in at most one Unit,
172
178
  Unit is of Value;
173
179
  Instance has at most one Value;
174
- Join Node has at most one Value;
175
180
 
176
181
  Value Constraint is a kind of Constraint;
177
182
  Role has at most one role-Value Constraint,
178
183
  Value Constraint applies to at most one Role;
184
+ Value Constraint requires matching at most one Regular Expression;
185
+
186
+ Variable is identified by Query and Ordinal where
187
+ Query includes at least one Variable,
188
+ Variable is in one Query,
189
+ Variable has one Ordinal position;
190
+ Variable projects at most one Role (as Projection),
191
+ Projection is projected from at most one Variable;
192
+ Variable has at most one Subscript,
193
+ Subscript is of Variable;
194
+ Variable is bound to at most one Value;
195
+ Variable has at most one role-Name,
196
+ Name is of Variable;
179
197
 
180
198
  Vocabulary is identified by Name where
181
199
  Vocabulary is called one Name;
@@ -184,6 +202,10 @@ Vocabulary contains Constraint,
184
202
  Vocabulary includes Unit,
185
203
  Unit is in one Vocabulary;
186
204
 
205
+ Aggregation is where
206
+ Variable is bound to Aggregate over aggregated-Variable,
207
+ Aggregate of aggregated-Variable is bound as one Variable;
208
+
187
209
  Agreement is identified by Context Note where
188
210
  Context Note was added by at most one Agreement,
189
211
  Agreement covers one Context Note;
@@ -216,8 +238,6 @@ Diagram is identified by Vocabulary and Name where
216
238
  Vocabulary contains Diagram,
217
239
  Diagram is called one Name,
218
240
  Name is of Diagram;
219
- Shape is in one Diagram,
220
- Diagram includes Shape;
221
241
 
222
242
  Fact Type Shape is a kind of Shape;
223
243
  Fact Type Shape has at most one Display Role Names Setting;
@@ -225,45 +245,37 @@ Fact Type Shape is for one Fact Type,
225
245
  Fact Type has Fact Type Shape;
226
246
  Fact Type Shape has at most one Rotation Setting;
227
247
 
228
- Join Role is independent where
229
- Join Node includes at least one Role,
230
- Role connects to Join Node;
231
-
232
- Join Step is identified by input-Join Role and output-Join Role where
233
- Join Step has one input-Join Role,
234
- Join Step has one output-Join Role;
235
- Join Step falls under at most one Alternative Set,
236
- Alternative Set covers at least one Join Step;
237
- Join Step traverses one Fact Type,
238
- Fact Type directs Join Step;
239
- Join Step involves incidental-Join Role,
240
- Join Role is incidentally involved in at most one Join Step;
241
- is anti Join Step;
242
- Join Step is outer;
243
-
244
248
  Model Note Shape is a kind of Shape;
245
249
  Model Note Shape is for one Context Note;
246
250
 
251
+ ORM Diagram is a kind of Diagram;
252
+ Shape is in one ORM Diagram,
253
+ ORM Diagram includes Shape;
254
+
247
255
  Object Type is a kind of Concept identified by Vocabulary and Name [partitioned] where
248
256
  Object Type belongs to one Vocabulary,
249
257
  Object Type is called one Name;
250
258
  Instance is of one Object Type;
251
- Join Node is for one Object Type,
252
- Object Type is referenced in Join Node;
253
259
  Object Type uses at most one Pronoun;
254
260
  Object Type plays Role,
255
261
  Role is played by one Object Type;
256
262
  Object Type is independent;
263
+ Variable is for one Object Type,
264
+ Object Type is referenced in Variable;
257
265
 
258
266
  Object Type Shape is a kind of Shape;
259
267
  Object Type Shape is for one Object Type,
260
268
  Object Type has Object Type Shape;
261
269
  Object Type Shape has expanded reference mode;
262
270
 
263
- Objectified Fact Type Name Shape is a kind of Shape identified by Fact Type Shape where
264
- Objectified Fact Type Name Shape is for one Fact Type Shape,
271
+ Objectified Fact Type Name Shape is a kind of Shape;
272
+ Objectified Fact Type Name Shape is for one Fact Type Shape,
265
273
  Fact Type Shape has at most one Objectified Fact Type Name Shape;
266
274
 
275
+ Play is where
276
+ Variable is restricted by Role,
277
+ Role controls Variable;
278
+
267
279
  Population is a kind of Concept identified by Vocabulary and Name [partitioned] where
268
280
  Vocabulary includes Population,
269
281
  Population belongs to at most one Vocabulary,
@@ -276,8 +288,8 @@ Population includes Instance,
276
288
  Population includes Role Value,
277
289
  Role Value belongs to one Population;
278
290
 
279
- Reading Shape is a kind of Shape identified by Fact Type Shape where
280
- Fact Type Shape has at most one Reading Shape,
291
+ Reading Shape is a kind of Shape;
292
+ Fact Type Shape has at most one Reading Shape,
281
293
  Reading Shape is for one Fact Type Shape;
282
294
  Reading Shape is for one Reading,
283
295
  Reading has Reading Shape;
@@ -298,7 +310,7 @@ Role Ref is where
298
310
  Role is in Role Sequence in one Ordinal place,
299
311
  Role Sequence includes Role in Ordinal place,
300
312
  Role has Ordinal place in Role Sequence;
301
- Join Role projects at most one Role Ref;
313
+ Play projects at most one Role Ref;
302
314
  Role Ref has at most one leading-Adjective;
303
315
  Role Ref has at most one trailing-Adjective;
304
316
 
@@ -315,6 +327,18 @@ Set Equality Constraint is a kind of Set Comparison Constraint;
315
327
  Set Exclusion Constraint is a kind of Set Comparison Constraint;
316
328
  Set Exclusion Constraint is mandatory;
317
329
 
330
+ Step is identified by input-Play and output-Play where
331
+ Step has one input-Play,
332
+ Step has at most one output-Play;
333
+ Step falls under at most one Alternative Set,
334
+ Alternative Set covers at least one Step;
335
+ Step specifies one Fact Type,
336
+ Fact Type directs Step;
337
+ Step involves incidental-Play,
338
+ Play is incidentally involved in at most one Step;
339
+ Step is disallowed;
340
+ Step is optional;
341
+
318
342
  Value Constraint Shape is a kind of Constraint Shape;
319
343
  Role Display has at most one Value Constraint Shape,
320
344
  Value Constraint Shape is for at most one Role Display;
@@ -325,43 +349,48 @@ Value Range is identified by minimum-Bound and maximum-Bound where
325
349
  Value Range has at most one minimum-Bound,
326
350
  Value Range has at most one maximum-Bound;
327
351
 
328
- Value Type is a kind of Object Type;
352
+ Allowed Range is where
353
+ Value Constraint allows Value Range;
354
+
355
+ Domain Object Type is a kind of Object Type;
356
+
357
+ Entity Type is a kind of Domain Object Type;
358
+ Entity Type nests at most one Fact Type,
359
+ Fact Type is nested as at most one Entity Type;
360
+
361
+ Type Inheritance is a kind of Fact Type identified by Subtype and Supertype where
362
+ Entity Type (as Subtype) is subtype of super-Entity Type (as Supertype) [acyclic, intransitive],
363
+ Supertype is supertype of Subtype;
364
+ Assimilation applies to Type Inheritance,
365
+ Type Inheritance uses at most one Assimilation;
366
+ Type Inheritance provides identification;
367
+
368
+ Value Type is a kind of Domain Object Type;
369
+ Value is of one Value Type,
370
+ Value Type has Value;
329
371
  Value Type has at most one Length,
330
372
  Length is of Value Type;
331
373
  Value Type has at most one Scale,
332
374
  Scale is of Value Type;
375
+ Value Type is auto-assigned at at most one Transaction Timing;
333
376
  Value Type is of at most one Unit;
334
377
  Value Type has at most one Value Constraint,
335
378
  Value Constraint constrains at most one Value Type;
336
- Value Type has at most one auto-- assigned Transaction Timing;
337
379
  Value Type is subtype of at most one super-Value Type (as Supertype) [acyclic, transitive],
338
380
  Supertype is supertype of Value Type;
339
381
 
340
- Allowed Range is where
341
- Value Constraint allows at least one Value Range;
342
-
343
- Entity Type is a kind of Object Type;
344
- Entity Type nests at most one Fact Type,
345
- Fact Type is nested as at most one Entity Type;
346
- Entity Type is implied by objectification;
347
-
348
382
  Facet is where
349
383
  Value Type has facet called Name,
350
384
  Name is a facet of Value Type;
385
+ Facet requires value of one facet-Value Type;
351
386
 
352
- Facet Value is where
353
- Value Type defines Facet as having one Value,
354
- Value for Facet applies to Value Type;
387
+ Facet Restriction is where
388
+ Value Type applies Facet,
389
+ Facet applies to Value Type;
390
+ Facet Restriction has one Value;
355
391
 
356
392
  Implicit Boolean Value Type is a kind of Value Type;
357
393
 
358
- Type Inheritance is a kind of Fact Type identified by Subtype and Supertype where
359
- Entity Type (as Subtype) is subtype of super-Entity Type (as Supertype) [acyclic, intransitive],
360
- Supertype is supertype of Subtype;
361
- Assimilation applies to Type Inheritance,
362
- Type Inheritance uses at most one Assimilation;
363
- Type Inheritance provides identification;
364
-
365
394
  /*
366
395
  * Constraints:
367
396
  */
@@ -374,13 +403,13 @@ for each Concept exactly one of these holds:
374
403
  Concept is a Constraint,
375
404
  Concept is a Population,
376
405
  Concept is an Unit,
377
- Concept is a Join,
406
+ Concept is a Query,
378
407
  Concept is a Context Note;
379
408
  for each Constraint exactly one of these holds:
380
409
  Constraint is a Presence Constraint,
381
410
  Constraint is a Set Constraint,
382
411
  Constraint is a Ring Constraint;
383
- either Object Type is an Entity Type or Object Type is a Value Type but not both;
412
+ either Domain Object Type is a Value Type or Domain Object Type is an Entity Type but not both;
384
413
  for each Role Sequence exactly one of these holds:
385
414
  Role Sequence is for Reading,
386
415
  Presence Constraint covers Role Sequence,
@@ -392,44 +421,45 @@ either Set Constraint is a Set Comparison Constraint or Set Constraint is a Subs
392
421
  either Unit uses coefficient from Ephemera URL or Unit has Coefficient but not both;
393
422
  either Unit is fundamental or Unit is derived from base-Unit but not both;
394
423
  either Value Constraint Shape is for Object Type Shape or Value Constraint Shape is for Role Display but not both;
424
+ either Value Constraint allows Value Range or Value Constraint requires matching Regular Expression but not both;
395
425
  either Value Constraint constrains Value Type or Value Constraint applies to Role but not both;
396
426
  for each Instance at most one of these holds:
397
427
  Instance has Value,
398
428
  Instance objectifies Fact;
399
- for each Join Role at most one of these holds:
400
- Join Step (1) has input-Join Role,
401
- Join Role is incidentally involved in Join Step;
402
- for each Join Role at most one of these holds:
403
- Join Step (1) has output-Join Role,
404
- Join Role is incidentally involved in Join Step;
405
- Join Node is for Object Type that plays Role
406
- if and only if
407
- Join Node includes Role;
429
+ for each Play at most one of these holds:
430
+ Step (1) has input-Play,
431
+ Play is incidentally involved in Step;
432
+ for each Play at most one of these holds:
433
+ Step (1) has output-Play,
434
+ Play is incidentally involved in Step;
408
435
  Role Value is of Instance that is of Object Type
409
436
  if and only if
410
437
  Role Value is of Role that is played by Object Type;
411
438
  Role Value fulfils Fact that is of Fact Type
412
439
  if and only if
413
440
  Role Value is of Role that belongs to Fact Type;
414
- Entity Type is implied by objectification
415
- only if Entity Type nests Fact Type;
441
+ Variable is for Object Type that plays Role
442
+ if and only if
443
+ Variable is restricted by Role;
416
444
  Presence Constraint is preferred identifier
417
445
  only if Presence Constraint has max Frequency;
446
+ Step involves incidental Play
447
+ only if Step has output Play;
418
448
  Value Type has Scale
419
449
  only if Value Type has Length;
420
450
  either Agreement was reached by Agent or Agreement was on Date;
421
- each combination Diagram, Position occurs at most one time in
422
- Shape is in Diagram,
423
- Shape is at Position;
424
451
  each combination Entity Type(1), Type Inheritance occurs at most one time in
425
452
  Entity Type(1) is subtype of super Entity Type(2),
426
453
  Type Inheritance provides identification;
454
+ each combination ORM Diagram, Location occurs at most one time in
455
+ Shape is in ORM Diagram,
456
+ Shape is at Location;
427
457
  each Presence Constraint occurs at least one time in
428
458
  Presence Constraint has min Frequency(2),
429
459
  Presence Constraint has max Frequency(1),
430
460
  Presence Constraint is mandatory;
431
461
  each Role Ref occurs at most one time in
432
- Join Role projects Role Ref;
462
+ Play projects Role Ref;
433
463
  each Role Sequence occurs at least one time in
434
464
  Role Sequence in Ordinal position includes Role;
435
465
  each Set Comparison Constraint occurs at least 2 times in