MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / execute_chain

Function execute_chain

nodedb/src/engine/graph/pattern/executor/mod.rs:152–173  ·  view source on GitHub ↗

Execute a single pattern chain against a binding row.

(
    chain: &PatternChain,
    csr: &CsrIndex,
    input_row: &BindingRow,
    state: &mut ExecutionState,
    frontier_bitmap: Option<&nodedb_types::SurrogateBitmap>,
)

Source from the content-addressed store, hash-verified

150
151/// Execute a single pattern chain against a binding row.
152fn execute_chain(
153 chain: &PatternChain,
154 csr: &CsrIndex,
155 input_row: &BindingRow,
156 state: &mut ExecutionState,
157 frontier_bitmap: Option<&nodedb_types::SurrogateBitmap>,
158) -> Result<Vec<BindingRow>, crate::Error> {
159 let mut rows = vec![input_row.clone()];
160
161 for triple in &chain.triples {
162 let mut next_rows = Vec::new();
163 for row in &rows {
164 next_rows.extend(execute_triple(triple, csr, row, state, frontier_bitmap)?);
165 }
166 rows = next_rows;
167 if rows.is_empty() {
168 break;
169 }
170 }
171
172 Ok(rows)
173}
174
175/// Execute a single triple `(src)-[edge]->(dst)` against a binding row.
176fn execute_triple(

Callers 1

execute_clauseFunction · 0.85

Calls 3

execute_tripleFunction · 0.85
extendMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected