从Neo4j数据库test中获取label为person、company的Node数据和Relationship为holding的数据,导入至嬴图数据库的图集shareholding中:
1. 生成配置文件模板
./ultipa-importer --sample
2. 修改配置文件
# 配置数据源类型
mode: neo4j
# 配置数据源信息
neo4j:
host: "192.168.1.1:5432"
username: "admin"
password: "abcd1234"
database: "test"
# 配置嬴图服务器
server:
# 嬴图服务器,集群中的多个节点用英文逗号隔开
host: "192.168.2.149:60075"
username: "admin"
password: "abcd1234"
# 图集名,默认使用图集default
graphset: "shareholding"
# 用于远程通信的ssl证书文件的路径及名称,仅在双方均为ssl模式时有效
crt: ""
# 配置点数据的字段
nodeConfig:
- schema: "human"
label: "person"
where: n.type = 1
properties:
- name: id
type: _id
- name: name
type: string
- schema: "firm"
label: "company"
where: n.type = 3
properties:
- name: id
type: _id
- name: name
type: string
# 配置边数据的字段
edgeConfig:
- schema: "hold"
relationship: "holding"
where: NOT n:obsolete
properties:
- name: from
type: _from
- name: to
type: _to
- name: shareInt
type: int32
new_name: share
# 全局设置
settings:
batchSize: 10000
importMode: insert
# 自动创建图集、schema和属性
yes: true
3. 执行导入
./ultipa-importer --config ./import.sample.neo4j.yml
如需将Neo4j点的自增ID(identity)导入为嬴图中点的ID,可将上述配置文件中的
id
、from
、to
修改为<id>
、<start>
、<end>
。