Release 0.2.3
A patch release of the 0.2 line. GQL (still experimental) can now write, call saved queries and
work with dates and times, and the playground gains GQL query tabs. It changes no format: stores,
snapshots and journals of 0.2.2 are read and written exactly as before. Its API additions are
additive (new methods, constants and #[non_exhaustive] error variants); three Gremlin
behaviours are fixed (see "Fixed").
Added
- GQL writes (experimental) (Writing with GQL):
g.gql(query)is no longer read-only. A query is one unit: it commits as a whole or leaves nothing, and the commit hooks, the journal, schema defaults and coercion, permissions, resource limits and cancellation apply as they do to Gremlin writes.INSERT(Cypher spellingCREATE) creates nodes and edges once per row;SETandREMOVEchange properties and labels (n.k = e,n = map,n += map,n:A:B,REMOVE n.k);[DETACH | NODETACH] DELETEremoves nodes, edges and paths;MERGE [p =] <pattern>withON CREATE SET/ON MATCH SETfinds or creates one pattern per row.- A query whose last clause writes may end there and returns no rows;
FINISHends any query without a result. - Writes run through internal steps (
gql:insert_node,gql:set,gql:delete,gql:merge, ...) that ask the same permissions as their Gremlin twins; a saved query that writes is recorded with its effects. - Not yet:
FOREACH(useFOR x IN list INSERT ...), a write inside aUNIONoperand, a path variable inINSERT, a nestedSET/REMOVEtarget such asn.a.b(Not yet).
- Saved queries written in GQL (Saved Queries):
g.define_query(#{name, language: "gql", body, params})stores a GQL query, read with$nameparameters and parsed, bound and planned when it is saved. A query that reads is recorded in the dialectgraphersal-gql/1, one that writes ingraphersal-gql/2with its effects (catalog::GQL_QUERY_DIALECT,catalog::GQL_WRITING_QUERY_DIALECT,QueryDefinition::language());queries()andget_query()reportlanguageanddialect. New errors for an undeclared or unused$parameter. A version that does not know GQL saved queries (0.2.2 and older) lists them as not runnable and keeps them unchanged. CALLof a saved GQL query (Calling saved queries):CALL folder.name(args) [YIELD ..], standalone or once per row inside a query (OPTIONAL CALL,YIELD .. WHERE, aVOIDcall may end a query). A saved query in Rhai and a call insideEXISTS/COUNT/COLLECTare not supported yet.- GQL dates and times (Dates in GQL, The Supported Subset):
date(),local_time(),local_datetime(),datetime()andduration()(Cypher spellingslocaltime(),localdatetime()accepted) from ISO 8601 text, a map of fields or another temporal value; components (d.year, ...), arithmetic with durations, comparison, the clocks (.statement,.transaction; one instant per execution, inside a script the script'snow()),X.truncate(unit, value),datetime.fromepoch(millis)andduration.between/inMonths/inDays/inSeconds. Values hold microseconds (finer input is refused, never cut), a zone name is turned into its offset, and zonedtime()is not supported yet; every difference from Neo4j is listed on Semantics. - More GQL expressions and clauses: list indexing and slicing (
x[i],x[a..b],m[k]),+of a list and one value, the power operatorx ^ y,percentile_cont/percentile_disc, chained comparisons, a constantLIMIT/SKIP, non-reserved words as names,ORDER BYover expressions of returned aggregates, aLET/WITHvalue as a pattern node or edge,RETURN *in name order. Equality across kinds isFALSE, lists are ordered, float division follows IEEE 754 (NaN,Infinity). A construct that is meaningless for its operand kinds is refused with a static error. The deliberate differences from Neo4j and ISO are collected in Semantics and Conformance. - openCypher TCK harness (TCK Compliance): the openCypher TCK 2024.3
is vendored unmodified (
crates/graphersal/tests/opencypher/, not part of the published crate) and run bycargo test --test opencypher_tckagainst the compatibility forms GQL accepts, with a ratchet baseline and a generated compliance page. At this release 3216 of 3818 in-scope cases pass (84.2 %, 95.7 % without the temporal group) and the wrong behaviour of supported constructs is 0; the rest is missing constructs. The kit measures the Cypher compatibility forms that GQL accepts. - Playground (Web Playground): query tabs can be GQL
(highlighting, completion, parameters, error spans, "Save as query..." from a
g.gql(..)tab), the saved-query editor has a language switch and completes the declared$parameters, the new Examples panel has search, collapsible groups and GQL subgroups (including write examples), element details collapse long values, and the panel header wraps on narrow screens. The book's GQL run buttons open GQL tabs. The MCP toolgqland the AI Chat can write (read-only under--mcp-read-only; the AI Chat only when asked), and the session reports a change summary.
Changed
g.gql()is no longer read-only: a query with a write clause that used to be refused now runs. A host that relied on the refusal restricts it with anAuthorizer/AccessPolicy(writes askCreate,UpdateandDeleteonDatalike their Gremlin twins) or--mcp-read-only.- GQL answers that were wrong or too strict now follow the TCK (cross-kind equality, ordering
of lists,
NaN,WITH ... WHEREseeing the dropped names, and more); a query that relied on such an answer may return a different one. - Result JSON writes
NaN,Infinityand-Infinityas GraphSON typed doubles ({"@type": "g:Double", "@value": "NaN"}) in the playground, the dev server, MCP,to_json()and--format json; they used to fail with "non-finite float cannot be represented in JSON". The strict writers (GraphML, the plain serde of a value) stay strict.
Fixed
where(P.eq("x"))compares by logical value (Predicates):where(P.eq(..)),where(P.neq(..)), the end label ofwhere(__.as("x")),where(P.eq(..)).by(..)andwhere(P.within(..))compared the current object with the labelled one structurally, so a computed value (inject,constant,math) never equalled a lazily read property, two properties of different elements never matched, and1never equalled1.0. Scalars now compare by the rulesP.eqapplies to a literal, elements by identity, containers by value.merge_v()andmerge_e()askReadon what they search (Permissions): they asked onlyCreateandUpdate, so a policy that denied reading could still probe for existence through them. A policy that allows writes but not reads now denies them.- A cross product is checked against the traverser limit before it is built:
MATCH (a), (b)(and a mid-traversalv()) on a large graph reserved the whole product up front and could abort the process. It now fails withmemory.allocationand aHelp:line when it exceedstraversal.max_traversersor the memory budget, and capacities taken from query data are capped.