Jamie Burns
Jamie Burns
JJanusGraph
Created by Jamie Burns on 3/11/2024 in #questions
script in empty-sample.groovy is called twice
I have JanusGraph running as it's own process and remote to it from Gremlin. Since i'm learning, i create an in-memory graph in empty-sample.goovy when i start JanusGraph g = graph.traversal() rV = g.addV('r').property('name', 'r-name').next() bV = g.addV('b').property('name', 'b-name').next() lV = g.addV('l').property('name', 'l-name').next() g.V(rV).addE('c').to(bV).property('name', 'r-b').next() g.V(rV).addE('ht').to(lV).property('name', 'r-ht').next() g.tx().commit() System.out.println( ">>>>>> post tx commit" ) g.V().each( System.out::println ) This outputs 3 vertices as i would expect. >>>>>> post tx commit ... v[4224] v[4256] v[4272] However, when i start Gremlin and :remote connect, it seems to run empty-sample.groovy again. Now i have duplicate vertices. >>>>>> post tx commit ... v[4224] v[4256] v[4272] v[8368] v[12464] v[4296] My yaml file has scriptEngines: { gremlin-groovy: { plugins: { ..., org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: [scripts/empty-sample.groovy]}}}} If this is expected behaviour - run the script on JanusGraph startup and then again on each(?) remote Gremlin connection - how would/where would one initialise an in-memory graph? Thanks.
9 replies
JJanusGraph
Created by Jamie Burns on 3/7/2024 in #questions
many graphs
I'm a little confused about accessing graphs. I have ideas for two unrelated graphs. For now, in my gremlin server yaml i have four graphs (while i'm learning) graphs: { graph: conf/janusgraph-inmemory.properties, ConfigurationManagementGraph: conf/janusgraph-cql-configurationgraph.properties, pbrgraph: conf/janusgraph-cql-pbrgraph.properties, gardengraph: conf/janusgraph-cql-gardengraph.properties } I can list these in the Console, gremlin> JanusGraphFactory.getGraphNames() ==>pbrgraph ==>gardengraph ==>graph ==>ConfigurationManagementGraph But to operate on one of them i have to open using the path to the properties file, gremlin> graph = JanusGraphFactory.open( 'conf/janusgraph-cql-pbrgraph.properties' ) ==>standardjanusgraph[cql:[127.0.0.1]] Why can't i just open it using the graph name? gremlin> graph = JanusGraphFactory.open( 'pbrgraph' ) Backend shorthand unknown: pbrgraph
6 replies