activefacts 1.6.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +14 -0
- data/LICENSE.txt +21 -0
- data/README.md +60 -0
- data/Rakefile +3 -80
- data/activefacts.gemspec +36 -0
- data/bin/afgen +4 -2
- data/bin/cql +5 -1
- data/lib/activefacts.rb +3 -12
- data/lib/activefacts/{vocabulary/query_evaluator.rb → query/evaluator.rb} +0 -0
- data/lib/activefacts/version.rb +2 -2
- metadata +48 -296
- data/History.txt +0 -4
- data/LICENSE +0 -19
- data/Manifest.txt +0 -165
- data/README.rdoc +0 -81
- data/css/offline.css +0 -3
- data/css/orm2.css +0 -124
- data/css/print.css +0 -8
- data/css/style-print.css +0 -357
- data/css/style.css +0 -387
- data/download.html +0 -110
- data/examples/CQL/Address.cql +0 -44
- data/examples/CQL/Blog.cql +0 -54
- data/examples/CQL/CompanyDirectorEmployee.cql +0 -56
- data/examples/CQL/Death.cql +0 -17
- data/examples/CQL/Diplomacy.cql +0 -48
- data/examples/CQL/Genealogy.cql +0 -98
- data/examples/CQL/Insurance.cql +0 -320
- data/examples/CQL/Marriage.cql +0 -18
- data/examples/CQL/Metamodel.cql +0 -493
- data/examples/CQL/Monogamy.cql +0 -24
- data/examples/CQL/MultiInheritance.cql +0 -22
- data/examples/CQL/NonRoleId.cql +0 -14
- data/examples/CQL/OddIdentifier.cql +0 -18
- data/examples/CQL/OilSupply.cql +0 -53
- data/examples/CQL/OneToOnes.cql +0 -17
- data/examples/CQL/Orienteering.cql +0 -111
- data/examples/CQL/PersonPlaysGame.cql +0 -18
- data/examples/CQL/RedundantDependency.cql +0 -34
- data/examples/CQL/SchoolActivities.cql +0 -33
- data/examples/CQL/SeparateSubtype.cql +0 -30
- data/examples/CQL/ServiceDirector.cql +0 -276
- data/examples/CQL/SimplestUnary.cql +0 -12
- data/examples/CQL/Supervision.cql +0 -34
- data/examples/CQL/WaiterTips.cql +0 -33
- data/examples/CQL/Warehousing.cql +0 -101
- data/examples/CQL/WindowInRoomInBldg.cql +0 -28
- data/examples/CQL/unit.cql +0 -474
- data/examples/index.html +0 -420
- data/examples/intro.html +0 -327
- data/examples/local.css +0 -24
- data/index.html +0 -111
- data/lib/activefacts/cql.rb +0 -35
- data/lib/activefacts/cql/CQLParser.treetop +0 -158
- data/lib/activefacts/cql/Context.treetop +0 -48
- data/lib/activefacts/cql/Expressions.treetop +0 -67
- data/lib/activefacts/cql/FactTypes.treetop +0 -358
- data/lib/activefacts/cql/Language/English.treetop +0 -315
- data/lib/activefacts/cql/LexicalRules.treetop +0 -253
- data/lib/activefacts/cql/ObjectTypes.treetop +0 -210
- data/lib/activefacts/cql/Rakefile +0 -14
- data/lib/activefacts/cql/Terms.treetop +0 -183
- data/lib/activefacts/cql/ValueTypes.treetop +0 -202
- data/lib/activefacts/cql/compiler.rb +0 -156
- data/lib/activefacts/cql/compiler/clause.rb +0 -1137
- data/lib/activefacts/cql/compiler/constraint.rb +0 -581
- data/lib/activefacts/cql/compiler/entity_type.rb +0 -457
- data/lib/activefacts/cql/compiler/expression.rb +0 -443
- data/lib/activefacts/cql/compiler/fact.rb +0 -390
- data/lib/activefacts/cql/compiler/fact_type.rb +0 -421
- data/lib/activefacts/cql/compiler/query.rb +0 -106
- data/lib/activefacts/cql/compiler/shared.rb +0 -161
- data/lib/activefacts/cql/compiler/value_type.rb +0 -174
- data/lib/activefacts/cql/nodes.rb +0 -49
- data/lib/activefacts/cql/parser.rb +0 -241
- data/lib/activefacts/dependency_analyser.rb +0 -182
- data/lib/activefacts/generate/absorption.rb +0 -70
- data/lib/activefacts/generate/composition.rb +0 -118
- data/lib/activefacts/generate/cql.rb +0 -714
- data/lib/activefacts/generate/dm.rb +0 -279
- data/lib/activefacts/generate/help.rb +0 -64
- data/lib/activefacts/generate/helpers/inject.rb +0 -16
- data/lib/activefacts/generate/helpers/oo.rb +0 -162
- data/lib/activefacts/generate/helpers/ordered.rb +0 -605
- data/lib/activefacts/generate/helpers/rails.rb +0 -57
- data/lib/activefacts/generate/html/glossary.rb +0 -461
- data/lib/activefacts/generate/json.rb +0 -337
- data/lib/activefacts/generate/null.rb +0 -32
- data/lib/activefacts/generate/rails/models.rb +0 -246
- data/lib/activefacts/generate/rails/schema.rb +0 -216
- data/lib/activefacts/generate/records.rb +0 -46
- data/lib/activefacts/generate/ruby.rb +0 -133
- data/lib/activefacts/generate/sql/mysql.rb +0 -280
- data/lib/activefacts/generate/sql/server.rb +0 -273
- data/lib/activefacts/generate/stats.rb +0 -69
- data/lib/activefacts/generate/text.rb +0 -27
- data/lib/activefacts/generate/topics.rb +0 -265
- data/lib/activefacts/generate/traits/datavault.rb +0 -241
- data/lib/activefacts/generate/traits/oo.rb +0 -73
- data/lib/activefacts/generate/traits/ordered.rb +0 -33
- data/lib/activefacts/generate/traits/ruby.rb +0 -210
- data/lib/activefacts/generate/transform/datavault.rb +0 -266
- data/lib/activefacts/generate/transform/surrogate.rb +0 -214
- data/lib/activefacts/generate/version.rb +0 -26
- data/lib/activefacts/input/cql.rb +0 -43
- data/lib/activefacts/input/orm.rb +0 -1636
- data/lib/activefacts/mapping/rails.rb +0 -132
- data/lib/activefacts/persistence.rb +0 -15
- data/lib/activefacts/persistence/columns.rb +0 -446
- data/lib/activefacts/persistence/foreignkey.rb +0 -187
- data/lib/activefacts/persistence/index.rb +0 -240
- data/lib/activefacts/persistence/object_type.rb +0 -198
- data/lib/activefacts/persistence/reference.rb +0 -434
- data/lib/activefacts/persistence/tables.rb +0 -380
- data/lib/activefacts/registry.rb +0 -11
- data/lib/activefacts/support.rb +0 -132
- data/lib/activefacts/vocabulary.rb +0 -9
- data/lib/activefacts/vocabulary/extensions.rb +0 -1348
- data/lib/activefacts/vocabulary/metamodel.rb +0 -570
- data/lib/activefacts/vocabulary/verbaliser.rb +0 -804
- data/script/txt2html +0 -71
- data/spec/absorption_spec.rb +0 -95
- data/spec/cql/comparison_spec.rb +0 -89
- data/spec/cql/context_spec.rb +0 -94
- data/spec/cql/contractions_spec.rb +0 -224
- data/spec/cql/deontic_spec.rb +0 -88
- data/spec/cql/entity_type_spec.rb +0 -320
- data/spec/cql/expressions_spec.rb +0 -66
- data/spec/cql/fact_type_matching_spec.rb +0 -338
- data/spec/cql/french_spec.rb +0 -21
- data/spec/cql/parser/bad_literals_spec.rb +0 -86
- data/spec/cql/parser/constraints_spec.rb +0 -19
- data/spec/cql/parser/entity_types_spec.rb +0 -106
- data/spec/cql/parser/expressions_spec.rb +0 -199
- data/spec/cql/parser/fact_types_spec.rb +0 -44
- data/spec/cql/parser/literals_spec.rb +0 -312
- data/spec/cql/parser/pragmas_spec.rb +0 -89
- data/spec/cql/parser/value_types_spec.rb +0 -42
- data/spec/cql/role_matching_spec.rb +0 -148
- data/spec/cql/samples_spec.rb +0 -244
- data/spec/cql_cql_spec.rb +0 -73
- data/spec/cql_dm_spec.rb +0 -136
- data/spec/cql_mysql_spec.rb +0 -69
- data/spec/cql_parse_spec.rb +0 -34
- data/spec/cql_ruby_spec.rb +0 -73
- data/spec/cql_sql_spec.rb +0 -72
- data/spec/cql_symbol_tables_spec.rb +0 -261
- data/spec/cqldump_spec.rb +0 -170
- data/spec/helpers/array_matcher.rb +0 -23
- data/spec/helpers/ctrl_c_support.rb +0 -52
- data/spec/helpers/diff_matcher.rb +0 -39
- data/spec/helpers/file_matcher.rb +0 -34
- data/spec/helpers/parse_to_ast_matcher.rb +0 -80
- data/spec/helpers/string_matcher.rb +0 -30
- data/spec/helpers/test_parser.rb +0 -15
- data/spec/norma_cql_spec.rb +0 -66
- data/spec/norma_ruby_spec.rb +0 -62
- data/spec/norma_ruby_sql_spec.rb +0 -107
- data/spec/norma_sql_spec.rb +0 -57
- data/spec/norma_tables_spec.rb +0 -95
- data/spec/ruby_api_spec.rb +0 -23
- data/spec/spec_helper.rb +0 -35
- data/spec/transform_surrogate_spec.rb +0 -59
- data/status.html +0 -138
- data/why.html +0 -60
data/spec/norma_sql_spec.rb
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# ActiveFacts tests: Parse all CQL files and check the generated Ruby.
|
3
|
-
# Copyright (c) 2008 Clifford Heath. Read the LICENSE file.
|
4
|
-
#
|
5
|
-
|
6
|
-
require 'spec_helper'
|
7
|
-
require 'stringio'
|
8
|
-
require 'activefacts/vocabulary'
|
9
|
-
require 'activefacts/support'
|
10
|
-
require 'activefacts/persistence'
|
11
|
-
require 'activefacts/input/orm'
|
12
|
-
require 'activefacts/generate/sql/server'
|
13
|
-
|
14
|
-
describe "NORMA Loader with SQL output" do
|
15
|
-
orm_failures = {
|
16
|
-
"SubtypePI" => "Has an illegal uniqueness constraint",
|
17
|
-
}
|
18
|
-
# Generate and return the SQL for the given vocabulary
|
19
|
-
def sql(vocabulary)
|
20
|
-
output = StringIO.new
|
21
|
-
@dumper = ActiveFacts::Generate::SQL::SERVER.new(vocabulary.constellation)
|
22
|
-
@dumper.generate(output)
|
23
|
-
output.rewind
|
24
|
-
output.read
|
25
|
-
end
|
26
|
-
|
27
|
-
pattern = ENV["AFTESTS"] || "*"
|
28
|
-
Dir["examples/norma/#{pattern}.orm"].each do |orm_file|
|
29
|
-
expected_file = orm_file.sub(%r{examples/norma/(.*).orm\Z}, 'examples/SQL/\1.sql')
|
30
|
-
actual_file = orm_file.sub(%r{examples/norma/(.*).orm\Z}, 'spec/actual/\1.sql')
|
31
|
-
base = File.basename(orm_file, ".orm")
|
32
|
-
|
33
|
-
next unless ENV["AFTESTS"] || File.exists?(expected_file)
|
34
|
-
|
35
|
-
it "should load #{orm_file} and dump SQL matching #{expected_file}" do
|
36
|
-
begin
|
37
|
-
vocabulary = ActiveFacts::Input::ORM.readfile(orm_file)
|
38
|
-
rescue => e
|
39
|
-
raise unless orm_failures.include?(base)
|
40
|
-
pending orm_failures[base]
|
41
|
-
end
|
42
|
-
|
43
|
-
# Build and save the actual file:
|
44
|
-
sql_text = sql(vocabulary)
|
45
|
-
Dir.mkdir "spec/actual" rescue nil
|
46
|
-
File.open(actual_file, "w") { |f| f.write sql_text }
|
47
|
-
|
48
|
-
pending("expected output file #{expected_file} not found") unless File.exists? expected_file
|
49
|
-
|
50
|
-
expected_text = File.open(expected_file) {|f| f.read }
|
51
|
-
sql_text.gsub!(/ INDEX (\[[^\]]*\]|`[^`]*`|[^ ]*) ON /, ' INDEX <Name is hidden> ON ')
|
52
|
-
expected_text.gsub!(/ INDEX (\[[^\]]*\]|`[^`]*`|[^ ]*) ON /, ' INDEX <Name is hidden> ON ')
|
53
|
-
sql_text.should_not differ_from(expected_text)
|
54
|
-
File.delete(actual_file) # It succeeded, we don't need the file.
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
data/spec/norma_tables_spec.rb
DELETED
@@ -1,95 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# ActiveFacts test:
|
3
|
-
#
|
4
|
-
# Parse all NORMA files, compute the composition (list of tables)
|
5
|
-
# and compare that with NORMA's output.
|
6
|
-
#
|
7
|
-
# Copyright (c) 2008 Clifford Heath. Read the LICENSE file.
|
8
|
-
#
|
9
|
-
|
10
|
-
require 'spec_helper'
|
11
|
-
require 'stringio'
|
12
|
-
require 'activefacts/vocabulary'
|
13
|
-
require 'activefacts/persistence'
|
14
|
-
require 'activefacts/support'
|
15
|
-
require 'activefacts/input/orm'
|
16
|
-
|
17
|
-
# The exceptions table is keyed by the model name, and contains the added and removed table names vs NORMA
|
18
|
-
orm_failures = {
|
19
|
-
}
|
20
|
-
norma_table_exceptions = {
|
21
|
-
"Corporate" => [%w{}, %w{Comment ContactReport ID Money Name Nr Photo ReferenceCheck Resource TimeDivision}], # ActiveFacts absorbs Agreement into ContextNote, Enforcement into Constraint, lots into Concept
|
22
|
-
"Metamodel" => [%w{Query}, %w{Agreement Enforcement Comment ContactReport ID Money Nr Photo ReferenceCheck Resource TimeDivision Constraint ContextNote Fact Instance Query Unit}], # ActiveFacts absorbs Agreement into ContextNote, Enforcement into Constraint, lots into Concept
|
23
|
-
"MetamodelNext" => [[], %w{Agreement Enforcement TypeInheritance}],
|
24
|
-
"Orienteering" => [%w{Punch}, []], # NORMA doesn't make a table for the IDENTITY field
|
25
|
-
"OrienteeringER" => [%w{SeriesEvent}, []], # NORMA doesn't make a table for the IDENTITY field
|
26
|
-
"RedundantDependency" => [%w{Politician StateOrProvince}, %w{LegislativeDistrict}], # NORMA doesn't make a table for the 3 IDENTITY fields
|
27
|
-
"Warehousing" => [%w{Product Warehouse}, %w{Dispatch Receipt}], # NORMA doesn't make a table for the IDENTITY field
|
28
|
-
"ServiceDirector" => [%w{DataStoreService MonitorNotificationUser}, %w{DataStoreFileHostSystem }],
|
29
|
-
"SeparateSubtype" => [%w{Claim}, %w{Incident}],
|
30
|
-
}
|
31
|
-
|
32
|
-
def extract_created_tables_from_sql sql_file
|
33
|
-
File.open(sql_file) do |f|
|
34
|
-
f.
|
35
|
-
readlines.
|
36
|
-
select do |l|
|
37
|
-
l =~ /CREATE TABLE/
|
38
|
-
end.
|
39
|
-
map do |l|
|
40
|
-
l.chomp.gsub(/.*CREATE TABLE\s+\W*(\w+\.)?"?(\w+)"?.*/, '\2')
|
41
|
-
end.
|
42
|
-
sort
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
describe "Relational Composition from NORMA" do
|
47
|
-
pattern = ENV["AFTESTS"] || "*"
|
48
|
-
Dir["examples/norma/#{pattern}.orm"].each do |orm_file|
|
49
|
-
exception = norma_table_exceptions[File.basename(orm_file, ".orm")]
|
50
|
-
sql_file_pattern = orm_file.sub(/\.orm\Z/, '.*sql')
|
51
|
-
sql_file = Dir[sql_file_pattern][0]
|
52
|
-
next unless sql_file
|
53
|
-
base = File.basename(orm_file, ".orm")
|
54
|
-
|
55
|
-
it "should load #{orm_file} and compute #{
|
56
|
-
(exception ? "a modified" : "the same") + " list of tables similar to those in #{sql_file}"
|
57
|
-
}" do
|
58
|
-
|
59
|
-
# Read the ORM file:
|
60
|
-
begin
|
61
|
-
vocabulary = ActiveFacts::Input::ORM.readfile(orm_file)
|
62
|
-
rescue => e
|
63
|
-
raise unless orm_failures.include?(base)
|
64
|
-
pending orm_failures[base]
|
65
|
-
end
|
66
|
-
|
67
|
-
# Get the list of tables from NORMA's SQL:
|
68
|
-
expected_tables = extract_created_tables_from_sql(sql_file)
|
69
|
-
if exception
|
70
|
-
expected_tables = expected_tables + exception[0] - exception[1]
|
71
|
-
end
|
72
|
-
|
73
|
-
# Get the list of tables from our composition:
|
74
|
-
tables = vocabulary.tables
|
75
|
-
table_names = tables.map{|o| o.name.gsub(/\s/,'')}.sort
|
76
|
-
|
77
|
-
# Save the actual and expected composition to files
|
78
|
-
actual_tables_file = orm_file.sub(%r{examples/norma/(.*).orm\Z}, 'spec/actual/\1.tables')
|
79
|
-
File.open(actual_tables_file, "w") { |f| f.puts table_names*"\n" }
|
80
|
-
expected_tables_file = orm_file.sub(%r{examples/norma/(.*).orm\Z}, 'spec/actual/\1.expected.tables')
|
81
|
-
File.open(expected_tables_file, "w") { |f| f.puts expected_tables*"\n" }
|
82
|
-
|
83
|
-
# Check that the list matched:
|
84
|
-
table_names.should_not differ_from(expected_tables)
|
85
|
-
|
86
|
-
# Calculate the columns and column names; REVISIT: check the results
|
87
|
-
tables.each do |table|
|
88
|
-
table.columns
|
89
|
-
end
|
90
|
-
|
91
|
-
File.delete(actual_tables_file)
|
92
|
-
File.delete(expected_tables_file)
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
data/spec/ruby_api_spec.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# ActiveFacts tests: Compare column lists created by aborption and by generated Ruby.
|
3
|
-
# Copyright (c) 2008 Clifford Heath. Read the LICENSE file.
|
4
|
-
#
|
5
|
-
|
6
|
-
require 'spec_helper'
|
7
|
-
require 'stringio'
|
8
|
-
require 'activefacts/vocabulary'
|
9
|
-
require 'activefacts/support'
|
10
|
-
|
11
|
-
describe "Requiring vocabularies in Ruby" do
|
12
|
-
ruby_failures = {
|
13
|
-
"MetamodelNext" => "Has a duplicate role name",
|
14
|
-
}
|
15
|
-
pattern = ENV["AFTESTS"] || "*"
|
16
|
-
Dir["examples/ruby/#{pattern}.rb"].each do |ruby_file|
|
17
|
-
base = File.basename(ruby_file, ".rb")
|
18
|
-
next if ruby_failures.include?(base)
|
19
|
-
it "#{ruby_file} should load cleanly" do
|
20
|
-
require "./"+ruby_file
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# A Custom Matcher for RSpec that shows the difference between two multi-line strings.
|
3
|
-
#
|
4
|
-
# Usage:
|
5
|
-
# actual_text.should_not differ_from(expected_text)
|
6
|
-
#
|
7
|
-
|
8
|
-
require 'helpers/diff_matcher'
|
9
|
-
require 'helpers/array_matcher'
|
10
|
-
require 'helpers/file_matcher'
|
11
|
-
require 'helpers/string_matcher'
|
12
|
-
require 'helpers/parse_to_ast_matcher'
|
13
|
-
|
14
|
-
Dir[File.dirname(__FILE__)+"/helpers/**rb"].each do |helper| require helper; end
|
15
|
-
|
16
|
-
class String
|
17
|
-
def strip_comments()
|
18
|
-
c_comment = %r{/\*((?!\*/).)*\*/}m
|
19
|
-
gsub(c_comment, '').gsub(%r{\n\n+},"\n")
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
class Array
|
24
|
-
def diff_strings(a2)
|
25
|
-
d = Diff::LCS::diff(self, a2)
|
26
|
-
d.map do |chunk|
|
27
|
-
added_at = (add = chunk.detect{|d| d.action == '+'}) && add.position+1
|
28
|
-
removed_at = (remove = chunk.detect{|d| d.action == '-'}) && remove.position+1
|
29
|
-
"Line #{added_at}/#{removed_at}:\n"+
|
30
|
-
chunk.map do |change|
|
31
|
-
"#{change.action} #{change.element}"
|
32
|
-
end*"\n"
|
33
|
-
end*"\n"
|
34
|
-
end
|
35
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# ActiveFacts tests: Parse all CQL files and check the surrogate key transformation
|
3
|
-
# Copyright (c) 2012 Clifford Heath. Read the LICENSE file.
|
4
|
-
#
|
5
|
-
|
6
|
-
require 'spec_helper'
|
7
|
-
require 'stringio'
|
8
|
-
require 'activefacts/vocabulary'
|
9
|
-
require 'activefacts/support'
|
10
|
-
require 'activefacts/input/cql'
|
11
|
-
require 'activefacts/generate/absorption'
|
12
|
-
require 'activefacts/generate/transform/surrogate'
|
13
|
-
|
14
|
-
describe "CQL Loader with Surrogate transformation" do
|
15
|
-
cql_failures = {
|
16
|
-
}
|
17
|
-
|
18
|
-
pattern = ENV["AFTESTS"] || "*"
|
19
|
-
Dir["examples/CQL/#{pattern}.cql"].each do |cql_file|
|
20
|
-
expected_file = cql_file.sub(%r{/CQL/(.*).cql\Z}, '/transform-surrogate/\1.transform-surrogate')
|
21
|
-
actual_file = cql_file.sub(%r{examples/CQL/(.*).cql\Z}, 'spec/actual/\1.transform-surrogate')
|
22
|
-
|
23
|
-
next unless ENV["AFTESTS"] || File.exists?(expected_file)
|
24
|
-
|
25
|
-
it "should load #{cql_file} and make transformations like #{expected_file}" do
|
26
|
-
vocabulary = nil
|
27
|
-
broken = cql_failures[File.basename(cql_file, ".cql")]
|
28
|
-
if broken
|
29
|
-
pending(broken) {
|
30
|
-
vocabulary = ActiveFacts::Input::CQL.readfile(cql_file)
|
31
|
-
}
|
32
|
-
else
|
33
|
-
vocabulary = ActiveFacts::Input::CQL.readfile(cql_file)
|
34
|
-
end
|
35
|
-
vocabulary.finalise
|
36
|
-
|
37
|
-
# Build and save the actual file:
|
38
|
-
output = StringIO.new
|
39
|
-
|
40
|
-
transformer = ActiveFacts::Generate::Transform::Surrogate.new(vocabulary)
|
41
|
-
transformer.generate(output)
|
42
|
-
|
43
|
-
absorption = ActiveFacts::Generate::Absorption.new(vocabulary)
|
44
|
-
absorption.generate(output)
|
45
|
-
|
46
|
-
# Save the output from the StringIO:
|
47
|
-
output.rewind
|
48
|
-
transformed_text = output.read
|
49
|
-
Dir.mkdir "spec/actual" rescue nil
|
50
|
-
File.open(actual_file, "w") { |f| f.write transformed_text }
|
51
|
-
|
52
|
-
pending("expected output file #{expected_file} not found") unless File.exists? expected_file
|
53
|
-
|
54
|
-
expected_text = File.open(expected_file) {|f| f.read }
|
55
|
-
transformed_text.should_not differ_from(expected_text)
|
56
|
-
File.delete(actual_file) # It succeeded, we don't need the file.
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
data/status.html
DELETED
@@ -1,138 +0,0 @@
|
|
1
|
-
<!--#include virtual="/header.html" -->
|
2
|
-
<!--#include virtual="navbar.html" -->
|
3
|
-
|
4
|
-
<link rel="stylesheet" href="../css/offline.css" media="screen" type="text/css" />
|
5
|
-
<div id="sidebar"></div>
|
6
|
-
|
7
|
-
<div id="top" class="content">
|
8
|
-
|
9
|
-
<a name="status"></a>
|
10
|
-
<h2 class="title">
|
11
|
-
ActiveFacts Project Status
|
12
|
-
</h2>
|
13
|
-
|
14
|
-
<h4>Constellation Query Language</h4>
|
15
|
-
|
16
|
-
<p>
|
17
|
-
The Constellation Query Language implementation available in
|
18
|
-
version 0.8.5 compiles all features of ORM2 implemented by NORMA
|
19
|
-
with only minuscule differences. Entity Types, Value Types, Fact
|
20
|
-
Types (including objectified), Reference Modes, and all types of
|
21
|
-
constraints - Value and Role Value Constraints, Presence
|
22
|
-
Constraints (which covers Mandatory, Uniqueness, and Frequency
|
23
|
-
constraints), Subset, Equality, Exclusion, Mandatory Exclusion,
|
24
|
-
and Ring constraints.
|
25
|
-
</p>
|
26
|
-
|
27
|
-
<p> At this version Terms (object type names) may not contain
|
28
|
-
spaces. Terms may not appear in readings (unless in lower-case)
|
29
|
-
and readings may only contain single adjectives (hyphen-binding).
|
30
|
-
Deontic constraints are recognised using the annotation (otherwise
|
31
|
-
<b>action</b>). Join Constraints may also be defined beyond those
|
32
|
-
available in NORMA. Example data may be declared. </p>
|
33
|
-
|
34
|
-
<p>
|
35
|
-
This version provides functionality not available in NORMA. Additions
|
36
|
-
include:
|
37
|
-
</p>
|
38
|
-
<ul>
|
39
|
-
<li> Business Context Notes, which are annotations indicating why a
|
40
|
-
particular modeling construct was used, and who approved that.
|
41
|
-
</li>
|
42
|
-
<li> Definition of Units using conversion formulae. A library of
|
43
|
-
500 standard unit conversions is provided. </li>
|
44
|
-
<li> Value Types may be defined to utilise those units. </li>
|
45
|
-
</ul>
|
46
|
-
|
47
|
-
<p>
|
48
|
-
New features are being developed for an upcoming 0.9.0 release:
|
49
|
-
</p>
|
50
|
-
<ul>
|
51
|
-
<li> Multi-word terms, and multiple adjectives.
|
52
|
-
<li> Improvements on the use of the hyphen to allow hyphenated words in readings.
|
53
|
-
<li> Term Synonyms
|
54
|
-
<li> Imported vocabularies (including multi-lingual versioning)
|
55
|
-
<li> Improved model validation
|
56
|
-
</ul>
|
57
|
-
|
58
|
-
<p>
|
59
|
-
Beyond that, the query syntax will be completed and queries will be generated
|
60
|
-
to SQL.
|
61
|
-
</p>
|
62
|
-
|
63
|
-
<h4>Constellation Query Language generators</h4>
|
64
|
-
|
65
|
-
<p>
|
66
|
-
The CQL generator allows conversion of NORMA files. At the present release,
|
67
|
-
deontic constraints and example fact populations are not emitted.
|
68
|
-
</p>
|
69
|
-
|
70
|
-
<p>
|
71
|
-
The Ruby generator is functional. Not all constraints are emitted to Ruby yet,
|
72
|
-
but any combination of facts allowed by the vocabulary may be represented.
|
73
|
-
</p>
|
74
|
-
|
75
|
-
<p>
|
76
|
-
The SQL generators are generating correct and useful SQL, using a relational
|
77
|
-
mapping algorithm that produces similar results to NORMA. This algorithm will
|
78
|
-
be extended to emit more constraints, and to provide more control over
|
79
|
-
the generation of object names, and to directly support Ruby on Rails.
|
80
|
-
Deontic constraints are still handled as Alethic.
|
81
|
-
</p>
|
82
|
-
|
83
|
-
<h4>The Constellation API</h4>
|
84
|
-
|
85
|
-
<p>
|
86
|
-
The Constellation API (in Ruby) supports the generated Ruby code, by
|
87
|
-
allowing any fact population to be asserted into a constellation for
|
88
|
-
a given vocabulary. The generated Ruby module for a vocabulary can be
|
89
|
-
told which object types are tables in the SQL, and can infer all the
|
90
|
-
column names and object mappings from that.
|
91
|
-
</p>
|
92
|
-
|
93
|
-
<p> Processing of the retract operation (which removes facts from a
|
94
|
-
constellation) does not yet propagate retraction through mandatory roles.
|
95
|
-
There is not yet a validate operation to verify that all verifible
|
96
|
-
constraints are met. Where a constellation is known to be
|
97
|
-
incomplete, that's not yet able to be recorded (this will be used
|
98
|
-
in determining which constraints can be checked)
|
99
|
-
There is not yet any support within the API for database persistence
|
100
|
-
(creating a constellation from query results, and creating, deleting or
|
101
|
-
updating database rows by saving a constellation).
|
102
|
-
</p>
|
103
|
-
|
104
|
-
<h4>The ORM2 Metamodel</h4>
|
105
|
-
|
106
|
-
<p>
|
107
|
-
The ORM2 Metamodel is generated to Ruby from CQL or ORM2 to support
|
108
|
-
the creation and manipulation of any semantic model. Some changes are
|
109
|
-
upcoming to support synonyms, including allowing a vocabulary to
|
110
|
-
provide a translation of an existing vocabulary, such as a Dutch or
|
111
|
-
Japanese version of an English language model.
|
112
|
-
</p>
|
113
|
-
|
114
|
-
<!--p>
|
115
|
-
ActiveFacts can currently read models from NORMA, which are in elementary
|
116
|
-
form, and it can reverse engineer the schemas of existing databases in SQL
|
117
|
-
Server, DB2, Oracle, and open-source databases not yet tested including
|
118
|
-
MySQL, PostgreSQL, etc. Reverse-engineered models are still in composite
|
119
|
-
form - the mapping to elementary form is incomplete. Reverse engineering
|
120
|
-
does not yet analyse actual data.
|
121
|
-
</p-->
|
122
|
-
|
123
|
-
<!--p>
|
124
|
-
ActiveFacts has no database adapter infrastructure yet. The
|
125
|
-
previously-available reverse engineering tools used used the
|
126
|
-
infrastructure of ActiveRecord with DRYSql and Composite Primary Keys, but
|
127
|
-
future versions will probably just use the ActiveRecord adapters directly.
|
128
|
-
</p-->
|
129
|
-
|
130
|
-
<!--p>
|
131
|
-
APRIMO allows the definition of vocabulary aspects as well as the addition
|
132
|
-
of entity and value objects and the fact types that link them. Subtyping,
|
133
|
-
data types and units, and complex constraints are still to be implemented.
|
134
|
-
</p-->
|
135
|
-
|
136
|
-
</div>
|
137
|
-
|
138
|
-
<!--#include virtual="/footer.html" -->
|
data/why.html
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
<!--#include virtual="/header.html" -->
|
2
|
-
|
3
|
-
<div class="content">
|
4
|
-
<h2>Why Semantic Modeling?</h2>
|
5
|
-
|
6
|
-
<p>
|
7
|
-
Software is not mainly about <em>how</em>, but about <em>what</em> and
|
8
|
-
<em>why</em>. Software projects fail most commonly because they build
|
9
|
-
the <em>wrong thing</em>, not because they build it wrongly. Other
|
10
|
-
forms of modeling, such as object modeling and entity relationship
|
11
|
-
modeling, attempt to capture <em>what</em>, but the models are shaped
|
12
|
-
from the start by the needs of implementation (<em>how</em>). That
|
13
|
-
shuts out the non-technical business expert, and bends the model out
|
14
|
-
of shape, losing track of <em>why</em> each feature is needed, what it
|
15
|
-
means and under what terms, the roles it plays in the overall system.
|
16
|
-
<strong>Semantic modeling</strong> incorporates and transcends both
|
17
|
-
approaches, and works in either Agile or traditional environments.
|
18
|
-
</p>
|
19
|
-
|
20
|
-
<p>
|
21
|
-
ActiveFacts uses a <strong>fact-oriented</strong> approach to
|
22
|
-
constructing models in <strong>elementary</strong> form. Every
|
23
|
-
concept, whether a business entity or a relationship, is represented
|
24
|
-
in the simplest possible form, isolated from all other concerns.
|
25
|
-
Every role that each concept plays in the system is incorporated in
|
26
|
-
simple <strong>business rules</strong> that can be effectively
|
27
|
-
verbalised in plain language, displayed on diagrams, and managed in a
|
28
|
-
system ontology (vocabulary). The elementary form is the most direct
|
29
|
-
mind-map of the business domain that can be constructed, is based on
|
30
|
-
pure logic, and is unsullied by implementation concerns. That makes it
|
31
|
-
much easier to understand and validate by all parties, especially the
|
32
|
-
business expert. Purely for its benefits in specification, semantic
|
33
|
-
modeling is revolutionary.
|
34
|
-
</p>
|
35
|
-
|
36
|
-
<p>
|
37
|
-
Because the semantic approach is based in pure logic, it can be
|
38
|
-
automatically <strong>transformed</strong> into working software,
|
39
|
-
in the form of executable code and database designs in efficient
|
40
|
-
normalised form. It's an established truth that very small changes
|
41
|
-
(even additions) in business rules can require large changes to
|
42
|
-
the structure of an database. Contrary to existing methods used
|
43
|
-
to design and access databases, semantic modeling allows you to
|
44
|
-
make radical changes in the underlying physical table structures
|
45
|
-
without the huge ramifications in your application code. The
|
46
|
-
advantages in business agility are manifold.
|
47
|
-
</p>
|
48
|
-
|
49
|
-
<!--p>
|
50
|
-
Queries in CQL span tables transparently, crossing conceptual
|
51
|
-
relationships (fact types) without explicit database joins, and
|
52
|
-
return structured data in a nested-relational form (called
|
53
|
-
constellation form). For every user action in an application, a
|
54
|
-
single query can be defined that provides all the data required to
|
55
|
-
respond to that action. There's no need to fetch this, that, and
|
56
|
-
the other. All required results are fetched at once, which
|
57
|
-
improves application structure, performance, and even concurrency.
|
58
|
-
</p-->
|
59
|
-
|
60
|
-
<!--#include virtual="/footer.html" -->
|