Hi Ken, 

Circling back to this topic, after some further examinations on Edge in 
grammar, I'm not very convinced that we need Elements to be in the grammar at 
all. Methods that uses Edge or Vertex really only needs the ids to identify the 
element, which means that these Element structures in the grammar are just id 
containers. As such it would be much simpler on the grammar to remove these 
entirely, and for methods that takes elements they will take in 
GenericLiteralArgument (which is the id in this case). For any GLV translation 
this just implies to pass in the id (i.e. Vertex.id) for the Gremlin lang 
script when a Vertex or Edge is encountered.

Do note that this will be a breaking change that removes Vertex support from 
the grammar.

Any thoughts or concerns?

On 2025/04/10 23:51:31 Ken Hu wrote:
> Hi All,
> 
> There are some inconsistencies around the casing of "type constructors" in
> the grammar. I'm calling these "type constructors" for a lack of a better
> term but they are essentially keywords in the grammar that, when parsed,
> will invoke a constructor (e.g. ReferenceVertex() or datetime()). I think
> that moving forward we should establish a standard casing for these "type
> constructors" to match our normal standard for classes which is PascalCase.
> So datetime() should actually be DateTime().
> 
> Speaking of ReferenceVertex, the grammar for structureVertex is actually
> "NEW? ('Vertex'|'ReferenceVertex') LPAREN genericLiteralArgument COMMA
> stringArgument RPAREN". The "new" keyword should probably be removed as
> it's not needed from a language point of view. Also, the use of "Reference"
> in the name may become inaccurate as it isn't guaranteed to always be a
> ReferenceVertex (it might become a DetachedVertex). The name should simply
> be Vertex to reflect that it is able to fulfill all usages of vertices in
> the language. The label in a Vertex is also not necessary. For example,
> "g.V(Vertex)" simply uses the id of the Vertex so Vertex should only
> require an id. The label can simply be defaulted to empty string as it
> won't be used.
> 
> It should also be mentioned that in TINKERPOP-3023, there are proposals of
> additional types to be added to the grammar for 3.8. The rules that are
> established here should also apply to any of those types (notably Edge).
> 
> Summary of proposed changes:
> -establish PascalCase as the standard for "type constructors" in the
> grammar and add a DateTime()
> -remove the new keyword
> -call an element type "{Element}" rather than "Reference{Element}"
> -elements shouldn't require label in the grammar
> 
> Thanks,
> Ken
> 
> 
> Related links:
> https://issues.apache.org/jira/browse/TINKERPOP-3023
> 

Reply via email to