Re: [netmod] tree diagrams - flags

worley@ariadne.com (Dale R. Worley) Fri, 24 March 2017 01:04 UTC

Return-Path: <worley@alum.mit.edu>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 4D3B4129A7F for <netmod@ietfa.amsl.com>; Thu, 23 Mar 2017 18:04:39 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.934
X-Spam-Level:
X-Spam-Status: No, score=-1.934 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_SOFTFAIL=0.665] autolearn=no autolearn_force=no
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 jxsbWkJPYImB for <netmod@ietfa.amsl.com>; Thu, 23 Mar 2017 18:04:38 -0700 (PDT)
Received: from resqmta-ch2-10v.sys.comcast.net (resqmta-ch2-10v.sys.comcast.net [IPv6:2001:558:fe21:29:69:252:207:42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id E326C1294A8 for <netmod@ietf.org>; Thu, 23 Mar 2017 18:04:37 -0700 (PDT)
Received: from resomta-ch2-06v.sys.comcast.net ([69.252.207.102]) by resqmta-ch2-10v.sys.comcast.net with SMTP id rDdkcEwlH61D9rDefcey3v; Fri, 24 Mar 2017 01:04:37 +0000
Received: from hobgoblin.ariadne.com ([24.60.114.4]) by resomta-ch2-06v.sys.comcast.net with SMTP id rDedcMfP3eyvGrDeecwZEX; Fri, 24 Mar 2017 01:04:36 +0000
Received: from hobgoblin.ariadne.com (hobgoblin.ariadne.com [127.0.0.1]) by hobgoblin.ariadne.com (8.14.7/8.14.7) with ESMTP id v2O14Zlr004782; Thu, 23 Mar 2017 21:04:35 -0400
Received: (from worley@localhost) by hobgoblin.ariadne.com (8.14.7/8.14.7/Submit) id v2O14ZvU004779; Thu, 23 Mar 2017 21:04:35 -0400
X-Authentication-Warning: hobgoblin.ariadne.com: worley set sender to worley@alum.mit.edu using -f
From: worley@ariadne.com
To: Martin Bjorklund <mbj@tail-f.com>
Cc: lhotka@nic.cz, netmod@ietf.org
In-Reply-To: <20170321.212254.1381357367952499259.mbj@tail-f.com>
Sender: worley@ariadne.com
Date: Thu, 23 Mar 2017 21:04:35 -0400
Message-ID: <87vaqzpjrw.fsf@hobgoblin.ariadne.com>
X-CMAE-Envelope: MS4wfFN9DgtnqWgP3AgnjsOdd+qop2Q+je8mSVkY8k9SXTkQ9mMzFArT+4FD+MDklJb64Vjw6XK38xiqhovybqDD1SbYA05TQz4XTf/IVVRq1sZt577RQVpq sXG2BoRQniDAhcbHbpAbNrlmxzUG32T8N14f67YeXdn0NFPd26Pyg6xyeAEcwV5uxyvClozwIqVlMhxsmavNKwx/lKeho9wC/mQ=
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/v7sgjiDMLrgZLYHWzHQrpemMRck>
Subject: Re: [netmod] tree diagrams - flags
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.22
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: Fri, 24 Mar 2017 01:04:39 -0000

Martin Bjorklund <mbj@tail-f.com> writes:
> Aha, ok.  This description is not a correct description of the YANG
> data tree (in which XPath expressions etc are evaluated).  There is
> not a single "list node" called "interfaces".  Look at an example of
                                  ^ I'm pretty sure you mean "interface" here.
> an XML instance document:
>
>   <interfaces>
>     <interface>
>       <name>eth0</name>
>       ...
>     </interface>
>     <interface>
>       <name>eth1</name>
>       ...
>     </interface>
>   </interfaces>
>
> This also reflects the data tree.

OK, yes, I'm recalling that now.  I run into mental interference because
there are at least three ways of looking at it:

- The Yang statement is named "list" -- a singular noun -- and not
something like "repeated" or "repeated container".  And compared to
ordinary programming languages, the semantics is "array-of-structures".
(The fact that Yang doesn't orthogonalize the array and the structure is
why Yang must also have a leaf-list statement.)  So the "obvious"
semantics of the name is that it's "the name" of "the list".

- The XML version doesn't have an overt representation of the array, but
does have an overt representation of each structure and uses the list
name as the label of each structure.  The XPath expressions are
evaluated within this version, so the absence of an explicit array node
is important.

- The JSON representation overtly represents both the array ([...]) and
the structures ({...}), and applies the name to the array, not the
structures.  (Which means that you can't evaluate XPath expressions
directly against the JSON representation.)

Thus you get the contrasting representations:

   list bar {
     key foo;
     leaf foo {
       type uint8;
     }
     leaf baz {
       type string;
     }
   }

   <bar>
     <foo>123</foo>
     <baz>zig</baz>
   </bar>
   <bar>
     <baz>zag</baz>
     <foo>o</foo>
   </bar>

   "bar": [
     {
       "foo": 123,
       "baz": "zig"
     },
     {
       "baz": "zag",
       "foo": 0
     }
   ]

each of which invites one to speak of the schema in somewhat different
ways.

The way you'd describe a tree diagram differs depending on which way
you're looking at the schema.

Dale