GraphTraversal.path().toList() method couldn't return all matched paths at first time


samma...@...
 


hello,  

gremlin java client couldn't return matched paths confused me for a long time,everything is all right when search condition is simple. sample code below logs
the matched path size which value is one.

//  gremlin console> g.V().has("nodeid", "0b83632f323f15a711726d8af1a0c86f").inE("legal").outV().path();
//              ==>[v[4628728],e[3rrvgga-393tweo-1fdh-2r7js][7080976464-legal->4628728],v[7080976464]]

GraphTraversal<Vertex, Path> legalPathTraversal = graphTraversalSource.V().has("nodeid", "0b83632f323f15a711726d8af1a0c86f")
        .inE("legal").outV()
        .path();  
logger.info("legalpath size: [{}]", legalPathTraversal.toList().size());

2020-05-09 10:53:16.055  INFO 18988 --- [           main] com.gremlin.client.DemoClientApp         : legalpath size: [1]


but, gremlin java client returns matched paths whose value are zero at first time when search conditions are more complexer.  I tracked the source code then into

public default <C extends Collection<E>> C fill(final C collection) method of Traversasal class,

final Traverser<E> traverser = endStep.next();  this row throws exception when called traversal.path().toList() to fetched matched paths as first time.
matched paths could returned normally if i have already called  another path().toList() method.

// <gremlin statement>: g.V().has("ent", "nodeid", "01c9373df1078c62c4dc6c08809cee6a").inE("staff", "legal")
//      .optional(outV().outE("legal", "staff").inV().hasLabel("ent").where(values("nodeid").is(neq("01c9373df1078c62c4dc6c08809cee6a")))).path();
// <example data>: [v[432869416],e[1zjfllb-1zmhzlk-3or9-75pw6g][4330889336-staff->432869416],v[4330889336],e[1zz2ozz-1zmhzlk-3or9-9odt68][4330889336-staff->585150704],v[585150704]]

GraphTraversal<Vertex, Path> graphTraversal = graphTraversalSource.V().has("ent", "nodeid", "01c9373df1078c62c4dc6c08809cee6a").inE("staff", "legal")
        .optional(__.outV().outE("legal", "staff").inV().hasLabel("ent").where(__.values("nodeid").is(P.neq("01c9373df1078c62c4dc6c08809cee6a"))))
        .path();
 logger.info("complex path size: [{}]", graphTraversal.toList().size());
 
2020-05-09 11:30:50.092  INFO 22632 --- [           main] com.gremlin.client.DemoClientApp         : graphTraversal path size: []

please menthion this problem, expecting your answers, thanks !


below is configuration files (pom.xml、remote-graph.properties、remote-objects.yaml) in spring-boot application:
   
<dependency>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph-driver</artifactId>
<version>0.5.1</version>
</dependency>

<dependency>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>gremlin-driver</artifactId>
<version>3.4.6</version>
</dependency>

janusgraph client configuration(remote-graph.properties、remote-objects.yaml)
gremlin.graph=org.janusgraph.core.JanusGraphFactory
storage.backend=hbase

storage.hostname=hadoop1,hadoop2,hadoop3
storage.port=2181
cache.db-cache=true
cache.db-cache-clean-wait=20
cache.db-cache-time=180000
cache.db-cache-size=0.5
index.search.backend=elasticsearch

index.search.hostname=hadoop1,hadoop2,hadoop3
storage.hbase.ext.zookeeper.znode.parent=/hbase1
tx.log-tx=true
tx.max-commit-time=10000

gremlin.remote.remoteConnectionClass=org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteConnection
gremlin.remote.driver.clusterFile=conf/remote-objects.yaml
gremlin.remote.driver.sourceName=g


hosts: [hadoop1,hadoop2,hadoop3]
port: 8182
serializer: {
className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0,
config: {
ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry]
}
}
username: janusgraph
password: password


Sam Ma <samma...@...>
 


The bug that janusgraph java client couln't return complicated paths at first time has already been fixed in janusgraph-driver 0.5.2 version.




在 2020年5月10日星期日 UTC+8上午12:13:23,Sam Ma写道:


hello,  

gremlin java client couldn't return matched paths confused me for a long time,everything is all right when search condition is simple. sample code below logs
the matched path size which value is one.

//  gremlin console> g.V().has("nodeid", "0b83632f323f15a711726d8af1a0c86f").inE("legal").outV().path();
//              ==>[v[4628728],e[3rrvgga-393tweo-1fdh-2r7js][7080976464-legal->4628728],v[7080976464]]

GraphTraversal<Vertex, Path> legalPathTraversal = graphTraversalSource.V().has("nodeid", "0b83632f323f15a711726d8af1a0c86f")
        .inE("legal").outV()
        .path();  
logger.info("legalpath size: [{}]", legalPathTraversal.toList().size());

2020-05-09 10:53:16.055  INFO 18988 --- [           main] com.gremlin.client.DemoClientApp         : legalpath size: [1]


but, gremlin java client returns matched paths whose value are zero at first time when search conditions are more complexer.  I tracked the source code then into

public default <C extends Collection<E>> C fill(final C collection) method of Traversasal class,

final Traverser<E> traverser = endStep.next();  this row throws exception when called traversal.path().toList() to fetched matched paths as first time.
matched paths could returned normally if i have already called  another path().toList() method.

// <gremlin statement>: g.V().has("ent", "nodeid", "01c9373df1078c62c4dc6c08809cee6a").inE("staff", "legal")
//      .optional(outV().outE("legal", "staff").inV().hasLabel("ent").where(values("nodeid").is(neq("01c9373df1078c62c4dc6c08809cee6a")))).path();
// <example data>: [v[432869416],e[1zjfllb-1zmhzlk-3or9-75pw6g][4330889336-staff->432869416],v[4330889336],e[1zz2ozz-1zmhzlk-3or9-9odt68][4330889336-staff->585150704],v[585150704]]

GraphTraversal<Vertex, Path> graphTraversal = graphTraversalSource.V().has("ent", "nodeid", "01c9373df1078c62c4dc6c08809cee6a").inE("staff", "legal")
        .optional(__.outV().outE("legal", "staff").inV().hasLabel("ent").where(__.values("nodeid").is(P.neq("01c9373df1078c62c4dc6c08809cee6a"))))
        .path();
 logger.info("complex path size: [{}]", graphTraversal.toList().size());
 
2020-05-09 11:30:50.092  INFO 22632 --- [           main] com.gremlin.client.DemoClientApp         : graphTraversal path size: []

please menthion this problem, expecting your answers, thanks !


below is configuration files (pom.xml、remote-graph.properties、remote-objects.yaml) in spring-boot application:
   
<dependency>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph-driver</artifactId>
<version>0.5.1</version>
</dependency>

<dependency>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>gremlin-driver</artifactId>
<version>3.4.6</version>
</dependency>

janusgraph client configuration(remote-graph.properties、remote-objects.yaml)
gremlin.graph=org.janusgraph.core.JanusGraphFactory
storage.backend=hbase

storage.hostname=hadoop1,hadoop2,hadoop3
storage.port=2181
cache.db-cache=true
cache.db-cache-clean-wait=20
cache.db-cache-time=180000
cache.db-cache-size=0.5
index.search.backend=elasticsearch

index.search.hostname=hadoop1,hadoop2,hadoop3
storage.hbase.ext.zookeeper.znode.parent=/hbase1
tx.log-tx=true
tx.max-commit-time=10000

gremlin.remote.remoteConnectionClass=org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteConnection
gremlin.remote.driver.clusterFile=conf/remote-objects.yaml
gremlin.remote.driver.sourceName=g


hosts: [hadoop1,hadoop2,hadoop3]
port: 8182
serializer: {
className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0,
config: {
ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry]
}
}
username: janusgraph
password: password