schema.py
changeset 10653 42c5bd7286b7
parent 10612 84468b90e9c1
child 10661 e6eb0c7c2e98
equal deleted inserted replaced
10652:e3e4a8c45695 10653:42c5bd7286b7
   144 def normalize_expression(rqlstring):
   144 def normalize_expression(rqlstring):
   145     """normalize an rql expression to ease schema synchronization (avoid
   145     """normalize an rql expression to ease schema synchronization (avoid
   146     suppressing and reinserting an expression if only a space has been
   146     suppressing and reinserting an expression if only a space has been
   147     added/removed for instance)
   147     added/removed for instance)
   148     """
   148     """
   149     return u', '.join(' '.join(expr.split()) for expr in rqlstring.split(','))
   149     union = parse(u'Any 1 WHERE %s' % rqlstring).as_string()
       
   150     if isinstance(union, str):
       
   151         union = union.decode('utf-8')
       
   152     return union.split(' WHERE ', 1)[1]
   150 
   153 
   151 
   154 
   152 def _check_valid_formula(rdef, formula_rqlst):
   155 def _check_valid_formula(rdef, formula_rqlst):
   153     """Check the formula is a valid RQL query with some restriction (no union,
   156     """Check the formula is a valid RQL query with some restriction (no union,
   154     single selected node, etc.), raise BadSchemaDefinition if not
   157     single selected node, etc.), raise BadSchemaDefinition if not