-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add contextually-variant content models to ODD #1744
Comments
Yes, solving the Durand conundrum part 2: replacing schematron with PureODD! |
Co-occurrence constraints are a specific form of additional constraint on content, which you might well implement by means of schematron. A typical co-occurrence constraint might say that if an attribute has some value, then some other attribute should not be permitted, for example. Or it might say that if this element is present in a content model, then that other element should not be. The 'context' attribute proposed (but not implemented) in pure ODD originally is rather different: it was intended to help with the more frequent problem of wanting elements to have different content models in different contexts: for example, I might want to require the <p> elements in my <text> to be segmented into <s>s, but not those in my <teiHeader. This too can be implemented in schematron. And there are lots of other things that schematron can do which are neither contextual nor co-occurrence constraints. So what exactly is the proposal here? ODD already permits the inclusion of embedded schematron rules of any kind. Is the proposal to re-express some or all of the semantics of schematron in ODD? That would certainly be tidier, though presumably it would still have to be translated into something else (presumably schematron) to be of any practical use. |
A few thoughts, which I can't really afford to go into in detail right now, but should jot down lest I forget them:
Even implementing the |
OK, but don't call it "co-occurrence constraint" then. The requirement is for contextually-variant content models. Which is what the |
Here's another use case (a real one). ELTeC wants to use a constrained <bibl> in the sourceDoc of its headers -- requiring certain members of model.biblLike to be present -- but it doesn't want <bibl> anywhere else to be constrained. |
(In reply to @lb42 of 14:54Z, i.e. ~15 mins ago.) Point taken. |
I really think we're seeing the beginning of P6 here. The combination of a hierarchical class system and an extended Pure ODD that can encompass context-dependent context models is a big enough change in my view to make it a start-from-scratch project, and it would be much more straightforward to start with a relatively clean slate than try to graft all these things onto the existing system while retaining backward compatibility. |
I think I might have a higher bar to what constitutes moving to P6 than @martindholmes. @lb42: You are right that I was conflating co-occurrence constraints and contextually-variant content models. However, my thinking was that if we are solving this for content models then why would we not be using the same mechanism for attribute valLists etc. I agree with all your use cases that this is a good thing to be done and I think is part of our updating of ODD to be pure and complete. I don't want to replace schematron (though I recognise one can do many of these things by schematron rules). It isn't about giving users warnings or errors that the thing they are doing is crossing some line in the sand. It is about them having or not having the choices available to them or restrictions already placed on them. That could be on an ODD-level of in the header requiring several elements where elsewhere it doesn't (context-sensitive content models) but equally could be on the document level (say an attribute not being available on an element in a specific location because of the value entered into another attribute elsewhere in the document). The latter is also a context-sensitive content model (if you accept that attributes and their values are part of element's content). An example might be that underneath |
F2F subgroup is in favor of creating a system for co-occurence constraints in ODD. Would @jamescummings produce a more fully fledged proposal? |
Greenlighted for @jamescummings to develop a proposal, with further discussion. |
There seems some overlap with problems we ran into when trying to compile Relax NG to (equivalent) ODD. Therefore I'd like to share my thoughts:
(here different content models are specified for Current ODD allows for exactly one single content model per element.
(Sidenote:
Even though possible, the ODD+Schematron approach has major drawbacks:
My suggestion for improving ODD is to go more into the direction of context-free grammar like syntax. These are the advantages:
I want to stress that rules like in the Relax NG example above are very common, but very difficult to express with current ODD + context dependent rules (be it Schematron or some other context-sensitive restriction language). They shouldn't be. |
@EsGeh It's not that ODD isn't a context-free grammar (it is), it's that its rules for what can go on the left and right sides of productions are more like DTD rules than RNG rules. One of the explicit design requirements of ODD was that it should be able to generate schemas in multiple flavors, and therefore it does not follow the full expressive capabilities of RNG. The point of this ticket is to think about ways to get beyond that. There is an organizational difficulty in what you suggest, which is that the point of ODD (well, one of the points of it) is that we can put element documentation together with element definitions. If we break that by allowing one element to (re)define another, then we have to figure out what to do about that documentation. That's not to say this can't be done, just that it's not quite as simple as "just do what RNG does". |
@jamescummings while you're not officially assigned, I think we're still hoping for a proposal from you. Let us know if that's still part of your plans |
Bump/nudge for @jamescummings |
After quite some time I've been having a think about this and mulling over how to fully document in the ODD the intentions of variations in contextually-variant content models. I'm using content-model here to refer not only to child elements and classes (e.g.
|
Noting this ticket is relevant: #2140 |
After @jamescummings comments, this is squarely in "Needs Discussion" territory. |
It was GO for a more fully-fleshed-out proposal for discussion, not for an actual implementation. 🙂 |
F2F@Guelph thinks we should support this, using Make sure we have the attributes in place that we need to specify co-occurrence. When this is done we will open tickets for:
|
@EsGeh — Wow, my apologies. It has been > 3 years since you posted, but I never saw it until now. Your premise (“ODD allows for exactly one single content model per element”) turns out not to be the case. Disregarding mode="change" for the moment, it is true that every <elementSpec ident="chapterblock" mode="add" ns="http://www.example.edu/cocio">
<altIdent>block</altIdent>
<classes>
<memberOf key="att.global"/>
<memberOf key="model.divPart"/>
</classes>
<content>
<alternate minOccurs="1" maxOccurs="unbounded">
<textNode/>
<elementRef key="code"/>
<elementRef key="foreign"/>
<elementRef key="bibl"/>
</alternate>
</content>
</elementSpec>
<elementSpec ident="otherblock" mode="add" ns="http://www.example.edu/cocio">
<altIdent>block</altIdent>
<classes>
<memberOf key="att.global"/>
<memberOf key="model.profileDescPart"/>
</classes>
<content>
<textNode/>
</content>
</elementSpec> In this case the elements are differentiated by their class membership. If another element (say |
@jamescummings does @sydb's example satisfy your original request? |
@jamescummings can you take a look at @sydb example above? |
We should add co-occurrence constraints [edit: Contextually-variant content models, really] properly to the ODD language.
This should happen for content models, attribute value lists, classSpecs, dataTypes etc.
Perhaps with a 'context' attribute or some such thing. This is more complicated than it might sound in doing it properly in ODD, but even more so in thinking about how our processing will deal with it.
(Based on discussion with @sydb in a breakout group at Council Face to Face Cologne, 2018-02-24)
The text was updated successfully, but these errors were encountered: