Warning: Declaration of action_plugin_translatebutton::register(&$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /usr/local/www/apache24/data/dokuwiki/lib/plugins/translatebutton/action.php on line 82
neo4j:cypher

Exemple de cargaments amb CSV

../bin/cypher-shell -u user -p passwd --debug < loadCantalausa.cql

loadCantalausa.cql

MATCH (p:Phrase) DETACH DELETE p;
MATCH (c:Category) DELETE c;
MATCH (r:Response) DELETE r;
// TABLES deleted
 
CREATE CONSTRAINT ON (p:Phrase) ASSERT p.id IS UNIQUE;
CREATE CONSTRAINT ON (r:Response) ASSERT r.id IS UNIQUE;
CREATE CONSTRAINT ON (c:Category) ASSERT c.name IS UNIQUE;
// Indices created
 
//Phrase
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM 'file:///cantalausa_phrase.csv' AS ROW
WITH ROW
CREATE (p:Phrase{id:TOINT(ROW.pid), name:ROW.phrase});
 
//Category
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM 'file:///cantalausa_tag.csv' AS ROW
WITH ROW
CREATE (c:Category{id:TOINT(ROW.tid), name:ROW.label});
 
//Response
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM 'file:///cantalausa_responsa.csv' AS ROW
WITH ROW
CREATE (r:Response{id:TOINT(ROW.rid), name:ROW.responsa});
 
// creation OF the relations  
 
// creation OF a fake node FOR the relation
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM 'file:///cantalausa_phrase_tags.csv' AS ROW
WITH ROW
CREATE (r:hasCategory{FROM:TOINT(ROW.pid), TO:TOINT(ROW.tid)});
 
// relationship creation
MATCH (h:hasCategory) 
MATCH (c:Category{id:h.to})
MATCH (p:Phrase{id:h.from})
CREATE (p)-[:HAS_CATEGORY]->(c);
 
// destroying fake relation node
MATCH (h:hasCategory) DELETE h;