Click here to Skip to main content
Click here to Skip to main content

An introduction to a post-relational database for .NET, Matisse - Part 1

By , 14 Jun 2004
 

Introduction

When it comes to database for .NET, there are several options in addition to the well known ones such as SQL Server or MySQL. One of them is Matisse, a post-relational database by Matisse Software.

Why Matisse? It is the only SQL database that I know of, which is extended with complete object capabilities and natively supports .NET. It features user defined types, inheritance, polymorphism, and a simple data model with declarative constraints, etc. Over the last two years I have acquired practical knowledge of Matisse while working on several .NET projects that required complex data modeling.

While one can find press articles that provide high-level comparisons between mainstream relational databases and other products, I have not seen yet a simple step-by-step tutorial to help developers who wish to try their hand at new generation databases. I therefore resolved to publish a series of short articles to help address this void. Here is the first one.

This first article covers a quick overview of SQL programming with Matisse. The subsequent articles, coming weekly, will show how to develop database applications with .NET and ASP.NET in more detail.

Installation

Installation of Matisse is quick and easy. Go to the Matisse download site http://www.matisse.com/developers/downloads/, and download the next two files under "Matisse DBMS 7.0.x" section:

  1. Intel - MS Windows (file name is matisse70x.exe)
  2. .NET binding (file name is matisseDotNet70x.exe)

The first file installs the database server, administration and development tools, and a common client library shared by diverse language interfaces for Matisse including .NET (i.e., C# and VB.NET). The second file contains a .NET assembly that provides object persistence services and a native ADO.NET data provider.

To install Matisse, you need to have the Windows Administrator privilege. System requirements are Windows NT, 2000, or XP, 64MB of RAM, and 100 MB of disk space. First, start the matisse70x.exe file, follow the instructions, and select "Typical/Full" as the type of setup. The installation will be completed within a couple of minutes. Then, start the matisseDotNet70x.exe to install the .NET interface. Choose the same directory for destination folder as the first installation (i.e., matisse70x.exe).

The documents you want to look at first are

  1. Discovering Matisse Enterprise Manager (from Readme.html)
  2. Building reusable components with SQL PSM (from Readme.html)
  3. Getting Started with Matisse

A lot of documents including programming guides, administration guide, and installation guide are also available at http://www.matisse.com/developers/documentation/.

If you have the Rational Rose modeling tool, you can download

Matisse Rose Link (matisseRoseLink70x.exe). You can define and maintain database schema using UML with Rational Rose.

Note that you can run the database server on Linux when deploying your .NET application on Windows. Download the Linux version of Matisse (matisse-7.0-x.i386.rpm) and install it using rpm. If you are using RedHat 8, you need to set the environment variable RPM_INSTALL_PREFIX to /usr/local/matisse before running rpm.

 > rpm -ihv matisse-7.0-x.i386.rpm

Requirements

The Matisse .NET binding requires Microsoft .NET Framework 1.1, not 1.0. If you are using Visual Studio .NET 2002, you need to upgrade it to Visual Studio .NET 2003. (Because even if you have .NET Framework 1.1 installed on your PC, Visual Studio .NET 2002 keeps using .NET Framework 1.0 for compilations.)

For Mono users on Linux, it seems like the Matisse company is preparing the Mono version of the .NET binding so that you can develop and deploy Mono applications on Linux.

What you can do with the Matisse Enterprise Manager

Before writing a simple demo program using SQL, let us visit some interesting features of the Enterprise Manager.

1. You can browse classes, attributes, relationships, and SQL methods in a database just like any other vendors' tools. An interesting feature is that a class can show all its properties (i.e., attributes, relationships, and methods) including its superclasses' properties. So, when you write an SQL statement on a class, this feature is useful, since you do not have to go back and forth between superclasses and subclasses to find out properties.

Matisse Enterprise Manager

2. Data Import (CSV)

You can import data from your relational database using CSV (Comma-Separated Value) files. When you import a CSV file, each line (row) in the file is stored as a data object in the Matisse database. After importing all the CSV files, you specify an XRD file (XML Relationship Definition), which describes how to establish links between objects in the database. Then, objects in the database are inter-related to each other building a meaningful semantic network that matches your UML description. Relationships between objects also provide a significant performance benefit on SQL queries as well.

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.

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

CREATE TABLE Employee (
  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') 
  RETURNING INTO emp1;
INSERT INTO Employee (Name, BirthDate) 
  VALUES ('Amy Mars', DATE '1965-09-25') 
  RETURNING INTO emp2;
INSERT INTO Manager (Name, BirthDate, Title) 
  VALUES ('Ken Jupiter', DATE '1952-12-15', 'Director') 
  RETURNING INTO mgr1;
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.

To view the inserted objects, execute "SELECT * FROM Employee" for example:

Execute SELECT statement

When you select from the class Employee, the query returns objects from both Employee and Manager since Manager is inheriting from Employee. However, the result table does not include the properties specific to Manager, e.g., Title, because the attribute Title is not visible from the class Employee.

You can define SQL methods for classes. The syntax follows SQL PSM (Persistent Stored Module). For example, let us define an instance method Age() that returns the age of an employee:

CREATE METHOD Age()
RETURNS INTEGER
FOR Employee
BEGIN
  RETURN EXTRACT(YEAR FROM CURRENT_DATE) - EXTRACT(YEAR FROM SELF.BirthDate);
END;

Execute the statement in the SQL Query Analyzer window, and then try the next SELECT query:

SELECT * FROM Employee emp WHERE emp.Age() > 40;

The Age() method works for both Employee and Manager, of course. You can override the method for Manager, and enjoy the polymorphic behavior just as you do with .NET.

Next Article

In this article, I showed a quick and brief introduction to SQL programming with Matisse, which shows object features like inheritance and relationships. In the following articles, I will show more details for each topic and discuss the technical advantages and disadvantages.

Next >>

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

John Sasak
Web Developer
United States United States
Member
John is a software consultant and currently working for a large .NET project. He has an extensive experience in object-oriented technologies for more than 15 years ranging from Smalltalk, C++, Java, .NET to databases.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralMy vote of 5membermonu_khan11 Oct '10 - 9:00 
nice tutorial i wil try it
thank you
GeneralOther object oriented databasememberdml25625 Jul '07 - 8:29 
intersystems cache'
GeneralRe: Other object oriented databasememberPIEBALDconsult21 Feb '08 - 6:20 
Caché isn't SQL-92 compliant. Mad | :mad:
GeneralcondomssussAnonymous7 Mar '05 - 13:31 
condoms
GeneralGreat Article!!sussDon R. Davidson24 Mar '04 - 10:01 
Thanks for reviewing other database systems. It great to hear other options. Hope that his is an enterprise class database system that is affordable. With the state of the ecomony, so many people can not afford MSSQL.
 
Don Davidson
donrdavidson@earthlink.net
GeneralThank you!memberian mariano8 Mar '04 - 11:05 
We're evaluating it now Wink | ;) It's a great alternative and I'd like to extend you thanks from my architecture team!
 
Ian Mariano - http://www.ian-space.com/

 
"We are all wave equations in the information matrix of the universe" - me

GeneralNice article, but...sussDmitry Shilov5 Mar '04 - 12:03 
I work with matisse for more then 6 months now. I even fixed for them several bugs in Matisse .NET binding Smile | :) And i think a little bit different about how Matisse should be introduced to people.
I posted my 2 cents at http://blogs.sibman.com/mtdto/

QuestionWhat's the catch?memberNorm Almond5 Mar '04 - 10:00 
Surely they want money for this kind of database ?
 

I am that is


AnswerRe: What's the catch?memberJan Vercauteren23 Mar '04 - 12:04 
jep 2000€
 
www.agilis.be
GeneralRe: What's the catch?memberNorm Almond23 Mar '04 - 21:11 
Ah I see!
GeneralRe: What's the catch?sussIsaias Formacio24 Mar '04 - 7:39 
2000€ for Which version? Developer?? Confused | :confused:

GeneralASP.NET coding with MatissememberAdam Otory4 Mar '04 - 18:47 
Another writing about Matisse:
http://blogs.sibman.com/mtdto/archive/2004/02/08/4721.aspx
GeneralNaive questionmemberTom Clement3 Mar '04 - 8:36 
I've tended to shy away from OODBs because of my perception (fair or not) that you get into trouble when your objects change. I'd think that without a mapping layer between your object structure and your storage structure, the ability to use agile programming techniques (i.e. agressively change your code) becomes unacceptably constrained by data compatability issues.
 
I'm sure these issues have been discussed and addressed, but I'd be interested in hearing a summary from folks who know about it.
 
Thanks!
 
Tom Clement
Apptero, Inc.
GeneralRe: Naive questionmemberJohn Sasak3 Mar '04 - 9:59 
Hi Tom,
 
It is a good question.
 
In my opinion, Matisse is different from other OODBs you mentioned, because Matisse has a logical (object) model (as explained in my second article) but others do not. Other OODBs are mostly language persistence systems.
 
As I mentioned in the second article, the first step with Matisse is to generate C# or VB.NET classes from the database schema. It is actually a mapping of database schema into .NET. But, it is a very simple object-to-object mapping, not like relational-to-object mapping which requires some rules.
 
IMHO, Matisse works better for agile programming.
 
I will cover the topic about the (dynamic) schema evolution later.
GeneralHere is the second articlememberJohn Sasak3 Mar '04 - 7:19 
Hi,
 
Thank you all for reading the article and posting comments.
Here is the second article:
http://www.codeproject.com/dotnet/introtomatisse_part2.asp
 
Enjoy it!
 

QuestionJVM?memberJoshua Nussbaum חיים2 Mar '04 - 5:45 
Why does Matisse require a JVM?
 
60% of statistics are made up on the spot
AnswerRe: JVM?memberJohn Sasak2 Mar '04 - 7:30 
JVM is used (only) by the Enterprise Manager, the primary GUI tool.
I think that's because Matisse runs on Windows, Linux, and Solaris.
GeneralMatisse is great!!memberamy_asaka27 Feb '04 - 18:57 
I am a biostatistican and write data analysis algorithm of microarray data. As all my program is written in C#, a database that can directly store objects really reduced our development time. By using Matisse, now I can forget about object relational mapping & object serialization! Changes in class definitoin are also extremely easy! I would definitely recommend Matisse for everyone who deal with objects and want to save time in storing and retrieving objects.
 
Amy
GeneralWow - Matisse's architecturememberLonnie Best27 Feb '04 - 10:12 
"The performance of SQL-based applications is often substantially better on Matisse than on relational databases because Matisse's architecture eliminates the need for de-normalization and processing-intensive complex joins when accessing related data since Matisse doesn't need to maintain multiple indices for each table, as required by a relational database."
 
Source: http://www.matisse.com/product_information/features/
 
Lonnie Lee Best

GeneralSound & Image Data Typesmembermarkmoss27 Feb '04 - 9:42 
John
 
I would like for you to discuss the Sound & Image data types that are in Matisse and how they are Heard / Displayed under .Net
 
The first article you did was great, keep up the good work.
 
Cool | :cool:
GeneralRe: Sound & Image Data TypesmemberJohn Sasak2 Mar '04 - 7:33 
I will mention about the media data types later in
my article as an advanced topic around .NET programming
with Matisse.
 
Thank you for your word.

GeneralRe: Sound & Image Data Typesmembermarkmoss2 Mar '04 - 8:03 
John
 
When do you think that you will have that part done and how many parts are their going to be?
 

QuestionHow widespreadmemberStan4th27 Feb '04 - 5:52 
Hi,
exiting stuff, I don't know how new this product is - assuming its not brand new can anyone give an indication of how widely it is used?
Thanks.
GeneralWe're Evaluating Matisse NowmemberAcuitrekBob26 Feb '04 - 13:27 

I'd like to see the future articles NOW!
 
We're evaluating Matisse against SQL Server as I type. Matisse has some great stuff, we're now trying to see if it walks the talk.
 
Have you had any experience with their versioning? We're very interested in that and trying to see if we can execute SQL against an object and it's version history in a single query.
 

 


 
Bob Stucky
Director of Engineering
Acuitrek
www.acuitrek.com
GeneralRe: We're Evaluating Matisse NowmemberJohn Sasak26 Feb '04 - 20:25 
Hi Bob,
 
I am working on the second article, it will be uploaded within a copule of days.
 
There is a section "Version Travel" in the SQL documentation.
An example from that part:
 
SET TRANSACTION READ ONLY day2;
SELECT * FROM UPDATED (Movie, day1);
 
returns Moovie objects that are updated between the two versions.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 15 Jun 2004
Article Copyright 2004 by John Sasak
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid