From joewiz at gmail.com Sat May 27 19:36:08 2017 From: joewiz at gmail.com (Joe Wicentowski) Date: Sat, 27 May 2017 22:36:08 -0400 Subject: [xquery-talk] Adaptive serialization and indendation Message-ID: Hi all, I'm involved in commissioning the addition of adaptive serialization [1] to eXist [2], and I would like to confirm my reading of the spec. It appears that adaptive serialization has no facility for indenting maps and arrays. The ser/method-adaptive.xml tests in the qt3 test suite reflect this understanding, esp. tests 32-34. In other words, `map { "a": "b", "c": "d" }` must be serialized as `map{"a":"b","c":"d"}` without any whitespace inserted inside the map constructor or between the map entries, and it would be *incorrect* to serialize this map as: ``` map { "a": "b", "c": "d" } ``` Is there room for implementations to use such indentation and still call it "adaptive"? If so, what basis is there in the spec for such behavior? Thanks in advance for any insights into this question, Joe [1] https://www.w3.org/TR/xslt-xquery-serialization-31/#adaptive-output [2] https://github.com/eXist-db/exist/issues/1124 -------------- next part -------------- An HTML attachment was scrubbed... URL: From liam at w3.org Sun May 28 00:13:04 2017 From: liam at w3.org (Liam R. E. Quin) Date: Sun, 28 May 2017 03:13:04 -0400 Subject: [xquery-talk] Adaptive serialization and indendation In-Reply-To: References: Message-ID: <1495955584.3603.329.camel@w3.org> On Sat, 2017-05-27 at 22:36 -0400, Joe Wicentowski wrote: > > [...] > Is there room for implementations to use such indentation and still > call it "adaptive"???If so, what basis is there in the spec for such > behavior? Here's a personal response - use bugzilla (see the status section of the spec, https://www.w3.org/TR/xslt-xquery-serialization-31/ for details) if you want a Working Group response. The Working Group will probably close soon, however. So, https://www.w3.org/TR/xslt-xquery-serialization-31/#JSON_INDENT has, for JSON, [[ The indent parameter controls whether the serializer adjusts the whitespace in the serialized result so that a person will find it easier to read. ]] (the spec doesn't say _which_ person!). OK, and now we see, in 10.1, [[ For some item types the Adaptive output method will delegate serialization to other?output methods. [...] serialization parameters,? if set, will be passed down to the serialization method that is applied? to each item?in the supplied sequence. ]] So as I read it you have as implementor a license to pass the indent parameter down and to use JSON serialization for maps and arrays and hence to allow the readable indenting. Certainly that's in the _spirit_ of the adaptive method. And using a serialization parameter would also let you pass the tests :) although I don't know how important that is to you. Again, this is based on my own reading of the spec, and being at the meetings and on the calls, but it's not an "official" response. Best, Liam -- Liam R. E. Quin The World Wide Web Consortium (W3C) From joewiz at gmail.com Tue May 30 12:18:04 2017 From: joewiz at gmail.com (Joe Wicentowski) Date: Tue, 30 May 2017 15:18:04 -0400 Subject: [xquery-talk] Adaptive serialization and indendation In-Reply-To: <1495955584.3603.329.camel@w3.org> References: <1495955584.3603.329.camel@w3.org> Message-ID: Hi Liam, Many thanks for this helpful response about the "spirit" of the spec here. I have one last question - do you have a sense why section 10.1.4 makes this statement? > The indent and suppress-indentation parameters are not directly applicable to the Adaptive output method. [1] (What throws me off a bit here, of course, is that Adaptive is the only output method that serializes maps *as* maps, so there isn't anywhere else to look for direct guidance on indentation of maps.) I may well proceed with the bugzilla request, but if you have any further insight on this question, it would help me understand whether the current phrasing was an unintentional oversight or whether there was some other consideration that led the WG to state the above. Thanks again, Joe [1] https://www.w3.org/TR/xslt-xquery-serialization-31/#ADAPTIVE_INDENT On Sun, May 28, 2017 at 3:13 AM, Liam R. E. Quin wrote: > On Sat, 2017-05-27 at 22:36 -0400, Joe Wicentowski wrote: > > > > [...] > > > Is there room for implementations to use such indentation and still > > call it "adaptive"? If so, what basis is there in the spec for such > > behavior? > > Here's a personal response - use bugzilla (see the status section of > the spec, > https://www.w3.org/TR/xslt-xquery-serialization-31/ > for details) if you want a Working Group response. > > The Working Group will probably close soon, however. > > So, > > https://www.w3.org/TR/xslt-xquery-serialization-31/#JSON_INDENT > has, for JSON, > [[ > The indent parameter controls whether the serializer adjusts the > whitespace in the serialized result so that a person will find it > easier to read. > ]] > (the spec doesn't say _which_ person!). > > OK, and now we see, in 10.1, > [[ > For some item types the Adaptive output method will delegate > serialization to other output methods. [...] serialization parameters, > if set, will be passed down to the serialization method that is > applied to each item in the supplied sequence. > ]] > > So as I read it you have as implementor a license to pass the indent > parameter down and to use JSON serialization for maps and arrays and > hence to allow the readable indenting. > > Certainly that's in the _spirit_ of the adaptive method. And using a > serialization parameter would also let you pass the tests :) although > I don't know how important that is to you. > > Again, this is based on my own reading of the spec, and being at the > meetings and on the calls, but it's not an "official" response. > > Best, > > Liam > > > -- > Liam R. E. Quin > The World Wide Web Consortium (W3C) > -------------- next part -------------- An HTML attachment was scrubbed... URL: From liam at w3.org Tue May 30 13:21:10 2017 From: liam at w3.org (Liam R. E. Quin) Date: Tue, 30 May 2017 16:21:10 -0400 Subject: [xquery-talk] Adaptive serialization and indendation In-Reply-To: References: <1495955584.3603.329.camel@w3.org> Message-ID: <1496175670.7794.42.camel@w3.org> On Tue, 2017-05-30 at 15:18 -0400, Joe Wicentowski wrote: > Hi Liam, > > Many thanks for this helpful response about the "spirit" of the spec > here. > I have one last question - do you have a sense why section 10.1.4 > makes > this statement? > > > The indent and suppress-indentation parameters are not directly > > applicable to the Adaptive output method. [1] it's saying that if the implementation delegates to another serialization method for part or all of the output, the indent and suppress-indentation parameters are to be passed on to that method. > > (What throws me off a bit here, of course, is that Adaptive is the > only > output method that serializes maps *as* maps, so there isn't anywhere > else > to look for direct guidance on indentation of maps.) In principle doesn't JSON do that too? Which is why I think delegating map serialization to the JSON method might make sense. If you do plan to file an issue against the spec, do it soon - I think the XQuery Working Group might only have two or three more meetings before it closes. XSLT will be going perhaps a little longer but is focused on XSLT 3. Liam -- Liam R. E. Quin The World Wide Web Consortium (W3C) From joewiz at gmail.com Tue May 30 13:24:16 2017 From: joewiz at gmail.com (Joe Wicentowski) Date: Tue, 30 May 2017 16:24:16 -0400 Subject: [xquery-talk] Adaptive serialization and indendation In-Reply-To: References: <1495955584.3603.329.camel@w3.org> Message-ID: Hi Michael, Thanks for your reply. Would it be accurate to say, then, that the indent parameter is delegated to the JSON output method when serializing map and array items under the Adaptive output method? I ask because I don't see anything explicitly stating that the JSON output method is the delegate for serialization parameters affecting map and array items under Adaptive output method. But since no other output method claims to be able to serialize map and array items, the spec makes this conclusion implicitly. Joe On Tue, May 30, 2017 at 3:45 PM, Michael Kay wrote: > I think the key to this is the word "directly". For many things the > adaptive methods delegates to other output methods, and in cases where the > adaptive method does not itself use a serialization parameter, but the > method to which it delegates does, the phrase "is not directly applicable" > is used. This is explained in section 10.1 of the serialization spec. > > Michael Kay > Saxonica > > On 30 May 2017, at 20:18, Joe Wicentowski wrote: > > Hi Liam, > > Many thanks for this helpful response about the "spirit" of the spec > here. I have one last question - do you have a sense why section 10.1.4 > makes this statement? > > > The indent and suppress-indentation parameters are not directly > applicable to the Adaptive output method. [1] > > (What throws me off a bit here, of course, is that Adaptive is the only > output method that serializes maps *as* maps, so there isn't anywhere else > to look for direct guidance on indentation of maps.) > > I may well proceed with the bugzilla request, but if you have any further > insight on this question, it would help me understand whether the current > phrasing was an unintentional oversight or whether there was some other > consideration that led the WG to state the above. > > Thanks again, > Joe > > [1] https://www.w3.org/TR/xslt-xquery-serialization-31/#ADAPTIVE_INDENT > > On Sun, May 28, 2017 at 3:13 AM, Liam R. E. Quin wrote: > >> On Sat, 2017-05-27 at 22:36 -0400, Joe Wicentowski wrote: >> > >> > [...] >> >> > Is there room for implementations to use such indentation and still >> > call it "adaptive"? If so, what basis is there in the spec for such >> > behavior? >> >> Here's a personal response - use bugzilla (see the status section of >> the spec, >> https://www.w3.org/TR/xslt-xquery-serialization-31/ >> for details) if you want a Working Group response. >> >> The Working Group will probably close soon, however. >> >> So, >> >> https://www.w3.org/TR/xslt-xquery-serialization-31/#JSON_INDENT >> has, for JSON, >> [[ >> The indent parameter controls whether the serializer adjusts the >> whitespace in the serialized result so that a person will find it >> easier to read. >> ]] >> (the spec doesn't say _which_ person!). >> >> OK, and now we see, in 10.1, >> [[ >> For some item types the Adaptive output method will delegate >> serialization to other output methods. [...] serialization parameters, >> if set, will be passed down to the serialization method that is >> applied to each item in the supplied sequence. >> ]] >> >> So as I read it you have as implementor a license to pass the indent >> parameter down and to use JSON serialization for maps and arrays and >> hence to allow the readable indenting. >> >> Certainly that's in the _spirit_ of the adaptive method. And using a >> serialization parameter would also let you pass the tests :) although >> I don't know how important that is to you. >> >> Again, this is based on my own reading of the spec, and being at the >> meetings and on the calls, but it's not an "official" response. >> >> Best, >> >> Liam >> >> >> -- >> Liam R. E. Quin >> The World Wide Web Consortium (W3C) >> > > _______________________________________________ > talk at x-query.com > http://x-query.com/mailman/listinfo/talk > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: