HarperFast / HarperFast/rql

Proposition to revise specification

Open
#51 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
276
Forks
48
PR merge metrics
No merged PRs in 30d

Description

Currently the specification is fiql at best... I propose revising it based on xpath 2.0, which is more consistent. It would also be nice to be able to extend rql more easily, instead of locking it into a single JS library.

IMO the following functions are inconsistent:
- in/out/contains/excludes: names pertain to filters, not the expressions or projected results
- mean: shouldn't this be average (avg)?
- recurse: what does this express? what does it return?
- aggregate: shouldn't this be split into groupby+fold?
- select: when is this needed?
- first: why only first() and not last() or position()?
- one: why might a query be expected to throw errors? Shouldn't this be left to the implementation?

In some cases, rql can return something else than a sequence. Perhaps it would be better to always return a sequence, even if it has only 1 item.

Prefixed values are inconsistent (e.g. boolean, date, lower-case, etc.) with other expressions, and type conversions may just as well be enforced by functions. This also means arguments could be passed.

IMO the following functions are lacking:
- exists/empty: check if property exists (where a property is conceived as a node)
- groupby/fold: as mentioned earlier
- contains/starts-with/ends-with: string filters
- matches: string filter for regular expressions
- the full numeric/date/duration stack

I'd also like to suggest adding boolean operators (false(), true(), not()) and evaluating all expressions, e.g. `eq(count(path),3)`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.