Re: [Jsonpath] Remarks on the array slice operator described in https://jsonpath-standard.github.io/internet-draft/#name-array-selector-2

Glyn Normington <glyn.normington.work@gmail.com> Wed, 25 November 2020 16:54 UTC

Return-Path: <glyn.normington.work@gmail.com>
X-Original-To: jsonpath@ietfa.amsl.com
Delivered-To: jsonpath@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 4B88C3A1A94 for <jsonpath@ietfa.amsl.com>; Wed, 25 Nov 2020 08:54:27 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.097
X-Spam-Level:
X-Spam-Status: No, score=-1.097 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, FREEMAIL_REPLY=1, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=no autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2xGaI6443l2V for <jsonpath@ietfa.amsl.com>; Wed, 25 Nov 2020 08:54:23 -0800 (PST)
Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id F2DDE3A1A9A for <jsonpath@ietf.org>; Wed, 25 Nov 2020 08:54:22 -0800 (PST)
Received: by mail-wm1-x334.google.com with SMTP id x22so2581856wmc.5 for <jsonpath@ietf.org>; Wed, 25 Nov 2020 08:54:22 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=Nzqx1tpaqT0/qAGjINGpKtbOSzlxDq4rnVeq+3DoJaU=; b=tN047iNcO7eDDzCJQzPCRrS47nnGggV+y8Q4MOjE+BFCiRdCjWvyt2/74aRNnqKNYq FjIZlWt+gLBRNMqnpDQME4Bc4J4PixThMWpkK+mYpQ/CcHxaXfP/Yqsaxd/eL6HH74WC k4gkkaqi46hg96B7W244+PILJvmDGPhqP1mT18jaxK/kSiOnPfZGagtpT58Le3DoVZtk 2cel9jo99KcGXtK7/HvkscKlQ9DrnWvKe07pVVEE3qjoBLU3PObhbs6PlZjCg3YyhsRr P5xdzjp5iA89sd/wVJIbI3h8vcRg/N8yvrlh20T6mkpEfqGD70GaGfYJY22hoVDhwnbM 3RrA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=Nzqx1tpaqT0/qAGjINGpKtbOSzlxDq4rnVeq+3DoJaU=; b=UcoCOspgQBvtK1dfRp+dfhzL9OcvAsC2MVSOpQ2Bz6/HP93W5g8jYPPmqZoS0CDRFY xOXDaoY9OWZx/fKyLM39H8zwU3ZY8O/O7e3sTDR5O2qIY88SZ5deEAzwU8BXynvJEqox fdir73AG9BUZBD81K+M4XFLsU1XJwyDXa+9aZyc5pkmaJuvttX5yGPcRoeuWa+ZWl0q0 FcIjJlHmyPeaEs3C96P1MJ8hOurESFYp4/ZX4uHl5edkfnMmO5SNHauSGdLhFWl4elr0 EajEUW1FowD//c1Lh2PuuHe/HlFEivwrfQM+kdLSy7d56tQ980eBWasOnlcaVmOUfkB7 Ae8A==
X-Gm-Message-State: AOAM533WVufCFK4UnD70gkjwMGn5lqvbAzLE0iqwORVXZnMP6V9rSRXX Bs9XbKMqaJxdTVmpuZlGVTM=
X-Google-Smtp-Source: ABdhPJz+IjHTFiGbYFofQgxH9OZPm40Tw5ni213a9EtR2PlmVV0+rkQ5auG0CbGPmA8WtHyECZKT8g==
X-Received: by 2002:a1c:21c1:: with SMTP id h184mr5073905wmh.106.1606323261293; Wed, 25 Nov 2020 08:54:21 -0800 (PST)
Received: from normingtong-a01.lan (2.144.199.146.dyn.plus.net. [146.199.144.2]) by smtp.gmail.com with ESMTPSA id b18sm5752157wrt.54.2020.11.25.08.54.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Nov 2020 08:54:20 -0800 (PST)
From: Glyn Normington <glyn.normington.work@gmail.com>
Message-Id: <3926457F-875E-4FBF-B9B5-B09FF81855F5@gmail.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_1CDA08C1-1434-444C-89CA-591462EDE9BE"
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\))
Date: Wed, 25 Nov 2020 16:54:19 +0000
In-Reply-To: <448EAD4C-D46F-40C3-9DAE-B5BB8CA458AA@gmail.com>
Cc: Daniel P <danielaparker@gmail.com>, jsonpath@ietf.org
To: Carsten Bormann <cabo@tzi.org>
References: <mailman.54.1605297609.13519.jsonpath@ietf.org> <CA+mwktJb1RV0syupRYjmKvsS9okcjA-q+ZLoL+sSumWaMZF_fA@mail.gmail.com> <526A1BBB-17DE-441B-BBD3-3B1F184C366B@tzi.org> <448EAD4C-D46F-40C3-9DAE-B5BB8CA458AA@gmail.com>
X-Mailer: Apple Mail (2.3608.120.23.2.4)
Archived-At: <https://mailarchive.ietf.org/arch/msg/jsonpath/ZhMx7E_tCiqKWEliL6d3jgv800Y>
Subject: Re: [Jsonpath] Remarks on the array slice operator described in https://jsonpath-standard.github.io/internet-draft/#name-array-selector-2
X-BeenThere: jsonpath@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: A summary description of the list to be included in the table on this page <jsonpath.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/jsonpath>, <mailto:jsonpath-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/jsonpath/>
List-Post: <mailto:jsonpath@ietf.org>
List-Help: <mailto:jsonpath-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/jsonpath>, <mailto:jsonpath-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 25 Nov 2020 16:54:27 -0000

I took a crack at those editorial changes. Please see:

https://github.com/jsonpath-standard/internet-draft/pull/41 <https://github.com/jsonpath-standard/internet-draft/pull/41>

> On 17 Nov 2020, at 15:20, Glyn Normington <glyn.normington.work@gmail.com> wrote:
> 
> The improvements below are welcome. I’ve made one clarification below.
> 
> On 14 Nov 2020, at 20:08, Carsten Bormann <cabo@tzi.org <mailto:cabo@tzi.org>> wrote:
>> 
>> On 2020-11-14, at 20:30, Daniel P <danielaparker@gmail.com <mailto:danielaparker@gmail.com>> wrote:
>>> 
>>>> From: Glyn Normington <glyn.normington@gmail.com <mailto:glyn.normington@gmail.com>>
>>>>> On 12 Nov 2020, at 17:37, Daniel P <danielaparker@gmail.com <mailto:danielaparker@gmail.com>> wrote:
>>> 
>>>>> Note that a slice expression in Goessner is defined with reference to
>>>>> the (long since abandoned) ECMASCRIPT 4. The original link is lost,
>>>>> but there is some discussion here,
>>>>> https://web.archive.org/web/20070125020659/developer.mozilla.org/es4/proposals/slice_syntax.html <https://web.archive.org/web/20070125020659/developer.mozilla.org/es4/proposals/slice_syntax.html>.
>>>> 
>>>> We plugged that gap in the Gössner article thus:
>>>> 
>>>> https://jsonpath-standard.github.io/internet-draft/#name-array-selector-2 <https://jsonpath-standard.github.io/internet-draft/#name-array-selector-2>
>>>> 
>>>> which may be a safer starting point for the WG.
>>>> 
>>> Thanks! The ABNF for an array slice in that reference
>>> 
>>> integer = [%x2D] (%x30 / (%x31-39 *%x30-39))
>>> 
>>> array-slice = [ integer ] ws %x3A ws [ integer ]
>>>                  [ ws %x3A ws [ integer ] ]
>>>                           ; start:end or start:end:step
>> 
>> Looks good.  From an editorial point of view, I’d use a separate definition DIGIT and DIGIT1 for %x30-39 and %x31-39 for readability.  I’d also use "-" and "0" for the non-range terminals %x2D and %x30.  (It may occasionally be necessary to use hex outside ranges, i.e., for case-sensitive letters, unless we want to use the ABNF extensions for case-sensitive letters in RFC 7405 — e.g., for the escapes.  Please see the end of https://tools.ietf.org/html/rfc4997#page-44 <https://tools.ietf.org/html/rfc4997#page-44> for how this can be kept readable.)
>> 
>>> is consistent with JMESPath, Python, and my understanding of
>>> ECMASCRIPT 4. Perhaps the comment could be expanded to highlight that
>>> all integer parts are optional.
>> 
>> That is clearly said in the ABNF, but it certainly doesn’t hurt to spell this out in English as well.
>> (Also, the third colon with the optional integer following is optional.)
>> 
>> The most obvious misunderstanding trap that is set up in the above draft is HEXDIG; this needs a English language comment that the letters A-F are indeed case-insensitive (i.e., also a-f).
>> 
>>> I think this sentence is awkward:
>>> 
>>> "An array slice is a union element consisting of two or three integers
>>> (in base 10 and which may be omitted) separated by colons."
>> 
>> I think what this is trying to say is that [0:3] is exactly equivalent to [0, 1, 2], which is a union operator, so the result of [0:3] should also be what can be called a “union element”.  Detailed terminology to be fixed...
> 
> I added “is a union element" to remind the reader that an array slice is just one kind of union element. That may not be necessary.
> 
> I wasn’t thinking of any equivalence between an array slice and a union of array indices, although that’s an interesting observation, especially as we address the more general questions of duplication and ordering.
> 
>> 
>>> More specifically, the use of the term "union element" seems to me to
>>> be unnatural and unnecessary. Nothing would be lost by substituting
>>> "An array slice consists of ..."
>>> 
>>> Moreover, Goessner uses the term "union" once in
>>> https://goessner.net/articles/JsonPath/ <https://goessner.net/articles/JsonPath/>, and appears to be referring
>>> to expressions of the form
>>> 
>>> union = "[" ( expression *( "," expression ) ) "]"
>>> 
>>> where minimally one comma is required (Goessner's shorthand notation is [,]).
>> 
>> The ABNF in draft-goessner-dispatch-jsonpath-00.txt merges this case with the single value-expression case, so [3], [3, 4], and [3, 4, 5] are handled by the same production, making the result of [3] a (trivial) union as well.
>> 
>> Grüße, Carsten
>> 
>> -- 
>> Jsonpath mailing list
>> Jsonpath@ietf.org <mailto:Jsonpath@ietf.org>
>> https://www.ietf.org/mailman/listinfo/jsonpath <https://www.ietf.org/mailman/listinfo/jsonpath>