• NEO4J导入数据备忘


    学习链接:https://neo4j.com/docs/operations-manual/current/tutorial/neo4j-admin-import/

    bin\neo4j-admin import --database=neo4j --skip-bad-relationships --skip-duplicate-nodes --nodes=import\nuget_all_releases.csv --relationships=import\nuget_project_dependencies.csv,import\nuget_project_dependencies2.csv

    带有头节点:

    bin/neo4j-admin import --database=neo4j --nodes=import/movies4-header.csv,import/movies4-part1.csv,import/movies4-part2.csv --nodes=import/actors4-header.csv,import/actors4-part1.csv,import/actors4-part2.csv --relationships=import/roles4-header.csv,import/roles4-part1.csv,import/roles4-part2.csv

    备份:

    bin\neo4j-admin import  --skip-bad-relationships --skip-duplicate-nodes --database=neo4j --nodes=D:\Neo4j\WorkPlace\CSV\NuFix\backups\nuget_all_releases.csv --relationships=D:\Neo4j\WorkPlace\CSV\NuFix\backups\nuget_project_dependencies_header.csv,D:\Neo4j\WorkPlace\CSV\NuFix\backups\nuget_project_dependencies200.csv,D:\Neo4j\WorkPlace\CSV\NuFix\backups\nuget_project_dependencies300.csv,D:\Neo4j\WorkPlace\CSV\NuFix\backups\nuget_project_dependencies450.csv,D:\Neo4j\WorkPlace\CSV\NuFix\backups\nuget_project_dependencies500.csv,D:\Neo4j\WorkPlace\CSV\NuFix\backups\nuget_project_dependencies600.csv,D:\Neo4j\WorkPlace\CSV\NuFix\backups\nuget_project_dependencies700.csv

    建立索引:

    create text index node_package_version for (n:Package) on (n.version)

    create text index node_package_package_name for (n:Package) on (n.package_name)

    create text index node_package_id for (n:Package) on (n.packageID)
    create text index node_package_is_perelease for (n:Package) on (n.isPrerelease)
    create text index relationship_framework for ()-[r:Target_To]-() on(r.targetFramework)
     
    更改成全文索引:
    CREATE FULLTEXT INDEX full_node_packageID FOR (n:Package) ON EACH  [n.packageID] OPTIONS {indexConfig: {`fulltext.analyzer`: 'url_or_email', `fulltext.eventually_consistent`: true}}
    CREATE FULLTEXT INDEX full_ral_targetframework FOR ()-[r:Target_To]->() ON EACH [r.targetFramework] OPTIONS {indexConfig: {`fulltext.analyzer`: 'url_or_email', `fulltext.eventually_consistent`: true}}
     
    全文索引查询:
    CALL db.index.fulltext.queryNodes("full_node_packageID  ", '"newtonsoft.json@@9.0.1"') YIELD node, score
    with node as a,score
    where (a)-[r:Target_To*1..5]->(m:Package) and all(a in r where a.targetFramework contains "Standard") and not (m)-[]->() and all (mm in nodes(p) where mm.isPrerelease ="False")
    RETURN reduce(node_ids = [], n IN nodes(p) | node_ids + [n]) as result
     
     
     
    测验查询:
    CALL db.index.fulltext.queryNodes("full_node_packageID", '"newtonsoft.json@@9.0.1"') YIELD node, score 
    with node as n,score
    optional match p=(n)-[r:Target_To*1..5]->(m:Package)
    where all(a in r where a.targetFramework contains "Standard") 
           and not (m)-[]->() 
           and all (mm in nodes(p) where mm.isPrerelease ="False")
    RETURN reduce(node_ids = [], n IN nodes(p) | node_ids + [n]) as result
     
     
    服务器备忘

    neo4j-admin import --skip-bad-relationships --skip-duplicate-nodes --database=neo4j --nodes=/var/lib/neo4j/import/nuget_all_releases.csv
    --relationships=/var/lib/neo4j/import/nuget_project_dependencies_header.csv,/var/lib/neo4j/import/nuget_project_dependencies796.csv,/var/lib/neo4j/import/nuget_project_dependencies700.csv,
    /var/lib/neo4j/import/nuget_project_dependencies600.csv,/var/lib/neo4j/import/nuget_project_dependencies500.csv,/var/lib/neo4j/import/nuget_project_dependencies450.csv,
    /var/lib/neo4j/import/nuget_project_dependencies300.csv,/var/lib/neo4j/import/nuget_project_dependencies200.csv,/var/lib/neo4j/import/nuget_project_dependencies106.csv,
    /var/lib/neo4j/import/nuget_project_dependencies100.csv

    LOAD CSV:

    load csv from 'file:///nuget_project_dependencies450.csv' as line
    match (n:Package{packageID:line[0]}), (m:Package{packageID:line[2]})
    merge (n)-[r:Target_To{targetFramework:line[1]}]->(m)
    return count(r)
     
     
    权限管理:
    命名新标签的能力
    GRANT NAME MANAGEMENT ON DATABASE * TO reader 
    给角色设置标签的权限
    GRANT SET LABEL * ON GRAPH neo4j TO regularUsers
    属性设置权限
    GRANT SET PROPERTY {*} ON HOME GRAPH NODES * TO regularUsers
    创建用户:
    CREATE USER jake SET PASSWORD 'abc'
    给用户赋予角色:
    GRANT ROLE myrole TO bob
  • 相关阅读:
    Ubuntu 18.04.3 更改系统语言为简体中文
    Centos7.3、nginx环境下部署hugo博客
    Centos7.3 卸载 Nginx(彻底卸载) 并重新安装 Nginx(RPM源yum安装)
    Centos7.3、nginx环境下部署hexo博客(非git推送方式)
    使用阿里云对象存储OSS+PicGo搭建图床
    Hexo博客添加LiveRe评论系统
    使用 jsDelivr CDN加速Github 仓库的图片
    解决win10一开机占用内存就飙到70%的问题
    [Andriod官方训练教程]管理Activity的生命活动之停止和重启一个Activity
    [Andriod官方训练教程]支持不同的设备之支持不同的语言
  • 原文地址:https://www.cnblogs.com/smartisn/p/16361082.html
Copyright © 2020-2023  润新知