server/rqlannotation.py
branchstable
changeset 4719 aaed3f813ef8
parent 4467 0e73d299730a
child 4721 8f63691ccb7f
equal deleted inserted replaced
4718:3dc3ad02d091 4719:aaed3f813ef8
    28                 stinfo = vref.variable.stinfo
    28                 stinfo = vref.variable.stinfo
    29                 if not stinfo['constnode'] and stinfo['selected']:
    29                 if not stinfo['constnode'] and stinfo['selected']:
    30                     need_distinct = True
    30                     need_distinct = True
    31                     # XXX could mark as not invariant
    31                     # XXX could mark as not invariant
    32                     break
    32                     break
    33     for name, var in rqlst.defined_vars.items():
    33     for var in rqlst.defined_vars.itervalues():
    34         stinfo = var.stinfo
    34         stinfo = var.stinfo
    35         if stinfo.get('ftirels'):
    35         if stinfo.get('ftirels'):
    36             has_text_query = True
    36             has_text_query = True
    37         if stinfo['attrvar']:
    37         if stinfo['attrvar']:
    38             stinfo['invariant'] = False
    38             stinfo['invariant'] = False
   137     represent an invariant variable (e.g. using on extremity of the relation
   137     represent an invariant variable (e.g. using on extremity of the relation
   138     instead of the variable's type table
   138     instead of the variable's type table
   139     """
   139     """
   140     # _sort argument is there for test
   140     # _sort argument is there for test
   141     diffscope_rels = {}
   141     diffscope_rels = {}
   142     has_same_scope_rel = False
       
   143     ored_rels = set()
   142     ored_rels = set()
   144     diffscope_rels = set()
   143     diffscope_rels = set()
   145     for rel in _sort(relations):
   144     for rel in _sort(relations):
   146         # note: only eid and has_text among all final relations may be there
   145         # note: only eid and has_text among all final relations may be there
   147         if rel.r_type in ('eid', 'identity'):
   146         if rel.r_type in ('eid', 'identity'):
   148             has_same_scope_rel = rel.sqlscope is sqlscope
       
   149             continue
   147             continue
   150         if rel.ored(traverse_scope=True):
   148         if rel.ored(traverse_scope=True):
   151             ored_rels.add(rel)
   149             ored_rels.add(rel)
   152         elif rel.sqlscope is sqlscope:
   150         elif rel.sqlscope is sqlscope:
   153             return rel
   151             return rel