Re: XS: Construction Rule Features

Subject: Re: XS: Construction Rule Features
From: James Clark <jjc@xxxxxxxxxx>
Date: Mon, 26 May 1997 12:33:57 +0700
At 23:44 25/05/97 -0400, Paul Prescod wrote:

>Implementors: is recognizing specifity conflicts much harder than recognizing
>identical qualified-gis in construction rules? I would have presumed that the
>actual machinery would be "calculate the specificity of all matching rules,
>look for the highest, and complain if two are the same".

At the moment you can detect any conflicts as soon as you know the concrete
syntax of document.  If you only have one concrete syntax to deal with (as
in XML), you can detect them at compile time.  In either case you detect
duplicates when you build your data structure (probably some sort of
hash-table) for doing matching.  If you added attribute matching, you
couldn't do this.  You would have to check for specificity conflicts each
time you processed a node.

The major concern I have about this isn't the implementation complexity, but
the conceptual complexity.  At the moment, the specificity rules are very
obvious and simple:

(id foo ...)

is more specific than

(element (bar foo) ...)

which is more specific than

(element foo ...)

which is more specific than

(default ...)

The moment you introduce attributes, I think it stops being obvious.

In fact I think it changes the whole concept of specificity.  Instead of
being a total order, it becomes a partial order.  For example, conside the
following element patterns.

1.  FOO

2. (FOO (A1 V1)

3. (BAR FOO)

4. (BAR FOO (A1 V1))

If we write 2 > 1 to mean pattern 2 is obviously more specific than pattern
1, then I think we have

2 > 1
3 > 1
4 > 1
4 > 2
4 > 3

but neither

3 > 2

nor

2 > 3.

Another example where I think the same applies is:

1. (BAR FOO)

2. (BAR (A1 V1) FOO)

3. (BAR FOO (A1 V1))

4. (BAR (A1 V1) FOO (A1 V1))

I guess I'm really making a proposal:

1. The pattern in an element construction rule is the same as a pattern in
match-element?.

2. An element construction rule E1 is more specific than an element
construction rule E2 if

- the number of GIs in E1 is greater than or equal to the number of GIs in
E2, and

- for each GI in E2 the number of attributes qualifying that GI in E1 is
greater than or equal to the number of attributes qualifying that GI in E2.

Note that the relation "more specific" is a partial order not a total order.

3. It is an error if there is a node for which there is a matching rule, but
for which there is no matching rule that is more specific than all other
matching rules.

James


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread