| 397 | } |
| 398 | |
| 399 | Schema *GraphContext_AddSchema |
| 400 | ( |
| 401 | GraphContext *gc, |
| 402 | const char *label, |
| 403 | SchemaType t |
| 404 | ) { |
| 405 | int id; |
| 406 | Schema *schema; |
| 407 | |
| 408 | if(t == SCHEMA_NODE) { |
| 409 | id = Graph_AddLabel(gc->g); |
| 410 | schema = Schema_New(SCHEMA_NODE, id, label); |
| 411 | array_append(gc->node_schemas, schema); |
| 412 | } else { |
| 413 | id = Graph_AddRelationType(gc->g); |
| 414 | schema = Schema_New(SCHEMA_EDGE, id, label); |
| 415 | array_append(gc->relation_schemas, schema); |
| 416 | } |
| 417 | |
| 418 | // new schema added, update graph version |
| 419 | _GraphContext_UpdateVersion(gc, label); |
| 420 | |
| 421 | return schema; |
| 422 | } |
| 423 | |
| 424 | void GraphContext_RemoveSchema(GraphContext *gc, int schema_id, SchemaType t) { |
| 425 | if(t == SCHEMA_NODE) { |