Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ronaldpetty/8282e6d8319e3873475b5d1632b5b8c6 to your computer and use it in GitHub Desktop.
Save ronaldpetty/8282e6d8319e3873475b5d1632b5b8c6 to your computer and use it in GitHub Desktop.
tree of life - arangodb
## FORMAT
```
$ curl -sLO https://rx-m-data.s3.us-west-1.amazonaws.com/tree_of_life.zip
$ unzip tree_of_life.zip
[rocky@ip-172-31-22-94 demo_big_graph]$ head -n 2 treeoflife_nodes.csv
node_id,node_name,child_nodes,leaf_node,tolorg_link,extinct,confidence,phylesis
1,Life on Earth,4,0,1,0,0,0
[rocky@ip-172-31-22-94 demo_big_graph]$ head -n 2 treeoflife_links.csv
source_node_id,target_node_id
1,2
[rocky@ip-172-31-22-94 demo_big_graph]$
```
```
$ sed -i -e 's/node_id/_key/g' treeoflife_nodes.csv
$ sed -i -e 's/source_node_id/_from/g' -e 's/target_node_id/_to/g' treeoflife_links.csv
# needed to ingest of edge _from _to
$ sed -i -e '2,$s/\(.*\),\(.*\)/treeoflife_nodes\/\1,treeoflife_nodes\/\2/g' treeoflife_links.csv
```
## UPLOAD
```
~/arangodb/bin/arangoimport --server.password "" --file ~/demo_big_graph/treeoflife_nodes.csv --type csv --collection "treeoflife_nodes" --create-collection true --create-collection-type document
~/arangodb/bin/arangoimport --server.password "" --file ~/demo_big_graph/treeoflife_links.csv --type csv --collection "treeoflife_links" --create-collection true --create-collection-type edge
## Query
```
FOR u IN treeoflife_links
RETURN u
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment