代码拉取完成,页面将自动刷新
// 删除已存在的约束
DROP CONSTRAINT constraint_153ebae IF EXISTS;
DROP CONSTRAINT character_id IF EXISTS;
DROP CONSTRAINT weapon_id IF EXISTS;
DROP CONSTRAINT skill_id IF EXISTS;
DROP CONSTRAINT location_id IF EXISTS;
// 创建索引
CREATE CONSTRAINT character_id IF NOT EXISTS FOR (c:Character) REQUIRE c.id IS UNIQUE;
CREATE CONSTRAINT weapon_id IF NOT EXISTS FOR (w:Weapon) REQUIRE w.id IS UNIQUE;
CREATE CONSTRAINT skill_id IF NOT EXISTS FOR (s:Skill) REQUIRE s.id IS UNIQUE;
CREATE CONSTRAINT location_id IF NOT EXISTS FOR (l:Location) REQUIRE l.id IS UNIQUE;
// 创建角色节点
RETURN 'Creating Character nodes';
LOAD CSV with headers from "file:///Sample-CSV/character_new.csv" as line
CALL {
with line
//CREATE (n:Character
MERGE (n:Character
{ nodetype: 'character',
id: line.id,
active: line.active,
effectiveTime: line.effectiveTime,
moduleId: line.moduleId,
FSN: line.FSN,
history: line.history} )
} IN TRANSACTIONS OF 200 ROWS;
// 创建武器节点
RETURN 'Creating Weapon nodes';
LOAD CSV with headers from "file:///Sample-CSV/weapon_new.csv" as line
CALL {
with line
//CREATE (n:Weapon
MERGE (n:Weapon
{ nodetype: 'weapon',
id: line.id,
active: line.active,
effectiveTime: line.effectiveTime,
moduleId: line.moduleId,
FSN: line.FSN,
history: line.history} )
} IN TRANSACTIONS OF 200 ROWS;
// 创建技能节点
RETURN 'Creating Skill nodes';
LOAD CSV with headers from "file:///Sample-CSV/skill_new.csv" as line
CALL {
with line
//CREATE (n:Skill
MERGE (n:Skill
{ nodetype: 'skill',
id: line.id,
active: line.active,
effectiveTime: line.effectiveTime,
moduleId: line.moduleId,
FSN: line.FSN,
history: line.history} )
} IN TRANSACTIONS OF 200 ROWS;
// 创建地点节点
RETURN 'Creating Location nodes';
LOAD CSV with headers from "file:///Sample-CSV/location_new.csv" as line
CALL {
with line
//CREATE (n:Location
MERGE (n:Location
{ nodetype: 'location',
id: line.id,
active: line.active,
effectiveTime: line.effectiveTime,
moduleId: line.moduleId,
FSN: line.FSN,
history: line.history} )
} IN TRANSACTIONS OF 200 ROWS;
// 创建HAS_WEAPON关系
RETURN 'Creating HAS_WEAPON relationships';
LOAD CSV with headers from "file:///Sample-CSV/DR_has_weapon_new.csv" as line
CALL {
with line
MATCH (c:Character { id: line.sourceId }), (w:Weapon { id: line.destinationId })
MERGE (c)-[:HAS_WEAPON {
id: line.id,
active: line.active,
effectiveTime: line.effectiveTime,
moduleId: line.moduleId,
characteristicTypeId: line.characteristicTypeId,
modifierId: line.modifierId,
history: line.history,
rolegroup: line.rolegroup
}]->(w)
} IN TRANSACTIONS OF 200 ROWS;
// 创建HAS_SKILL关系
RETURN 'Creating HAS_SKILL relationships';
LOAD CSV with headers from "file:///Sample-CSV/DR_has_skill_new.csv" as line
CALL {
with line
MATCH (c:Character { id: line.sourceId }), (s:Skill { id: line.destinationId })
MERGE (c)-[:HAS_SKILL {
id: line.id,
active: line.active,
effectiveTime: line.effectiveTime,
moduleId: line.moduleId,
characteristicTypeId: line.characteristicTypeId,
modifierId: line.modifierId,
history: line.history,
rolegroup: line.rolegroup
}]->(s)
} IN TRANSACTIONS OF 200 ROWS;
// 创建LOCATED_IN关系
RETURN 'Creating LOCATED_IN relationships';
LOAD CSV with headers from "file:///Sample-CSV/DR_located_in_new.csv" as line
CALL {
with line
MATCH (c:Character { id: line.sourceId }), (l:Location { id: line.destinationId })
MERGE (c)-[:LOCATED_IN {
id: line.id,
active: line.active,
effectiveTime: line.effectiveTime,
moduleId: line.moduleId,
characteristicTypeId: line.characteristicTypeId,
modifierId: line.modifierId,
history: line.history,
rolegroup: line.rolegroup
}]->(l)
} IN TRANSACTIONS OF 200 ROWS;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。