[BUG] Syntax error using logical operator OR


Flash
 

We discovered a bug that Syntax error using logical operator OR.

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

We want to use logical operator OR to merge two individual queries, but it trigger a syntax exception which I think the query it's actually correct. And I keep triggering this kind of problem.
Here is one of our examples that triggered the bug.
1) `g.V().or(__.count()).has('vp1')` is a correct query.
2) `g.V().in('el0')` is a correct query.
3) `g.V().or(or(__.count()).has('vp1'),in('el0'))` is supposed to be a correct query but trigger a crash.

- Expected behavior:
No exception should be expected to throw.

- Actual behavior:
A `exception` is thrown. And I'm not really sure whether this problem should happen so I report this. And I think if I replace the `in` into `inE` here, the bug may not be triggered, but I read the [Gremlin manual](https://tinkerpop.apache.org/docs/current/reference/) carefully, this query syntax is correct and should be supported.
```
java.util.concurrent.ExecutionException: org.apache.tinkerpop.gremlin.driver.exception.ResponseException: startup failed:
Script278.groovy: 1: unexpected token: in @ line 1, column 36.
g.V().or(or(__.count()).has('vp1'),in('el0'))
^

1 error
```


hadoopmarc@...
 
Edited

I can conform this behaviour in janusgraph-0.6.2, with the inmemory backend with graph.set-vertex-id=true and the graph from https://lists.lfaidata.foundation/g/janusgraph-users/topic/merged_query_using_logical/97516152

The same behaviour is seen in janusgraph.0.6.3.  Can you report this as an issue at: https://github.com/JanusGraph/janusgraph/issues ?

Best wishes,   Marc


Flash
 

OK, received with thanks! I'll start an issue combined with this one: https://lists.lfaidata.foundation/g/janusgraph-users/topic/bug_syntax_error_using/97516169.


hadoopmarc@...
 

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


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