Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. USING PERIODIC COMMIT 5000 LOAD CSV WITH HEADERS
  2. FROM 'file:///article.txt' as r FIELDTERMINATOR 't'
  3. MATCH (a:Article {PMID: toInt(r.PMID)})
  4. WITH a, toLower(r.ArticleTitle) as text
  5. WITH a, reduce(t=text, delim in [",",".","!","?",'"',":",";","'","(",")","[","]","{","}"] | replace(t,delim," ")) as text
  6. WITH a, reduce(t=text, delim in ["/", "\"] | replace(t, delim, " ")) as text with a, filter(w in split(text, " ") where length(w) > 2) as words SET a.words = words;
  7.  
  8. MATCH (a:Article) where exists(a.words)
  9. WITH a
  10. FOREACH (word in a.words|
  11. MERGE (w:Word {Name: word})
  12. MERGE (a) -[r:contains]-> (w)
  13. ON CREATE SET r.f = 1
  14. ON MATCH SET r.f = r.f + 1
  15. )
  16.  
  17. CALL apoc.periodic.iterate('MATCH (a:Article) WHERE EXISTS(a.words) RETURN a as art','WITH {art} as a FOREACH (word in a.words | MERGE (w:Word {Name: word}) MERGE (a) -[r:contains]-> (w) ON CREATE SET r.f = 1 ON MATCH SET r.f = r.f + 1)', {batchSize:1000, parallel:true})
  18.  
  19. batches total timeTaken committedOperations failedOperations failedBatches retries errorMessages batch operations wasTerminated
  20. 83 1233 2 573 82 82 0
  21. {
  22.  
  23. }
  24. {
  25. "total": 83,
  26. "committed": 1,
  27. "failed": 82,
  28. "errors": {
  29. "java.lang.NullPointerException": 82
  30. }
  31. }
  32. {
  33. "total": 1233,
  34. "committed": 573,
  35. "failed": 82,
  36. "errors": {
  37.  
  38. }
  39. }
  40. false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement