ActiveFacts is a free open-source project of Data Constellation which implements the Constellation Query Language (CQL) and the Constellation API. The Constellation Query Language was presented at the ORM Workshop 2009 in Portugal, and a version of that presentation is available in a screencast you can download here (links at top right). You can also install and use ActiveFacts freely on your own computer, even for commercial purposes, with no strings attached and no viral licensing.
The Constellation Query Language (CQL) is a plain-text restricted natural language which provides full-featured ORM2 capabilities without needing to use diagrams. As such, it is especially suitable for use in collaborating over models with people who do not have, would not use, or are not trained to understand an ORM2 diagramming tool such as NORMA. It's also useful when combined with differential revision management tools, and only requires plain-text tools such as text editors and email programs. CQL extends the ORM2 metamodel a little, and will be further extended to provide full query language capabilities surpassing SQL's select. CQL is also under development in French and Spanish, and other languages will become available over time - it's intended that the same model and database may be presented and queries in multiple languages.
ActiveFacts (written in the Ruby scripting language) centres around the ActiveFacts generator, which uses the ActiveFacts metamodel. The generator:
- can read models created in either NORMA or directly in CQL (more input formats will be available over time, or you can write your own)
- can transform models into object-oriented or 5NF relational form
- can generate (using a modular extensible generator architecture):
- CQL (if your NORMA models have adequate readings, they convert easily)
- Ruby code for the Constellation API
- SQL for several dialects
- fact-oriented, object-oriented or relational code or documentation using generators you can easily write for yourself.
- other generators may be available for purchase or on commission
The Constellation API is Ruby code which supports the output of the Ruby code generator. The generated code allows representation and manipulation of any collection of facts from your model. Although it's implemented in an object-oriented language, the API is fact-oriented. As such, there are no new and delete operations, instead you must (within a constellation of facts) assert and retract instances of facts. It is not possible to create duplicate instances within a constellation - a duplicate assert will just return the previous instance. All object instances are fully cross-referenced, such that every role played by each object is a method available on that object. For example, if you have a Person instance, you can say person.birth_date.all_directorship_as_appointment_date to get every company director who was appointed on the day this person was born. This is a radically new style of programming - it's true fact-oriented programming. Constellations in the API can not yet be retrieved from and saved to the relational storage for the same model, but this is work in progress which solves for the first time the notorious problem known as the Vietnam of Computer Science.
ActiveFacts contains (to my knowledge) the only published ORM2 metamodel which has actually been proven by being used to generate ORM2 tools. The metamodel differs from and extends somewhat the accepted ORM2 structures. In particular, it:
- includes a dimensional model for value types, supporting arbitrary conversion between compatible values in different units (including ephemeral conversions such as between currencies)
- models uniqueness, mandatory and frequency constraints as one constraint type called presence constraints, which allows easier constraint type migration
- supports deontic constraints by reference to the enforcement action that must be taken when the constraint is found to have been invalidated
- supports Business Context Notes to record the reasons why a particular entity type or constraint was created, and also to record the date and participants in agreeding to those reasons.
The ActiveFacts metamodel is maintained in CQL and NORMA, and is used with the generator to produce the code that supports all the ActiveFacts tools, including the CQL compiler. Being bootstrapped in this way makes it very easy to evolve the tools, and shows that the metamodel is actually sufficient and correct for converting between fact-oriented languages. Amidst all the noise and delay involved in our attempts to create a common agreed metamodel, it silently delivers. It also amply demonstrates the power of using fact-oriented modeling in the automatic generation of framework code to support real systems.
ActiveFacts is also being used as the basis for some enterprise-level and graphical tools for collaborative modelling, but these are not open source. Contact Data Constellation
for more details.