| 283 | } |
| 284 | |
| 285 | void 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 | |
| 322 | void UpdateNodeLabels |
| 323 | ( |
no test coverage detected