C#同步数据库的数据到Neo4J
数据组件采用https://github.com/Readify/Neo4jClient
在nuget里面有
需要注意的是
以下是示例代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Neo4jClient;
using Neo4jClient.Cypher;
namespace TestNeo4J
{
class Program
{
static void Main(string[] args)
{
// Init
var client = new GraphClient(new Uri("http://IP:7474/db/data"));
client.Connect();
var root = client.Get<User>(new NodeReference(0)); //获取根节点,主要是在neoclipse工具里面好浏览,如不考虑浏览,你也可以不加到根节点里面去。
// Create entities
var refA = client.Create(new User() { Name = "User A" });
var refB = client.Create(new User() { Name = "User B" });
var refC = client.Create(new User() { Name = "User C" });
client.CreateRelationship(root.Reference,new ReferralRelationship(refA));
client.CreateRelationship(root.Reference, new ReferralRelationship(refB));
client.CreateRelationship(root.Reference, new ReferralRelationship(refC));
Console.Read();
}
//static void DrawPoints(
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Neo4jClient;
namespace TestNeo4J
{
public class HatesData
{
public string Reason { get; set; }
public HatesData()
{ }
public HatesData(string reason)
{
this.Reason = reason;
}
}
public class KnowsRelationship : Relationship, IRelationshipAllowingSourceNode<User>,
IRelationshipAllowingTargetNode<User>
{
public static readonly string TypeKey = "KNOWS";
public KnowsRelationship(NodeReference targetNode)
: base(targetNode)
{ }
public override string RelationshipTypeKey
{
get { return TypeKey; }
}
}
public class ReferralRelationship : Relationship, IRelationshipAllowingSourceNode<User>,
IRelationshipAllowingTargetNode<User>
{
public static readonly string TypeKey = "Referral";
public ReferralRelationship(NodeReference targetNode)
: base(targetNode)
{ }
public override string RelationshipTypeKey
{
get { return TypeKey; }
}
}
public class User
{
public string Name { get; set; }
}
}
C#同步数据库的数据到Neo4J的更多相关文章
- Python同步数据库的数据到Neo4J
写了主要是步骤,如果疑问,请咨询QQ:5988628 Python版本采用2.7.X,默认的2.6.X后期会有问题,建议,一开始就升级Python.然后再安装pip. 访问数据库 sqlalchemy ...
- 使用APOC技术从MYSQL数据库导数据到Neo4j图数据库(JDBC)
Neo4j 数据导入 一.安装与部署Neo4j 直接在官网下载安装包安装,解压即可. 2.mysql ...
- Navicat 同步数据库中数据
Navicat工具同步两个数据库中的数据 第一步在我们的电脑里面打开navicat软件,打开要复制表的数据库,如下图所示: 第二步点击上方的“工具->数据传输”,如下图所示: 第三步进 ...
- 使用Red Gate Sql Data Compare 数据库同步工具进行SQL Server的两个数据库的数据比较、同步
Sql Data Compare 是比较两个数据库的数据是否相同.生成同步sql的工具. 这一款工具由Red Gate公司出品,我们熟悉的.NET Reflector就是这个公司推出的,它的SQLTo ...
- Neo4j ETL工具快速上手:简化从关系数据库到图数据库的数据迁移
注:本文系从https://medium.com/neo4j/tap-into-hidden-connections-translating-your-relational-data-to-graph ...
- 使用SSIS创建同步数据库数据任务
国外相关的文章:http://blog.dxuf.com/sql-tutorial/use-ssis-to-create-the-synchronization-database-data-task. ...
- [转]使用SSIS创建同步数据库数据任务
本文转自:http://www.cnblogs.com/heqichang/archive/2012/09/19/2693214.html SSIS(SQL Server Integration Se ...
- 同步数据库数据到ES中代码
多节点部署保证HA,分布式锁代码 public class DistributedLock implements Watcher,Runnable{ private static final Logg ...
- [知识图谱]利用py2neo从Neo4j数据库获取数据
# -*- coding: utf-8 -*- from py2neo import Graph import json import re class Neo4jToJson(object): &q ...
随机推荐
- css中使用rgba和opacity设置透明度的区别
1.使用rgba设置背景色的透明 效果如下: <body> <div id="box"> 你好啊! </div> </body> b ...
- K - Ignatius and the Princess IV
Description "OK, you are not too bad, em... But you can never pass the next test." ...
- hdu3830 (二分+LCA)
转载请注明出处: http://www.cnblogs.com/fraud/ ——by fraud Checkers Time Limit: 2000/1000 MS (Java/O ...
- 图的割点 桥 双连通(byvoid)
[点连通度与边连通度] 在一个无向连通图中,如果有一个顶点集合,删除这个顶点集合,以及这个集合中所有顶点相关联的边以后,原图变成多个连通块,就称这个点集为割点集合.一个图的点连通度的定义为,最小割点集 ...
- http://python3-cookbook.readthedocs.io/zh_CN/latest/c14/p01_testing_output_sent_to_stdout.html
http://python3-cookbook.readthedocs.io/zh_CN/latest/c14/p01_testing_output_sent_to_stdout.html draw. ...
- YUI Array 之dedupe(快速去重)
YUI.Array.dedupe函数,如果传参为有length属性,返回一个去除掉重复项('1’ 与1 | true 与'true’认为相等)的参数数组副本,如果传参的length为undefined ...
- tomcat解决乱码
今天遇到个问题,太尴尬了: 本来做好并测试号的项目提交到svn, 组员下了之后,又部分url传递的中文参数在另一个jsp接收出现乱码(只有我的不乱码). 改了之后更尴尬的事情发生了:组员的全部不乱码, ...
- JQuery validator扩展
//validator 扩展 jQuery.validator.addMethod("mail", function(value, element, messages) { ret ...
- c#或获取系统的特殊路径,如我的文档等
Console.WriteLine(System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)); System.E ...
- 【转】Memcached管理与监控工具----MemAdmin
原文连接:http://blog.csdn.net/ajun_studio/article/details/6746877 原文作者:halfMe 转载注明以上信息! 使用MemCached以后,肯定 ...