ODD constrained attribute class membership

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ODD constrained attribute class membership

Benjamin Wolff Bohl
Der TEI community,

I’m currently working on a schema definition using ODD and have some attributes defined in a class. Now I want to define an element that allows only certain attributes of that class.
I tried using @exclude in the memberOf definition but that didn’t work. So I came up with the idea to use attest/attRef and reference the specific attribute I want to allow. That would work if there was another element being a member of the specified class but all elements use only certain attributes of that class…

The attribute class is att.linking and should group all attributes that hold references to uri:s, other elements and the like. At the moment it holds only two attributes ‘uri’ and ‘name.ref’ (referencing another elements @name – comparable to referencing xml:id but not not constrained to the uniqueness of xml:id across a xml file). More attributes might come up that would fit in this class.

Is there a technical solution to this or is it rather a modelling problem?
In any case, maybe you could help me with some ideas of how to tackle this problem!

Many thanks,
Benjamin
Reply | Threaded
Open this post in threaded view
|

Re: ODD constrained attribute class membership

Lou Burnard-6
Interesting question... Let's see if I've understood it correctly.

Let's say your ODD defines an attribute class "att.xyz" supplying
attributes x, y, and z. And you want to make element E a member of that
class (so that it gets attributes y and z), but you don't want it to
have attribute x. There are only two ways of doing this currently:
1) the easy one : just add an attlist  containing an <attDef ident="x"
mode="delete"/> to the elementSpec for E
2) the tidy one: if E is not the only element which has this behaviour,
it would be more elegant to define a SECOND class att.yz which provides
just those two attributes. Your elements can then state which of the two
classes they belong to.

It would be nice if this second class could inherit y and z from att.xyz
instead of having to define them itself, but the current state of ODD
processing doesn't support things being defined and modified within the
same derived module, i.e. in the same ODD. If it did you could also
solve this more simply using classRef (see
https://github.com/TEIC/Stylesheets/issues/227)

So much for the theory. Maybe you could explain your use case a bit
though. It may well be that the TEI already provides a simpler method of
doing what you want to do without having to invent new non TEI
atttributes! The class att.linking is a TEI class, of course, so while
you can suppress attributes it provides and add new attributes to it, it
might be better practice to define your own att.myLinking class for this
purpose. It can of course inherit whatever it wants from the real
att.linking.


On 20/01/17 09:06, Benjamin W. Bohl wrote:

> Der TEI community,
>
> I’m currently working on a schema definition using ODD and have some attributes defined in a class. Now I want to define an element that allows only certain attributes of that class.
> I tried using @exclude in the memberOf definition but that didn’t work. So I came up with the idea to use attest/attRef and reference the specific attribute I want to allow. That would work if there was another element being a member of the specified class but all elements use only certain attributes of that class…
>
> The attribute class is att.linking and should group all attributes that hold references to uri:s, other elements and the like. At the moment it holds only two attributes ‘uri’ and ‘name.ref’ (referencing another elements @name – comparable to referencing xml:id but not not constrained to the uniqueness of xml:id across a xml file). More attributes might come up that would fit in this class.
>
> Is there a technical solution to this or is it rather a modelling problem?
> In any case, maybe you could help me with some ideas of how to tackle this problem!
>
> Many thanks,
> Benjamin
Reply | Threaded
Open this post in threaded view
|

Re: ODD constrained attribute class membership

Lou Burnard-6
In reply to this post by Benjamin Wolff Bohl
Immediately after  pressing "send" on my previous reply, I thought of  a
much more elegant solution, in which att.xyz inherits y and z from
att.yz and completes them with x. Like this


             <classSpec type="atts" ident="att.xy">
                <desc>provides two attributes</desc>
               <attList>
                <attDef ident="y">
                   <desc>the y attribute</desc>
                   <datatype>
                      <dataRef name="NCName"/>
                   </datatype>
                </attDef>
                <attDef ident="z">
                   <desc>the z attribute</desc>
                   <datatype>
                      <dataRef name="NCName"/>
                   </datatype>
                </attDef>
                </attList>
             </classSpec>

             <classSpec type="atts" ident="att.xyz">
                <desc>provides three attributes</desc>
                <classes>
                   <memberOf key="att.xy"/>
                </classes>
                <attList>
                   <attDef ident="x">
                      <desc>the x attribute</desc>
                      <datatype>
                         <dataRef name="NCName"/>
                      </datatype>
                   </attDef>
                </attList>
             </classSpec>

That seems to work. An element which says it is a member of att.xy will
get attributes x and y, while one that says it's a member of att.xyz
will get x, y, and z.




  On 20/01/17 09:06, Benjamin W. Bohl wrote:

> Der TEI community,
>
> I’m currently working on a schema definition using ODD and have some attributes defined in a class. Now I want to define an element that allows only certain attributes of that class.
> I tried using @exclude in the memberOf definition but that didn’t work. So I came up with the idea to use attest/attRef and reference the specific attribute I want to allow. That would work if there was another element being a member of the specified class but all elements use only certain attributes of that class…
>
> The attribute class is att.linking and should group all attributes that hold references to uri:s, other elements and the like. At the moment it holds only two attributes ‘uri’ and ‘name.ref’ (referencing another elements @name – comparable to referencing xml:id but not not constrained to the uniqueness of xml:id across a xml file). More attributes might come up that would fit in this class.
>
> Is there a technical solution to this or is it rather a modelling problem?
> In any case, maybe you could help me with some ideas of how to tackle this problem!
>
> Many thanks,
> Benjamin