I recently rewrote my slides on http://pitch.com https://app.pitch.com/app/presentation/a760be33-4a5b-4e73-bd25-07387cd197dc/d673c9f7-c98f-45eb-a6ff-668b42909f1c
Lately, I took a break away from the project, now I am back at it.
Today I am working on modeling a query language which will be used between the Vrac clients and the Vrac servers.
I will call it VracQL (VQL in short), it naturally stands for Vrac’s Query Language
I finished to decide for the format:
; EQL
'{session [:session/title
:session/description
{:session/speakers [:speaker/name
:speaker/bio]}]}
; VQL
'[(:session/title session)
(:session/description session)
(for [speakers (:session/speakers session)]
[(:speaker/name speakers)
(:speaker/bio speakers)])]
;; VQL - same semantic as above
'(let [{:session/keys [title description speakers]} session]
[title
session
(for [{:speaker/keys [name bio]} speakers]
[name
bio])])
; Returns values similarly to Clojure
["session title"
"session description"
[["name1"
"bio1"]
["name2"
"bio2"]]]
VracQL can include a directed graph of data computations, similarly to the Vrac templates.
; VQL - computed data
'[(- (:admin.money/spent global)
(:admin.money/earned global))
(count (:admin/users global))]
; VQL - let with computed data
'(let [{:admin/keys [users]
:admin.money/keys [earning spending]} global
benefit (- earning spending)
nb-users (count users)]
[benefit
nb-users
(/ benefit nb-users)])
VracQL is more verbose than EQL, but I like the fact that users won’t have to remember one more DSL syntax, as it is a subset of Clojure.
I pushed my VQL wip code at https://github.com/green-coder/vrac/blob/vracql/src/vrac/model/vql.cljc I am considering adding support for recursion in VQL later. Any suggestion about the syntax is welcome.