htsql-sqlascii-patch / test / regress / input / tutorial.yaml

#
# Copyright (c) 2006-2011, Prometheus Research, LLC
# Authors: Clark C. Evans <cce@clarkevans.com>,
#          Kirill Simonov <xi@resolvent.net>
#

title: Examples from the Tutorial
id: tutorial
tests:

- title: Getting Started
  tests:
  # Selecting Data
  - uri: /school
  - uri: /program{school, code, title}
  - uri: /department{name-, school}
  - uri: /course{department+, no, credits-, title}
  - uri: /course{department+ :as 'Dept Code', no :as 'No.',
                 credits-, title}
  # Linking Data
  - uri: /program{school.name, title}
  - uri: /course{department.school.name, department.name, title}
  - uri: /course{department{school.name, name}, title}
  - uri: /department{*,school.*}
  # Filtering Data
  - uri: /department?school='eng'
  - uri: /program?degree={'ba','bs'}
  - uri: /program?school='bus'&degree!='bs'
  - uri: /course{department, no, title}
                ?credits<3&department.school='ns'
  - uri: /(course?credits<3&department.school='ns')
                {department, no, title}
  # Formatters
  - uri: /school/:json
  # Putting it All Together
  - uri: /course{department{code, name},no,title+}
                ?department.school='bus'/:csv

- title: Relating and Aggregating Data
  tests:
  # Basic Linking
  - uri: /course{department.name, title}    # singular join
  - uri: /department{name, course.credits}  # invalid plural join
    expect: 400
  - uri: /department{name, max(course.credits)}
  - uri: /department{name, count(school)}   # invalid singular join
    expect: 400
  - uri: /max(course.credits)
  # Aggregate Expressions
  - uri: /school{name, count(program), count(department)}
  - uri: /department{name, count(course?no>=400)}
  - uri: /school{name, avg(department.count(course))}
  - uri: /school{name, count(department?exists(course?credits>3))}
  - uri: /department{name, avg((course?no>400).credits)}
  - uri: /department{code, min(course.credits), max(course.credits),
                           avg(course.credits)}
  - uri: /department{name, avg(course.credits), count(course)}
                ?every(course.credits=3)

- title: Logical Expressions
  tests:
  # Comparison Operators
  - uri: /course?title='Drawing'
  - uri: /course?title~'lab'
  - uri: /course?title!~'lab'
  - uri: /course?title!='Organic Chemistry Laboratory I'
  - uri: /course{department,no,title}?no=101
  - uri: /course?department!={'arthis','stdart'}
  - uri: /course?credits>3
  - uri: /course?credits>=3
  - uri: /department?code>'me'
  # Boolean Expressions
  - uri: /{true(), false(), null(), ''}
  - uri: /department{code, name}?is_null(school)
  - uri: /department{code, name}?!is_null(school)
  - uri: /course?department='acc'&credits<3
  - uri: /course?credits>4|credits<3
  - uri: /course?(department='arthis'|department='stdart')&credits>3
  - uri: /course?department='arthis'|department='stdart'&credits>3
  - uri: /course?description
  - uri: /course{department, no, description}?!description

- title: Types and Functions
  tests:
  # Working with NULLs
  - uri: /department?school=null()
  - uri: /department?school==null()
  - uri: /department?school!=='art'

- title: Odds & Ends
  tests:
  - uri: /{1='1'}               # untyped literals
  - uri: /{'Bursar''s Office'}  # single-quote escaping
  - uri: /{'%25'}               # percent-encoding
  - uri: /course.sort(credits)  # sort expression
  - uri: /course.limit(5,20)    # limit/offset
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.