我试图使用pyorient为两个顶点类创建一个边。我所做的就是;
vertex_class = client.command( "create class ABC extends V")
vertex_class = client.command( "create class my_class extends V")
edge_class = client.command("CREATE CLASS E12 EXTENDS E")
edge_class = client.command("create edge E12 from ABC to my_class")顶点类和边缘类是成功创建的,但是,我无法创建边缘。对我做错了什么有什么想法吗?我必须先添加顶点吗?如果是的话,那么我如何在pyorient中这样做呢?
发布于 2018-07-08 03:28:47
这个错误似乎与python无关。这个问题更像是一个OrientDB问题,而不是python问题。创建边缘时,必须指定资源id,或者可以使用内联选择。我正在使用一个不同的例子,因为我不清楚你的顶点,边缘和链接。
CREATE CLASS Customer EXTENDS V
CREATE CLASS Account EXTENDS V
CREATE CLASS Owns EXTENDS E
CREATE VERTEX Customer SET name = 'John'
CREATE VERTEX Account SET accountnum = '12345678910'
#Option 1: You will have to get the rid of the vertices
# You can use SELECT to get the record ID.
# SELECT FROM Customer WHERE name = 'John'
# SELECT FROM Account where accountnum = '12345678910'
# Use the RID to create the edge
CREATE EDGE owns FROM #10:0 TO #11:0
#Option 2: You can use select inline which will create all the edges
CREATE EDGE Owns FROM ( SELECT FROM Customer where name = 'John' ) TO (
SELECT FROM Account where accountnum = '12345678910' )https://stackoverflow.com/questions/51228377
复制相似问题