krlawrence / graph

Practical Gremlin - An Apache TinkerPop Tutorial
Apache License 2.0
830 stars 251 forks source link

How to load data #168

Closed amber-moe closed 4 years ago

amber-moe commented 4 years ago

I'm using the gremlin console docker on Mac. I don't follow the instructions in 2.6. Loading the air-routes graph using the Gremlin console. I don't know where to download the file load-air-routes-graph.groovy and air-routes.graphml. image

krlawrence commented 4 years ago

As documented in the manuscript all sample code and data is in the repo. Please try looking here: https://github.com/krlawrence/graph/tree/master/sample-data

jcjp commented 4 years ago

I am having issue as well on loading the sample data air-routes-latest.graphml tried using :load or the function graph.io(graphml()).readGraph('air-routes.graphml') here is my exact terminal:

gremlin> :load air-routes.graphml
File not found: "air-routes.graphml"
gremlin> :load ./air-routes.graphml
File not found: "./air-routes.graphml"
gremlin> graph.io(graphml()).readGraph('air-routes.graphml')
air-routes.graphml (No such file or directory)
Type ':help' or ':h' for help.

I also tried using the exact path or using ~ but no luck as well. I used curl to download the file and also tried cloning your repo and use only the sample data air-routes.graphml but still same error.

Edit: I got this working by using this command on the terminal in Ubuntu: ./gremlin.sh -i load-air-routes-graph.groovy but before you execute this command edit the file load-air-routes-graph.groovy replace the path of 'air-routes.graphml' to the absolute path and desired data file e.g. home/user/projects/grem-console/bin/air-routes-latest.graphml

krlawrence commented 4 years ago

I was about to suggest trying the absolute path. Glad that you got it working.

imanabu commented 2 years ago

For those who run into this issue and arrived here, and if your only purpose is to try out the queries in the book, I have built a docker container where all need to do is to launch it, run start.sh inside and you will be ready to query away in the console. No Java install, no directory or paths to worry about.

Please start here: Air Routes Gremlin Console

krlawrence commented 2 years ago

Thanks for sharing. Looks useful!