diff --git a/ontology-build.rb b/ontology-build.rb index 055fbe4..d1f318a 100644 --- a/ontology-build.rb +++ b/ontology-build.rb @@ -21,7 +21,7 @@ if row["#{theme}_color_icon"] current_superclasses = row["#{theme}_superclass"] superclasses[current_superclasses] = { - label: { en: current_superclasses, fr: row["#{theme}_superclass:name:fr"] }, + label: { en_GB: current_superclasses, fr_FR: row["#{theme}_superclass:name:fr"] }, color_fill: row["#{theme}_color_icon"].downcase, color_line: row["#{theme}_color_text"].downcase, attributes: row['attributes_superclass'].split, @@ -51,7 +51,7 @@ plus_groups[tag[1..]] = current_group elsif !tag.nil? current_tag = { - label: { fr: row['name:fr'] }, + label: { fr_FR: row['name:fr'] }, is_array: !row['array'].nil? && row['array'] != '', values: row['value'] == '*' ? nil : [], } @@ -60,13 +60,13 @@ if current_tag[:values].nil? puts "Error: value for non enum key: #{row['value']}" end - current_tag[:values] << { value: row['value'], label: { fr: row['name:fr'] } } + current_tag[:values] << { value: row['value'], label: { fr_FR: row['name:fr'] } } end } plus_groups.each{ |group_id, group| group.each{ |tag, ct| if !ct[:values].nil? && ct[:values].empty? - puts "Error: osm_tags_extra \"#{tag}\" with no values" + puts "Error: properties_extra \"#{tag}\" with no values" ct[:values] = nil end } @@ -122,22 +122,22 @@ rr['attributes'].any?{ |a| a == '' } and raise "Error: invalid attribute: #{rr['attributes'].inspect}" value = rr['name_over_value'] || rr['value'] [value, { - label: { en: value, fr: rr['name:fr'] }, + label: { en_GB: value, fr_FR: rr['name:fr'] }, zoom: rr["#{theme}_zoom"].to_i, style: rr["#{theme}_style"], priority: rr["#{theme}_priority"].to_i, - osm_tags: rr['overpass'].split(';'), - osm_tags_extra: rr['attributes'], + osm_selector: rr['overpass'].split(';'), + properties_extra: rr['attributes'], }] }.to_h if sc [classs, { - label: { en: classs, fr: sc0["#{theme}_class:name:fr"] }, - subclass: sc, + label: { en_GB: classs, fr_FR: sc0["#{theme}_class:name:fr"] }, + group: sc, }] else [classs, { - label: { en: classs, fr: sc0["#{theme}_class:name:fr"] }, + label: { en_GB: classs, fr_FR: sc0["#{theme}_class:name:fr"] }, zoom: sc0["#{theme}_zoom"].to_i, style: sc0["#{theme}_style"], priority: sc0["#{theme}_priority"].to_i, @@ -145,12 +145,12 @@ end }.to_h pop = c.delete(nil) - pop = pop[:subclass] if pop + pop = pop[:group] if pop [superclass, { label: superclasses[superclass][:label], color_fill: superclasses[superclass][:color_fill], color_line: superclasses[superclass][:color_line], - class: c.merge(pop || {}), + group: c.merge(pop || {}), }] }.to_h @@ -162,6 +162,6 @@ file = File.open(ontology_json, 'w') file.write(JSON.pretty_generate({ name: name, - superclass: hierarchy, - osm_tags_extra: plus_groups, + group: hierarchy, + properties_extra: plus_groups, })) diff --git a/ontology-build.sh b/ontology-build.sh index df6d71c..9ac1e0a 100755 --- a/ontology-build.sh +++ b/ontology-build.sh @@ -16,9 +16,9 @@ ruby ontology-build.rb tourism 'Ontology Tourism' \ ontology-tourism-superclass.csv \ ontology-tourism.csv \ ontology-tourism-extra_tags.csv \ - build/teritorio-tourism-ontology-1.0.json + build/teritorio-tourism-ontology-2.0.json -ruby ontology2html.rb build/teritorio-tourism-ontology-1.0.json > build/teritorio-tourism-ontology-1.0.html +ruby ontology2html.rb build/teritorio-tourism-ontology-2.0.json > build/teritorio-tourism-ontology-2.0.html # City curl -L "${DOC_CITY}/export?format=csv&gid=2097204395" > ontology-city-superclass.csv @@ -29,6 +29,6 @@ ruby ontology-build.rb city 'Ontology City' \ ontology-city-superclass.csv \ ontology-city.csv \ ontology-city-extra_tags.csv \ - build/teritorio-city-ontology-1.0.json + build/teritorio-city-ontology-2.0.json -ruby ontology2html.rb build/teritorio-city-ontology-1.0.json > build/teritorio-city-ontology-1.0.html +ruby ontology2html.rb build/teritorio-city-ontology-2.0.json > build/teritorio-city-ontology-2.0.html diff --git a/ontology2html.rb b/ontology2html.rb index f449207..69c2d10 100644 --- a/ontology2html.rb +++ b/ontology2html.rb @@ -21,8 +21,8 @@ def leaf(color_fill, color_line, font, id, c) #{c["style"]} #{c["zoom"]} #{c["priority"]} - #{c["osm_tags"].join(' or
')} - #{c["osm_tags_extra"].join(', ')} + #{c["osm_selector"].join(' or
')} + #{c["properties_extra"].join(', ')} " end @@ -47,13 +47,13 @@ def leaf(color_fill, color_line, font, id, c) Overpass Extra tags " -ontology["superclass"].each { |superclass_id, superclass| +ontology['group'].each { |superclass_id, superclass| color_fill = superclass["color_fill"] html += "#{icon(color_fill, superclass_id)}#{superclass_id}#{i18n(superclass["label"])}" - superclass["class"].each { |class_id, classs| - if classs["subclass"] + superclass['group'].each { |class_id, classs| + if classs['group'] html += "#{icon(color_fill, class_id)}#{class_id}#{i18n(classs["label"])}" - classs["subclass"].each { |subclass_id, subclass| + classs['group'].each { |subclass_id, subclass| html += leaf( color_fill, superclass["color_line"],