Open raffazizzi opened 1 year ago
Follow up: it seems that even including <classRef key="model.persStateLike" />
isn't sufficient. Possibly because the model ins't used by any other element, so it gets dropped during compilation. This makes me think that the element may as well be dropped too: <nationality>
itself isn't at all usable without including person
, personGrp
, or persona
Precisely. If you modify the ODD to read
<moduleRef key="namesdates" include="nationality person"/>
then model.persStateLike reappears in the generated schema. So clearly the ODD compiler is being a bit cleverer than I thought: my guess is that it removes classes for which no member can be found.
So clearly the ODD compiler is being a bit cleverer than I thought: my guess is that it removes classes for which no member can be found.
Yes, this can be seen in the verbose logs of teitorelaxng
, for example:
[xslt] Phase 1: import model.persStateLike by moduleRef
[xslt] Phase 1: hang onto model.persStateLike
later:
[xslt] Phase 2: keep classSpec model.persStateLike
then:
[xslt] Reject unused class model.persStateLike
and finally:
[xslt] Reject unused memberOf pointing to model.persStateLike
So what do we (or at least you @raffazizzi & @lb42) think is the correct solution? Should we document the current behavior better (if you include an element but not its parents, the result probably is not what you expect), or change the current behavior (which would leave many schemas with lots of empty classes, but at least a user could add something to that class without difficulty)?
I think the current behaviour is quite reasonable, once you understand that orphan elements (i.e. those with no possible parent) are always eliminated. The problem is that it's not very well explained. A previous version of Roma Classic included an additional "sanity check" which would alert the user to this and similar situations: might be worth thinking about including something like it in a future version.
Consider the following
<schemaSpec>
:When its ODD gets compiled (e.g. via TEIGarage, which uses the Stylesheets), the definition for
<nationality>
will not includemodel.persStateLike
:To fix this, one can include the model explicitly with a
<classRef>
, but should it be included automatically?@lb42 pointed to this passage in the Guidelines:
What should be the right behavior here? This of course affects Roma, too. See https://github.com/TEIC/romajs/issues/101