Re: [netmod] 'predicate' production

Martin Bjorklund <mbj@tail-f.com> Thu, 25 February 2016 15:10 UTC

Return-Path: <mbj@tail-f.com>
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 BFFC01B2A0B for <netmod@ietfa.amsl.com>; Thu, 25 Feb 2016 07:10:01 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.907
X-Spam-Level:
X-Spam-Status: No, score=-1.907 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RP_MATCHES_RCVD=-0.006, SPF_PASS=-0.001] 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 wbBj1evL1rT5 for <netmod@ietfa.amsl.com>; Thu, 25 Feb 2016 07:10:00 -0800 (PST)
Received: from mail.tail-f.com (mail.tail-f.com [46.21.102.45]) by ietfa.amsl.com (Postfix) with ESMTP id 14F1B1B2A07 for <netmod@ietf.org>; Thu, 25 Feb 2016 07:10:00 -0800 (PST)
Received: from localhost (unknown [173.38.220.38]) by mail.tail-f.com (Postfix) with ESMTPSA id 67D8D1AE0335; Thu, 25 Feb 2016 16:09:58 +0100 (CET)
Date: Thu, 25 Feb 2016 16:10:02 +0100
Message-Id: <20160225.161002.1324090744270867912.mbj@tail-f.com>
To: lhotka@nic.cz
From: Martin Bjorklund <mbj@tail-f.com>
In-Reply-To: <489B46F2-CF54-4696-A4C9-BDE7295569D6@nic.cz>
References: <8DCD8E77-F906-49F6-A776-31FF2B623D8F@nic.cz> <20160225.145102.1511894162925887050.mbj@tail-f.com> <489B46F2-CF54-4696-A4C9-BDE7295569D6@nic.cz>
X-Mailer: Mew version 6.5 on Emacs 24.3 / Mule 6.0 (HANACHIRUSATO)
Mime-Version: 1.0
Content-Type: Text/Plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Archived-At: <http://mailarchive.ietf.org/arch/msg/netmod/g2vmc7YOrvIMMLwJfF5enXgDWJo>
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:10:01 -0000

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)



/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
> 
> 
> 
>