Generic query expression parsing and AST manipulation.
QUERY EXPRESSIONS
Query expressions are a variation on Datomic Pull Syntax http://docs.datomic.com/pull.html more suitable for generic client/server state transfer. It's important to note the query expression syntax is not a strict superset of Datomic Pull.
A query expression is composed of EDN values. The grammar for query expressions follows:
QueryRoot := EdnVector(QueryExpr*) PlainQueryExpr := (EdnKeyword | IdentExpr | JoinExpr) QueryExpr := (PlainQueryExpr | ParamExpr) IdentExpr := EdnVector2(Keyword, EdnValue) ParamExpr := EdnList2(PlainQueryExpr | EdnSymbol, ParamMapExpr) ParamMapExpr := EdnMap(Keyword, EdnValue) JoinExpr := EdnMap((Keyword | IdentExpr), (QueryRoot | UnionExpr | RecurExpr)) UnionExpr := EdnMap(Keyword, QueryRoot) RecurExpr := ('... | Integer)
Note most of the api expects a QueryRoot not a QueryExpr.
QUERY EXPRESSION AST FORMAT
Given a QueryExpr you can get the AST via om.next.impl.parser/expr->ast. The following keys can appear in the AST representation:
{:type (:prop | :join | :call | :root | :union | :union-entry) :key (EdnKeyword | EdnSymbol | IdentExpr) :dispatch-key (EdnKeyword | EdnSymbol) :union-key EdnKeyword :query (QueryRoot | RecurExpr) :params ParamMapExpr :children EdnVector(AST) :component Object :target EdnKeyword}
:query and :params may or may not appear. :type :call is only for mutations.
Generic query expression parsing and AST manipulation.
QUERY EXPRESSIONS
Query expressions are a variation on Datomic Pull Syntax
http://docs.datomic.com/pull.html more suitable for generic client/server
state transfer. It's important to note the query expression syntax is
*not* a strict superset of Datomic Pull.
A query expression is composed of EDN values. The grammar for query
expressions follows:
QueryRoot := EdnVector(QueryExpr*)
PlainQueryExpr := (EdnKeyword | IdentExpr | JoinExpr)
QueryExpr := (PlainQueryExpr | ParamExpr)
IdentExpr := EdnVector2(Keyword, EdnValue)
ParamExpr := EdnList2(PlainQueryExpr | EdnSymbol, ParamMapExpr)
ParamMapExpr := EdnMap(Keyword, EdnValue)
JoinExpr := EdnMap((Keyword | IdentExpr), (QueryRoot | UnionExpr | RecurExpr))
UnionExpr := EdnMap(Keyword, QueryRoot)
RecurExpr := ('... | Integer)
Note most of the api expects a QueryRoot not a QueryExpr.
QUERY EXPRESSION AST FORMAT
Given a QueryExpr you can get the AST via om.next.impl.parser/expr->ast.
The following keys can appear in the AST representation:
{:type (:prop | :join | :call | :root | :union | :union-entry)
:key (EdnKeyword | EdnSymbol | IdentExpr)
:dispatch-key (EdnKeyword | EdnSymbol)
:union-key EdnKeyword
:query (QueryRoot | RecurExpr)
:params ParamMapExpr
:children EdnVector(AST)
:component Object
:target EdnKeyword}
:query and :params may or may not appear. :type :call is only for
mutations.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |