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
    
  • 相关阅读:
    Buffer cache spillover: only buffers
    11g中如何禁用自动统计信息收集作业
    OTN中文技术论坛清净的ORACLE讨论之地
    关闭磁盘自动运行
    #error
    在VC++中实现无标题栏对话框的拖动
    string,CString,char*之间的转化
    关于注册表
    #pragma once
    extern "C"用法详解
  • 原文地址:https://www.cnblogs.com/lelezuimei/p/15135058.html
Copyright © 2011-2022 走看看