JanusGraph / JanusGraph/janusgraph

g.V().bothE().hasId(within(ids)) not working

Open
#1,632 1 comment 0 reactions 0 assignees View on GitHub
kind/bug/possible
Dominant language
Java
Stars
5.8k
Forks
1.2k
Avg merge
13h 53m
Merged PRs (30d)
6

Description

```
graph = JanusGraphFactory.open("inmemory")

g = graph.traversal()
eid = g.addV().as("a").addV().addE("E").to("a").id().next()

g.V().bothE().hasId(eid)
g.V().bothE().hasId(within(eid))
```

Result
```
gremlin> graph = JanusGraphFactory.open("inmemory")
==>standardjanusgraph[inmemory:[127.0.0.1]]
gremlin>
gremlin> g = graph.traversal()
==>graphtraversalsource[standardjanusgraph[inmemory:[127.0.0.1]], standard]
gremlin> eid = g.addV().as("a").addV().addE("E").to("a").id().next()
==>sk-36o-t1-3co
gremlin>
gremlin> g.V().bothE().hasId(eid)
11:12:00 WARN org.janusgraph.graphdb.transaction.StandardJanusGraphTx - Query requires iterating over all vertices [()]. For better performance, use indexes
==>e[sk-36o-t1-3co][4128-E->4344]
==>e[sk-36o-t1-3co][4128-E->4344]
gremlin> g.V().bothE().hasId(within(eid))
11:12:00 WARN org.janusgraph.graphdb.transaction.StandardJanusGraphTx - Query requires iterating over all vertices [()]. For better performance, use indexes
Expected valid relation id: [sk-36o-t1-3co]
Type ':help' or ':h' for help.
Display stack trace? [yN]
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the example with JanusGraphFactory.open("inmemory") and compare bothE().hasId(eid) with bothE().hasId(within(eid)). Trace the query or ID handling involved in the failing form. Done means hasId(within(eid)) returns the same edge without the “Expected valid relation id” error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.