Re: [netmod] 'predicate' production

Ladislav Lhotka <lhotka@nic.cz> Thu, 25 February 2016 15:34 UTC

Return-Path: <lhotka@nic.cz>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 05FFA1B2AD9 for <netmod@ietfa.amsl.com>; Thu, 25 Feb 2016 07:34:20 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -5.357
X-Spam-Level:
X-Spam-Status: No, score=-5.357 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HELO_EQ_CZ=0.445, HOST_EQ_CZ=0.904, MIME_8BIT_HEADER=0.3, RCVD_IN_DNSWL_HI=-5, RP_MATCHES_RCVD=-0.006] autolearn=ham
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 SVXSFlACP5tn for <netmod@ietfa.amsl.com>; Thu, 25 Feb 2016 07:34:18 -0800 (PST)
Received: from mail.nic.cz (mail.nic.cz [217.31.204.67]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id D33EE1B2ACD for <netmod@ietf.org>; Thu, 25 Feb 2016 07:34:17 -0800 (PST)
Received: from [IPv6:2001:718:1a02:1:e195:2630:b6d8:3b02] (unknown [IPv6:2001:718:1a02:1:e195:2630:b6d8:3b02]) by mail.nic.cz (Postfix) with ESMTPSA id 6E617181AC8; Thu, 25 Feb 2016 16:34:16 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1456414456; bh=8ox9h3ZEMABxNRPRJMZU6GKrHZHXgaf9usomB67c1XI=; h=From:Date:To; b=giD8BQQQLCxHiIfHaJCUSChyXis59Ykoc5nxXRq4aeBo2vzihyfejjbyY6jJlKp4b gczzyyljKgfU0TrR+OVoC2Ae2EqoSVUMwc+RLZ8AZtX3FcGB5kzHwc5ATuNVjkZoUv mOIVs6EVBGtHRzef9OK6yPmCBZr0Z1ZzIwICmcTE=
Content-Type: text/plain; charset="us-ascii"
Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\))
From: Ladislav Lhotka <lhotka@nic.cz>
In-Reply-To: <20160225.161002.1324090744270867912.mbj@tail-f.com>
Date: Thu, 25 Feb 2016 16:34:28 +0100
Content-Transfer-Encoding: quoted-printable
Message-Id: <AE48CA80-73FD-4578-828F-019BF9E66752@nic.cz>
References: <8DCD8E77-F906-49F6-A776-31FF2B623D8F@nic.cz> <20160225.145102.1511894162925887050.mbj@tail-f.com> <489B46F2-CF54-4696-A4C9-BDE7295569D6@nic.cz> <20160225.161002.1324090744270867912.mbj@tail-f.com>
To: Martin Björklund <mbj@tail-f.com>
X-Mailer: Apple Mail (2.3112)
X-Virus-Scanned: clamav-milter 0.98.7 at mail
X-Virus-Status: Clean
Archived-At: <http://mailarchive.ietf.org/arch/msg/netmod/Q5B-7wIMN-m76utO6HHGUffL9wI>
Cc: netmod@ietf.org
Subject: Re: [netmod] 'predicate' production
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Feb 2016 15:34:20 -0000

> On 25 Feb 2016, at 16:10, Martin Bjorklund <mbj@tail-f.com> wrote:
> 
> Hi,
> 
> Here's a summary of the changes:
> 
> OLD:
> 
>   instance-identifier = 1*("/" (node-identifier *predicate))
> 
>   predicate           = "[" *WSP (predicate-expr / pos) *WSP "]"
> 
>   predicate-expr      = (node-identifier / ".") *WSP "=" *WSP
>                         ((DQUOTE string DQUOTE) /
>                          (SQUOTE string SQUOTE))
> 
>   pos                 = non-negative-integer-value
> 
> NEW:
> 
>   instance-identifier = 1*("/" (node-identifier
>                                 [1*key-predicate /
>                                  leaf-list-predicate /
>                                  pos]))
> 
>   key-predicate       = "[" *WSP key-predicate-expr *WSP "]"
> 
>   key-predicate-expr  = node-identifier *WSP "=" *WSP quoted-string
> 
>   leaf-list-predicate = "[" *WSP leaf-list-predicate-expr *WSP "]"
> 
>   leaf-list-predicate-expr = "." *WSP "=" *WSP quoted-string
> 
>   pos                 = "[" *WSP positive-integer-value *WSP "]"
> 
>   quoted-string       = (DQUOTE string DQUOTE) / (SQUOTE string SQUOTE)

Looks great!

Thanks, Lada

> 
> 
> 
> /martin
> 
> 
> 
> Ladislav Lhotka <lhotka@nic.cz> wrote:
>> 
>>> On 25 Feb 2016, at 14:51, Martin Bjorklund <mbj@tail-f.com> wrote:
>>> 
>>> Ladislav Lhotka <lhotka@nic.cz> wrote:
>>>> 
>>>>> On 25 Feb 2016, at 14:16, Martin Bjorklund <mbj@tail-f.com> wrote:
>>>>> 
>>>>> Ladislav Lhotka <lhotka@nic.cz> wrote:
>>>>>> Martin Bjorklund <mbj@tail-f.com> writes:
>>>>>> 
>>>>>>> Ladislav Lhotka <lhotka@nic.cz> wrote:
>>>>>>>> Hi,
>>>>>>>> 
>>>>>>>> another ABNF issue:
>>>>>>>> 
>>>>>>>> predicate           = "[" *WSP (predicate-expr / pos) *WSP "]"
>>>>>>>> 
>>>>>>>> predicate-expr      = (node-identifier / ".") *WSP "=" *WSP
>>>>>>>>                       ((DQUOTE string DQUOTE) /
>>>>>>>>                        (SQUOTE string SQUOTE))
>>>>>>>> 
>>>>>>>> pos                 = non-negative-integer-value
>>>>>>>> 
>>>>>>>> non-negative-integer-value = "0" / positive-integer-value
>>>>>>>> 
>>>>>>>> The value of 0 shouldn't be allowed for 'pos' because context position
>>>>>>>> in XPath is always positive, i.e. the first list entry is selected
>>>>>>>> with "[1]".
>>>>>>> 
>>>>>>> You are right - I have changed this to:
>>>>>>> 
>>>>>>> pos = positive-integer-value
>>>>>> 
>>>>>> Actually, there is another problem: the ABNF allows, for example
>>>>>> 
>>>>>> /if:interfaces/if:interface[1][2]
>>>>>> 
>>>>>> which doesn't make sense.
>>>>> 
>>>>> Yes, you're right.
>>>>> 
>>>>>> So a correct version could be
>>>>>> 
>>>>>> instance-identifier = 1*("/" (node-identifier (*predicate / pos))
>>>>> 
>>>>> this would make pos mandatory after every node-identifier.  It should
>>>>> be: 
>>>>> 
>>>>> instance-identifier = 1*("/" (node-identifier (*predicate / *1pos)))
>>>>> 
>>>>> or, in order to match the style in the rest of the grammar:
>>>>> 
>>>>> instance-identifier = 1*("/" (node-identifier [1*predicate / pos]))
>>>> 
>>>> If we want to be really precise, then the predicate for a leaf-list [
>>>> . = 'foo'] can also appear no more than once.
>>> 
>>> Correct.  But we can only do so much in the grammar... For example, we
>>> cannot verify that the name and number of keys are correct.
>> 
>> Yes, but these are already semantic constraints. I think the new productions below are in fact easier to comprehend. Perhaps a production like
>> 
>> quoted-string = (DQUOTE string DQUOTE) / (SQUOTE string SQUOTE)
>> 
>> would also be an improvement.
>> 
>> Lada
>> 
>>> 
>>> It would be:
>>> 
>>> instance-identifier = 1*("/" (node-identifier [1*key-predicate /
>>>                                              leaf-list-predicate /
>>>                                              pos]))
>>> 
>>> key-predicate       = "[" *WSP key-predicate-expr *WSP "]"
>>> 
>>> key-predicate-expr  = node-identifier *WSP "=" *WSP
>>>                     ((DQUOTE string DQUOTE) /
>>>                      (SQUOTE string SQUOTE))
>>> 
>>> leaf-list-predicate = "[" *WSP leaf-list-predicate-expr *WSP "]"
>>> 
>>> leaf-list-predicate-expr = "." *WSP "=" *WSP
>>>                     ((DQUOTE string DQUOTE) /
>>>                      (SQUOTE string SQUOTE))
>>> 
>>> pos                 = "[" *WSP positive-integer-value *WSP "]"
>>> 
>>> 
>>> 
>>> /martin
>> 
>> --
>> Ladislav Lhotka, CZ.NIC Labs
>> PGP Key ID: E74E8C0C
>> 
>> 
>> 
>> 

--
Ladislav Lhotka, CZ.NIC Labs
PGP Key ID: E74E8C0C