zoukankan      html  css  js  c++  java
  • neo4j导入csv格式数据

    实例

    USING periodic commit 10000 LOAD CSV WITH HEADERS FROM 'file:///地区.csv' AS line CREATE (:地区 { id: line.id, paramchname: line.paramchname, paramcode: line.paramcode })
    neo4j-import --into /usr/local/neo4j-community-3.5.8/data/databases/graph.db --nodes /root/nodes0922.csv --relationships /root/relationships0922.csv

    官网样例

    // Create orders
    LOAD CSV WITH HEADERS FROM 'https://gist.githubusercontent.com/jexp/054bc6baf36604061bf407aa8cd08608/raw/8bdd36dfc88381995e6823ff3f419b5a0cb8ac4f/orders.csv' AS row
    MERGE (order:Order {orderID: row.OrderID})
      ON CREATE SET order.shipName = row.ShipName;

    如果是本地使用下面(orders.csv提前放到import/)

    // Create orders
    LOAD CSV WITH HEADERS FROM 'file:///orders.csv' AS row
    MERGE (order:Order {orderID: row.OrderID})
      ON CREATE SET order.shipName = row.ShipName;

    查看

    MATCH (o:Order) return o LIMIT 5;

    限制提交数据条数 

    USING periodic commit 10000 每满10000条提交一次,防止内存溢出

    USING periodic commit 10000 LOAD CSV WITH HEADERS FROM 'file:///orders.csv' AS row
    MERGE (order:Order {orderID: row.OrderID})
      ON CREATE SET order.shipName = row.ShipName;

    没有标题行的csv导入实体:

    LOAD CSV FROM 'file:///地区.csv' AS line CREATE (:地区 { id: line[0], paramchname: line[1], paramcode: line[2] })

    没有标题行的csv导入关系:

    LOAD CSV FROM 'file:///机构-地区.csv' AS line MATCH (m:机构), (g:地区) WHERE m.id= line[0] AND g.id= line[1] CREATE (m) - [r:所属地区] -> (g) RETURN r

    对于有标题行的csv导入实体

    LOAD CSV WITH HEADERS FROM 'file:///地区.csv' AS line CREATE (:地区 { id: line.id, paramchname: line.paramchname, paramcode: line.paramcode })

    对于有标题行的csv导入关系

    LOAD CSV  WITH HEADERS FROM 'file:///机构-地区.csv' AS line MATCH (m:机构), (g:地区) WHERE m.id=line.startid AND g.id= line.endid CREATE (m) - [r:所属地区] -> (g) RETURN r

    基础的增删改查

    https://zhuanlan.zhihu.com/p/88745411

  • 相关阅读:
    Tomcat启动提示At least one JAR was scanned for TLDs yet contained no TLDs
    elasticsearch 相关操作
    ES下载与安装
    分词器
    Go语言中import导入包时:点. 、下划线_ 、别名的用法
    删除某库中所有表
    yum 安装mysql
    chromedriver下载及配置
    前端库在Core Web项目中的引入和使用
    The database provider attempted to register an implementation of the 'IRelationalTypeMappingSource' service.
  • 原文地址:https://www.cnblogs.com/soymilk2019/p/14864202.html
Copyright © 2011-2022 走看看