从包含三列的 csv 文件创建一个 neo4j 图形
create a neo4j graph from a csv file containing three columns
我有一个包含某些主题的生产者和消费者的 csv 文件。例如
producer,topic,consumer
PRODUCER-1,TOPIC-A,CONSUMER-1
PRODUCER-2,TOPIC-B,CONSUMER-2
PRODUCER-1,TOPIC-C,CONSUMER-3
PRODUCER-1,TOPIC-D,CONSUMER-1
PRODUCER-2,TOPIC-E,CONSUMER-3
我正在尝试在 Zeppelin Notebook 中使用 neo4j 绘制图表以实现此目的。我设法加载了如下所示的 csv,但无法通过主题工作获得显示生产者和消费者之间关系的 pubsub 图。
LOAD CSV FROM 'file:///data/pubsub.csv' AS row
WITH row[0] AS Producer, row[1] AS Topic, row[2] AS Consumer
RETURN Producer, Topic, Consumer
如有任何帮助,我们将不胜感激。
提前致谢
尝试先将数据集存储到 Neo4j 中,然后对其进行查询...这将有助于 Zeppelin 可视化
LOAD CSV WITH HEADERS FROM 'file:///data/pubsub.csv' AS row
MERGE (p:Producer{id:row.producer})
MERGE (t:Topic{id:row.topic})
MERGE (c:Consumer{id:row.consumer})
MERGE (p)-[:PRODUCER]->(t)
MERGE (t)-[:CONSUMER]->(c)
现在您已将数据保存到图表中,您可以尝试在 Zeppelin 中查询它:
MATCH p=()-->()
RETURN p
我有一个包含某些主题的生产者和消费者的 csv 文件。例如
producer,topic,consumer
PRODUCER-1,TOPIC-A,CONSUMER-1
PRODUCER-2,TOPIC-B,CONSUMER-2
PRODUCER-1,TOPIC-C,CONSUMER-3
PRODUCER-1,TOPIC-D,CONSUMER-1
PRODUCER-2,TOPIC-E,CONSUMER-3
我正在尝试在 Zeppelin Notebook 中使用 neo4j 绘制图表以实现此目的。我设法加载了如下所示的 csv,但无法通过主题工作获得显示生产者和消费者之间关系的 pubsub 图。
LOAD CSV FROM 'file:///data/pubsub.csv' AS row
WITH row[0] AS Producer, row[1] AS Topic, row[2] AS Consumer
RETURN Producer, Topic, Consumer
如有任何帮助,我们将不胜感激。 提前致谢
尝试先将数据集存储到 Neo4j 中,然后对其进行查询...这将有助于 Zeppelin 可视化
LOAD CSV WITH HEADERS FROM 'file:///data/pubsub.csv' AS row
MERGE (p:Producer{id:row.producer})
MERGE (t:Topic{id:row.topic})
MERGE (c:Consumer{id:row.consumer})
MERGE (p)-[:PRODUCER]->(t)
MERGE (t)-[:CONSUMER]->(c)
现在您已将数据保存到图表中,您可以尝试在 Zeppelin 中查询它:
MATCH p=()-->()
RETURN p