Can someone explain to me what the main differences to jq are, besides the syntax?
Likewise, compare "sum($element.response_time)" with "map(.response_time) | add" in jq. Processing in JSONiq goes inside to outside while jq goes left to right.
def avg: add / length;
group_by(.url) | map({
"url": .[0].url,
"hits": length,
"avg": map(.response_time) | avg
})
so jq should be (at least roughly) as powerful as JSONiq.But we have a function: https://github.com/sirixdb/brackit
$ jq '.foo += 1' <<< '{"foo": 2}'
{
"foo": 3
} 1. let $stats := collection("stats")
2. for $access in $stats
3. group by $url := $access.url
4. return
5. {
6. "url": $url,
7. "avg": avg($access.response_time),
8. "hits": count($access)
9. }So basically grep or even sql ->xquery. No thank you!