| 431 | //------------------------------------------------------------------------------ |
| 432 | |
| 433 | AST_CreateContext AST_PrepareCreateOp |
| 434 | ( |
| 435 | QueryGraph *qg, |
| 436 | rax *bound_vars, |
| 437 | const cypher_astnode_t *clause |
| 438 | ) { |
| 439 | // shouldn't operate on the original bound variables map |
| 440 | // as this function may insert aliases |
| 441 | rax *bound_and_introduced_entities = raxClone(bound_vars); |
| 442 | |
| 443 | NodeCreateCtx *nodes_to_create = array_new(NodeCreateCtx, 1); |
| 444 | EdgeCreateCtx *edges_to_create = array_new(EdgeCreateCtx, 1); |
| 445 | |
| 446 | const cypher_astnode_t *pattern = cypher_ast_create_get_pattern(clause); |
| 447 | uint npaths = cypher_ast_pattern_npaths(pattern); |
| 448 | |
| 449 | for(uint j = 0; j < npaths; j++) { |
| 450 | const cypher_astnode_t *path = cypher_ast_pattern_get_path(pattern, j); |
| 451 | AST_PreparePathCreation(path, qg, bound_and_introduced_entities, |
| 452 | &nodes_to_create, &edges_to_create); |
| 453 | } |
| 454 | |
| 455 | raxFree(bound_and_introduced_entities); |
| 456 | |
| 457 | AST_CreateContext ctx = { .nodes_to_create = nodes_to_create, |
| 458 | .edges_to_create = edges_to_create }; |
| 459 | |
| 460 | return ctx; |
| 461 | } |
| 462 |
no test coverage detected