removed debug prints and corrected returning of modified nodes
git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@162 014f5005-505e-4b48-8d0a-63407b615a7c
This commit is contained in:
@@ -216,7 +216,7 @@ def swap_rename_select(n):
|
|||||||
changes=0
|
changes=0
|
||||||
|
|
||||||
if n.name=='σ' and n.child.name=='ρ':
|
if n.name=='σ' and n.child.name=='ρ':
|
||||||
|
changes=1
|
||||||
#Dictionary containing attributes of rename
|
#Dictionary containing attributes of rename
|
||||||
_vars={}
|
_vars={}
|
||||||
for i in n.child.prop.split(','):
|
for i in n.child.prop.split(','):
|
||||||
@@ -225,13 +225,11 @@ def swap_rename_select(n):
|
|||||||
|
|
||||||
#tokenizes expression in select
|
#tokenizes expression in select
|
||||||
_tokens=tokenize_select(n.prop)
|
_tokens=tokenize_select(n.prop)
|
||||||
print _tokens, _vars
|
|
||||||
|
|
||||||
#Renaming stuff
|
#Renaming stuff
|
||||||
for i in range(len(_tokens)):
|
for i in range(len(_tokens)):
|
||||||
if _tokens[i] in _vars:
|
if _tokens[i] in _vars:
|
||||||
_tokens[i]=_vars[_tokens[i]]
|
_tokens[i]=_vars[_tokens[i]]
|
||||||
print _tokens, _vars
|
|
||||||
|
|
||||||
n.name='ρ'
|
n.name='ρ'
|
||||||
n.child.name='σ'
|
n.child.name='σ'
|
||||||
@@ -241,9 +239,6 @@ def swap_rename_select(n):
|
|||||||
for i in _tokens:
|
for i in _tokens:
|
||||||
n.child.prop+=i+ " "
|
n.child.prop+=i+ " "
|
||||||
|
|
||||||
|
|
||||||
pass
|
|
||||||
|
|
||||||
#recoursive scan
|
#recoursive scan
|
||||||
if n.kind==optimizer.UNARY:
|
if n.kind==optimizer.UNARY:
|
||||||
changes+=swap_rename_select(n.child)
|
changes+=swap_rename_select(n.child)
|
||||||
|
@@ -194,7 +194,7 @@ if __name__=="__main__":
|
|||||||
#a=tokenize("(a-b*c)*(b-c)")
|
#a=tokenize("(a-b*c)*(b-c)")
|
||||||
#print tree("σ i==2 (c ᑌ d - (aᑎb))") == tree("σ i==3 (c ᑌ d - (aᑎb))")
|
#print tree("σ i==2 (c ᑌ d - (aᑎb))") == tree("σ i==3 (c ᑌ d - (aᑎb))")
|
||||||
|
|
||||||
a=general_optimize("σ age==3 and qq<=2 or nome!='ciccio d\\'urso'(ρ ciccio➡age,nome➡nom(R))")
|
a=general_optimize("σ age==3 and qq<=2 or nome!='ciccio d\\'urso'(ρ ciccio➡age,nome➡nom(R-Q))")
|
||||||
#a=general_optimize("σ i==2 (σ b>5 (d))")
|
#a=general_optimize("σ i==2 (σ b>5 (d))")
|
||||||
print a
|
print a
|
||||||
#print node(a)
|
#print node(a)
|
||||||
|
Reference in New Issue
Block a user