schema.py
branchstable
changeset 3826 0c0c051863cb
parent 3825 b54c8d664dd6
child 3827 c7142a4e3470
equal deleted inserted replaced
3825:b54c8d664dd6 3826:0c0c051863cb
   810                 mainvars.append('U')
   810                 mainvars.append('U')
   811             if not mainvars:
   811             if not mainvars:
   812                 raise Exception('unable to guess selection variables')
   812                 raise Exception('unable to guess selection variables')
   813             mainvars = ','.join(mainvars)
   813             mainvars = ','.join(mainvars)
   814         RQLExpression.__init__(self, expression, mainvars, eid)
   814         RQLExpression.__init__(self, expression, mainvars, eid)
       
   815         self.vargraph = {}
       
   816         for relation in self.rqlst.get_nodes(nodes.Relation):
       
   817             try:
       
   818                 rhsvarname = relation.children[1].children[0].variable.name
       
   819                 lhsvarname = relation.children[0].name
       
   820             except AttributeError:
       
   821                 pass
       
   822             else:
       
   823                 self.vargraph.setdefault(lhsvarname, []).append(rhsvarname)
       
   824                 self.vargraph.setdefault(rhsvarname, []).append(lhsvarname)
       
   825                 #self.vargraph[(lhsvarname, rhsvarname)] = relation.r_type
   815 
   826 
   816     @property
   827     @property
   817     def full_rql(self):
   828     def full_rql(self):
   818         rql = self.minimal_rql
   829         rql = self.minimal_rql
   819         rqlst = getattr(self, 'rqlst', None) # may be not set yet
   830         rqlst = getattr(self, 'rqlst', None) # may be not set yet