Example Data

The following examples all use a vertex collection v and an edge collectione. The vertexcollection v contains continents, countries, and capitals. The edge collection e contains connections between continents and countries, and between countries and capitals.

To set up the collections and populate them with initial data, the following script was used:

  1. db._create("v");
  2. db._createEdgeCollection("e");
  3. // vertices: root node
  4. db.v.save({ _key: "world", name: "World", type: "root" });
  5. // vertices: continents
  6. db.v.save({ _key: "continent-africa", name: "Africa", type: "continent" });
  7. db.v.save({ _key: "continent-asia", name: "Asia", type: "continent" });
  8. db.v.save({ _key: "continent-australia", name: "Australia", type: "continent" });
  9. db.v.save({ _key: "continent-europe", name: "Europe", type: "continent" });
  10. db.v.save({ _key: "continent-north-america", name: "North America", type: "continent" });
  11. db.v.save({ _key: "continent-south-america", name: "South America", type: "continent" });
  12. // vertices: countries
  13. db.v.save({ _key: "country-afghanistan", name: "Afghanistan", type: "country", code: "AFG" });
  14. db.v.save({ _key: "country-albania", name: "Albania", type: "country", code: "ALB" });
  15. db.v.save({ _key: "country-algeria", name: "Algeria", type: "country", code: "DZA" });
  16. db.v.save({ _key: "country-andorra", name: "Andorra", type: "country", code: "AND" });
  17. db.v.save({ _key: "country-angola", name: "Angola", type: "country", code: "AGO" });
  18. db.v.save({ _key: "country-antigua-and-barbuda", name: "Antigua and Barbuda", type: "country", code: "ATG" });
  19. db.v.save({ _key: "country-argentina", name: "Argentina", type: "country", code: "ARG" });
  20. db.v.save({ _key: "country-australia", name: "Australia", type: "country", code: "AUS" });
  21. db.v.save({ _key: "country-austria", name: "Austria", type: "country", code: "AUT" });
  22. db.v.save({ _key: "country-bahamas", name: "Bahamas", type: "country", code: "BHS" });
  23. db.v.save({ _key: "country-bahrain", name: "Bahrain", type: "country", code: "BHR" });
  24. db.v.save({ _key: "country-bangladesh", name: "Bangladesh", type: "country", code: "BGD" });
  25. db.v.save({ _key: "country-barbados", name: "Barbados", type: "country", code: "BRB" });
  26. db.v.save({ _key: "country-belgium", name: "Belgium", type: "country", code: "BEL" });
  27. db.v.save({ _key: "country-bhutan", name: "Bhutan", type: "country", code: "BTN" });
  28. db.v.save({ _key: "country-bolivia", name: "Bolivia", type: "country", code: "BOL" });
  29. db.v.save({ _key: "country-bosnia-and-herzegovina", name: "Bosnia and Herzegovina", type: "country", code: "BIH" });
  30. db.v.save({ _key: "country-botswana", name: "Botswana", type: "country", code: "BWA" });
  31. db.v.save({ _key: "country-brazil", name: "Brazil", type: "country", code: "BRA" });
  32. db.v.save({ _key: "country-brunei", name: "Brunei", type: "country", code: "BRN" });
  33. db.v.save({ _key: "country-bulgaria", name: "Bulgaria", type: "country", code: "BGR" });
  34. db.v.save({ _key: "country-burkina-faso", name: "Burkina Faso", type: "country", code: "BFA" });
  35. db.v.save({ _key: "country-burundi", name: "Burundi", type: "country", code: "BDI" });
  36. db.v.save({ _key: "country-cambodia", name: "Cambodia", type: "country", code: "KHM" });
  37. db.v.save({ _key: "country-cameroon", name: "Cameroon", type: "country", code: "CMR" });
  38. db.v.save({ _key: "country-canada", name: "Canada", type: "country", code: "CAN" });
  39. db.v.save({ _key: "country-chad", name: "Chad", type: "country", code: "TCD" });
  40. db.v.save({ _key: "country-chile", name: "Chile", type: "country", code: "CHL" });
  41. db.v.save({ _key: "country-colombia", name: "Colombia", type: "country", code: "COL" });
  42. db.v.save({ _key: "country-cote-d-ivoire", name: "Cote d'Ivoire", type: "country", code: "CIV" });
  43. db.v.save({ _key: "country-croatia", name: "Croatia", type: "country", code: "HRV" });
  44. db.v.save({ _key: "country-czech-republic", name: "Czech Republic", type: "country", code: "CZE" });
  45. db.v.save({ _key: "country-denmark", name: "Denmark", type: "country", code: "DNK" });
  46. db.v.save({ _key: "country-ecuador", name: "Ecuador", type: "country", code: "ECU" });
  47. db.v.save({ _key: "country-egypt", name: "Egypt", type: "country", code: "EGY" });
  48. db.v.save({ _key: "country-eritrea", name: "Eritrea", type: "country", code: "ERI" });
  49. db.v.save({ _key: "country-finland", name: "Finland", type: "country", code: "FIN" });
  50. db.v.save({ _key: "country-france", name: "France", type: "country", code: "FRA" });
  51. db.v.save({ _key: "country-germany", name: "Germany", type: "country", code: "DEU" });
  52. db.v.save({ _key: "country-people-s-republic-of-china", name: "People's Republic of China", type: "country", code: "CHN" });
  53. // vertices: capitals
  54. db.v.save({ _key: "capital-algiers", name: "Algiers", type: "capital" });
  55. db.v.save({ _key: "capital-andorra-la-vella", name: "Andorra la Vella", type: "capital" });
  56. db.v.save({ _key: "capital-asmara", name: "Asmara", type: "capital" });
  57. db.v.save({ _key: "capital-bandar-seri-begawan", name: "Bandar Seri Begawan", type: "capital" });
  58. db.v.save({ _key: "capital-beijing", name: "Beijing", type: "capital" });
  59. db.v.save({ _key: "capital-berlin", name: "Berlin", type: "capital" });
  60. db.v.save({ _key: "capital-bogota", name: "Bogota", type: "capital" });
  61. db.v.save({ _key: "capital-brasilia", name: "Brasilia", type: "capital" });
  62. db.v.save({ _key: "capital-bridgetown", name: "Bridgetown", type: "capital" });
  63. db.v.save({ _key: "capital-brussels", name: "Brussels", type: "capital" });
  64. db.v.save({ _key: "capital-buenos-aires", name: "Buenos Aires", type: "capital" });
  65. db.v.save({ _key: "capital-bujumbura", name: "Bujumbura", type: "capital" });
  66. db.v.save({ _key: "capital-cairo", name: "Cairo", type: "capital" });
  67. db.v.save({ _key: "capital-canberra", name: "Canberra", type: "capital" });
  68. db.v.save({ _key: "capital-copenhagen", name: "Copenhagen", type: "capital" });
  69. db.v.save({ _key: "capital-dhaka", name: "Dhaka", type: "capital" });
  70. db.v.save({ _key: "capital-gaborone", name: "Gaborone", type: "capital" });
  71. db.v.save({ _key: "capital-helsinki", name: "Helsinki", type: "capital" });
  72. db.v.save({ _key: "capital-kabul", name: "Kabul", type: "capital" });
  73. db.v.save({ _key: "capital-la-paz", name: "La Paz", type: "capital" });
  74. db.v.save({ _key: "capital-luanda", name: "Luanda", type: "capital" });
  75. db.v.save({ _key: "capital-manama", name: "Manama", type: "capital" });
  76. db.v.save({ _key: "capital-nassau", name: "Nassau", type: "capital" });
  77. db.v.save({ _key: "capital-n-djamena", name: "N'Djamena", type: "capital" });
  78. db.v.save({ _key: "capital-ottawa", name: "Ottawa", type: "capital" });
  79. db.v.save({ _key: "capital-ouagadougou", name: "Ouagadougou", type: "capital" });
  80. db.v.save({ _key: "capital-paris", name: "Paris", type: "capital" });
  81. db.v.save({ _key: "capital-phnom-penh", name: "Phnom Penh", type: "capital" });
  82. db.v.save({ _key: "capital-prague", name: "Prague", type: "capital" });
  83. db.v.save({ _key: "capital-quito", name: "Quito", type: "capital" });
  84. db.v.save({ _key: "capital-saint-john-s", name: "Saint John's", type: "capital" });
  85. db.v.save({ _key: "capital-santiago", name: "Santiago", type: "capital" });
  86. db.v.save({ _key: "capital-sarajevo", name: "Sarajevo", type: "capital" });
  87. db.v.save({ _key: "capital-sofia", name: "Sofia", type: "capital" });
  88. db.v.save({ _key: "capital-thimphu", name: "Thimphu", type: "capital" });
  89. db.v.save({ _key: "capital-tirana", name: "Tirana", type: "capital" });
  90. db.v.save({ _key: "capital-vienna", name: "Vienna", type: "capital" });
  91. db.v.save({ _key: "capital-yamoussoukro", name: "Yamoussoukro", type: "capital" });
  92. db.v.save({ _key: "capital-yaounde", name: "Yaounde", type: "capital" });
  93. db.v.save({ _key: "capital-zagreb", name: "Zagreb", type: "capital" });
  94. // edges: continent -> world
  95. db.e.save("v/continent-africa", "v/world", { type: "is-in" });
  96. db.e.save("v/continent-asia", "v/world", { type: "is-in" });
  97. db.e.save("v/continent-australia", "v/world", { type: "is-in" });
  98. db.e.save("v/continent-europe", "v/world", { type: "is-in" });
  99. db.e.save("v/continent-north-america", "v/world", { type: "is-in" });
  100. db.e.save("v/continent-south-america", "v/world", { type: "is-in" });
  101. // edges: country -> continent
  102. db.e.save("v/country-afghanistan", "v/continent-asia", { type: "is-in" });
  103. db.e.save("v/country-albania", "v/continent-europe", { type: "is-in" });
  104. db.e.save("v/country-algeria", "v/continent-africa", { type: "is-in" });
  105. db.e.save("v/country-andorra", "v/continent-europe", { type: "is-in" });
  106. db.e.save("v/country-angola", "v/continent-africa", { type: "is-in" });
  107. db.e.save("v/country-antigua-and-barbuda", "v/continent-north-america", { type: "is-in" });
  108. db.e.save("v/country-argentina", "v/continent-south-america", { type: "is-in" });
  109. db.e.save("v/country-australia", "v/continent-australia", { type: "is-in" });
  110. db.e.save("v/country-austria", "v/continent-europe", { type: "is-in" });
  111. db.e.save("v/country-bahamas", "v/continent-north-america", { type: "is-in" });
  112. db.e.save("v/country-bahrain", "v/continent-asia", { type: "is-in" });
  113. db.e.save("v/country-bangladesh", "v/continent-asia", { type: "is-in" });
  114. db.e.save("v/country-barbados", "v/continent-north-america", { type: "is-in" });
  115. db.e.save("v/country-belgium", "v/continent-europe", { type: "is-in" });
  116. db.e.save("v/country-bhutan", "v/continent-asia", { type: "is-in" });
  117. db.e.save("v/country-bolivia", "v/continent-south-america", { type: "is-in" });
  118. db.e.save("v/country-bosnia-and-herzegovina", "v/continent-europe", { type: "is-in" });
  119. db.e.save("v/country-botswana", "v/continent-africa", { type: "is-in" });
  120. db.e.save("v/country-brazil", "v/continent-south-america", { type: "is-in" });
  121. db.e.save("v/country-brunei", "v/continent-asia", { type: "is-in" });
  122. db.e.save("v/country-bulgaria", "v/continent-europe", { type: "is-in" });
  123. db.e.save("v/country-burkina-faso", "v/continent-africa", { type: "is-in" });
  124. db.e.save("v/country-burundi", "v/continent-africa", { type: "is-in" });
  125. db.e.save("v/country-cambodia", "v/continent-asia", { type: "is-in" });
  126. db.e.save("v/country-cameroon", "v/continent-africa", { type: "is-in" });
  127. db.e.save("v/country-canada", "v/continent-north-america", { type: "is-in" });
  128. db.e.save("v/country-chad", "v/continent-africa", { type: "is-in" });
  129. db.e.save("v/country-chile", "v/continent-south-america", { type: "is-in" });
  130. db.e.save("v/country-colombia", "v/continent-south-america", { type: "is-in" });
  131. db.e.save("v/country-cote-d-ivoire", "v/continent-africa", { type: "is-in" });
  132. db.e.save("v/country-croatia", "v/continent-europe", { type: "is-in" });
  133. db.e.save("v/country-czech-republic", "v/continent-europe", { type: "is-in" });
  134. db.e.save("v/country-denmark", "v/continent-europe", { type: "is-in" });
  135. db.e.save("v/country-ecuador", "v/continent-south-america", { type: "is-in" });
  136. db.e.save("v/country-egypt", "v/continent-africa", { type: "is-in" });
  137. db.e.save("v/country-eritrea", "v/continent-africa", { type: "is-in" });
  138. db.e.save("v/country-finland", "v/continent-europe", { type: "is-in" });
  139. db.e.save("v/country-france", "v/continent-europe", { type: "is-in" });
  140. db.e.save("v/country-germany", "v/continent-europe", { type: "is-in" });
  141. db.e.save("v/country-people-s-republic-of-china", "v/continent-asia", { type: "is-in" });
  142. // edges: capital -> country
  143. db.e.save("v/capital-algiers", "v/country-algeria", { type: "is-in" });
  144. db.e.save("v/capital-andorra-la-vella", "v/country-andorra", { type: "is-in" });
  145. db.e.save("v/capital-asmara", "v/country-eritrea", { type: "is-in" });
  146. db.e.save("v/capital-bandar-seri-begawan", "v/country-brunei", { type: "is-in" });
  147. db.e.save("v/capital-beijing", "v/country-people-s-republic-of-china", { type: "is-in" });
  148. db.e.save("v/capital-berlin", "v/country-germany", { type: "is-in" });
  149. db.e.save("v/capital-bogota", "v/country-colombia", { type: "is-in" });
  150. db.e.save("v/capital-brasilia", "v/country-brazil", { type: "is-in" });
  151. db.e.save("v/capital-bridgetown", "v/country-barbados", { type: "is-in" });
  152. db.e.save("v/capital-brussels", "v/country-belgium", { type: "is-in" });
  153. db.e.save("v/capital-buenos-aires", "v/country-argentina", { type: "is-in" });
  154. db.e.save("v/capital-bujumbura", "v/country-burundi", { type: "is-in" });
  155. db.e.save("v/capital-cairo", "v/country-egypt", { type: "is-in" });
  156. db.e.save("v/capital-canberra", "v/country-australia", { type: "is-in" });
  157. db.e.save("v/capital-copenhagen", "v/country-denmark", { type: "is-in" });
  158. db.e.save("v/capital-dhaka", "v/country-bangladesh", { type: "is-in" });
  159. db.e.save("v/capital-gaborone", "v/country-botswana", { type: "is-in" });
  160. db.e.save("v/capital-helsinki", "v/country-finland", { type: "is-in" });
  161. db.e.save("v/capital-kabul", "v/country-afghanistan", { type: "is-in" });
  162. db.e.save("v/capital-la-paz", "v/country-bolivia", { type: "is-in" });
  163. db.e.save("v/capital-luanda", "v/country-angola", { type: "is-in" });
  164. db.e.save("v/capital-manama", "v/country-bahrain", { type: "is-in" });
  165. db.e.save("v/capital-nassau", "v/country-bahamas", { type: "is-in" });
  166. db.e.save("v/capital-n-djamena", "v/country-chad", { type: "is-in" });
  167. db.e.save("v/capital-ottawa", "v/country-canada", { type: "is-in" });
  168. db.e.save("v/capital-ouagadougou", "v/country-burkina-faso", { type: "is-in" });
  169. db.e.save("v/capital-paris", "v/country-france", { type: "is-in" });
  170. db.e.save("v/capital-phnom-penh", "v/country-cambodia", { type: "is-in" });
  171. db.e.save("v/capital-prague", "v/country-czech-republic", { type: "is-in" });
  172. db.e.save("v/capital-quito", "v/country-ecuador", { type: "is-in" });
  173. db.e.save("v/capital-saint-john-s", "v/country-antigua-and-barbuda", { type: "is-in" });
  174. db.e.save("v/capital-santiago", "v/country-chile", { type: "is-in" });
  175. db.e.save("v/capital-sarajevo", "v/country-bosnia-and-herzegovina", { type: "is-in" });
  176. db.e.save("v/capital-sofia", "v/country-bulgaria", { type: "is-in" });
  177. db.e.save("v/capital-thimphu", "v/country-bhutan", { type: "is-in" });
  178. db.e.save("v/capital-tirana", "v/country-albania", { type: "is-in" });
  179. db.e.save("v/capital-vienna", "v/country-austria", { type: "is-in" });
  180. db.e.save("v/capital-yamoussoukro", "v/country-cote-d-ivoire", { type: "is-in" });
  181. db.e.save("v/capital-yaounde", "v/country-cameroon", { type: "is-in" });
  182. db.e.save("v/capital-zagreb", "v/country-croatia", { type: "is-in" });