| 291 | } |
| 292 | |
| 293 | fn into_bindings(&self) -> Vec<Binding> { |
| 294 | // @TODO provide a general fold for plans |
| 295 | match *self { |
| 296 | Plan::Project(ref projection) => projection.into_bindings(), |
| 297 | Plan::Aggregate(ref aggregate) => aggregate.into_bindings(), |
| 298 | Plan::Union(ref union) => union.into_bindings(), |
| 299 | Plan::Join(ref join) => join.into_bindings(), |
| 300 | Plan::Hector(ref hector) => hector.into_bindings(), |
| 301 | Plan::Antijoin(ref antijoin) => antijoin.into_bindings(), |
| 302 | Plan::Negate(ref plan) => plan.into_bindings(), |
| 303 | Plan::Filter(ref filter) => filter.into_bindings(), |
| 304 | Plan::Transform(ref transform) => transform.into_bindings(), |
| 305 | Plan::MatchA(e, ref a, v) => vec![Binding::attribute(e, a, v)], |
| 306 | Plan::MatchEA(match_e, ref a, v) => { |
| 307 | let e = gensym(); |
| 308 | vec![ |
| 309 | Binding::attribute(e, a, v), |
| 310 | Binding::constant(e, Value::Eid(match_e)), |
| 311 | ] |
| 312 | } |
| 313 | Plan::MatchAV(e, ref a, ref match_v) => { |
| 314 | let v = gensym(); |
| 315 | vec![ |
| 316 | Binding::attribute(e, a, v), |
| 317 | Binding::constant(v, match_v.clone()), |
| 318 | ] |
| 319 | } |
| 320 | Plan::NameExpr(_, ref _name) => unimplemented!(), // @TODO hmm... |
| 321 | Plan::Pull(ref pull) => pull.into_bindings(), |
| 322 | Plan::PullLevel(ref path) => path.into_bindings(), |
| 323 | Plan::PullAll(ref path) => path.into_bindings(), |
| 324 | #[cfg(feature = "graphql")] |
| 325 | Plan::GraphQl(ref q) => q.into_bindings(), |
| 326 | } |
| 327 | } |
| 328 | |
| 329 | fn datafy(&self) -> Vec<(Eid, Aid, Value)> { |
| 330 | // @TODO provide a general fold for plans |