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

Function UpdateNodeProperty

src/graph/graph_hub.c:250–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248}
249
250void UpdateNodeProperty
251(
252 GraphContext *gc, // graph context
253 NodeID id, // node ID
254 Attribute_ID attr_id, // attribute ID
255 SIValue v // new attribute value
256) {
257 Node n;
258 int res = Graph_GetNode(gc->g, id, &n);
259
260 // make sure entity was found
261 UNUSED(res);
262 ASSERT(res == true);
263
264 if(attr_id == ATTRIBUTE_ID_ALL) {
265 AttributeSet_Free(n.attributes);
266 } else if(GraphEntity_GetProperty((GraphEntity *)&n, attr_id) == ATTRIBUTE_NOTFOUND) {
267 AttributeSet_AddNoClone(n.attributes, &attr_id, &v, 1, true);
268 } else {
269 AttributeSet_UpdateNoClone(n.attributes, attr_id, v);
270 }
271
272 // retrieve node labels
273 uint label_count;
274 NODE_GET_LABELS(gc->g, &n, label_count);
275
276 Schema *s;
277 for(uint i = 0; i < label_count; i++) {
278 int label_id = labels[i];
279 s = GraphContext_GetSchemaByID(gc, label_id, SCHEMA_NODE);
280 ASSERT(s != NULL);
281 Schema_AddNodeToIndices(s, &n);
282 }
283}
284
285void UpdateEdgeProperty
286(

Callers 1

ApplyUpdateNodeFunction · 0.85

Calls 7

Graph_GetNodeFunction · 0.85
AttributeSet_FreeFunction · 0.85
GraphEntity_GetPropertyFunction · 0.85
AttributeSet_AddNoCloneFunction · 0.85
Schema_AddNodeToIndicesFunction · 0.85

Tested by

no test coverage detected