-
Notifications
You must be signed in to change notification settings - Fork 10
The Qlkit Graph Query Language
A "query term" in qlkit is always a vector containing a keyword:
[:person/name]
A data-aware component defines a collection of query terms, referred to as a "query". It will look as follows:
[[:person/name] [:person/age] [:person/address]]
Note that in OmNext, query items are (optionally) naked keyword symbols, so such a query could be written as [:person/name :person/age :person/address]
, but this is NOT permitted in qlkit, the query items MUST be in a vector. This is necessary because qlkit (unlike OmNext) does not implement a separate ast query syntax for parsing- The base query syntax essentially is already in the form of an ast.
A query term can also have parameters and children- Note how this looks exactly the same as the qlkit HTML syntax:
[:persons/search {:name-prefix "smit"} [:person/name] [:person/age]]
As with the HMTL syntax, the query syntax also supports sequence expansion, making this equivalent to the previous query term:
[:persons/search {:name-prefix "smit"} (list [:person/name] [:person/age])]
This feature is used for importing query dependencies of child components, making a syntax like the following possible:
[:persons/search {:name-prefix "smit"} (ql/get-query PersonRow)]
In qlkit, mutation query items are keywords, just as the keys in read query terms, but they must end in an exclamation mark, such as :example/set-number!
(This differs from OmNext, where mutations must be symbols instead of keywords)
Here are further examples of the qlkit query language, along with a clojure.spec specification