diff --git a/docs/groovy/docker-compose.yml b/docs/groovy/docker-compose.yml new file mode 100644 index 0000000..c1631f8 --- /dev/null +++ b/docs/groovy/docker-compose.yml @@ -0,0 +1,14 @@ +# Provided as a convience to run the example .groovy files in this directory +version: '3.9' + + +services: + runner: + image: groovy:3.0.9-jdk11 + working_dir: /appsrc + command: bash -c "groovy graph-method-1.groovy" + stdin_open: true + tty: true + volumes: + - "./:/appsrc" + diff --git a/docs/groovy/graph-method-1.groovy b/docs/groovy/graph-method-1.groovy index 05357a6..8a7d8a9 100644 --- a/docs/groovy/graph-method-1.groovy +++ b/docs/groovy/graph-method-1.groovy @@ -2,7 +2,7 @@ // DEPENDENCIES /////////////////////////////////////////////////////////////////////////////// -@Grab('io.github.carnival-data:carnival-core:3.0.2-SNAPSHOT') +@Grab('io.github.carnival-data:carnival-core:3.0.1') @Grab('org.apache.tinkerpop:gremlin-core:3.4.10') @@ -106,14 +106,14 @@ class Expanders implements GraphMethods { String val = PX.NAME.valueOf(recV) List words = val.trim().split(/\s+/) - if (words.size == 0) return + if (words.size() == 0) return Vertex nameV - if (words.size == 1) { + if (words.size() == 1) { nameV = VX.NAME.instance().withProperty(PX.FIRST, words[0]).ensure(graph, g) } - if (words.size == 2) { + if (words.size() == 2) { nameV = VX.NAME.instance().withProperties( PX.FIRST, words[0], PX.LAST, words[1] diff --git a/docs/groovy/graph-model-1.groovy b/docs/groovy/graph-model-1.groovy index ca1dbed..93bbc03 100644 --- a/docs/groovy/graph-model-1.groovy +++ b/docs/groovy/graph-model-1.groovy @@ -2,7 +2,8 @@ // DEPENDENCIES /////////////////////////////////////////////////////////////////////////////// -@Grab('io.github.carnival-data:carnival-core:3.0.2-SNAPSHOT') +//@Grab('io.github.carnival-data:carnival-core:3.0.2-SNAPSHOT') +@Grab('io.github.carnival-data:carnival-core:3.0.1') @Grab('org.apache.tinkerpop:gremlin-core:3.4.10') diff --git a/docs/groovy/graph-model-2.groovy b/docs/groovy/graph-model-2.groovy index a8e6fab..ccf7926 100644 --- a/docs/groovy/graph-model-2.groovy +++ b/docs/groovy/graph-model-2.groovy @@ -2,7 +2,7 @@ // DEPENDENCIES /////////////////////////////////////////////////////////////////////////////// -@Grab('io.github.carnival-data:carnival-core:3.0.2-SNAPSHOT') +@Grab('io.github.carnival-data:carnival-core:3.0.1') @Grab('org.apache.tinkerpop:gremlin-core:3.4.10') diff --git a/docs/groovy/graph-model-3.groovy b/docs/groovy/graph-model-3.groovy index 677a6df..9fede20 100644 --- a/docs/groovy/graph-model-3.groovy +++ b/docs/groovy/graph-model-3.groovy @@ -2,7 +2,7 @@ // DEPENDENCIES /////////////////////////////////////////////////////////////////////////////// -@Grab('io.github.carnival-data:carnival-core:3.0.2-SNAPSHOT') +@Grab('io.github.carnival-data:carnival-core:3.0.1') @Grab('org.apache.tinkerpop:gremlin-core:3.4.10') diff --git a/docs/groovy/readme.md b/docs/groovy/readme.md new file mode 100644 index 0000000..64fddc5 --- /dev/null +++ b/docs/groovy/readme.md @@ -0,0 +1,9 @@ +This directory contains example scripts. + +The docker compose file can be use to start an interactive shell with groovy available on the command line: +`docker-compose run runner bash` + +From the shell, the scripts can be run as follows: +`groovy graph-model-1.groovy` + +For more see the [user documentation](https://carnival-data.github.io/carnival/#script-development). \ No newline at end of file diff --git a/docs/groovy/tutorial-1.groovy b/docs/groovy/tutorial-1.groovy index 4b83e90..3b3cc1d 100644 --- a/docs/groovy/tutorial-1.groovy +++ b/docs/groovy/tutorial-1.groovy @@ -6,8 +6,8 @@ // public snapshot repository //@GrabResolver(name='io.github.carnival-data', root='https://s01.oss.sonatype.org/content/repositories/snapshots/') -@Grab('io.github.carnival-data:carnival-core:3.0.2-SNAPSHOT') -@Grab('io.github.carnival-data:carnival-vine:3.0.2-SNAPSHOT') +@Grab('io.github.carnival-data:carnival-core:3.0.1') +@Grab('io.github.carnival-data:carnival-vine:3.0.1') @Grab('org.apache.tinkerpop:gremlin-core:3.4.10') @Grab('com.fasterxml.jackson.core:jackson-databind:2.14.1') diff --git a/docs/index.md b/docs/index.md index e241f95..8f41cbc 100644 --- a/docs/index.md +++ b/docs/index.md @@ -285,6 +285,9 @@ The example scripts use [Groovy Grape](http://docs.groovy-lang.org/latest/html/d groovy -Dgroovy.grape.report.downloads=true graph-model-1.groovy ``` +> **Note** +> To assist with running the example scripts, as an alternative to installing Groovy `docs/groovy` contains a docker-compose file to start an interactive shell with groovy available on the command line. To start the shell, from the example directory run `docker-compose run runner bash`. Scripts can be run with commands such as `groovy graph-model-1.groovy`. + ### Groovy Applications The Carnival library can be included in Gradle Groovy applications and libraries.