Introducing a post-relational database for .NET

Simple Demo

In this article, I am going to show a simple demo application that demonstrates how you can use SQL to define a schema and manipulate data objects with Matisse. More detailed discussions will follow in the subsequent articles.

First of all, you need to start a database. Start the Enterprise Manager, select a database, and select the Start menu. The database will be on-line within a couple of seconds:

Start a database

The data model that we are going to use is for project management, in which we define three classes Project , Employee , and Manager as depicted using UML in the next figure.

UML Diagram

If you have Rational Rose, you can simply export the UML diagram into your database. Choose Export to Database... menu under Tools/Matisse :

Exporting UML Diagram

If you do not have Rational Rose, you can use SQL DDL or ODL (Object Definition Language). The following DDL statements are equivalent to the above UML diagram.

  ProjectName STRING,
  Budget NUMERIC(19,2),
  Members REFERENCES (Employee)
    CARDINALITY (1, -1)
    INVERSE Employee.WorksIn,
  ManagedBy REFERENCES (Manager)
    CARDINALITY (1, 1)
    INVERSE Manager.Manages
  Name STRING,
  BirthDate DATE,
  WorksIn REFERENCES (Project)
    INVERSE Project.Members
CREATE TABLE Manager UNDER Employee (
  Title STRING,
  Manages REFERENCES (Project)
    INVERSE Project.ManagedBy

To execute the above DDL statements, copy and paste them into the SQL Query Analyzer window, and execute them.

Execute SQL DDL Statements

Here, you see an advantage in database modeling with Matisse. You do not need any transformation of your model, and all the semantic information about associations between classes and their constraints are kept in the database schema as they are. This is a big plus for maintenance and extension of the application.

We can now create objects in the database. Execute the following SQL statements in the SQL Query Analyzer window as shown above:

INSERT INTO Employee (Name, BirthDate)
  VALUES ('John Venus', DATE '1955-10-01')
INSERT INTO Employee (Name, BirthDate)
  VALUES ('Amy Mars', DATE '1965-09-25')
INSERT INTO Manager (Name, BirthDate, Title)
  VALUES ('Ken Jupiter', DATE '1952-12-15', 'Director')
INSERT INTO Project (ProjectName, Budget, ManagedBy, Members)
  VALUES ('Campaign Spring 04', 10000.00, mgr1, SELECTION(emp1, emp2));

The above statements create two Employee objects, a Manager object, a Project object, and then assign the two employees to the project as its members and the manager as the project manager.

You might also like...



Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.” - Tom Cargill