Re: [core] Designs to resolve streaming issues in SenML
Michael Koster <michaeljohnkoster@gmail.com> Fri, 15 January 2016 03:04 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 8E0BF1A888A for <core@ietfa.amsl.com>; Thu, 14 Jan 2016 19:04:22 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.998
X-Spam-Level:
X-Spam-Status: No, score=-1.998 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, SPF_PASS=-0.001, WEIRD_PORT=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 20Eu5XIc6akd for <core@ietfa.amsl.com>; Thu, 14 Jan 2016 19:04:18 -0800 (PST)
Received: from mail-pf0-x229.google.com (mail-pf0-x229.google.com [IPv6:2607:f8b0:400e:c00::229]) (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 CC0AA1A8886 for <core@ietf.org>; Thu, 14 Jan 2016 19:04:18 -0800 (PST)
Received: by mail-pf0-x229.google.com with SMTP id q63so113371250pfb.1 for <core@ietf.org>; Thu, 14 Jan 2016 19:04:18 -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=/2+QBejbWjRl9Ub247BkD6THBdD1xNQAZbXaS4nc2p4=; b=ZXiTBObolEhDbCBN21ktVh02rb/mHZifeoOK7OwZzStMasmo4dRnHTscmudbNQbknq KkTWmEYHeF79ViWyoWQvkVpMUyty7rCRnGFFPpel0DN78o9q57iCJc0yZgZMzngO0kCw B2J8ytFoQTlXKSnnz1OB6Wh3qWw+ePcy0Tv70Zc4aWnf2pFb77eXCEYdRAlyfEd6TSlA 8z0/1HoEC9ShP4wZ85exKuPK9m8/V2rBbqdWK6Ee6ZfZClEXYqoyzXkMChuDPAH2GWa5 2pZJsPlaZc3nZe5n3QI7+Rh25xPjHkK8A/Nm9BTUnFZyDYp5/SzjC2Y5rtXbWFg/ZzCh HoDw==
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=/2+QBejbWjRl9Ub247BkD6THBdD1xNQAZbXaS4nc2p4=; b=DlABARW302lLrw18XzixYseJTes98sBg5Z/kqcun7Qkpkah4u7yfyBzrtZWt3g00ep 9Gp8Nchdw5Ys92EK5Xqr7dq84/pid+uCqhQwenTQoCH0ZSgQkU5C3l5yJ0s3ZmG8c1m8 +M/26HejGaV6Muw+cUoMMgpMKl1zrT45M2hQtb3v5kuMsVINa9vYPNJovreuLgjhnkHn syqRMuxCQkwjhVZulY5kMX+VivmiHzD8uG18MUrnwH3HRGDHTAWOB2tFncB5EGPMa4yZ kEzea+9lulWr7S4B6G5YDcWBtLFwtJZa2QB2rI6nIWZ3awqM1hc6Zg9CQX0t1+g0YdH7 6R/g==
X-Gm-Message-State: AG10YOR8HBWaLrRmZ25QHiI3hqiZ/sr/UDHKHK9tAzQ6WjG1RLTbz2wOc+OUtMInCSA6UA==
X-Received: by 10.98.0.66 with SMTP id 63mr5813131pfa.61.1452827058451; Thu, 14 Jan 2016 19:04:18 -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 sm8sm12105191pac.43.2016.01.14.19.04.17 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 14 Jan 2016 19:04:17 -0800 (PST)
Content-Type: multipart/alternative; boundary="Apple-Mail=_18A2B176-3F4E-4EFB-AB9B-49F1A1F53333"
Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\))
From: Michael Koster <michaeljohnkoster@gmail.com>
In-Reply-To: <85DB69FC-A20E-4314-AAB0-5E8AA8B5E5E6@gmail.com>
Date: Thu, 14 Jan 2016 19:04:15 -0800
Message-Id: <7ABA380B-AEA8-4025-B582-2C168CAEE6D3@gmail.com>
References: <175A1806-ACB0-4FC7-A318-2A58FF66CDD2@cisco.com> <85DB69FC-A20E-4314-AAB0-5E8AA8B5E5E6@gmail.com>
To: "Cullen Jennings (fluffy)" <fluffy@cisco.com>
X-Mailer: Apple Mail (2.2104)
Archived-At: <http://mailarchive.ietf.org/arch/msg/core/bARY5n0Bo6Ag_mV84QcUrh35Krw>
Cc: 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: Fri, 15 Jan 2016 03:04:22 -0000
Note: A reference implementation (in progress) of the Hypermedia Collection described in https://datatracker.ietf.org/doc/draft-ietf-core-interfaces/ <https://datatracker.ietf.org/doc/draft-ietf-core-interfaces/> uses the collection+senml content type mentioned below and is available at https://github.com/mjkoster/MachineHypermediaToolkit <https://github.com/mjkoster/MachineHypermediaToolkit> for an example of the use case. > On Jan 14, 2016, at 6:43 PM, Michael Koster <michaeljohnkoster@gmail.com> wrote: > > Hi, > > I have been working with JSON serializations of senml and link data lately and I have some comments on the new SenML draft. I haven’t kept up with the format changes because I have something already working that I like that is based on the senml core wg draft-01. > > There are two problems with the new formats (-02 and -04) for my use case. The first is that I have added more element types to extend senml to represent collections that may have links, forms, and data items. The second is the issue of mapping vs. streaming as discussed previously. First, I’ll try to explain the issue as I see it with mapping vs. streaming. > > This is how the “collection” example appears in section 6.1.4 of draft-04: > > [{"bn": "http://[2001:db8::2]/ <http://[2001:db8::2]/>", > "bt": 1320078429, > "ver": 3}, > { "n": "temperature", "v": 27.2, "u": "Cel" }, > { "n": "humidity", "v": 80, "u": "%RH" } > ] > > The block formatting of the first map and addition of whitespace to the second 2 maps gives the visual impression that there is some hierarchy. The reformatted example below using standard json pretty print makes it easier to see how this parses into a data structure using standard json tools. I’d recommend following this format to make the examples consistent and easy to read. I will do the same in my drafts. > > [ > { > "bn": "http://[2001:db8::2]/ <http://[2001:db8::2]/>", > "bt": 1320078429, > "ver": 3 > }, > { > "n": "temperature", > "u": "Cel", > "v": 27.2 > }, > { > "n": "humidity", > "u": "%RH", > "v": 80 > } > ] > As pointed out, the streaming format can only be processed in streaming form. Storing this in memory using a JSON parser does not result in a structure that can be easily sorted or indexed by base element. If I were to design a parser for this, it would have a state machine that would consume the top level array elements in sequence and create an in-memory structure that looks like the structures described in draft-02: > > [ > { > "bn": "http://[2001:db8::2]/ <http://[2001:db8::2]/>", > "bt": 1320078429, > "ver": 1 > }, > [ > { > "n": "temperature", > "u": "Cel", > "v": 27.2 > }, > { > "n": "humidity", > "u": "%RH", > "v": 80 > } > ] > ] > Or draft-01: > > { > "bn": "http://[2001:db8::2]/ <http://[2001:db8::2]/>", > "bt": 1320078429, > "ver": 1 > "e": [ > { > "n": "temperature", > "u": "Cel", > "v": 27.2 > }, > { > "n": "humidity", > "u": "%RH", > "v": 80 > } > ], > } > With these earlier structures I could use standard JSON parse tools and then selection algorithms that match the “bn” value and select the contents within that item’s scope (for patching, etc.). With the streaming formats I need to add another level of serialize/deserialize between the content format and the actual program data model and process elements in order. > > IOW, I already have a JSON parser and a JSON data structure filter that work together. Now with this format change, I need to add another layer of deserializing to create an index or remap the base elements. > > The other issue is that in draft-01 the element tag “e” maps to the XML serialization <e/> tags nicely. I have tools that process both XML and JSON that understand this. Also, this is easily extensible to add more element classes to the senml data model, which I have done of links and forms. > > { > "bn": "/", > "e": [ > { > "n": "test", > "sv": "testValue" > } > ], > "l": [ > { > "href": "", > "rel": [ > "self" > ] > }, > { > "href": "test", > "rel": "sub" > } > ] > } > > I have indicated this with a content format “collection+senml+json”, to indicate the senml data model with a collection extension or subtype. > > Since the recent changes in senml, I have considered forking -01 and creating a new set of media types called hyper-senml, or “hsml”, so “application/hsml+json”, “application/hsml+xml”, “application/collection+hsml+json”, etc. > > I guess my preferred outcome would be a senml optimized for mapping that looks like -01 and can be extended to add element classes, and a separate, streaming optimized format. > > Best regards, > > Michael > > >> On Jan 13, 2016, at 5:57 AM, Cullen Jennings (fluffy) <fluffy@cisco.com <mailto:fluffy@cisco.com>> wrote: >> >> The changes we made to SenML to support streaming in the -02 version raised many issues for lots of people. In the end, one of the biggest problems is it forces all things receiving SenML to support streaming. >> >> I have an alternative design for streaming that I think addresses the issues raised and I would like the WG to think about two alternative designs for SenML and give me some direction on which one to use. >> >> The first design is the current -02 design with simple fixes and is in draft draft-jennings-core-senml-03 >> >> The second design is the new design I am proposing and is in draft-jennings-core-senml-04. It many way it moves back to be much closer to what was in -01 than what is in -02. >> >> The drafts can be found at >> >> https://datatracker.ietf.org/doc/draft-jennings-core-senml/03/ <https://datatracker.ietf.org/doc/draft-jennings-core-senml/03/> >> >> and >> >> https://datatracker.ietf.org/doc/draft-jennings-core-senml/04/ >> >> >> Practically speaking the differences are not that much between the two but they do resolve a bunch of the issue. Let me discuss this in terms of the JSON representation and the rest of the representations mirror that. In the new design measurements are put in JSON object as always. The object are put in array to represent a series of measurements. 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. >> >> Here is an example of something that is not a stream in both old and new design. >> >> OLD >> >> [{"bn": "urn:dev:mac:0024befffe804ff1/"}, >> [ { "n": "voltage", "t": 0, "u": "V", "v": 120.1 }, >> { "n": "current", "t": 0, "u": "A", "v": 1.2 } ] >> ] >> >> NEW >> >> [{"bn": "urn:dev:mac:0024befffe804ff1/"}, >> { "n": "voltage", "t": 0, "u": "V", "v": 120.1 }, >> { "n": "current", "t": 0, "u": "A", "v": 1.2 } >> ] >> >> Note the old design has an array with a base object, followed by a second array of measurements. The new design just has an single array and the first object happens to only have base values that apply to future object in the array. >> >> This could also be sent as >> >> [ >> { >> "t": 0, >> "n": "voltage", >> "u": "V", >> "bn": "urn:dev:mac:0024befffe804ff1/", >> "v": 120.1 >> }, >> { >> "n": "current", >> "t": 0, >> "u": "A", >> "v": 1.2 >> } >> ] >> >> Here is an example of streaming with old and new design >> >> OLD >> >> [{"bn": "http://[2001:db8::1]", >> "bt": 1320067464, >> "bu": "%RH"}, >> [ { "v": 21.2, "t": 0 }, >> { "v": 21.3, "t": 10 }, >> { "v": 21.4, "t": 20 }, >> { "v": 21.4, "t": 30 }, >> { "v": 21.5, "t": 40 }, >> { "v": 21.5, "t": 50 }, >> { "v": 21.5, "t": 60 }, >> { "v": 21.6, "t": 70 }, >> { "v": 21.7, "t": 80 }, >> { "v": 21.5, "t": 90 }, >> ... >> >> NEW >> >> [ {"bn": "http://[2001:db8::1]", >> "bt": 1320067464, >> "bu": "%RH"}, >> { "v": 21.2, "t": 0 }, >> { "v": 21.3, "t": 10 }, >> { "v": 21.4, "t": 20 }, >> { "v": 21.4, "t": 30 }, >> { "v": 21.5, "t": 40 }, >> { "v": 21.5, "t": 50 }, >> { "v": 21.5, "t": 60 }, >> { "v": 21.6, "t": 70 }, >> { "v": 21.7, "t": 80 }, >> { "v": 21.5, "t": 90 }, >> ... >> >> >> The draft does not have it yet but an applications that supports receiving streaming is written is a substantially different way that one that does not. I think the best way to deal with this is simply use a different mine type for streaming ( calls it senml_stream for now but send me suggestions on name for it). That way it can be clearly indicated and negotiated in existing transport protocols. >> >> Appreciate any thoughts people have on pro / cons of the -03 design vs -04 design. >> >> >> >> >> _______________________________________________ >> core mailing list >> core@ietf.org >> 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