Hacker News new | ask | show | jobs
by masklinn 1684 days ago
Jq is xpath, this looks to be xquery. In fact it specifically works as an xquery embed.
2 comments

You can write the example below in jq as

    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.
... although, it seems neither JSONIq nor jq contain a "parent" operator, as far as I can tell.
This might be too restricting regarding the storage.

But we have a function: https://github.com/sirixdb/brackit

Not that not having it makes either of them any less powerful. If you descend to an inner context, you can refer to the parent/ancestor via a variable you can set before-hand.