Open dmj opened 2 years ago
Thanks @dmj! We should probably test the behavior of @generate
on a sample ODD and its outputs in this context and see what we can do...It might not generate an error, but I'm also wondering under what conditions <classSpec>
is ignored or overruled.
I agree with you that this is an error which should be detected by the ODD processor
I have to admit, at the moment I am not sure I understand the reason for the existence of @generate
of <classSpec>
. Thus I am wondering (aloud) if we could just drop it, and thus avoid conflicts between it and @expand
of <classRef>
.
We are considering this blocked until we decide whether or not to keep @generate
at all, or to have some constraint that would limit @expand
to match @generate
, or whatever, which should be discussed in TEI#2369.
I have been playing around with classes, @generate
, and @expand
for much of yesterday, and have discovered some horrifying (at least to me) things.
Remember as you read this that although @generate
supposedly lists which values of the corresponding @expand
are valid, the way that is currently done in our Stylesheets is only the patterns listed on @generate
are generated (hence the mildly bizarre name of the attribute).
<classSpec>
, I was wrong: “By default, all variations are permitted.”.@generate
plus the plain one) and others have only 1 pattern (the plain one, which is the same as "alternation").classes/memberOf/@key="model.global"
to it (it had no <classes>
at all initially), and suddenly all 6 patterns were generated.<classSpec>
s that have a child <classes>
; and, correspondingly, a list of all classes defined with 1 pattern in tei_all, and a list of all <classSpec>
s that do not have a child <classes>
. While there are many classes in common in each of those pairs, they are not even close to the same lists. Sigh.@generate
was being ignored, which is why I am writing all this on this ticket.My take on all this is that
@generate
as useless, or keep it as an extra internal semantic check on an ODD, we need to fix the Stylesheets so that all 6 patterns are always generated unless we keep @generate
and it explicitly says otherwise.Note-to-self Commands used:
$ egrep '^model\.[A-Za-z0-9._-]+\s*=' Exemplars/tei_all.rnc | perl -pe 's,\s*=.*$,,; s,_.*$,,;' | rank | egrep ' 1 ' | sort | perl -pe 's,^\s+1 ,,;' > /tmp/classes_only_1.txt
$ egrep '^model\.[A-Za-z0-9._-]+\s*=' Exemplars/tei_all.rnc | perl -pe 's,\s*=.*$,,; s,_.*$,,;' | rank | egrep ' 6 ' | sort | perl -pe 's,^\s+6 ,,;' > /tmp/classes_all_6.txt
$ xsel -t -m "//t:classSpec[@type='model'][ not( t:classes ) ]" -v "@ident" -n p5subset.xml | sort > /tmp/classes_sans_classes.txt
$ xsel -t -m "//t:classSpec[@type='model'][ t:classes ]" -v "@ident" -n p5subset.xml | sort > /tmp/classes_with_classes.txt
Considere the following schema specification:
The
classRef
in theroot
element's content model asks the transpiler to create an alternation of the class members ("any one member of the class may appear"), theclassSpec
on the other hand declares that the members of the class are to be provided in sequence.From my understanding this should result in an error. The stylesheets (Version 4.4.0, Last updated on 19th April 2022, revision ff9cc28b0) seem to ignore the classSpec/@generate.