You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2023/10/20 13:30:21 UTC

[tinkerpop] branch master updated (9ac7ee8b1b -> 8ba85676aa)

This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


    from 9ac7ee8b1b Merge branch '3.6-dev'
     new 3357af5380 Allowed io() to recognize .graphml file extension CTR
     new 8f82dfe708 Merge branch '3.6-dev'
     new 8ba85676aa Regenerated Gremlin test files after merge CTR

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 CHANGELOG.asciidoc                                 |  1 +
 docs/src/reference/the-traversal.asciidoc          | 28 +++++++++++++++-------
 .../process/traversal/step/sideEffect/IoStep.java  |  2 +-
 .../Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs |  2 +-
 gremlin-go/driver/cucumber/gremlin.go              |  2 +-
 .../gremlin-javascript/test/cucumber/gremlin.js    |  2 +-
 gremlin-python/src/main/python/radish/gremlin.py   |  2 +-
 7 files changed, 25 insertions(+), 14 deletions(-)


[tinkerpop] 01/03: Allowed io() to recognize .graphml file extension CTR

Posted by sp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit 3357af53801fdb9e5f10d54bcccfa24126c46e1e
Author: Stephen Mallette <st...@amazon.com>
AuthorDate: Fri Oct 20 09:22:52 2023 -0400

    Allowed io() to recognize .graphml file extension CTR
---
 CHANGELOG.asciidoc                                 |  1 +
 docs/src/reference/the-traversal.asciidoc          | 28 +++++++++++++++-------
 .../process/traversal/step/sideEffect/IoStep.java  |  2 +-
 3 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 6e53144486..d451e6e03d 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -27,6 +27,7 @@ This release also includes changes from <<release-3-5-8, 3.5.8>>.
 
 * Fixed a javadoc comment in `GraphTraversal.not()` method.
 * Allowed `gremlin-driver` to be used over HTTP for experimental purposes.
+* Allowed `io()` to automatically detect ".graphml" as a file extension.
 * Deprecated the `HandshakeInterceptor` in favor of a more generic `RequestInterceptor`.
 * Fixed a bug in `StarGraph` where `EdgeFilter` did not remove associated Edge Properties.
 * Added translator to the Go GLV.
diff --git a/docs/src/reference/the-traversal.asciidoc b/docs/src/reference/the-traversal.asciidoc
index dd1e72c9f8..762f8f47f2 100644
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@ -1801,6 +1801,10 @@ The version of the formats (e.g. GraphSON 2.0 or 3.0) utilized by `io()` is dete
 of TinkerPop. It is also possible for graph providers to override these defaults, so consult the documentation of the
 underlying graph database in use for any details on that.
 
+NOTE: The `io()` step will try to automatically detect the appropriate `GraphReader` or `GraphWriter` to use based on
+the file extension. If the file has a different extension than the ones expected, use `with()` as shown above to set the
+`reader` or `writer` explicitly.
+
 For more advanced configuration of `GraphReader` and `GraphWriter` operations (e.g. normalized output for GraphSON,
 disabling class registrations for Gryo, etc.) then construct the appropriate `GraphReader` and `GraphWriter` using
 the `build()` method on their implementations and use it directly. It can be passed directly to the `IO.reader` or
@@ -1823,16 +1827,18 @@ WARNING: GraphML is a "lossy" format in that it only supports primitive values f
 support for `Graph` variables.  It will use `toString` to serialize property values outside of those primitives.
 
 WARNING: GraphML as a specification allows for `<edge>` and `<node>` elements to appear in any order.  Most software
-that writes GraphML (including as TinkerPop's `GraphMLWriter`) write `<node>` elements before `<edge>` elements.  However it
-is important to note that `GraphMLReader` will read this data in order and order can matter.  This is because TinkerPop
-does not allow the vertex label to be changed after the vertex has been created.  Therefore, if an `<edge>` element
-comes before the `<node>`, the label on the vertex will be ignored.  It is thus better to order `<node>` elements in the
-GraphML to appear before all `<edge>` elements if vertex labels are important to the graph.
+that writes GraphML (including as TinkerPop's `GraphMLWriter`) write `<node>` elements before `<edge>` elements.
+However it is important to note that `GraphMLReader` will read this data in order and order can matter.  This is because
+TinkerPop does not allow the vertex label to be changed after the vertex has been created.  Therefore, if an `<edge>`
+element comes before the `<node>`, the label on the vertex will be ignored.  It is thus better to order `<node>`
+elements in the GraphML to appear before all `<edge>` elements if vertex labels are important to the graph.
 
 [source,java]
 ----
-g.io("graph.xml").read().iterate()
-g.io("graph.xml").write().iterate()
+// expects a file extension of .xml or .graphml to determine that
+// a GraphML reader/writer should be used.
+g.io("graph.xml").read().iterate();
+g.io("graph.xml").write().iterate();
 ----
 
 NOTE: If using GraphML generated from TinkerPop 2.x, read more about its incompatibilities in the
@@ -1852,8 +1858,10 @@ but it is generally best used in two cases:
 
 [source,java]
 ----
-g.io("graph.json").read().iterate()
-g.io("graph.json").write().iterate()
+// expects a file extension of .json to interpret that
+// a GraphSON reader/writer should be used
+g.io("graph.json").read().iterate();
+g.io("graph.json").write().iterate();
 ----
 
 NOTE: Additional documentation for GraphSON can be found in the link:https://tinkerpop.apache.org/docs/x.y.z/dev/io/#graphson[IO Reference].
@@ -1877,6 +1885,8 @@ other.  Failure to do so, may result in errors.
 
 [source,java]
 ----
+// expects a file extension of .kryo to interpret that
+// a GraphSON reader/writer should be used
 g.io("graph.kryo").read().iterate()
 g.io("graph.kryo").write().iterate()
 ----
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/IoStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/IoStep.java
index dc5f0403c5..3adff7f0b8 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/IoStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/IoStep.java
@@ -210,7 +210,7 @@ public class IoStep<S> extends AbstractStep<S,S> implements ReadWriting {
             return IO.gryo;
         else if (file.endsWith(".json"))
             return IO.graphson;
-        else if (file.endsWith(".xml"))
+        else if (file.endsWith(".xml") || file.endsWith(".graphml"))
             return IO.graphml;
         else
             throw new IllegalStateException("Could not detect the file format - specify the writer explicitly or rename file with a standard extension");


[tinkerpop] 02/03: Merge branch '3.6-dev'

Posted by sp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit 8f82dfe708d1be367ae2aa0a6a3f2d4648de1eae
Merge: 9ac7ee8b1b 3357af5380
Author: Stephen Mallette <st...@amazon.com>
AuthorDate: Fri Oct 20 09:23:18 2023 -0400

    Merge branch '3.6-dev'

 CHANGELOG.asciidoc                                 |  1 +
 docs/src/reference/the-traversal.asciidoc          | 28 +++++++++++++++-------
 .../process/traversal/step/sideEffect/IoStep.java  |  2 +-
 3 files changed, 21 insertions(+), 10 deletions(-)



[tinkerpop] 03/03: Regenerated Gremlin test files after merge CTR

Posted by sp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit 8ba85676aa37e90c877f50b971451dbd376b5b9f
Author: Stephen Mallette <st...@amazon.com>
AuthorDate: Fri Oct 20 09:29:58 2023 -0400

    Regenerated Gremlin test files after merge CTR
---
 gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs      | 2 +-
 gremlin-go/driver/cucumber/gremlin.go                                   | 2 +-
 .../src/main/javascript/gremlin-javascript/test/cucumber/gremlin.js     | 2 +-
 gremlin-python/src/main/python/radish/gremlin.py                        | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs
index 410c6f3d6c..657fc9f5f6 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs
@@ -604,7 +604,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                {"g_injectXdatetimeXstrXX_dateAddXminute_10X", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject(DateTimeOffset.FromUnixTimeMilliseconds(1690934400000)).DateAdd(DT.Minute,10)}}, 
                {"g_injectXdatetimeXstrXX_dateAddXsecond_20X", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject(DateTimeOffset.FromUnixTimeMilliseconds(1690934400000)).DateAdd(DT.Second,20)}}, 
                {"g_injectXdatetimeXstrXX_dateAddXday_11X", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject(DateTimeOffset.FromUnixTimeMilliseconds(1693958400000)).DateAdd(DT.Day,11)}}, 
-               {"g_injectXdatetimeXXX_dateDiffXdatetimeXstrXX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject(DateTimeOffset.FromUnixTimeMilliseconds(1697732331987)).DateDiff(DateTimeOffset.FromUnixTimeMilliseconds(1673481600000)).Is(P.Gt(0))}}, 
+               {"g_injectXdatetimeXXX_dateDiffXdatetimeXstrXX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject(DateTimeOffset.FromUnixTimeMilliseconds(1697808371721)).DateDiff(DateTimeOffset.FromUnixTimeMilliseconds(1673481600000)).Is(P.Gt(0))}}, 
                {"g_injectXdatetimeXstr1XX_dateDiffXdatetimeXstr2XX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject(DateTimeOffset.FromUnixTimeMilliseconds(1690934400000)).DateDiff(DateTimeOffset.FromUnixTimeMilliseconds(1691539200000))}}, 
                {"g_injectXdatetimeXstr1XX_dateDiffXinjectXdatetimeXstr2XXX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject(DateTimeOffset.FromUnixTimeMilliseconds(1691452800000)).DateDiff(__.Inject(DateTimeOffset.FromUnixTimeMilliseconds(1690848000000)))}}, 
                {"g_V_EX11X", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().E(p["eid11"])}}, 
diff --git a/gremlin-go/driver/cucumber/gremlin.go b/gremlin-go/driver/cucumber/gremlin.go
index d78543feac..1d42e51d2e 100644
--- a/gremlin-go/driver/cucumber/gremlin.go
+++ b/gremlin-go/driver/cucumber/gremlin.go
@@ -575,7 +575,7 @@ var translationMap = map[string][]func(g *gremlingo.GraphTraversalSource, p map[
     "g_injectXdatetimeXstrXX_dateAddXminute_10X": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(time.UnixMilli(1690934400000)).DateAdd(gremlingo.DT.Minute, 10)}}, 
     "g_injectXdatetimeXstrXX_dateAddXsecond_20X": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(time.UnixMilli(1690934400000)).DateAdd(gremlingo.DT.Second, 20)}}, 
     "g_injectXdatetimeXstrXX_dateAddXday_11X": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(time.UnixMilli(1693958400000)).DateAdd(gremlingo.DT.Day, 11)}}, 
-    "g_injectXdatetimeXXX_dateDiffXdatetimeXstrXX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(time.UnixMilli(1697732427057)).DateDiff(time.UnixMilli(1673481600000)).Is(gremlingo.P.Gt(0))}}, 
+    "g_injectXdatetimeXXX_dateDiffXdatetimeXstrXX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(time.UnixMilli(1697808379990)).DateDiff(time.UnixMilli(1673481600000)).Is(gremlingo.P.Gt(0))}}, 
     "g_injectXdatetimeXstr1XX_dateDiffXdatetimeXstr2XX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(time.UnixMilli(1690934400000)).DateDiff(time.UnixMilli(1691539200000))}}, 
     "g_injectXdatetimeXstr1XX_dateDiffXinjectXdatetimeXstr2XXX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(time.UnixMilli(1691452800000)).DateDiff(gremlingo.T__.Inject(time.UnixMilli(1690848000000)))}}, 
     "g_V_EX11X": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().E(p["eid11"])}}, 
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/gremlin.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/gremlin.js
index 143c01f38b..9deec36034 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/gremlin.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/gremlin.js
@@ -595,7 +595,7 @@ const gremlins = {
     g_injectXdatetimeXstrXX_dateAddXminute_10X: [function({g}) { return g.inject(new Date(1690934400000)).dateAdd(DT.minute,10) }], 
     g_injectXdatetimeXstrXX_dateAddXsecond_20X: [function({g}) { return g.inject(new Date(1690934400000)).dateAdd(DT.second,20) }], 
     g_injectXdatetimeXstrXX_dateAddXday_11X: [function({g}) { return g.inject(new Date(1693958400000)).dateAdd(DT.day,11) }], 
-    g_injectXdatetimeXXX_dateDiffXdatetimeXstrXX: [function({g}) { return g.inject(new Date(1697731998344)).dateDiff(new Date(1673481600000)).is(P.gt(0)) }], 
+    g_injectXdatetimeXXX_dateDiffXdatetimeXstrXX: [function({g}) { return g.inject(new Date(1697808304397)).dateDiff(new Date(1673481600000)).is(P.gt(0)) }], 
     g_injectXdatetimeXstr1XX_dateDiffXdatetimeXstr2XX: [function({g}) { return g.inject(new Date(1690934400000)).dateDiff(new Date(1691539200000)) }], 
     g_injectXdatetimeXstr1XX_dateDiffXinjectXdatetimeXstr2XXX: [function({g}) { return g.inject(new Date(1691452800000)).dateDiff(__.inject(new Date(1690848000000))) }], 
     g_V_EX11X: [function({g, eid11}) { return g.V().E(eid11) }], 
diff --git a/gremlin-python/src/main/python/radish/gremlin.py b/gremlin-python/src/main/python/radish/gremlin.py
index eec8faa862..70002aaa9a 100644
--- a/gremlin-python/src/main/python/radish/gremlin.py
+++ b/gremlin-python/src/main/python/radish/gremlin.py
@@ -577,7 +577,7 @@ world.gremlins = {
     'g_injectXdatetimeXstrXX_dateAddXminute_10X': [(lambda g:g.inject(datetime.datetime.utcfromtimestamp(1690934400000 / 1000.0)).date_add(DT.minute,10))], 
     'g_injectXdatetimeXstrXX_dateAddXsecond_20X': [(lambda g:g.inject(datetime.datetime.utcfromtimestamp(1690934400000 / 1000.0)).date_add(DT.second,20))], 
     'g_injectXdatetimeXstrXX_dateAddXday_11X': [(lambda g:g.inject(datetime.datetime.utcfromtimestamp(1693958400000 / 1000.0)).date_add(DT.day,11))], 
-    'g_injectXdatetimeXXX_dateDiffXdatetimeXstrXX': [(lambda g:g.inject(datetime.datetime.utcfromtimestamp(1697732148807 / 1000.0)).date_diff(datetime.datetime.utcfromtimestamp(1673481600000 / 1000.0)).is_(P.gt(0)))], 
+    'g_injectXdatetimeXXX_dateDiffXdatetimeXstrXX': [(lambda g:g.inject(datetime.datetime.utcfromtimestamp(1697808315145 / 1000.0)).date_diff(datetime.datetime.utcfromtimestamp(1673481600000 / 1000.0)).is_(P.gt(0)))], 
     'g_injectXdatetimeXstr1XX_dateDiffXdatetimeXstr2XX': [(lambda g:g.inject(datetime.datetime.utcfromtimestamp(1690934400000 / 1000.0)).date_diff(datetime.datetime.utcfromtimestamp(1691539200000 / 1000.0)))], 
     'g_injectXdatetimeXstr1XX_dateDiffXinjectXdatetimeXstr2XXX': [(lambda g:g.inject(datetime.datetime.utcfromtimestamp(1691452800000 / 1000.0)).date_diff(__.inject(datetime.datetime.utcfromtimestamp(1690848000000 / 1000.0))))], 
     'g_V_EX11X': [(lambda g, eid11=None:g.V().E(eid11))],