returns an array of string representations of each label of a node
| 26 | |
| 27 | // returns an array of string representations of each label of a node |
| 28 | SIValue AR_LABELS(SIValue *argv, int argc, void *private_data) { |
| 29 | if(SI_TYPE(argv[0]) == T_NULL) return SI_NullVal(); |
| 30 | |
| 31 | Node *node = argv[0].ptrval; |
| 32 | GraphContext *gc = QueryCtx_GetGraphCtx(); |
| 33 | // retrieve node labels |
| 34 | uint label_count; |
| 35 | NODE_GET_LABELS(gc->g, node, label_count); |
| 36 | SIValue res = SI_Array(label_count); |
| 37 | |
| 38 | for(uint i = 0; i < label_count; i++) { |
| 39 | Schema *s = GraphContext_GetSchemaByID(gc, labels[i], SCHEMA_NODE); |
| 40 | ASSERT(s != NULL); |
| 41 | const char *name = Schema_GetName(s); |
| 42 | SIArray_Append(&res, SI_ConstStringVal(name)); |
| 43 | } |
| 44 | |
| 45 | return res; |
| 46 | } |
| 47 | |
| 48 | // returns true if input node contains all specified labels, otherwise false |
| 49 | SIValue AR_HAS_LABELS(SIValue *argv, int argc, void *private_data) { |
nothing calls this directly
no test coverage detected