Database Schema Definition Language

Greetings. This is the humble home page of the Database Schema Definition Language. You can find the project page here.

What is it?

In short, it is an XML schema for creating relational database schemas. The latest schema is version 1.1 can be found here. When you write your own database schema (in XML), you can use this XML schema to validate it. Once you have specified a database schema in this manner, there are at least two very useful things you can do with it - both of them using extensible stylesheets (XSLTs).
  1. You could use it to generate the SQL statements that will create your database structure
  2. You could use it to document your database (particularly if you like browser-accessible documentation)
In fact, this project provides XSLTs for doing just that. There is an XSLT for generating DDL in the form of SQL statements. There is another XSLT that generates an XHTML file.

You'll be needing an XSLT processor to use these XSLTs. Xalan (from apache.org) is good. 'C' developers are encouraged to use libxslt. Java-hacker that I am, I discovered that ANT has a task just for performing XSL translations. The download includes an example of this (build.xml).

Note: I have placed the h2.jar in the download for regression test purposes only. You don't need this jar at all to use either of the XSLTs. However, the default ANT target (test) will try to use H2 to run the regression test. Please visit the H2 website for source code and the latest and greatest version. My thanks to the H2 Group for making the H2 Database both free and open source.

What it is not.

I have wording issues with this project because it uses XML, generates database schemas, and has an XML schema. But its misleading to call it "an XML Database Schema generator."

It's not ... There are lots of open source projects for doing those things, many of them hosted on SourceForge.

Why?

Basically, I created this because, well, "It just ought to be there ..." When I first thought about it, I said, "Surely someone has done this already ..." After three days of on and off searching, I decided that, "No it doesn't look like anyone has." Now, maybe somebody did and failed to publish it or maybe I just couldn't find it.

In any case, I welcome anyone who wants to help.

The Future

I'm a neophyte when it comes to XSL. I succeeded in createing these two XSLTs and they work. But they're not "pretty" as far as I'm concerned. Someone better versed in XSL might be able to clean them up a bit.

I'm no expert at XML schema design either. The DbSchemaDefLang XML schema itself could probably be made more extensible. The important thing is that it remain a valid XML schema.

These XSLTs are good for basic SQL-92 compliant databases. I know that many databases support the concept of "a schema." That would probably be a useful enhancement. I've thought about adding DML (statements for initializing the database once the structure has been defined). Have to be careful with this because there's a lot of other projects out there that do XML DML very well. I'm sure there are many others database schema enhancements I haven't thought of.

The existing XSLTs are database-agnostic (I think) which is the way I like it. Others might be interested in derived XSLTs that are database-specific (e.g. PostgreSQL, MySQL, etc.).

Perhaps there are other XSL translations that would be useful, other than the two I came up with.

I've seen at least one tool out there that generates a database schema in XML from a database instantiation. Perhaps they would consider making this XML schema a target. It's a thought, anyway.

Gratitude

There are many organizations that helped make this possible. I'm going to give you what I hope is an inclusive list ...
And most of all, I am thankful to SourceForge for hosting this project.