1

Drupal Taxonomy Managerで使用するために、MySQLワールドデータベースをインデントされた形式にしようとしています。フラットなスプレッドシート形式の階層があります:world_hierarchy.xlsx

そのファイルのような階層を次の形式で出力する必要があります。

Region
-Continent
--Country
---City

したがって、ツリーのランダムサンプルは次のようになります。

Central America
-North America
--Panama
---San Miguelito
Eastern Africa
-Africa
--British Indian Ocean Territory
--Ethiopia
---Nazret

ツリーにノードが2回以上表示されないようにする必要があります(たとえば、中央アメリカは、子が追随して1回だけ表示される必要があります。

4

1 に答える 1

0

スプレッドシートを大陸ごとに並べ替えて、地域と都市を切り捨てました (ユーザーが都市を追加できるように、オートコンプリートを使用してこのオープンエンドのままにします。タクソノミー マネージャー モジュールの Export to CSV 機能を使用して構造をエクスポートし、これを思いつきました(セミコロン区切り):

"5";"364";"Africa";"";"0"
"5";"394";"Algeria";"";"364"
"5";"365";"Angola";"";"364"
"5";"406";"Benin";"";"364"
"5";"401";"Botswana";"";"364"
"5";"374";"British Indian Ocean Territory";"";"364"
"5";"407";"Burkina Faso";"";"364"
"5";"375";"Burundi";"";"364"
"5";"366";"Cameroon";"";"364"
"5";"408";"Cape Verde";"";"364"
"5";"409";"Côte d’Ivoire";"";"364"
"5";"367";"Central African Republic";"";"364"
"5";"368";"Chad";"";"364"
"5";"376";"Comoros";"";"364"
"5";"369";"Congo";"";"364"
"5";"370";"Congo, The Democratic Republic of the";"";"364"
"5";"377";"Djibouti";"";"364"
"5";"395";"Egypt";"";"364"
"5";"371";"Equatorial Guinea";"";"364"
"5";"378";"Eritrea";"";"364"
"5";"379";"Ethiopia";"";"364"
"5";"372";"Gabon";"";"364"
"5";"410";"Gambia";"";"364"
"5";"411";"Ghana";"";"364"
"5";"412";"Guinea";"";"364"
"5";"413";"Guinea-Bissau";"";"364"
"5";"380";"Kenya";"";"364"
"5";"402";"Lesotho";"";"364"
"5";"414";"Liberia";"";"364"
"5";"396";"Libyan Arab Jamahiriya";"";"364"
"5";"381";"Madagascar";"";"364"
"5";"382";"Malawi";"";"364"
"5";"415";"Mali";"";"364"
"5";"416";"Mauritania";"";"364"
"5";"383";"Mauritius";"";"364"
"5";"384";"Mayotte";"";"364"
"5";"397";"Morocco";"";"364"
"5";"385";"Mozambique";"";"364"
"5";"403";"Namibia";"";"364"
"5";"417";"Niger";"";"364"
"5";"418";"Nigeria";"";"364"
"5";"386";"Réunion";"";"364"
"5";"387";"Rwanda";"";"364"
"5";"419";"Saint Helena";"";"364"
"5";"373";"Sao Tome and Principe";"";"364"
"5";"420";"Senegal";"";"364"
"5";"388";"Seychelles";"";"364"
"5";"421";"Sierra Leone";"";"364"
"5";"389";"Somalia";"";"364"
"5";"404";"South Africa";"";"364"
"5";"398";"Sudan";"";"364"
"5";"405";"Swaziland";"";"364"
"5";"390";"Tanzania";"";"364"
"5";"422";"Togo";"";"364"
"5";"399";"Tunisia";"";"364"
"5";"391";"Uganda";"";"364"
"5";"400";"Western Sahara";"";"364"
"5";"392";"Zambia";"";"364"
"5";"393";"Zimbabwe";"";"364"
"5";"423";"Antarctica";"";"0"
"5";"424";"Antarctica";"";"423"
"5";"425";"Bouvet Island";"";"423"
"5";"426";"French Southern territories";"";"423"
"5";"427";"Heard Island and McDonald Islands";"";"423"
"5";"428";"South Georgia and the South Sandwich Islands";"";"423"
"5";"429";"Asia";"";"0"
"5";"467";"Afghanistan";"";"429"
"5";"438";"Armenia";"";"429"
"5";"439";"Azerbaijan";"";"429"
"5";"440";"Bahrain";"";"429"
"5";"468";"Bangladesh";"";"429"
"5";"469";"Bhutan";"";"429"
"5";"456";"Brunei";"";"429"
"5";"457";"Cambodia";"";"429"
"5";"430";"China";"";"429"
"5";"441";"Cyprus";"";"429"
"5";"458";"East Timor";"";"429"
"5";"442";"Georgia";"";"429"
"5";"431";"Hong Kong";"";"429"
"5";"470";"India";"";"429"
"5";"459";"Indonesia";"";"429"
"5";"471";"Iran";"";"429"
"5";"443";"Iraq";"";"429"
"5";"444";"Israel";"";"429"
"5";"432";"Japan";"";"429"
"5";"445";"Jordan";"";"429"
"5";"472";"Kazakstan";"";"429"
"5";"446";"Kuwait";"";"429"
"5";"473";"Kyrgyzstan";"";"429"
"5";"460";"Laos";"";"429"
"5";"447";"Lebanon";"";"429"
"5";"433";"Macao";"";"429"
"5";"461";"Malaysia";"";"429"
"5";"474";"Maldives";"";"429"
"5";"434";"Mongolia";"";"429"
"5";"462";"Myanmar";"";"429"
"5";"475";"Nepal";"";"429"
"5";"435";"North Korea";"";"429"
"5";"448";"Oman";"";"429"
"5";"476";"Pakistan";"";"429"
"5";"449";"Palestine";"";"429"
"5";"463";"Philippines";"";"429"
"5";"450";"Qatar";"";"429"
"5";"451";"Saudi Arabia";"";"429"
"5";"464";"Singapore";"";"429"
"5";"436";"South Korea";"";"429"
"5";"477";"Sri Lanka";"";"429"
"5";"452";"Syria";"";"429"
"5";"437";"Taiwan";"";"429"
"5";"478";"Tajikistan";"";"429"
"5";"465";"Thailand";"";"429"
"5";"453";"Turkey";"";"429"
"5";"479";"Turkmenistan";"";"429"
"5";"454";"United Arab Emirates";"";"429"
"5";"480";"Uzbekistan";"";"429"
"5";"466";"Vietnam";"";"429"
"5";"455";"Yemen";"";"429"
"5";"481";"Europe";"";"0"
"5";"504";"Albania";"";"481"
"5";"505";"Andorra";"";"481"
"5";"519";"Austria";"";"481"
"5";"487";"Belarus";"";"481"
"5";"520";"Belgium";"";"481"
"5";"506";"Bosnia and Herzegovina";"";"481"
"5";"488";"Bulgaria";"";"481"
"5";"507";"Croatia";"";"481"
"5";"489";"Czech Republic";"";"481"
"5";"497";"Denmark";"";"481"
"5";"482";"Estonia";"";"481"
"5";"498";"Faroe Islands";"";"481"
"5";"499";"Finland";"";"481"
"5";"521";"France";"";"481"
"5";"522";"Germany";"";"481"
"5";"508";"Gibraltar";"";"481"
"5";"509";"Greece";"";"481"
"5";"510";"Holy See (Vatican City State)";"";"481"
"5";"490";"Hungary";"";"481"
"5";"500";"Iceland";"";"481"
"5";"485";"Ireland";"";"481"
"5";"511";"Italy";"";"481"
"5";"483";"Latvia";"";"481"
"5";"523";"Liechtenstein";"";"481"
"5";"484";"Lithuania";"";"481"
"5";"524";"Luxembourg";"";"481"
"5";"512";"Macedonia";"";"481"
"5";"513";"Malta";"";"481"
"5";"491";"Moldova";"";"481"
"5";"525";"Monaco";"";"481"
"5";"526";"Netherlands";"";"481"
"5";"501";"Norway";"";"481"
"5";"492";"Poland";"";"481"
"5";"514";"Portugal";"";"481"
"5";"493";"Romania";"";"481"
"5";"494";"Russian Federation";"";"481"
"5";"515";"San Marino";"";"481"
"5";"495";"Slovakia";"";"481"
"5";"516";"Slovenia";"";"481"
"5";"517";"Spain";"";"481"
"5";"502";"Svalbard and Jan Mayen";"";"481"
"5";"503";"Sweden";"";"481"
"5";"527";"Switzerland";"";"481"
"5";"496";"Ukraine";"";"481"
"5";"486";"United Kingdom";"";"481"
"5";"518";"Yugoslavia";"";"481"
"5";"528";"North America";"";"0"
"5";"529";"Anguilla";"";"528"
"5";"530";"Antigua and Barbuda";"";"528"
"5";"531";"Aruba";"";"528"
"5";"532";"Bahamas";"";"528"
"5";"533";"Barbados";"";"528"
"5";"553";"Belize";"";"528"
"5";"561";"Bermuda";"";"528"
"5";"562";"Canada";"";"528"
"5";"534";"Cayman Islands";"";"528"
"5";"554";"Costa Rica";"";"528"
"5";"535";"Cuba";"";"528"
"5";"536";"Dominica";"";"528"
"5";"537";"Dominican Republic";"";"528"
"5";"555";"El Salvador";"";"528"
"5";"563";"Greenland";"";"528"
"5";"538";"Grenada";"";"528"
"5";"539";"Guadeloupe";"";"528"
"5";"556";"Guatemala";"";"528"
"5";"540";"Haiti";"";"528"
"5";"557";"Honduras";"";"528"
"5";"541";"Jamaica";"";"528"
"5";"542";"Martinique";"";"528"
"5";"558";"Mexico";"";"528"
"5";"543";"Montserrat";"";"528"
"5";"544";"Netherlands Antilles";"";"528"
"5";"559";"Nicaragua";"";"528"
"5";"560";"Panama";"";"528"
"5";"545";"Puerto Rico";"";"528"
"5";"546";"Saint Kitts and Nevis";"";"528"
"5";"547";"Saint Lucia";"";"528"
"5";"564";"Saint Pierre and Miquelon";"";"528"
"5";"548";"Saint Vincent and the Grenadines";"";"528"
"5";"549";"Trinidad and Tobago";"";"528"
"5";"550";"Turks and Caicos Islands";"";"528"
"5";"565";"United States";"";"528"
"5";"566";"Alabama";"";"565"
"5";"567";"Alaska";"";"565"
"5";"568";"Arizona";"";"565"
"5";"569";"Arkansas";"";"565"
"5";"570";"California";"";"565"
"5";"571";"Colorado";"";"565"
"5";"572";"Connecticut";"";"565"
"5";"573";"Delaware";"";"565"
"5";"574";"Florida";"";"565"
"5";"575";"Georgia";"";"565"
"5";"576";"Hawaii";"";"565"
"5";"577";"Idaho";"";"565"
"5";"578";"Illinois";"";"565"
"5";"579";"Indiana";"";"565"
"5";"580";"Iowa";"";"565"
"5";"581";"Kansas";"";"565"
"5";"582";"Kentucky";"";"565"
"5";"583";"Louisiana";"";"565"
"5";"584";"Maine";"";"565"
"5";"585";"Maryland";"";"565"
"5";"586";"Massachusetts";"";"565"
"5";"587";"Michigan";"";"565"
"5";"588";"Minnesota";"";"565"
"5";"589";"Mississippi";"";"565"
"5";"590";"Missouri";"";"565"
"5";"591";"Montana";"";"565"
"5";"592";"Nebraska";"";"565"
"5";"593";"Nevada";"";"565"
"5";"594";"New Hampshire";"";"565"
"5";"595";"New Jersey";"";"565"
"5";"596";"New Mexico";"";"565"
"5";"597";"New York";"";"565"
"5";"598";"North Carolina";"";"565"
"5";"599";"North Dakota";"";"565"
"5";"600";"Ohio";"";"565"
"5";"601";"Oklahoma";"";"565"
"5";"602";"Oregon";"";"565"
"5";"603";"Pennsylvania";"";"565"
"5";"604";"Rhode Island";"";"565"
"5";"605";"South Carolina";"";"565"
"5";"606";"South Dakota";"";"565"
"5";"607";"Tennessee";"";"565"
"5";"608";"Texas";"";"565"
"5";"609";"Utah";"";"565"
"5";"610";"Vermont";"";"565"
"5";"611";"Virginia";"";"565"
"5";"612";"Washington";"";"565"
"5";"613";"West Virginia";"";"565"
"5";"614";"Wisconsin";"";"565"
"5";"615";"Wyoming";"";"565"
"5";"551";"Virgin Islands, British";"";"528"
"5";"552";"Virgin Islands, U.S.";"";"528"
"5";"616";"Oceania";"";"0"
"5";"635";"American Samoa";"";"616"
"5";"617";"Australia";"";"616"
"5";"618";"Christmas Island";"";"616"
"5";"619";"Cocos (Keeling) Islands";"";"616"
"5";"636";"Cook Islands";"";"616"
"5";"622";"Fiji Islands";"";"616"
"5";"637";"French Polynesia";"";"616"
"5";"627";"Guam";"";"616"
"5";"628";"Kiribati";"";"616"
"5";"629";"Marshall Islands";"";"616"
"5";"630";"Micronesia, Federated States of";"";"616"
"5";"631";"Nauru";"";"616"
"5";"623";"New Caledonia";"";"616"
"5";"620";"New Zealand";"";"616"
"5";"638";"Niue";"";"616"
"5";"621";"Norfolk Island";"";"616"
"5";"632";"Northern Mariana Islands";"";"616"
"5";"633";"Palau";"";"616"
"5";"624";"Papua New Guinea";"";"616"
"5";"639";"Pitcairn";"";"616"
"5";"640";"Samoa";"";"616"
"5";"625";"Solomon Islands";"";"616"
"5";"641";"Tokelau";"";"616"
"5";"642";"Tonga";"";"616"
"5";"643";"Tuvalu";"";"616"
"5";"634";"United States Minor Outlying Islands";"";"616"
"5";"626";"Vanuatu";"";"616"
"5";"644";"Wallis and Futuna";"";"616"
"5";"645";"South America";"";"0"
"5";"646";"Argentina";"";"645"
"5";"647";"Bolivia";"";"645"
"5";"648";"Brazil";"";"645"
"5";"649";"Chile";"";"645"
"5";"650";"Colombia";"";"645"
"5";"651";"Ecuador";"";"645"
"5";"652";"Falkland Islands";"";"645"
"5";"653";"French Guiana";"";"645"
"5";"654";"Guyana";"";"645"
"5";"655";"Paraguay";"";"645"
"5";"656";"Peru";"";"645"
"5";"657";"Suriname";"";"645"
"5";"658";"Uruguay";"";"645"
"5";"659";"Venezuela";"";"645"
于 2012-10-28T23:23:46.253 に答える