Over the weekend, I implemented RMap - the part that chooses which object types will be tables in a third-normal-form database. I had previously identified all possible absorption paths, so it's now a small step to emit columns, either foreign key fields where the referenced object is a table, or all absorbed fields where not, and using that, to emit SQL.
My example models are all emitting mappings that are either identical or superior(*) to those of NORMA. There may be cases that still fail, but I believe I have almost all possibilities covered, even the weird ones.
I was able to do this without resorting to binarizing the model, so the roles that are listed in my join paths are in all cases the same role objects that are covered by constraints, role references for readings, etc - which makes it much easier to incrementally adjust the mappings and to correlate operations between the relational and elementary forms. It also means that it's easy to emit constraint enforcement for all constraints that are mappable.
I can do this from either NORMA files or the CQL files that I can generate from them, though a couple of "known problems" with the CQL parser means that not all my models compile properly yet. I'll address those soon.
My metamodel so far has no indicator that a subtype should be partitioned, so that's not implemented, though subtype absorption or extension is possible using the "independent" role. Partition will also require the identification of subtype exhaustion. Anyhow, that's a small step.
My main next step is to emit SQL, for at least a couple of databases, and to annotate the generated Ruby so that the objects know how to construct queries. That should take me up to my presentation at the OSDC conference In Sydney on Dec 3.
(*) NORMA will sometimes absorb an AutoCounter field into a table that already has one, or will absorb the same AutoCounter into more than one place, which leads to processing errors. It also sometimes chooses the wrong end of a one-to-one, such as when it creates a "Name" table instead of an "Author" table in my Blog model. My implementation of Rmap doesn't have these errors. The entire implementation codebase of ActiveFacts is just 5000 lines of code, which is small enough to be able to make rapid progress. It's open source, and I invite your contributions.
Clifford Heath, Data Constellation.
Agile Information Management and Design.