在neo4j中的json中创建具有属性的多个节点 [英] creating multiple nodes with properties in json in neo4j

查看:566
本文介绍了在neo4j中的json中创建具有属性的多个节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Neo4j的新手,面临一个小问题.

I am a newbie in Neo4j and facing a small problem.

我创建了约5000个路由器节点,其ipaddress属性设置为特定的ip. 现在,我还有大约5000个接口,并且需要创建它们的节点.我在C ++中使用json和rest api.

I created around 5000 router nodes with its ipaddress property set to specific ip. Now I have around 5000 more interfaces and needs to create their nodes. I am using json and rest api for that in c++.

每个接口都有一个Routerip属性,如果routerip与已经创建的路由器节点的ipaddress匹配,那么我需要创建该接口.

Every interface has a Routerip property and if the routerip matches the ipaddress of the router node that is already created I need to create that interface.

我用过这个 http://docs.neo4j.org/chunked/snapshot/rest-api-cypher.html#rest-api-create-mutiple-nodes-with-properties 链接创建我的路由器. 现在,我想使用相同的方法来创建我的界面. 有没有一种方法可以让我通过密码查询中的参数数组传递属性数组,并检查存在的路由器以创建我的接口?

I have used this http://docs.neo4j.org/chunked/snapshot/rest-api-cypher.html#rest-api-create-mutiple-nodes-with-properties link to create my routers. Now I want to use the same method in order to create my interfaces. Is there a way wherein I can do so passing array of properties as paramaters in the cypher query and check for the router present to create my interface?

推荐答案

有几种方法可以做到这一点.将其分解为步骤:

There are several ways to do this. Breaking it down into steps:

  • 对于每个接口,找到匹配的路由器
  • 创建界面&将接口连接到该路由器

那看起来像

MATCH (router:Router)
WHERE router.ipaddress = props.RouterIp
CREATE (n:Interface { props } )-[:CONNECTED_TO]->(router)

这篇关于在neo4j中的json中创建具有属性的多个节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆