{"id":21007977,"url":"https://github.com/lflxp/studyneo4j","last_synced_at":"2026-02-08T01:33:14.473Z","repository":{"id":150080933,"uuid":"166750714","full_name":"lflxp/studyNeo4j","owner":"lflxp","description":"study neo4j api","archived":false,"fork":false,"pushed_at":"2019-01-24T18:59:47.000Z","size":45,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-21T15:44:37.087Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lflxp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-21T04:57:39.000Z","updated_at":"2019-01-24T18:59:49.000Z","dependencies_parsed_at":"2023-06-05T03:00:36.606Z","dependency_job_id":null,"html_url":"https://github.com/lflxp/studyNeo4j","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lflxp/studyNeo4j","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lflxp%2FstudyNeo4j","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lflxp%2FstudyNeo4j/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lflxp%2FstudyNeo4j/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lflxp%2FstudyNeo4j/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lflxp","download_url":"https://codeload.github.com/lflxp/studyNeo4j/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lflxp%2FstudyNeo4j/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29216086,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-08T00:10:47.190Z","status":"ssl_error","status_checked_at":"2026-02-08T00:10:43.589Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T09:11:04.201Z","updated_at":"2026-02-08T01:33:14.453Z","avatar_url":"https://github.com/lflxp.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# studyNeo4j\nstudy neo4j api\n\n# 导入基础数据\n\nLOAD CSV WITH HEADERS FROM \"http://192.168.40.204:8888/group.csv\" as row\ncreate (n:Group)\nset n = row\n\nLOAD CSV WITH HEADERS FROM \"http://192.168.40.204:8888/host.csv\" as row\ncreate (a:Host)\nset a = row\n\nLOAD CSV WITH HEADERS FROM \"http://192.168.40.204:8888/person.csv\" as row\ncreate (b:Person)\nset b = row\n\nLOAD CSV WITH HEADERS FROM \"http://192.168.40.204:8888/service.csv\" as row\ncreate (c:Service)\nset c = row\n\n# 创建关系\n\n张三\n李四\n王五\n周期\n李想\n冉伊\n材质鹏\n吕集\n\n## 人员关系 普通员工  \nmatch (n:Person),(m:Group)\nwhere n.name in ['张三','王五','冉伊'] and m.group=\"云平台\"\ncreate (n)-[:BELONG {role:['普通员工']}]-\u003e(m)\n\n## 人员关系 管理员\nmatch (n:Person),(m:Group)\nwhere n.name in ['材质鹏'] and m.group=\"云平台\"\ncreate (n)-[:BELONG {role:['管理员']}]-\u003e(m)\n\n## 人员关系 管理员\nmatch (n:Person),(m:Group)\nwhere n.name in ['材质鹏','李想'] and m.group=\"运维\"\ncreate (n)-[:BELONG {role:['管理员']}]-\u003e(m)\n\nmatch (n:Person),(m:Group)\nwhere n.name in ['李四','周期'] and m.group=\"安防\"\ncreate (n)-[:BELONG {role:['员工']}]-\u003e(m)\n\nmatch (n:Person),(m:Group)\nwhere n.name in ['李四','吕集'] and m.group=\"dba\"\ncreate (n)-[:BELONG {role:['员工']}]-\u003e(m)\n\nmatch (n:Person),(m:Group)\nwhere n.name in ['李四','吕集','李想'] and m.group=\"基础平台\"\ncreate (n)-[:BELONG {role:['员工']}]-\u003e(m)\n\nmatch (n:Person),(m:Group)\nwhere n.name in ['冉伊'] and m.group=\"人事\"\ncreate (n)-[:BELONG {role:['员工']}]-\u003e(m)\n\nmatch (n:Person),(m:Group)\nwhere n.name in ['王五'] and m.group=\"创新\"\ncreate (n)-[:BELONG {role:['员工']}]-\u003e(m)\n\nmatch (n:Person),(m:Group)\nwhere n.name in ['周期'] and m.group=\"研发\"\ncreate (n)-[:BELONG {role:['员工']}]-\u003e(m)\n\n\u003c!-- create (G:Group{group:\"前台\",description:\"美女\"})\ncreate (One1:Person{name:\"测试\",email:\"test@cloudwalk.cn\",age:\"99\",sex:\"男\"})\ncreate (Two:Person{name:\"测试1\",email:\"test@cloudwalk.cn\",age:\"99\",sex:\"男\"})\ncreate (One2:Person{name:\"测试2\",email:\"test@cloudwalk.cn\",age:\"99\",sex:\"男\"})\ncreate (One3:Person{name:\"测试3\",email:\"test@cloudwalk.cn\",age:\"99\",sex:\"男\"})\n\ncreate \n    (One1)-[:BELONG {role:['admin']}]-\u003e(G),\n    (Two)-[:BELONG {role:['admin']}]-\u003e(G),\n    (One2)-[:BELONG {role:['admin']}]-\u003e(G),\n    (One3)-[:BELONG {role:['admin']}]-\u003e(G) --\u003e\n\n# 设置Service到host\n\nmatch (a:Host),(b:Service)\nwhere b.ip=a.ip\ncreate (b)-[:Deploy {type:\"install\"}]-\u003e(a)\nreturn a,b\n\n# 设置host到group\n\n\u003c!-- \"研发\"\n\"运维\"\n\"安防\"\n\"创新\"\n\"人事\"\n\"基础平台\"\n\"云平台\"\n\"dba\" --\u003e\n\nmatch (h:Host),(g:Group)\nwhere h.hostname in ['hostname1',\n    'hostname11',\n    'hostname21',\n    'hostname31',\n    'hostname41',\n    'hostname51',\n    'hostname61',\n    'hostname71',\n    'hostname81',\n    'hostname91'] and g.group='研发'\ncreate (h)-[:分配]-\u003e(g)\nreturn h,g\n\nmatch (h:Host),(g:Group)\nwhere h.hostname in ['hostname2',\n    'hostname12',\n    'hostname22',\n    'hostname32',\n    'hostname42',\n    'hostname52',\n    'hostname62',\n    'hostname72',\n    'hostname82',\n    'hostname92'] and g.group='运维'\ncreate (h)-[:分配]-\u003e(g)\nreturn h,g\n\nmatch (h:Host),(g:Group)\nwhere h.hostname in ['hostname3',\n    'hostname13',\n    'hostname23',\n    'hostname33',\n    'hostname43',\n    'hostname53',\n    'hostname63',\n    'hostname73',\n    'hostname83',\n    'hostname93'] and g.group='安防'\ncreate (h)-[:分配]-\u003e(g)\nreturn h,g\n\nmatch (h:Host),(g:Group)\nwhere h.hostname in ['hostname4',\n    'hostname14',\n    'hostname24',\n    'hostname34',\n    'hostname44',\n    'hostname54',\n    'hostname64',\n    'hostname74',\n    'hostname84',\n    'hostname94'] and g.group='创新'\ncreate (h)-[:分配]-\u003e(g)\nreturn h,g\n\nmatch (h:Host),(g:Group)\nwhere h.hostname in ['hostname5',\n    'hostname15',\n    'hostname25',\n    'hostname35',\n    'hostname45',\n    'hostname55',\n    'hostname65',\n    'hostname75',\n    'hostname85',\n    'hostname95'] and g.group='人事'\ncreate (h)-[:分配]-\u003e(g)\nreturn h,g\n\nmatch (h:Host),(g:Group)\nwhere h.hostname in ['hostname6',\n    'hostname16',\n    'hostname26',\n    'hostname36',\n    'hostname46',\n    'hostname56',\n    'hostname66',\n    'hostname76',\n    'hostname86',\n    'hostname96'] and g.group='基础平台'\ncreate (h)-[:分配]-\u003e(g)\nreturn h,g\n\nmatch (h:Host),(g:Group)\nwhere h.hostname in ['hostname7',\n    'hostname17',\n    'hostname27',\n    'hostname37',\n    'hostname47',\n    'hostname57',\n    'hostname67',\n    'hostname77',\n    'hostname87',\n    'hostname97'] and g.group='云平台'\ncreate (h)-[:分配]-\u003e(g)\nreturn h,g\n\nmatch (h:Host),(g:Group)\nwhere h.hostname in ['hostname8',\n    'hostname18',\n    'hostname28',\n    'hostname38',\n    'hostname48',\n    'hostname58',\n    'hostname68',\n    'hostname78',\n    'hostname88',\n    'hostname98'] and g.group='dba'\ncreate (h)-[:分配]-\u003e(g)\nreturn h,g\n\n\n# 修改关系 添加属性\nmatch (n)-[r:Deploy]-\u003e(a)\nset r.desc='部署'\n\n# 批量关系 csv\n\n\u003c!-- LOAD CSV WITH HEADERS FROM \"http://data.neo4j.com/northwind/order-details.csv\" AS row\nMATCH (p:Product), (o:Order)\nWHERE p.productID = row.productID AND o.orderID = row.orderID\nCREATE (o)-[details:ORDERS]-\u003e(p)\nSET details = row,\n  details.quantity = toInteger(row.quantity) --\u003e\n\n\u003c!-- orderID\tproductID\tunitPrice\tquantity\tdiscount\n10248\t11\t14\t12\t0\n10248\t42\t9.8\t10\t0\n10248\t72\t34.8\t5\t0\n10249\t14\t18.6\t9\t0\n10249\t51\t42.4\t40\t0\n10250\t41\t7.7\t10\t0\n10250\t51\t42.4\t35\t0.15\n10250\t65\t16.8\t15\t0.15\n10251\t22\t16.8\t6\t0.05\n10251\t57\t15.6\t15\t0.05\n10251\t65\t16.8\t20\t0\n10252\t20\t64.8\t40\t0.05\n10252\t33\t2\t25\t0.05\n10252\t60\t27.2\t40\t0\n10253\t31\t10\t20\t0\n10253\t39\t14.4\t42\t0\n10253\t49\t16\t40\t0\n10254\t24\t3.6\t15\t0.15 --\u003e\n\n# 权限表\n\ncreate (n:Privileges{name:'管理员',desc:'admin'})\ncreate (b:Privileges{name:'员工',desc:'worker'})\ncreate (c:Privileges{name:'游客',desc:'guest'})\n\nmatch (a:Person),(p:Privileges)\nwhere a.name in ['张三'] and p.name='管理员'\ncreate (a)-[:Privileges]-\u003e(p)\nreturn a,p\n\nmatch (a:Person),(p:Privileges)\nwhere a.name in ['李四','王五','周期','李想','冉伊'] and p.name='员工'\ncreate (a)-[:Privileges]-\u003e(p)\nreturn a,p\n\nmatch (a:Person),(p:Privileges)\nwhere a.name in ['吕集','材质鹏'] and p.name='游客'\ncreate (a)-[:Privileges]-\u003e(p)\nreturn a,p\n\n# 查询\n\nmatch (c)-[:Privileges]-\u003e(a)-[:BELONG]-\u003e(m)\u003c-[:分配]-(n) return a,m,n,c","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flflxp%2Fstudyneo4j","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flflxp%2Fstudyneo4j","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flflxp%2Fstudyneo4j/lists"}