Skip to content

Support repeated GQL node variables with SameAs - #352

Merged
kellrott merged 5 commits into
feature/cypherfrom
copilot/featurecypher-add-gripql-support
Sep 30, 2026
Merged

kellrott merged 5 commits into
feature/cypherfrom
copilot/featurecypher-add-gripql-support

Conversation

Copilot AI commented Sep 30, 2026 •

Copy link
Copy Markdown

Repeated node variables in GQL patterns must constrain later occurrences to the same graph element. GripQL now provides SameAs for that identity check; repeated edge variables remain explicitly unsupported until edge bindings are available.

  • Protocol and engine: Add protobuf field 74, Go and Python builders, and a core filter that compares element IDs. Compilation rejects unknown bindings and vertex/edge type mismatches; Mongo queries fall back to the core engine.
  • GQL compiler: Lower repeated node variables to SameAs without overwriting their original binding.
  • Coverage and docs: Add serialization, engine, compiler, endpoint, and Python tests; document supported mapping and rejection behavior.
MATCH (n)-[:FRIEND]->(middle)-[:FRIEND]->(n)
RETURN n
gripql.NewQuery().
  V().
  As("n").
  Out("FRIEND").
  As("middle").
  Out("FRIEND").
  SameAs("n").
  Render("$n")

Copilot AI and others added 3 commits September 30, 2026 04:12
Co-authored-by: kellrott <113868+kellrott@users.noreply.github.com>
Co-authored-by: kellrott <113868+kellrott@users.noreply.github.com>
Co-authored-by: kellrott <113868+kellrott@users.noreply.github.com>
Copilot AI changed the title Add SameAs support for repeated GQL variables Support repeated GQL node variables with SameAs Sep 30, 2026
Copilot AI requested a review from kellrott September 30, 2026 04:24
@kellrott
kellrott changed the base branch from develop to feature/cypher September 30, 2026 04:25
Comment thread mongo/compile.go Outdated
for _, gs := range stmts {
switch gs.GetStatement().(type) {
case *gripql.GraphStatement_Jump, *gripql.GraphStatement_Set,
*gripql.GraphStatement_SameAs,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather then leave it as unsupported op, it should be implemented into the mongo pipeline compiler

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented native Mongo pipeline compilation for SameAs, including binding/type validation and mark preservation. Commit: 2e3c30f.

@kellrott

Copy link
Copy Markdown
Member

@copilot can you implement SameAs in the mongo cross compiler, rather then leaving it as an unsupported op?

Co-authored-by: kellrott <113868+kellrott@users.noreply.github.com>

Copilot AI commented Sep 30, 2026

Copy link
Copy Markdown
Author

@copilot can you implement SameAs in the mongo cross compiler, rather then leaving it as an unsupported op?

SameAs now compiles in Mongo’s aggregation pipeline using $expr to compare current and bound element IDs; vertex/edge and validation tests pass. Commit: 2e3c30f.

Co-authored-by: kellrott <113868+kellrott@users.noreply.github.com>
@kellrott
kellrott marked this pull request as ready for review September 30, 2026 05:45
@kellrott
kellrott merged commit a4050a6 into feature/cypher Sep 30, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants