MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / _QueryGraphSetNodeLabel

Function _QueryGraphSetNodeLabel

src/graph/query_graph.c:15–34  ·  view source on GitHub ↗

sets node label and label ID

Source from the content-addressed store, hash-verified

13
14// sets node label and label ID
15static void _QueryGraphSetNodeLabel
16(
17 QGNode *n,
18 const cypher_astnode_t *ast_entity
19) {
20 GraphContext *gc = QueryCtx_GetGraphCtx();
21
22 // retrieve node labels from the AST entity
23 uint nlabels = cypher_ast_node_pattern_nlabels(ast_entity);
24
25 for(uint i = 0; i < nlabels; i++) {
26 const char *l = cypher_ast_label_get_name(
27 cypher_ast_node_pattern_get_label(ast_entity, i));
28
29 // if a schema is found, the AST refers to an existing label
30 Schema *s = GraphContext_GetSchema(gc, l, SCHEMA_NODE);
31 int l_id = (s) ? Schema_GetID(s) : GRAPH_UNKNOWN_LABEL;
32 QGNode_AddLabel(n, l, l_id);
33 }
34}
35
36// adds node to query graph
37static void _QueryGraphAddNode

Callers 2

_QueryGraphAddNodeFunction · 0.85
_QueryGraph_ExtractNodeFunction · 0.85

Calls 4

QueryCtx_GetGraphCtxFunction · 0.85
GraphContext_GetSchemaFunction · 0.85
Schema_GetIDFunction · 0.85
QGNode_AddLabelFunction · 0.85

Tested by

no test coverage detected