Skip to content

Commit

Permalink
feat(cognitarium): build query plan from where clause
Browse files Browse the repository at this point in the history
  • Loading branch information
amimart committed Jun 5, 2023
1 parent 0ef6f1f commit b57e3a0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion contracts/okp4-cognitarium/src/querier/plan_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@ impl<'a> PlanBuilder<'a> {
}

pub fn build_plan(&mut self, where_clause: WhereClause) -> StdResult<QueryPlan> {
Err(StdError::generic_err("not implemented"))
let bgp: Vec<QueryNode::TriplePattern> = where_clause
.iter()
.map(|cond| {
let WhereCondition::Simple(SimpleWhereCondition::TriplePattern(pattern)) = cond;
self.build_triple_pattern(pattern)
})
.collect()?;

self.build_from_bgp(bgp)
}

fn build_from_bgp(&self, bgp: Vec<QueryNode::TriplePattern>) -> StdResult<QueryPlan> {
bgp.iter()
Expand Down

0 comments on commit b57e3a0

Please sign in to comment.