[vodml] EnumLiterals and vodml-id
Gerard Lemson
glemson1 at jhu.edu
Sun Jan 10 14:14:46 CET 2016
Hi all
A follow up on enumeration literals in VO-DML.
Mark noted that the automated vodml-id generation from UML in the XSLT scripts I prepared use the literal values. In the Dataset and STC models these produced vdml-id that do not obey the constrains for the vodml-id element. I noted that this might just be a problem of the generation code and the UML profile one uses.
However, even when adding vodml-id-s explicitly to enum literals in the UML, there remains the problem s.
In VO-DML.xsd EnumLiteral extends ReferableElement, and does not add anything to it. The @name attribute inherited fro ReferableElement is supposed to represent the literal value. Problem is that @name is restricted as well, namely by the VODMLName pattern '[a-zA-Z_][\w_]*'.
I think one obvious solution might be to add a 'fullName' attribute (or 'title'? I'd be open to alternative name) to EnumLiteral that is supposed to represent the use of the literal in conversation, and defaults to the literal's 'name' if it is not specified. This fullName has no restrictions. In UML one can use an <<enumliteral>> with tag fullName to specify this which the XSLT could pick up.
The other, more straightforward solution is to restrict enumliterals to the pattern for VODMLName.
I actually slightly prefer this solution and not only because it is simpler. Enumerations are primitive types with a discrete set of values. Their "only" r(R)ole is to define the categories for categorical variables (attributes), with the EnumLiterals naming these categories. As such their precise value is immaterial, one could always just use the N lowest integers for this if one wanted. The semantics of the literal is provided by the description. The constraints on 'name' do not really impact human readability in my opinion, but make it easier to use these values in computer contexts which generally impose certain restrictions. Examples are use in pointers, possibly implemented as URLs; class/attribute/table/column names; query languages.
These are also the reason why we restrict the names of Types, Roles, Packages and so on. To make them easier to use in a computer context.
Comments please?
Mark, Arnold, any problems simply making the 'name' of the enumliterals conform to these rules?
Cheers
Gerard
> -----Original Message-----
> From: dm-bounces at ivoa.net [mailto:dm-bounces at ivoa.net] On Behalf Of
> Gerard Lemson
> Sent: Friday, January 08, 2016 6:25 PM
> To: CresitelloDittmar, Mark <mdittmar at cfa.harvard.edu>; Data Models mailing
> list <dm at ivoa.net>
> Subject: RE: [vodml] EnumLiterals and vodml-id
>
> Hi Mark
> Good catch, thanks.But realize that the vodml-id generation from UML is a
> utility, not a part of the spec.
> What we can/should do in the UML is to add explicit vodml-ids for enumeration
> literals whose name is not compliant with the vodml-id standard.
> My generation code should respect predefined vodml-ids in the UML and use
> those rather than generating them form the name.
> I'll try it out in your Modelio diagrams when I get to them.
> Cheers
> Gerard
>
> > -----Original Message-----
> > From: dm-bounces at ivoa.net [mailto:dm-bounces at ivoa.net] On Behalf Of
> > CresitelloDittmar, Mark
> > Sent: Friday, January 08, 2016 3:10 PM
> > To: Data Models mailing list <dm at ivoa.net>
> > Subject: [vodml] EnumLiterals and vodml-id
> >
> > Gerard,
> >
> > I am working on processing the DatasetMetadata model through the
> > vo-dml scripts and am getting a validation error for some enumeration
> > literals which I think point to a conflict in the doc or a missing
> > step in the vodml-id generation in the scripts.
> >
> >
> > Section 4.9.1 literal: EnumLiteral
> >
> > "literals are modeled as strings, as the actual value of an
> > enumeration literal is not important,"
> >
> >
> > However, the value is used to generate the vodml-id for the element,
> > and vodml-id has a rule:
> >
> >
> > Section 4.1.1 vodml-id: ElementID
> >
> > "This element MUST be formatted according to the regular expression
> > in the XML schema: '[\w\._-]+' "
> >
> >
> >
> > In the DatasetMetadata document we have values like:
> >
> > Enumeration Literal vodml-id
> > CreationType "spectral extraction" dataset.CreationType.spectral
> extraction
> > SpectralBandType "X-ray" dataset.SpectralBandType.X-ray
> >
> >
> >
> >
> > The space in the first, and '-' in the second violate the vodml-id pattern.
> >
> >
> > Mark
More information about the dm
mailing list