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

Function UpdateEdgeProperty

src/graph/graph_hub.c:285–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283}
284
285void UpdateEdgeProperty
286(
287 GraphContext *gc, // graph context
288 EdgeID id, // edge ID
289 RelationID r_id, // relation ID
290 NodeID src_id, // source node ID
291 NodeID dest_id, // destination node ID
292 Attribute_ID attr_id, // attribute ID
293 SIValue v // new attribute value
294) {
295 Edge e; // edge to delete
296
297 // get src node, dest node and edge from the graph
298 int res;
299 UNUSED(res);
300
301 res = Graph_GetEdge(gc->g, id, &e);
302 ASSERT(res != 0);
303
304 // set edge relation, src and destination node
305 Edge_SetSrcNodeID(&e, src_id);
306 Edge_SetDestNodeID(&e, dest_id);
307 Edge_SetRelationID(&e, r_id);
308
309 if(attr_id == ATTRIBUTE_ID_ALL) {
310 AttributeSet_Free(e.attributes);
311 } else if(GraphEntity_GetProperty((GraphEntity *)&e, attr_id) == ATTRIBUTE_NOTFOUND) {
312 AttributeSet_AddNoClone(e.attributes, &attr_id, &v, 1, true);
313 } else {
314 AttributeSet_UpdateNoClone(e.attributes, attr_id, v);
315 }
316
317 Schema *schema = GraphContext_GetSchemaByID(gc, r_id, SCHEMA_EDGE);
318 ASSERT(schema != NULL);
319 Schema_AddEdgeToIndices(schema, &e);
320}
321
322void UpdateNodeLabels
323(

Callers 1

ApplyUpdateEdgeFunction · 0.85

Calls 10

Graph_GetEdgeFunction · 0.85
Edge_SetSrcNodeIDFunction · 0.85
Edge_SetDestNodeIDFunction · 0.85
Edge_SetRelationIDFunction · 0.85
AttributeSet_FreeFunction · 0.85
GraphEntity_GetPropertyFunction · 0.85
AttributeSet_AddNoCloneFunction · 0.85
Schema_AddEdgeToIndicesFunction · 0.85

Tested by

no test coverage detected