[DFDL-WG] question relevant to evaluation timing - short form
Steve Hanson
smh at uk.ibm.com
Wed Oct 31 04:59:36 EDT 2012
Reading the spec sections 7 and 8, it does not explicitly state that at
most one 'format' annotation can appear at an annotation point. But I
think I know why. Firstly, we used to have selectors in the spec, which
would have allowed multiple 'format' annotations on the same object,
although looking back to draft 035 of the spec, the wording for selectors
makes it clear that it allowed just one annotation to be chosen from the
set of annotations. Secondly, we used to allow multiple formats on certain
objects - remember the "applies" attribute, which had values "toScope" and
"hereOnly". When both these features were dropped I think the wording in
the spec was not updated to say that at most one 'format' annotation can
appear at an annotation point. There used to be an example that showed
two dfdl:formats in a dfdl:defineFormat - that was changed to show just
one.
Thinking about it, the IBM DFDL xsd for DFDL annotations can't impose the
one annotation constraint, as it only supplies global elements for
dfdl:element etc. So that check must be being imposed by IBM DFDL code.
However the IBM DFDL xsd allows multiple dfdl:format within
dfdl:defineFormat, but again IBM DFDL code issues an error if more than
one is found. I think this is a hangover from selector support and should
be corrected in the xsd. (The IBM code was originally written when
selectors were in the spec.)
<xsd:element name="defineFormat" type="dfdl:DFDLDefineFormat" />
<xsd:complexType name="DFDLDefineFormat">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0"
ref="dfdl:format" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:NCName" />
<xsd:attribute ref="ibmDfdlExtn:basicProperties" />
</xsd:complexType>
I strongly feel that the only time we should allow multiple 'format'
annotations at the same annotation point is if we add support for
selectors in a future DFDL version.
Regards
Steve Hanson
Architect, Data Format Description Language (DFDL)
Co-Chair, OGF DFDL Working Group
IBM SWG, Hursley, UK
smh at uk.ibm.com
tel:+44-1962-815848
From: Mike Beckerle <mbeckerle.dfdl at gmail.com>
To: Steve Hanson/UK/IBM at IBMGB,
Cc: dfdl-wg at ogf.org
Date: 30/10/2012 19:00
Subject: Re: [DFDL-WG] question relevant to evaluation timing -
short form
But, do you know where in the spec or the errata there are any constraints
on format annotations at a particular annotation point? I'm aware of the
one about discriminators (only one, and excludes asserts). But I can't
find anything saying that you can't have more than one format annotation
at a given annotation point, nor anything constraining the relative order
of the various annotations that appear at a given annotation point that
would dis-allow inter-leaving them arbitrarily. (Though I'm happy to see
this constrained.)
I also can't find anything in the IBM XML Schema for DFDL annotations that
would constrain this. This describes the properties allowed on individual
annotation elements, but I don't see how it constrains how they are
combined/interleaved.
On Tue, Oct 30, 2012 at 2:32 PM, Steve Hanson <smh at uk.ibm.com> wrote:
This makes no sense to me. It doesn't work - you can't spread properties
across multiple annotations and expect the timing to be different at
runtime - what if dfdl:length was on one and dfdl:lengthKind on the other?
IBM DFDL disallows this in its xsd for DFDL annotations. Spec should make
this clear if it doesn't already.
Regards
Steve Hanson
Architect, Data Format Description Language (DFDL)
Co-Chair, OGF DFDL Working Group
IBM SWG, Hursley, UK
smh at uk.ibm.com
tel:+44-1962-815848
From: Mike Beckerle <mbeckerle.dfdl at gmail.com>
To: dfdl-wg at ogf.org,
Date: 30/10/2012 17:50
Subject: [DFDL-WG] question relevant to evaluation timing - short
form
Sent by: dfdl-wg-bounces at ogf.org
Can I do this?
<sequence>
<annotation><appinfo...>
<dfdl:setVariable ref="foo" .../>
<dfdl:sequence initiator="{...expression involving foo...}"/>
<dfdl:newVariableInstance ref="foo" value="{...some
expression...}"/>
<dfdl:sequence terminator="{...expression involving foo...}"/>
</appinfo></annotation>
</element>
See how I am spreading out the evaluation of the runtime-valued properties
with the setVariable and newVariable stuff.
This works so long as we evaluate everything in schema definition order.
Now let me throw one more wrench (spanner for the UK folks) in the works.
I'm going to add a short form annotation:
<sequence dfdl:separator="{... expression...}">
<annotation><appinfo...>
<dfdl:setVariable ref="foo" .../>
<dfdl:sequence initiator="{...expression involving foo...}"/>
<dfdl:newVariableInstance ref="foo" value="{...some
expression...}"/>
<dfdl:sequence terminator="{...expression involving foo...}"/>
</appinfo></annotation>
</element>
Now, a short form annotation is equivalent to a long form conversion
thereof, but in this case is it this one???
<sequence>
<annotation><appinfo...>
<!-- short form annotation comes FIRST when converted. -->
<dfdl:sequence separator="{...expression ...}"/> <!-- Expression
cannot use variable foo. -->
<dfdl:setVariable ref="foo" .../>
<dfdl:sequence initiator="{...expression involving foo...}"/>
<dfdl:newVariableInstance ref="foo" value="{...some
expression...}"/>
<dfdl:sequence terminator="{...expression involving foo...}"/>
</appinfo></annotation>
</element>
Or... is it this one:
<sequence>
<annotation><appinfo...>
<dfdl:setVariable ref="foo" .../>
<dfdl:sequence initiator="{...expression involving foo...}"/>
<dfdl:newVariableInstance ref="foo" value="{...some
expression...}"/>
<dfdl:sequence terminator="{...expression involving foo...}"/>
<!-- short form annotation comes LAST when converted -->
<dfdl:sequence separator="{...expression ...}"/> <!-- expression
could use varible foo. -->
</appinfo></annotation>
</element>
I would argue I prefer the first one, because makes the lexical order of
appearance consistent with evaluation order.
...mikeb
--
Mike Beckerle | OGF DFDL WG Co-Chair
Tel: 781-330-0412
--
dfdl-wg mailing list
dfdl-wg at ogf.org
https://www.ogf.org/mailman/listinfo/dfdl-wg
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
--
Mike Beckerle | OGF DFDL WG Co-Chair
Tel: 781-330-0412
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ogf.org/pipermail/dfdl-wg/attachments/20121031/dec24a47/attachment-0001.html>
More information about the dfdl-wg
mailing list