Creating a Database Schema for DSM
The Meta-metamodel
Here is our first cut meta-metamodel based on a subset of ecore
- Name: string
- AttributeList: EAttribute:0.*
- ReferenceList: EReference:0.*
- eSuperType: EClass:0.1
EAttribute
- Name
- DataType: EDataType:1.1
EDataType
- Name: String
EReference
- Name: String
- From: EClass: 1.1
- To: EClass: 1.1
- Containment: boolean
- LowerBound: int
- UpperBound: int
So, we're going to need tables for EClass, EAttribute, EDataType and EReference.
The db schema to represent the above is:
- EClassID int primary key
- Name varchar(100)
- eSuperType int
EAttribute
- EAttributeID int primary key
- Name varchar(100)
- DataType int
- EClass int
EDataType
- EDataTypeID int primary key
- Name varchar(100)
EReference
- EReferenceID int
- Name varchar(100)
- From int
- To int
- Containment: boolean
- LowerBound: int
- UpperBound: int
Then we just need to enter the first metamodel as records into the meta-metamodel tables. The information below shows what table each item goes into:
- Title: String (EAttribute)
- Properties: Property:0.* (EReference)
- Relationships: Relationship: 0.* (EReference)
Property (EClass)
- Title: String (EAttribute)
- DataType: DataType: 1.1 (EReference)
Relationship (EClass)
- Title: String (EAttribute)
- From: Object: 1.1 (EReference)
- To: Object: 1.1 (EReference)
- Dependency: String (EAttribute)
DataType (EClass)
- Title: String (EAttribute)
OK. So now what do we have? We have a databased meta-metamodel schema and the ability to laboriously enter metamodels into the db by adding entries to the EClass, EAttribute, EDataType and EReference data tables. We also have a very simplistic metamodel for describing domain classes. Next we really need to wrap this with some tooling to more easily and elegantly create metamodels and then some tooling to generate the tables for each metamodel for storing model statements and some tooling for editing the models. Luckily, the tooling for editing models and metamodels can be the same, and I'm pretty familiar with creating generic tooling for editing arbitrary object models (it's basically just a cms - which I need anyway for my clients - we're just now using the cms to edit metadata instead of just data). So now I need to go away, make some design decisions and start to throw together a simplistic toolkit for editing metamodels and models and then for generating and diffing db tables for the models and the end user data.



There are no comments for this entry.
[Add Comment]