Tuesday, May 19, 2009

Explaining the structure of Mondrian schemas

There are some major schema changes coming in Mondrian 4.0, and I'm writing up specifications for these so that everyone knows what's coming and has chance to influence it.

But before I do that, I thought I'd try to improve how we describe the structure of XML schemas in the present release, just a bit. I have tried a couple of things. First, I created an XML skeleton that shows which elements can occur inside which other elements:

aggElements
aggElements
relation
<SQL/>
<SQL/>
<SQL/>
<SQL/>
<SQL/>
<SQL/>
<SQL/>

relation ::=
<SQL/>
<SQL/>
<Row>
relation

aggElement ::=


You can see the full version in the Mondrian schema guide.

This approach shows where things are located, but it doesn't show how many of each element can belong to a particular parent element, or the order in which they are required. So, I wrote up a small BNF grammar and used Clapham to generate a railroad diagram. For comparison, the railroad diagram for the work-in-progress mondrian-4.0 schema is here.

2 comments:

rpbouman said...

Hi Julian,

I haven't looked into the schema changes, but the railroad diagrams look nice. I'm impressed how fast you managed to create a working solution like this. Good work!

In the result, I noticed a few minor things that could be improved:

1) vertical text alignment. For non-terminals text is close to the bottom, for terminals it's close tot the top. I think it would better to have the text perfectly centered vertically in both cases.

2) for terminals, the text is a bit close to the left boundary of the box. It would be nice to have a bit more space there.

See for example http://clapham.hydromatic.net/mondrian-4.0-bnf/AggName.svg
this illustrates both issues.

Julian Hyde said...

Roland,

Yeah, fair comment, the text alignment needs to be fixed. I'll get to them in the next revision (whenever that is).

Julian