Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima

This release also includes changes from <<release-3-7-XXX, 3.7.XXX>>.

* Removed Vertex/ReferenceVertex from grammar. Use vertex id in traversals now instead.
* Modified mathematical operators to prevent overflows in steps such as `sum()` and 'sack()' to prefer promotion to the next highest number type.
* Added `DateTime` ontop of the existing 'datetime' grammar.
* Added UUID() + UUID(value) to grammar
Expand Down
33 changes: 32 additions & 1 deletion docs/src/upgrade/release-3.8.x.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,38 @@ complete list of all the modifications that are part of this release.

=== Upgrading for Users

==== Removal of Vertex/ReferenceVertex from grammar

`StructureVertex`, previously used to construct new vertices in the grammar, now been removed. The `V()` step, as well
as the `from()` and `to()` modulators used with `addE()`, previously accepted `StructureVertex` as arguments in the
grammar. In its place, the `from()` and `to()` modulators can now directly accept a vertex id in place of a `Vertex`
when used with `addE()` (`V()` has always accepted ids in addition to vertices). When using these steps in `gremlin-lang`
scripts, the vertex id must be used directly. This change has no effect on the `GraphTraversal` API, nor on
`gremlin-groovy` scripts. Vertices can continue to be used directly such places.

[source,groovy]
----
// 3.7.3
gremlin> v1 = g.V(1).next()
==>v[1]
gremlin> v2 = g.V(2).next()
==>v[2]
gremlin> script = String.format("g.V(new Vertex(%s)).outE().where(inV().is(new Vertex(%s)))", v1.id(), v2.id())
==>g.V(new Vertex(1)).outE().where(inV().is(new Vertex(2)))
gremlin> client.submit(script).all().get().get(0).getEdge()
==>e[7][1-knows->2]

// 3.8.0
gremlin> v1 = g.V(1).next()
==>v[1]
gremlin> v2 = g.V(2).next()
==>v[2]
gremlin> script = String.format("g.V(%s).outE().where(inV().id().is(%s))", v1.id(), v2.id())
==>g.V(1).outE().where(inV().id().is(2))
gremlin> client.submit(script).all().get().get(0).getEdge()
==>e[7][1-knows->2]
----

==== Auto promotion of number types

Previously, operations like sum or sack that involved mathematical calculations did not automatically promote the result
Expand Down Expand Up @@ -411,7 +443,6 @@ See: link:https://issues.apache.org/jira/browse/TINKERPOP-2974[TINKERPOP-2974]
All of the following types in the grammar have been renamed to follow consistent rules:

`genericLiteralArgument` -> `genericArgument`
`structureVertex` -> `structureVertexLiteral`
`stringLiteralVarargsArgument` -> `stringNullableArgumentVarargs`
`genericLiteralMapArgument` -> `genericMapArgument`
`genericLiteralMapNullable` -> `genericMapNullableLiteral`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,6 @@ public Object parseObject(final GremlinParser.GenericArgumentContext ctx) {
return visitGenericArgument(ctx);
}

/**
* Wrapper for visit function for {@link Vertex} types.
*/
public Vertex parseVertex(final GremlinParser.StructureVertexArgumentContext ctx) {
return (Vertex) visitStructureVertexArgument(ctx);
}

/**
* Wrapper for visit function for {@code Map} types.
*/
Expand Down Expand Up @@ -184,15 +177,6 @@ public Object visitGenericArgument(final GremlinParser.GenericArgumentContext ct
}
}

@Override
public Object visitStructureVertexArgument(final GremlinParser.StructureVertexArgumentContext ctx) {
if (ctx.structureVertexLiteral() != null) {
return antlr.structureVisitor.visitStructureVertexLiteral(ctx.structureVertexLiteral());
} else {
return visitVariable(ctx.variable());
}
}

@Override
public Object visitGenericMapArgument(final GremlinParser.GenericMapArgumentContext ctx) {
if (ctx.genericMapLiteral() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ protected void notImplemented(final ParseTree ctx) {
/**
* {@inheritDoc}
*/
@Override public T visitTraversalMethod_from_Vertex(final GremlinParser.TraversalMethod_from_VertexContext ctx) { notImplemented(ctx); return null; }
@Override public T visitTraversalMethod_from_GenricArgument(GremlinParser.TraversalMethod_from_GenricArgumentContext ctx) { return null; }
/**
* {@inheritDoc}
*/
Expand Down Expand Up @@ -854,7 +854,7 @@ protected void notImplemented(final ParseTree ctx) {
/**
* {@inheritDoc}
*/
@Override public T visitTraversalMethod_to_Vertex(final GremlinParser.TraversalMethod_to_VertexContext ctx) { notImplemented(ctx); return null; }
@Override public T visitTraversalMethod_to_GenricArgument(final GremlinParser.TraversalMethod_to_GenricArgumentContext ctx) { notImplemented(ctx); return null; }
/**
* {@inheritDoc}
*/
Expand Down Expand Up @@ -1367,10 +1367,6 @@ protected void notImplemented(final ParseTree ctx) {
* {@inheritDoc}
*/
@Override public T visitIoOptionsStringConstant(final GremlinParser.IoOptionsStringConstantContext ctx) { notImplemented(ctx); return null; }
/**
* {@inheritDoc}
*/
@Override public T visitStructureVertexLiteral(final GremlinParser.StructureVertexLiteralContext ctx) { notImplemented(ctx); return null; }
/**
* {@inheritDoc}
*/
Expand Down Expand Up @@ -1687,8 +1683,4 @@ protected void notImplemented(final ParseTree ctx) {
* {@inheritDoc}
*/
@Override public T visitNakedKey(final GremlinParser.NakedKeyContext ctx) { notImplemented(ctx); return null;}
/**
* {@inheritDoc}
*/
@Override public T visitStructureVertexArgument(final GremlinParser.StructureVertexArgumentContext ctx) { notImplemented(ctx); return null; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,6 @@ public Object visitNestedTraversal(final GremlinParser.NestedTraversalContext ct
return antlr.tvisitor.visitNestedTraversal(ctx);
}

@Override
public Object visitStructureVertexLiteral(final GremlinParser.StructureVertexLiteralContext ctx) {
return antlr.structureVisitor.visitStructureVertexLiteral(ctx);
}

/**
* {@inheritDoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@ public class GremlinAntlrToJava extends DefaultGremlinBaseVisitor<Object> {
*/
final TraversalPredicateVisitor traversalPredicateVisitor;

/**
* Parses structure instances like {@link Vertex}.
*/
final StructureElementVisitor structureVisitor;

/**
* Constructs a new instance and is bound to an {@link EmptyGraph}. This form of construction is helpful for
* generating {@link Bytecode} or for various forms of testing. {@link Traversal} instances constructed from this
Expand Down Expand Up @@ -196,7 +191,6 @@ protected GremlinAntlrToJava(final String traversalSourceName, final Graph graph
this.txVisitor = new TraversalSourceTxVisitor(g, this);
this.traversalPredicateVisitor = new TraversalPredicateVisitor(this);
this.traversalStrategyVisitor = new TraversalStrategyVisitor(this);
this.structureVisitor = new StructureElementVisitor(this);
this.genericVisitor = new GenericLiteralVisitor(this);
this.argumentVisitor = new ArgumentVisitor(variableResolver, this);
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -1788,16 +1788,16 @@ public Traversal visitTraversalMethod_option_Predicate_Traversal(final GremlinPa
* {@inheritDoc}
*/
@Override
public Traversal visitTraversalMethod_from_Vertex(final GremlinParser.TraversalMethod_from_VertexContext ctx) {
return graphTraversal.from(antlr.argumentVisitor.parseVertex(ctx.structureVertexArgument()));
public GraphTraversal visitTraversalMethod_from_GenricArgument(final GremlinParser.TraversalMethod_from_GenricArgumentContext ctx) {
return graphTraversal.from(antlr.argumentVisitor.visitGenericArgument(ctx.genericArgument()));
}

/**
* {@inheritDoc}
*/
@Override
public Traversal visitTraversalMethod_to_Vertex(final GremlinParser.TraversalMethod_to_VertexContext ctx) {
return graphTraversal.to(antlr.argumentVisitor.parseVertex(ctx.structureVertexArgument()));
public Traversal visitTraversalMethod_to_GenricArgument(final GremlinParser.TraversalMethod_to_GenricArgumentContext ctx) {
return graphTraversal.to(antlr.argumentVisitor.visitGenericArgument(ctx.genericArgument()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,6 @@ public Void visitNullLiteral(final GremlinParser.NullLiteralContext ctx) {
return null;
}

@Override
public Void visitStructureVertexLiteral(final GremlinParser.StructureVertexLiteralContext ctx) {
sb.append(GO_PACKAGE_NAME).append("Vertex{Element{");
visit(ctx.getChild(3)); // id
sb.append(", ");
visit(ctx.getChild(5)); // label
sb.append("}}");
return null;
}

@Override
public Void visitTraversalStrategy(final GremlinParser.TraversalStrategyContext ctx) {
if (ctx.getChildCount() == 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,6 @@ public GroovyTranslateVisitor(final String graphTraversalSourceName) {
super(graphTraversalSourceName);
}

@Override
public Void visitStructureVertexLiteral(final GremlinParser.StructureVertexLiteralContext ctx) {
sb.append("new ");
sb.append(vertexClassName);
sb.append("(");
visit(ctx.getChild(3)); // id
sb.append(", ");
visit(ctx.getChild(5)); // label
sb.append(")");
return null;
}

@Override
public Void visitIntegerLiteral(final GremlinParser.IntegerLiteralContext ctx) {
final String integerLiteral = ctx.getText().toLowerCase();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,6 @@ public JavaTranslateVisitor(final String graphTraversalSourceName) {
super(graphTraversalSourceName);
}

@Override
public Void visitStructureVertexLiteral(final GremlinParser.StructureVertexLiteralContext ctx) {
sb.append("new ");
sb.append(vertexClassName);
sb.append("(");
visit(ctx.getChild(3)); // id
sb.append(", ");
visit(ctx.getChild(5)); // label
sb.append(")");
return null;
}

@Override
public Void visitTraversalStrategy(final GremlinParser.TraversalStrategyContext ctx) {
if (ctx.getChildCount() == 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,6 @@ public JavascriptTranslateVisitor(String graphTraversalSourceName) {
super(graphTraversalSourceName);
}

@Override
public Void visitStructureVertexLiteral(final GremlinParser.StructureVertexLiteralContext ctx) {
sb.append("new Vertex(");
visit(ctx.getChild(3)); // id
sb.append(", ");
visit(ctx.getChild(5)); // label
sb.append(")");
return null;
}

@Override
public Void visitTraversalStrategy(final GremlinParser.TraversalStrategyContext ctx) {
sb.append("new ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,6 @@ public Void visitBooleanLiteral(final GremlinParser.BooleanLiteralContext ctx) {
return null;
}

@Override
public Void visitStructureVertexLiteral(final GremlinParser.StructureVertexLiteralContext ctx) {
sb.append("Vertex(");
visit(ctx.getChild(3)); // id
sb.append(", ");
visit(ctx.getChild(5)); // label
sb.append(")");
return null;
}

@Override
public Void visitTraversalStrategy(final GremlinParser.TraversalStrategyContext ctx) {
if (ctx.getChildCount() == 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@ public default GraphTraversal<S, E> from(final String fromStepLabel) {
* @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#addedge-step" target="_blank">Reference Documentation - From Step</a>
* @since 3.1.0-incubating
*/
public default GraphTraversal<S, E> to(final Traversal<?, Vertex> toVertex) {
public default GraphTraversal<S, E> to(final Traversal<?, Object> toVertex) {
final Step<?,?> prev = this.asAdmin().getEndStep();
if (!(prev instanceof FromToModulating))
throw new IllegalArgumentException(String.format(
Expand All @@ -1312,7 +1312,7 @@ public default GraphTraversal<S, E> to(final Traversal<?, Vertex> toVertex) {
* @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#addedge-step" target="_blank">Reference Documentation - From Step</a>
* @since 3.1.0-incubating
*/
public default GraphTraversal<S, E> from(final Traversal<?, Vertex> fromVertex) {
public default GraphTraversal<S, E> from(final Traversal<?, Object> fromVertex) {
final Step<?,?> prev = this.asAdmin().getEndStep();
if (!(prev instanceof FromToModulating))
throw new IllegalArgumentException(String.format(
Expand All @@ -1332,7 +1332,13 @@ public default GraphTraversal<S, E> from(final Traversal<?, Vertex> fromVertex)
* @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#addedge-step" target="_blank">Reference Documentation - From Step</a>
* @since 3.3.0
*/
public default GraphTraversal<S, E> to(final Vertex toVertex) {
public default GraphTraversal<S, E> to(final Object toVertex) {
if (toVertex instanceof String) {
return this.to((String) toVertex);
} else if (toVertex instanceof Traversal) {
this.to((Traversal<?, Object>)toVertex);
return this;
}
final Step<?,?> prev = this.asAdmin().getEndStep();
if (!(prev instanceof FromToModulating))
throw new IllegalArgumentException(String.format(
Expand All @@ -1352,7 +1358,13 @@ public default GraphTraversal<S, E> to(final Vertex toVertex) {
* @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#addedge-step" target="_blank">Reference Documentation - From Step</a>
* @since 3.3.0
*/
public default GraphTraversal<S, E> from(final Vertex fromVertex) {
public default GraphTraversal<S, E> from(final Object fromVertex) {
if (fromVertex instanceof String) {
return this.from((String) fromVertex);
} else if (fromVertex instanceof Traversal) {
this.from((Traversal<?, Object>)fromVertex);
return this;
}
final Step<?,?> prev = this.asAdmin().getEndStep();
if (!(prev instanceof FromToModulating))
throw new IllegalArgumentException(String.format(
Expand Down
Loading
Loading