OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Are we losing out because of grammars?

Rick Jelliffe wrote:

> I believe propronents of various schema paradigms (grammars and rule-based
> systems) need to justify that their paradigm is useful. When we only had
> grammars, it was a moot point. Now we have Schematron and other rule-based
> systems, there I think we can be bold enough to start to critique
> grammars-as-schemas.  (Of course, this is a two-way street.)

I think the utility of grammar-based schemas has been well established.
Just because there are some things they can't do doesn't mean the
things they *can* do aren't useful.

One of the biggest benefits of grammar-based schemata is that
they are generative: there is an enumeration procedure as well
as a decision procedure.  This makes things like syntax-directed
editors possible ("show me a list of all the elements that
I can insert at this point in the document"), and makes it
easier to verify transformations ("will this XSLT transform
always produce a valid HTML document when fed an input document
conforming to the specified source DTD?").

> Might we get
> to higher-level schema languages faster by completely ditching the grammar
> paradigm and treating schemas as systems of logical assertions which can be
> queried?

Well, yes; the existence of Schematron aptly demonstrates this point.
But it's not an either-or proposition: grammar-based and rule-based
schemas can work together quite nicely.

[ ... earlier ...]

> Lets contrast the grammar approach to a rule/path based approach (as in
> Schematron). In Schematron we don't have any ambiguity problem, because we
> don't have alternate paths for any location expression in the same way.

But there *is* an ambiguity issue in Schematron -- the requirement
that a node can match the context of at most one <rule>  in
a given <pattern>.  As you mentioned, this doesn't cause
a problem when trying to merge two schemas (just include all
the <pattern>s from both schemas), but the question of whether
all the <rules> within each of the original <pattern>s match
disjoint node-sets remains.

> XML does not have SGML's short refs and delimiter maps, so why does it now
> need grammar-based content-modeling?

XML doesn't need *any* kind of schema language, but lots
of XML applications benefit greatly from them.  Different
kinds of applications call for different kinds of schemas;
those based on tree-local and tree-regular grammars are still
very useful for "document-centric" applications (HTML, DocBook,
TEI, etc.).

--Joe English