Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将Neo4j密码查询转换为orientdb/gremlin(java)_Java_Neo4j_Orientdb_Gremlin - Fatal编程技术网

将Neo4j密码查询转换为orientdb/gremlin(java)

将Neo4j密码查询转换为orientdb/gremlin(java),java,neo4j,orientdb,gremlin,Java,Neo4j,Orientdb,Gremlin,我有一个Neo4j密码查询,如下所示: 匹配 (b:VertexType1)-(e1)-(a:VertexType2)-(e2)-(c:VertexType1)-(e3)-(d) 我想这句话在英语中的意思是: “给我找一个顶点链‘b’、‘a’、‘c’、‘d’的类型为‘VertexType1’、‘VertexType2’、‘VertexType1’和‘VertexTypeAny’,按顺序由任何类型的边‘e1’、‘e2’和‘e3’连接” 在java中使用OrientDB和gremlin与此有什么等价

我有一个Neo4j密码查询,如下所示:

匹配 (b:VertexType1)-(e1)-(a:VertexType2)-(e2)-(c:VertexType1)-(e3)-(d)

我想这句话在英语中的意思是:

“给我找一个顶点链‘b’、‘a’、‘c’、‘d’的类型为‘VertexType1’、‘VertexType2’、‘VertexType1’和‘VertexTypeAny’,按顺序由任何类型的边‘e1’、‘e2’和‘e3’连接”

在java中使用OrientDB和gremlin与此有什么等价之处

似乎我想从以下几点开始:

for(Vertex a : orientGraph.getVerticesOfClass("VertexType2")){

}
然后用顶点“a”和“两者”开始我的gremlin代码,这样我就可以从顶点“a”开始展开,直到我确认/否认a以我想要的方式连接

最后,我希望Java中有所有的顶点和边,这样我可以添加/删除边和顶点,因此我有:

OrientVertex a;
OrientVertex b;
OrientVertex c;
OrientVertex d;
OrientEdge e1;
OrientEdge e2;
OrientEdge e3;

这在java中的gremlin中是可能的吗?

这是您正在寻找的gremlin查询:

 g.V().has('@class', T.eq, 'VertexType1').as('b').bothE().as('e1').bothV().as('a').has('@class', T.eq, 'VertexType2').bothE().as('e2').bothV().as('c').has('@class', T.eq, 'VertexType1').bothE().as('e3').bothV().path

作为替代方案,您可以查看OrientDB中的MATCH语句,它将在下一个次要版本(2.2)中发布。语法将非常类似于原始的Cypher