Something I've been wondering about recently is the separation of semantics from presentation in proper web design, and how it applies to diagrams. The Scalable Vector Graphics (SVG) specification would seem to indicate that with drawings, all the presentation is part of the semantics, because it's a specification for presentation.
The problem with this for diagrams is that diagrams have a layer of underlying object meaning apart from the meaning of how they are laid out. For example, a UML Component Object Model specifies various classes and their relationships—this is the essence of the diagram at a semantic level, and the specific locations of the shapes and lines are merely a way of presenting that information.
Of course, an XML Schema could easily be designed to represent the underlying semantics for diagrams of a certain type, then XSLT could be used to produce an actual diagram by specifying some form of transformed data; for example, an SVG drawing. This would be a perfectly viable solution. The thing I don't like about this solution is that the resulting display object, the SVG drawing, would be decoupled from the underlying semantics—the semantics would exist on the initial side of a one way transform, not as part of the resulting drawing. Of course, if we think of the drawing as merely an implementation artifact, like transforming a document to PDF for distribution, this may not be too serious a problem.
One alternative that I wonder about is the possibility of using a microformat to specify semantics of a diagram, and using CSS to handle actually displaying the elements. HTML elements with appropriate classes and attributes could be used to represent the underlying objects, while a stylesheet could place the diagram objects as needed. An interesting advantage of this solution is that it preserves the object model directly withing the diagram—use an alternate stylesheet (or no stylesheet) and the semantics are right there on display.
The main questions, then, are:
- What are the proper semantics of a microformat for representing a diagram?
- How can CSS apply styles robustly enough to display a document as a diagram?
I'll elaborate on this in the future.