equal
deleted
inserted
replaced
22 from rql.stmts import Union, Select |
22 from rql.stmts import Union, Select |
23 from rql.nodes import Constant, Relation |
23 from rql.nodes import Constant, Relation |
24 |
24 |
25 from cubicweb import QueryError |
25 from cubicweb import QueryError |
26 from cubicweb.schema import VIRTUAL_RTYPES |
26 from cubicweb.schema import VIRTUAL_RTYPES |
27 from cubicweb.rqlrewrite import add_types_restriction |
27 from cubicweb.rqlrewrite import add_types_restriction, RQLRelationRewriter |
28 from cubicweb.server.edition import EditedEntity |
28 from cubicweb.server.edition import EditedEntity |
29 |
29 |
30 READ_ONLY_RTYPES = set(('eid', 'has_text', 'is', 'is_instance_of', 'identity')) |
30 READ_ONLY_RTYPES = set(('eid', 'has_text', 'is', 'is_instance_of', 'identity')) |
31 |
31 |
32 _CONSTANT = object() |
32 _CONSTANT = object() |
300 def _select_plan(self, plan, select, solutions): |
300 def _select_plan(self, plan, select, solutions): |
301 union = Union() |
301 union = Union() |
302 union.append(select) |
302 union.append(select) |
303 select.clean_solutions(solutions) |
303 select.clean_solutions(solutions) |
304 add_types_restriction(self.schema, select) |
304 add_types_restriction(self.schema, select) |
|
305 # Rewrite computed relations |
|
306 rewriter = RQLRelationRewriter(plan.cnx) |
|
307 rewriter.rewrite(union, plan.args) |
305 self.rqlhelper.annotate(union) |
308 self.rqlhelper.annotate(union) |
306 return self.build_select_plan(plan, union) |
309 return self.build_select_plan(plan, union) |
307 |
310 |
308 |
311 |
309 # execution steps and helper functions ######################################## |
312 # execution steps and helper functions ######################################## |