ActiveFacts Example Models
The example models presented here were created as Object Role Models using NORMA. The ActiveFacts generator afgen was used to convert them from ORM2 to CQL, SQL and Ruby code using ActiveFacts. They're all available here as PNG images and in the other formats.
To make a start learning Object Role Modeling, read the Introduction to ORM2 or check the Resources page for other sites.
The CQL code here formatted and laid out is exactly as it was generated. It's interesting how cleverly the semantic clustering algorithm works!
If you're looking at a Subversion checkout of the project on Windows, and have Visual Studio (pro) with NORMA installed, you can open the solution here. Otherwise, you won't be able to edit the ORM2 files, but never fear, you can do all the same things by editing the CQL text.
CompanyDirectorEmployee
This is my main introductory model. It shows the relationships of a person to a company of which they are a director or employee.
Blog
The Blog model supports a hierarchy of topics, Posts by Authors, each Post consisting of a series of styled Paragraphs. Comments may be made on individual Paragraphs.
SchoolActivities
This model represents students representing their school in school-sanctioned activities. It includes the ternary StudentParticipation Fact Type, which represents a student's participation in a school-sanctioned activity. The model has constraints that allow a given Student to participate only in a given Activity for a single School, only representing the School in which they're enrolled, and only if the School sanctions that activity.
Orienteering
A model for the sport of Orienteering, broken into three diagrams for administration, registration and scoring. These diagrams also reflect areas of interest to folk in different roles, an idea which could inspire the use of the division as security domains. However, for an object showing on multiple diagrams, ORM2 doesn't indicate with which diagram it has a primary affinity. In CQL, it might be better to structure this as three separate vocabularies.
The author is involved in orienteering in his local association (which publishes a program and results at street.orienteering.com.au and the Victorian Orienteering Association) and he used this model to construct a scoring system using low-power microprocessors distributed around the course.
Metamodel
The Metamodel encodes the meaning of an ORM2 or CQL model. All features of the ORM2 and CQL languages have a representation here, as well as a few CQL features that haven't yet been implemented yet. The generated Ruby code is used as the intermediate form inside the CQL language implementation.
Table of all examples
Model Name | Diagrams | |||
---|---|---|---|---|
Address | CQL | Ruby | SQL |
Address |
Blog | CQL | Ruby | SQL |
Blog |
CompanyDirectorEmployee | CQL | Ruby | SQL |
CompanyDirectorEmployee |
Death | CQL | Ruby | SQL |
Death |
Genealogy | CQL | Ruby | SQL |
Genealogy |
Insurance | CQL | Ruby | SQL |
Claim Insurance Person Policy |
Marriage | CQL | Ruby | SQL |
Marriage |
Metamodel | CQL | Ruby | SQL |
Constraints Import Objects Populations Values |
MultiInheritance | CQL | Ruby | SQL |
MultiInheritance |
OilSupply | CQL | Ruby | SQL |
OilSupply |
Orienteering | CQL | Ruby | SQL |
Administration Registration Scoring |
OrienteeringER | CQL | Ruby | SQL |
OrienteeringER |
PersonPlaysGame | CQL | Ruby | SQL |
PersonPlaysGame |
SchoolActivities | CQL | Ruby | SQL |
SchoolActivities |
SimplestUnary | CQL | Ruby | SQL |
SimplestUnary |
Warehousing | CQL | Ruby | SQL |
Warehousing |
WindowInRoomInBldg | CQL | Ruby | SQL |
WindowInRoomInBldg |