forked from datastax/graph-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsupplemental-data-mapping.groovy
69 lines (61 loc) · 1.6 KB
/
supplemental-data-mapping.groovy
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
config create_schema: true, load_new: false
// If the user specifies an inputpath on the command-line, use that.
// Otherwise check the data directory from the data directory from where the loader is run.
if (inputpath == '')
path = new java.io.File('.').getCanonicalPath() + '/data/'
else
path = inputpath + '/'
def fbMembersInput = File.csv(path + 'facebook_members.csv').delimiter('|')
def identitiesInput = File.csv(path + 'identity_c2fb.csv').delimiter('|')
def isFriendsWithInput = File.csv(path + 'isFriendsWith.csv').delimiter('|')
def isRelatedToInput = File.csv(path + 'isRelatedTo.csv').delimiter('|')
def ratedInput = File.csv(path + 'rated.csv').delimiter('|')
//Specifies what data source to load using which mapper
load(fbMembersInput).asVertices {
label "networkMember"
key "name"
}
load(identitiesInput).asEdges {
label 'isMember'
outV 'name', {
label 'customer'
key 'name'
}
inV 'name', {
label 'networkMember'
key 'name'
}
}
load(isFriendsWithInput).asEdges {
label "isFriendsWith"
outV "nameFrom", {
label "networkMember"
key "name"
}
inV "nameTo", {
label "networkMember"
key "name"
}
}
load(isRelatedToInput).asEdges {
label "isRelatedTo"
outV "nameFrom", {
label "networkMember"
key "name"
}
inV "nameTo", {
label "networkMember"
key "name"
}
}
load(ratedInput).asEdges {
label "rated"
outV "customerName", {
label "customer"
key "name"
}
inV "productId", {
label "product"
key "id"
}
}