This is a static archive of the previous Open Grid Forum Redmine content management system saved from host redmine.ogf.org file /boards/15/topics/28 at Thu, 03 Nov 2022 15:42:36 GMT Ensure that 'nil' is handled by DFDL expressions - Public Comments Archive - Open Grid Forum

Ensure that 'nil' is handled by DFDL expressions

Added by Steve Hanson about 9 years ago

The special value 'nil' is recognised in DFDL but not in XDM where a separate flag is used.


Replies (8)

RE: Ensure that 'nil' is handled by DFDL expressions - Added by Michael Beckerle about 9 years ago

XPath 2.0 has a fn:nilled function for testing if something is nil.

If we added that to the set of functions DFDL provides, plus a constructor, suggest dfdl:nil().

The only additional thing would be to define how expressions that encounter nil behave.

RE: Ensure that 'nil' is handled by DFDL expressions - Added by Michael Beckerle about 9 years ago

Having the constructor dfdl:nil() may cause issues.

Consider this expression

if ($p = 5) then "a string" else dfdl:nil()

Since XPath/XML doesn't really have a notion of nil (it's really an empty XML element with a special attribute xsi:nil='true'), there is no way to carry around a nil value as part of a calculation. Another way to say this is that XPath/XML allows nilled elements. But does not allow nil values.

So if we want DFDL implementations to be able to reuse an XPath implementation as a means of implementing DFDL expressions, then this dfdl:nil() constructor idea would be rather problematic.

I suggest we eliminate the value 'nil' from the DFDL Infoset, and add a member [isNil] (or we can copy whatever name XDM uses for this) which is a boolean for nillable elements, and has no value otherwise.

Then we can add the fn:nilled function to test this boolean.

RE: Ensure that 'nil' is handled by DFDL expressions - Added by Michael Beckerle about 9 years ago

XDM calls this infoset member 'nilled'.

So the whole proposal is:
  • remove all discussion of nil as a special value
  • add [nilled] member to element information item
  • add fn:nilled function to expression language

RE: Ensure that 'nil' is handled by DFDL expressions - Added by Steve Hanson about 9 years ago

There's a section in the XPath 2.0 spec that is worth a read - 2.5.2 Typed Value and String Value. The typed value takes into account the nilled flag, and is the empty sequence if nilled is true. Given our infoset only deals with typed values, then this implies that an attempt to get the value of a nilled element should return empty sequence. We should state this somewhere in section 23.

Resolved RE: Ensure that 'nil' is handled by DFDL expressions - Added by Michael Beckerle about 9 years ago

Combining prior two comments. Add the language about taking the value of a nilled element to section 23.

Resolved: Ensure that 'nil' is handled by DFDL expressions - Added by Steve Hanson over 8 years ago

New errata 4.3 in experience document 1.

DONE - RE: Ensure that 'nil' is handled by DFDL expressions - Added by Michael Beckerle over 8 years ago

DONE in draft-gwdrp-dfdl-v1.0.4-r05.docx. Note that I searched the entire spec for all references of nil, and there were additional sections where wording had to be revised so as to describe nil properly based on the [nilled] member versus a distinguished Nil value.

(1-8/8)

This is a static archive of the previous Open Grid Forum Redmine content management system saved from host redmine.ogf.org file /boards/15/topics/28 at Thu, 03 Nov 2022 15:42:45 GMT