Kirill Simonov avatar Kirill Simonov committed 5c5273f

Added more examples to the reference.

Comments (0)

Files changed (1)

doc/reference.rst

 +----------------------+---------------------------+---------------------------+----------------------+
 | Function             | Description               | Example Input             | Output               |
 +======================+===========================+===========================+======================+
-| `exists(ps)`         | *TRUE* if *ps* contains   |                           |                      |
+| `exists(ps)`         | *TRUE* if *ps* contains   | |exists-in|               |                      |
 |                      | at least one *TRUE*       |                           |                      |
 |                      | value; *FALSE* otherwise  |                           |                      |
 +----------------------+---------------------------+---------------------------+----------------------+
-| `every(ps)`          | *TRUE* if *ps* contains   |                           |                      |
+| `every(ps)`          | *TRUE* if *ps* contains   | |every-in|                |                      |
 |                      | only *TRUE* values;       |                           |                      |
 |                      | *FALSE* otherwise         |                           |                      |
 +----------------------+---------------------------+---------------------------+----------------------+
-| `count(ps)`          | number of *TRUE* values   |                           |                      |
+| `count(ps)`          | number of *TRUE* values   | |count-in|                |                      |
 |                      | in *ps*                   |                           |                      |
 +----------------------+---------------------------+---------------------------+----------------------+
-| `min(xs)`            | smallest *x* in *sx*      |                           |                      |
+| `min(xs)`            | smallest *x* in *sx*      | ``min(course.credits)``   |                      |
 +----------------------+---------------------------+---------------------------+----------------------+
-| `max(xs)`            | largest *x* in *sx*       |                           |                      |
+| `max(xs)`            | largest *x* in *sx*       | ``max(course.credits)``   |                      |
 +----------------------+---------------------------+---------------------------+----------------------+
-| `sum(xs)`            | sum of *x* in *xs*        |                           |                      |
+| `sum(xs)`            | sum of *x* in *xs*        | ``sum(course.credits)``   |                      |
 +----------------------+---------------------------+---------------------------+----------------------+
-| `avg(xs)`            | average value of *x*      |                           |                      |
+| `avg(xs)`            | average value of *x*      | ``avg(course.credits)``   |                      |
 |                      | in *xs*                   |                           |                      |
 +----------------------+---------------------------+---------------------------+----------------------+
 
+.. |exists-in| replace:: ``exists(course.credits>5)``
+.. |every-in| replace:: ``every(course.credits>5)``
+.. |count-in| replace:: ``count(course.credits>5)``
+
 
 Navigation Operations
 =====================
 +----------------------+---------------------------+---------------------------+----------------------+
 | Function             | Description               | Example Input             | Output               |
 +======================+===========================+===========================+======================+
-| `chain . link`       | follow a link             |                           |                      |
+| `chain . link`       | traverse a link           | ``school.program``        |                      |
 +----------------------+---------------------------+---------------------------+----------------------+
-| `chain . attr`       | extract attribute value   |                           |                      |
+| `chain . attr`       | extract attribute value   | ``school.name``           |                      |
 +----------------------+---------------------------+---------------------------+----------------------+
-| `chain . *`          | extract all attributes    |                           |                      |
+| `chain . \*`         | extract all attributes    | ``school.*``              |                      |
 +----------------------+---------------------------+---------------------------+----------------------+
-| `chain ? p`          | records from *chain*      |                           |                      |
+| `chain ? p`          | records from *chain*      | ``school?code='edu'``     |                      |
 |                      | satisfying condition *p*  |                           |                      |
 +----------------------+---------------------------+---------------------------+----------------------+
-| `chain.sort(x,...)`  | records from *chain*      |                           |                      |
+| `chain.sort(x,...)`  | records from *chain*      | ``course.sort(credits-)`` |                      |
 |                      | sorted by *x*, ...        |                           |                      |
 +----------------------+---------------------------+---------------------------+----------------------+
-| `chain.limit(n)`     | first *n* records from    |                           |                      |
+| `chain.limit(n)`     | first *n* records from    | ``course.limit(10)``      |                      |
 |                      | *chain*                   |                           |                      |
 +----------------------+---------------------------+---------------------------+----------------------+
-| `chain.limit(n,k)`   | *n* records from *chain*  |                           |                      |
+| `chain.limit(n,k)`   | *n* records from *chain*  | ``course.limit(10,20)``   |                      |
 |                      | starting from *k*-th      |                           |                      |
 +----------------------+---------------------------+---------------------------+----------------------+
-| `chain {x,...}`      | select *x*, ... from      |                           |                      |
+| `chain {x,...}`      | select *x*, ... from      | ``school{code,name}``     |                      |
 |                      | *chain*                   |                           |                      |
 +----------------------+---------------------------+---------------------------+----------------------+
 | `root()`             | scalar class              |                           |                      |
 +----------------------+---------------------------+---------------------------+----------------------+
 | Function             | Description               | Example Input             | Output               |
 +======================+===========================+===========================+======================+
-| `as(x,title)`        | set the column title      |                           |                      |
+| `as(x,title)`        | set the column title      | ``number :as 'No.'``      |                      |
 +----------------------+---------------------------+---------------------------+----------------------+
-| `x+`                 | sort by *x* in            |                           |                      |
+| `x+`                 | sort by *x* in            | ``credits+``              |                      |
 |                      | ascending order           |                           |                      |
 +----------------------+---------------------------+---------------------------+----------------------+
-| `x-`                 | sort by *x* in            |                           |                      |
+| `x-`                 | sort by *x* in            | ``credits-``              |                      |
 |                      | descending order          |                           |                      |
 +----------------------+---------------------------+---------------------------+----------------------+
 
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.