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 ...
随机推荐
- SQL Server -SET ANSI_NULLS
当ANSI_NULLS 为ON时,遵循SQL92的标准,只能使用IS NULL 来判断值是否为NULL, 而不能使用=或<>来与NULL做比较,任何值包括NULL值与NULL值做=或< ...
- UIScrollView的大全
UIScrollView是iOS中提供滚动控件,用于解决当内容区域大于可视区域时不能完全查看的问题,UISrollView就可提供滑动方式查看全部内容,UISrollView是所有滚动视图的基类,后期 ...
- Qt调用外部程序QProcess通信
mainwindow.cpp文件: -------------------------------- #include "mainwindow.h" #include " ...
- (原创) mac 10.9.2 eclipse 的 CDT 的 异常的修复
测试平台:macbook air 2012 , os x 10.9.2 , eclipse 4.3 在升级了 10.9 之后,eclipse 的CDT 无法正常使用了 异常表现: 1. 文 ...
- UIScrollView和UIPageControl学习使用
# UIScrollView和UIPageControl # 概要 对于同一个页面需要展示很多图片信息.子视图等的这样的需求,我们可以采用控件UIScrollVIew,与之常常一起使用的控件是UIPa ...
- python的时间模块
python有两个重要的时间模块,分别是time和datetime 先看time模块 表示时间的几种方法: 1)时间元组:time.struct_time(tm_year=2016, tm_mon ...
- oc语言--protocol(协议)
一.protocol 1.基本用途 1> 可以用来声明很多方法,但是不能用来声明成员变量 2> 只要某个类遵守了这个协议,就相当于拥有这个协议中的所有方法声明 3> 只要父类遵守了某 ...
- HttpClient工具类
HttpClient 是 Apache Jakarta Common 下的子项目,用来提供高效的.最新的.功能丰富的支持 HTTP 协议的客户端编程工具包,并且它支持 HTTP 协议最新的版本和建议. ...
- centos单用户模式:修改ROOT密码和grub加密
centos单用户模式:修改ROOT密码和grub加密 CentOSLinux网络应用配置管理应用服务器 Linux 系统处于正常状态时,服务器主机开机(或重新启动)后,能够由系统引导器程序自动引导 ...
- LeeCode-Pow(x, n)
Implement pow(x, n). double myPow(double x, int n) { ) return 1.0; ) return 1.0/pow(x,-n); ); }