Skip to content

TINKERPOP-3023 Expand type syntax in grammar in 3.8 - Remove Vertex #3133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: 3.8-dev
Choose a base branch
from

Conversation

EchoNullify
Copy link
Contributor

@EchoNullify EchoNullify commented Jun 11, 2025

Feat: Remove Vertex support from grammar, and for places where a vertex is required, pass in the vertex id instead at traversal construction.

  • The grammar currently includes inconsistencies, particularly around "type constructors" like ReferenceVertex(), which are being re-evaluated.

  • ReferenceVertex should be renamed simply to Vertex, as the distinction (e.g., between ReferenceVertex and DetachedVertex) is no longer meaningful or guaranteed.

  • The keyword new should be removed from the grammar rule for structureVertex, as it's syntactically unnecessary.

  • The Vertex constructor should only require an id, not a label. Labels are not utilized in practice (e.g., in g.V(Vertex)), and can default to an empty string.

Resolves: 3023,

For reference...

https://lists.apache.org/thread/ptq81160z4y4vddg4lxz2nv244x2yzhq

@EchoNullify EchoNullify marked this pull request as ready for review June 11, 2025 16:17
@codecov-commenter
Copy link

codecov-commenter commented Jun 11, 2025

Codecov Report

Attention: Patch coverage is 79.59184% with 10 lines in your changes missing coverage. Please review.

Please upload report for BASE (3.8-dev@9c7a54c). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...remlin/process/traversal/step/map/AddEdgeStep.java 64.70% 4 Missing and 2 partials ⚠️
...in/language/grammar/DefaultGremlinBaseVisitor.java 0.00% 2 Missing ⚠️
...n/process/traversal/step/map/AddEdgeStartStep.java 87.50% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             3.8-dev    #3133   +/-   ##
==========================================
  Coverage           ?   76.52%           
  Complexity         ?    13829           
==========================================
  Files              ?     1109           
  Lines              ?    69787           
  Branches           ?     7545           
==========================================
  Hits               ?    53404           
  Misses             ?    13617           
  Partials           ?     2766           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@EchoNullify EchoNullify changed the title [TP Grammar] Remove Vertex from Grammar [TINKERPOP-3023] Expand type syntax in grammar in 3.8 - Remove Vertex Jun 11, 2025
@EchoNullify EchoNullify changed the title [TINKERPOP-3023] Expand type syntax in grammar in 3.8 - Remove Vertex TINKERPOP-3023 Expand type syntax in grammar in 3.8 - Remove Vertex Jun 11, 2025
@EchoNullify EchoNullify marked this pull request as draft June 11, 2025 17:16
@EchoNullify EchoNullify marked this pull request as ready for review June 12, 2025 22:04
@@ -23,7 +23,6 @@ g.V().horder().by(id)
g.mergeE(["weight": 0.5, Direction.out: 1])
g.mergeE(["weight": 0.5, Direction.in: 1])
g.addE('knows').from(g.V(1))
g.addE('knows').from(g.V(1).next())
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this now a valid traversal?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previously was invalid but now works

Copy link
Contributor

Choose a reason for hiding this comment

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

This is interesting. from() in the grammar previously only allowed a nestedTraversal, but not a terminatedTraversal. By putting genericArgument in there to accept any arbitrary ID type, we've now allowed terminatedTraversal to leak in. I don't think this is a big concern.
@spmallette any thoughts on this?

@@ -23,7 +23,6 @@ g.V().horder().by(id)
g.mergeE(["weight": 0.5, Direction.out: 1])
g.mergeE(["weight": 0.5, Direction.in: 1])
g.addE('knows').from(g.V(1))
g.addE('knows').from(g.V(1).next())
Copy link
Contributor

Choose a reason for hiding this comment

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

This is interesting. from() in the grammar previously only allowed a nestedTraversal, but not a terminatedTraversal. By putting genericArgument in there to accept any arbitrary ID type, we've now allowed terminatedTraversal to leak in. I don't think this is a big concern.
@spmallette any thoughts on this?

@Cole-Greer
Copy link
Contributor

I've pushed some changes into the branch which updates the docs a bit and strips out the vertex -> id sugar in GraphTraversal as it's not required for bytecode. (to be added to master in a separate PR)

My vote is VOTE +1

@Cole-Greer
Copy link
Contributor

Note: Followup PR for master: #3138

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.

5 participants