server/rqlannotation.py
changeset 5173 73760bbb66bd
parent 5004 4cc020ee70e2
child 5423 e15abfdcce38
equal deleted inserted replaced
5163:3079b8345915 5173:73760bbb66bd
   337         print 'ambiguous vars', sorted(self.ambiguousvars)
   337         print 'ambiguous vars', sorted(self.ambiguousvars)
   338 
   338 
   339     def set_rel_constraint(self, term, rel, etypes_func):
   339     def set_rel_constraint(self, term, rel, etypes_func):
   340         if isinstance(term, VariableRef) and self.is_ambiguous(term.variable):
   340         if isinstance(term, VariableRef) and self.is_ambiguous(term.variable):
   341             var = term.variable
   341             var = term.variable
   342             if var.stinfo['typerel'] is not None:
   342             if len(var.stinfo['relations']) == 1 \
   343                 sub = 1
       
   344             else:
       
   345                 sub = 0
       
   346             if len(var.stinfo['relations']) - sub == 1 \
       
   347                    or rel.sqlscope is var.sqlscope or rel.r_type == 'identity':
   343                    or rel.sqlscope is var.sqlscope or rel.r_type == 'identity':
   348                 self.restrict(var, frozenset(etypes_func()))
   344                 self.restrict(var, frozenset(etypes_func()))
   349                 try:
   345                 try:
   350                     self.maydeambrels[var].add(rel)
   346                     self.maydeambrels[var].add(rel)
   351                 except KeyError:
   347                 except KeyError: