0

I follow the getting started in .janusgraph.org

terminal 1:

docker run --name janusgraph-default janusgraph/janusgraph:latest

terminal 2:

docker run --rm --link janusgraph-default:janusgraph -e GREMLIN_REMOTE_HOSTS=janusgraph -it janusgraph/janusgraph:latest bash 
./bin/gremlin.sh
gremlin> :remote connect tinkerpop.server conf/remote.yaml
gremlin> :remote console

gremlin> graph = JanusGraphFactory.open('conf/janusgraph-berkeleyje-lucene-server.properties')
==>standardjanusgraph[berkeleyje:/var/lib/janusgraph/data]
gremlin> GraphOfTheGodsFactory.load(graph)
==>null
gremlin> g = graph.traversal()
==>graphtraversalsource[standardjanusgraph[berkeleyje:/var/lib/janusgraph/data], standard]

gremlin> saturn = g.V().has('name', 'saturn').next()
==>v[4304]
gremlin> g.V()
==>v[4184]
==>v[8280]
==>v[4224]
==>v[8320]
==>v[4240]
==>v[8336]
==>v[4264]
==>v[8360]
==>v[12456]
==>v[4304]
==>v[8400]
==>v[12496]
gremlin> g.V(saturn)
No such property: saturn for class: Script10
Type ':help' or ':h' for help.
Display stack trace? [yN]

What am I doing wrong? Why I cannot use saturn variable? The guide sugest conf/janusgraph-berkeleyje-lucene.properties, but in conf dir there are only *-server.properties

user3757753
  • 41
  • 2
  • 7

1 Answers1

0

I found the answer here How can I use gremlin-console to remotely create and access variables?

I cannot use variables unles connected with a session the line

:remote connect tinkerpop.server conf/remote.yaml

should be

:remote connect tinkerpop.server conf/remote.yaml session
user3757753
  • 41
  • 2
  • 7
  • The second answer to that post you referenced is actually heading towards a better way. You can use a properties file to configure your connection even when using Gremlin Server and then you do not need to use `:remote console` at all, and variables will work just as when using a TinkerGraph. You essentially have the properties file and the yaml file work together to construct a DriverRemoteConnection. If you are interested I can post an example as another answer. Running in session mode has drawbacks as the entire console session will be treated as a single transaction until you close it. – Kelvin Lawrence Nov 04 '21 at 19:46