[Home] [By Thread] [By Date] [Recent Entries]

  • From: "Ghislain Fourny" <gfourny@i...>
  • To: Michael Kay <mike@s...>
  • Date: Mon, 14 Aug 2017 08:53:16 +0000

Hi Mike,

> Once you have this basic support at the data structure level, you probably need to introduce operations that take advantage of it: rather like map:put which creates a new map as a modified copy of an existing map, with a delta implementation underneath, you need operations that create a new tree which is a delta copy of an existing tree differing only in small details, e.g. a change in the value of a single attribute.

Syntactically, this would be very similar to a copy-modify-return with an update expression. This functionality is actually supported by JSONiq with a syntax similar to the Update Facility -- but on JSON trees (where there are no parent pointers in the JDM design).

With Zorba 3.0:
__
jsoniq version "1.0";

let $a := {
  "foo" : 1,
  "bar" : [
    { "foobar" : 2 },
    { "foobar" : 5 }
  ]
}
return
 copy $b := $a
 modify replace value of json $b.bar[[1]].foobar with 3
 return $b
__

Kind regards,
Ghislain



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member