-
Notifications
You must be signed in to change notification settings - Fork 0
/
import_data.sh
55 lines (47 loc) · 1.59 KB
/
import_data.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Create collections
arangoimport \
--server.endpoint "${ARANGO_ENDPOINT}" \
--server.username "${ARANGO_USERNAME}" \
--server.password "${ARANGO_PASSWORD}" \
--server.database "${ARANGO_DATABASE}" \
--file "data/kanji.jsonl" \
--type json \
--collection "kanji" \
--create-collection true
arangoimport \
--server.endpoint "${ARANGO_ENDPOINT}" \
--server.username "${ARANGO_USERNAME}" \
--server.password "${ARANGO_PASSWORD}" \
--server.database "${ARANGO_DATABASE}" \
--file "data/words.jsonl" \
--type json \
--collection "words" \
--create-collection true
arangoimport \
--server.endpoint "${ARANGO_ENDPOINT}" \
--server.username "${ARANGO_USERNAME}" \
--server.password "${ARANGO_PASSWORD}" \
--server.database "${ARANGO_DATABASE}" \
--file "data/kanji-kanji.jsonl" \
--type json \
--collection "kanji-kanji" \
--from-collection-prefix "kanji" \
--to-collection-prefix "kanji" \
--create-collection true\
--create-collection-type edge
# Create Graph
CREATE_GRAPH_CMD=$(cat <<-END
db._useDatabase("${ARANGO_DATABASE}");
var graph_module = require("org/arangodb/general-graph");
var edgeDefinitions = [ { collection: "kanji-kanji", "from": [ "kanji" ], "to" : [ "kanji" ] } ];
var graph = graph_module._create("graph-kanji",edgeDefinitions);
END
)
echo "${CREATE_GRAPH_CMD}" > tmp.js
arangosh \
--javascript.execute tmp.js \
--server.endpoint "${ARANGO_ENDPOINT}" \
--server.username "${ARANGO_USERNAME}" \
--server.password "${ARANGO_PASSWORD}" \
--server.database "${ARANGO_DATABASE}"
rm tmp.js