2 desc 'Populate the node_tags table'
4 require File.dirname(__FILE__) + '/../../config/environment'
6 #"created_by=YahooApplet 1.0;highway=traffic_signals"
7 node_count = Node.count
9 for n in (0..node_count)
10 Node.find(:all, :limit => 1, :offset => n).each do |node|
12 node.tags.split(';').each do |tag|
15 nt.k = tag.split('=')[0]
16 nt.v = tag.split('=')[1]
17 nt.sequence_id = seq_id
22 version = 1 #version refers to one set of histories
23 node.old_nodes.find(:all, :order => 'timestamp asc').each do |old_node|
24 sequence_id = 1 #sequence_id refers to the sequence of node tags within a history
25 old_node.tags.split(';').each do |tag|
27 ont.id = node.id #the id of the node tag
28 ont.k = tag.split('=')[0]
29 ont.v = tag.split('=')[1]
31 ont.sequence_id = sequence_id