Re: [tei-council] fun with min and max
In further experimentation, Syd and I have uncovered a rather nasty bug in the way @minOccurs and @maxOccurs interact. See https://github.com/TEIC/TEI/issues/1544 How does this work in XSD I wonder? On 29/11/16 14:51, Syd Bauman wrote:
Discussion of <abx> content ---------- -- ----- ------- The ODD defines <abx> as follows. | <elementSpec ident="abx"> | <desc>A block with at least 2 titles</desc> | <content> | <elementRef key="title" minOccurs="2"/> | </content> | </elementSpec> It seems that from the comment you believe this should generate ( title, title+ ) or ( title, title, title* ) That is, you (quite reasonably) presume that if @minOccurs is > 1, @maxOccurs should default to "unbounded".
But the Guidelines seem pretty clear to me: the default of @maxOccurs is '1', period. Thus the specification above has a bit of a contradiction (min of 2, max of 1), which I decided to resolve in favor of the specified @minOccurs rather than the defaulted @maxOccurs. Thus I produce ( title, title )
I do not know off the top of my head what XSD does in this case, or what pre-PureODD would have done with a <datatype minOccurs="2">.
You sent this directly to me (not the Council list), so I replied directly to you. But I think the @maxOccurs default issue needs to be brought to the group.
Here's my little test file, a script to run it, and the outputs I get, all zipped up for your pleasure in one (I hope) self-explanatory zip.
The main reason I was getting different results from you, I think. is because I am an eejut when it comes to handling branches. You and me both, bub.
ALL HANDS ON DECK Sorry for yelling, guys, but we have a ticket flagged as high priority, release-blocking, and needs discussion with less than 1 week to go before a planned release. I think people should be commenting on this ticket pretty aggressively. It is https://github.com/TEIC/TEI/issues/1544. Here is a quick (well, quick for me) summary: * The documented default value of @minOccurs and @maxOccurs is '1'; that does not make sense for @maxOccurs, because then <datatype minOccurs="3"> ... has a @maxOccurs (of "1") that is less than @minOccurs. * We don't want to leave it as is, as the code that handles @minOccurs and @maxOccurs is quite broken (in 'dev') and a little broken (in 'sybd-occurs2'). So we need to know what the fixed code should do. * There are lots of possible solutions. The two that seem most reasonable at the moment are: * (d) establish a rule that IF @minOccurs is specified THEN @maxOccurs must be specified, too * (e) remove the <defaultVal> from the definition of @maxOccurs and add a <remarks> that says something like "The default value of @maxOccurs is "unbounded" if @minOccurs is 2 or greater; otherwise the default value of @maxOccurs is 1.". * Whether we choose (d) or (e) or something else, there is work to be done. * We could, I think, just back out to as bad as things are in 3.0.0, but (as mentioned above) that seems a real shame. Can anyone answer Lou's question below? If no one knows off top of head, someone should research it. (I can't check right now, as for reasons I don't understand I cannot connect to the W3C website from home.) P.S. Martin Holmes is chuckling an "I told you so" about the dangers of default values right now.
In further experimentation, Syd and I have uncovered a rather nasty bug in the way @minOccurs and @maxOccurs interact.
See https://github.com/TEIC/TEI/issues/1544
How does this work in XSD I wonder?
But I can reach Stack Overflow from home, so I was able to find out. W3C says that in XSD-land the defaults are simply "1", and it is invalid to specify a @maxOccurs that is less than @minOccurs. Corollaries: * when @maxOccurs is *not* specified, only two values are valid for @minOccurs: namely "0" and "1"; * if @minOccurs is specified as "2" or greater, then @maxOccurs is required; * a lone @maxOccurs (i.e., no @minOccurs) of "0" is invalid. I think there is something to be said for this approach, which I will add to the ticket as (g).
Can anyone answer Lou's question below? If no one knows off top of head, someone should research it. (I can't check right now, as for reasons I don't understand I cannot connect to the W3C website from home.)
I've been following this quietly, figuring/hoping you two were always on the verge of solving this and know a lot more than me. I've not a clue on the XSD question, but since you called for aggressive commenting, I’ll just say my read of this favors option d): IF @minOccurs is specified THEN @maxOccurs must be specified too. It seems the most flexible and adaptable solution, since you can set minOccurs as some specific value and maxOccurs as unbounded as needed. Or you can tightly control things and set minOccurs to zero and maxOccurs to 1. Option e) sets a couple of conditions for the default value of maxOccurs, and does nothing with minOccurs: Is that an issue in itself? (Is there currently a default on @minOccurs?) Sorry if you’ve covered this already—don’t answer if not helpful. Elisa
On Nov 29, 2016, at 11:06 PM, Syd Bauman
wrote: ALL HANDS ON DECK
Sorry for yelling, guys, but we have a ticket flagged as high priority, release-blocking, and needs discussion with less than 1 week to go before a planned release.
I think people should be commenting on this ticket pretty aggressively. It is https://github.com/TEIC/TEI/issues/1544.
Here is a quick (well, quick for me) summary:
* The documented default value of @minOccurs and @maxOccurs is '1'; that does not make sense for @maxOccurs, because then <datatype minOccurs="3"> ... has a @maxOccurs (of "1") that is less than @minOccurs.
* We don't want to leave it as is, as the code that handles @minOccurs and @maxOccurs is quite broken (in 'dev') and a little broken (in 'sybd-occurs2'). So we need to know what the fixed code should do.
* There are lots of possible solutions. The two that seem most reasonable at the moment are:
* (d) establish a rule that IF @minOccurs is specified THEN @maxOccurs must be specified, too
* (e) remove the <defaultVal> from the definition of @maxOccurs and add a <remarks> that says something like "The default value of @maxOccurs is "unbounded" if @minOccurs is 2 or greater; otherwise the default value of @maxOccurs is 1.".
* Whether we choose (d) or (e) or something else, there is work to be done.
* We could, I think, just back out to as bad as things are in 3.0.0, but (as mentioned above) that seems a real shame.
Can anyone answer Lou's question below? If no one knows off top of head, someone should research it. (I can't check right now, as for reasons I don't understand I cannot connect to the W3C website from home.)
P.S. Martin Holmes is chuckling an "I told you so" about the dangers of default values right now.
In further experimentation, Syd and I have uncovered a rather nasty bug in the way @minOccurs and @maxOccurs interact.
See https://github.com/TEIC/TEI/issues/1544
How does this work in XSD I wonder? -- tei-council mailing list tei-council@lists.tei-c.org http://lists.lists.tei-c.org/mailman/listinfo/tei-council
PLEASE NOTE: postings to this list are publicly archived
participants (3)
-
Elisa Beshero-Bondar
-
Lou Burnard
-
Syd Bauman