- query statement is a transformator
- input: one or more TMs, output: one TM, one XML, ....
- phasing should be like SQL and XQuery
- define collection (SQL: FROM table, XQuery: document)
- iterate over all components (SQL: rows, XQuery: nodes)
- filter out those components which satisfy a particular predicate (SQL: WHERE clauses, XQuery: XPath
- generate new content from the remaining matches (SQL: SELECT ..., XQuery RETURN
- match and navigate, use two complementary navigation mechanisms
- match: highly declarative, pattern oriented
- navigation: movements within a map from a starting position
- allow arbitrarily deep levels of subqueries (chaining queries)
- can only work if input structure is the same as the output structure
- different from SQL (nested queries very limited and a pain), but similar to XQuery
- allows for pipelining queries
- allows for optimizations
- functional language
- no stateful variables, only immutable objects
- clean language
- all stateful things are tucked away into the evaluation context (character encoding, optimization pragmas, ...)
- functions everywhere: predefined, user-defined, the whole query is technically a function