returns a map containing all the properties in the given node, or edge.
| 64 | |
| 65 | // returns a map containing all the properties in the given node, or edge. |
| 66 | SIValue GraphEntity_Properties |
| 67 | ( |
| 68 | const GraphEntity *e |
| 69 | ) { |
| 70 | GraphContext *gc = QueryCtx_GetGraphCtx(); |
| 71 | const AttributeSet set = GraphEntity_GetAttributes(e); |
| 72 | int propCount = AttributeSet_Count(set); |
| 73 | SIValue map = SI_Map(propCount); |
| 74 | for(int i = 0; i < propCount; i++) { |
| 75 | Attribute_ID attr_id; |
| 76 | SIValue value = AttributeSet_GetIdx(set, i, &attr_id); |
| 77 | const char *key = GraphContext_GetAttributeString(gc, attr_id); |
| 78 | Map_Add(&map, SI_ConstStringVal(key), value); |
| 79 | } |
| 80 | return map; |
| 81 | } |
| 82 | |
| 83 | // prints the attribute set into a buffer, returns what is the string length |
| 84 | // buffer can be re-allocated if needed |
no test coverage detected