Method: Twb::Util::CypherPython#renderEdges
- Defined in:
- lib/twb/util/cypherpython.rb
#renderEdges ⇒ Object
USING PERIODIC COMMIT LOAD CSV WITH HEADERS FROM “file:://C:/tech/Tableau/Tableau Tools/Ruby/experiments/GraphElements.nodes.csv” AS row CREATE (:row.Type row.Name, uuid: row.UUID);
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/twb/util/cypherpython.rb', line 91 def renderEdges csv = CSV.open("./ttdoc/#{@fileName}.edges.csv",'w') csv << ['Source Type' , 'Source Name' , 'Source UUID' , 'Relationship', 'Target Type', 'Target Name', 'Target UUID' ] @edges.each do |edge| relationship = edge.relationship.upcase.gsub(/[ ]+/,'_') csv << [edge.from.type, edge.from.name, edge.from.uuid, relationship , edge.to.type , edge.to.name, edge.to.uuid ] @file.puts ' ' @file.puts 'query = """' @file.puts encodeEdge('MATCH', 'source', edge.from) @file.puts encodeEdge('MATCH', 'target', edge.to) @file.puts "%-8s (source)-[r:%s]->(target) " % ['MERGE', edge.relationship.upcase.gsub(/[ ]+/,'_')] @file.puts "RETURN source.name, type(r), target.name ;" @file.puts '"""' @file.puts 'graph.run(query)' @file.puts "print '-'," end csv.close end |