2013-08-08 10:37:32 |
Ghislain Fourny |
description |
Because of snapshot semantics, in JSONiq it is perfectly fine to do things like:
variable $object := { "foo" : 1, "bar" : 2 };
(rename $object.foo as "bar", rename $object.bar as "foo");
However, Zorba does not support circular renames.
Even though updates are unordered, Zorba (like some other implementations) applies the update primitives in a special, precise order that guarantees that the result cannot be distinguished from the application of all updates at the same time against the same snapshot.
This works for most updates, but circular renames are an exception and need to be handled separately.
Possible strategy:
- Change the internal API of JSONObject::rename() to accept a vector of (old name, new name) pairs instead of just a single pair. This function then looks for the cycles in the vector and applies one rename cycle after the other, using, for each cycle, a temporary, unused name to roll-over. |
Because of snapshot semantics, in JSONiq it is perfectly fine to do things like:
variable $object := { "foo" : 1, "bar" : 2 };
(rename $object.foo as "bar", rename $object.bar as "foo");
However, Zorba does not support chained renames.
Even though updates are unordered, Zorba (like some other implementations) applies the update primitives in a special, precise order that guarantees that the result cannot be distinguished from the application of all updates at the same time against the same snapshot.
This works for most updates, but chained renames are an exception and need to be handled separately.
Possible strategy:
- Change the internal API of JSONObject::rename() to accept a vector of (old name, new name) pairs instead of just a single pair. This function then looks for the chains in the vector and applies one rename chain after the other, using, for each chain, a temporary, unused name to roll-over through the entire chain. |
|
2013-08-08 10:38:47 |
Ghislain Fourny |
description |
Because of snapshot semantics, in JSONiq it is perfectly fine to do things like:
variable $object := { "foo" : 1, "bar" : 2 };
(rename $object.foo as "bar", rename $object.bar as "foo");
However, Zorba does not support chained renames.
Even though updates are unordered, Zorba (like some other implementations) applies the update primitives in a special, precise order that guarantees that the result cannot be distinguished from the application of all updates at the same time against the same snapshot.
This works for most updates, but chained renames are an exception and need to be handled separately.
Possible strategy:
- Change the internal API of JSONObject::rename() to accept a vector of (old name, new name) pairs instead of just a single pair. This function then looks for the chains in the vector and applies one rename chain after the other, using, for each chain, a temporary, unused name to roll-over through the entire chain. |
Because of snapshot semantics, in JSONiq it is perfectly fine to do things like:
variable $object := { "foo" : 1, "bar" : 2 };
(rename $object.foo as "bar", rename $object.bar as "foo");
However, Zorba does not support chained renames.
Even though updates are unordered, Zorba (like some other implementations) applies the update primitives in a special, precise order that guarantees that the result cannot be distinguished from the application of all updates at the same time against the same snapshot.
This works for most updates, but chained renames are an exception and need to be handled separately.
Possible strategy:
- Change the internal API of JSONObject::rename() to accept a vector of (old name, new name) pairs instead of just a single pair. This function then looks for the chains in the vector and applies one rename chain after the other. A temporary, unused name might be needed to roll-over through the entire chain in case the chain is a cycle. |
|