Commits

Kirill Simonov committed 61355bb

Renamed `where()` -> `given()`.

Comments (0)

Files changed (14)

doc/ref/functions.rst

    :cut: 3
 
    /department^avg_credits {avg_credits, count(department)}
-    :where(department.avg_credits := avg(course.credits) :trunc(1))
+    :given(department.avg_credits := avg(course.credits) :trunc(1))
 
 
 String Functions
    /{date($dt), time($dt),
      year($d), month($d), day($d),
      hour($t), minute($t), second($t)}
-    :where ($d := date('2010-04-15'),
+    :given ($d := date('2010-04-15'),
             $t := time('20:13'),
             $dt := datetime($d,$t))
 
    /{exists(astro_course.credits>=5),
      every(astro_course.credits>=5),
      count(astro_course.credits>=5)}
-    :where astro_course := course?department.code='astro'
+    :given astro_course := course?department.code='astro'
 
 .. htsql:: /course?department.code='pia'
 
    /{exists(pia_course.credits>=5),
      every(pia_course.credits>=5),
      count(pia_course.credits>=5)}
-    :where pia_course := course?department.code='pia'
+    :given pia_course := course?department.code='pia'
 
 .. index:: min(), max()
 
 .. htsql::
 
    /{min(astro_course.credits), max(astro_course.credits)}
-    :where astro_course := course?department.code='astro'
+    :given astro_course := course?department.code='astro'
 
 .. htsql::
 
    /{min(pia_course.credits), max(pia_course.credits)}
-    :where pia_course := course?department.code='pia'
+    :given pia_course := course?department.code='pia'
 
 .. index:: sum(), avg()
 
 .. htsql::
 
    /{sum(astro_course.credits), avg(astro_course.credits)}
-    :where astro_course := course?department.code='astro'
+    :given astro_course := course?department.code='astro'
 
 .. htsql::
 
    /{sum(pia_course.credits), avg(pia_course.credits)}
-    :where pia_course := course?department.code='pia'
+    :given pia_course := course?department.code='pia'
 
 
 Flow Operations
 | `define(x:=...)`     | add names to the current  | |define-in|               |
 |                      | scope                     |                           |
 +----------------------+---------------------------+---------------------------+
-| `where(expr,x:=...)` | evaluate an expression    | |where-in|                |
+| `given(expr,x:=...)` | evaluate an expression    | |given-in|                |
 |                      | with extra names in the   |                           |
 |                      | current scope             |                           |
 +----------------------+---------------------------+---------------------------+
 +----------------------+---------------------------+---------------------------+
 
 .. |define-in| replace:: ``define(num_prog:=count(program))``
-.. |where-in| replace:: ``count(course?credits>$c) :where $c:=avg(course.credits)``
+.. |given-in| replace:: ``count(course?credits>$c) :given $c:=avg(course.credits)``
 
-.. index:: define(), where()
+.. index:: define(), given()
 
 Calculated Attributes
 ---------------------
 
 `define(x:=...)`
     Add a calculated attribute to the current scope.
-`where(expr,x:=...)`
+`given(expr,x:=...)`
     Evaluate an expression in a current scope with a calculated
     attribute.
 

doc/ref/scopes.rst

 Scope-Augmenting Functions
 --------------------------
 
-Functions ``define()`` and ``where()`` allows you to add new names to
+Functions ``define()`` and ``given()`` allows you to add new names to
 the current scope.
 
 Function ``define()`` takes one or more assignment and adds the names
    /define($avg_credits := avg(course.credits))
     .course?credits>$avg_credits
 
-Function ``where()`` takes an expression as the first parameter, a list
+Function ``given()`` takes an expression as the first parameter, a list
 of assignments as subsequent parameters and evaluates the expression in
-an augmented scope.  Function ``where()`` is typically used in infix
+an augmented scope.  Function ``given()`` is typically used in infix
 notation:
 
 .. htsql::
    :cut: 3
 
    /department{name, count(course?credits>$avg_credits)
-                     :where $avg_credits := avg(course.credits)}
+                     :given $avg_credits := avg(course.credits)}
 
 Resolving Plain Identifiers
 ---------------------------

doc/ref/syntax.rst

    :cut: 3
 
    /course?credits>$avg_credits
-    :where $avg_credits := avg(course.credits)
+    :given $avg_credits := avg(course.credits)
 
 In this example, a reference ``$avg_credits`` is defined in the root
 scope, but accessed in the scope of ``course``.
    :cut: 3
 
    /school{name, num_dept}?num_dept>=4
-    :where school.num_dept := count(department)
+    :given school.num_dept := count(department)
 
 An assignment expression could be used only as an argument of functions
-`define()` and `where()`, or in a selector expression.
+`define()` and `given()`, or in a selector expression.
 
 
 .. vim: set spell spelllang=en textwidth=72:
                  max(sophomore.credits),
                  min(sophomore.credits),
                  avg(sophomore.credits)
-                } :where(sophomore := course?no>=200&no<300)}
+                } :given(sophomore := course?no>=200&no<300)}
 
-In this example we use infix notation to call the ``where()`` function.
+In this example we use infix notation to call the ``given()`` function.
 Generally, any function call ``f(x,y)`` could be written ``x :f y``.
 
 
                                    max(set.credits),
                                    min(set.credits),
                                    avg(set.credits)
-                                   } :where set :=
+                                   } :given set :=
                                     course?no>=$level*100
                                           &no<($level+1)*100)
               {name, stats(1),
    /define($avg_credits := avg(course.credits))
    .course?credits>$avg_credits
 
-This same request can be written using ``where``.
+This same request can be written using ``given``.
 
 .. htsql::
    :no-output:
    :cut: 3
 
    /course?credits>$avg_credits
-   :where $avg_credits := avg(course.credits)
+   :given $avg_credits := avg(course.credits)
 
 Suppose that we'd like to return courses that have more than average
 credits for their given department.  We could write this as follows.

src/htsql/core/tr/fn/bind.py

         TodaySig, NowSig, MultiplySig, DivideSig, IfSig, SwitchSig,
         KeepPolaritySig, ReversePolaritySig, RoundSig, RoundToSig, TruncSig,
         TruncToSig, LengthSig, ContainsSig, ExistsSig, CountSig, MinMaxSig,
-        SumSig, AvgSig, AggregateSig, QuantifySig, DefineSig, WhereSig,
+        SumSig, AvgSig, AggregateSig, QuantifySig, DefineSig, GivenSig,
         SelectSig, LinkSig, TopSig)
 import sys
 
         return binding
 
 
-class BindWhere(BindMacro):
-
-    call('where')
-    signature = WhereSig
+class BindGiven(BindMacro):
+
+    call('given')
+    signature = GivenSig
 
     def expand(self, lop, rops):
         binding = self.state.scope
         return self.state.bind(lop, scope=binding)
 
 
+class BindWhere(BindGiven):
+
+    call('where')
+
+
 class BindId(BindMacro):
 
     call('id')

src/htsql/core/tr/fn/signature.py

     pass
 
 
-class WhereSig(NArySig):
+class GivenSig(NArySig):
     pass
 
 

test/input/error.yaml

   tests:
   # invalid reference with a hint
   - uri: /school?code=$scool_code
-          :where $school_code:='art'
+          :given $school_code:='art'
     expect: 400
   # invalid reference with no hints
   - uri: /school?code=$code
-          :where $school_code:='art'
+          :given $school_code:='art'
     expect: 400
   # invalid reference with many hints
   - uri: /school?code=$scool_code
-          :where ($school_code1:='art', $school_code2:='eng', $school_code3:='mus')
+          :given ($school_code1:='art', $school_code2:='eng', $school_code3:='mus')
     expect: 400
   # invalid attribute; missing $
   - uri: /school?code=school_code
-          :where $school_code:='art'
+          :given $school_code:='art'
     expect: 400
   # invalid attribute; missing ()
   - uri: /school{code, count{department}}
     expect: 400
   - uri: /define(today()){now()}
     expect: 400
-  - uri: /today() :where now()
+  - uri: /today() :given now()
     expect: 400
   # invalid aggregate expansion
   - uri: /exists(school{code,name})
     expect: 400
   # invalid plural quotient base
   - uri: /department{code, count($school^campus)}
-          :where $school:=school
+          :given $school:=school
     expect: 400
   # invalid quotient kernel
   - uri: /school^true()
   - uri: /department{code, count(school{code})}
     expect: 400
   - uri: /department{code, count($school{code})}
-          :where $school:=school
+          :given $school:=school
     expect: 400
   - uri: /school{code, count(program|department)}
     expect: 400

test/input/translation.yaml

             {code, count(course_level), count(course_level.course)}
     # Optimized gluing.
     - uri: /course?credits=$max_credits
-            :where $max_credits := max(course.credits)
+            :given $max_credits := max(course.credits)
     - uri: /course?credits=max(fork().credits)
     - uri: /department{code, count(course?credits=$max_credits)}.limit(10)
-            :where department.$max_credits := max(course.credits)
+            :given department.$max_credits := max(course.credits)
     - uri: /department{code, count(course?credits=max(fork().credits))}.limit(10)
     # Test for a bug with LIMIT preventing unmasking a filter
     - uri: /school?code='art'{code, count(department.limit(10))}
     - uri: /program{school_code,code,count(student)}?count(student)>avg(fork(school_code).count(student))
     - uri: /school.program{school_code,code,count(student)}?count(student)>avg(fork().count(student))
     - uri: /program{school_code,code,count(student)}?count(student)>avg(fork().count(student))
-            :where program := program?school_code='eng'
+            :given program := program?school_code='eng'
     - uri: /program{school_code,code,count(student)}?count(student)>avg(fork(school_code).count(student))
-            :where program := program.limit(10,15)
+            :given program := program.limit(10,15)
     # fork() with projections
     - uri: /program^degree?count(^.student)=max(fork().count(^.student))
     # fork() with nullable kernel
     - uri: /department{id(), school{id()}}
     - uri: /course[astro.105].class.id()
     - uri: /program^degree{*, /^.id()}
-    - uri: /school[$id] :where $id:='ns'
-    - uri: /course[$id]{id(), title} :where $id:=[astro.105]
+    - uri: /school[$id] :given $id:='ns'
+    - uri: /course[$id]{id(), title} :given $id:=[astro.105]
     - uri: /class[$course.$season.001]
-            :where ($course:=[astro.105], $season:=[2009.spring])
+            :given ($course:=[astro.105], $season:=[2009.spring])
     - uri: /program[ns]
       expect: 400
     - uri: /school[ns.uchem]
       expect: 400
     - uri: /program^degree{id()}
       expect: 400
-    - uri: /course[$id]{id(), title} :where $id:='astro.105'
+    - uri: /course[$id]{id(), title} :given $id:='astro.105'
       expect: 400
 
   - title: Table Expressions
     - uri: /school{code,{count(student),
                          count(student?gender='m'),
                          count(student?gender='f')}
-                        :where(student:=program.student?is_active)}
+                        :given(student:=program.student?is_active)}
     - uri: /department.define(stats(c):={min(c.credits) :as min,max(c.credits) :as max})
                 {stats(course), stats(course?no>=100&no<200)}?code='acc'
     - uri: /school.define($school_name:=name).filter(code='eng')
     - uri: /school.define(student_by_year($year) := program.student?year(dob)=$year)
                   {code, student_by_year(1990).$year}
       expect: 400
-    - uri: /define(f($x) := $x*2){{$x, f($x)} :where $x := 21}
+    - uri: /define(f($x) := $x*2){{$x, f($x)} :given $x := 21}
     - uri: /school{code, num_dept := count(department)}?num_dept>3
     - uri: /school{code, $num_dept := count(department)}?$num_dept>3
     - uri: /school{code, program.num_stud := count(student)}

test/input/tutorial.yaml

                  max(sophomore.credits),
                  min(sophomore.credits),
                  avg(sophomore.credits)
-                } :where(sophomore := course?no>=200&no<300)}
+                } :given(sophomore := course?no>=200&no<300)}
   - uri: /department.define(freshman := course?no>=100&no<200,
                             sophomore := course?no>=200&no<300,
                             junior := course?no>=300&no<400,
                                   max(set.credits),
                                   min(set.credits),
                                   avg(set.credits)
-                                 } :where set :=
+                                 } :given set :=
                                         course?no>=$level*100
                                               &no<($level+1)*100)
                 {name, stats(1), stats(2), stats(3), stats(4)}
   - uri: /define($avg_credits := avg(course.credits))
                 .course?credits>$avg_credits
   - uri: /course?credits>$avg_credits
-                :where $avg_credits := avg(course.credits)
+                :given $avg_credits := avg(course.credits)
   - uri: /department.define($avg_credits:=avg(course.credits))
                 .course?credits>$avg_credits
 

test/output/mssql.yaml

                                   ON ([department].[code] = [course].[department_code])
              ORDER BY [department].[code] ASC
         - uri: /department{name, {count(sophomore), max(sophomore.credits), min(sophomore.credits),
-            avg(sophomore.credits) } :where(sophomore := course?no>=200&no<300)}
+            avg(sophomore.credits) } :given(sophomore := course?no>=200&no<300)}
           status: 200 OK
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
              | Wind                   |                0 |                        |                        |                        |
 
              ----
-             /department{name,{count(sophomore),max(sophomore.credits),min(sophomore.credits),avg(sophomore.credits)} :where(sophomore:=course?no>=200&no<300)}
+             /department{name,{count(sophomore),max(sophomore.credits),min(sophomore.credits),avg(sophomore.credits)} :given(sophomore:=course?no>=200&no<300)}
              SELECT [department].[name],
                     COALESCE([course].[count], 0),
                     [course].[max],
                                   ON ([department].[code] = [course].[department_code])
              ORDER BY [department].[code] ASC
         - uri: /department.define( stats($level) := {count(set), max(set.credits),
-            min(set.credits), avg(set.credits) } :where set := course?no>=$level*100
+            min(set.credits), avg(set.credits) } :given set := course?no>=$level*100
             &no<($level+1)*100) {name, stats(1), stats(2), stats(3), stats(4)}
           status: 200 OK
           headers:
              | Wind                   |          0 |                  |                  |                  |          0 |                  |                  |                  |          0 |                  |                  |                  |          0 |                  |                  |                  |
 
              ----
-             /department.define(stats($level):={count(set),max(set.credits),min(set.credits),avg(set.credits)} :where set:=course?no>=$level*100&no<($level+1)*100){name,stats(1),stats(2),stats(3),stats(4)}
+             /department.define(stats($level):={count(set),max(set.credits),min(set.credits),avg(set.credits)} :given set:=course?no>=$level*100&no<($level+1)*100){name,stats(1),stats(2),stats(3),stats(4)}
              SELECT [department].[name],
                     COALESCE([course].[count_1], 0),
                     [course].[max_1],
                                   ON (1 <> 0)
              WHERE (CAST([course_1].[credits] AS DECIMAL(38)) > [course_2].[avg])
              ORDER BY 1 ASC, 2 ASC
-        - uri: /course?credits>$avg_credits :where $avg_credits := avg(course.credits)
+        - uri: /course?credits>$avg_credits :given $avg_credits := avg(course.credits)
           status: 200 OK
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
              | tched           | 640 | Practice of Language Teaching    |       6 | " "                              |
 
              ----
-             /course?credits>$avg_credits :where $avg_credits:=avg(course.credits)
+             /course?credits>$avg_credits :given $avg_credits:=avg(course.credits)
              SELECT [course_1].[department_code],
                     [course_1].[no],
                     [course_1].[title],
                                      GROUP BY [course_1].[department_code]) AS [course_2]
                                     ON ([department].[code] = [course_2].[department_code])
                ORDER BY 1 ASC
-          - uri: /course?credits=$max_credits :where $max_credits := max(course.credits)
+          - uri: /course?credits=$max_credits :given $max_credits := max(course.credits)
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                :                 :     :                            :         : industrial setting.              :
 
                ----
-               /course?credits=$max_credits :where $max_credits:=max(course.credits)
+               /course?credits=$max_credits :given $max_credits:=max(course.credits)
                SELECT [course_1].[department_code],
                       [course_1].[no],
                       [course_1].[title],
                                     ON (1 <> 0)
                WHERE ([course_1].[credits] = [course_2].[max])
                ORDER BY 1 ASC, 2 ASC
-          - uri: /department{code, count(course?credits=$max_credits)}.limit(10) :where
+          - uri: /department{code, count(course?credits=$max_credits)}.limit(10) :given
               department.$max_credits := max(course.credits)
             status: 200 OK
             headers:
                | edpol  |                                 15 |
 
                ----
-               /department{code,count(course?credits=$max_credits)}.limit(10) :where department.$max_credits:=max(course.credits)
+               /department{code,count(course?credits=$max_credits)}.limit(10) :given department.$max_credits:=max(course.credits)
                SELECT TOP 10
                       [department].[code],
                       COALESCE([course].[count], 0)
                WHERE (CAST(COALESCE([student].[count], 0) AS DECIMAL(38)) > [program_2].[avg])
                ORDER BY [school].[code] ASC, 1 ASC, 2 ASC
           - uri: /program{school_code,code,count(student)}?count(student)>avg(fork().count(student))
-              :where program := program?school_code='eng'
+              :given program := program?school_code='eng'
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | eng         | umech    |             11 |
 
                ----
-               /program{school_code,code,count(student)}?count(student)>avg(fork().count(student)) :where program:=program?school_code='eng'
+               /program{school_code,code,count(student)}?count(student)>avg(fork().count(student)) :given program:=program?school_code='eng'
                SELECT [program_1].[school_code],
                       [program_1].[code],
                       COALESCE([student].[count], 0)
                      AND ([program_1].[school_code] = 'eng')
                ORDER BY 1 ASC, 2 ASC
           - uri: /program{school_code,code,count(student)}?count(student)>avg(fork(school_code).count(student))
-              :where program := program.limit(10,15)
+              :given program := program.limit(10,15)
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | eng         | umech    |             11 |
 
                ----
-               /program{school_code,code,count(student)}?count(student)>avg(fork(school_code).count(student)) :where program:=program.limit(10,15)
+               /program{school_code,code,count(student)}?count(student)>avg(fork(school_code).count(student)) :given program:=program.limit(10,15)
                SELECT [program_1].[school_code],
                       [program_1].[code],
                       COALESCE([student].[count], 0)
                  FROM [ad].[program]
                  WHERE ([program].[degree] IS NOT NULL)
                  ORDER BY 3 ASC, 1 ASC, 2 ASC
-          - uri: /school[$id] :where $id:='ns'
+          - uri: /school[$id] :given $id:='ns'
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | ns   | School of Natural Sciences | old    |
 
                ----
-               /school[$id] :where $id:='ns'
+               /school[$id] :given $id:='ns'
                SELECT [school].[code],
                       [school].[name],
                       [school].[campus]
                FROM [ad].[school]
                WHERE ([school].[code] = 'ns')
                ORDER BY 1 ASC
-          - uri: /course[$id]{id(), title} :where $id:=[astro.105]
+          - uri: /course[$id]{id(), title} :given $id:=[astro.105]
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | astro.105 | General Astronomy I |
 
                ----
-               /course[$id]{id(),title} :where $id:=[astro.105]
+               /course[$id]{id(),title} :given $id:=[astro.105]
                SELECT [course].[department_code],
                       [course].[no],
                       [course].[title]
                WHERE ([course].[department_code] = 'astro')
                      AND ([course].[no] = 105)
                ORDER BY 1 ASC, 2 ASC
-          - uri: /class[$course.$season.001] :where ($course:=[astro.105], $season:=[2009.spring])
+          - uri: /class[$course.$season.001] :given ($course:=[astro.105], $season:=[2009.spring])
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | astro           |       105 | 2009 | spring | 001     | mtriplett       |      1167 |
 
                ----
-               /class[$course.$season.001] :where($course:=[astro.105],$season:=[2009.spring])
+               /class[$course.$season.001] :given($course:=[astro.105],$season:=[2009.spring])
                SELECT [class].[department_code],
                       [class].[course_no],
                       [class].[year],
               While translating:
                   /program^degree{id()}
                                   ^^^^
-          - uri: /course[$id]{id(), title} :where $id:='astro.105'
+          - uri: /course[$id]{id(), title} :given $id:='astro.105'
             status: 400 Bad Request
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
             body: |
               Found ill-formed locator
               While translating:
-                  /course[$id]{id(), title} :where $id:='astro.105'
+                  /course[$id]{id(), title} :given $id:='astro.105'
                          ^^^^^
         - id: table-expressions
           tests:
                WHERE (NOT ([student].[is_active] <> 0))
                ORDER BY [student].[id] ASC
           - uri: /school{code,{count(student), count(student?gender='m'), count(student?gender='f')}
-              :where(student:=program.student?is_active)}
+              :given(student:=program.student?is_active)}
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | sc   |              0 |                         0 |                         0 |
 
                ----
-               /school{code,{count(student),count(student?gender='m'),count(student?gender='f')} :where(student:=program.student?is_active)}
+               /school{code,{count(student),count(student?gender='m'),count(student?gender='f')} :given(student:=program.student?is_active)}
                SELECT [school].[code],
                       COALESCE([student].[count_1], 0),
                       COALESCE([student].[count_2], 0),
               While translating:
                   /school.define(student_by_year($year) := program.student?year(dob)=$year) {code, student_by_year(1990).$year}
                                                                                                                          ^^^^^
-          - uri: /define(f($x) := $x*2){{$x, f($x)} :where $x := 21}
+          - uri: /define(f($x) := $x*2){{$x, f($x)} :given $x := 21}
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | 21 |    42 |
 
                ----
-               /define(f($x):=$x*2){{$x,f($x)} :where $x:=21}
+               /define(f($x):=$x*2){{$x,f($x)} :given $x:=21}
                SELECT 21,
                       (21 * 2)
           - uri: /school{code, num_dept := count(department)}?num_dept>3
                          ^^^^^^^
       - id: lookup-hints
         tests:
-        - uri: /school?code=$scool_code :where $school_code:='art'
+        - uri: /school?code=$scool_code :given $school_code:='art'
           status: 400 Bad Request
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
             Perhaps you had in mind:
                 $school_code
             While translating:
-                /school?code=$scool_code :where $school_code:='art'
+                /school?code=$scool_code :given $school_code:='art'
                              ^^^^^^^^^^^
-        - uri: /school?code=$code :where $school_code:='art'
+        - uri: /school?code=$code :given $school_code:='art'
           status: 400 Bad Request
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
             Found unknown reference:
                 $code
             While translating:
-                /school?code=$code :where $school_code:='art'
+                /school?code=$code :given $school_code:='art'
                              ^^^^^
-        - uri: /school?code=$scool_code :where ($school_code1:='art', $school_code2:='eng',
+        - uri: /school?code=$scool_code :given ($school_code1:='art', $school_code2:='eng',
             $school_code3:='mus')
           status: 400 Bad Request
           headers:
                 $school_code2
                 $school_code3
             While translating:
-                /school?code=$scool_code :where ($school_code1:='art', $school_code2:='eng', $school_code3:='mus')
+                /school?code=$scool_code :given ($school_code1:='art', $school_code2:='eng', $school_code3:='mus')
                              ^^^^^^^^^^^
-        - uri: /school?code=school_code :where $school_code:='art'
+        - uri: /school?code=school_code :given $school_code:='art'
           status: 400 Bad Request
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
             Perhaps you had in mind:
                 a reference '$school_code'
             While translating:
-                /school?code=school_code :where $school_code:='art'
+                /school?code=school_code :given $school_code:='art'
                              ^^^^^^^^^^^
         - uri: /school{code, count{department}}
           status: 400 Bad Request
             While translating:
                 /define(today()){now()}
                         ^^^^^^^
-        - uri: /today() :where now()
-          status: 400 Bad Request
-          headers:
-          - [Content-Type, text/plain; charset=UTF-8]
-          body: |
-            Function 'where' expects an assignment expression
-            While translating:
-                /today() :where now()
+        - uri: /today() :given now()
+          status: 400 Bad Request
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |
+            Function 'given' expects an assignment expression
+            While translating:
+                /today() :given now()
                                 ^^^^^
         - uri: /exists(school{code,name})
           status: 400 Bad Request
             While translating:
                 /department.(school^campus)
                              ^^^^^^
-        - uri: /department{code, count($school^campus)} :where $school:=school
+        - uri: /department{code, count($school^campus)} :given $school:=school
           status: 400 Bad Request
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
           body: |
             Expected a descendant expression
             While translating:
-                /department{code, count($school^campus)} :where $school:=school
+                /department{code, count($school^campus)} :given $school:=school
                                                                          ^^^^^^
         - uri: /school^true()
           status: 400 Bad Request
             While translating:
                 /department{code, count(school{code})}
                                   ^^^^^^^^^^^^^^^^^^^
-        - uri: /department{code, count($school{code})} :where $school:=school
+        - uri: /department{code, count($school{code})} :given $school:=school
           status: 400 Bad Request
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
           body: |
             Expected a descendant operand
             While translating:
-                /department{code, count($school{code})} :where $school:=school
+                /department{code, count($school{code})} :given $school:=school
                                   ^^^^^^^^^^^^^^^^^^^^
         - uri: /school{code, count(program|department)}
           status: 400 Bad Request

test/output/mysql.yaml

                                   ON (`department`.`code` = `course`.`department_code`)
              ORDER BY `department`.`code` ASC
         - uri: /department{name, {count(sophomore), max(sophomore.credits), min(sophomore.credits),
-            avg(sophomore.credits) } :where(sophomore := course?no>=200&no<300)}
+            avg(sophomore.credits) } :given(sophomore := course?no>=200&no<300)}
           status: 200 OK
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
              | Wind                   |                0 |                        |                        |                                  |
 
              ----
-             /department{name,{count(sophomore),max(sophomore.credits),min(sophomore.credits),avg(sophomore.credits)} :where(sophomore:=course?no>=200&no<300)}
+             /department{name,{count(sophomore),max(sophomore.credits),min(sophomore.credits),avg(sophomore.credits)} :given(sophomore:=course?no>=200&no<300)}
              SELECT `department`.`name`,
                     COALESCE(`course`.`count`, 0),
                     `course`.`max`,
                                   ON (`department`.`code` = `course`.`department_code`)
              ORDER BY `department`.`code` ASC
         - uri: /department.define( stats($level) := {count(set), max(set.credits),
-            min(set.credits), avg(set.credits) } :where set := course?no>=$level*100
+            min(set.credits), avg(set.credits) } :given set := course?no>=$level*100
             &no<($level+1)*100) {name, stats(1), stats(2), stats(3), stats(4)}
           status: 200 OK
           headers:
              | Wind                   |          0 |                  |                  |                                  |          0 |                  |                  |                                  |          0 |                  |                  |                                  |          0 |                  |                  |                                  |
 
              ----
-             /department.define(stats($level):={count(set),max(set.credits),min(set.credits),avg(set.credits)} :where set:=course?no>=$level*100&no<($level+1)*100){name,stats(1),stats(2),stats(3),stats(4)}
+             /department.define(stats($level):={count(set),max(set.credits),min(set.credits),avg(set.credits)} :given set:=course?no>=$level*100&no<($level+1)*100){name,stats(1),stats(2),stats(3),stats(4)}
              SELECT `department`.`name`,
                     COALESCE(`course`.`count_1`, 0),
                     `course`.`max_1`,
                                   ON TRUE
              WHERE (CAST(`course_1`.`credits` AS DECIMAL(65,30)) > `course_2`.`avg`)
              ORDER BY 1 ASC, 2 ASC
-        - uri: /course?credits>$avg_credits :where $avg_credits := avg(course.credits)
+        - uri: /course?credits>$avg_credits :given $avg_credits := avg(course.credits)
           status: 200 OK
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
              | tched           | 640 | Practice of Language Teaching    |       6 | " "                              |
 
              ----
-             /course?credits>$avg_credits :where $avg_credits:=avg(course.credits)
+             /course?credits>$avg_credits :given $avg_credits:=avg(course.credits)
              SELECT `course_1`.`department_code`,
                     `course_1`.`no`,
                     `course_1`.`title`,
                                     ON (`department`.`code` = `course_2`.`department_code`)
                ORDER BY 1 ASC
                LIMIT 3
-          - uri: /course?credits=$max_credits :where $max_credits := max(course.credits)
+          - uri: /course?credits=$max_credits :given $max_credits := max(course.credits)
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                :                 :     :                            :         : industrial setting.              :
 
                ----
-               /course?credits=$max_credits :where $max_credits:=max(course.credits)
+               /course?credits=$max_credits :given $max_credits:=max(course.credits)
                SELECT `course_1`.`department_code`,
                       `course_1`.`no`,
                       `course_1`.`title`,
                                     ON TRUE
                WHERE (`course_1`.`credits` = `course_2`.`max`)
                ORDER BY 1 ASC, 2 ASC
-          - uri: /department{code, count(course?credits=$max_credits)}.limit(10) :where
+          - uri: /department{code, count(course?credits=$max_credits)}.limit(10) :given
               department.$max_credits := max(course.credits)
             status: 200 OK
             headers:
                | edpol  |                                 15 |
 
                ----
-               /department{code,count(course?credits=$max_credits)}.limit(10) :where department.$max_credits:=max(course.credits)
+               /department{code,count(course?credits=$max_credits)}.limit(10) :given department.$max_credits:=max(course.credits)
                SELECT `department`.`code`,
                       COALESCE(`course`.`count`, 0)
                FROM `department`
                WHERE (CAST(COALESCE(`student`.`count`, 0) AS DECIMAL(65,30)) > `program_2`.`avg`)
                ORDER BY `school`.`code` ASC, 1 ASC, 2 ASC
           - uri: /program{school_code,code,count(student)}?count(student)>avg(fork().count(student))
-              :where program := program?school_code='eng'
+              :given program := program?school_code='eng'
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | eng         | umech    |             11 |
 
                ----
-               /program{school_code,code,count(student)}?count(student)>avg(fork().count(student)) :where program:=program?school_code='eng'
+               /program{school_code,code,count(student)}?count(student)>avg(fork().count(student)) :given program:=program?school_code='eng'
                SELECT `program_1`.`school_code`,
                       `program_1`.`code`,
                       COALESCE(`student`.`count`, 0)
                      AND (`program_1`.`school_code` = 'eng')
                ORDER BY 1 ASC, 2 ASC
           - uri: /program{school_code,code,count(student)}?count(student)>avg(fork(school_code).count(student))
-              :where program := program.limit(10,15)
+              :given program := program.limit(10,15)
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | eng         | umech    |             11 |
 
                ----
-               /program{school_code,code,count(student)}?count(student)>avg(fork(school_code).count(student)) :where program:=program.limit(10,15)
+               /program{school_code,code,count(student)}?count(student)>avg(fork(school_code).count(student)) :given program:=program.limit(10,15)
                SELECT `program_1`.`school_code`,
                       `program_1`.`code`,
                       COALESCE(`student`.`count`, 0)
                  FROM `program`
                  WHERE (`program`.`degree` IS NOT NULL)
                  ORDER BY 3 ASC, 1 ASC, 2 ASC
-          - uri: /school[$id] :where $id:='ns'
+          - uri: /school[$id] :given $id:='ns'
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | ns   | School of Natural Sciences | old    |
 
                ----
-               /school[$id] :where $id:='ns'
+               /school[$id] :given $id:='ns'
                SELECT `school`.`code`,
                       `school`.`name`,
                       `school`.`campus`
                FROM `school`
                WHERE (`school`.`code` = 'ns')
                ORDER BY 1 ASC
-          - uri: /course[$id]{id(), title} :where $id:=[astro.105]
+          - uri: /course[$id]{id(), title} :given $id:=[astro.105]
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | astro.105 | General Astronomy I |
 
                ----
-               /course[$id]{id(),title} :where $id:=[astro.105]
+               /course[$id]{id(),title} :given $id:=[astro.105]
                SELECT `course`.`department_code`,
                       `course`.`no`,
                       `course`.`title`
                WHERE (`course`.`department_code` = 'astro')
                      AND (`course`.`no` = 105)
                ORDER BY 1 ASC, 2 ASC
-          - uri: /class[$course.$season.001] :where ($course:=[astro.105], $season:=[2009.spring])
+          - uri: /class[$course.$season.001] :given ($course:=[astro.105], $season:=[2009.spring])
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | astro           |       105 | 2009 | spring | 001     | mtriplett       |      1167 |
 
                ----
-               /class[$course.$season.001] :where($course:=[astro.105],$season:=[2009.spring])
+               /class[$course.$season.001] :given($course:=[astro.105],$season:=[2009.spring])
                SELECT `class`.`department_code`,
                       `class`.`course_no`,
                       `class`.`year`,
               While translating:
                   /program^degree{id()}
                                   ^^^^
-          - uri: /course[$id]{id(), title} :where $id:='astro.105'
+          - uri: /course[$id]{id(), title} :given $id:='astro.105'
             status: 400 Bad Request
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
             body: |
               Found ill-formed locator
               While translating:
-                  /course[$id]{id(), title} :where $id:='astro.105'
+                  /course[$id]{id(), title} :given $id:='astro.105'
                          ^^^^^
         - id: table-expressions
           tests:
                WHERE (NOT `student`.`is_active`)
                ORDER BY `student`.`id` ASC
           - uri: /school{code,{count(student), count(student?gender='m'), count(student?gender='f')}
-              :where(student:=program.student?is_active)}
+              :given(student:=program.student?is_active)}
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | sc   |              0 |                         0 |                         0 |
 
                ----
-               /school{code,{count(student),count(student?gender='m'),count(student?gender='f')} :where(student:=program.student?is_active)}
+               /school{code,{count(student),count(student?gender='m'),count(student?gender='f')} :given(student:=program.student?is_active)}
                SELECT `school`.`code`,
                       COALESCE(`student`.`count_1`, 0),
                       COALESCE(`student`.`count_2`, 0),
               While translating:
                   /school.define(student_by_year($year) := program.student?year(dob)=$year) {code, student_by_year(1990).$year}
                                                                                                                          ^^^^^
-          - uri: /define(f($x) := $x*2){{$x, f($x)} :where $x := 21}
+          - uri: /define(f($x) := $x*2){{$x, f($x)} :given $x := 21}
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | 21 |    42 |
 
                ----
-               /define(f($x):=$x*2){{$x,f($x)} :where $x:=21}
+               /define(f($x):=$x*2){{$x,f($x)} :given $x:=21}
                SELECT 21,
                       (21 * 2)
           - uri: /school{code, num_dept := count(department)}?num_dept>3
                          ^^^^^^^
       - id: lookup-hints
         tests:
-        - uri: /school?code=$scool_code :where $school_code:='art'
+        - uri: /school?code=$scool_code :given $school_code:='art'
           status: 400 Bad Request
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
             Perhaps you had in mind:
                 $school_code
             While translating:
-                /school?code=$scool_code :where $school_code:='art'
+                /school?code=$scool_code :given $school_code:='art'
                              ^^^^^^^^^^^
-        - uri: /school?code=$code :where $school_code:='art'
+        - uri: /school?code=$code :given $school_code:='art'
           status: 400 Bad Request
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
             Found unknown reference:
                 $code
             While translating:
-                /school?code=$code :where $school_code:='art'
+                /school?code=$code :given $school_code:='art'
                              ^^^^^
-        - uri: /school?code=$scool_code :where ($school_code1:='art', $school_code2:='eng',
+        - uri: /school?code=$scool_code :given ($school_code1:='art', $school_code2:='eng',
             $school_code3:='mus')
           status: 400 Bad Request
           headers:
                 $school_code2
                 $school_code3
             While translating:
-                /school?code=$scool_code :where ($school_code1:='art', $school_code2:='eng', $school_code3:='mus')
+                /school?code=$scool_code :given ($school_code1:='art', $school_code2:='eng', $school_code3:='mus')
                              ^^^^^^^^^^^
-        - uri: /school?code=school_code :where $school_code:='art'
+        - uri: /school?code=school_code :given $school_code:='art'
           status: 400 Bad Request
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
             Perhaps you had in mind:
                 a reference '$school_code'
             While translating:
-                /school?code=school_code :where $school_code:='art'
+                /school?code=school_code :given $school_code:='art'
                              ^^^^^^^^^^^
         - uri: /school{code, count{department}}
           status: 400 Bad Request
             While translating:
                 /define(today()){now()}
                         ^^^^^^^
-        - uri: /today() :where now()
-          status: 400 Bad Request
-          headers:
-          - [Content-Type, text/plain; charset=UTF-8]
-          body: |
-            Function 'where' expects an assignment expression
-            While translating:
-                /today() :where now()
+        - uri: /today() :given now()
+          status: 400 Bad Request
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |
+            Function 'given' expects an assignment expression
+            While translating:
+                /today() :given now()
                                 ^^^^^
         - uri: /exists(school{code,name})
           status: 400 Bad Request
             While translating:
                 /department.(school^campus)
                              ^^^^^^
-        - uri: /department{code, count($school^campus)} :where $school:=school
+        - uri: /department{code, count($school^campus)} :given $school:=school
           status: 400 Bad Request
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
           body: |
             Expected a descendant expression
             While translating:
-                /department{code, count($school^campus)} :where $school:=school
+                /department{code, count($school^campus)} :given $school:=school
                                                                          ^^^^^^
         - uri: /school^true()
           status: 400 Bad Request
             While translating:
                 /department{code, count(school{code})}
                                   ^^^^^^^^^^^^^^^^^^^
-        - uri: /department{code, count($school{code})} :where $school:=school
+        - uri: /department{code, count($school{code})} :given $school:=school
           status: 400 Bad Request
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
           body: |
             Expected a descendant operand
             While translating:
-                /department{code, count($school{code})} :where $school:=school
+                /department{code, count($school{code})} :given $school:=school
                                   ^^^^^^^^^^^^^^^^^^^^
         - uri: /school{code, count(program|department)}
           status: 400 Bad Request

test/output/oracle.yaml

                                   ON ("DEPARTMENT"."CODE" = "COURSE"."DEPARTMENT_CODE")
              ORDER BY "DEPARTMENT"."CODE" ASC
         - uri: /department{name, {count(sophomore), max(sophomore.credits), min(sophomore.credits),
-            avg(sophomore.credits) } :where(sophomore := course?no>=200&no<300)}
+            avg(sophomore.credits) } :given(sophomore := course?no>=200&no<300)}
           status: 200 OK
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
              | Wind                   |                0 |                        |                        |                                          |
 
              ----
-             /department{name,{count(sophomore),max(sophomore.credits),min(sophomore.credits),avg(sophomore.credits)} :where(sophomore:=course?no>=200&no<300)}
+             /department{name,{count(sophomore),max(sophomore.credits),min(sophomore.credits),avg(sophomore.credits)} :given(sophomore:=course?no>=200&no<300)}
              SELECT "DEPARTMENT"."NAME",
                     COALESCE("COURSE"."count", 0),
                     "COURSE"."max",
                                   ON ("DEPARTMENT"."CODE" = "COURSE"."DEPARTMENT_CODE")
              ORDER BY "DEPARTMENT"."CODE" ASC
         - uri: /department.define( stats($level) := {count(set), max(set.credits),
-            min(set.credits), avg(set.credits) } :where set := course?no>=$level*100
+            min(set.credits), avg(set.credits) } :given set := course?no>=$level*100
             &no<($level+1)*100) {name, stats(1), stats(2), stats(3), stats(4)}
           status: 200 OK
           headers:
              | Wind                   |          0 |                  |                  |                                          |          0 |                  |                  |                                          |          0 |                  |                  |                                          |          0 |                  |                  |                                          |
 
              ----
-             /department.define(stats($level):={count(set),max(set.credits),min(set.credits),avg(set.credits)} :where set:=course?no>=$level*100&no<($level+1)*100){name,stats(1),stats(2),stats(3),stats(4)}
+             /department.define(stats($level):={count(set),max(set.credits),min(set.credits),avg(set.credits)} :given set:=course?no>=$level*100&no<($level+1)*100){name,stats(1),stats(2),stats(3),stats(4)}
              SELECT "DEPARTMENT"."NAME",
                     COALESCE("COURSE"."count_1", 0),
                     "COURSE"."max_1",
                                   ON (1 <> 0)
              WHERE ("COURSE_1"."CREDITS" > "COURSE_2"."avg")
              ORDER BY 1 ASC, 2 ASC
-        - uri: /course?credits>$avg_credits :where $avg_credits := avg(course.credits)
+        - uri: /course?credits>$avg_credits :given $avg_credits := avg(course.credits)
           status: 200 OK
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
              | tched           | 640 | Practice of Language Teaching    |       6 | " "                              |
 
              ----
-             /course?credits>$avg_credits :where $avg_credits:=avg(course.credits)
+             /course?credits>$avg_credits :given $avg_credits:=avg(course.credits)
              SELECT "COURSE_1"."DEPARTMENT_CODE",
                     "COURSE_1"."NO",
                     "COURSE_1"."TITLE",
                                      GROUP BY "COURSE_1"."DEPARTMENT_CODE") "COURSE_2"
                                     ON ("DEPARTMENT"."CODE" = "COURSE_2"."DEPARTMENT_CODE")
                ORDER BY 1 ASC
-          - uri: /course?credits=$max_credits :where $max_credits := max(course.credits)
+          - uri: /course?credits=$max_credits :given $max_credits := max(course.credits)
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                :                 :     :                            :         : industrial setting.              :
 
                ----
-               /course?credits=$max_credits :where $max_credits:=max(course.credits)
+               /course?credits=$max_credits :given $max_credits:=max(course.credits)
                SELECT "COURSE_1"."DEPARTMENT_CODE",
                       "COURSE_1"."NO",
                       "COURSE_1"."TITLE",
                                     ON (1 <> 0)
                WHERE ("COURSE_1"."CREDITS" = "COURSE_2"."max")
                ORDER BY 1 ASC, 2 ASC
-          - uri: /department{code, count(course?credits=$max_credits)}.limit(10) :where
+          - uri: /department{code, count(course?credits=$max_credits)}.limit(10) :given
               department.$max_credits := max(course.credits)
             status: 200 OK
             headers:
                | edpol  |                                 15 |
 
                ----
-               /department{code,count(course?credits=$max_credits)}.limit(10) :where department.$max_credits:=max(course.credits)
+               /department{code,count(course?credits=$max_credits)}.limit(10) :given department.$max_credits:=max(course.credits)
                SELECT "DEPARTMENT"."CODE",
                       COALESCE("COURSE"."count", 0)
                FROM (SELECT "DEPARTMENT"."CODE"
                WHERE (CAST(COALESCE("STUDENT"."count", 0) AS NUMBER) > "PROGRAM_2"."avg")
                ORDER BY "SCHOOL"."CODE" ASC, 1 ASC, 2 ASC
           - uri: /program{school_code,code,count(student)}?count(student)>avg(fork().count(student))
-              :where program := program?school_code='eng'
+              :given program := program?school_code='eng'
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | eng         | umech    |             11 |
 
                ----
-               /program{school_code,code,count(student)}?count(student)>avg(fork().count(student)) :where program:=program?school_code='eng'
+               /program{school_code,code,count(student)}?count(student)>avg(fork().count(student)) :given program:=program?school_code='eng'
                SELECT "PROGRAM_1"."SCHOOL_CODE",
                       "PROGRAM_1"."CODE",
                       COALESCE("STUDENT"."count", 0)
                      AND ("PROGRAM_1"."SCHOOL_CODE" = 'eng')
                ORDER BY 1 ASC, 2 ASC
           - uri: /program{school_code,code,count(student)}?count(student)>avg(fork(school_code).count(student))
-              :where program := program.limit(10,15)
+              :given program := program.limit(10,15)
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | eng         | umech    |             11 |
 
                ----
-               /program{school_code,code,count(student)}?count(student)>avg(fork(school_code).count(student)) :where program:=program.limit(10,15)
+               /program{school_code,code,count(student)}?count(student)>avg(fork(school_code).count(student)) :given program:=program.limit(10,15)
                SELECT "PROGRAM_1"."SCHOOL_CODE",
                       "PROGRAM_1"."CODE",
                       COALESCE("STUDENT"."count", 0)
                  FROM "PROGRAM"
                  WHERE ("PROGRAM"."DEGREE" IS NOT NULL)
                  ORDER BY 3 ASC NULLS FIRST, 1 ASC, 2 ASC
-          - uri: /school[$id] :where $id:='ns'
+          - uri: /school[$id] :given $id:='ns'
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | ns   | School of Natural Sciences | old    |
 
                ----
-               /school[$id] :where $id:='ns'
+               /school[$id] :given $id:='ns'
                SELECT "SCHOOL"."CODE",
                       "SCHOOL"."NAME",
                       "SCHOOL"."CAMPUS"
                FROM "SCHOOL"
                WHERE ("SCHOOL"."CODE" = 'ns')
                ORDER BY 1 ASC
-          - uri: /course[$id]{id(), title} :where $id:=[astro.105]
+          - uri: /course[$id]{id(), title} :given $id:=[astro.105]
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | astro.105 | General Astronomy I |
 
                ----
-               /course[$id]{id(),title} :where $id:=[astro.105]
+               /course[$id]{id(),title} :given $id:=[astro.105]
                SELECT "COURSE"."DEPARTMENT_CODE",
                       "COURSE"."NO",
                       "COURSE"."TITLE"
                WHERE ("COURSE"."DEPARTMENT_CODE" = 'astro')
                      AND ("COURSE"."NO" = 105)
                ORDER BY 1 ASC, 2 ASC
-          - uri: /class[$course.$season.001] :where ($course:=[astro.105], $season:=[2009.spring])
+          - uri: /class[$course.$season.001] :given ($course:=[astro.105], $season:=[2009.spring])
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | astro           |       105 | 2009 | spring | 001     | mtriplett       |      1167 |
 
                ----
-               /class[$course.$season.001] :where($course:=[astro.105],$season:=[2009.spring])
+               /class[$course.$season.001] :given($course:=[astro.105],$season:=[2009.spring])
                SELECT "CLASS"."DEPARTMENT_CODE",
                       "CLASS"."COURSE_NO",
                       "CLASS"."YEAR",
               While translating:
                   /program^degree{id()}
                                   ^^^^
-          - uri: /course[$id]{id(), title} :where $id:='astro.105'
+          - uri: /course[$id]{id(), title} :given $id:='astro.105'
             status: 400 Bad Request
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
             body: |
               Found ill-formed locator
               While translating:
-                  /course[$id]{id(), title} :where $id:='astro.105'
+                  /course[$id]{id(), title} :given $id:='astro.105'
                          ^^^^^
         - id: table-expressions
           tests:
                WHERE (NOT ("STUDENT"."IS_ACTIVE" <> 0))
                ORDER BY "STUDENT"."ID" ASC
           - uri: /school{code,{count(student), count(student?gender='m'), count(student?gender='f')}
-              :where(student:=program.student?is_active)}
+              :given(student:=program.student?is_active)}
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | sc   |              0 |                         0 |                         0 |
 
                ----
-               /school{code,{count(student),count(student?gender='m'),count(student?gender='f')} :where(student:=program.student?is_active)}
+               /school{code,{count(student),count(student?gender='m'),count(student?gender='f')} :given(student:=program.student?is_active)}
                SELECT "SCHOOL"."CODE",
                       COALESCE("STUDENT"."count_1", 0),
                       COALESCE("STUDENT"."count_2", 0),
               While translating:
                   /school.define(student_by_year($year) := program.student?year(dob)=$year) {code, student_by_year(1990).$year}
                                                                                                                          ^^^^^
-          - uri: /define(f($x) := $x*2){{$x, f($x)} :where $x := 21}
+          - uri: /define(f($x) := $x*2){{$x, f($x)} :given $x := 21}
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | 21 |    42 |
 
                ----
-               /define(f($x):=$x*2){{$x,f($x)} :where $x:=21}
+               /define(f($x):=$x*2){{$x,f($x)} :given $x:=21}
                SELECT 21,
                       (21 * 2)
                FROM DUAL "!"
                          ^^^^^^^
       - id: lookup-hints
         tests:
-        - uri: /school?code=$scool_code :where $school_code:='art'
+        - uri: /school?code=$scool_code :given $school_code:='art'
           status: 400 Bad Request
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
             Perhaps you had in mind:
                 $school_code
             While translating:
-                /school?code=$scool_code :where $school_code:='art'
+                /school?code=$scool_code :given $school_code:='art'
                              ^^^^^^^^^^^
-        - uri: /school?code=$code :where $school_code:='art'
+        - uri: /school?code=$code :given $school_code:='art'
           status: 400 Bad Request
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
             Found unknown reference:
                 $code
             While translating:
-                /school?code=$code :where $school_code:='art'
+                /school?code=$code :given $school_code:='art'
                              ^^^^^
-        - uri: /school?code=$scool_code :where ($school_code1:='art', $school_code2:='eng',
+        - uri: /school?code=$scool_code :given ($school_code1:='art', $school_code2:='eng',
             $school_code3:='mus')
           status: 400 Bad Request
           headers:
                 $school_code2
                 $school_code3
             While translating:
-                /school?code=$scool_code :where ($school_code1:='art', $school_code2:='eng', $school_code3:='mus')
+                /school?code=$scool_code :given ($school_code1:='art', $school_code2:='eng', $school_code3:='mus')
                              ^^^^^^^^^^^
-        - uri: /school?code=school_code :where $school_code:='art'
+        - uri: /school?code=school_code :given $school_code:='art'
           status: 400 Bad Request
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
             Perhaps you had in mind:
                 a reference '$school_code'
             While translating:
-                /school?code=school_code :where $school_code:='art'
+                /school?code=school_code :given $school_code:='art'
                              ^^^^^^^^^^^
         - uri: /school{code, count{department}}
           status: 400 Bad Request
             While translating:
                 /define(today()){now()}
                         ^^^^^^^
-        - uri: /today() :where now()
-          status: 400 Bad Request
-          headers:
-          - [Content-Type, text/plain; charset=UTF-8]
-          body: |
-            Function 'where' expects an assignment expression
-            While translating:
-                /today() :where now()
+        - uri: /today() :given now()
+          status: 400 Bad Request
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |
+            Function 'given' expects an assignment expression
+            While translating:
+                /today() :given now()
                                 ^^^^^
         - uri: /exists(school{code,name})
           status: 400 Bad Request
             While translating:
                 /department.(school^campus)
                              ^^^^^^
-        - uri: /department{code, count($school^campus)} :where $school:=school
+        - uri: /department{code, count($school^campus)} :given $school:=school
           status: 400 Bad Request
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
           body: |
             Expected a descendant expression
             While translating:
-                /department{code, count($school^campus)} :where $school:=school
+                /department{code, count($school^campus)} :given $school:=school
                                                                          ^^^^^^
         - uri: /school^true()
           status: 400 Bad Request
             While translating:
                 /department{code, count(school{code})}
                                   ^^^^^^^^^^^^^^^^^^^
-        - uri: /department{code, count($school{code})} :where $school:=school
+        - uri: /department{code, count($school{code})} :given $school:=school
           status: 400 Bad Request
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
           body: |
             Expected a descendant operand
             While translating:
-                /department{code, count($school{code})} :where $school:=school
+                /department{code, count($school{code})} :given $school:=school
                                   ^^^^^^^^^^^^^^^^^^^^
         - uri: /school{code, count(program|department)}
           status: 400 Bad Request

test/output/pgsql.yaml

                                   ON ("department"."code" = "course"."department_code")
              ORDER BY "department"."code" ASC
         - uri: /department{name, {count(sophomore), max(sophomore.credits), min(sophomore.credits),
-            avg(sophomore.credits) } :where(sophomore := course?no>=200&no<300)}
+            avg(sophomore.credits) } :given(sophomore := course?no>=200&no<300)}
           status: 200 OK
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
              | Wind                   |                0 |                        |                        |                        |
 
              ----
-             /department{name,{count(sophomore),max(sophomore.credits),min(sophomore.credits),avg(sophomore.credits)} :where(sophomore:=course?no>=200&no<300)}
+             /department{name,{count(sophomore),max(sophomore.credits),min(sophomore.credits),avg(sophomore.credits)} :given(sophomore:=course?no>=200&no<300)}
              SELECT "department"."name",
                     COALESCE("course"."count", 0),
                     "course"."max",
                                   ON ("department"."code" = "course"."department_code")
              ORDER BY "department"."code" ASC
         - uri: /department.define( stats($level) := {count(set), max(set.credits),
-            min(set.credits), avg(set.credits) } :where set := course?no>=$level*100
+            min(set.credits), avg(set.credits) } :given set := course?no>=$level*100
             &no<($level+1)*100) {name, stats(1), stats(2), stats(3), stats(4)}
           status: 200 OK
           headers:
              | Wind                   |          0 |                  |                  |                    |          0 |                  |                  |                    |          0 |                  |                  |                    |          0 |                  |                  |                    |
 
              ----
-             /department.define(stats($level):={count(set),max(set.credits),min(set.credits),avg(set.credits)} :where set:=course?no>=$level*100&no<($level+1)*100){name,stats(1),stats(2),stats(3),stats(4)}
+             /department.define(stats($level):={count(set),max(set.credits),min(set.credits),avg(set.credits)} :given set:=course?no>=$level*100&no<($level+1)*100){name,stats(1),stats(2),stats(3),stats(4)}
              SELECT "department"."name",
                     COALESCE("course"."count_1", 0),
                     "course"."max_1",
                                   ON TRUE
              WHERE (CAST("course_1"."credits" AS NUMERIC) > "course_2"."avg")
              ORDER BY 1 ASC, 2 ASC
-        - uri: /course?credits>$avg_credits :where $avg_credits := avg(course.credits)
+        - uri: /course?credits>$avg_credits :given $avg_credits := avg(course.credits)
           status: 200 OK
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
              | tched           | 640 | Practice of Language Teaching    |       6 | " "                              |
 
              ----
-             /course?credits>$avg_credits :where $avg_credits:=avg(course.credits)
+             /course?credits>$avg_credits :given $avg_credits:=avg(course.credits)
              SELECT "course_1"."department_code",
                     "course_1"."no",
                     "course_1"."title",
                                     ON ("department"."code" = "course_2"."department_code")
                ORDER BY 1 ASC
                LIMIT 3
-          - uri: /course?credits=$max_credits :where $max_credits := max(course.credits)
+          - uri: /course?credits=$max_credits :given $max_credits := max(course.credits)
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                :                 :     :                            :         : industrial setting.              :
 
                ----
-               /course?credits=$max_credits :where $max_credits:=max(course.credits)
+               /course?credits=$max_credits :given $max_credits:=max(course.credits)
                SELECT "course_1"."department_code",
                       "course_1"."no",
                       "course_1"."title",
                                     ON TRUE
                WHERE ("course_1"."credits" = "course_2"."max")
                ORDER BY 1 ASC, 2 ASC
-          - uri: /department{code, count(course?credits=$max_credits)}.limit(10) :where
+          - uri: /department{code, count(course?credits=$max_credits)}.limit(10) :given
               department.$max_credits := max(course.credits)
             status: 200 OK
             headers:
                | edpol  |                                 15 |
 
                ----
-               /department{code,count(course?credits=$max_credits)}.limit(10) :where department.$max_credits:=max(course.credits)
+               /department{code,count(course?credits=$max_credits)}.limit(10) :given department.$max_credits:=max(course.credits)
                SELECT "department"."code",
                       COALESCE("course"."count", 0)
                FROM "ad"."department"
                WHERE (CAST(COALESCE("student"."count", 0) AS NUMERIC) > "program_2"."avg")
                ORDER BY "school"."code" ASC, 1 ASC, 2 ASC
           - uri: /program{school_code,code,count(student)}?count(student)>avg(fork().count(student))
-              :where program := program?school_code='eng'
+              :given program := program?school_code='eng'
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | eng         | umech    |             11 |
 
                ----
-               /program{school_code,code,count(student)}?count(student)>avg(fork().count(student)) :where program:=program?school_code='eng'
+               /program{school_code,code,count(student)}?count(student)>avg(fork().count(student)) :given program:=program?school_code='eng'
                SELECT "program_1"."school_code",
                       "program_1"."code",
                       COALESCE("student"."count", 0)
                      AND ("program_1"."school_code" = 'eng')
                ORDER BY 1 ASC, 2 ASC
           - uri: /program{school_code,code,count(student)}?count(student)>avg(fork(school_code).count(student))
-              :where program := program.limit(10,15)
+              :given program := program.limit(10,15)
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | eng         | umech    |             11 |
 
                ----
-               /program{school_code,code,count(student)}?count(student)>avg(fork(school_code).count(student)) :where program:=program.limit(10,15)
+               /program{school_code,code,count(student)}?count(student)>avg(fork(school_code).count(student)) :given program:=program.limit(10,15)
                SELECT "program_1"."school_code",
                       "program_1"."code",
                       COALESCE("student"."count", 0)
                  FROM "ad"."program"
                  WHERE ("program"."degree" IS NOT NULL)
                  ORDER BY 3 ASC NULLS FIRST, 1 ASC, 2 ASC
-          - uri: /school[$id] :where $id:='ns'
+          - uri: /school[$id] :given $id:='ns'
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | ns   | School of Natural Sciences | old    |
 
                ----
-               /school[$id] :where $id:='ns'
+               /school[$id] :given $id:='ns'
                SELECT "school"."code",
                       "school"."name",
                       "school"."campus"
                FROM "ad"."school"
                WHERE ("school"."code" = 'ns')
                ORDER BY 1 ASC
-          - uri: /course[$id]{id(), title} :where $id:=[astro.105]
+          - uri: /course[$id]{id(), title} :given $id:=[astro.105]
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | astro.105 | General Astronomy I |
 
                ----
-               /course[$id]{id(),title} :where $id:=[astro.105]
+               /course[$id]{id(),title} :given $id:=[astro.105]
                SELECT "course"."department_code",
                       "course"."no",
                       "course"."title"
                WHERE ("course"."department_code" = 'astro')
                      AND ("course"."no" = 105)
                ORDER BY 1 ASC, 2 ASC
-          - uri: /class[$course.$season.001] :where ($course:=[astro.105], $season:=[2009.spring])
+          - uri: /class[$course.$season.001] :given ($course:=[astro.105], $season:=[2009.spring])
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | astro           |       105 | 2009 | spring | 001     | mtriplett       |      1167 |
 
                ----
-               /class[$course.$season.001] :where($course:=[astro.105],$season:=[2009.spring])
+               /class[$course.$season.001] :given($course:=[astro.105],$season:=[2009.spring])
                SELECT "class"."department_code",
                       "class"."course_no",
                       "class"."year",
               While translating:
                   /program^degree{id()}
                                   ^^^^
-          - uri: /course[$id]{id(), title} :where $id:='astro.105'
+          - uri: /course[$id]{id(), title} :given $id:='astro.105'
             status: 400 Bad Request
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
             body: |
               Found ill-formed locator
               While translating:
-                  /course[$id]{id(), title} :where $id:='astro.105'
+                  /course[$id]{id(), title} :given $id:='astro.105'
                          ^^^^^
         - id: table-expressions
           tests:
                WHERE (NOT "student"."is_active")
                ORDER BY "student"."id" ASC
           - uri: /school{code,{count(student), count(student?gender='m'), count(student?gender='f')}
-              :where(student:=program.student?is_active)}
+              :given(student:=program.student?is_active)}
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | sc   |              0 |                         0 |                         0 |
 
                ----
-               /school{code,{count(student),count(student?gender='m'),count(student?gender='f')} :where(student:=program.student?is_active)}
+               /school{code,{count(student),count(student?gender='m'),count(student?gender='f')} :given(student:=program.student?is_active)}
                SELECT "school"."code",
                       COALESCE("student"."count_1", 0),
                       COALESCE("student"."count_2", 0),
               While translating:
                   /school.define(student_by_year($year) := program.student?year(dob)=$year) {code, student_by_year(1990).$year}
                                                                                                                          ^^^^^
-          - uri: /define(f($x) := $x*2){{$x, f($x)} :where $x := 21}
+          - uri: /define(f($x) := $x*2){{$x, f($x)} :given $x := 21}
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | 21 |    42 |
 
                ----
-               /define(f($x):=$x*2){{$x,f($x)} :where $x:=21}
+               /define(f($x):=$x*2){{$x,f($x)} :given $x:=21}
                SELECT 21,
                       (21 * 2)
           - uri: /school{code, num_dept := count(department)}?num_dept>3
                          ^^^^^^^
       - id: lookup-hints
         tests:
-        - uri: /school?code=$scool_code :where $school_code:='art'
+        - uri: /school?code=$scool_code :given $school_code:='art'
           status: 400 Bad Request
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
             Perhaps you had in mind:
                 $school_code
             While translating:
-                /school?code=$scool_code :where $school_code:='art'
+                /school?code=$scool_code :given $school_code:='art'
                              ^^^^^^^^^^^
-        - uri: /school?code=$code :where $school_code:='art'
+        - uri: /school?code=$code :given $school_code:='art'
           status: 400 Bad Request
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
             Found unknown reference:
                 $code
             While translating:
-                /school?code=$code :where $school_code:='art'
+                /school?code=$code :given $school_code:='art'
                              ^^^^^
-        - uri: /school?code=$scool_code :where ($school_code1:='art', $school_code2:='eng',
+        - uri: /school?code=$scool_code :given ($school_code1:='art', $school_code2:='eng',
             $school_code3:='mus')
           status: 400 Bad Request
           headers:
                 $school_code2
                 $school_code3
             While translating:
-                /school?code=$scool_code :where ($school_code1:='art', $school_code2:='eng', $school_code3:='mus')
+                /school?code=$scool_code :given ($school_code1:='art', $school_code2:='eng', $school_code3:='mus')
                              ^^^^^^^^^^^
-        - uri: /school?code=school_code :where $school_code:='art'
+        - uri: /school?code=school_code :given $school_code:='art'
           status: 400 Bad Request
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
             Perhaps you had in mind:
                 a reference '$school_code'
             While translating:
-                /school?code=school_code :where $school_code:='art'
+                /school?code=school_code :given $school_code:='art'
                              ^^^^^^^^^^^
         - uri: /school{code, count{department}}
           status: 400 Bad Request
             While translating:
                 /define(today()){now()}
                         ^^^^^^^
-        - uri: /today() :where now()
-          status: 400 Bad Request
-          headers:
-          - [Content-Type, text/plain; charset=UTF-8]
-          body: |
-            Function 'where' expects an assignment expression
-            While translating:
-                /today() :where now()
+        - uri: /today() :given now()
+          status: 400 Bad Request
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |
+            Function 'given' expects an assignment expression
+            While translating:
+                /today() :given now()
                                 ^^^^^
         - uri: /exists(school{code,name})
           status: 400 Bad Request
             While translating:
                 /department.(school^campus)
                              ^^^^^^
-        - uri: /department{code, count($school^campus)} :where $school:=school
+        - uri: /department{code, count($school^campus)} :given $school:=school
           status: 400 Bad Request
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
           body: |
             Expected a descendant expression
             While translating:
-                /department{code, count($school^campus)} :where $school:=school
+                /department{code, count($school^campus)} :given $school:=school
                                                                          ^^^^^^
         - uri: /school^true()
           status: 400 Bad Request
             While translating:
                 /department{code, count(school{code})}
                                   ^^^^^^^^^^^^^^^^^^^
-        - uri: /department{code, count($school{code})} :where $school:=school
+        - uri: /department{code, count($school{code})} :given $school:=school
           status: 400 Bad Request
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
           body: |
             Expected a descendant operand
             While translating:
-                /department{code, count($school{code})} :where $school:=school
+                /department{code, count($school{code})} :given $school:=school
                                   ^^^^^^^^^^^^^^^^^^^^
         - uri: /school{code, count(program|department)}
           status: 400 Bad Request

test/output/sqlite.yaml

                                   ON ("department"."code" = "course"."department_code")
              ORDER BY "department"."code" ASC
         - uri: /department{name, {count(sophomore), max(sophomore.credits), min(sophomore.credits),
-            avg(sophomore.credits) } :where(sophomore := course?no>=200&no<300)}
+            avg(sophomore.credits) } :given(sophomore := course?no>=200&no<300)}
           status: 200 OK
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
              | Wind                   |                0 |                        |                        |                        |
 
              ----
-             /department{name,{count(sophomore),max(sophomore.credits),min(sophomore.credits),avg(sophomore.credits)} :where(sophomore:=course?no>=200&no<300)}
+             /department{name,{count(sophomore),max(sophomore.credits),min(sophomore.credits),avg(sophomore.credits)} :given(sophomore:=course?no>=200&no<300)}
              SELECT "department"."name",
                     COALESCE("course"."count", 0),
                     "course"."max",
                                   ON ("department"."code" = "course"."department_code")
              ORDER BY "department"."code" ASC
         - uri: /department.define( stats($level) := {count(set), max(set.credits),
-            min(set.credits), avg(set.credits) } :where set := course?no>=$level*100
+            min(set.credits), avg(set.credits) } :given set := course?no>=$level*100
             &no<($level+1)*100) {name, stats(1), stats(2), stats(3), stats(4)}
           status: 200 OK
           headers:
              | Wind                   |          0 |                  |                  |                  |          0 |                  |                  |                  |          0 |                  |                  |                  |          0 |                  |                  |                  |
 
              ----
-             /department.define(stats($level):={count(set),max(set.credits),min(set.credits),avg(set.credits)} :where set:=course?no>=$level*100&no<($level+1)*100){name,stats(1),stats(2),stats(3),stats(4)}
+             /department.define(stats($level):={count(set),max(set.credits),min(set.credits),avg(set.credits)} :given set:=course?no>=$level*100&no<($level+1)*100){name,stats(1),stats(2),stats(3),stats(4)}
              SELECT "department"."name",
                     COALESCE("course"."count_1", 0),
                     "course"."max_1",
                                   ON 1
              WHERE (CAST("course_1"."credits" AS REAL) > "course_2"."avg")
              ORDER BY 1 ASC, 2 ASC
-        - uri: /course?credits>$avg_credits :where $avg_credits := avg(course.credits)
+        - uri: /course?credits>$avg_credits :given $avg_credits := avg(course.credits)
           status: 200 OK
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
              | tched           | 640 | Practice of Language Teaching    |       6 | " "                              |
 
              ----
-             /course?credits>$avg_credits :where $avg_credits:=avg(course.credits)
+             /course?credits>$avg_credits :given $avg_credits:=avg(course.credits)
              SELECT "course_1"."department_code",
                     "course_1"."no",
                     "course_1"."title",
                                     ON ("department"."code" = "course_2"."department_code")
                ORDER BY 1 ASC
                LIMIT 3
-          - uri: /course?credits=$max_credits :where $max_credits := max(course.credits)
+          - uri: /course?credits=$max_credits :given $max_credits := max(course.credits)
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                :                 :     :                            :         : industrial setting.              :
 
                ----
-               /course?credits=$max_credits :where $max_credits:=max(course.credits)
+               /course?credits=$max_credits :given $max_credits:=max(course.credits)
                SELECT "course_1"."department_code",
                       "course_1"."no",
                       "course_1"."title",
                                     ON 1
                WHERE ("course_1"."credits" = "course_2"."max")
                ORDER BY 1 ASC, 2 ASC
-          - uri: /department{code, count(course?credits=$max_credits)}.limit(10) :where
+          - uri: /department{code, count(course?credits=$max_credits)}.limit(10) :given
               department.$max_credits := max(course.credits)
             status: 200 OK
             headers:
                | edpol  |                                 15 |
 
                ----
-               /department{code,count(course?credits=$max_credits)}.limit(10) :where department.$max_credits:=max(course.credits)
+               /department{code,count(course?credits=$max_credits)}.limit(10) :given department.$max_credits:=max(course.credits)
                SELECT "department"."code",
                       COALESCE("course"."count", 0)
                FROM "department"
                WHERE (CAST(COALESCE("student"."count", 0) AS REAL) > "program_2"."avg")
                ORDER BY "school"."code" ASC, 1 ASC, 2 ASC
           - uri: /program{school_code,code,count(student)}?count(student)>avg(fork().count(student))
-              :where program := program?school_code='eng'
+              :given program := program?school_code='eng'
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | eng         | umech    |             11 |
 
                ----
-               /program{school_code,code,count(student)}?count(student)>avg(fork().count(student)) :where program:=program?school_code='eng'
+               /program{school_code,code,count(student)}?count(student)>avg(fork().count(student)) :given program:=program?school_code='eng'
                SELECT "program_1"."school_code",
                       "program_1"."code",
                       COALESCE("student"."count", 0)
                      AND ("program_1"."school_code" = 'eng')
                ORDER BY 1 ASC, 2 ASC
           - uri: /program{school_code,code,count(student)}?count(student)>avg(fork(school_code).count(student))
-              :where program := program.limit(10,15)
+              :given program := program.limit(10,15)
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | eng         | umech    |             11 |
 
                ----
-               /program{school_code,code,count(student)}?count(student)>avg(fork(school_code).count(student)) :where program:=program.limit(10,15)
+               /program{school_code,code,count(student)}?count(student)>avg(fork(school_code).count(student)) :given program:=program.limit(10,15)
                SELECT "program_1"."school_code",
                       "program_1"."code",
                       COALESCE("student"."count", 0)
                  FROM "program"
                  WHERE ("program"."degree" IS NOT NULL)
                  ORDER BY 3 ASC, 1 ASC, 2 ASC
-          - uri: /school[$id] :where $id:='ns'
+          - uri: /school[$id] :given $id:='ns'
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | ns   | School of Natural Sciences | old    |
 
                ----
-               /school[$id] :where $id:='ns'
+               /school[$id] :given $id:='ns'
                SELECT "school"."code",
                       "school"."name",
                       "school"."campus"
                FROM "school"
                WHERE ("school"."code" = 'ns')
                ORDER BY 1 ASC
-          - uri: /course[$id]{id(), title} :where $id:=[astro.105]
+          - uri: /course[$id]{id(), title} :given $id:=[astro.105]
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | astro.105 | General Astronomy I |
 
                ----
-               /course[$id]{id(),title} :where $id:=[astro.105]
+               /course[$id]{id(),title} :given $id:=[astro.105]
                SELECT "course"."department_code",
                       "course"."no",
                       "course"."title"
                WHERE ("course"."department_code" = 'astro')
                      AND ("course"."no" = 105)
                ORDER BY 1 ASC, 2 ASC
-          - uri: /class[$course.$season.001] :where ($course:=[astro.105], $season:=[2009.spring])
+          - uri: /class[$course.$season.001] :given ($course:=[astro.105], $season:=[2009.spring])
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | astro           |       105 | 2009 | spring | 001     | mtriplett       |      1167 |
 
                ----
-               /class[$course.$season.001] :where($course:=[astro.105],$season:=[2009.spring])
+               /class[$course.$season.001] :given($course:=[astro.105],$season:=[2009.spring])
                SELECT "class"."department_code",
                       "class"."course_no",
                       "class"."year",
               While translating:
                   /program^degree{id()}
                                   ^^^^
-          - uri: /course[$id]{id(), title} :where $id:='astro.105'
+          - uri: /course[$id]{id(), title} :given $id:='astro.105'
             status: 400 Bad Request
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
             body: |
               Found ill-formed locator
               While translating:
-                  /course[$id]{id(), title} :where $id:='astro.105'
+                  /course[$id]{id(), title} :given $id:='astro.105'
                          ^^^^^
         - id: table-expressions
           tests:
                WHERE (NOT "student"."is_active")
                ORDER BY "student"."id" ASC
           - uri: /school{code,{count(student), count(student?gender='m'), count(student?gender='f')}
-              :where(student:=program.student?is_active)}
+              :given(student:=program.student?is_active)}
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | sc   |              0 |                         0 |                         0 |
 
                ----
-               /school{code,{count(student),count(student?gender='m'),count(student?gender='f')} :where(student:=program.student?is_active)}
+               /school{code,{count(student),count(student?gender='m'),count(student?gender='f')} :given(student:=program.student?is_active)}
                SELECT "school"."code",
                       COALESCE("student"."count_1", 0),
                       COALESCE("student"."count_2", 0),
               While translating:
                   /school.define(student_by_year($year) := program.student?year(dob)=$year) {code, student_by_year(1990).$year}
                                                                                                                          ^^^^^
-          - uri: /define(f($x) := $x*2){{$x, f($x)} :where $x := 21}
+          - uri: /define(f($x) := $x*2){{$x, f($x)} :given $x := 21}
             status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
                | 21 |    42 |
 
                ----
-               /define(f($x):=$x*2){{$x,f($x)} :where $x:=21}
+               /define(f($x):=$x*2){{$x,f($x)} :given $x:=21}
                SELECT 21,
                       (21 * 2)
           - uri: /school{code, num_dept := count(department)}?num_dept>3
                          ^^^^^^^
       - id: lookup-hints
         tests:
-        - uri: /school?code=$scool_code :where $school_code:='art'
+        - uri: /school?code=$scool_code :given $school_code:='art'
           status: 400 Bad Request
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
             Perhaps you had in mind:
                 $school_code
             While translating:
-                /school?code=$scool_code :where $school_code:='art'
+                /school?code=$scool_code :given $school_code:='art'
                              ^^^^^^^^^^^
-        - uri: /school?code=$code :where $school_code:='art'
+        - uri: /school?code=$code :given $school_code:='art'
           status: 400 Bad Request
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
             Found unknown reference:
                 $code
             While translating:
-                /school?code=$code :where $school_code:='art'
+                /school?code=$code :given $school_code:='art'
                              ^^^^^
-        - uri: /school?code=$scool_code :where ($school_code1:='art', $school_code2:='eng',
+        - uri: /school?code=$scool_code :given ($school_code1:='art', $school_code2:='eng',
             $school_code3:='mus')
           status: 400 Bad Request
           headers:
                 $school_code2
                 $school_code3
             While translating:
-                /school?code=$scool_code :where ($school_code1:='art', $school_code2:='eng', $school_code3:='mus')
+                /school?code=$scool_code :given ($school_code1:='art', $school_code2:='eng', $school_code3:='mus')
                              ^^^^^^^^^^^
-        - uri: /school?code=school_code :where $school_code:='art'
+        - uri: /school?code=school_code :given $school_code:='art'
           status: 400 Bad Request
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
             Perhaps you had in mind:
                 a reference '$school_code'
             While translating:
-                /school?code=school_code :where $school_code:='art'