创建标签:
LOAD CSV WITH HEADERS FROM “file:///Affair.csv” AS line
CREATE (p:Affair{title:line.title,disaster_level:line.disaster_level,emergency_response:line.emergency_response,phases:line.phases,antistop:line.antistop,Disaster_classification:line.Disaster_classification,occurrence_time:line.occurrence_time,Scale_of_the_event:line.Scale_of_the_event,accident_spot:line.accident_spot,casualty:line.casualty,Event_duration:line.Event_duration,financial_loss:line.financial_loss,nationality:line.nationality,immediate_cause:line.immediate_cause,remote_cause:line.remote_cause})
创建索引:
CREATE CONSTRAINT ON (c:Affair)
ASSERT c.title IS UNIQUE
创建标签:
LOAD CSV WITH HEADERS FROM “file:///new_node.csv” AS line
CREATE (p:NewNode{title:line.title})
创建关系:
LOAD CSV WITH HEADERS FROM “file:///Entity.csv” AS line
MATCH(entity1:Affair{stype:line.entity1}) ,(entity2:NewNode{stype:line.entity2})
CREATE (entity1)-[:RELATION { type: line.relation }]->(entity2)
清空数据库:
MATCH (n)-[r]-()
DELETE n,r
LOAD CSV WITH HEADERS FROM “file:///subject.csv” AS line
CREATE (p:Subject{subject:line.subject,subject_type:line.subject_type})
LOAD CSV WITH HEADERS FROM “file:///object.csv” AS line
CREATE (p:Object{object:line.object,object_type:line.object_type})
LOAD CSV WITH HEADERS FROM “file:///predicate.csv” AS line
MATCH(entity1:Subject{subject:line.subject}) ,(entity2:Object{object:line.object})
CREATE (entity1)-[:RL { type: line.predicate }]->(entity2)