Как установить триггер для изменения даты всех связанных узлов в neo4j? - PullRequest
0 голосов
/ 07 апреля 2019

Как установить триггер таким образом, чтобы при изменении даты родительского узла автоматически изменялась дата окончания и даты начала связанных с ним узлов?Мой триггер выглядит примерно так:

CALL apoc.trigger.add(
'update_date',
'UNWIND apoc.trigger.propertiesByKey({assignedNodeProperties},"start_date") as prop
WITH prop.node as n 
match (n)-[:precedes_fs]->(m)
SET n.end_date = apoc.date.toISO8601(apoc.date.add(apoc.date.fromISO8601(n.start_date), 'ms', n.duration, 'd'), "ms")
, m.start_date = apoc.date.toISO8601(apoc.date.add(apoc.date.fromISO8601(n.end_date), 'ms', 1, 'd'), "ms")', {phase:'after'});

, но мой запрос -

match(n) where n.wbs="1.3" set n.start_date="2019-03-19T11:30:00.000Z"

выполняется слишком долго (никакого результата вообще - запрос продолжает вращаться в браузере neo4j и ничегов журнале отладки).Я использую Neo4j Enterprise версии 3.5.4 - Любые предложения приветствуются

Правка - Свойства моего узла выглядят примерно так - (все они имеют одну задачу метки)

{
  "marked": "false",
  "end_date": "2019-04-25T11:30:00.000Z",
  "parent": "d4e051af-91da-4024-96e7-dfe518ef54980",
  "early_start_date": "2019-03-06T02:30:00.000Z",
  "early_finish_date": "2019-04-25T11:30:00.000Z",
  "late_start_date": "2019-03-06T02:30:00.000Z",
  "wbs": "1",
  "difference": 50,
  "isCritical": false,
  "late_finish_date": "2019-04-25T11:30:00.000Z",
  "text": "Construction of House",
  "id": "d4e051af-91da-4024-96e7-dfe518ef54981",
  "task_type": "project",
  "start_date": "2019-03-06T02:30:00.000Z"
}
{
  "marked": "false",
  "end_date": "2019-04-18T11:30:00.000Z",
  "parent": "d4e051af-91da-4024-96e7-dfe518ef54981",
  "early_start_date": "2019-04-12T02:30:00.000Z",
  "early_finish_date": "2019-04-18T11:30:00.000Z",
  "late_start_date": "2019-04-12T02:30:00.000Z",
  "wbs": "1.9",
  "type": 0,
  "lag": 0,
  "difference": 6,
  "isCritical": false,
  "late_finish_date": "2019-04-18T11:30:00.000Z",
  "text": "Concreting of columns",
  "id": "d4e051af-91da-4024-96e7-dfe518ef549810",
  "task_type": "task",
  "start_date": "2019-04-12T02:30:00.000Z"
}
{
  "marked": "false",
  "end_date": "2019-04-23T11:30:00.000Z",
  "parent": "d4e051af-91da-4024-96e7-dfe518ef54981",
  "early_start_date": "2019-04-19T02:30:00.000Z",
  "early_finish_date": "2019-04-23T11:30:00.000Z",
  "late_start_date": "2019-04-19T02:30:00.000Z",
  "wbs": "1.10",
  "type": 0,
  "lag": 0,
  "difference": 4,
  "isCritical": false,
  "late_finish_date": "2019-04-23T11:30:00.000Z",
  "text": "Shuttering of slab",
  "id": "d4e051af-91da-4024-96e7-dfe518ef549811",
  "task_type": "task",
  "start_date": "2019-04-19T02:30:00.000Z"
}
{
  "marked": "false",
  "end_date": "2019-04-25T11:30:00.000Z",
  "parent": "d4e051af-91da-4024-96e7-dfe518ef54981",
  "early_start_date": "2019-04-24T02:30:00.000Z",
  "early_finish_date": "2019-04-25T11:30:00.000Z",
  "late_start_date": "2019-04-24T02:30:00.000Z",
  "wbs": "1.11",
  "type": 0,
  "lag": 0,
  "difference": 1,
  "isCritical": false,
  "late_finish_date": "2019-04-25T11:30:00.000Z",
  "text": "Reinforcement of slab",
  "id": "d4e051af-91da-4024-96e7-dfe518ef549812",
  "task_type": "task",
  "start_date": "2019-04-24T02:30:00.000Z"
}
{
  "marked": "111",
  "end_date": "2019-03-06T11:30:00.000Z",
  "parent": "d4e051af-91da-4024-96e7-dfe518ef54981",
  "early_start_date": "2019-03-06T02:30:00.000Z",
  "early_finish_date": "2019-03-06T11:30:00.000Z",
  "late_start_date": "2019-04-25T02:30:00.000Z",
  "wbs": "1.12",
  "difference": 0,
  "isCritical": false,
  "late_finish_date": "2019-04-25T11:30:00.000Z",
  "text": "Concreting of slab",
  "id": "d4e051af-91da-4024-96e7-dfe518ef549813",
  "task_type": "task",
  "start_date": "2019-03-06T02:30:00.000Z"
}
{
  "marked": "false",
  "end_date": "2019-03-11T11:30:00.000Z",
  "parent": "d4e051af-91da-4024-96e7-dfe518ef54981",
  "early_start_date": "2019-03-06T02:30:00.000Z",
  "early_finish_date": "2019-03-11T11:30:00.000Z",
  "late_start_date": "2019-03-06T02:30:00.000Z",
  "wbs": "1.1",
  "difference": 4,
  "isCritical": false,
  "late_finish_date": "2019-03-11T11:30:00.000Z",
  "text": "Marking of footing",
  "id": "d4e051af-91da-4024-96e7-dfe518ef54982",
  "task_type": "task",
  "start_date": "2019-03-07T02:30:00.000Z"
}
{
  "marked": "true",
  "end_date": "2019-03-13T11:30:00.000Z",
  "parent": "d4e051af-91da-4024-96e7-dfe518ef54981",
  "early_start_date": "2019-03-12T02:30:00.000Z",
  "early_finish_date": "2019-03-13T11:30:00.000Z",
  "late_start_date": "2019-03-12T02:30:00.000Z",
  "wbs": "1.2",
  "type": 0,
  "lag": 0,
  "difference": 2,
  "isCritical": false,
  "late_finish_date": "2019-03-13T11:30:00.000Z",
  "text": "###",
  "id": "d4e051af-91da-4024-96e7-dfe518ef54983",
  "task_type": "task",
  "start_date": "2019-03-11T11:30:00.000Z"
}
{
  "marked": "true",
  "end_date": "2019-03-19T11:30:00.000Z",
  "parent": "d4e051af-91da-4024-96e7-dfe518ef54981",
  "early_start_date": "2019-03-14T02:30:00.000Z",
  "early_finish_date": "2019-03-19T11:30:00.000Z",
  "actual_start_date": "$$$$",
  "late_start_date": "2019-03-14T02:30:00.000Z",
  "wbs": "1.3",
  "type": 0,
  "lag": 0,
  "difference": 5,
  "isCritical": false,
  "late_finish_date": "2019-03-19T11:30:00.000Z",
  "text": "Footing Reinforcement",
  "id": "d4e051af-91da-4024-96e7-dfe518ef54984",
  "task_type": "task",
  "start_date": "2019-03-14T02:30:00.000Z"
}
{
  "marked": "false",
  "end_date": "2019-03-25T11:30:00.000Z",
  "parent": "d4e051af-91da-4024-96e7-dfe518ef54981",
  "early_start_date": "2019-03-20T02:30:00.000Z",
  "early_finish_date": "2019-03-25T11:30:00.000Z",
  "actual_start_date": "$$$$",
  "late_start_date": "2019-03-20T02:30:00.000Z",
  "wbs": "1.4",
  "type": 0,
  "lag": 0,
  "difference": 5,
  "isCritical": false,
  "late_finish_date": "2019-03-25T11:30:00.000Z",
  "text": "Footing shutteirng",
  "id": "d4e051af-91da-4024-96e7-dfe518ef54985",
  "task_type": "task",
  "start_date": "2019-03-20T02:30:00.000Z"
}
{
  "marked": "false",
  "end_date": "2019-03-26T11:30:00.000Z",
  "parent": "d4e051af-91da-4024-96e7-dfe518ef54981",
  "early_start_date": "2019-03-26T02:30:00.000Z",
  "early_finish_date": "2019-03-26T11:30:00.000Z",
  "late_start_date": "2019-03-26T02:30:00.000Z",
  "wbs": "1.5",
  "type": 0,
  "lag": 0,
  "difference": 0,
  "isCritical": false,
  "late_finish_date": "2019-03-26T11:30:00.000Z",
  "text": "Footing Concreting",
  "id": "d4e051af-91da-4024-96e7-dfe518ef54986",
  "task_type": "task",
  "start_date": "2019-03-26T02:30:00.000Z"
}
{
  "marked": "false",
  "end_date": "2019-04-01T11:30:00.000Z",
  "parent": "d4e051af-91da-4024-96e7-dfe518ef54981",
  "early_start_date": "2019-03-27T02:30:00.000Z",
  "early_finish_date": "2019-04-01T11:30:00.000Z",
  "late_start_date": "2019-03-27T02:30:00.000Z",
  "wbs": "1.6",
  "type": 0,
  "lag": 0,
  "difference": 5,
  "isCritical": false,
  "late_finish_date": "2019-04-01T11:30:00.000Z",
  "text": "Backfilling",
  "id": "d4e051af-91da-4024-96e7-dfe518ef54987",
  "task_type": "task",
  "start_date": "2019-03-27T02:30:00.000Z"
}
{
  "marked": "false",
  "end_date": "2019-04-05T11:30:00.000Z",
  "parent": "d4e051af-91da-4024-96e7-dfe518ef54981",
  "early_start_date": "2019-04-02T02:30:00.000Z",
  "early_finish_date": "2019-04-05T11:30:00.000Z",
  "late_start_date": "2019-04-02T02:30:00.000Z",
  "wbs": "1.7",
  "type": 0,
  "lag": 0,
  "difference": 3,
  "isCritical": false,
  "late_finish_date": "2019-04-05T11:30:00.000Z",
  "text": "Reinforcement of columns",
  "id": "d4e051af-91da-4024-96e7-dfe518ef54988",
  "task_type": "task",
  "start_date": "2019-04-04T02:30:00.000Z"
}
{
  "marked": "false",
  "end_date": "2019-04-11T11:30:00.000Z",
  "parent": "d4e051af-91da-4024-96e7-dfe518ef54981",
  "early_start_date": "2019-04-08T02:30:00.000Z",
  "early_finish_date": "2019-04-11T11:30:00.000Z",
  "late_start_date": "2019-04-08T02:30:00.000Z",
  "wbs": "1.8",
  "type": 0,
  "lag": 0,
  "difference": 3,
  "isCritical": false,
  "late_finish_date": "2019-04-11T11:30:00.000Z",
  "text": "Shuttering of columns",
  "id": "d4e051af-91da-4024-96e7-dfe518ef54989",
  "task_type": "task",
  "start_date": "2019-04-08T02:30:00.000Z"
}
```[enter image description here][1]


  [1]: https://i.stack.imgur.com/OGLEe.png
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...