-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathlandscape-cncf-load.cypher
65 lines (54 loc) · 1.6 KB
/
landscape-cncf-load.cypher
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
//load.json(landscape.cncf.io) items.json
CALL apoc.load.json("https://landscape.cncf.io/data/items.json") YIELD value
MERGE (c:Card {name: value.name})
ON CREATE SET
c += value {
.bestPracticeBadgeId,
.bestPracticePercentage,
.commitsThisYear,
.contributorsCount,
.crunchbase,
.description,
.homepage_url,
.isSubsidiaryProject,
.logo,
.member,
.name, // i
.oss, // i
.repo_url,
.stars,
.twitter
}
WITH c, value
MERGE(ossl:License { name: value.license })
MERGE (c)-[:HAS_LICENSE]->(ossl)
MERGE(hq:Headquarters { name: value.headquarters })
MERGE(c)-[:HAS_HEADQUARTERS]->(hq)
// sandbox | incubating | graduated
MERGE(r:Relation { name: value.relation })
MERGE(c)-[:HAS_RELATION]->(r)
MERGE(org:Organization { name: value.organization })
MERGE(c)-[:IN_ORGANIZATION]->(org)
MERGE(p:Path {name: value.path})
MERGE(c)-[:IN_PATH]->(p)
MERGE(cat:Category {name: value.category})
MERGE(c)-[:IN_CATEGORY]->(cat)
// false || bronze/silver/gold/platinum
MERGE(m:Member {name: value.member})
MERGE(c)-[:HAS_MEMBERSHIP]->(m)
//
// deal with embedded arrays
//
WITH c, value
UNWIND value.industries as industry
MERGE (i:Industry {name: industry})
MERGE (c)-[:IN_INDUSTRY]->(i)
WITH c, value
UNWIND value.github_data.languages as language
MERGE (l:Language {name: language.name})
MERGE (c)-[:USES_LANGUAGE]->(l)
WITH c, value
UNWIND value.repos as repo
MERGE (r:Repo {url: repo.url}) // TODO: should parse out an org/repo id for this
MERGE (c)-[:OWNS_REPO]->(r)
return count(*)