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

Function _bind_matrices

tests/unit/test_algebraic_expression.c:140–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140static void _bind_matrices() {
141 int mat_id;
142 GraphContext *gc = QueryCtx_GetGraphCtx();
143 Graph *g = gc->g;
144
145 mat_id = GraphContext_GetSchema(gc, "Person", SCHEMA_NODE)->id;
146 mat_p = Graph_GetLabelMatrix(g, mat_id);
147 mat_f = Graph_GetLabelMatrix(g, mat_id);
148
149 mat_id = GraphContext_GetSchema(gc, "City", SCHEMA_NODE)->id;
150 mat_c = Graph_GetLabelMatrix(g, mat_id);
151 mat_e = Graph_GetLabelMatrix(g, mat_id);
152
153 mat_id = GraphContext_GetSchema(gc, "friend", SCHEMA_EDGE)->id;
154 mat_ef = Graph_GetRelationMatrix(g, mat_id, false);
155 mat_tef = Graph_GetRelationMatrix(g, mat_id, true);
156
157 mat_id = GraphContext_GetSchema(gc, "visit", SCHEMA_EDGE)->id;
158 mat_ev = Graph_GetRelationMatrix(g, mat_id, false);
159 mat_tev = Graph_GetRelationMatrix(g, mat_id, true);
160
161 mat_id = GraphContext_GetSchema(gc, "war", SCHEMA_EDGE)->id;
162 mat_ew = Graph_GetRelationMatrix(g, mat_id, false);
163 mat_tew = Graph_GetRelationMatrix(g, mat_id, true);
164
165 GrB_Matrix dummy_matrix;
166 GrB_Matrix_new(&dummy_matrix, GrB_BOOL, 2, 2);
167 _matrices = raxNew();
168 raxInsert(_matrices, (unsigned char *)"p", strlen("p"), mat_p, NULL);
169 raxInsert(_matrices, (unsigned char *)"f", strlen("f"), mat_f, NULL);
170 raxInsert(_matrices, (unsigned char *)"c", strlen("c"), mat_c, NULL);
171 raxInsert(_matrices, (unsigned char *)"e", strlen("e"), mat_e, NULL);
172 raxInsert(_matrices, (unsigned char *)"F", strlen("F"), mat_ef, NULL);
173 raxInsert(_matrices, (unsigned char *)"V", strlen("V"), mat_ev, NULL);
174 raxInsert(_matrices, (unsigned char *)"W", strlen("W"), mat_ew, NULL);
175 raxInsert(_matrices, (unsigned char *)"tF", strlen("tF"), mat_tef, NULL);
176 raxInsert(_matrices, (unsigned char *)"tV", strlen("tV"), mat_tev, NULL);
177 raxInsert(_matrices, (unsigned char *)"tW", strlen("tW"), mat_tew, NULL);
178 raxInsert(_matrices, (unsigned char *)"A", strlen("A"), dummy_matrix, NULL);
179 raxInsert(_matrices, (unsigned char *)"B", strlen("B"), dummy_matrix, NULL);
180 raxInsert(_matrices, (unsigned char *)"C", strlen("C"), dummy_matrix, NULL);
181}
182
183AlgebraicExpression **build_algebraic_expression(const char *query, AST **master_ast) {
184 cypher_parse_result_t *parse_result = cypher_parse(query, NULL, NULL, CYPHER_PARSE_ONLY_STATEMENTS);

Callers 1

setupFunction · 0.85

Calls 5

QueryCtx_GetGraphCtxFunction · 0.85
GraphContext_GetSchemaFunction · 0.85
Graph_GetLabelMatrixFunction · 0.85
Graph_GetRelationMatrixFunction · 0.85
GrB_Matrix_newFunction · 0.85

Tested by

no test coverage detected