diff --git a/generate.py b/generate.py
index d9b901acd44c494e7ceb3b48266c4ac2cea01d06..958aa3cf972ddaa660bfd42d39d3a233c931d8b7 100755
--- a/generate.py
+++ b/generate.py
@@ -8,7 +8,7 @@ class select_query:
     self.constraints  = constraints
     self.restrictions = restrictions
   def to_scql(self):
-    q = "SELECT " + " ".join(map(" AS ".join, self.variables))
+    q = "SELECT " + ", ".join(map(" AS ".join, self.variables))
     if len(self.constraints) > 0:
       q += " WHERE " + " AND ".join(map(" ".join, self.constraints))
     return q + " " + " ".join(self.restrictions)
@@ -57,6 +57,30 @@ def generate_scql(queries):
     print(s)
     print(q.to_scql())
 
+def validate_scql(queries):
+  import requests
+  from termcolor import colored
+  all_success = True
+  results = []
+  for s,q in queries:
+    payload = {'query': q.to_scql()}
+    r = requests.post('http://localhost:8181/api/get_model', data=payload).json()
+    # print(r)
+    if not r['model']['parse']:
+      print(f"Failed to parse: '{colored(q.to_scql(), 'blue')}' with error '{colored(r['model']['message'], 'red')}'")
+    else:
+      for m in r["model"]["models"]:
+        if m['success']:
+          results.append([q.to_scql(), m["model"]])
+        else:
+        # elif m['message'] != 'Unimplemented QueryResultModelVisitor PerformQuery':
+          print(f"Failed to model: '{colored(q.to_scql(), 'blue')}' with error '{colored(m['message'], 'red')}'")
+          all_success = False
+  if all_success:
+    for v in results:
+      print(f"Query '{colored(v[0], 'blue')}' has model '{colored(v[1], 'green')}'")
+
+
 prefix_to_uri = {
   "ex": "http://example.org/",
   "scql_actions": "http://askco.re/scql/actions#",
@@ -67,7 +91,7 @@ prefix_to_uri = {
 def mu(curie):
   # split curie accordin to :
   x = curie.split(":", 1)
-  return prefix_to_uri[x[0]] + x[1]
+  return "<" + prefix_to_uri[x[0]] + x[1] + ">"
 
 desire_perf = ["I would like", "I am interested in", "I want to see", "He would like", "He is interested in"]
 
@@ -80,7 +104,7 @@ queries = []
 queries = add_query(queries, [desire_perf, ["a point cloud of the rescue area"]], select_query([[mu("geo:Geometry"), "area"], [mu("scql_types:point_cloud"), "scan"]], [["scan.pose", "inside", "area"], ["area.uri", "=", mu("ex:rescue_area")]], []))
 
 queries = add_query(queries, [desire_perf, ["a point cloud", "a 3d model"]], select_query([[mu("geo:Geometry"), "area"], [mu("scql_types:point_cloud"), "scan"]], [["area.klass", "=", mu("ex:area_of_interest")], ["scan.pose", "inside", "area"]], []))
-queries = add_query(queries, [desire_perf, [["a"], ["high resolution", "very detailed", "high quality"], ["point cloud", "3d model"]]], select_query([[mu("scql_types:point_cloud"), "scan"]], [["scan.pose", "inside", "area"], ["scan.density", ">", "100 point/m^2"]], []))
+queries = add_query(queries, [desire_perf, [["a"], ["high resolution", "very detailed", "high quality"], ["point cloud", "3d model"]]], select_query([[mu("scql_types:point_cloud"), "scan"]], [["scan.pose", "inside", "area"], ["scan.density", ">", "{100 point/m^2}"]], []))
 
 ### Images/Models
 
@@ -97,10 +121,10 @@ properties = [ ["color", mu("ex:color"), ["red", mu("ex:red")], ["green", mu("ex
                ["size", mu("ex:size"), ["big", mu("ex:big")], ["medium", mu("ex:medium")], ["small", mu("ex:small")]] ]
 
 for io in images_objects:
-  queries = add_query(queries, [desire_perf, ["a image", "a picture"], io[0]], select_query([[mu("geo:Geometry"), "area"], [mu("scql_types:salient_point"), "sp"], [mu("scql_types:image"), "image"]], [["area.klass", "=", mu("ex:area_of_interest")], ["sp.klass", "=", io[1]], ["sp.pose", "inside", "area"], ["distance(image.pose, sp.pose)", "<", "1m"]], []))
+  queries = add_query(queries, [desire_perf, ["a image", "a picture"], io[0]], select_query([[mu("geo:Geometry"), "area"], [mu("scql_types:salient_point"), "sp"], [mu("scql_types:image"), "image"]], [["area.klass", "=", mu("ex:area_of_interest")], ["sp.klass", "=", io[1]], ["sp.pose", "inside", "area"], ["distance(image.pose, sp.pose)", "<", "{1m}"]], []))
   for prop in properties:
     for value in prop[2]:
-      queries = add_query(queries, [desire_perf, ["a image", "a picture"], io[0], ["with a " + value[0] + " " + prop[0]]], select_query([[mu("geo:Geometry"), "area"], [mu("scql_types:salient_point"), "sp"], [mu("scql_types:image"), "image"]], [["area.klass", "=", mu("ex:area_of_interest")], ["sp.klass", "=", io[1]], ["sp.pose", "inside", "area"], ["distance(image.pose, sp.pose)", "<", "1m"], ["sp." + prop[1], "=", value[1]]], []))
+      queries = add_query(queries, [desire_perf, ["a image", "a picture"], io[0], ["with a " + value[0] + " " + prop[0]]], select_query([[mu("geo:Geometry"), "area"], [mu("scql_types:salient_point"), "sp"], [mu("scql_types:image"), "image"]], [["area.klass", "=", mu("ex:area_of_interest")], ["sp.klass", "=", io[1]], ["sp.pose", "inside", "area"], ["distance(image.pose, sp.pose)", "<", "{1m}"], ["sp." + prop[1], "=", value[1]]], []))
 
 
 ######### Performs #########
@@ -115,25 +139,26 @@ bring_boxes_perf = ["I would like you to bring a box with", "Could you bring a b
 bring_boxes_dest = ["to specific coordinates", "to this location", "near the goal"]
 
 for bc in box_contents:
-  queries = add_query(queries, [bring_boxes_perf, bc[0] , bring_boxes_dest], perform_query(mu("scql_actions:bring_to"), ["ex:box", "box"], ["scql_types:geo_pose", "pose"], [], [["pose.klass", "=", "ex:location_of_interest" ], ["box", mu("ex:contains"), bc[1]]], []))
+  queries = add_query(queries, [bring_boxes_perf, bc[0] , bring_boxes_dest], perform_query(mu("scql_actions:bring_to"), [mu("ex:box"), "box"], [mu("scql_types:geo_pose"), "pose"], [], [["pose.klass", "=", mu("ex:location_of_interest") ], ["box", mu("ex:contains"), bc[1]]], []))
 
 # Bring boxes to human in needs
 
-human_sick_injured_statuses = [[["all sick humans", "all sick persons", "all humans with disease"], "ex:sick"],[["all injured humans", "all humans with injury"], "ex:injured"]]
+human_sick_injured_statuses = [[["all sick humans", "all sick persons", "all humans with disease"], mu("ex:sick")],[["all injured humans", "all humans with injury"], mu("ex:injured")]]
 human_in_need_statuses = ["all humans in need", "all persons in need", "all persons that need to be rescued"]
 all_human_bad_statuses = "[" + ", ".join([mu("ex:injured"), mu("ex:sick"), mu("ex:dying")]) + "]"
 
 for bc in box_contents:
   for bbd in human_sick_injured_statuses:
-    queries = add_query(queries, [bring_boxes_perf, bc[0] , bbd[0]], perform_query(mu("scql_actions:bring_to"), ["ex:box", "box"], ["human.pose"], [["scql_types:salient_point", "human"]], [["human.klass", "=", "ex:human"], ["human.status",  "=", bbd[1]], ["box", mu("ex:contains"), bc[1]]], []))
+    queries = add_query(queries, [bring_boxes_perf, bc[0] , bbd[0]], perform_query(mu("scql_actions:bring_to"), [mu("ex:box"), "box"], ["human.pose"], [[mu("scql_types:salient_point"), "human"]], [["human.klass", "=", mu("ex:human")], ["human.status",  "=", bbd[1]], ["box", mu("ex:contains"), bc[1]]], []))
 
-  queries = add_query(queries, [bring_boxes_perf, bc[0], human_in_need_statuses], perform_query(mu("scql_actions:bring_to"), ["ex:box", "box"], ["human.pose"], [["scql_types:salient_point", "human"]], [["human.klass", "=", mu("ex:human")], ["human.status",  "in", all_human_bad_statuses], ["box", mu("ex:contains"), bc[1]]], []))
+  queries = add_query(queries, [bring_boxes_perf, bc[0], human_in_need_statuses], perform_query(mu("scql_actions:bring_to"), [mu("ex:box"), "box"], ["human.pose"], [[mu("scql_types:salient_point"), "human"]], [["human.klass", "=", mu("ex:human")], ["human.status",  "in", all_human_bad_statuses], ["box", mu("ex:contains"), bc[1]]], []))
 
 # SELECT variant of "Bring boxes to human in needs"
 for bbd in human_sick_injured_statuses:
-  queries = add_query(queries, [desire_perf, bbd[0]], select_query([[mu("scql_types:salient_point"), "human"]], [["human.klass", "=", "ex:human"], ["human.status",  "=", bbd[1]]], []))
+  queries = add_query(queries, [desire_perf, bbd[0]], select_query([[mu("scql_types:salient_point"), "human"]], [["human.klass", "=", mu("ex:human")], ["human.status",  "=", bbd[1]]], []))
 
-queries = add_query(queries, [desire_perf, human_in_need_statuses], select_query([[mu("scql_types:salient_point"), "human"]], [["human.klass", "=", "ex:human"], ["human.status",  "in", all_human_bad_statuses]], []))
+queries = add_query(queries, [desire_perf, human_in_need_statuses], select_query([[mu("scql_types:salient_point"), "human"]], [["human.klass", "=", mu("ex:human")], ["human.status",  "in", all_human_bad_statuses]], []))
 
 
 generate_scql(queries)
+# validate_scql(queries)