In my case, I want to build a addreebook in neo4j, which a person has mutiply cellphones and maybe some cellphones have the same concacter with same phone number but different nicknames. such as
user A has two cellphones C1, C2,
C1 | 18190752225 | wife |
C2 | 18190752225 | 老婆 |
I model this with mutiply relationsips between two nodes.
User A -----(C1,wife)--------------->UserB(18190752225)
\
\
-------(C2,老婆)--------------->UserB(18190752225)
The source codes
@NodeEntity @JsonAutoDetect @JsonIgnoreProperties(ignoreUnknown = true) public class User { private static final Logger logger = Logger.getLogger(User.class.getName()); @Indexed private String userId; @Indexed private String nickname; private String realname; private byte sex; private byte type; // common user or businesses private String tags;// personal tags @Indexed(unique = true) private String cellphone; private String cellphoneID; private byte status; private float credit; private boolean registered; @GraphId private Long nodeId; @Labels private Set<String> lables; @RelatedToVia Set<Knowing> knows;
@RelationshipEntity(type = "knows") public class Knowing { private static final Logger logger = Logger.getLogger(Knowing.class.getName()); @GraphId Long relationshipId; String cellphoneID; String nickName; @StartNode User user; @EndNode User contacter;
user.addKnowing(friendInDB, duser.getCellphoneID(), friend.getNickname());
But this operation can not add the second relationships between UserA and UserB.
After googling, I found
Note
Spring Data Neo4j ensures by default that there is only one relationship of a given type between any two given entities. This can be circumvented by using the createRelationshipBetween() method with the allowDuplicates parameter on repositories or entities.
But, in my codes it doesn't work at all.
Knowing r = template.createRelationshipBetween(user, friendInDB, Knowing.class, "knows", true); r.setCellphoneID(duser.getCellphoneID()); r.setNickName(friend.getNickname()); template.save(r);
Preferences
http://stackoverflow.com/questions/18403802/can-a-node-contain-a-collection-of-relationships-with-the-same-end-node
http://stackoverflow.com/questions/18392393/unable-to-create-more-than-2-same-relations-between-two-nodes
相关推荐
Neo4j Vue 安装步骤 克隆或下载该库到本地 下载neo4j并安装到本地,启动neo4j服务 进入到该工程的根目录,输入命令:npm run update进行npm包的导入 使用命令:npm run dev启动该工程 默认端口是:8081 neo4j账号...
Neo4j Vue 安装步骤 克隆或下载该库到本地 下载neo4j并安装到本地,启动neo4j服务 进入到该工程的根目录,输入命令:npm run update进行npm包的导入 使用命令:npm run dev启动该工程 默认端口是:8081 neo4j账号...
电影示例应用 如何一起使用Spring Boot,Spring Data和Neo4j。 Spring Data Neo4j可以在基于Spring的应用程序中方便地集成Neo4j。 它提供了对象图映射(OGM)功能以及Spring Data项目共有的其他功能。 笔记该项目...
DR $ docker run --name neo4j bitnami/neo4j:latestDocker撰写$ curl -sSL https://raw.githubusercontent.com/bitnami/bitnami-docker-neo4j/master/docker-compose.yml > docker-compose.yml$ docker-compose up...
neo4j:所有人的图表
宁静的 Neo4j 2.1+ 用于 Neo4j 宁静 apis 的 Sails.js 水线适配器安装从 NPM 安装。 $ npm install sails-restful-neo4j兼容性这与风帆 0.10 及更高版本兼容帆配置将以下配置添加到 config/connections.js 文件中: ...
imap2neo4j: imap2neo4j imapServer imapUsername imapPassword imapMailbox neo4jServer [neo4jUsername] [neo4jPassword] [paging, eg import by batches of 1000] [specific range of messages, eg 50
通过在 conf/neo4j-server.properties 中添加一行来配置 Neo4j: org.neo4j.server.thirdparty_jaxrs_classes=org.neo4j.example.unmanagedextension=/example 启动 Neo4j 服务器。 写评论 curl ...
Sublime Text 2/3 插件:Neo4j Sublime 是最好的跨平台编辑器之一,所以我想为什么不创建一个简单的 Neo4j 插件呢?... 编辑用户名和密码(默认为neo4j:neo) 结果显示在控制台中(Ctrl+~)打开C
egg-neo4j Neo4j用于鸡蛋框架。安装$ npm i egg-neo4j --save用法// {app_root}/config/plugin.jsexports . neo4j = { enable : true , package : 'egg-neo4j' ,} ;配置// {app_root}/config/config.default....
NBD_Tutorials_Neo4J:PJATK NDB教程的Neo4J分配
schemaless-graphql-neo4j 将无类型的动态GraphQL查询转换为Cypher。 签出,以更好地查看您可以编写的查询。入门$ npm install schemaless-graphql-neo4j :warning: 图书馆尚未发布操场您可以开始使用开发人员游乐场...
Neo4j Vue安装步骤克隆或下载该库到本地下载neo4j并安装到本地,启动neo4j服务进入到该工程的根目录,输入命令:npm run update进行npm包的导入使用命令:npm run dev启动该工程默认端口是:8081 neo4j账号信息: ...
Using this book, you'll get everything up and running, and then learn how to use Neo4j to build up recommendations, relationships, and calculate the shortest route between two locations. With example ...
poc-neo4j 这是有关neo4j功能的POC 启动neo4j数据库docker run -p7474:7474 -p7687:7687 -e NEO4J_AUTH = neo4j / s3cr3t neo4j 可以通过浏览器访问 直接创建数据: 创建(Inception:电影{title:'Inception',...
Neo4j Neo4j 是一个高度可扩展、健壮(完全 ACID)的原生图形数据库。 Neo4j 被全球数以千计的领先企业、初创公司、企业和政府用于任务关键型应用程序。 使用存储库上的 Dockerfile,您就可以使用 docker neo4j ...
适用于Node.js的Neo4j REST API包装器 主分支: 开发分支: 安装 npm install node-neo4j --save 用法 为了使用该库,您必须创建一个应用并添加或在本地安装它。 如果您使用的是OS XI,则强烈建议通过安装Neo4j。 ...
适用于Neo4j的GORM 该项目使用Bolt Java驱动程序为Neo4j 3.x图形数据库实现 。 有关更多信息,请参见以下链接: 对于当前的开发版本,请参见以下链接:
Neo4j 用于将Neo4j图形数据库作为Hackolade数据建模目标的插件。 Hackolade通过插件体系结构公开了其核心数据建模引擎。 每个插件都将Hackolade数据建模功能应用于特定的目标技术,无论是静态数据(数据库)还是...
spring data Neo4j 整合demo,基本整合案例,详细细节参考https://docs.spring.io/spring-data/neo4j/docs/5.1.3.RELEASE/reference/html