Date   

[BUG] Throw ClassCastException

Flash
 

- JanusGraph Version: 0.6.2
- Operating system: macOS 13.2.1
- API/Driver: Java

I first randomly create a graph. Then when I run the following query: `g.V().or(__.outE('el0')).as('x').V().order().by(desc).where(within('x'))` is thrown with an exception. I think this query is syntactically correct, but I keep triggering this kind of problem. I follow the rule here to generate the query: https://stackoverflow.com/questions/48067834/gremlin-intersection-operation.

### Expected behavior:
No exception should be expected to throw. Or futher messages or prompts should be thrown.

### Actual behavior:
A `java.util.concurrent.ExecutionException` is thrown. And I'm not really sure whether this problem should happen so I report this. I think it should support the type transition rules.
```
JanusGraph exception :
java.util.concurrent.ExecutionException: org.apache.tinkerpop.gremlin.driver.exception.ResponseException: org.janusgraph.graphdb.vertices.CacheVertex cannot be cast to java.util.Collection
```


[BUG] Throw ExecutionException

Flash
 

- JanusGraph Version: 0.6.2
- Operating system: macOS 13.2.1
- API/Driver: Java

I first randomly create a graph. Then when I run the following query: `g.V().order().by(desc).where(values('vp1').max().is(lt('\u河ⴛ)'))).both('el1').dedup()` is thrown with an exception. I think this query is syntactically correct, but I keep triggering this kind of problem.

### Expected behavior:
No exception should be expected to throw. Or futher messages or prompts should be thrown.

### Actual behavior:
A `java.util.concurrent.ExecutionException` is thrown. And I'm not really sure whether this problem should happen so I report this.
```
JanusGraph exception :
java.util.concurrent.ExecutionException: org.apache.tinkerpop.gremlin.driver.exception.ResponseException: startup failed:
General error during parsing: Did not find four digit hex character code. line: 1 col:56

groovyjarjarantlr.TokenStreamIOException: Did not find four digit hex character code. line: 1 col:56
at org.codehaus.groovy.antlr.parser.GroovyLexer.nextToken(GroovyLexer.java:733)
at org.codehaus.groovy.antlr.parser.GroovyLexer$1.nextToken(GroovyLexer.java:262)
at groovyjarjarantlr.TokenBuffer.fill(TokenBuffer.java:69)
at groovyjarjarantlr.TokenBuffer.LA(TokenBuffer.java:80)
at groovyjarjarantlr.LLkParser.LA(LLkParser.java:52)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.pathExpression(GroovyRecognizer.java:11797)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.postfixExpression(GroovyRecognizer.java:13527)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.unaryExpressionNotPlusMinus(GroovyRecognizer.java:13496)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.powerExpressionNotPlusMinus(GroovyRecognizer.java:13200)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.multiplicativeExpression(GroovyRecognizer.java:13132)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.additiveExpression(GroovyRecognizer.java:12802)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.shiftExpression(GroovyRecognizer.java:10066)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.relationalExpression(GroovyRecognizer.java:12707)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.equalityExpression(GroovyRecognizer.java:12631)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.regexExpression(GroovyRecognizer.java:12579)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.andExpression(GroovyRecognizer.java:12547)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.exclusiveOrExpression(GroovyRecognizer.java:12515)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.inclusiveOrExpression(GroovyRecognizer.java:12483)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.logicalAndExpression(GroovyRecognizer.java:12451)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.logicalOrExpression(GroovyRecognizer.java:12419)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.conditionalExpression(GroovyRecognizer.java:4947)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.assignmentExpression(GroovyRecognizer.java:8216)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.expression(GroovyRecognizer.java:10206)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.strictContextExpression(GroovyRecognizer.java:9481)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.argument(GroovyRecognizer.java:14123)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.argList(GroovyRecognizer.java:6714)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.methodCallArgs(GroovyRecognizer.java:12105)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.pathElement(GroovyRecognizer.java:11684)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.pathExpression(GroovyRecognizer.java:11814)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.postfixExpression(GroovyRecognizer.java:13527)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.unaryExpressionNotPlusMinus(GroovyRecognizer.java:13496)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.powerExpressionNotPlusMinus(GroovyRecognizer.java:13200)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.multiplicativeExpression(GroovyRecognizer.java:13132)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.additiveExpression(GroovyRecognizer.java:12802)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.shiftExpression(GroovyRecognizer.java:10066)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.relationalExpression(GroovyRecognizer.java:12707)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.equalityExpression(GroovyRecognizer.java:12631)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.regexExpression(GroovyRecognizer.java:12579)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.andExpression(GroovyRecognizer.java:12547)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.exclusiveOrExpression(GroovyRecognizer.java:12515)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.inclusiveOrExpression(GroovyRecognizer.java:12483)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.logicalAndExpression(GroovyRecognizer.java:12451)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.logicalOrExpression(GroovyRecognizer.java:12419)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.conditionalExpression(GroovyRecognizer.java:4947)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.assignmentExpression(GroovyRecognizer.java:8216)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.expression(GroovyRecognizer.java:10206)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.strictContextExpression(GroovyRecognizer.java:9481)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.argument(GroovyRecognizer.java:14123)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.argList(GroovyRecognizer.java:6714)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.methodCallArgs(GroovyRecognizer.java:12105)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.pathElement(GroovyRecognizer.java:11684)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.pathExpression(GroovyRecognizer.java:11814)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.postfixExpression(GroovyRecognizer.java:13527)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.unaryExpressionNotPlusMinus(GroovyRecognizer.java:13496)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.powerExpressionNotPlusMinus(GroovyRecognizer.java:13200)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.multiplicativeExpression(GroovyRecognizer.java:13132)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.additiveExpression(GroovyRecognizer.java:12802)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.shiftExpression(GroovyRecognizer.java:10066)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.relationalExpression(GroovyRecognizer.java:12707)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.equalityExpression(GroovyRecognizer.java:12631)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.regexExpression(GroovyRecognizer.java:12579)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.andExpression(GroovyRecognizer.java:12547)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.exclusiveOrExpression(GroovyRecognizer.java:12515)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.inclusiveOrExpression(GroovyRecognizer.java:12483)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.logicalAndExpression(GroovyRecognizer.java:12451)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.logicalOrExpression(GroovyRecognizer.java:12419)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.conditionalExpression(GroovyRecognizer.java:4947)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.assignmentExpression(GroovyRecognizer.java:8216)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.expression(GroovyRecognizer.java:10206)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.expressionStatementNoCheck(GroovyRecognizer.java:8543)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.expressionStatement(GroovyRecognizer.java:9089)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.statement(GroovyRecognizer.java:1276)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.compilationUnit(GroovyRecognizer.java:666)
at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:213)
at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:192)
at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:226)
at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:201)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:965)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:642)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:618)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:595)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:401)
at groovy.lang.GroovyClassLoader.access$300(GroovyClassLoader.java:89)
at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:341)
at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:338)
at org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:147)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:336)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:320)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:262)
at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine$GroovyCacheLoader.lambda$load$0(GremlinGroovyScriptEngine.java:821)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1604)
at java.util.concurrent.CompletableFuture.asyncSupplyStage(CompletableFuture.java:1618)
at java.util.concurrent.CompletableFuture.supplyAsync(CompletableFuture.java:1843)
at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine$GroovyCacheLoader.load(GremlinGroovyScriptEngine.java:819)
at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine$GroovyCacheLoader.load(GremlinGroovyScriptEngine.java:814)
at com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalLoadingCache.lambda$new$0(BoundedLocalCache.java:3117)
at com.github.benmanes.caffeine.cache.LocalCache.lambda$statsAware$0(LocalCache.java:144)
at com.github.benmanes.caffeine.cache.BoundedLocalCache.lambda$doComputeIfAbsent$16(BoundedLocalCache.java:1968)
at java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1853)
at com.github.benmanes.caffeine.cache.BoundedLocalCache.doComputeIfAbsent(BoundedLocalCache.java:1966)
at com.github.benmanes.caffeine.cache.BoundedLocalCache.computeIfAbsent(BoundedLocalCache.java:1949)
at com.github.benmanes.caffeine.cache.LocalCache.computeIfAbsent(LocalCache.java:113)
at com.github.benmanes.caffeine.cache.LocalLoadingCache.get(LocalLoadingCache.java:67)
at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.getScriptClass(GremlinGroovyScriptEngine.java:569)
at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:376)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233)
at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$0(GremlinExecutor.java:272)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)

1 error
```

### Steps to reproduce:
We create a graph with 10 nodes and 20 edges. We try to make it clear to reproduce the bugs, **hope** to not cause much inconvenience to your reviewing, but we believe the problem does exist.
Following the following graph data generation query, we can reproduce the bugs:
- Create data
```
Vertex:
g.addV('vl0').property('vp0','7572798559089711260').property(T.id,4336)
g.addV('vl2').property('vp1',''X
pju'').property(T.id,4312)
g.addV('vl2').property('vp1',''YDf죿죿'').property(T.id,4320)
g.addV('vl2').property('vp1',''-695547649'').property(T.id,4304)
g.addV('vl1').property('vp1',''BT\{&'').property(T.id,8400)
g.addV('vl2').property('vp1',''YDf죿죿'').property(T.id,4328)
g.addV('vl0').property('vp0','5496164996206927742').property(T.id,8424)
g.addV('vl1').property('vp1',''-695547649'').property(T.id,4168)
g.addV('vl2').property('vp1',''YDf죿죿'').property(T.id,12496)
g.addV('vl0').property('vp0','4899776225246795239').property(T.id,4096)

Edge:
g.V(4304).as('4304').V(12496).as('12496').addE('el0').from('4304').to('12496')
g.V(4096).as('4096').V(4304).as('4304').addE('el1').from('4096').to('4304')
g.V(4312).as('4312').V(4328).as('4328').addE('el0').from('4312').to('4328')
g.V(12496).as('12496').V(4320).as('4320').addE('el0').from('12496').to('4320')
g.V(4096).as('4096').V(4320).as('4320').addE('el1').from('4096').to('4320')
g.V(12496).as('12496').V(4312).as('4312').addE('el0').from('12496').to('4312')
g.V(8424).as('8424').V(4312).as('4312').addE('el1').from('8424').to('4312')
g.V(4312).as('4312').V(4312).as('4312').addE('el0').from('4312').to('4312')
g.V(4336).as('4336').V(4312).as('4312').addE('el1').from('4336').to('4312')
g.V(4312).as('4312').V(12496).as('12496').addE('el0').from('4312').to('12496')
g.V(4336).as('4336').V(4320).as('4320').addE('el1').from('4336').to('4320')
g.V(4328).as('4328').V(4304).as('4304').addE('el0').from('4328').to('4304')
g.V(4096).as('4096').V(12496).as('12496').addE('el1').from('4096').to('12496')
g.V(4304).as('4304').V(4304).as('4304').addE('el0').from('4304').to('4304')
g.V(12496).as('12496').V(4304).as('4304').addE('el0').from('12496').to('4304')
g.V(4336).as('4336').V(12496).as('12496').addE('el1').from('4336').to('12496')
g.V(4304).as('4304').V(4312).as('4312').addE('el0').from('4304').to('4312')
g.V(4320).as('4320').V(4320).as('4320').addE('el0').from('4320').to('4320')
g.V(4312).as('4312').V(4320).as('4320').addE('el0').from('4312').to('4320')
g.V(4328).as('4328').V(4312).as('4312').addE('el0').from('4328').to('4312')
```


Re: [BUG] Merged query using logical operator OR returns false results

Flash
 

Dear developers, I re-corrected the syntax and ran new experiments, still triggered the bugs.

### Expected behavior:
We construct the following scenario: we randomly generate two queries Q1, Q2, and merge these two queries using UNION operator into a new query Q3. See reference at https://tinkerpop.apache.org/docs/current/reference/#union-step. Based on the calculation. The Q3 query result set should be the union of result sets from Q1 and Q2.
We generate graph schema and data based on random strings and values. Here is one of our examples that triggered the bug.

1. `g.V().has('vp3',0.096218884).and(__.values('vp3')).dedup()` returns `[4104]]`.
2. `g.V().has('vl1', 'vp0',neq(1837432504)).dedup()` returns `[12352, 4120, 4160, 8256]`.
3. `g.V().union(__.has('vp3',0.096218884).and(__.values('vp3')).dedup(),__.has('vl1', 'vp0',neq(1837432504)).dedup()).dedup()` returns `[12352, 4120, 4160, 8256]`.

We calculate the union result set of Q1 and Q2, which is `[12352, 4104, 4120, 4160, 8256]`.
The union result set doesn't equal to Q3 result set.

### Actual behavior:
The union result set should equal to Q3 result set. We did trigger some cases conform to this requirement, but still there're some cases that violate this constraint.

### Steps to reproduce
Create data
``` data
Vertex:
g.addV('vl0').property('vp3','0.07635844').property('vp2','-1253153106882140636').property(T.id,4112)
g.addV('vl1').property('vp0','-2008883833').property('vp4','-1175010975').property(T.id,4160)
g.addV('vl1').property('vp1','7263845879243599376').property('vp0','-2027833781').property('vp4','-2008883833').property(T.id,8256)
g.addV('vl1').property('vp1','-243995170435985954').property('vp0','-723752269').property(T.id,4120)
g.addV('vl0').property('vp3','0.7607715').property('vp2','1317863491439683413').property(T.id,4296)
g.addV('vl0').property('vp3','0.096218884').property('vp2','-5937605049120030789').property(T.id,4104)
g.addV('vl1').property('vp0','-801622318').property('vp4','-1549232059').property(T.id,12352)
g.addV('vl0').property('vp3','0.6184602').property(T.id,8216)
g.addV('vl1').property('vp1','-3321205565666288421').property('vp4','-205678910').property(T.id,4232)
g.addV('vl0').property('vp3','0.76833284').property('vp2','8093816432935448112').property(T.id,4168)

Edge:
g.V(4120).as('4120').V(4160).as('4160').addE('el2').from('4120').to('4160')
g.V(12352).as('12352').V(8256).as('8256').addE('el2').from('12352').to('8256')
g.V(4120).as('4120').V(8256).as('8256').addE('el2').from('4120').to('8256')
g.V(4232).as('4232').V(8256).as('8256').addE('el2').from('4232').to('8256')
g.V(4120).as('4120').V(8256).as('8256').addE('el1').from('4120').to('8256')
g.V(8256).as('8256').V(12352).as('12352').addE('el1').from('8256').to('12352')
g.V(4232).as('4232').V(8256).as('8256').addE('el1').from('4232').to('8256')
g.V(4120).as('4120').V(12352).as('12352').addE('el1').from('4120').to('12352')
g.V(12352).as('12352').V(12352).as('12352').addE('el2').from('12352').to('12352')
g.V(4120).as('4120').V(4232).as('4232').addE('el2').from('4120').to('4232')
g.V(4232).as('4232').V(4232).as('4232').addE('el2').from('4232').to('4232')
g.V(8256).as('8256').V(4120).as('4120').addE('el1').from('8256').to('4120')
g.V(4112).as('4112').V(4232).as('4232').addE('el0').from('4112').to('4232')
g.V(4296).as('4296').V(12352).as('12352').addE('el0').from('4296').to('12352')
g.V(4104).as('4104').V(4232).as('4232').addE('el0').from('4104').to('4232')
g.V(8256).as('8256').V(4160).as('4160').addE('el2').from('8256').to('4160')
g.V(4160).as('4160').V(4120).as('4120').addE('el2').from('4160').to('4120')
g.V(4112).as('4112').V(12352).as('12352').addE('el0').from('4112').to('12352')
g.V(4168).as('4168').V(4232).as('4232').addE('el0').from('4168').to('4232')
g.V(4120).as('4120').V(12352).as('12352').addE('el2').from('4120').to('12352')
```


Re: Merged query using logical operator AND returns false results

Flash
 
Edited

Dear developers, I re-corrected the syntax and ran new experiments, still triggered the bugs.

### Expected behavior:
We construct the following scenario: we randomly generate two queries Q1, Q2, and merge these two queries using MATCH operator into a new query Q3. See reference at https://stackoverflow.com/questions/48067834/gremlin-intersection-operation. Based on the calculation. The Q3 query result set should be the intersection of result sets from Q1 and Q2.
We generate graph schema and data based on random strings and values. Here is one of our examples that triggered the bug.

1. `g.V().bothE('el1').outV()` returns `[8400]`.
2. `g.V().and(__.outE('el2'))` returns `[16592, 4120, 4136, 4168, 4304]`.
3. `g.V().match(__.as('a').bothE('el1').outV(),__.as('a').filter(and(__.outE('el2')))).select('a')` returns `[16592, 4120, 4168, 4304]`.

We calculate the intersection result set of Q1 and Q2, which is `[]` an empty set.
The intersection result set doesn't equal to Q3 result set.

### Actual behavior:
The intersection result set should equal to Q3 result set. We did trigger some cases conform to this requirement, but still there're some cases that violate this constraint.

### Steps to reproduce:
- Create data
```
Vertex:
g.addV('vl1').property('vp3','true').property(T.id,4168)
g.addV('vl2').property('vp0','-1270611045').property(T.id,4296)
g.addV('vl1').property('vp3','true').property(T.id,4304)
g.addV('vl0').property('vp2',''nw)0Y'').property(T.id,8400)
g.addV('vl2').property('vp0','-1270611045').property('vp2',''~kK4?'').property(T.id,4264)
g.addV('vl1').property('vp3','false').property(T.id,4120)
g.addV('vl1').property('vp3','false').property(T.id,4136)
g.addV('vl2').property('vp2',''qrΛO|'').property(T.id,12496)
g.addV('vl2').property('vp2',''qrΛO|'').property(T.id,4312)
g.addV('vl1').property('vp3','false').property(T.id,16592)

Edge:
g.V(4120).as('4120').V(4168).as('4168').addE('el2').from('4120').to('4168')
g.V(4120).as('4120').V(4136).as('4136').addE('el0').from('4120').to('4136')
g.V(4120).as('4120').V(16592).as('16592').addE('el0').from('4120').to('16592')
g.V(16592).as('16592').V(4168).as('4168').addE('el2').from('16592').to('4168')
g.V(4136).as('4136').V(4120).as('4120').addE('el2').from('4136').to('4120')
g.V(4168).as('4168').V(8400).as('8400').addE('el1').from('4168').to('8400')
g.V(4120).as('4120').V(8400).as('8400').addE('el1').from('4120').to('8400')
g.V(4136).as('4136').V(4168).as('4168').addE('el0').from('4136').to('4168')
g.V(4304).as('4304').V(4120).as('4120').addE('el2').from('4304').to('4120')
g.V(4304).as('4304').V(4136).as('4136').addE('el2').from('4304').to('4136')
g.V(16592).as('16592').V(8400).as('8400').addE('el1').from('16592').to('8400')
g.V(4168).as('4168').V(4120).as('4120').addE('el2').from('4168').to('4120')
g.V(4136).as('4136').V(4304).as('4304').addE('el2').from('4136').to('4304')
g.V(4304).as('4304').V(8400).as('8400').addE('el1').from('4304').to('8400')
g.V(4120).as('4120').V(4168).as('4168').addE('el0').from('4120').to('4168')
g.V(4168).as('4168').V(16592).as('16592').addE('el2').from('4168').to('16592')
g.V(16592).as('16592').V(4120).as('4120').addE('el2').from('16592').to('4120')
g.V(4136).as('4136').V(16592).as('16592').addE('el2').from('4136').to('16592')
g.V(4304).as('4304').V(16592).as('16592').addE('el0').from('4304').to('16592')
g.V(4168).as('4168').V(4120).as('4120').addE('el0').from('4168').to('4120')
```


Re: Custermized Docker for janusgraph 1.0.0. rc2

Yingjie Li
 

Actually while trying to add more env variables  to the janusgraph.env file (posted earlier). I realized that my docker compose of latest Janusgraph (janusgraph/janusgraph:1.0.0-rc2), cassandra:4.1 and openshift2.6 failed. One of the reasons is Cassandra server can not started successfully, so does the Junagarh server. I am attaching the related files and the output of  docker-compose --verbose up  (Janusgraph-1.0.0-rc2-cassandra-4.1-openshift2.6-out.txt) . Any pointers of how to fix the issue?  Thanks 



Re: Custermized Docker for janusgraph 1.0.0. rc2

Yingjie Li
 

Thank you Florian. Will try and report back!

Yingjie


Re: Custermized Docker for janusgraph 1.0.0. rc2

Florian Hockmann
 

1) I assume you mean the ConfigurationManagementGraph. You can enable that by setting this env var:

gremlinserver.graphs.ConfigurationManagementGraph="/etc/opt/janusgraph/janusgraph.properties"

 

To additionally set the required options in the properties file, you can also set these env vars:

 

janusgraph.gremlin.graph="org.janusgraph.core.ConfiguredGraphFactory"

janusgraph.graph.graphname="ConfigurationManagementGraph"

 

You might then want to remove the statically configured graph from the JanusGraph Server YAML file which can be done by also setting this env var:

 

gremlinserver%d.graphs.graph=

 

(without any value as this removes the option from the file).

 

2) JanusGraph 1.0.0 uses Java 11 so it uses a file “jvm-11.options” instead of “jvm-8.options”. The easiest way to replace that file is by mounting it into the container or by creating your own Docker image that uses the JanusGraph image as the base image and then contains a COPY like this:

 

COPY --chown=janusgraph:janusgraph src/jvm-11.options ${JANUS_HOME}/conf/jvm-11.options

 

3) scriptEvaluationTimeout has been replaced by evaluationTimeout. You can set that just like any other JanusGraph Server options through an env var:

 

gremlinserver.evaluationTimeout=30000

 

4) Just mount your script or COPY it into the container, exactly like for the `jvm-11.options` file. The default config of the server already contains a script that will be executed on startup so you can for example just replace that: scripts/empty-sample.groovy

 

 

Von: janusgraph-users@... <janusgraph-users@...> Im Auftrag von Yingjie Li
Gesendet: Mittwoch, 15. März 2023 12:39
An: janusgraph-users@...
Betreff: Re: [janusgraph-users] Custermized Docker for janusgraph 1.0.0. rc2

 

I was able to create a docker-compose that starts four containers Janusgraph 1.0.0-rc2, Cassandra and OpenSearch  based on a repo https://gist.github.com/Phate334/9fd90ddce0eaea74086c1a2e5d419402   from an earlier discussion in Janusgraph git:  https://github.com/JanusGraph/janusgraph/discussions/2837

The docker-compose  and janusgraph.env files are attached. 

Here are my question is in this new context and apprecaite any pointers. 


1) how can I enable Janusgraph container to use ConfiguredGraphManager but not default JanusgraphFactory. In all-in-one case. I simply do

cp $JANUSGRPH_DIR/conf/gremlin-server/gremlin-server-configuration.yaml $JANUSGRPH_DIR/conf/gremlin-server/gremlin-server-cql-es.yaml

2) how can i change the default Janusgraph JVM heap size. In all-in-one case, I replace the sring in the related file

sed "s/Xmx4096m/$JVM_HEAP_MAX/g" $JANUSGRPH_DIR/conf/jvm-8.options > $JANUSGRPH_DIR/conf/jvm-8.options

3). How to change the scriptEvaluationTime in some of the files, for example, in all-in-one case, I replace the sring in the related files like below


sed "s/evaluationTimeout: 30000/evaluationTimeout: $SCRIPT_EVALUATION_TIMEOUT/g" $JANUSGRPH_DIR/conf/gremlin-server/gremlin-server-cql-es.yaml > $JANUSGRPH_DIR/conf/gremlin-server/gremlin-server-cql-es.yaml

4). How to start my janusgraph docker run with a default graph & schema (groovy), a sample of my groovy as below ( somehow can not attache it) :


 

//Create a sessioned connection to the Gremlin Server

 

:remote connect tinkerpop.server conf/remote.yaml session

 

:remote console

 



//define graph name

 

graph_name = "graph1"

 

map = new HashMap();

 

map.put("storage.backend", "cql");

 

map.put("storage.hostname", "127.0.0.1")

 

map.put("index.search.backend", "elasticsearch")

 

map.put("index.search.hostname", "127.0.0.1")

 

map.put("graph.graphname", graph_name)

 

map.put('query.batch', true)

 

ConfiguredGraphFactory.createConfiguration(new MapConfiguration(map))

 

graph = ConfiguredGraphFactory.open(graph_name)

 

//Creat graph schema

 

//Close all transactions

 

graph.getOpenTransactions().forEach { tx -> tx.rollback() }

 

mgmt = graph.openManagement()

 

mgmt.getOpenInstances().forEach {

 

if (it.reverse().take(1) != ")") {

 

mgmt.forceCloseInstance(it)

 

}

 

}

 

pk_id = mgmt.makePropertyKey('id').dataType(String.class).cardinality(org.janusgraph.core.Cardinality.LIST).make()

 

pk_name = mgmt.makePropertyKey('name').dataType(String.class).cardinality(org.janusgraph.core.Cardinality.LIST).make()

 

mgmt.buildIndex('vby_name_m', Vertex.class).addKey(pk_name).buildMixedIndex('search')

 

mgmt.commit()

 

ConfiguredGraphFactory.close(graph_name)

 

 



 

 

 

 

 

 


Re: Custermized Docker for janusgraph 1.0.0. rc2

Yingjie Li
 

Would prefer to using existing docker if I could somehow achieve  the above with ENV settting etc, if not , could anybody point me to the exact process that I can use to build the docker image  from januspgrah 1.10 RC2 source code  in the same style as the office docker image? I have been mostly a user so far but not a docker builder, so any help in this regards is highly appreciated.

Yingjie


Re: Custermized Docker for janusgraph 1.0.0. rc2

Yingjie Li
 

I was able to create a docker-compose that starts four containers Janusgraph 1.0.0-rc2, Cassandra and OpenSearch  based on a repo https://gist.github.com/Phate334/9fd90ddce0eaea74086c1a2e5d419402   from an earlier discussion in Janusgraph git:  https://github.com/JanusGraph/janusgraph/discussions/2837

The docker-compose  and janusgraph.env files are attached. 

Here are my question is in this new context and apprecaite any pointers. 


1) how can I enable Janusgraph container to use ConfiguredGraphManager but not default JanusgraphFactory. In all-in-one case. I simply do

cp $JANUSGRPH_DIR/conf/gremlin-server/gremlin-server-configuration.yaml $JANUSGRPH_DIR/conf/gremlin-server/gremlin-server-cql-es.yaml

2) how can i change the default Janusgraph JVM heap size. In all-in-one case, I replace the sring in the related file

sed "s/Xmx4096m/$JVM_HEAP_MAX/g" $JANUSGRPH_DIR/conf/jvm-8.options > $JANUSGRPH_DIR/conf/jvm-8.options

3). How to change the scriptEvaluationTime in some of the files, for example, in all-in-one case, I replace the sring in the related files like below

sed "s/evaluationTimeout: 30000/evaluationTimeout: $SCRIPT_EVALUATION_TIMEOUT/g" $JANUSGRPH_DIR/conf/gremlin-server/gremlin-server-cql-es.yaml > $JANUSGRPH_DIR/conf/gremlin-server/gremlin-server-cql-es.yaml

4). How to start my janusgraph docker run with a default graph & schema (groovy), a sample of my groovy as below ( somehow can not attache it) :

//Create a sessioned connection to the Gremlin Server
:remote connect tinkerpop.server conf/remote.yaml session
:remote console

//define graph name
graph_name = "graph1"
map = new HashMap();
map.put("storage.backend", "cql");
map.put("storage.hostname", "127.0.0.1")
map.put("index.search.backend", "elasticsearch")
map.put("index.search.hostname", "127.0.0.1")
map.put("graph.graphname", graph_name)
map.put('query.batch', true)
ConfiguredGraphFactory.createConfiguration(new MapConfiguration(map))
graph = ConfiguredGraphFactory.open(graph_name)
//Creat graph schema
//Close all transactions
graph.getOpenTransactions().forEach { tx -> tx.rollback() }
mgmt = graph.openManagement()
mgmt.getOpenInstances().forEach {
if (it.reverse().take(1) != ")") {
mgmt.forceCloseInstance(it)
}
}
pk_id = mgmt.makePropertyKey('id').dataType(String.class).cardinality(org.janusgraph.core.Cardinality.LIST).make()
pk_name = mgmt.makePropertyKey('name').dataType(String.class).cardinality(org.janusgraph.core.Cardinality.LIST).make()
mgmt.buildIndex('vby_name_m', Vertex.class).addKey(pk_name).buildMixedIndex('search')
mgmt.commit()
ConfiguredGraphFactory.close(graph_name)



 
 


Re: [BUG ]Encountering an unexpected exception [java.lang.IllegalArgumentException] when ordering vertices/edges by property values that are not defined for all

hadoopmarc@...
 

Hi Joye,

Here you go, in the gremlin console with janusgraph-0.6.3:

```
gremlin> graph = JanusGraphFactory.open('conf/janusgraph-inmemory.properties')
==>standardjanusgraph[inmemory:[127.0.0.1]]
gremlin> g = graph.traversal()
==>graphtraversalsource[standardjanusgraph[inmemory:[127.0.0.1]], standard]
gremlin> g.addV('v1')
==>v[4112]
gremlin> g.V().order().by("name")
08:00:35 WARN  org.janusgraph.graphdb.transaction.StandardJanusGraphTx - Query requires iterating over all vertices [()]. For better performance, use indexes
==>v[4112]
```


Re: Custermized Docker for janusgraph 1.0.0. rc2

Yingjie Li
 

I guess if I can start the janusgraph 1.0.0-rc2 docker with the configuration that alignes with my customization (excluding the removing extention/jar parts, intially I have to do it due to hgh CVE number for certain jars. which might be fixed already), I can create a sepreate image for my flask service and docker compose all the related images.

Please advise. 

Thanks


Re: Custermized Docker for janusgraph 1.0.0. rc2

Boxuan Li
 

I am unfamiliar with packaging so I will wait to see if other experts can chime in.

My two cents: you can look at https://github.com/JanusGraph/janusgraph-docker/blob/master/docker-compose-cql-es.yml and come up with your own docker-compose setting.

Cheers,
Boxuan


Re: Custermized Docker for janusgraph 1.0.0. rc2

Yingjie Li
 

Hello Boxuan.

Thanks for the pointers.   Will it allow me to run with certain configuration,  such as use ConfiguredGraphFactory instead of JanusgraphFactory etc? 


To add a little bit of context here. I have been using Janusgraph all in one package with the cql-es backend.  In my docker, I first do certain customization to janusgraph-all-in-one package :1) Configure Janusgraph to use ConfiguredGraphFactory instead of JanusgraphFactory 2) change the JVM heap Size 3) change the default evaluationTimeout time for gremlin server, and 4) remove certain extensions/jars that I don't use.

I then initialize it with a default graph with own defined schema (groovy script) if there is no graph defined.


The last part is a flask service that insert data to the graph and query the graph (gremlin-python or gremlin command). The entry point of my docker is the flask service. So basically the user interacts with the graph via flask APIs.


Now I need to split my docker into three separate ones, Janusgraph + flask (can split if necessary), Cassandra (latest docker) OpenSearch(latest docker, replacing Elasticsearch as the ElasticSearch license in Janusgraph all in one is not sspl).

I am looking for pointers/samples that help me to do the above.

Thanks,
Yingjie


Re: Custermized Docker for janusgraph 1.0.0. rc2

Boxuan Li
 


Custermized Docker for janusgraph 1.0.0. rc2

Yingjie Li
 

Hello,

 It appears that the latest janusgraph docker is 0.6.3, and  I will need to create a customized docker for  Janusgraph 1.0.0.rc2. Any pointers of the  steps  I should take?

Thank you.

Yingjie


Re: Janusgraph support of Open Search

Yingjie Li
 

Hello Marc,

Thanks for the pointers, Will try  the janusgraph-1.0.0-rc2 with open search 2.6.0 docker. 

Thanks,
Yingjie


[BUG ]Encountering an unexpected exception [java.lang.IllegalArgumentException] when ordering vertices/edges by property values that are not defined for all

joyemang33@...
 

Version: 0.6.3 OS: Linux
Similar to an issue in OrientDB https://github.com/orientechnologies/orientdb/issues/9933
Here is a simpler case to reproduce:
g.addV("v1")
g.V().order().by("name")
=> java.lang.IllegalArgumentException
When attempting to order vertices by property value "name" that is not defined for all vertices, we have received an unexpected exception [java.lang.IllegalArgumentException]. We have found that other Graph Databases such as HugeGraph and ArcadeDB are capable of executing similar Gremlin queries without encountering exceptions, which leads us to believe that this functionality should be supported in JanusGraph as well.
Would it be possible for you to further confirm it? It would be highly appreciated.

Best regards,
Joye


Re: Janusgraph support of Open Search

hadoopmarc@...
 

Hi Yingjie Li,

The latest janusgraph-1.0.0-rc2 ships with elasticsearch-rest-client 8.6. According to the OpenSearch docs, the latest opensearch versions should be compatible with that. What goes wrong when you try and connect a janusgraph instance with your opensearch-2.5 cluster?

I assume that you do not need to replace the elasticsearch-rest-client, because AFAICS this is still APL2 licensed.

Note that replacing individual jars in a binary distrbution is not a good idea, because the new config was never tested during a build. Even if only applying minor updates in the sense of semantic versioning, things can and will break in practice.

Best wishes,   Marc


Re: [BUG] Syntax error using logical operator OR

hadoopmarc@...
 

See https://issues.apache.org/jira/browse/TINKERPOP-2898

Stephen Mallette remarks that in Case 1 and Case 2 the root cause is "in" being a keyword in Groovy. So, implicit anonymous traversals starting with "in" are not possible and need to be explicit anonymous traversals: __.in().

https://github.com/JanusGraph/janusgraph/issues/3656


Re: [BUG] Syntax error using logical operator OR

hadoopmarc@...
 

Please also mention:
https://issues.apache.org/jira/browse/TINKERPOP-2897
https://issues.apache.org/jira/browse/TINKERPOP-2895