[SCL] XML syntax options
Murray Altheim
m.altheim at open.ac.uk
Fri Feb 27 19:53:47 CST 2004
Pat Hayes wrote:
> Ive been trying to figure out what is the best way to handle a
> structured XML syntax for SCL.
>
> Currently we have two main contenders, as far as I can see, for the
> overall 'style'. Murray, following Tanel, suggests having generic
> tags corresponding to the syntax classes with the actual names as
> properties. The boy-kissed-girl example
>
> (forall (x) (implies (Boy x) (exists (y) (and (Girl y)(Kissed x y) )) ))
>
> looks like this:
>
> <quant name="forall" variable="x" >
> <conn name="implies" >
> <pred name="Boy" >
> <term name="x" / >
> </pred>
> <quant name="exists" variable="y" >
> <conn name="and" >
> <pred name="Girl">
> <term name="y" />
> </pred>
> <pred name=" Kissed">
[...]
I would (unsurprisingly) tend to advocate my own syntax decisions
for a variety of reasons. Before we begin, though, using an existing
syntax means that the semantics of SCL are *identical* with the
defined MathML semantics. If they're not identical, we shouldn't
use MathML. No fudging.
My other points are about syntax. The reasons for the approach I took
were primarily twofold:
1. it minimizes the number of declared elements. E.g., all
predicates use the <pred> element. You always know it's
a predicate, even for SCL extensions. There are only 13
elements in my proposal, including two for documentation.
I have about 30 ENTITY declarations. MathML has 127 elements
and 155 ENTITY declarations, not including the character
entity files (which have hundreds). If SCL is to be a
subset of MathML, someone would have to write that DTD,
which (if you want it to be a subset), be actually a
syntactic subset. That's non-trivial... but you'd still have
an element for every quantifier, every predicate, every
connective. And extending this would either require a new
DTD for each variant, or some different approach for the
extensions than for the core.
[If SCL semantics matched the MathML semantics in each place where
they overlapped, and we were to subset out just the parts of MathML
that we actually used, well, there certainly would be benefits to
that. To me, it's not a pretty way to do things, and doesn't take
advantage of attributes where they would be useful and appropriate.
But the element-only approach can work. I think there's a lot of
places where MathML will seem very cumbersome, particularly where
one is literally providing an attribute/property for something else
and one is using element content to do that.]
2. it allows a model for extension that fits in with the way
that web people understand, the URI. So if I wanted to
modify the Boy-kissed-Girl example by saying that the act
of kissing indicates they touch each other directly, I can
use the defined semantics of an existing schema (such as
Cyc) to create predicates, without creating new markup. No
<touchesDirectly> element (which would require a modification
to the DTD), it'd be something like:
<pred name="touchesDirectly"
xlink:href="http://www.cyc.com/cycdoc/vocab/spatial-vocab.html#touchesDirectly"/>
[If we decided not to use XLink, just drop the "xlink:" from the above.]
I have an example of something like this in the example found in
Section 4.4 of my strawman proposal:
http://www.altheim.com/specs/xcl/1.0/index.html#elt_ref2
I don't think I have much of an emotional attachment to my proposal,
where perhaps a year ago I might have. On technical merit there are
pros and cons (as Pat pointed out) in each approach. I tend to design
DTDs a certain way, and am proud to think that XTM bears a lot of
my design personality. Some people think it's too verbose, or that
I could have economized by including links as attributes within
existing elements rather than having explicit linking elements. Some
of these decisions are aesthetic, but to me a lot of them have what
I think of as fairly solid reasoning behind them. I think MathML is
a fairly well-designed DTD (better than a lot these days), but for
SCL, *if* we want it to be web-enabled, my syntax approach is a lot
more reasonable. IMO.
And I'm certainly (as I've said before) willing to try to help
develop the syntax you want towards fulfilling the design
requirements you feel are there (I'd still like to see those stated,
otherwise how do we know what the target is?).
Murray
......................................................................
Murray Altheim http://kmi.open.ac.uk/people/murray/
Knowledge Media Institute
The Open University, Milton Keynes, Bucks, MK7 6AA, UK .
Now the Pentagon tells Bush: climate change will destroy us
http://www.guardian.co.uk/climatechange/story/0,12374,1153530,00.html
More information about the SCL
mailing list