| 248 | } |
| 249 | |
| 250 | void 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 | |
| 285 | void UpdateEdgeProperty |
| 286 | ( |
no test coverage detected