Commits

Kirill Simonov committed 53c752d

top() and locators to inherit their headers from the seed binding.

  • Participants
  • Parent commits 5afd353

Comments (0)

Files changed (6)

File src/htsql/core/tr/lookup.py

         return lookup(self.binding.seed, probe)
 
 
-class GuessTagAndHeaderFromLocator(Lookup):
+class GuessTagHeaderFromLocatorClipPath(Lookup):
 
     adapt_many((LocatorBinding, GuessTagProbe),
-               (LocatorBinding, GuessHeaderProbe))
+               (LocatorBinding, GuessHeaderProbe),
+               (LocatorBinding, GuessPathProbe),
+               (ClipBinding, GuessTagProbe),
+               (ClipBinding, GuessHeaderProbe),
+               (ClipBinding, GuessPathProbe))
 
     def __call__(self):
         return lookup(self.binding.seed, self.probe)

File test/output/mssql.yaml

             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | school:top                             |
+               | school                                 |
                +------+------------------------+--------+
                | code | name                   | campus |
               -+------+------------------------+--------+-
             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | school:top(3)                          |
+               | school                                 |
                +------+------------------------+--------+
                | code | name                   | campus |
               -+------+------------------------+--------+-
             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | school:top(3,2)                               |
+               | school                                        |
                +------+-------------------------------+--------+
                | code | name                          | campus |
               -+------+-------------------------------+--------+-
             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | top(school.sort(count(department)-)) |
-               +------------+-------------------------+
-               | code       | count(department)       |
-              -+------------+-------------------------+-
-               | la         |                       6 |
+               | school                   |
+               +------+-------------------+
+               | code | count(department) |
+              -+------+-------------------+-
+               | la   |                 6 |
 
                ----
                /top(school.sort(count(department)-)){code,count(department)}
             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | top(school.sort(count(department)-),3) |
-               +-------------+--------------------------+
-               | code        | count(department)        |
-              -+-------------+--------------------------+-
-               | la          |                        6 |
-               | eng         |                        4 |
-               | mus         |                        4 |
+               | school                   |
+               +------+-------------------+
+               | code | count(department) |
+              -+------+-------------------+-
+               | la   |                 6 |
+               | eng  |                 4 |
+               | mus  |                 4 |
 
                ----
                /top(school.sort(count(department)-),3){code,count(department)}
             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | top(school.sort(count(department)-),3,2) |
-               +--------------+---------------------------+
-               | code         | count(department)         |
-              -+--------------+---------------------------+-
-               | mus          |                         4 |
-               | ns           |                         4 |
-               | bus          |                         3 |
+               | school                   |
+               +------+-------------------+
+               | code | count(department) |
+              -+------+-------------------+-
+               | mus  |                 4 |
+               | ns   |                 4 |
+               | bus  |                 3 |
 
                ----
                /top(school.sort(count(department)-),3,2){code,count(department)}
             body: |2
                | school                                                                                             |
                +-------------------------------+----------------+---------------------------------------------------+
-               |                               |                | top(program)                                      |
+               |                               |                | program                                           |
                |                               |                +----------------------------------+----------------+
                | name                          | count(program) | title                            | count(student) |
               -+-------------------------------+----------------+----------------------------------+----------------+-
             body: |2
                | school                                                                                             |
                +-------------------------------+----------------+---------------------------------------------------+
-               |                               |                | top(program,3)                                    |
+               |                               |                | program                                           |
                |                               |                +----------------------------------+----------------+
                | name                          | count(program) | title                            | count(student) |
               -+-------------------------------+----------------+----------------------------------+----------------+-
             body: |2
                | school                                                                                             |
                +-------------------------------+----------------+---------------------------------------------------+
-               |                               |                | top(program,3,2)                                  |
+               |                               |                | program                                           |
                |                               |                +----------------------------------+----------------+
                | name                          | count(program) | title                            | count(student) |
               -+-------------------------------+----------------+----------------------------------+----------------+-
             body: |2
                | school^campus                                   |
                +--------+----------------------------------------+
-               |        | top(^)                                 |
+               |        | ^                                      |
                |        +------+------------------------+--------+
                | campus | code | name                   | campus |
               -+--------+------+------------------------+--------+-
             status: 200 OK
             headers:
             - [Content-Type, text/csv; charset=UTF-8]
-            - [Content-Disposition, 'attachment; filename="school:top.csv"']
+            - [Content-Disposition, attachment; filename="school.csv"]
             body: "code,name,campus\r\nart,School of Art & Design,old\r\n"
         - id: identity
           tests:
                   }
                 },
                 "header": "enrollment",
+                "path": "enrollment",
                 "syntax": "\/enrollment[1010.[[mth.101].[2008.fall].001]]{id()}",
                 "tag": "enrollment"
               },
                         "type": "string"
                       },
                       "header": "code",
+                      "path": "school.code",
                       "syntax": "code",
                       "tag": "code"
                     },
                         "type": "string"
                       },
                       "header": "name",
+                      "path": "school.name",
                       "syntax": "name",
                       "tag": "name"
                     },
                         "type": "string"
                       },
                       "header": "campus",
+                      "path": "school.campus",
                       "syntax": "campus",
                       "tag": "campus"
                     }
                   ]
                 },
                 "header": "school",
+                "path": "school",
                 "syntax": "school[art]",
                 "tag": "school"
               },
                         "type": "string"
                       },
                       "header": "code",
+                      "path": "school.code",
                       "syntax": "code",
                       "tag": "code"
                     },
                         "type": "string"
                       },
                       "header": "name",
+                      "path": "school.name",
                       "syntax": "name",
                       "tag": "name"
                     },
                         "type": "string"
                       },
                       "header": "campus",
+                      "path": "school.campus",
                       "syntax": "campus",
                       "tag": "campus"
                     }
                   ]
                 },
                 "header": "school",
+                "path": "school",
                 "syntax": "school[none]",
                 "tag": "school"
               }

File test/output/mysql.yaml

             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | school:top                             |
+               | school                                 |
                +------+------------------------+--------+
                | code | name                   | campus |
               -+------+------------------------+--------+-
             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | school:top(3)                          |
+               | school                                 |
                +------+------------------------+--------+
                | code | name                   | campus |
               -+------+------------------------+--------+-
             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | school:top(3,2)                               |
+               | school                                        |
                +------+-------------------------------+--------+
                | code | name                          | campus |
               -+------+-------------------------------+--------+-
             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | top(school.sort(count(department)-)) |
-               +------------+-------------------------+
-               | code       | count(department)       |
-              -+------------+-------------------------+-
-               | la         |                       6 |
+               | school                   |
+               +------+-------------------+
+               | code | count(department) |
+              -+------+-------------------+-
+               | la   |                 6 |
 
                ----
                /top(school.sort(count(department)-)){code,count(department)}
             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | top(school.sort(count(department)-),3) |
-               +-------------+--------------------------+
-               | code        | count(department)        |
-              -+-------------+--------------------------+-
-               | la          |                        6 |
-               | eng         |                        4 |
-               | mus         |                        4 |
+               | school                   |
+               +------+-------------------+
+               | code | count(department) |
+              -+------+-------------------+-
+               | la   |                 6 |
+               | eng  |                 4 |
+               | mus  |                 4 |
 
                ----
                /top(school.sort(count(department)-),3){code,count(department)}
             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | top(school.sort(count(department)-),3,2) |
-               +--------------+---------------------------+
-               | code         | count(department)         |
-              -+--------------+---------------------------+-
-               | mus          |                         4 |
-               | ns           |                         4 |
-               | bus          |                         3 |
+               | school                   |
+               +------+-------------------+
+               | code | count(department) |
+              -+------+-------------------+-
+               | mus  |                 4 |
+               | ns   |                 4 |
+               | bus  |                 3 |
 
                ----
                /top(school.sort(count(department)-),3,2){code,count(department)}
             body: |2
                | school                                                                                             |
                +-------------------------------+----------------+---------------------------------------------------+
-               |                               |                | top(program)                                      |
+               |                               |                | program                                           |
                |                               |                +----------------------------------+----------------+
                | name                          | count(program) | title                            | count(student) |
               -+-------------------------------+----------------+----------------------------------+----------------+-
             body: |2
                | school                                                                                             |
                +-------------------------------+----------------+---------------------------------------------------+
-               |                               |                | top(program,3)                                    |
+               |                               |                | program                                           |
                |                               |                +----------------------------------+----------------+
                | name                          | count(program) | title                            | count(student) |
               -+-------------------------------+----------------+----------------------------------+----------------+-
             body: |2
                | school                                                                                             |
                +-------------------------------+----------------+---------------------------------------------------+
-               |                               |                | top(program,3,2)                                  |
+               |                               |                | program                                           |
                |                               |                +----------------------------------+----------------+
                | name                          | count(program) | title                            | count(student) |
               -+-------------------------------+----------------+----------------------------------+----------------+-
             body: |2
                | school^campus                                   |
                +--------+----------------------------------------+
-               |        | top(^)                                 |
+               |        | ^                                      |
                |        +------+------------------------+--------+
                | campus | code | name                   | campus |
               -+--------+------+------------------------+--------+-
             status: 200 OK
             headers:
             - [Content-Type, text/csv; charset=UTF-8]
-            - [Content-Disposition, 'attachment; filename="school:top.csv"']
+            - [Content-Disposition, attachment; filename="school.csv"]
             body: "code,name,campus\r\nart,School of Art & Design,old\r\n"
         - id: identity
           tests:
                   }
                 },
                 "header": "enrollment",
+                "path": "enrollment",
                 "syntax": "\/enrollment[1010.[[mth.101].[2008.fall].001]]{id()}",
                 "tag": "enrollment"
               },
                         "type": "string"
                       },
                       "header": "code",
+                      "path": "school.code",
                       "syntax": "code",
                       "tag": "code"
                     },
                         "type": "string"
                       },
                       "header": "name",
+                      "path": "school.name",
                       "syntax": "name",
                       "tag": "name"
                     },
                         "type": "string"
                       },
                       "header": "campus",
+                      "path": "school.campus",
                       "syntax": "campus",
                       "tag": "campus"
                     }
                   ]
                 },
                 "header": "school",
+                "path": "school",
                 "syntax": "school[art]",
                 "tag": "school"
               },
                         "type": "string"
                       },
                       "header": "code",
+                      "path": "school.code",
                       "syntax": "code",
                       "tag": "code"
                     },
                         "type": "string"
                       },
                       "header": "name",
+                      "path": "school.name",
                       "syntax": "name",
                       "tag": "name"
                     },
                         "type": "string"
                       },
                       "header": "campus",
+                      "path": "school.campus",
                       "syntax": "campus",
                       "tag": "campus"
                     }
                   ]
                 },
                 "header": "school",
+                "path": "school",
                 "syntax": "school[none]",
                 "tag": "school"
               }

File test/output/oracle.yaml

             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | school:top                             |
+               | school                                 |
                +------+------------------------+--------+
                | code | name                   | campus |
               -+------+------------------------+--------+-
             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | school:top(3)                          |
+               | school                                 |
                +------+------------------------+--------+
                | code | name                   | campus |
               -+------+------------------------+--------+-
             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | school:top(3,2)                               |
+               | school                                        |
                +------+-------------------------------+--------+
                | code | name                          | campus |
               -+------+-------------------------------+--------+-
             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | top(school.sort(count(department)-)) |
-               +------------+-------------------------+
-               | code       | count(department)       |
-              -+------------+-------------------------+-
-               | la         |                       6 |
+               | school                   |
+               +------+-------------------+
+               | code | count(department) |
+              -+------+-------------------+-
+               | la   |                 6 |
 
                ----
                /top(school.sort(count(department)-)){code,count(department)}
             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | top(school.sort(count(department)-),3) |
-               +-------------+--------------------------+
-               | code        | count(department)        |
-              -+-------------+--------------------------+-
-               | la          |                        6 |
-               | eng         |                        4 |
-               | mus         |                        4 |
+               | school                   |
+               +------+-------------------+
+               | code | count(department) |
+              -+------+-------------------+-
+               | la   |                 6 |
+               | eng  |                 4 |
+               | mus  |                 4 |
 
                ----
                /top(school.sort(count(department)-),3){code,count(department)}
             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | top(school.sort(count(department)-),3,2) |
-               +--------------+---------------------------+
-               | code         | count(department)         |
-              -+--------------+---------------------------+-
-               | mus          |                         4 |
-               | ns           |                         4 |
-               | bus          |                         3 |
+               | school                   |
+               +------+-------------------+
+               | code | count(department) |
+              -+------+-------------------+-
+               | mus  |                 4 |
+               | ns   |                 4 |
+               | bus  |                 3 |
 
                ----
                /top(school.sort(count(department)-),3,2){code,count(department)}
             body: |2
                | school                                                                                             |
                +-------------------------------+----------------+---------------------------------------------------+
-               |                               |                | top(program)                                      |
+               |                               |                | program                                           |
                |                               |                +----------------------------------+----------------+
                | name                          | count(program) | title                            | count(student) |
               -+-------------------------------+----------------+----------------------------------+----------------+-
             body: |2
                | school                                                                                             |
                +-------------------------------+----------------+---------------------------------------------------+
-               |                               |                | top(program,3)                                    |
+               |                               |                | program                                           |
                |                               |                +----------------------------------+----------------+
                | name                          | count(program) | title                            | count(student) |
               -+-------------------------------+----------------+----------------------------------+----------------+-
             body: |2
                | school                                                                                             |
                +-------------------------------+----------------+---------------------------------------------------+
-               |                               |                | top(program,3,2)                                  |
+               |                               |                | program                                           |
                |                               |                +----------------------------------+----------------+
                | name                          | count(program) | title                            | count(student) |
               -+-------------------------------+----------------+----------------------------------+----------------+-
             body: |2
                | school^campus                                   |
                +--------+----------------------------------------+
-               |        | top(^)                                 |
+               |        | ^                                      |
                |        +------+------------------------+--------+
                | campus | code | name                   | campus |
               -+--------+------+------------------------+--------+-
             status: 200 OK
             headers:
             - [Content-Type, text/csv; charset=UTF-8]
-            - [Content-Disposition, 'attachment; filename="school:top.csv"']
+            - [Content-Disposition, attachment; filename="school.csv"]
             body: "code,name,campus\r\nart,School of Art & Design,old\r\n"
         - id: identity
           tests:
                   }
                 },
                 "header": "enrollment",
+                "path": "enrollment",
                 "syntax": "\/enrollment[1010.[[mth.101].[2008.fall].001]]{id()}",
                 "tag": "enrollment"
               },
                         "type": "string"
                       },
                       "header": "code",
+                      "path": "school.code",
                       "syntax": "code",
                       "tag": "code"
                     },
                         "type": "string"
                       },
                       "header": "name",
+                      "path": "school.name",
                       "syntax": "name",
                       "tag": "name"
                     },
                         "type": "string"
                       },
                       "header": "campus",
+                      "path": "school.campus",
                       "syntax": "campus",
                       "tag": "campus"
                     }
                   ]
                 },
                 "header": "school",
+                "path": "school",
                 "syntax": "school[art]",
                 "tag": "school"
               },
                         "type": "string"
                       },
                       "header": "code",
+                      "path": "school.code",
                       "syntax": "code",
                       "tag": "code"
                     },
                         "type": "string"
                       },
                       "header": "name",
+                      "path": "school.name",
                       "syntax": "name",
                       "tag": "name"
                     },
                         "type": "string"
                       },
                       "header": "campus",
+                      "path": "school.campus",
                       "syntax": "campus",
                       "tag": "campus"
                     }
                   ]
                 },
                 "header": "school",
+                "path": "school",
                 "syntax": "school[none]",
                 "tag": "school"
               }

File test/output/pgsql.yaml

             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | school:top                             |
+               | school                                 |
                +------+------------------------+--------+
                | code | name                   | campus |
               -+------+------------------------+--------+-
             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | school:top(3)                          |
+               | school                                 |
                +------+------------------------+--------+
                | code | name                   | campus |
               -+------+------------------------+--------+-
             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | school:top(3,2)                               |
+               | school                                        |
                +------+-------------------------------+--------+
                | code | name                          | campus |
               -+------+-------------------------------+--------+-
             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | top(school.sort(count(department)-)) |
-               +------------+-------------------------+
-               | code       | count(department)       |
-              -+------------+-------------------------+-
-               | la         |                       6 |
+               | school                   |
+               +------+-------------------+
+               | code | count(department) |
+              -+------+-------------------+-
+               | la   |                 6 |
 
                ----
                /top(school.sort(count(department)-)){code,count(department)}
             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | top(school.sort(count(department)-),3) |
-               +-------------+--------------------------+
-               | code        | count(department)        |
-              -+-------------+--------------------------+-
-               | la          |                        6 |
-               | eng         |                        4 |
-               | mus         |                        4 |
+               | school                   |
+               +------+-------------------+
+               | code | count(department) |
+              -+------+-------------------+-
+               | la   |                 6 |
+               | eng  |                 4 |
+               | mus  |                 4 |
 
                ----
                /top(school.sort(count(department)-),3){code,count(department)}
             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | top(school.sort(count(department)-),3,2) |
-               +--------------+---------------------------+
-               | code         | count(department)         |
-              -+--------------+---------------------------+-
-               | mus          |                         4 |
-               | ns           |                         4 |
-               | bus          |                         3 |
+               | school                   |
+               +------+-------------------+
+               | code | count(department) |
+              -+------+-------------------+-
+               | mus  |                 4 |
+               | ns   |                 4 |
+               | bus  |                 3 |
 
                ----
                /top(school.sort(count(department)-),3,2){code,count(department)}
             body: |2
                | school                                                                                             |
                +-------------------------------+----------------+---------------------------------------------------+
-               |                               |                | top(program)                                      |
+               |                               |                | program                                           |
                |                               |                +----------------------------------+----------------+
                | name                          | count(program) | title                            | count(student) |
               -+-------------------------------+----------------+----------------------------------+----------------+-
             body: |2
                | school                                                                                             |
                +-------------------------------+----------------+---------------------------------------------------+
-               |                               |                | top(program,3)                                    |
+               |                               |                | program                                           |
                |                               |                +----------------------------------+----------------+
                | name                          | count(program) | title                            | count(student) |
               -+-------------------------------+----------------+----------------------------------+----------------+-
             body: |2
                | school                                                                                             |
                +-------------------------------+----------------+---------------------------------------------------+
-               |                               |                | top(program,3,2)                                  |
+               |                               |                | program                                           |
                |                               |                +----------------------------------+----------------+
                | name                          | count(program) | title                            | count(student) |
               -+-------------------------------+----------------+----------------------------------+----------------+-
             body: |2
                | school^campus                                   |
                +--------+----------------------------------------+
-               |        | top(^)                                 |
+               |        | ^                                      |
                |        +------+------------------------+--------+
                | campus | code | name                   | campus |
               -+--------+------+------------------------+--------+-
             status: 200 OK
             headers:
             - [Content-Type, text/csv; charset=UTF-8]
-            - [Content-Disposition, 'attachment; filename="school:top.csv"']
+            - [Content-Disposition, attachment; filename="school.csv"]
             body: "code,name,campus\r\nart,School of Art & Design,old\r\n"
         - id: identity
           tests:
                   }
                 },
                 "header": "enrollment",
+                "path": "enrollment",
                 "syntax": "\/enrollment[1010.[[mth.101].[2008.fall].001]]{id()}",
                 "tag": "enrollment"
               },
                         "type": "string"
                       },
                       "header": "code",
+                      "path": "school.code",
                       "syntax": "code",
                       "tag": "code"
                     },
                         "type": "string"
                       },
                       "header": "name",
+                      "path": "school.name",
                       "syntax": "name",
                       "tag": "name"
                     },
                         "type": "string"
                       },
                       "header": "campus",
+                      "path": "school.campus",
                       "syntax": "campus",
                       "tag": "campus"
                     }
                   ]
                 },
                 "header": "school",
+                "path": "school",
                 "syntax": "school[art]",
                 "tag": "school"
               },
                         "type": "string"
                       },
                       "header": "code",
+                      "path": "school.code",
                       "syntax": "code",
                       "tag": "code"
                     },
                         "type": "string"
                       },
                       "header": "name",
+                      "path": "school.name",
                       "syntax": "name",
                       "tag": "name"
                     },
                         "type": "string"
                       },
                       "header": "campus",
+                      "path": "school.campus",
                       "syntax": "campus",
                       "tag": "campus"
                     }
                   ]
                 },
                 "header": "school",
+                "path": "school",
                 "syntax": "school[none]",
                 "tag": "school"
               }

File test/output/sqlite.yaml

             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | school:top                             |
+               | school                                 |
                +------+------------------------+--------+
                | code | name                   | campus |
               -+------+------------------------+--------+-
             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | school:top(3)                          |
+               | school                                 |
                +------+------------------------+--------+
                | code | name                   | campus |
               -+------+------------------------+--------+-
             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | school:top(3,2)                               |
+               | school                                        |
                +------+-------------------------------+--------+
                | code | name                          | campus |
               -+------+-------------------------------+--------+-
             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | top(school.sort(count(department)-)) |
-               +------------+-------------------------+
-               | code       | count(department)       |
-              -+------------+-------------------------+-
-               | la         |                       6 |
+               | school                   |
+               +------+-------------------+
+               | code | count(department) |
+              -+------+-------------------+-
+               | la   |                 6 |
 
                ----
                /top(school.sort(count(department)-)){code,count(department)}
             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | top(school.sort(count(department)-),3) |
-               +-------------+--------------------------+
-               | code        | count(department)        |
-              -+-------------+--------------------------+-
-               | la          |                        6 |
-               | eng         |                        4 |
-               | mus         |                        4 |
+               | school                   |
+               +------+-------------------+
+               | code | count(department) |
+              -+------+-------------------+-
+               | la   |                 6 |
+               | eng  |                 4 |
+               | mus  |                 4 |
 
                ----
                /top(school.sort(count(department)-),3){code,count(department)}
             - [Content-Type, text/plain; charset=UTF-8]
             - [Vary, Accept]
             body: |2
-               | top(school.sort(count(department)-),3,2) |
-               +--------------+---------------------------+
-               | code         | count(department)         |
-              -+--------------+---------------------------+-
-               | mus          |                         4 |
-               | ns           |                         4 |
-               | bus          |                         3 |
+               | school                   |
+               +------+-------------------+
+               | code | count(department) |
+              -+------+-------------------+-
+               | mus  |                 4 |
+               | ns   |                 4 |
+               | bus  |                 3 |
 
                ----
                /top(school.sort(count(department)-),3,2){code,count(department)}
             body: |2
                | school                                                                                             |
                +-------------------------------+----------------+---------------------------------------------------+
-               |                               |                | top(program)                                      |
+               |                               |                | program                                           |
                |                               |                +----------------------------------+----------------+
                | name                          | count(program) | title                            | count(student) |
               -+-------------------------------+----------------+----------------------------------+----------------+-
             body: |2
                | school                                                                                             |
                +-------------------------------+----------------+---------------------------------------------------+
-               |                               |                | top(program,3)                                    |
+               |                               |                | program                                           |
                |                               |                +----------------------------------+----------------+
                | name                          | count(program) | title                            | count(student) |
               -+-------------------------------+----------------+----------------------------------+----------------+-
             body: |2
                | school                                                                                             |
                +-------------------------------+----------------+---------------------------------------------------+
-               |                               |                | top(program,3,2)                                  |
+               |                               |                | program                                           |
                |                               |                +----------------------------------+----------------+
                | name                          | count(program) | title                            | count(student) |
               -+-------------------------------+----------------+----------------------------------+----------------+-
             body: |2
                | school^campus                                   |
                +--------+----------------------------------------+
-               |        | top(^)                                 |
+               |        | ^                                      |
                |        +------+------------------------+--------+
                | campus | code | name                   | campus |
               -+--------+------+------------------------+--------+-
             status: 200 OK
             headers:
             - [Content-Type, text/csv; charset=UTF-8]
-            - [Content-Disposition, 'attachment; filename="school:top.csv"']
+            - [Content-Disposition, attachment; filename="school.csv"]
             body: "code,name,campus\r\nart,School of Art & Design,old\r\n"
         - id: identity
           tests:
                   }
                 },
                 "header": "enrollment",
+                "path": "enrollment",
                 "syntax": "\/enrollment[1010.[[mth.101].[2008.fall].001]]{id()}",
                 "tag": "enrollment"
               },
                         "type": "string"
                       },
                       "header": "code",
+                      "path": "school.code",
                       "syntax": "code",
                       "tag": "code"
                     },
                         "type": "string"
                       },
                       "header": "name",
+                      "path": "school.name",
                       "syntax": "name",
                       "tag": "name"
                     },
                         "type": "string"
                       },
                       "header": "campus",
+                      "path": "school.campus",
                       "syntax": "campus",
                       "tag": "campus"
                     }
                   ]
                 },
                 "header": "school",
+                "path": "school",
                 "syntax": "school[art]",
                 "tag": "school"
               },
                         "type": "string"
                       },
                       "header": "code",
+                      "path": "school.code",
                       "syntax": "code",
                       "tag": "code"
                     },
                         "type": "string"
                       },
                       "header": "name",
+                      "path": "school.name",
                       "syntax": "name",
                       "tag": "name"
                     },
                         "type": "string"
                       },
                       "header": "campus",
+                      "path": "school.campus",
                       "syntax": "campus",
                       "tag": "campus"
                     }
                   ]
                 },
                 "header": "school",
+                "path": "school",
                 "syntax": "school[none]",
                 "tag": "school"
               }