如何通过CSV文件上传边缘,如果节点在Apache年龄中具有null ID-错误:“ Label_id必须为1 .. 65535”

问题描述 投票:0回答:1

因此,我正在尝试在Apache Age中从CSV文件上传图形。 为此,我正在使用以下命令,

SELECT create_graph('test_graph');

SELECT create_vlabel('test_graph','movie');

SELECT load_labels_from_file('test_graph','movie','/home/sarthak/Downloads/sample/movie.csv',false);

这起作用,它是为了创建节点。 请注意,我传递了错误的标志,因为ID是可选的,如documentation。 there的电影。csv

~ cat movie.csv name,released The Matrix,1999

上传边缘时,我要遵循this
CSV格式。 这里

start_id and end_id对应于Node.csv中存在的ID,但我尚未设置。 那么我如何在它们之间创建边缘。 我尝试了

SELECT create_elabel('test_graph','acted');

SELECT load_edges_from_file('test_graph', 'acted','/home/sarthak/Downloads/sample/ACTED_IN[person&movie].csv');

但导致错误

ERROR: label_id must be 1 .. 65535

这里是我的边缘
> cat ACTED_IN\[person\&movie\].csv start_id,start_vertex_type,end_id,end_vertex_type,properties 1,Keanu Reeves,3,The Matrix,Neo 2,Carrie-Anne Moss,1,The Matrix,Trinity 3,Laurence Fishburne,2,The Matrix,Morpheus 4,Hugo Weaving,2,The Matrix,Agent Smith

我检查了CSV文件中没有垃圾值。

	

发生错误,因为您需要提供边缘标签名称为

start_vertex_type

end_vertex_type
参数。这是正确的格式:

start_id,start_vertex_type,end_id,end_vertex_type,character_name 1,Person,3,Movie,Neo 2,Person,1,Movie,Trinity 3,Person,2,Movie,Morpheus 4,Person,2,Movie,Agent Smith
apache-age
1个回答
1
投票
properties

更改为

character_name
。创建边缘时,解析器将使用此标头名作为属性名称。
,为了使用正确的ID,您需要确保每个顶点具有此属性。您可以通过每个顶点迭代并添加属性,或修改顶点
.csv

文件以包含此附加列。

如果我的ID为字符串格式,什么?例如“ de012945758_aer5gf”吗? 是否有针对此类ID的解决方案,或者我必须具有整数ID才能在两个节点之间创建边缘。

注:如这里所述,我也能够用“ false”参数创建节点以避免ID。但是我必须在我的边缘文件中拥有ID?
请让我知道可能的解决方案,谢谢:)
    

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.