diff --git a/ChangeHistory.md b/ChangeHistory.md index e0955764..bc089b9b 100755 --- a/ChangeHistory.md +++ b/ChangeHistory.md @@ -5,7 +5,8 @@ Starting with the v275 release, this file will contain a record of the major cha ## Release 283 change history (Release date TBD) Here is a link to the [Git diffs](https://github.com/krlawrence/graph/compare/v282-tp-3.4.4...master) between this release and the prior one. -- Moved the supported TinkerPop version up to 3.5.1. Issue #228 +- Moved the supported TinkerPop version up to 3.5.2. Issue #228 +- Added a section describing the changes added as part of the TinkerPop 3.6.0 release. - Upated all sections to remove any use of `Order.decr` and `Order.incr` except where explicitly discussing their removal from Gremlin as of 3.5.0 in favor of `Order.asc` and `Order.desc`. Issue #228 - Added a new section "Comparing properties to the value of a sack". Issue #163 - Added a new section "Using `index` to reverse a list" Issue #220 @@ -37,6 +38,7 @@ Here is a link to the [Git diffs](https://github.com/krlawrence/graph/compare/v2 - Added `RemoteWriteText.java` which shows how to turn traversals and GraphSON back into text queries. - Fixed a compile error in TinkerGraphTest.java caused by a change to the `valueMap` return type. Issue #181 - Fixed two compile errors in RemoteClient.java caused by a change to the `valueMap` return type. Issue #181 + - Added a new sample `go-basic.go` that provides examples of using the new Gremlin Go client - Sample data updates - Added a SQL version of the air routes data to a new `SQL` sub folder under `sample-data`. Issue #214 - Added an RDF version of the air routes data to a new `RDF` sub folder under `sample-data`. Issue #232 diff --git a/README.md b/README.md index c924f845..0d9ee08b 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,8 @@ This repository is the home for the source materials, sample code and examples f To read the latest snapshot of the book right away in a browser (HTML format) click [here](http://kelvinlawrence.net/book/PracticalGremlin.html) or for a PDF version click [here](http://kelvinlawrence.net/book/PracticalGremlin.pdf). These snapshots are updated regularly. You will find other formats including MOBI, EPUB and XML (Docbook) in the [releases](https://github.com/krlawrence/graph/releases) section. Formal releases will be published periodically assuming there is enough new material to make it worthwhile. If you want to see the absolute latest updates you can always browse the Asciidoc source file (Gremlin-Graph-Guide.adoc) in the /book folder. The PDF version is currently the "official" version. It has a better table of contents, some better formatting and a much nicer title page! **LATEST NEWS:** - +- [May-04-2022] The latest preview draft of revision 283 (TP 3.5.1) is now available in HTML and PDF versions. See [change history](https://github.com/krlawrence/graph/blob/master/ChangeHistory.md) for details. - [Aug-31-2021] Updated versions of the sample data and corresponding demo apps have been uploaded. -- [Aug-02-2021] The latest preview draft of revision 283 (TP 3.5.1) is now available in HTML and PDF versions. See [change history](https://github.com/krlawrence/graph/blob/master/ChangeHistory.md) for details. - [Jun-28-2020] I have started creating a series of [issues](https://github.com/krlawrence/graph/issues) to capture changes and updates I hope to make soon. The issues contain some interesting examples of both new Gremlin features and some additional queries, some of which are quite advanced, that I intend to add to the manuscript as time allows. The issues have been sorted into a Kanban board which can be found in the Projects area. - [Oct-26-2019] Revision 282 (TP 3.4.4) was just published in all formats. See [change history](https://github.com/krlawrence/graph/blob/master/ChangeHistory.md) for details. @@ -126,13 +125,13 @@ Chapter 9 - FURTHER READING **NEWS ARCHIVE:** - -[Jul-31-2021] Updated versions of the sample data and corresponding demo apps have been uploaded. +[Aug-02-2021] The latest preview draft of revision 283 (TP 3.5.1) is now available in HTML and PDF versions. See [change history](https://github.com/krlawrence/graph/blob/master/ChangeHistory.md) for details. +[Jul-31-2021] Updated versions of the sample data and corresponding demo apps have been uploaded. [Jul-10-2021] The latest preview draft of revision 283 (TP 3.4.10) is now available in HTML and PDF versions. See [change history](https://github.com/krlawrence/graph/blob/master/ChangeHistory.md) for details. [Mar-21-2021] The latest preview draft of revision 283 (TP 3.4.10) is now available in HTML and PDF versions. See [change history](https://github.com/krlawrence/graph/blob/master/ChangeHistory.md) for details. [Mar-14-2021] The latest preview draft of revision 283 (TP 3.4.10) is now available in HTML and PDF versions. See [change history](https://github.com/krlawrence/graph/blob/master/ChangeHistory.md) for details. [Aug-28-2020] The latest preview draft of revision 283 (TP 3.4.8) is now available in HTML and PDF versions. See [change history](https://github.com/krlawrence/graph/blob/master/ChangeHistory.md) for details. -[Feb-01-2020] Updated versions of the sample data and corresponding demo apps have been uploaded. +[Feb-01-2020] Updated versions of the sample data and corresponding demo apps have been uploaded. [Jan-06-2020] The latest draft of revision 283 (TP 3.4.4 preview) is now available in HTML and PDF versions. See [change history](https://github.com/krlawrence/graph/blob/master/ChangeHistory.md) for details. [Oct-13-2019] Updated versions of the sample data and corresponding demo apps have been uploaded. [Oct-26-2019] Revision 282 (TP 3.4.4) was just published in all formats. See [change history](https://github.com/krlawrence/graph/blob/master/ChangeHistory.md) for details. diff --git a/book/Gremlin-Graph-Guide.adoc b/book/Gremlin-Graph-Guide.adoc index c8b73a66..80c20042 100755 --- a/book/Gremlin-Graph-Guide.adoc +++ b/book/Gremlin-Graph-Guide.adoc @@ -2,9 +2,9 @@ PRACTICAL GREMLIN: An Apache TinkerPop Tutorial =============================================== Kelvin R. Lawrence //v281 (TP 3.3.5), January 28th 2019 -v283-preview, August 2nd 2021 +v283-preview, May 4th 2022 // vim: set tw=85 cc=+1 wrap spell redrawtime=20000: -// Mon Aug 02, 2021 14:22:17 CDT +// Wed May 04, 2022 08:20:08 CDT //:Author: Kelvin R. Lawrence //:Email: gfxman@yahoo.com :Numbered: @@ -25,8 +25,8 @@ v283-preview, August 2nd 2021 :doctype: book :icons: font //:pdf-page-size: Letter -:draftdate: August 2nd 2021 -:tpvercheck: 3.5.1 +:draftdate: May 4th 2022 +:tpvercheck: 3.5.2 // NOTE1: I updated the paraiso-dark style so that source code with a style of text // has a white foreground color. The default was unreadable, @@ -344,13 +344,56 @@ removed from the Gremlin language. The newer 'Order.asc' and 'Order.desc' must b used instead. The examples in this book and those in the `sample-code` folder have been updated to reflect these changes. -As always, check the level of ApacheTinkerPop the graph database you are using -supports to make sure the features you want to use are supported. +In January 2022, the TinkerPop 3.5.2 release added a native `datetime` operator to +the Gremlin language such that dates can be added without needing programming +language specific constructs. This is useful when sending Gremlin queries as text +strings. NOTE: Full details of all the new features added in the TinkerPop 3.5.x releases can be found at the following link: https://github.com/apache/tinkerpop/blob/master/CHANGELOG.asciidoc +[[tp36intro]] +Introducing TinkerPop 3.6 +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Apache TinkerPop 3.6.0 was released in April 2022. Coming almost exactly a year after +the initial 3.5.0 release, this is one of the most significant TinkerPop releases +since TinkerPop 3.4.0 appeared in January 2019. The release contains many +improvements, including several new Gremlin steps, designed to make commonly +performed tasks much easier. Notable improvements include: + +- New 'mergeV' and 'mergeE' steps that make "create if not exist" + type queries, sometimes referred to as "upserts", much easier to write. Over time, + these steps will replace use of the 'fold...coalesce' pattern, and will also + replace the various "map injection" patterns that can be used to create multiple + vertices and edges in a single query. +- A new 'TextP.regex' predicate that allows regular expressions to be + used when comparing strings. +- The 'property' step can now be given a map of key/value pairs so that several + properties can be created at once. +- A new 'element' step that can be used to find the parent element (vertex or edge) + of a property. +- A new 'call' step that lays the foundation enabling Gremlin queries to call other + endpoints. This opens up many types of interesting use cases such as query + federation, and looking up values from other services. +- A lot of effort has been put into removing unnecessary exceptions by filtering out + parts of traversals instead of failing with an error. This is especially so in the + case of 'by' modulators that now filter when a value does not exist rather than + throw an exception. This work began as part of the TinkerPop 3.5.2 update and is + completed as of TinkerPop 3.6.0. +- A new 'fail' step that can be used to abort a query in a controlled way. + +Over time, new sections will be added to this book that cover each of these features +in detail. + +As always, check the level of ApacheTinkerPop the graph database you are using +supports before trying to use these new features. + +NOTE: Full details of all the new features added in the TinkerPop 3.6.x releases can be +found at the following link: +https://github.com/apache/tinkerpop/blob/master/CHANGELOG.asciidoc + [[whygraph]] So what is a graph database and why should I care? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -550,7 +593,8 @@ with Gremlin when entering queries into the Console or sending them via REST API Gremlin Server. All of these topics are covered in detail in this book. The queries used as examples in this book have been tested with Apache TinkerPop -version 3.3. using the TinkerGraph graph and the Gremlin console as well as some +version {tpvercheck} as well as many prior releases. Tests were performed using the +TinkerGraph in memory graph and the Gremlin console, as well as other TinkerPop 3 enabled graph stores. [[gconsole]] diff --git a/book/README.md b/book/README.md index 09a524c8..4c6f4a7f 100644 --- a/book/README.md +++ b/book/README.md @@ -3,7 +3,7 @@ This folder contains the AsciiDoc source file used to produce the HTML, XML (DOC **LATEST NEWS:** -- [Aug-2-2021] The latest preview draft of revision 283 (TP 3.5.1) is now available in HTML and PDF versions. See [change history](https://github.com/krlawrence/graph/blob/master/ChangeHistory.md) for details. +- [May-4-2022] The latest preview draft of revision 283 (TP 3.5.2) is now available in HTML and PDF versions. See [change history](https://github.com/krlawrence/graph/blob/master/ChangeHistory.md) for details. - [Oct-26-2019] Revision 282 (TP 3.4.4) was just published in all formats. See [change history](https://github.com/krlawrence/graph/blob/master/ChangeHistory.md) for details. @@ -31,6 +31,7 @@ Please note that the DOCBOOK, EPUB and MOBI format files currently do not have a **ARCHIVED NEWS:** +- [Aug-2-2021] The latest preview draft of revision 283 (TP 3.5.1) is now available in HTML and PDF versions. See [change history](https://github.com/krlawrence/graph/blob/master/ChangeHistory.md) for details. [Jul-10-2021] The latest preview draft of revision 283 (TP 3.4.10) is now available in HTML and PDF versions. See [change history](https://github.com/krlawrence/graph/blob/master/ChangeHistory.md) for details. [Mar-21-2021] The latest preview draft of revision 283 (TP 3.4.8) is now available in HTML and PDF versions. See [change history](https://github.com/krlawrence/graph/blob/master/ChangeHistory.md) for details. [Mar-14-2021] The latest preview draft of revision 283 (TP 3.4.8) is now available in HTML and PDF versions. See [change history](https://github.com/krlawrence/graph/blob/master/ChangeHistory.md) for details. diff --git a/sample-code/RemoteQueryPool.java b/sample-code/RemoteQueryPool.java index 0a9056a4..da8a9719 100644 --- a/sample-code/RemoteQueryPool.java +++ b/sample-code/RemoteQueryPool.java @@ -247,7 +247,7 @@ public static void main(String[] args) long stop = System.currentTimeMillis(); - // All done, shit down the pool, close the server connection and calculate how long the + // All done, shut down the pool, close the server connection and calculate how long the // workload took to run. rqp.closeConnection(); rqp.shutdown(); diff --git a/sample-code/go-basic.go b/sample-code/go-basic.go index bd47320f..14c45f08 100644 --- a/sample-code/go-basic.go +++ b/sample-code/go-basic.go @@ -19,7 +19,7 @@ import ( ) // Server and port we want to connect to -const Host = "krl-6-i1-cluster.cluster-cm9t6tfwbtsr.us-east-1.neptune.amazonaws.com" +const Host = "" const Port = 8182 // Define a few shortcuts to commonly used Gremlin constructs diff --git a/sample-code/regression.groovy b/sample-code/regression.groovy index 1a0cfed5..b0353414 100644 --- a/sample-code/regression.groovy +++ b/sample-code/regression.groovy @@ -24,7 +24,8 @@ println "Reported version is $ver";[] assert ver[0]=='3' && ((ver[2]=='3' && ver[4].toInteger() >= 1) || (ver[2]=='4' && ver[4].toInteger() >= 0) - || (ver[2]=='5' && ver[4].toInteger() >= 0));[] + || (ver[2]=='5' && ver[4].toInteger() >= 0) + || (ver[2]=='6' && ver[4].toInteger() >= 0));[] n=status( "Checking air-routes version",n);[] ver=g.V().hasLabel('version').values('code').next();[]