-
Notifications
You must be signed in to change notification settings - Fork 2
/
queries-gcore-paper.spt
166 lines (116 loc) · 3.82 KB
/
queries-gcore-paper.spt
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
module queries-gcore-paper
language gcore-spoofax
test Query 1 (lines 1-4) [[
CONSTRUCT (n)
MATCH (n:Person)
ON social_graph
WHERE n.employer = 'Google'
]]
test Query 2 (lines 5-9) [[
CONSTRUCT (c)<-[:worksAt]-(n)
MATCH (c:Company) ON company_graph,
(n:Person) ON social_graph
WHERE c.name = n.employer
UNION social_graph
]]
test Query 3 (lines 10-14) [[
CONSTRUCT (c)<-[:worksAt]-(n)
MATCH (c:Company) ON company_graph,
(n:Person {employer=e}) ON social_graph
WHERE c.name = e
UNION social_graph
]]
test Query 4 (lines 15-19) [[
CONSTRUCT (c)<-[:worksAt]-(n)
MATCH (c:Company) ON company_graph,
(n:Person {employer=e}) ON social_graph
WHERE c.name = e
UNION social_graph
]]
test Query 5 (lines 20-22) [[
CONSTRUCT social_graph,
(x GROUP e :Company {name:=e})<-[y:worksAt]-(n)
MATCH (n:Person {employer=e})
]]
test Query 6 (lines 23-27) [[
CONSTRUCT (n)-/@p:localPeople{distance:=c}/->(m)
MATCH (n)-/3 SHORTEST p<:knows*> COST c/->(m)
WHERE (n:Person) AND (m:Person)
AND n.firstName = 'John' AND n.lastName = 'Doe'
AND (n)-[:isLocatedIn]->()<-[:isLocatedIn]-(m)
]]
test Query 7 (lines 28-31) [[
CONSTRUCT (m)
MATCH (n:Person)-/<:knows*>/->(m:Person)
WHERE n.firstName = 'John' AND n.lastName = 'Doe'
AND (n)-[:isLocatedIn]->()<-[:isLocatedIn]-(m)
]]
test Query 8 (lines 32-35) [[
CONSTRUCT (n)-/p/->(m)
MATCH (n:Person)-/ALL p<:knows*>/->(m:Person)
WHERE n.firstName = 'John' AND n.lastName = 'Doe'
AND (n)-[:isLocatedIn]->()<-[:isLocatedIn]-(m)
]]
test Query 9 (lines 32-34, 36-39) [[
CONSTRUCT (n)-/p/->(m)
MATCH (n:Person)-/ALL p<:knows*>/->(m:Person)
WHERE n.firstName = 'John' AND n.lastName = 'Doe'
AND EXISTS (
CONSTRUCT ()
MATCH (n)-[:isLocatedIn]->()<-[:isLocatedIn]-(m)
)
]]
test Query 10 (lines 40-48) [[
GRAPH VIEW social_graph1 AS (
CONSTRUCT social_graph,
(n)-[e]->(m) SET e.nr_messages := COUNT(*)
MATCH (n)-[e:knows]->(m)
WHERE (n:Person) AND (m:Person)
OPTIONAL (n)<-[c1]-(msg1:Post|Comment),
(msg1)-[:reply_of]-(msg2),
(msg2:Post|Comment)-[c2]->(m)
WHERE (c1:has_creator) AND (c2:has_creator) )
]]
test Query 11 (lines 49-51) [[
CONSTRUCT (n) /* line not part of the G-CORE paper */
MATCH (n:Person)
OPTIONAL (n)-[:worksAt]->(c)
OPTIONAL (n)-[:livesIn]->(a)
]]
test Query 12 (lines 52-54) [[
CONSTRUCT (n) /* line not part of the G-CORE paper */
MATCH (n:Person)
OPTIONAL (n)-[:worksAt]->(a)
OPTIONAL (n)-[:livesIn]->(a)
]]
test Query 13 (lines 55-57) [[
CONSTRUCT (n) /* line not part of the G-CORE paper */
MATCH (n:Person)
OPTIONAL (n)-[:worksAt]->(a)
OPTIONAL (n)-[:livesIn]->(a)
]]
test Query 14 (lines 58-67) [[
GRAPH VIEW social_graph2 AS (
PATH wKnows = (x)-[e:knows]->(y)
WHERE NOT 'Google' IN y.employer
COST 1 / (1 + e.nr_messages)
CONSTRUCT social_graph1, (n)-/@p:toWagner/->(m)
MATCH (n:Person)-/p<~wKnows*>/->(m:Person)
ON social_graph1
WHERE (m)-[:hasInterest]->(:tag {name='Wagner'})
AND (n)-[:isLocatedIn]->()<-[:isLocatedIn]-(m)
AND n.firstName = 'John' AND n.lastName = 'Doe')
]]
test Query 15 (lines 68-72) [[
CONSTRUCT (n)-[e:wagnerFriend {score:=COUNT(*)}]->(m)
WHEN e.score > 0
MATCH (n:Person)-/@p:toWagner/->(), (m:Person)
ON social_graph2
WHERE n = nodes(p)[1]
]]
test Query 16 (lines 73-76) [[
SELECT m.lastName + ', ' + m.firstName AS friendName
MATCH (n:Person)-/<:knows*>/->(m:Person)
WHERE n.firstName = 'John' AND n.lastName = 'Doe'
AND (n)-[:isLocatedIn]->()<-[:isLocatedIn]-(m)
]]