| 508 | } |
| 509 | |
| 510 | void QueryGraph_ResolveUnknownRelIDs |
| 511 | ( |
| 512 | QueryGraph *qg |
| 513 | ) { |
| 514 | // no unknown relationships - no need to updated |
| 515 | if(!qg->unknown_reltype_ids) return; |
| 516 | |
| 517 | Schema *s = NULL; |
| 518 | bool unkown_relationships = false; |
| 519 | GraphContext *gc = QueryCtx_GetGraphCtx(); |
| 520 | uint edge_count = QueryGraph_EdgeCount(qg); |
| 521 | |
| 522 | // update edges |
| 523 | for(uint i = 0; i < edge_count; i++) { |
| 524 | QGEdge *edge = qg->edges[i]; |
| 525 | uint rel_types_count = array_len(edge->reltypeIDs); |
| 526 | for(uint j = 0; j < rel_types_count; j++) { |
| 527 | if(edge->reltypeIDs[j] == GRAPH_UNKNOWN_RELATION) { |
| 528 | s = GraphContext_GetSchema(gc, edge->reltypes[j], SCHEMA_EDGE); |
| 529 | if(s) edge->reltypeIDs[j] = s->id; |
| 530 | else unkown_relationships = true; // cannot update the unkown relationship |
| 531 | } |
| 532 | } |
| 533 | } |
| 534 | |
| 535 | qg->unknown_reltype_ids = unkown_relationships; |
| 536 | } |
| 537 | |
| 538 | QueryGraph *QueryGraph_Clone |
| 539 | ( |
no test coverage detected