Skip to Content
数据分析之图算法: 基于Spark和Neo4j
book

数据分析之图算法: 基于Spark和Neo4j

by Mark Needham, Amy E. Hodler
September 2020
Intermediate to advanced
213 pages
5h 25m
Chinese
Posts & Telecom Press
Content preview from 数据分析之图算法: 基于Spark和Neo4j
36
4
4.1.2
 将数据导入
Neo4j
下面介绍如何将数据导入
Neo4j
,首先加载节点:
WITH
"https://github.com/neo4j-graph-analytics/book/raw/master/data"
AS
base
WITH
base + "transport-nodes.csv"
AS
uri
LOAD CSV
WITH
HEADERS FROM uri
AS
row
MERGE (place:Place {id:row.id})
SET
place.latitude = toFloat(row.latitude),
place.longitude = toFloat(row.latitude),
place.population = toInteger(row.population)
然后加载关系:
WITH
"https://github.com/neo4j-graph-analytics/book/raw/master/data/"
AS
base
WITH
base + "transport-relationships.csv"
AS
uri
LOAD CSV
WITH
HEADERS FROM uri
AS
row
MATCH
(origin:Place {id: row.src})
MATCH
(destination:Place {id: row.dst})
MERGE (origin)-[:EROAD {distance: toInteger(row.cost)}]->(destination) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

大数据项目管理:从规划到实现

大数据项目管理:从规划到实现

Ted Malaska, Jonathan Seidman
Presto实战

Presto实战

Matt Fuller, Manfred Moser, Martin Traverso
精實企業|高績效組織如何達成創新規模化

精實企業|高績效組織如何達成創新規模化

Jez Humble, Joanne Molesky, Barry O'Reilly

Publisher Resources

ISBN: 9787115546678