[core] SenML and its use in core-interfaces (follow-up on bn/n URI clarification)

Christian Amsüss <c.amsuess@energyharvesting.at> Fri, 24 March 2017 11:31 UTC

Return-Path: <c.amsuess@energyharvesting.at>
X-Original-To: core@ietfa.amsl.com
Delivered-To: core@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 2D8691296A6; Fri, 24 Mar 2017 04:31:58 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] autolearn=ham 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 p2QcL5u0Nii2; Fri, 24 Mar 2017 04:31:55 -0700 (PDT)
Received: from prometheus.amsuess.com (prometheus.amsuess.com [5.9.147.112]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 80F4212969C; Fri, 24 Mar 2017 04:31:54 -0700 (PDT)
Received: from poseidon-mailhub.amsuess.com (unknown [IPv6:2a02:b18:c13b:8001:a800:ff:fede:b1bd]) by prometheus.amsuess.com (Postfix) with ESMTPS id DA166469D8; Fri, 24 Mar 2017 12:31:52 +0100 (CET)
Received: from poseidon-mailbox.amsuess.com (poseidon-mailbox.amsuess.com [10.13.13.231]) by poseidon-mailhub.amsuess.com (Postfix) with ESMTP id B381A11B; Fri, 24 Mar 2017 12:31:51 +0100 (CET)
Received: from hephaistos.amsuess.com (hermes.amsuess.com [10.13.13.254]) by poseidon-mailbox.amsuess.com (Postfix) with ESMTPSA id 84E7E10D; Fri, 24 Mar 2017 12:31:51 +0100 (CET)
Received: (nullmailer pid 317 invoked by uid 1000); Fri, 24 Mar 2017 11:31:50 -0000
Date: Fri, 24 Mar 2017 12:31:50 +0100
From: Christian Amsüss <c.amsuess@energyharvesting.at>
To: draft-ietf-core-senml@ietf.org, core@ietf.org, draft-ietf-core-interfaces@ietf.org
Message-ID: <20170324113150.hrxznr44n5zdivud@hephaistos.amsuess.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="hy7rwhszyv65flhg"
Content-Disposition: inline
User-Agent: NeoMutt/20170113 (1.7.2)
Archived-At: <https://mailarchive.ietf.org/arch/msg/core/c4Z5h5JK6ROoX5Kgum4bCT534hE>
Subject: [core] SenML and its use in core-interfaces (follow-up on bn/n URI clarification)
X-BeenThere: core@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: "Constrained RESTful Environments \(CoRE\) Working Group list" <core.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/core>, <mailto:core-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/core/>
List-Post: <mailto:core@ietf.org>
List-Help: <mailto:core-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/core>, <mailto:core-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 24 Mar 2017 11:31:58 -0000

Hello SenML authors, and hello CoRE Interfaces authors,

I'd like to follow up on the IETF96 (Berlin) discussion on using URIs
with SenML after reviewing the mails on the topic and the discussion
footage. The point of the URI concatenation discussion back then was to
allow CoRE Interfaces to do what they are currently doing, being

GET /l/
[{"n": "/s/light", "v": 123, "u": "lx"},
 {"n:" "/s/temp", "v": 27.2, "u": "degC"}]

which is supposed to mean the /s/light and /s/temp resources on the
origin server, and not /l//s/light etc. as it will by the SenML spec.


In the Berlin discussion, there was a rough agreement on taking a route
where URI users could use a different attribute to denote their
anchor/href; this would avoid the pitfalls of doing URI concatenation
wrong for people who don't use URIs there anyway.

This has not been fleshed out or at least explored since then AFAICT,
and I'd like to at least see that there is a route of extensions CoRE
interfaces can use if we publish SenML as it is now.

Two questions need answering IMO:

* Do we want to be able to share documents between "URI users" and
  "non-URI users"? In many cases this will be possible; for example,
  batches (as opposed to linked batches as above) would just work with
  the current name building, and thus be usable by non-URI-aware clients
  as well.

* If we want to keep them apart, how would we deal with the requirement
  of having mandatory uniquely identifying names? A linked batch would
  certainly not want to repeat names once in "n" and once in "h"
  notation.


For a strawman proposal, I'd assume the answers are "we want to allow
mixed usership", and "the unique name requirement stays". Then we could
construct an extension like this:

Resolved records have, in addition to their name, a URI name ("href"),
which is optional to use but can be mandated to use in certain
applications (eg. CoRE interfaces). The URI name is formed by doing
RFC3986 relative URI resolution of the "h" property relative to the "bh"
base attribute relative to the requested URI. If the "h" property is
absent on a record, its "n" property provides a default value. If the
"bh" property is absent on the first record, the "bn" property provides
a default value.

This scheme has the properties that

+ Batches (or generally, collections that worked so far) work equally
  well for non-URI and URI users.
+ Representations stay as compact as they are.
+ The CoRE interfaces can refer to the records' URI names and thus be
  sure that users must take the necessary steps to resolve relativities
  correctly, while simpler SenML users arrive at resolved names by
  concatenating.
~ Evaluating the name of, say, linked batch resources still gives a
  unique name. It might or might not be a valid URI, and might or might
  not be dereferncable, but since it's agreed on that a name is not
  necessarily a URI, that's OK. For example, the linked batch of the
  first example would give resolved "n":"coap://host/l//s/light" (or
  even, for other examples, "n":"coap://host/l/http://remote/resource"),
  but that would still be a unique name.
- It doesn't survive representation as Resolved Records. (But are they
  intended to be serialized again at all? How do other extensions cope
  with Resolved Records?)
- It defines properties that would, in actual use, barely (if at all)
  show up. In particular, the CoRE Interfaces examples could stay as
  they are and never use "h"/"bh". If we just dropped the arguments and
  only defined a URI property, we're even worse again in the next point:
- This has a smell of applications defining how to interpret the name,
  which is what Cullen has already argued against in the July thread.

If we can live with the above downsides or those of another form of URI
extension (which might have fewer or others), then I think we can
procede with SenML as it is, otherwise we should either come up with a
better URI story, or need SenML to accomodate such uses.

What do you think?

Best regards
Christian

-- 
Christian Amsüss                      | Energy Harvesting Solutions GmbH
founder, system architect             | headquarter:
mailto:c.amsuess@energyharvesting.at  | Arbeitergasse 15, A-4400 Steyr
tel:+43-664-97-90-6-39                | http://www.energyharvesting.at/
                                      | ATU68476614