zoukankan      html  css  js  c++  java
  • Neo4j记录

    1. Neo4j+Python

    报错提示:
    ValueError: "The following settings are not supported:%r" % other
    
    原因:py2neo版本太高
    
    # 解决办法:
    pip install py2neo==4.3.0 -i https://pypi.douban.com/simple
    

    python操作neo4j

    # 链接数据库
    from py2neo import Graph,Node,Relationship,NodeMatcher
    graph = Graph("http://localhost:7474", username="neo4j", password="123456")
    
    # 创建新的节点
    s = Node('Student', name='张三', age=15)
    c = Node('Class', name='高三(1)班')
    # 创建关系
    r = Relationship(s,'属于',c)  # 张三是高三一班的学生
    
    # 批量创建节点时,会有重复节点的产生,因此创建节点先要先查找节点 NodeMatcher
    matcher = NodeMatcher(graph)
    nodelist_student = list(matcher.match('Student', name='张三'))  # 这里假设全校只有一个张三,哈哈
    if len(nodelist_student)>0:
        # 存在重复节点,就查找节点
        s = graph.nodes.match('Student', name='张三').first()
    else:
        # 否则创建新的节点
        s = Node('Student', name='张三', age=15)
        
    
    
    

    2. Neo4j 使用(neo4j 4.2.4)

    #创建新数据库
    #在system数据库中执行:(这个方法只对商业版有效,社区版的4.x已经转战3.5了,呜呜呜)
    create database name
    
    # 以下为neo4j 3.5.5
    # 修改conf
    eo4j.conf,重启
    dbms.active_database=health.db
    

    3. Neo4j 基本语句

    #查询节点:
    Match(d {name:"乳腺增生"})return d
    
    #删除指定关系:(删除了所有的relate_symptom关系及其指向的节点)
    
    MATCH (p1:Disease)-[r:relate_symptom]-(p2:Food) delete r,p2
    
  • 相关阅读:
    Go入门笔记-14 EdgeX读取配置文件
    Go入门笔记-13 使用EdgeX日志输出
    Go入门笔记-12 输出unix时间戳
    Go入门笔记-11 Go 获取Linux系统CPU占用率
    htop使用
    Ubuntu子系统默认使用root登录
    函数参数传递数组
    c 'CRTSCTS' undeclared
    c 数组指针使用
    使用SD卡刷OpenWRT后,调整分区大小
  • 原文地址:https://www.cnblogs.com/lelezuimei/p/15135058.html
Copyright © 2011-2022 走看看