You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: schema.graphql
+24-12Lines changed: 24 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -193,6 +193,7 @@ type PseudoCharacterInstance {
193
193
characterName: String
194
194
characterID: String
195
195
characterDeepOrder: String
196
+
stateDeepOrder: String
196
197
stateName: String
197
198
stateID: String
198
199
stateOrder: String
@@ -240,33 +241,44 @@ type OTU {
240
241
(ci)-[hs:HAS_STATE]->(s:State),
241
242
(d)-[:APPLICATION_OF]->(schema:Schema)
242
243
WITH
243
-
DISTINCT c, schema, s{.*, value: hs.value, order:avg(toInteger(hs.order))} AS s //Tuck the order and value relationship properties in temp object with state for use later. For order, we want to save the average value for this state.
244
+
DISTINCT c, schema, s, hs.value AS stateValue, hs.order AS stateOrder
244
245
245
-
// Calculate Character deepOrder using a subquery that doesn't affect row count
246
+
// Combined subquery for both Character and State deepOrder
246
247
CALL {
247
-
WITH c
248
-
MATCH path = (c)-[:CHARACTER_OF*0..]->(root:Character)
249
-
WITH c, path
250
-
ORDER BY length(path) DESC
248
+
WITH c, s
249
+
// Calculate Character deepOrder
250
+
MATCH path1 = (c)-[:CHARACTER_OF*0..]->(rootChar:Character)
251
+
WITH c, s, path1
252
+
ORDER BY length(path1) DESC
251
253
LIMIT 1
254
+
255
+
// Calculate State deepOrder
256
+
MATCH path2 = (s)-[:STATE_OF*0..]->(rootState:State)
257
+
WITH c, s, path1, path2
258
+
ORDER BY length(path2) DESC
259
+
LIMIT 1
260
+
252
261
RETURN
253
-
c.pbotID AS charID,
254
-
apoc.text.join([n IN reverse(nodes(path)) | n.order], ".") AS deepOrder
262
+
c.pbotID AS charID,
263
+
s.pbotID AS stateID,
264
+
apoc.text.join([n IN reverse(nodes(path1)) | n.order], ".") AS charDeepOrder,
265
+
apoc.text.join([n IN reverse(nodes(path2)) | n.order], ".") AS stateDeepOrder
0 commit comments