Re: [core] Designs to resolve streaming issues in SenML
Michael Koster <michaeljohnkoster@gmail.com> Sat, 16 January 2016 18:33 UTC
Return-Path: <michaeljohnkoster@gmail.com>
X-Original-To: core@ietfa.amsl.com
Delivered-To: core@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 61D761A1EB7 for <core@ietfa.amsl.com>; Sat, 16 Jan 2016 10:33:06 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.099
X-Spam-Level:
X-Spam-Status: No, score=-1.099 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, J_CHICKENPOX_54=0.6, MIME_8BIT_HEADER=0.3, SPF_PASS=-0.001] autolearn=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 yhGVMhKdGAR0 for <core@ietfa.amsl.com>; Sat, 16 Jan 2016 10:33:03 -0800 (PST)
Received: from mail-pa0-x22e.google.com (mail-pa0-x22e.google.com [IPv6:2607:f8b0:400e:c03::22e]) (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 5B00E1A1B65 for <core@ietf.org>; Sat, 16 Jan 2016 10:33:03 -0800 (PST)
Received: by mail-pa0-x22e.google.com with SMTP id ho8so150563242pac.2 for <core@ietf.org>; Sat, 16 Jan 2016 10:33:03 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; bh=xEfsyaIANnehcUT6royZmK/CVd04Xg/k7qqZ5g2qF1o=; b=oB41sVbUM2CN1E4aoUWQFfajWAQPRURpIFqR2c/6gI6oRE9zyzeGPLS1y3JHeRk6Pw bgvu7uDYYyyPFgYH6Xc1sUJS7rSMGal6zdDf2y25seUYZwQpOy1AFe3NigFYxd8ppGOD 9dp7Pdi+Z/vZYrsXjJVNDMiXOygeakNQm6F7Fy/qmegfEwfs+74bYRiFPByf+UWPnDUg 6RX+J4mctEEmBsE4krP4tb5Bzgms6dzo2Lr5oVM4OA6D2DCzNPs1vK5bgnp4onus84Y3 kIPwcR0QTiAuu1SLcTailsu6t6w9NuZcVHoSthSrKstXooWeQt2lb6MtJRkc2HuSdxkI A0Dg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:content-type:mime-version:subject:from :in-reply-to:date:cc:message-id:references:to; bh=xEfsyaIANnehcUT6royZmK/CVd04Xg/k7qqZ5g2qF1o=; b=jUHHQxtrkVy9iPlTcTC4bVN2Wmx/VKFA0z2ucQVfQ+E9zILS1C01QvVzQVZ2+5BGER hBDY37cWK6h+MQOole1Ug+0o0UXzsf9nmpU4K839LcmNTb2C35BkwtsYLYKReBZwQLCS eflryWlMtJccc2fsag7ol1C+Rku8gjSUDwTPBcNVaE4Bo8VL5j21/VRf6adBIAHZioVv uq5FbbwOvyYrJ6Xs8z3r3xvhkZxKHHQWZVwTwJLdRsV/2eT2AwCL0Cgopw5Qn4HzqJGV aQjtmw0buDj3f3qSm+a/4powOePBA928gK26W0Do07V1GZLTr2mDLL4gLJxq7mEAGEpp 2ZWA==
X-Gm-Message-State: ALoCoQlss3PB1CtjwGwg8nII6UiM/uyEioZ70WaZ/N0VhsfLfDv1pG/k0OPAi1PqEcTc/jvjQ5EdiIfIx8QcEqmvPGUYleiLXQ==
X-Received: by 10.67.6.67 with SMTP id cs3mr24363928pad.143.1452969182909; Sat, 16 Jan 2016 10:33:02 -0800 (PST)
Received: from [10.0.0.21] (108-201-184-41.lightspeed.sntcca.sbcglobal.net. [108.201.184.41]) by smtp.gmail.com with ESMTPSA id m75sm23324553pfj.38.2016.01.16.10.33.01 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 16 Jan 2016 10:33:01 -0800 (PST)
Content-Type: multipart/alternative; boundary="Apple-Mail=_E013333B-066A-46A0-87FB-60EF6794F4D0"
Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\))
From: Michael Koster <michaeljohnkoster@gmail.com>
In-Reply-To: <0D5538ED-D126-4A1B-AFDD-D9D54580D48B@gmail.com>
Date: Sat, 16 Jan 2016 10:33:00 -0800
Message-Id: <DF100176-EEC4-4FCD-9475-4EC545AB98AC@gmail.com>
References: <175A1806-ACB0-4FC7-A318-2A58FF66CDD2@cisco.com> <20160116132751.GB18563@hephaistos.amsuess.com> <CC28D44A-DBC0-446D-90A8-3E329FC3F0AF@gmail.com> <0D5538ED-D126-4A1B-AFDD-D9D54580D48B@gmail.com>
To: Christian Amsüss <c.amsuess@energyharvesting.at>
X-Mailer: Apple Mail (2.2104)
Archived-At: <http://mailarchive.ietf.org/arch/msg/core/ZX2PXg31TbaH8NrpsqMtb8uPsaM>
Cc: "Cullen Jennings (fluffy)" <fluffy@cisco.com>, core <core@ietf.org>
Subject: Re: [core] Designs to resolve streaming issues in SenML
X-BeenThere: core@ietf.org
X-Mailman-Version: 2.1.15
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: Sat, 16 Jan 2016 18:33:06 -0000
A small correction. draft -02 and -04 have different top level structures. -02 is [ {b} [ {e} {e} ] ] and -04 is [ {b} {e} {e} ] Either one both will work for me, since the I will be able to extend the base item as needed. Michael PS for correctness my example should look more like this: [ { "bn": "/light/brightness", "l": [ { "href": "", "rel": ["self"], "rt": ["brightness", "action"] }, { "href": "change", "rel": ["form", "item"], "rt": ["change", "form"], "ct": "application/forms+senml+json" }, { "href": "tbr", "rel": ["item"], "rt": ["property", "param"], "ct": "application/senml+json" }, { "href": "tt", "rel": ["item"], "rt": ["property", "param"], "ct": "application/senml+json" }, { "href": "actuations", "rel": ["sub"], "rt": "actuation", "ct": "application/collection+senml+json" } ], "f": [ { "id": "change", “anchor": "../brightness" "rel": "change" "method": "post", "href": "actuations", "ct": "application/collection+json", "template": { "tbr": "$targetbrightness" "tt": "$transitiontime" } } ], "e": [ { "n": "tbr", "v": "44.3", }, { "n": "tt", "v": "1.0", } ] } ] > On Jan 16, 2016, at 9:53 AM, Michael Koster <michaeljohnkoster@gmail.com> wrote: > > Here is a concrete proposal. > > My goal with the collection+senml content format is to create a format for machine hypermedia representations that is roughly analogous to a HTML web page in the web of documents world. > > The idea was a compact representation that can represent machine hypermedia data, links, and forms and would leverage existing formats and processors; link-format, senml, json. > > When I started, it looked like SenML was a good base due to what appeared to be an extension mechanism: the element tag that was an artifact of the XML serialization. I didn’t expect it to be removed because I have XML/JSON tools that programmatically generate that style as a lossless XML-JSON transform. This is generally useful because EXI is still a very popular format and in many cases more compact than CBOR. > > If we can allow the base element to retain this functionality, and put the streaming support in the sequence of top level array elements, it seems like exactly what is needed. It retains backward compatibility with current senml implementations and allows some extensibility at both levels, while supporting sequential processing. > > I propose to restore the base senml functionality of draft -01 within the base element definition in the new draft, that is to allow measurement data within the base element using the “e” key. To facilitate sequential processing, a topmost structure of array will allow an arbitrary sequence of base element maps and data element arrays as defined in draft -04. > > Are there any issues with this construction? > > Best regards, > > Michael > > >> On Jan 16, 2016, at 7:24 AM, Michael Koster <michaeljohnkoster@gmail.com <mailto:michaeljohnkoster@gmail.com>> wrote: >> >> Hi Christian, >> >> 1. >> Thanks for the code example! It seems well optimized indeed. >> >> It also serves to highlight one of the points. >> >> It’s more than just a matter of me liking my own favorite language (actually library) internal representation of JSON. Most modern libraries produce dictionary and array representations for parsed JSON that work more or less the same way. >> >> The optimizations you recommend require a new string input parser, where I am using the JSON parser that comes with the library. My point was that I will need to either make my own string parser for SenML or make a re-parser with the state machine I described in order to use -02 + but there is another issue anyway: >> >> One of the big advantages of using JSON is connecting the embedded world to the web world. To do this in a low-friction way, it’s good to be able to use well known tools and patterns. Streaming JSON >> 2. >> Thanks also for looking into my code. I could easily use the -02 or -03 in the senml processing as you show. What is missing still from everything after -01 is the element tag that I am re-using to indicate links and forms in the document: >> >> { >> "bn":"/3300/1/", >> "e":[ >> {"n":"5700","v":"31.3"}, >> {"n":"5602","v":"37.1"}, >> {"n":"5601","v":"18.3"}, >> {"n":"5605"}, >> {"n":"5603","v":"0"}, >> {"n":"5604","v":"100"}, >> {"n":"5750","sv":"Inboard Bearing"} >> ], >> "l":[ >> {"href":"","rel":"self","rt":"temperature","u":"C"}, >> {"href":"5700","rt":"currentValue","u":"C"}, >> {"href":"5602","rt":"maxValue","u":"C"}, >> {"href":"5601","rt":"minValue","u":"C"}, >> {"href":"5605","rt":"resetMaxMin"}, >> {"href":"5603","rt":"minScale","u":"C"}, >> {"href":"5604","rt":"maxScale","u":"C"}, >> {"href":"5750","rt":"appType"} >> ] >> } >> >> I will think about other designs that do not depend on entity tags in the representation; maybe there is a better design for the content format in general. But I would still like to use SenML. Maybe not extend it but embed it in another new format… >> >> In the meantime, I don’t have a good alternative yet. >> >> Best regards, >> >> Michael >> >> PS Can we succinctly describe the use case for ordered serial processing of senml+json elements being important? From reading the draft, it seems like the important bit is saving the buffer memory for large responses. Is it a bigger deal with CBOR encoding or less important. >> >> Is the most important consideration being able to know the base values ahead of the data? >> >> Also, where is -03? there doesn’t seem to be a version -03 that you all are talking about on the IETF website: >> https://tools.ietf.org/html/draft-jennings-core-senml-04 <https://tools.ietf.org/html/draft-jennings-core-senml-04> >> >> >>> On Jan 16, 2016, at 5:27 AM, Christian Amsüss <c.amsuess@energyharvesting.at <mailto:c.amsuess@energyharvesting.at>> wrote: >>> >>> Hello Cullen, >>> >>> On Wed, Jan 13, 2016 at 01:57:02PM +0000, Cullen Jennings (fluffy) wrote: >>>> The objects can also have the base values right in the object and the >>>> base values apply to all the things in the object and any future >>>> objects in the array. >>>> >>>> Appreciate any thoughts people have on pro / cons of the -03 design vs -04 design. >>> >>> The -03 draft is parsable with minimum RAM: I've assembled a crude >>> demo[1] that shows that given a list of known integer-valued resources >>> on a device, it is possible to parse incoming SenML-03 with less than 30 >>> bytes of state, with support for arbitrary SenML extensions, all legal >>> JSON number representations and full URL concatenation semantics. >>> >>> With the -04 draft, one would have to allocate a buffer for the "n" >>> value, because before the object finishes, the "bn" might change later >>> in the same object, and change the context in which it needs to be >>> interpreted. This could be remedied by making base and entry updates >>> mutually exclusive (arguably a less straight-forward design), but as >>> things are, I'd prefer -03. >>> >>> Best regards >>> Christian >>> >>> [1] https://gitlab.com/c.amsuess-energyharvesting/senml-03-streaming-parser-demo/tree/master <https://gitlab.com/c.amsuess-energyharvesting/senml-03-streaming-parser-demo/tree/master> >>> >>> -- >>> Christian Amsüss | Energy Harvesting Solutions GmbH >>> founder, system architect | headquarter: >>> mailto:c.amsuess@energyharvesting.at <mailto:c.amsuess@energyharvesting.at> | Arbeitergasse 15, A-4400 Steyr >>> tel:+43-664-97-90-6-39 | http://www.energyharvesting.at/ <http://www.energyharvesting.at/> >>> | ATU68476614 >>> _______________________________________________ >>> core mailing list >>> core@ietf.org <mailto:core@ietf.org> >>> https://www.ietf.org/mailman/listinfo/core <https://www.ietf.org/mailman/listinfo/core> >> >
- Re: [core] Designs to resolve streaming issues in… Carsten Bormann
- [core] Designs to resolve streaming issues in Sen… Cullen Jennings (fluffy)
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- Re: [core] Designs to resolve streaming issues in… Christian Amsüss
- Re: [core] Designs to resolve streaming issues in… Carsten Bormann
- Re: [core] Designs to resolve streaming issues in… Christian Amsüss
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- Re: [core] Designs to resolve streaming issues in… Carsten Bormann
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- Re: [core] Designs to resolve streaming issues in… Carsten Bormann
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- Re: [core] Designs to resolve streaming issues in… Christian Amsüss
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- Re: [core] Designs to resolve streaming issues in… Christian Amsüss
- Re: [core] Designs to resolve streaming issues in… Christian Amsüss
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- Re: [core] Designs to resolve streaming issues in… Cullen Jennings (fluffy)
- Re: [core] Designs to resolve streaming issues in… Cullen Jennings (fluffy)
- [core] privacy issues (was: Re: Designs to resolv… Stephen Farrell
- Re: [core] Designs to resolve streaming issues in… Christian Amsüss
- Re: [core] Designs to resolve streaming issues in… Carsten Bormann
- Re: [core] Designs to resolve streaming issues in… Christian Amsüss
- Re: [core] Designs to resolve streaming issues in… Michael Koster
- [core] SenML and link-format in RDF (was: Re: Des… Christian Amsüss
- Re: [core] SenML and link-format in RDF (was: Re:… Michael Koster
- Re: [core] SenML and link-format in RDF (was: Re:… Christian Amsüss
- Re: [core] SenML and link-format in RDF (was: Re:… Michael Koster
- Re: [core] SenML and link-format in RDF (was: Re:… Christian Amsüss
- Re: [core] SenML and link-format in RDF (was: Re:… Michael Koster
- Re: [core] SenML and link-format in RDF (was: Re:… Michael Koster
- Re: [core] SenML and link-format in RDF Carsten Bormann
- Re: [core] SenML and link-format in RDF (was: Re:… Michael Koster