Append a temporal instant or a temporal sequence
appendInstant({tpose,tposechain},{tposeInst,tposechainInst}) → {tpose,tposechain}
appendSequence({tpose,tposechain},{tposeSeq,tposechainSeq}) → {tpose,tposechain}
SELECT asText(appendInstant(tpose 'Pose(Point(1 1), 0.5)@2001-01-01',
'Pose(Point(2 2), 1)@2001-01-02'));
-- [Pose(POINT(1 1),0.5)@2001-01-01, Pose(POINT(2 2),1)@2001-01-02]
SELECT asText(appendSequence(tpose '[Pose(Point(1 1), 0.5)@2001-01-01]',
'[Pose(Point(2 2), 1)@2001-01-02]'));
-- {[Pose(POINT(1 1),0.5)@2001-01-01], [Pose(POINT(2 2),1)@2001-01-02]}
Merge the temporal poses
merge({tpose,tposechain},{tpose,tposechain}) → {tpose,tposechain}
merge({tpose,tposechain}[]) → {tpose,tposechain}
mergeAgg({tpose,tposechain}) → {tpose,tposechain}
The aggregate form of the function is mergeAgg.
SELECT asText(merge(tpose '[Pose(Point(1 1 1),1,0,0,0)@2001-01-01,
Pose(Point(2 2 2),0,1,0,0)@2001-01-02]',
'[Pose(Point(2 2 2),0,1,0,0)@2001-01-02, Pose(Point(3 3 3),0,0,0,1)@2001-01-03]'));
/* [Pose(POINT Z (1 1 1),1,0,0,0)@2001-01-01, Pose(POINT Z (2 2 2),0,1,0,0)@2001-01-02,
Pose(POINT Z (3 3 3),0,0,0,1)@2001-01-03] */
SELECT asText(merge(ARRAY[tpose '{[Pose(Point(1 1),0.1)@2001-01-01,
Pose(Point(2 2),0.2)@2001-01-02],
[Pose(Point(3 3),0.3)@2001-01-03, Pose(Point(4 4),0.4)@2001-01-04]}',
'[Pose(Point(4 4),0.4)@2001-01-04, Pose(Point(5 5),0.5)@2001-01-05]']));
/* {[Pose(POINT(1 1),0.1)@2001-01-01, Pose(POINT(2 2),0.2)@2001-01-02],
[Pose(POINT(3 3),0.3)@2001-01-03, Pose(POINT(5 5),0.5)@2001-01-05]} */
WITH temp(inst) AS (
SELECT tpose 'Pose(Point(1 1),0.1)@2001-01-01' UNION
SELECT tpose 'Pose(Point(2 2),0.2)@2001-01-02' UNION
SELECT tpose 'Pose(Point(3 3),0.3)@2001-01-03' )
SELECT asText(merge(inst)) FROM temp;
/* {Pose(POINT(1 1),0.1)@2001-01-01, Pose(POINT(2 2),0.2)@2001-01-02,
Pose(POINT(3 3),0.3)@2001-01-03} */
SELECT asText(mergeAgg(temp)) FROM (VALUES
(tposechain 'PoseChain(Pose(Point(1 1), 0.1))@2001-01-01'),
(tposechain 'PoseChain(Pose(Point(2 2), 0.2))@2001-01-02')) t(temp);
/* {PoseChain(Pose(POINT(1 1),0.1))@2001-01-01,
PoseChain(Pose(POINT(2 2),0.2))@2001-01-02} */
Insert or update the second temporal pose chain into the first one, or delete a time value from it
insert({tpose,tposechain},{tpose,tposechain},connect boolean=true) → {tpose,tposechain}
update({tpose,tposechain},{tpose,tposechain},connect boolean=true) → {tpose,tposechain}
deleteTime({tpose,tposechain},time,connect boolean=true) → {tpose,tposechain}
SELECT asText(deleteTime(tposechain
'{PoseChain(Pose(Point(1 1),0.5), Pose(Point(2 0),0))@2001-01-01,
PoseChain(Pose(Point(3 3),0.5), Pose(Point(4 0),0))@2001-01-02}',
timestamptz '2001-01-02'));
-- {PoseChain(Pose(POINT(1 1),0.5),Pose(POINT(2 0),0))@2001-01-01}