blob: 5ba15949bf299f7f23ec518c6fb6ceba70f83836 [file] [log] [blame]
////
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
////
= TinkerPop 3.7.0
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/images/gremlin-running.png[width=185]
*NOT OFFICIALLY NAMED YET*
== TinkerPop 3.7.0
*Release Date: NOT OFFICIALLY RELEASED YET*
Please see the link:https://github.com/apache/tinkerpop/blob/3.7.0/CHANGELOG.asciidoc#release-3-7-0[changelog] for a complete list of all the modifications that are part of this release.
=== Upgrading for Users
==== Properties on Elements
===== Introduction
By default properties on `Element` are now returned for OLTP requests. Gremlin Server 3.5 and 3.6 can return properties only in some special cases.
More history details about serialization of properties can be found in the link:https://lists.apache.org/thread/xltcon4zxnwq4fyw2r2126syyrqm8spy[Stephen's post].
===== Behavior for OLAP queries
Queries still won't return properties on Elements. The main reason for this is performance considerations.
If you need to get a property, then this can be explicitly configured with `HaltedTraverserStrategy`
[source,java]
----
g.withComputer().withStrategies(HaltedTraverserFactoryStrategy.detached())
----
===== Output comparison for Gremlin Server 3.5/3.6 and 3.7
Let's take a closer look at a Javascript GLV code example in 3.6 and 3.7:
[source,javascript]
----
const client = new Client('ws://localhost:8182/gremlin',{traversalSource: 'gmodern'});
await client.open();
const result = await client.submit('g.V(1)');
console.log(JSON.stringify(result.first()));
await client.close();
----
The result will be different depending on the version of Gremlin Server.
For 3.5/3.6:
[source,json]
----
{"id":1,"label":"person"}
----
For 3.7:
[source,json]
----
{"id":1,"label":"person","properties":{"name":[{"id":0,"label":"name","value":"marko","key":"name"}],"age":[{"id":1,"label":"age","value":29,"key":"age"}]}}
----
===== Enabling the previous behavior
The GLVs in 3.5/3.6 will not be able to work correctly with properties on Elements. If you don't need to get properties then you can do one of the following:
* To configure Gremlin Server to not return properties, update Gremlin Server initialization script with `ReferenceElementStrategy`.
This method is better to use with 3.5/3.6 GLVs.
For example
[source,groovy]
----
globals << [g : traversal().withEmbedded(graph).withStrategies(ReferenceElementStrategy)]
----
* Use config per request `with('materializeProperties', 'tokens')`
[source,csharp]
----
g.With("materializeProperties", "tokens").V(1).Next()
----
===== Possible issues
ReferenceElement-type objects are no longer returned - you get a DetachedElement from remote requests. If you have not been implementing the `Element` interfaces then you will need to update the code to use interfaces like `Vertex` and `Edge`.
See: link:https://issues.apache.org/jira/browse/TINKERPOP-2824[TINKERPOP-2824]
==== Gremlin.NET: Nullable Annotations
Gremlin.NET now uses link:https://learn.microsoft.com/en-us/dotnet/csharp/nullable-references#nullable-variable-annotations[nullable annotations]
to state wether an argument or a return value can be null or not. This should make it much less likely to get a
`NullReferenceException` from Gremlin.NET.
This change required to make some breaking changes but most users should not be affected by this as the breaking
changes are limited to APIs that are mostly intended for graph driver providers.
See: link:https://issues.apache.org/jira/browse/TINKERPOP-2348[TINKERPOP-2348]
==== Removed connectOnStartup javascript
Removed the `connectOnStartup` option for Gremlin Javascript API to resolve potential `unhandledRejection` and race
conditions. New `DriverRemoteConnection` objects no longer initiate connection by default at startup. Call `open()`
explicitly if one wishes to manually connect on startup.
For example:
[source,javascript]
----
const drc = new DriverRemoteConnection(url);
drc.open().catch(err => {
// Handle error upon open.
})
----
==== Creation of New `gremlin-util` Module
`gremlin-driver` has been refactored and several classes have been extracted to a new `gremlin-util` module. Any classes
which are utilized by both `gremlin-driver` and `gremlin-server` have been extracted to `gremlin-util`. This includes
the entire `tinkerpop.gremlin.driver.ser` and `tinkerpop.gremlin.driver.message` packages as well as
`tinkerpop.gremlin.driver.MessageSerializer` and `tinkerpop.gremlin.driver.Tokens`. For a full list of the migrated
classes, see: link:https://issues.apache.org/jira/browse/TINKERPOP-2819[TINKERPOP-2819].
All migrated classes have had their packages updated to reflect this change. For these classes, packages have changed
from `tinkerpop.gremlin.driver.*` to `tinkerpop.gremlin.util.*`. For example
`org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1` has been updated to
`org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV1`. All imports of these classes should be updated
to reflect this change. All server config files which declare a list of serializers should also be updated to
reflect the new location of serializer classes.
See: link:https://issues.apache.org/jira/browse/TINKERPOP-2819[TINKERPOP-2819]
==== Removal of `gremlin-driver` from `gremlin-server`
`gremlin-driver` is no longer a dependency of `gremlin-server` and thus will no longer be packaged in server
distributions. Any app which makes use of both `gremlin-driver` and `gremlin-server` will now need to directly
include both modules.
==== Building and Running with JDK 17
You can now run TinkerPop with Java 17. Be advised that there are some issues with reflection and so you may need to
either --add-opens or --add-exports certain modules to enable it to work with Java 17. This mostly affects the Kryo
serialization library which is used with OLAP. If you use OLTP, then you may not need to add any of these options to
the JVM. The following are only examples used by TinkerPop's automated tests and are placed here for convenience.
--add-opens=java.base/java.io=ALL-UNNAMED
--add-opens=java.base/java.nio=ALL-UNNAMED
--add-opens=java.base/sun.nio.cs=ALL-UNNAMED
--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.base/java.lang.invoke=ALL-UNNAMED
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED
--add-opens=java.base/java.util=ALL-UNNAMED
--add-opens=java.base/java.util.concurrent=ALL-UNNAMED
--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED
--add-opens=java.base/java.net=ALL-UNNAMED
=== Upgrading for Providers
==== Graph Driver Providers
===== Gremlin.NET: Nullable Reference Types
Enabling nullable reference types comes with some breaking changes in Gremlin.NET which can affect driver providers.
GraphBinary APIs changed to make better use of nullable reference types. Instead of one method `WriteValueAsync` and
one method `ReadValueAsync`, there are now methods `WriteNullableValueAsync` and `ReadNullableValueAsync` that allow
`null` values and methods `WriteNonNullableValueAsync` and `ReadNonNullableValueAsync` that do not allow `null` values.
Some `set` property accessors were removed from some pure data classes in the `Structure` and the `Driver.Messages`
namespaces to initialize these properties directly from the constructor which ensures that they are really not `null`.
We also used this opportunity to convert some of these pure data classes into a `record`.
See: link:https://issues.apache.org/jira/browse/TINKERPOP-2348[TINKERPOP-2348]
===== Reworked Gremlin Socket Server
The `SimpleSocketServer` from `gremlin-driver` has been brought into a new module `gremlin-tools/gremlin-socket-server`
and it has been adapted to be usable by all drivers for testing. See more about creating gremlin socket server tests
link:https://tinkerpop.apache.org/docs/x.y.z/dev/developer/#gremlin-socket-server-tests[here].
===== Mid-traversal E()
Traversals now support mid-traversal E()-steps.
Prior to this change you were limited to using E()-step only at the start of traversal, but now you can this step in
the middle. This improvement makes it easier for users to build certain types of queries. For example, get edges with
label knows, if there is none then add new one between josh and vadas.
`g.inject(1).coalesce(E().hasLabel("knows"), addE("knows").from(V().has("name","josh")).to(V().has("name","vadas")))`
Another reason is to make E() and V() steps equivalent in terms of use in the middle of traversal.
See link:https://issues.apache.org/jira/browse/TINKERPOP-2798[TINKERPOP-2798]