Skip to content
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

when an element is included, Roma should (dynamically) select all classes it is a member of #101

Open
rvdb opened this issue Apr 28, 2020 · 8 comments
Assignees

Comments

@rvdb
Copy link

rvdb commented Apr 28, 2020

When an element is included, Roma should automatically load all of the model classes it is a member of.

This does not (always) seem to be the case. For example, if the <nationality> element is included in an ODD:

<moduleRef key="namesdates" include="nationality"/>

When this ODD is loaded in Roma, the Model Classes section for the <nationality> element is empty:

2020-04-28 17_09_10-Roma - ODD customization

Yet, TEI defines <nationality> as member of the model.persStateLike model class.

When inspecting the Model Classes tab in Roma, the model.persStateLike class is not selected:

2020-04-28 17_13_55-Roma - ODD customization

Selecting this class will make it appear in the Model Classes section for the <nationality> element in Roma.

This is inconvenient, and inconsistent with Roma's handling of attribute classes. When an ODD file that includes the <nationality> element is loaded in Roma, the attribute class att.editLike is selected automatically in Roma.

Note: While attribute classes for individual elements do seem to be loaded better than their model classes, Roma doesn't do this interactively. For example: when starting from an absolutely bare ODD, selecting <nationality> in Roma doesn't automatically load the att.editLike and model.persStateLike classes. For both types of classes, it would be most convenient if they were selected dynamically in Roma's display upon selecting a member element.

Unfortunately, I haven't been able to identify the exact trigger for this buggy display. It does happen when only one element from a module is included in an ODD (as with this example). Roma does properly select all attribute and element classes:

  • when the entire namesdates module is included (without @include attribute)
  • when all elements from the namesdates module are included individually in the @include attribute
@rvdb rvdb changed the title when an element is included, Roma should (dynamically) selec all classes it is a member of when an element is included, Roma should (dynamically) select all classes it is a member of Apr 28, 2020
@raffazizzi raffazizzi self-assigned this Apr 30, 2020
@raffazizzi raffazizzi added this to the v0.3.0 milestone Apr 30, 2020
@raffazizzi
Copy link
Contributor

Note to self: consider adding prompt to user (e.g. "do you also want to add all classes this element is a member of?") -- perhaps allow to choose model, atts, both

@rvdb
Copy link
Author

rvdb commented Nov 16, 2020

@raffazizzi I confirm that in Roma-0.3.0 these problems are resolved when an element is added via Roma. For example, when <nationality> is added to an ODD via Roma, now all model classes (model.persStateLike) and attribute classes (att.editLike) are included (or displayed as such) automatically.

Still, there's one glitch remaining: when an existing ODD is uploaded which only includes <nationality> from namesdates, the attribute classes seem to be diplayed correctly in Roma, but the Model Classes tab shows up empty (instead of listing model.persStateLike).

@raffazizzi
Copy link
Contributor

raffazizzi commented Mar 11, 2023

@rvdb I believe this is something outside of scope for Roma because the Stylesheets will exclude membership to classes that are not explicitly selected. Consider the following <schemaSpec>:

<schemaSpec ident="oddex1" start="TEI">
        <moduleRef key="header"/>
        <moduleRef key="core"/>
        <moduleRef key="tei"/>
        <moduleRef key="textstructure"/>
        <moduleRef key="namesdates" include="nationality"/>
</schemaSpec>

When it gets compiled by TEIGarage, the definition for <nationality> will not include model.persStateLike:

<elementSpec xmlns:rng="http://relaxng.org/ns/structure/1.0" module="namesdates" ident="nationality">
<!-- ... -->
 <classes>
    <memberOf key="att.global"/>
    
    <memberOf key="att.datable"/>
    <memberOf key="att.editLike"/>
    <memberOf key="att.naming"/>
    <memberOf key="att.typed"/>
  </classes>
<!-- ... -->
</elementSpec>

This is the data the Roma gets, so it won't include model.persStateLike.

To fix this, you can include the model explicitly (as you would have to do if you were writing the ODD by hand). If you select from the list of model classes, it will correctly show up in the element page.

@lb42 lb42 reopened this Mar 11, 2023
@lb42
Copy link
Member

lb42 commented Mar 11, 2023

My understanding is that model classes should be included in an ODD if the module in which they are defined is included: it has nothing to do with whether or not a member element of the class is defined. In the case of model.persStateLike, it is declared in the basic tei module, and should therefore be available, but even if it were defined only in the namesdates module (as one might expect), it should still be available. The Guidelines are a bit coy on the matter : "The effect of a moduleRef element is to include in the schema all declarations provided by that module. This may be modified by means of the attributes include and except which allow the encoder to supply an explicit lists of elements from the stated module which are to be included or excluded respectively." they say : but this doesnt make explicit that "This may be modified..." applies only to elements, and that ipso facto other declarations in a module (such as classes or macros) are always included.

So either I am misunderstanding this completely, or something has changed, or this is a bug in roma.

@raffazizzi
Copy link
Contributor

Hi @lb42 , if that's the case, then this is a Stylesheet issue. Roma should operate with what comes back from the ODD compilation process. I can open an issue on the stylesheets repo and reference this one.

@raffazizzi
Copy link
Contributor

raffazizzi commented Mar 11, 2023

@rvdb I also want to point out that attribute classes are included because they are all (or most) declared on the tei module, so they are already included by default. Model classes like model.persStateLike are part of specific modules, like namesdates and must either be included by adding the entire module, or on a case-by-case basis. I'm not sure if Roma should step in here to actively add classes that may get "zapped" by compilation anyway.

It is nonetheless something to consider, so I'm re-opening this issues, but removing it from the next release milestone.

@raffazizzi raffazizzi reopened this Mar 11, 2023
raffazizzi added a commit that referenced this issue Mar 11, 2023
@lb42
Copy link
Member

lb42 commented Mar 11, 2023

Hmm. But in fact model.persStateLike is declared in the module tei, not in the namesdates module. So something else is going on here.

@raffazizzi
Copy link
Contributor

You're right @lb42 , then it's definitely because it gets removed at compilation, while the other attribute classes survive because they're used elsewhere.

I think I'll bring this to issue to the Stylsheets group because I'm not sure whether we should adjust the compilation stylesheets to keep classes of elements that are explicitly included, or if Roma should do some heavy lifting in making up for (intentionally) lost data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants