I like this. One thing I might change, though I don't feel strongly, is
what happens when both dfdl:lookupRange and dfdl:lookupKey are both
provided. In this case, the proposal says only dfdl:lookupRange is used
on parse, and dfdl:lookupKey is used on unparse. I can imagine cases
where there are a bunch of individual keys unioned with a range of keys,
for example, enum values for a string might be

  -10, 0, 2, 4, 6, 8, and 100-1000

If we wanted to support that and unparse to 6, we would need the following:

  dfdl:lookupKey="6"
  dfdl:lookupRange="-10 -10 0 0 2 2 4 4 6 6 8 8 100 1000"

which is a bit more verbose than it needs to be. If instead both
lookupKey and lookupRange were unioned for parse, and the first
lookupKey was used for unparse, it could look like this:

  dfdl:lookupKey="6 -10 0 2 4 8"
  dfdl:lookupRange="100 1000"

which is a little more readable, and is somewhat consistent with how
dfdl:separator works (i.e. you can provide multiple separators for
parse, and the first is used for unparse). This is also consistent with
how you mention unions can be used for building up the dfdl:repType.

Only other thing I'd think about changing is the names of the properties
so that it is more clear that dfdl:repType and dfdl:lookupKey/Range are
pairs, sortof like dfdl:choiceDispatchKey/Value clearly go together. I'm
not sure what would be better, and it's just a name so probably not
worth worrying about too much at this point, but maybe something worth
thinking about as this proposal matures and we start implementation.

The multi-dimensional lookup table is interesting, but I'm not sure I
fully understand the use case. I assume it's converting key/value paris
to something, but it's not exactly clear to me what/how.


On 03/29/2018 04:10 PM, Mike Beckerle wrote:
> 
> Feedback on this idea/proposal is welcome. We need to be able to deal with 
> enumerated constants, converting them from integers to/from strings in DFDL.
> 
> The idea here would be to refine this proposal, then prototype in Daffodil 
> and try it out on some of the schemas that really need it.
> 
> https://cwiki.apache.org/confluence/display/DAFFODIL/Proposal%3A+Features+to+Support+Table-Lookup
> 

Reply via email to