| 74 | } |
| 75 | |
| 76 | int QGNode_GetLabelID |
| 77 | ( |
| 78 | const QGNode *n, |
| 79 | uint idx |
| 80 | ) { |
| 81 | ASSERT(n != NULL); |
| 82 | ASSERT(idx < QGNode_LabelCount(n)); |
| 83 | |
| 84 | int labelId = n->labelsID[idx]; |
| 85 | |
| 86 | // in-case labelId is unknown at time it was created |
| 87 | // check if we can resolve it now |
| 88 | if(labelId == GRAPH_UNKNOWN_LABEL) { |
| 89 | GraphContext *gc = QueryCtx_GetGraphCtx(); |
| 90 | ASSERT(gc != NULL); |
| 91 | |
| 92 | // get schema by name |
| 93 | Schema *s = GraphContext_GetSchema(gc, n->labels[idx], SCHEMA_NODE); |
| 94 | if(s != NULL) { |
| 95 | labelId = Schema_GetID(s); |
| 96 | n->labelsID[idx] = labelId; |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | return labelId; |
| 101 | } |
| 102 | |
| 103 | const char *QGNode_GetLabel |
| 104 | ( |
no test coverage detected