aql

package
v0.0.0-...-bd8d8dc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllStreamers = []byte(`{
	"return": {
	  "entities": [
		2,
		3
	  ],
	  "relations": [
		1,
		14
	  ],
	  "groupBys": [
		6,
		7,
		21
	  ]
	},
	"entities": [
	  {
		"name": "Streamer",
		"ID": 2,
		"constraints": []
	  },
	  {
		"name": "Streamer",
		"ID": 3,
		"constraints": []
	  }
	],
	"relations": [
	  {
		"ID": 1,
		"name": "viewerOverlap",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 2,
		"toType": "entity",
		"toID": 3,
		"constraints": []
	  },
	  {
		"ID": 14,
		"name": "viewerOverlap",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "groupBy",
		"fromID": 6,
		"toType": "groupBy",
		"toID": 7,
		"constraints": []
	  }
	],
	"groupBys": [
	  {
		"ID": 6,
		"groupType": "entity",
		"groupID": [
		  2
		],
		"groupAttribute": "Count",
		"byType": "entity",
		"byID": [
		  3
		],
		"byAttribute": "_id",
		"appliedModifier": "AVG",
		"relationID": 1,
		"constraints": []
	  },
	  {
		"ID": 7,
		"groupType": "entity",
		"groupID": [
		  2
		],
		"groupAttribute": "Count",
		"byType": "entity",
		"byID": [
		  3
		],
		"byAttribute": "_id",
		"appliedModifier": "AVG",
		"relationID": 1,
		"constraints": []
	  },
	  {
		"ID": 21,
		"groupType": "groupBy",
		"groupID": [
		  6
		],
		"groupAttribute": "Count",
		"byType": "groupBy",
		"byID": [
		  7
		],
		"byAttribute": "_id",
		"appliedModifier": "AVG",
		"relationID": 14,
		"constraints": []
	  }
	],
	"machineLearning": [],
	"limit": 5000
  }
`)
View Source
var AllStreamersResult = string(`LET tree_0 = (
	FOR e_2 IN Streamer
	LET e3 = (
			FOR e_3 IN Streamer
			FOR r1 IN viewerOverlap
			FILTER r1._from == e_2._id AND r1._to == e_3._id
			FILTER length(e_3) != 0 AND length(r1) != 0
			RETURN {"e3": union_distinct([e_3], []), "r1": union_distinct([r1], [])}
	)
	FILTER length(e3) != 0 AND length(e_2) != 0
	RETURN {"e3": union_distinct(flatten(e3[**].e3), []), "r1": union_distinct(flatten(e3[**].r1), []), "e2": union_distinct([e_2], [])}
)
LET gt6 = (
	FOR x IN viewerOverlap
	LET variable_0 = (
			LET tmp = union_distinct(flatten(tree_0[**].e3), [])
					FOR y IN tmp
					FILTER y._id == x._to
					RETURN y._id
	)
	LET variable_1 = variable_0[0]
	LET variable_2 = (
			LET tmp = union_distinct(flatten(tree_0[**].e2), [])
					FOR y IN tmp
					FILTER y._id == x._from
					RETURN y.Count
	)
	LET variable_3 = variable_2[0]
	FILTER variable_1 != NULL AND variable_3 != NULL
	RETURN {
			"group": variable_1,
			"by": variable_3
	}
)
LET g6 = (
	FOR x IN gt6
	COLLECT c = x.group INTO groups = x.by
	LET variable_0 = AVG(groups)
	RETURN {
	_id: c,
	modifier: variable_0
	}
)
LET in6 = (
	FOR x IN g6[**]._id
	FOR y IN Streamer
	FILTER x == y._id
	RETURN y
)
LET gt7 = (
	FOR x IN viewerOverlap
	LET variable_0 = (
			LET tmp = union_distinct(flatten(tree_0[**].e3), [])
					FOR y IN tmp
					FILTER y._id == x._to
					RETURN y._id
	)
	LET variable_1 = variable_0[0]
	LET variable_2 = (
			LET tmp = union_distinct(flatten(tree_0[**].e2), [])
					FOR y IN tmp
					FILTER y._id == x._from
					RETURN y.Count
	)
	LET variable_3 = variable_2[0]
	FILTER variable_1 != NULL AND variable_3 != NULL
	RETURN {
			"group": variable_1,
			"by": variable_3
	}
)
LET g7 = (
	FOR x IN gt7
	COLLECT c = x.group INTO groups = x.by
	LET variable_0 = AVG(groups)
	RETURN {
	_id: c,
	modifier: variable_0
	}
)
LET in7 = (
	FOR x IN g7[**]._id
	FOR y IN Streamer
	FILTER x == y._id
	RETURN y
)
LET tree_1 = (
	FOR g_6 IN in6
	LET gb7 = (
			FOR g_7 IN in7
			FOR r14 IN viewerOverlap
			FILTER r14._from == g_6._id AND r14._to == g_7._id
			FILTER length(g_7) != 0 AND length(r14) != 0
			RETURN {"gb7": union_distinct([g_7], []), "r14": union_distinct([r14], [])}
	)
	FILTER length(gb7) != 0 AND length(g_6) != 0
	RETURN {"gb6": union_distinct([g_6], []), "gb7": union_distinct(flatten(gb7[**].gb7), []), "r14": union_distinct(flatten(gb7[**].r14), [])}
)
LET gt21 = (
	FOR x IN viewerOverlap
	LET variable_0 = (
			LET tmp = union_distinct(flatten(tree_1[**].gb7), [])
					FOR y IN tmp
					FILTER y._id == x._to
					RETURN y._id
	)
	LET variable_1 = variable_0[0]
	LET variable_2 = (
			LET tmp = union_distinct(flatten(tree_1[**].gb6), [])
					FOR y IN tmp
					FILTER y._id == x._from
					RETURN y.Count
	)
	LET variable_3 = variable_2[0]
	FILTER variable_1 != NULL AND variable_3 != NULL
	RETURN {
			"group": variable_1,
			"by": variable_3
	}
)
LET g21 = (
	FOR x IN gt21
	COLLECT c = x.group INTO groups = x.by
	LET variable_0 = AVG(groups)
	RETURN {
	_id: c,
	modifier: variable_0
	}
)
FOR x in g21
RETURN {group: x.modifier, by: x._id}`)
View Source
var BoolEqual = []byte(`{
	"return": {
	  "entities": [
		8,
		9
	  ],
	  "relations": [
		7
	  ],
	  "groupBys": []
	},
	"entities": [
	  {
		"name": "parliament",
		"ID": 8,
		"constraints": []
	  },
	  {
		"name": "parties",
		"ID": 9,
		"constraints": []
	  }
	],
	"relations": [
	  {
		"ID": 7,
		"name": "member_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 8,
		"toType": "entity",
		"toID": 9,
		"constraints": [
		  {
			"attribute": "isChairman",
			"value": "true",
			"dataType": "bool",
			"matchType": "EQ"
		  }
		]
	  }
	],
	"groupBys": [],
	"machineLearning": [],
	"limit": 5000
  }`)
View Source
var BoolEqualResult = string(`LET tree_0 = (
	FOR e_8 IN parliament
	LET e9 = (
			FOR e_9 IN parties
			FOR r7 IN member_of
			FILTER r7.isChairman == true
			FILTER r7._from == e_8._id AND r7._to == e_9._id
			FILTER length(e_9) != 0 AND length(r7) != 0
			RETURN {"e9": union_distinct([e_9], []), "r7": union_distinct([r7], [])}
	)
	FILTER length(e9) != 0 AND length(e_8) != 0
	RETURN {"e8": union_distinct([e_8], []), "e9": union_distinct(flatten(e9[**].e9), []), "r7": union_distinct(flatten(e9[**].r7), [])}
)
LET nodes = union_distinct(flatten(tree_0[**].e8), flatten(tree_0[**].e9), [])
LET edges = union_distinct(flatten(tree_0[**].r7), [])
RETURN {"vertices":nodes,"edges":edges}`)
View Source
var BoolNotEqual = []byte(`{
	"return": {
	  "entities": [
		8,
		9
	  ],
	  "relations": [
		7
	  ],
	  "groupBys": []
	},
	"entities": [
	  {
		"name": "parliament",
		"ID": 8,
		"constraints": []
	  },
	  {
		"name": "parties",
		"ID": 9,
		"constraints": []
	  }
	],
	"relations": [
	  {
		"ID": 7,
		"name": "member_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 8,
		"toType": "entity",
		"toID": 9,
		"constraints": [
		  {
			"attribute": "isChairman",
			"value": "true",
			"dataType": "bool",
			"matchType": "NEQ"
		  }
		]
	  }
	],
	"groupBys": [],
	"machineLearning": [],
	"limit": 5000
  }`)
View Source
var BoolNotEqualResult = string(`LET tree_0 = (
	FOR e_8 IN parliament
	LET e9 = (
			FOR e_9 IN parties
			FOR r7 IN member_of
			FILTER r7.isChairman != true
			FILTER r7._from == e_8._id AND r7._to == e_9._id
			FILTER length(e_9) != 0 AND length(r7) != 0
			RETURN {"e9": union_distinct([e_9], []), "r7": union_distinct([r7], [])}
	)
	FILTER length(e9) != 0 AND length(e_8) != 0
	RETURN {"e8": union_distinct([e_8], []), "e9": union_distinct(flatten(e9[**].e9), []), "r7": union_distinct(flatten(e9[**].r7), [])}
)
LET nodes = union_distinct(flatten(tree_0[**].e9), flatten(tree_0[**].e8), [])
LET edges = union_distinct(flatten(tree_0[**].r7), [])
RETURN {"vertices":nodes,"edges":edges}`)
View Source
var DifferentNodesOnGroupBy = []byte(`{
	"return": {
	  "entities": [
		2,
		3,
		11,
		12
	  ],
	  "relations": [
		1,
		10
	  ],
	  "groupBys": [
		6
	  ]
	},
	"entities": [
	  {
		"name": "parliament",
		"ID": 2,
		"constraints": []
	  },
	  {
		"name": "commissions",
		"ID": 3,
		"constraints": []
	  },
	  {
		"name": "parliament",
		"ID": 11,
		"constraints": []
	  },
	  {
		"name": "parties",
		"ID": 12,
		"constraints": []
	  }
	],
	"relations": [
	  {
		"ID": 1,
		"name": "part_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 2,
		"toType": "entity",
		"toID": 3,
		"constraints": []
	  },
	  {
		"ID": 10,
		"name": "member_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 11,
		"toType": "entity",
		"toID": 12,
		"constraints": []
	  }
	],
	"groupBys": [
	  {
		"ID": 6,
		"groupType": "entity",
		"groupID": [
		  3,
		  11
		],
		"groupAttribute": "age",
		"byType": "entity",
		"byID": [
		  3,
		  12
		],
		"byAttribute": "_id",
		"appliedModifier": "avg",
		"relationID": 1,
		"constraints": []
	  }
	],
	"machineLearning": [],
	"limit": 5000
  }`)
View Source
var DoubleJunctionNineEntitiesThreeEntityFilters = []byte(`{
	"return": {
		"entities": [
			0,
			1,
			2,
			3,
			4,
			5,
			6,
			7
		],
		"relations": [
			0,
			1,
			2,
			3,
			4,
			5,
			6
		]
	},
	"entities": [
		{
			"name": "parliament",
			"ID": 0,
			"constraints": [
				{
					"attribute": "name",
					"value": "Geert",
					"dataType": "string",
					"matchType": "contains"
				}
			]
		},
		{
			"name": "commissions",
			"ID": 1,
			"constraints": []
		},
		{
			"name": "parliament",
			"ID": 2,
			"constraints": []
		},
		{
			"name": "parties",
			"ID": 3,
			"constraints": [
				{
					"attribute": "seats",
					"value": "10",
					"dataType": "int",
					"matchType": "LT"
				}
			]
		},
		{
			"name": "resolutions",
			"ID": 4,
			"constraints": [
				{
					"attribute": "date",
					"value": "mei",
					"dataType": "string",
					"matchType": "contains"
				}
			]
		},
		{
			"name": "resolutions",
			"ID": 5,
			"constraints": []
		},
		{
			"name": "parties",
			"ID": 6,
			"constraints": []
		}
		,
		{
			"name": "parliament",
			"ID": 7,
			"constraints": []
		}
		
	],
	"groupBys": [],
	"relations": [
		{
			"ID": 0,
			"name": "part_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromId": 0,
			"toType": "entity",
			"toID": 1,
			"constraints": []
		},
		{
			"ID": 1,
			"name": "part_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromId": 2,
			"toType": "entity",
			"toID": 1,
			"constraints": []
		},
		{
			"ID": 2,
			"name": "member_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromId": 2,
			"toType": "entity",
			"toID": 3,
			"constraints": []
		},
		{
			"ID": 3,
			"name": "submits",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromId": 2,
			"toType": "entity",
			"toID": 4,
			"constraints": []
		},
		{
			"ID": 4,
			"name": "submits",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromId": 0,
			"toType": "entity",
			"toID": 5,
			"constraints": []
		},
		{
			"ID": 5,
			"name": "member_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromId": 0,
			"toType": "entity",
			"toID": 6,
			"constraints": []
		}
		,
		{
			"ID": 6,
			"name": "member_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromId": 7,
			"toType": "entity",
			"toID": 6,
			"constraints": []
		}
	],
	"limit": 5000
}`)
View Source
var DoubleJunctionNineEntitiesThreeEntityFiltersResult = string(`LET tree_0 = (
	FOR e_3 IN parties
	FILTER e_3.seats < 10
	LET e2 = (
			FOR e_2 IN parliament
			FOR r2 IN member_of
			FILTER r2._from == e_2._id AND r2._to == e_3._id
			LET e1 = (
					FOR e_1 IN commissions
					FOR r1 IN part_of
					FILTER r1._from == e_2._id AND r1._to == e_1._id
					LET e0 = (
							FOR e_0 IN parliament
							FOR r0 IN part_of
							FILTER e_0.name LIKE "%Geert%"
							FILTER r0._from == e_0._id AND r0._to == e_1._id
							LET e5 = (
									FOR e_5 IN resolutions
									FOR r4 IN submits
									FILTER r4._from == e_0._id AND r4._to == e_5._id
									FILTER length(e_5) != 0 AND length(r4) != 0
									RETURN {"e5": union_distinct([e_5], []), "r4": union_distinct([r4], [])}
							)
							LET e6 = (
									FOR e_6 IN parties
									FOR r5 IN member_of
									FILTER r5._from == e_0._id AND r5._to == e_6._id
									LET e7 = (
											FOR e_7 IN parliament
											FOR r6 IN member_of
											FILTER r6._from == e_7._id AND r6._to == e_6._id
											FILTER length(e_7) != 0 AND length(r6) != 0
											RETURN {"e7": union_distinct([e_7], []), "r6": union_distinct([r6], [])}
									)
									FILTER length(e7) != 0 AND length(e_6) != 0 AND length(r5) != 0
									RETURN {"e6": union_distinct([e_6], []), "e7": union_distinct(flatten(e7[**].e7), []), "r6": union_distinct(flatten(e7[**].r6), []), "r5": union_distinct([r5], [])}
							)
							FILTER length(e5) != 0 AND length(e6) != 0 AND length(e_0) != 0 AND length(r0) != 0
							RETURN {"e0": union_distinct([e_0], []), "r0": union_distinct([r0], []), "r6": union_distinct(flatten(e6[**].r6), []), "r4": union_distinct(flatten(e5[**].r4), []), "r5": union_distinct(flatten(e6[**].r5), []), "r6": union_distinct(flatten(e6[**].r6), []), "e5": union_distinct(flatten(e5[**].e5), []), "e6": union_distinct(flatten(e6[**].e6), []), "e7": union_distinct(flatten(e6[**].e7), [])}
					)
					FILTER length(e0) != 0 AND length(e_1) != 0 AND length(r1) != 0
					RETURN {"e1": union_distinct([e_1], []), "r6": union_distinct(flatten(e0[**].r6), []), "r0": union_distinct(flatten(e0[**].r0), []), "r4": union_distinct(flatten(e0[**].r4), []), "r5": union_distinct(flatten(e0[**].r5), []), "r6": union_distinct(flatten(e0[**].r6), []), "e5": union_distinct(flatten(e0[**].e5), []), "e6": union_distinct(flatten(e0[**].e6), []), "e7": union_distinct(flatten(e0[**].e7), []), "e0": union_distinct(flatten(e0[**].e0), []), "r1": union_distinct([r1], [])}
			)
			LET e4 = (
					FOR e_4 IN resolutions
					FOR r3 IN submits
					FILTER e_4.date LIKE "%mei%"
					FILTER r3._from == e_2._id AND r3._to == e_4._id
					FILTER length(e_4) != 0 AND length(r3) != 0
					RETURN {"e4": union_distinct([e_4], []), "r3": union_distinct([r3], [])}
			)
			FILTER length(e1) != 0 AND length(e4) != 0 AND length(e_2) != 0 AND length(r2) != 0
			RETURN {"e2": union_distinct([e_2], []), "r2": union_distinct([r2], []), "r6": union_distinct(flatten(e1[**].r6), []), "r0": union_distinct(flatten(e1[**].r0), []), "r5": union_distinct(flatten(e1[**].r5), []), "r4": union_distinct(flatten(e1[**].r4), []), "r1": union_distinct(flatten(e1[**].r1), []), "e1": union_distinct(flatten(e1[**].e1), []), "e0": union_distinct(flatten(e1[**].e0), []), "e7": union_distinct(flatten(e1[**].e7), []), "e6": union_distinct(flatten(e1[**].e6), []), "e5": union_distinct(flatten(e1[**].e5), []), "r3": union_distinct(flatten(e4[**].r3), []), "e4": union_distinct(flatten(e4[**].e4), [])}
	)
	FILTER length(e2) != 0 AND length(e_3) != 0
	RETURN {"e0": union_distinct(flatten(e2[**].e0), []), "e1": union_distinct(flatten(e2[**].e1), []), "e2": union_distinct(flatten(e2[**].e2), []), "e3": union_distinct([e_3], []), "e4": union_distinct(flatten(e2[**].e4), []), "e5": union_distinct(flatten(e2[**].e5), []), "e6": union_distinct(flatten(e2[**].e6), []), "e7": union_distinct(flatten(e2[**].e7), []), "r0": union_distinct(flatten(e2[**].r0), []), "r1": union_distinct(flatten(e2[**].r1), []), "r2": union_distinct(flatten(e2[**].r2), []), "r3": union_distinct(flatten(e2[**].r3), []), "r4": union_distinct(flatten(e2[**].r4), []), "r5": union_distinct(flatten(e2[**].r5), []), "r6": union_distinct(flatten(e2[**].r6), [])}
)
LET nodes = union_distinct(flatten(tree_0[**].e0), flatten(tree_0[**].e1), flatten(tree_0[**].e2), flatten(tree_0[**].e3), flatten(tree_0[**].e4), flatten(tree_0[**].e5), flatten(tree_0[**].e6), flatten(tree_0[**].e7), [])
LET edges = union_distinct(flatten(tree_0[**].r0), flatten(tree_0[**].r1), flatten(tree_0[**].r2), flatten(tree_0[**].r3), flatten(tree_0[**].r4), flatten(tree_0[**].r5), flatten(tree_0[**].r6), [])
RETURN {"vertices":nodes,"edges":edges}
`)
View Source
var EmptyQueryResult = string(`LET nodes = first(RETURN UNION_DISTINCT([],[]))
LET edges = first(RETURN UNION_DISTINCT([],[]))
RETURN {"vertices":nodes, "edges":edges }`)
View Source
var FiveEntitiesFourEntityFilters = []byte(`{
	"databaseName": "TweedeKamer",
	"return": {
		"entities": [
			0,
			1,
			2,
			3,
			4
		],
		"relations": [
			0,
			1,
			2,
			3
		]
	},
	"entities": [
		{
			"name": "parliament",
			"ID": 0,
			"constraints": [
				{
					"attribute": "name",
					"value": "A",
					"dataType": "string",
					"matchType": "contains"
				}
			]
		},
		{
			"name": "parties",
			"ID": 1,
			"constraints": [
				{
					"attribute": "seats",
					"value": "10",
					"dataType": "int",
					"matchType": "LT"
				}
			]
		},
		{
			"name": "resolutions",
			"ID": 2,
			"constraints": [
				{
					"attribute": "date",
					"value": "mei",
					"dataType": "string",
					"matchType": "contains"
				}
			]
		},
		{
			"name": "parliament",
			"ID": 3,
			"constraints":[]
		},
		{
			"name": "parties",
			"ID": 4,
			"constraints": [
				{
					"attribute": "name",
					"value": "Volkspartij voor Vrijheid en Democratie",
					"dataType": "string",
					"matchType": "=="
				}
			]
		}
	],
	"relations": [
		{
			"ID": 0,
			"name": "member_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 0,
			"toType": "entity",
			"toID": 1,
			"constraints": []
		},
		{
			"ID": 1,
			"name": "submits",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 0,
			"toType": "entity",
			"toID": 2,
			"constraints": []
		},
		{
			"ID": 2,
			"name": "submits",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 3,
			"toType": "entity",
			"toID": 2,
			"constraints": []
		},
		{
			"ID": 3,
			"name": "member_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 3,
			"toType": "entity",
			"toID": 4,
			"constraints": []
		}
	],
	"groupBys": [],
	"limit": 5000,
	"modifiers": []
}`)
View Source
var FiveEntitiesFourEntityFiltersResult = string(`LET tree_0 = (
	FOR e_1 IN parties
	FILTER e_1.seats < 10
	LET e0 = (
			FOR e_0 IN parliament
			FOR r0 IN member_of
			FILTER e_0.name LIKE "%A%"
			FILTER r0._from == e_0._id AND r0._to == e_1._id
			LET e2 = (
					FOR e_2 IN resolutions
					FOR r1 IN submits
					FILTER e_2.date LIKE "%mei%"
					FILTER r1._from == e_0._id AND r1._to == e_2._id
					LET e3 = (
							FOR e_3 IN parliament
							FOR r2 IN submits
							FILTER r2._from == e_3._id AND r2._to == e_2._id
							LET e4 = (
									FOR e_4 IN parties
									FOR r3 IN member_of
									FILTER e_4.name == "Volkspartij voor Vrijheid en Democratie"
									FILTER r3._from == e_3._id AND r3._to == e_4._id
									FILTER length(e_4) != 0 AND length(r3) != 0
									RETURN {"e4": union_distinct([e_4], []), "r3": union_distinct([r3], [])}
							)
							FILTER length(e4) != 0 AND length(e_3) != 0 AND length(r2) != 0
							RETURN {"e3": union_distinct([e_3], []), "e4": union_distinct(flatten(e4[**].e4), []), "r2": union_distinct([r2], []), "r3": union_distinct(flatten(e4[**].r3), [])}
					)
					FILTER length(e3) != 0 AND length(e_2) != 0 AND length(r1) != 0
					RETURN {"e2": union_distinct([e_2], []), "e3": union_distinct(flatten(e3[**].e3), []), "e4": union_distinct(flatten(e3[**].e4), []), "r1": union_distinct([r1], []), "r2": union_distinct(flatten(e3[**].r2), []), "r3": union_distinct(flatten(e3[**].r3), [])}
			)
			FILTER length(e2) != 0 AND length(e_0) != 0 AND length(r0) != 0
			RETURN {"e0": union_distinct([e_0], []), "e2": union_distinct(flatten(e2[**].e2), []), "e3": union_distinct(flatten(e2[**].e3), []), "e4": union_distinct(flatten(e2[**].e4), []), "r0": union_distinct([r0], []), "r1": union_distinct(flatten(e2[**].r1), []), "r2": union_distinct(flatten(e2[**].r2), []), "r3": union_distinct(flatten(e2[**].r3), [])}
	)
	FILTER length(e0) != 0 AND length(e_1) != 0
	RETURN {"e1": union_distinct([e_1], []), "e0": union_distinct(flatten(e0[**].e0), []), "e2": union_distinct(flatten(e0[**].e2), []), "e3": union_distinct(flatten(e0[**].e3), []), "e4": union_distinct(flatten(e0[**].e4), []), "r0": union_distinct(flatten(e0[**].r0), []), "r1": union_distinct(flatten(e0[**].r1), []), "r2": union_distinct(flatten(e0[**].r2), []), "r3": union_distinct(flatten(e0[**].r3), [])}
)
LET nodes = union_distinct(flatten(tree_0[**].e0), flatten(tree_0[**].e1), flatten(tree_0[**].e2), flatten(tree_0[**].e3), flatten(tree_0[**].e4), [])
LET edges = union_distinct(flatten(tree_0[**].r0), flatten(tree_0[**].r1), flatten(tree_0[**].r2), flatten(tree_0[**].r3), [])
RETURN {"vertices":nodes,"edges":edges}
`)
View Source
var HierarchyBasic = []byte(`{
	"return": {
		"entities": [
			0,
			1,
			2,
			3,
			4
		],
		"relations": [
			0,
			1,
			2,
			3
		]
	},
	"entities": [
		{
			"name": "parliament",
			"ID": 0,
			"constraints": [
				{
					"attribute": "name",
					"value": "Geert",
					"dataType": "string",
					"matchType": "CONTAINS"
				}
			]
		},
		{
			"name": "commissions",
			"ID": 1,
			"constraints": []
		},
		{
			"name": "parliament",
			"ID": 2,
			"constraints": []
		},
		{
			"name": "parties",
			"ID": 3,
			"constraints": [
				{
					"attribute": "seats",
					"value": "10",
					"dataType": "int",
					"matchType": "LT"
				}
			]
		},
		{
			"name": "resolutions",
			"ID": 4,
			"constraints": [
				{
					"attribute": "date",
					"value": "mei",
					"dataType": "string",
					"matchType": "CONTAINS"
				}
			]
		}
	],
	"groupBys": [],
	"relations": [
		{
			"ID": 0,
			"name": "part_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromId": 0,
			"toType": "entity",
			"toID": 1,
			"constraints": []
		},
		{
			"ID": 1,
			"name": "part_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromId": 2,
			"toType": "entity",
			"toID": 1,
			"constraints": []
		},
		{
			"ID": 2,
			"name": "member_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromId": 2,
			"toType": "entity",
			"toID": 3,
			"constraints": []
		},
		{
			"ID": 3,
			"name": "submits",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromId": 2,
			"toType": "entity",
			"toID": 4,
			"constraints": []
		}
	],
	"limit": 5000
}
`)
View Source
var IncorrectGroupByModifier = []byte(`{
	"return": {
	  "entities": [
		2,
		3
	  ],
	  "relations": [
		1
	  ],
	  "groupBys": [
		6
	  ]
	},
	"entities": [
	  {
		"name": "parliament",
		"ID": 2,
		"constraints": []
	  },
	  {
		"name": "commissions",
		"ID": 3,
		"constraints": []
	  }
	],
	"relations": [
	  {
		"ID": 1,
		"name": "part_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 2,
		"toType": "entity",
		"toID": 3,
		"constraints": []
	  }
	],
	"groupBys": [
	  {
		"ID": 6,
		"groupType": "entity",
		"groupID": [
		  2
		],
		"groupAttribute": "age",
		"byType": "entity",
		"byID": [
		  3
		],
		"byAttribute": "_id",
		"appliedModifier": "wibblywobbly",
		"relationID": 1,
		"constraints": []
	  }
	],
	"machineLearning": [],
	"limit": 5000
  }`)
View Source
var IncorrectRelationFrom = []byte(`{
	"databaseName": "TweedeKamer",
	"return": {
		"entities": [
			0,
			1
		],
		"relations": [
			0
		]
	},
	"entities": [
		{
			"name": "parliament",
			"ID": 0,
			"constraints": []
		},
		{
			"name": "parties",
			"ID": 1,
			"constraints": []
		}
	],
	"relations": [
		{
			"ID": 0,
			"name": "member_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 0,
			"toType": "entity",
			"toID": -4,
			"constraints":[]
		}
	],
	"groupBys": [],		
	"limit": 5000,
	"modifiers": []
}`)
View Source
var IntNotEquals = []byte(`{
	"return": {
	  "entities": [
		2,
		3
	  ],
	  "relations": [
		1
	  ],
	  "groupBys": []
	},
	"entities": [
	  {
		"name": "parliament",
		"ID": 2,
		"constraints": [
			{
				"attribute": "seniority",
				"value": "57",
				"dataType": "int",
				"matchType": "NEQ"
			}
		]
	  },
	  {
		"name": "parties",
		"ID": 3,
		"constraints": []
	  }
	],
	"relations": [
	  {
		"ID": 1,
		"name": "member_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 2,
		"toType": "entity",
		"toID": 3,
		"constraints": []
	  }
	],
	"groupBys": [],
	"machineLearning": [],
	"limit": 5000
  }`)
View Source
var IntNotEqualsResult = string(`LET tree_0 = (
	FOR e_2 IN parliament
	FILTER e_2.seniority != 57
	LET e3 = (
			FOR e_3 IN parties
			FOR r1 IN member_of
			FILTER r1._from == e_2._id AND r1._to == e_3._id
			FILTER length(e_3) != 0 AND length(r1) != 0
			RETURN {"e3": union_distinct([e_3], []), "r1": union_distinct([r1], [])}
	)
	FILTER length(e3) != 0 AND length(e_2) != 0
	RETURN {"e2": union_distinct([e_2], []), "e3": union_distinct(flatten(e3[**].e3), []), "r1": union_distinct(flatten(e3[**].r1), [])}
)
LET nodes = union_distinct(flatten(tree_0[**].e3), flatten(tree_0[**].e2), [])
LET edges = union_distinct(flatten(tree_0[**].r1), [])
RETURN {"vertices":nodes,"edges":edges}`)
View Source
var MultipleInputGroupBy = []byte(`{
	"return": {
	  "entities": [43, 44, 48, 49, 73],
	  "relations": [42, 47, 71],
	  "groupBys": [31]
	},
	"entities": [
	  {
		"name": "parliament",
		"ID": 43,
		"constraints": [
		  {
			"attribute": "age",
			"value": "42",
			"dataType": "int",
			"matchType": "LT"
		  }
		]
	  },
	  {
		"name": "parties",
		"ID": 44,
		"constraints": [
		  {
			"attribute": "seats",
			"value": "6",
			"dataType": "int",
			"matchType": "GT"
		  }
		]
	  },
	  {
		"name": "parliament",
		"ID": 48,
		"constraints": [
		  {
			"attribute": "age",
			"value": "42",
			"dataType": "int",
			"matchType": "GET"
		  }
		]
	  },
	  {
		"name": "parties",
		"ID": 49,
		"constraints": [
		  {
			"attribute": "seats",
			"value": "6",
			"dataType": "int",
			"matchType": "LET"
		  }
		]
	  },
	  { "name": "parliament", "ID": 73, "constraints": [] }
	],
	"relations": [
	  {
		"ID": 42,
		"name": "member_of",
		"depth": { "min": 1, "max": 1 },
		"fromType": "entity",
		"fromID": 43,
		"toType": "entity",
		"toID": 44,
		"constraints": []
	  },
	  {
		"ID": 47,
		"name": "member_of",
		"depth": { "min": 1, "max": 1 },
		"fromType": "entity",
		"fromID": 48,
		"toType": "entity",
		"toID": 49,
		"constraints": []
	  },
	  {
		"ID": 71,
		"name": "member_of",
		"depth": { "min": 1, "max": 1 },
		"fromType": "entity",
		"fromID": 73,
		"toType": "groupBy",
		"toID": 31,
		"constraints": []
	  }
	],
	"groupBys": [
	  {
		"ID": 31,
		"groupType": "entity",
		"groupID": [43, 48],
		"groupAttribute": "age",
		"byType": "entity",
		"byID": [49, 44],
		"byAttribute": "_id",
		"appliedModifier": "AVG",
		"relationID": 47,
		"constraints": [
		  {
			"attribute": "age",
			"value": "40",
			"dataType": "int",
			"matchType": "GET"
		  }
		]
	  }
	],
	"machineLearning": [],
	"limit": 5000
  }
`)
View Source
var MultipleInputGroupByEndpoint = []byte(`{
	"return": {
	  "entities": [43, 44, 48, 49],
	  "relations": [42, 47],
	  "groupBys": [31]
	},
	"entities": [
	  {
		"name": "parliament",
		"ID": 43,
		"constraints": [
		  {
			"attribute": "age",
			"value": "42",
			"dataType": "int",
			"matchType": "LT"
		  }
		]
	  },
	  {
		"name": "parties",
		"ID": 44,
		"constraints": [
		  {
			"attribute": "seats",
			"value": "6",
			"dataType": "int",
			"matchType": "GT"
		  }
		]
	  },
	  {
		"name": "parliament",
		"ID": 48,
		"constraints": [
		  {
			"attribute": "age",
			"value": "42",
			"dataType": "int",
			"matchType": "GET"
		  }
		]
	  },
	  {
		"name": "parties",
		"ID": 49,
		"constraints": [
		  {
			"attribute": "seats",
			"value": "6",
			"dataType": "int",
			"matchType": "LET"
		  }
		]
	  }
	],
	"relations": [
	  {
		"ID": 42,
		"name": "member_of",
		"depth": { "min": 1, "max": 1 },
		"fromType": "entity",
		"fromID": 43,
		"toType": "entity",
		"toID": 44,
		"constraints": []
	  },
	  {
		"ID": 47,
		"name": "member_of",
		"depth": { "min": 1, "max": 1 },
		"fromType": "entity",
		"fromID": 48,
		"toType": "entity",
		"toID": 49,
		"constraints": []
	  }
	],
	"groupBys": [
	  {
		"ID": 31,
		"groupType": "entity",
		"groupID": [43, 48],
		"groupAttribute": "age",
		"byType": "entity",
		"byID": [49, 44],
		"byAttribute": "_id",
		"appliedModifier": "AVG",
		"relationID": 47,
		"constraints": [
		  {
			"attribute": "age",
			"value": "40",
			"dataType": "int",
			"matchType": "GET"
		  }
		]
	  }
	],
	"machineLearning": [],
	"limit": 5000
  }
`)
View Source
var MultipleInputGroupByEndpointResult = string(`LET tree_0 = (
	FOR e_43 IN parliament
	FILTER e_43.age < 42
	LET e44 = (
			FOR e_44 IN parties
			FOR r42 IN member_of
			FILTER e_44.seats > 6
			FILTER r42._from == e_43._id AND r42._to == e_44._id
			FILTER length(e_44) != 0 AND length(r42) != 0
			RETURN {"e44": union_distinct([e_44], []), "r42": union_distinct([r42], [])}
	)
	FILTER length(e44) != 0 AND length(e_43) != 0
	RETURN {"e43": union_distinct([e_43], []), "e44": union_distinct(flatten(e44[**].e44), []), "r42": union_distinct(flatten(e44[**].r42), [])}
)
LET tree_1 = (
	FOR e_48 IN parliament
	FILTER e_48.age >= 42
	LET e49 = (
			FOR e_49 IN parties
			FOR r47 IN member_of
			FILTER e_49.seats <= 6
			FILTER r47._from == e_48._id AND r47._to == e_49._id
			FILTER length(e_49) != 0 AND length(r47) != 0
			RETURN {"e49": union_distinct([e_49], []), "r47": union_distinct([r47], [])}
	)
	FILTER length(e49) != 0 AND length(e_48) != 0
	RETURN {"e48": union_distinct([e_48], []), "e49": union_distinct(flatten(e49[**].e49), []), "r47": union_distinct(flatten(e49[**].r47), [])}
)
LET gt31 = (
	FOR x IN member_of
	LET variable_0 = (
			LET tmp = union_distinct(flatten(tree_1[**].e49), flatten(tree_0[**].e44), [])
					FOR y IN tmp
					FILTER y._id == x._to
					RETURN y._id
	)
	LET variable_1 = variable_0[0]
	LET variable_2 = (
			LET tmp = union_distinct(flatten(tree_0[**].e43), flatten(tree_1[**].e48), [])
					FOR y IN tmp
					FILTER y._id == x._from
					RETURN y.age
	)
	LET variable_3 = variable_2[0]
	FILTER variable_1 != NULL AND variable_3 != NULL
	RETURN {
			"group": variable_1,
			"by": variable_3
	}
)
LET g31 = (
	FOR x IN gt31
	COLLECT c = x.group INTO groups = x.by
	LET variable_0 = AVG(groups)
	FILTER variable_0 >= 40
	RETURN {
	_id: c,
	modifier: variable_0
	}
)
FOR x in g31
RETURN {group: x.modifier, by: x._id}
`)
View Source
var MultipleInputGroupByResult = string(`LET tree_0 = (
	FOR e_43 IN parliament
	FILTER e_43.age < 42
	LET e44 = (
			FOR e_44 IN parties
			FOR r42 IN member_of
			FILTER e_44.seats > 6
			FILTER r42._from == e_43._id AND r42._to == e_44._id
			FILTER length(e_44) != 0 AND length(r42) != 0
			RETURN {"e44": union_distinct([e_44], []), "r42": union_distinct([r42], [])}
	)
	FILTER length(e44) != 0 AND length(e_43) != 0
	RETURN {"e44": union_distinct(flatten(e44[**].e44), []), "r42": union_distinct(flatten(e44[**].r42), []), "e43": union_distinct([e_43], [])}
)
LET tree_1 = (
	FOR e_48 IN parliament
	FILTER e_48.age >= 42
	LET e49 = (
			FOR e_49 IN parties
			FOR r47 IN member_of
			FILTER e_49.seats <= 6
			FILTER r47._from == e_48._id AND r47._to == e_49._id
			FILTER length(e_49) != 0 AND length(r47) != 0
			RETURN {"e49": union_distinct([e_49], []), "r47": union_distinct([r47], [])}
	)
	FILTER length(e49) != 0 AND length(e_48) != 0
	RETURN {"e48": union_distinct([e_48], []), "e49": union_distinct(flatten(e49[**].e49), []), "r47": union_distinct(flatten(e49[**].r47), [])}
)
LET gt31 = (
	FOR x IN member_of
	LET variable_0 = (
			LET tmp = union_distinct(flatten(tree_1[**].e49), flatten(tree_0[**].e44), [])
					FOR y IN tmp
					FILTER y._id == x._to
					RETURN y._id
	)
	LET variable_1 = variable_0[0]
	LET variable_2 = (
			LET tmp = union_distinct(flatten(tree_0[**].e43), flatten(tree_1[**].e48), [])
					FOR y IN tmp
					FILTER y._id == x._from
					RETURN y.age
	)
	LET variable_3 = variable_2[0]
	FILTER variable_1 != NULL AND variable_3 != NULL
	RETURN {
			"group": variable_1,
			"by": variable_3
	}
)
LET g31 = (
	FOR x IN gt31
	COLLECT c = x.group INTO groups = x.by
	LET variable_0 = AVG(groups)
	FILTER variable_0 >= 40
	RETURN {
	_id: c,
	modifier: variable_0
	}
)
LET in31 = (
	FOR x IN g31[**]._id
	FOR y IN parties
	FILTER x == y._id
	RETURN y
)
LET tree_2 = (
	FOR e_73 IN parliament
	LET gb31 = (
			FOR g_31 IN in31
			FOR r71 IN member_of
			FILTER r71._from == e_73._id AND r71._to == g_31._id
			FILTER length(g_31) != 0 AND length(r71) != 0
			RETURN {"gb31": union_distinct([g_31], []), "r71": union_distinct([r71], [])}
	)
	FILTER length(gb31) != 0 AND length(e_73) != 0
	RETURN {"e73": union_distinct([e_73], []), "gb31": union_distinct(flatten(gb31[**].gb31), []), "r71": union_distinct(flatten(gb31[**].r71), [])}
)
LET nodes = union_distinct(flatten(tree_2[**].e73), flatten(tree_2[**].gb31), [])
LET edges = union_distinct(flatten(tree_2[**].r71), [])
RETURN {"vertices":nodes,"edges":edges}
`)
View Source
var NestedGroupBys2 = []byte(`{
	"return": {
	  "entities": [
		9,
		10,
		25,
		52
	  ],
	  "relations": [
		8,
		24,
		51
	  ],
	  "groupBys": [
		6,
		40
	  ]
	},
	"entities": [
	  {
		"name": "parliament",
		"ID": 9,
		"constraints": []
	  },
	  {
		"name": "commissions",
		"ID": 10,
		"constraints": []
	  },
	  {
		"name": "parliament",
		"ID": 25,
		"constraints": []
	  },
	  {
		"name": "parliament",
		"ID": 52,
		"constraints": []
	  }
	],
	"relations": [
	  {
		"ID": 8,
		"name": "part_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 9,
		"toType": "entity",
		"toID": 10,
		"constraints": []
	  },
	  {
		"ID": 24,
		"name": "part_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 25,
		"toType": "groupBy",
		"toID": 6,
		"constraints": []
	  },
	  {
		"ID": 51,
		"name": "part_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 52,
		"toType": "groupBy",
		"toID": 40,
		"constraints": []
	  }
	],
	"groupBys": [
	  {
		"ID": 6,
		"groupType": "entity",
		"groupID": [
		  9
		],
		"groupAttribute": "age",
		"byType": "entity",
		"byID": [
		  10
		],
		"byAttribute": "_id",
		"appliedModifier": "AVG",
		"relationID": 8,
		"constraints": [
		  {
			"attribute": "age",
			"value": "41",
			"dataType": "int",
			"matchType": "LET"
		  }
		]
	  },
	  {
		"ID": 40,
		"groupType": "entity",
		"groupID": [
		  25
		],
		"groupAttribute": "age",
		"byType": "groupBy",
		"byID": [
		  6
		],
		"byAttribute": "_id",
		"appliedModifier": "MAX",
		"relationID": 24,
		"constraints": []
	  }
	],
	"machineLearning": [],
	"limit": 5000
  }`)
View Source
var NestedGroupBys2Result = string(`LET tree_0 = (
	FOR e_9 IN parliament
	LET e10 = (
			FOR e_10 IN commissions
			FOR r8 IN part_of
			FILTER r8._from == e_9._id AND r8._to == e_10._id
			FILTER length(e_10) != 0 AND length(r8) != 0
			RETURN {"e10": union_distinct([e_10], []), "r8": union_distinct([r8], [])}
	)
	FILTER length(e10) != 0 AND length(e_9) != 0
	RETURN {"r8": union_distinct(flatten(e10[**].r8), []), "e9": union_distinct([e_9], []), "e10": union_distinct(flatten(e10[**].e10), [])}
)
LET gt6 = (
	FOR x IN part_of
	LET variable_0 = (
			LET tmp = union_distinct(flatten(tree_0[**].e10), [])
					FOR y IN tmp
					FILTER y._id == x._to
					RETURN y._id
	)
	LET variable_1 = variable_0[0]
	LET variable_2 = (
			LET tmp = union_distinct(flatten(tree_0[**].e9), [])
					FOR y IN tmp
					FILTER y._id == x._from
					RETURN y.age
	)
	LET variable_3 = variable_2[0]
	FILTER variable_1 != NULL AND variable_3 != NULL
	RETURN {
			"group": variable_1,
			"by": variable_3
	}
)
LET g6 = (
	FOR x IN gt6
	COLLECT c = x.group INTO groups = x.by
	LET variable_0 = AVG(groups)
	FILTER variable_0 <= 41
	RETURN {
	_id: c,
	modifier: variable_0
	}
)
LET in6 = (
	FOR x IN g6[**]._id
	FOR y IN commissions
	FILTER x == y._id
	RETURN y
)
LET tree_1 = (
	FOR e_25 IN parliament
	LET gb6 = (
			FOR g_6 IN in6
			FOR r24 IN part_of
			FILTER r24._from == e_25._id AND r24._to == g_6._id
			FILTER length(g_6) != 0 AND length(r24) != 0
			RETURN {"gb6": union_distinct([g_6], []), "r24": union_distinct([r24], [])}
	)
	FILTER length(gb6) != 0 AND length(e_25) != 0
	RETURN {"e25": union_distinct([e_25], []), "gb6": union_distinct(flatten(gb6[**].gb6), []), "r24": union_distinct(flatten(gb6[**].r24), [])}
)
LET gt40 = (
	FOR x IN part_of
	LET variable_0 = (
			LET tmp = union_distinct(flatten(tree_1[**].gb6), [])
					FOR y IN tmp
					FILTER y._id == x._to
					RETURN y._id
	)
	LET variable_1 = variable_0[0]
	LET variable_2 = (
			LET tmp = union_distinct(flatten(tree_1[**].e25), [])
					FOR y IN tmp
					FILTER y._id == x._from
					RETURN y.age
	)
	LET variable_3 = variable_2[0]
	FILTER variable_1 != NULL AND variable_3 != NULL
	RETURN {
			"group": variable_1,
			"by": variable_3
	}
)
LET g40 = (
	FOR x IN gt40
	COLLECT c = x.group INTO groups = x.by
	LET variable_0 = MAX(groups)
	RETURN {
	_id: c,
	modifier: variable_0
	}
)
LET in40 = (
	FOR x IN g40[**]._id
	FOR y IN commissions
	FILTER x == y._id
	RETURN y
)
LET tree_2 = (
	FOR e_52 IN parliament
	LET gb40 = (
			FOR g_40 IN in40
			FOR r51 IN part_of
			FILTER r51._from == e_52._id AND r51._to == g_40._id
			FILTER length(g_40) != 0 AND length(r51) != 0
			RETURN {"gb40": union_distinct([g_40], []), "r51": union_distinct([r51], [])}
	)
	FILTER length(gb40) != 0 AND length(e_52) != 0
	RETURN {"e52": union_distinct([e_52], []), "gb40": union_distinct(flatten(gb40[**].gb40), []), "r51": union_distinct(flatten(gb40[**].r51), [])}
)
LET nodes = union_distinct(flatten(tree_2[**].e52), flatten(tree_2[**].gb40), [])
LET edges = union_distinct(flatten(tree_2[**].r51), [])
RETURN {"vertices":nodes,"edges":edges}`)
View Source
var NoRelationsField = []byte(`{
	"databaseName": "TweedeKamer",
	"return": {
		"entities": [
			0,
			1
		]
	},
	"entities": [
		{
			"name": "parliament",
			"ID": 0,
			"constraints": []
		},
		{
			"name": "parties",
			"ID": 1,
			"constraints": []
		}
	],		
	"groupBys": [],		
	"limit": 5000,
	"modifiers": []
}`)
View Source
var SeparatedChainDoubleRelationPerChain = []byte(`{
	"databaseName": "TweedeKamer",
	"return": {
		"entities": [
			0,
			1,
			2,
			3,
			4,
			5
		],
		"relations": [
			0
		]
	},
	"entities": [
		{
			"name": "parliament",
			"ID": 0,
			"constraints": []
		},
		{
			"name": "parties",
			"ID": 1,
			"constraints": []
		},
		{
			"name": "parliament",
			"ID": 2,
			"constraints": []
		},
		{
			"name": "parties",
			"ID": 3,
			"constraints": []
		},
		{
			"name": "resolutions",
			"ID": 4,
			"constraints": []
		},
		{
			"name": "resolutions",
			"ID": 5,
			"constraints": []
		}
	],
	"relations": [
		{
			"ID": 0,
			"name": "member_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 0,
			"toType": "entity",
			"toID": 1,
			"constraints":[]
		},
		{
			"ID": 1,
			"name": "member_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 2,
			"toType": "entity",
			"toID": 3,
			"constraints":[]
		},
		{
			"ID": 2,
			"name": "submits",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 0,
			"toType": "entity",
			"toID": 4,
			"constraints":[]
		},
		{
			"ID": 3,
			"name": "submits",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 2,
			"toType": "entity",
			"toID": 5,
			"constraints":[]
		}
	],
	"groupBys": [],		
	"limit": 5000,
	"modifiers": []
}`)
View Source
var SeparatedChainSingleRelationPerChain = []byte(`{
	"databaseName": "TweedeKamer",
	"return": {
		"entities": [
			0,
			1,
			2,
			3
		],
		"relations": [
			0
		]
	},
	"entities": [
		{
			"name": "parliament",
			"ID": 0,
			"constraints": []
		},
		{
			"name": "parties",
			"ID": 1,
			"constraints": []
		},
		{
			"name": "parliament",
			"ID": 2,
			"constraints": []
		},
		{
			"name": "parties",
			"ID": 3,
			"constraints": []
		}
	],
	"relations": [
		{
			"ID": 0,
			"name": "member_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 0,
			"toType": "entity",
			"toID": 1,
			"constraints":[]
		},
		{
			"ID": 1,
			"name": "member_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 2,
			"toType": "entity",
			"toID": 3,
			"constraints":[]
		}
	],
	"groupBys": [],		
	"limit": 5000,
	"modifiers": []
}`)
View Source
var SeperatedChainWithGroupBys = []byte(`{
	"return": {
	  "entities": [
		2,
		3,
		14,
		28,
		37,
		38,
		47
	  ],
	  "relations": [
		1,
		13,
		26,
		36,
		46
	  ],
	  "groupBys": [
		12,
		35
	  ]
	},
	"entities": [
	  {
		"name": "parliament",
		"ID": 2,
		"constraints": []
	  },
	  {
		"name": "parties",
		"ID": 3,
		"constraints": []
	  },
	  {
		"name": "parliament",
		"ID": 14,
		"constraints": []
	  },
	  {
		"name": "commissions",
		"ID": 28,
		"constraints": [
		  {
			"attribute": "name",
			"value": "f",
			"dataType": "string",
			"matchType": "contains"
		  }
		]
	  },
	  {
		"name": "parliament",
		"ID": 37,
		"constraints": []
	  },
	  {
		"name": "resolutions",
		"ID": 38,
		"constraints": []
	  },
	  {
		"name": "parliament",
		"ID": 47,
		"constraints": []
	  }
	],
	"relations": [
	  {
		"ID": 1,
		"name": "member_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 2,
		"toType": "entity",
		"toID": 3,
		"constraints": []
	  },
	  {
		"ID": 13,
		"name": "member_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 14,
		"toType": "groupBy",
		"toID": 12,
		"constraints": []
	  },
	  {
		"ID": 26,
		"name": "part_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 14,
		"toType": "entity",
		"toID": 28,
		"constraints": []
	  },
	  {
		"ID": 36,
		"name": "submits",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 37,
		"toType": "entity",
		"toID": 38,
		"constraints": []
	  },
	  {
		"ID": 46,
		"name": "submits",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 47,
		"toType": "groupBy",
		"toID": 35,
		"constraints": []
	  }
	],
	"groupBys": [
	  {
		"ID": 12,
		"groupType": "entity",
		"groupID": [
		  2
		],
		"groupAttribute": "age",
		"byType": "entity",
		"byID": [
		  3
		],
		"byAttribute": "_id",
		"appliedModifier": "AVG",
		"relationID": 1,
		"constraints": [
		  {
			"attribute": "age",
			"value": "42",
			"dataType": "int",
			"matchType": "GET"
		  }
		]
	  },
	  {
		"ID": 35,
		"groupType": "entity",
		"groupID": [
		  37
		],
		"groupAttribute": "age",
		"byType": "entity",
		"byID": [
		  38
		],
		"byAttribute": "_id",
		"appliedModifier": "AVG",
		"relationID": 36,
		"constraints": [
		  {
			"attribute": "age",
			"value": "45",
			"dataType": "int",
			"matchType": "GET"
		  }
		]
	  }
	],
	"machineLearning": [],
	"limit": 5000
  }`)
View Source
var SingleEndPointGroupBy = []byte(`{
	"return": {
		"entities": [
			2,
			3
		],
		"relations": [
			1
		],
		"groupBys": [
			6
		]
	},
	"entities": [
		{
			"name": "parliament",
			"ID": 2,
			"constraints": []
		},
		{
			"name": "commissions",
			"ID": 3,
			"constraints": []
		}
	],
	"relations": [
		{
			"ID": 1,
			"name": "part_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 2,
			"toType": "entity",
			"toID": 3,
			"constraints": []
		}
	],
	"groupBys": [
		{
			"ID": 6,
			"groupType": "entity",
			"groupID": [
				2
			],
			"groupAttribute": "age",
			"byType": "entity",
			"byID": [
				3
			],
			"byAttribute": "name",
			"appliedModifier": "AVG",
			"relationID": 1,
			"constraints": [
				{
					"attribute": "age",
					"value": "45",
					"dataType": "int",
					"matchType": "GT"
				}
			]
		}
	],
	"machineLearning": [],
	"limit": 5000
}`)
View Source
var SingleEndPointGroupByResult = string(`LET tree_0 = (
	FOR e_2 IN parliament
	LET e3 = (
			FOR e_3 IN commissions
			FOR r1 IN part_of
			FILTER r1._from == e_2._id AND r1._to == e_3._id
			FILTER length(e_3) != 0 AND length(r1) != 0
			RETURN {"e3": union_distinct([e_3], []), "r1": union_distinct([r1], [])}
	)
	FILTER length(e3) != 0 AND length(e_2) != 0
	RETURN {"e2": union_distinct([e_2], []), "e3": union_distinct(flatten(e3[**].e3), []), "r1": union_distinct(flatten(e3[**].r1), [])}
)
LET gt6 = (
	FOR x IN part_of
	LET variable_0 = (
			LET tmp = union_distinct(flatten(tree_0[**].e3), [])
					FOR y IN tmp
					FILTER y._id == x._to
					RETURN y.name
	)
	LET variable_1 = variable_0[0]
	LET variable_2 = (
			LET tmp = union_distinct(flatten(tree_0[**].e2), [])
					FOR y IN tmp
					FILTER y._id == x._from
					RETURN y.age
	)
	LET variable_3 = variable_2[0]
	FILTER variable_1 != NULL AND variable_3 != NULL
	RETURN {
			"group": variable_1,
			"by": variable_3
	}
)
LET g6 = (
	FOR x IN gt6
	COLLECT c = x.group INTO groups = x.by
	LET variable_0 = AVG(groups)
	FILTER variable_0 > 45
	RETURN {
	_id: c,
	modifier: variable_0
	}
)
FOR x in g6
RETURN {group: x.modifier, by: x._id}
`)
View Source
var SingleGroupBy = []byte(`{
	"return": {
		"entities": [
			2,
			3,
			4
		],
		"relations": [
			1,
			2
		],
		"groupBys": [
			6
		]
	},
	"entities": [
		{
			"name": "parliament",
			"ID": 2,
			"constraints": []
		},
		{
			"name": "commissions",
			"ID": 3,
			"constraints": []
		},
		{
			"name": "parliament",
			"ID": 4,
			"constraints": []
		}
	],
	"relations": [
		{
			"ID": 1,
			"name": "part_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 2,
			"toType": "entity",
			"toID": 3,
			"constraints": []
		},
		{
			"ID": 2,
			"name": "part_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 4,
			"toType": "groupBy",
			"toID": 6,
			"constraints": []
		}
	],
	"groupBys": [
		{
			"ID": 6,
			"groupType": "entity",
			"groupID": [
				2
			],
			"groupAttribute": "age",
			"byType": "entity",
			"byID": [
				3
			],
			"byAttribute": "name",
			"appliedModifier": "avg",
			"relationID": 1,
			"constraints": [
				{
					"attribute": "age",
					"value": "45",
					"dataType": "int",
					"matchType": "GT"
				}
			]
		}
	],
	"machineLearning": [],
	"limit": 5000
}
`)
View Source
var SingleGroupByResult = string(`LET tree_0 = (
	FOR e_2 IN parliament
	LET e3 = (
			FOR e_3 IN commissions
			FOR r1 IN part_of
			FILTER r1._from == e_2._id AND r1._to == e_3._id
			FILTER length(e_3) != 0 AND length(r1) != 0
			RETURN {"e3": union_distinct([e_3], []), "r1": union_distinct([r1], [])}
	)
	FILTER length(e3) != 0 AND length(e_2) != 0
	RETURN {"e2": union_distinct([e_2], []), "e3": union_distinct(flatten(e3[**].e3), []), "r1": union_distinct(flatten(e3[**].r1), [])}
)
LET gt6 = (
	FOR x IN part_of
	LET variable_0 = (
			LET tmp = union_distinct(flatten(tree_0[**].e3), [])
					FOR y IN tmp
					FILTER y._id == x._to
					RETURN y.name
	)
	LET variable_1 = variable_0[0]
	LET variable_2 = (
			LET tmp = union_distinct(flatten(tree_0[**].e2), [])
					FOR y IN tmp
					FILTER y._id == x._from
					RETURN y.age
	)
	LET variable_3 = variable_2[0]
	FILTER variable_1 != NULL AND variable_3 != NULL
	RETURN {
			"group": variable_1,
			"by": variable_3
	}
)
LET g6 = (
	FOR x IN gt6
	COLLECT c = x.group INTO groups = x.by
	LET variable_0 = avg(groups)
	FILTER variable_0 > 45
	RETURN {
	_id: c,
	modifier: variable_0
	}
)
LET in6 = (
	FOR x IN g6[**]._id
	FOR y IN commissions
	FILTER x == y.name
	RETURN y
)
LET tree_1 = (
	FOR e_4 IN parliament
	LET gb6 = (
			FOR g_6 IN in6
			FOR r2 IN part_of
			FILTER r2._from == e_4._id AND r2._to == g_6._id
			FILTER length(g_6) != 0 AND length(r2) != 0
			RETURN {"gb6": union_distinct([g_6], []), "r2": union_distinct([r2], [])}
	)
	FILTER length(gb6) != 0 AND length(e_4) != 0
	RETURN {"r2": union_distinct(flatten(gb6[**].r2), []), "e4": union_distinct([e_4], []), "gb6": union_distinct(flatten(gb6[**].gb6), [])}
)
LET nodes = union_distinct(flatten(tree_1[**].e4), flatten(tree_1[**].gb6), [])
LET edges = union_distinct(flatten(tree_1[**].r2), [])
RETURN {"vertices":nodes,"edges":edges}
`)
View Source
var SingleJunctionFiveEntitiesThreeEntityFilters = []byte(`{
	"return": {
		"entities": [
			0,
			1,
			2,
			3,
			4
		],
		"relations": [
			0,
			1,
			2,
			3
		]
	},
	"entities": [
		{
			"name": "parliament",
			"ID": 0,
			"constraints": [
				{
					"attribute": "name",
					"value": "Geert",
					"dataType": "string",
					"matchType": "contains"
				}
			]
		},
		{
			"name": "commissions",
			"ID": 1,
			"constraints": []
		},
		{
			"name": "parliament",
			"ID": 2,
			"constraints": []
		},
		{
			"name": "parties",
			"ID": 3,
			"constraints": [
				{
					"attribute": "seats",
					"value": "10",
					"dataType": "int",
					"matchType": "LT"
				}
			]
		},
		{
			"name": "resolutions",
			"ID": 4,
			"constraints": [
				{
					"attribute": "date",
					"value": "mei",
					"dataType": "string",
					"matchType": "contains"
				}
			]
		}
		
	],
	"groupBys": [],
	"relations": [
		{
			"ID": 0,
			"name": "part_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromId": 0,
			"toType": "entity",
			"toID": 1,
			"constraints": []
		},
		{
			"ID": 1,
			"name": "part_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromId": 2,
			"toType": "entity",
			"toID": 1,
			"constraints": []
		},
		{
			"ID": 2,
			"name": "member_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromId": 2,
			"toType": "entity",
			"toID": 3,
			"constraints": []
		},
		{
			"ID": 3,
			"name": "submits",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromId": 2,
			"toType": "entity",
			"toID": 4,
			"constraints": []
		}
	],
	"limit": 5000
}`)
View Source
var SingleJunctionFiveEntitiesThreeEntityFiltersResult = string(`LET tree_0 = (
	FOR e_0 IN parliament
	FILTER e_0.name LIKE "%Geert%"
	LET e1 = (
			FOR e_1 IN commissions
			FOR r0 IN part_of
			FILTER r0._from == e_0._id AND r0._to == e_1._id
			LET e2 = (
					FOR e_2 IN parliament
					FOR r1 IN part_of
					FILTER r1._from == e_2._id AND r1._to == e_1._id
					LET e3 = (
							FOR e_3 IN parties
							FOR r2 IN member_of
							FILTER e_3.seats < 10
							FILTER r2._from == e_2._id AND r2._to == e_3._id
							FILTER length(e_3) != 0 AND length(r2) != 0
							RETURN {"e3": union_distinct([e_3], []), "r2": union_distinct([r2], [])}
					)
					LET e4 = (
							FOR e_4 IN resolutions
							FOR r3 IN submits
							FILTER e_4.date LIKE "%mei%"
							FILTER r3._from == e_2._id AND r3._to == e_4._id
							FILTER length(e_4) != 0 AND length(r3) != 0
							RETURN {"e4": union_distinct([e_4], []), "r3": union_distinct([r3], [])}
					)
					FILTER length(e3) != 0 AND length(e4) != 0 AND length(e_2) != 0 AND length(r1) != 0
					RETURN {"e2": union_distinct([e_2], []), "r1": union_distinct([r1], []), "e3": union_distinct(flatten(e3[**].e3), []), "r2": union_distinct(flatten(e3[**].r2), []), "e4": union_distinct(flatten(e4[**].e4), []), "r3": union_distinct(flatten(e4[**].r3), [])}
			)
			FILTER length(e2) != 0 AND length(e_1) != 0 AND length(r0) != 0
			RETURN {"e1": union_distinct([e_1], []), "r0": union_distinct([r0], []), "e2": union_distinct(flatten(e2[**].e2), []), "e3": union_distinct(flatten(e2[**].e3), []), "e4": union_distinct(flatten(e2[**].e4), []), "r1": union_distinct(flatten(e2[**].r1), []), "r2": union_distinct(flatten(e2[**].r2), []), "r3": union_distinct(flatten(e2[**].r3), [])}
	)
	FILTER length(e1) != 0 AND length(e_0) != 0
	RETURN {"e0": union_distinct([e_0], []), "e1": union_distinct(flatten(e1[**].e1), []), "e2": union_distinct(flatten(e1[**].e2), []), "e3": union_distinct(flatten(e1[**].e3), []), "e4": union_distinct(flatten(e1[**].e4), []), "r0": union_distinct(flatten(e1[**].r0), []), "r1": union_distinct(flatten(e1[**].r1), []), "r2": union_distinct(flatten(e1[**].r2), []), "r3": union_distinct(flatten(e1[**].r3), [])}
)
LET nodes = union_distinct(flatten(tree_0[**].e0), flatten(tree_0[**].e1), flatten(tree_0[**].e2), flatten(tree_0[**].e3), flatten(tree_0[**].e4), [])
LET edges = union_distinct(flatten(tree_0[**].r0), flatten(tree_0[**].r1), flatten(tree_0[**].r2), flatten(tree_0[**].r3), [])
RETURN {"vertices":nodes,"edges":edges}
`)
View Source
var StringMatchTypes = []byte(`{
	"return": {
	  "entities": [
		2,
		3,
		8
	  ],
	  "relations": [
		1,
		6
	  ],
	  "groupBys": []
	},
	"entities": [
	  {
		"name": "parliament",
		"ID": 2,
		"constraints": [
		  {
			"attribute": "name",
			"value": "Geert Wilders",
			"dataType": "string",
			"matchType": "NEQ"
		  }
		]
	  },
	  {
		"name": "parties",
		"ID": 3,
		"constraints": [
		  {
			"attribute": "name",
			"value": "v",
			"dataType": "string",
			"matchType": "excludes"
		  }
		]
	  },
	  {
		"name": "commissions",
		"ID": 8,
		"constraints": [
		  {
			"attribute": "name",
			"value": "groep",
			"dataType": "string",
			"matchType": "excludes"
		  }
		]
	  }
	],
	"relations": [
	  {
		"ID": 1,
		"name": "member_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 2,
		"toType": "entity",
		"toID": 3,
		"constraints": []
	  },
	  {
		"ID": 6,
		"name": "part_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 2,
		"toType": "entity",
		"toID": 8,
		"constraints": []
	  }
	],
	"groupBys": [],
	"machineLearning": [],
	"limit": 5000
  }`)
View Source
var StringMatchTypesResult = string(`LET tree_0 = (
	FOR e_3 IN parties
	FILTER e_3.name NOT LIKE "v"
	LET e2 = (
			FOR e_2 IN parliament
			FOR r1 IN member_of
			FILTER e_2.name != "Geert Wilders"
			FILTER r1._from == e_2._id AND r1._to == e_3._id
			LET e8 = (
					FOR e_8 IN commissions
					FOR r6 IN part_of
					FILTER e_8.name NOT LIKE "groep"
					FILTER r6._from == e_2._id AND r6._to == e_8._id
					FILTER length(e_8) != 0 AND length(r6) != 0
					RETURN {"e8": union_distinct([e_8], []), "r6": union_distinct([r6], [])}
			)
			FILTER length(e8) != 0 AND length(e_2) != 0 AND length(r1) != 0
			RETURN {"r1": union_distinct([r1], []), "e8": union_distinct(flatten(e8[**].e8), []), "r6": union_distinct(flatten(e8[**].r6), []), "e2": union_distinct([e_2], [])}
	)
	FILTER length(e2) != 0 AND length(e_3) != 0
	RETURN {"r6": union_distinct(flatten(e2[**].r6), []), "e3": union_distinct([e_3], []), "e2": union_distinct(flatten(e2[**].e2), []), "r1": union_distinct(flatten(e2[**].r1), []), "e8": union_distinct(flatten(e2[**].e8), [])}
)
LET nodes = union_distinct(flatten(tree_0[**].e3), flatten(tree_0[**].e2), flatten(tree_0[**].e8), [])
LET edges = union_distinct(flatten(tree_0[**].r6), flatten(tree_0[**].r1), [])
RETURN {"vertices":nodes,"edges":edges}`)
View Source
var ThreeEntitiesNoFilter = []byte(`{
	"databaseName": "TweedeKamer",
	"return": {
		"entities": [
			0,
			1,
			2
		],
		"relations": [
			0,
			1
		]
	},
	"entities": [
		{
			"name": "parliament",
			"ID": 0,
			"constraints": []
		},
		{
			"name": "parties",
			"ID": 1,
			"constraints": []
		},
		{
			"name": "resolutions",
			"ID": 2,
			"constraints": []
		}
	],
	"relations": [
		{
			"ID": 0,
			"name": "member_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 0,
			"toType": "entity",
			"toID": 1,
			"constraints":[]
		},
		{
			"ID": 1,
			"name": "submits",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 0,
			"toType": "entity",
			"toID": 2,
			"constraints":[]
		}
	],
	"groupBys": [],		
	"limit": 5000,
	"modifiers": []
}`)
View Source
var ThreeEntitiesNoFilterResult = string(`LET tree_0 = (
	FOR e_1 IN parties
	LET e0 = (
			FOR e_0 IN parliament
			FOR r0 IN member_of
			FILTER r0._from == e_0._id AND r0._to == e_1._id
			LET e2 = (
					FOR e_2 IN resolutions
					FOR r1 IN submits
					FILTER r1._from == e_0._id AND r1._to == e_2._id
					FILTER length(e_2) != 0 AND length(r1) != 0
					RETURN {"e2": union_distinct([e_2], []), "r1": union_distinct([r1], [])}
			)
			FILTER length(e2) != 0 AND length(e_0) != 0 AND length(r0) != 0
			RETURN {"e0": union_distinct([e_0], []), "r0": union_distinct([r0], []), "e2": union_distinct(flatten(e2[**].e2), []), "r1": union_distinct(flatten(e2[**].r1), [])}
	)
	FILTER length(e0) != 0 AND length(e_1) != 0
	RETURN {"r0": union_distinct(flatten(e0[**].r0), []), "e2": union_distinct(flatten(e0[**].e2), []), "r1": union_distinct(flatten(e0[**].r1), []), "e1": union_distinct([e_1], []), "e0": union_distinct(flatten(e0[**].e0), [])}
)
LET nodes = union_distinct(flatten(tree_0[**].e1), flatten(tree_0[**].e0), flatten(tree_0[**].e2), [])
LET edges = union_distinct(flatten(tree_0[**].r0), flatten(tree_0[**].r1), [])
RETURN {"vertices":nodes,"edges":edges}`)
View Source
var ThreeEntitiesOneEntityFilter = []byte(`{
	"databaseName": "TweedeKamer",
	"return": {
		"entities": [
			0,
			1,
			2
		],
		"relations": [
			0,
			1
		]
	},
	"entities": [
		{
			"name": "parliament",
			"ID": 0,				
			"constraints": [
				{
					"attribute": "name",
					"value": "Geert",
					"dataType": "string",
					"matchType": "contains"
				}
			]
		},
		{
			"name": "parties",
			"ID": 1,
			"constraints": []
		},
		{
			"name": "resolutions",
			"ID": 2,
			"constraints": []
		}
	],
	"relations": [
		{
			"ID": 0,
			"name": "member_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 0,
			"toType": "entity",
			"toID": 1,
			"constraints":[]
		},
		{
			"ID": 1,
			"name": "submits",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 0,
			"toType": "entity",
			"toID": 2,
			"constraints":[]
		}
	],
	"groupBys": [],		
	"limit": 5000,
	"modifiers": []
}`)
View Source
var ThreeEntitiesOneEntityFilterResult = string(`LET tree_0 = (
	FOR e_1 IN parties
	LET e0 = (
			FOR e_0 IN parliament
			FOR r0 IN member_of
			FILTER e_0.name LIKE "%Geert%"
			FILTER r0._from == e_0._id AND r0._to == e_1._id
			LET e2 = (
					FOR e_2 IN resolutions
					FOR r1 IN submits
					FILTER r1._from == e_0._id AND r1._to == e_2._id
					FILTER length(e_2) != 0 AND length(r1) != 0
					RETURN {"e2": union_distinct([e_2], []), "r1": union_distinct([r1], [])}
			)
			FILTER length(e2) != 0 AND length(e_0) != 0 AND length(r0) != 0
			RETURN {"e2": union_distinct(flatten(e2[**].e2), []), "r1": union_distinct(flatten(e2[**].r1), []), "e0": union_distinct([e_0], []), "r0": union_distinct([r0], [])}
	)
	FILTER length(e0) != 0 AND length(e_1) != 0
	RETURN {"e1": union_distinct([e_1], []), "e0": union_distinct(flatten(e0[**].e0), []), "e2": union_distinct(flatten(e0[**].e2), []), "r0": union_distinct(flatten(e0[**].r0), []), "r1": union_distinct(flatten(e0[**].r1), [])}
)
LET nodes = union_distinct(flatten(tree_0[**].e1), flatten(tree_0[**].e0), flatten(tree_0[**].e2), [])
LET edges = union_distinct(flatten(tree_0[**].r0), flatten(tree_0[**].r1), [])
RETURN {"vertices":nodes,"edges":edges}`)
View Source
var ThreeEntitiesTwoEntityFilters = []byte(`{
	"databaseName": "TweedeKamer",
	"return": {
		"entities": [
			0,
			1,
			2
		],
		"relations": [
			0,
			1
		]
	},
	"entities": [
		{
			"name": "parliament",
			"ID": 0,				
			"constraints": [
				{
					"attribute": "name",
					"value": "Geert",
					"dataType": "string",
					"matchType": "contains"
				}
			]
		},
		{
			"name": "parties",
			"ID": 1,
			"constraints": []
		},
		{
			"name": "resolutions",
			"ID": 2,
			"constraints": [
				{
					"attribute": "date",
					"value": "mei",
					"dataType": "string",
					"matchType": "contains"
				}
			]
		}
	],
	"relations": [
		{
			"ID": 0,
			"name": "member_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 0,
			"toType": "entity",
			"toID": 1,
			"constraints":[]
		},
		{
			"ID": 1,
			"name": "submits",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 0,
			"toType": "entity",
			"toID": 2,
			"constraints":[]
		}
	],
	"groupBys": [],		
	"limit": 5000,
	"modifiers": []
}`)
View Source
var ThreeEntitiesTwoEntityFiltersResult = string(`LET tree_0 = (
	FOR e_1 IN parties
	LET e0 = (
			FOR e_0 IN parliament
			FOR r0 IN member_of
			FILTER e_0.name LIKE "%Geert%"
			FILTER r0._from == e_0._id AND r0._to == e_1._id
			LET e2 = (
					FOR e_2 IN resolutions
					FOR r1 IN submits
					FILTER e_2.date LIKE "%mei%"
					FILTER r1._from == e_0._id AND r1._to == e_2._id
					FILTER length(e_2) != 0 AND length(r1) != 0
					RETURN {"e2": union_distinct([e_2], []), "r1": union_distinct([r1], [])}
			)
			FILTER length(e2) != 0 AND length(e_0) != 0 AND length(r0) != 0
			RETURN {"e0": union_distinct([e_0], []), "r0": union_distinct([r0], []), "e2": union_distinct(flatten(e2[**].e2), []), "r1": union_distinct(flatten(e2[**].r1), [])}
	)
	FILTER length(e0) != 0 AND length(e_1) != 0
	RETURN {"e1": union_distinct([e_1], []), "e0": union_distinct(flatten(e0[**].e0), []), "e2": union_distinct(flatten(e0[**].e2), []), "r0": union_distinct(flatten(e0[**].r0), []), "r1": union_distinct(flatten(e0[**].r1), [])}
)
LET nodes = union_distinct(flatten(tree_0[**].e1), flatten(tree_0[**].e0), flatten(tree_0[**].e2), [])
LET edges = union_distinct(flatten(tree_0[**].r0), flatten(tree_0[**].r1), [])
RETURN {"vertices":nodes,"edges":edges}`)
View Source
var TopEntityToFromGroupBy = []byte(`{
	"return": {
	  "entities": [
		26,
		27,
		36
	  ],
	  "relations": [
		25,
		34
	  ],
	  "groupBys": [
		30
	  ]
	},
	"entities": [
	  {
		"name": "Streamer",
		"ID": 26,
		"constraints": []
	  },
	  {
		"name": "Streamer",
		"ID": 27,
		"constraints": []
	  },
	  {
		"name": "Streamer",
		"ID": 36,
		"constraints": []
	  }
	],
	"relations": [
	  {
		"ID": 25,
		"name": "viewerOverlap",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 26,
		"toType": "entity",
		"toID": 27,
		"constraints": []
	  },
	  {
		"ID": 34,
		"name": "viewerOverlap",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "groupBy",
		"fromID": 30,
		"toType": "entity",
		"toID": 36,
		"constraints": []
	  }
	],
	"groupBys": [
	  {
		"ID": 30,
		"groupType": "entity",
		"groupID": [
		  27
		],
		"groupAttribute": "Count",
		"byType": "entity",
		"byID": [
		  26
		],
		"byAttribute": "_id",
		"appliedModifier": "avg",
		"relationID": 25,
		"constraints": []
	  }
	],
	"machineLearning": [],
	"limit": 5000
  }`)
View Source
var TopEntityToFromGroupByResult = string(`LET tree_0 = (
	FOR e_26 IN Streamer
	LET e27 = (
			FOR e_27 IN Streamer
			FOR r25 IN viewerOverlap
			FILTER r25._from == e_26._id AND r25._to == e_27._id
			FILTER length(e_27) != 0 AND length(r25) != 0
			RETURN {"e27": union_distinct([e_27], []), "r25": union_distinct([r25], [])}
	)
	FILTER length(e27) != 0 AND length(e_26) != 0
	RETURN {"e26": union_distinct([e_26], []), "e27": union_distinct(flatten(e27[**].e27), []), "r25": union_distinct(flatten(e27[**].r25), [])}
)
LET gt30 = (
	FOR x IN viewerOverlap
	LET variable_0 = (
			LET tmp = union_distinct(flatten(tree_0[**].e26), [])
					FOR y IN tmp
					FILTER y._id == x._to
					RETURN y._id
	)
	LET variable_1 = variable_0[0]
	LET variable_2 = (
			LET tmp = union_distinct(flatten(tree_0[**].e27), [])
					FOR y IN tmp
					FILTER y._id == x._from
					RETURN y.Count
	)
	LET variable_3 = variable_2[0]
	FILTER variable_1 != NULL AND variable_3 != NULL
	RETURN {
			"group": variable_1,
			"by": variable_3
	}
)
LET g30 = (
	FOR x IN gt30
	COLLECT c = x.group INTO groups = x.by
	LET variable_0 = avg(groups)
	RETURN {
	_id: c,
	modifier: variable_0
	}
)
LET in30 = (
	FOR x IN g30[**]._id
	FOR y IN Streamer
	FILTER x == y._id
	RETURN y
)
LET tree_1 = (
	FOR e_36 IN Streamer
	LET gb30 = (
			FOR g_30 IN in30
			FOR r34 IN viewerOverlap
			FILTER r34._from == g_30._id AND r34._to == e_36._id
			FILTER length(g_30) != 0 AND length(r34) != 0
			RETURN {"gb30": union_distinct([g_30], []), "r34": union_distinct([r34], [])}
	)
	FILTER length(gb30) != 0 AND length(e_36) != 0
	RETURN {"r34": union_distinct(flatten(gb30[**].r34), []), "e36": union_distinct([e_36], []), "gb30": union_distinct(flatten(gb30[**].gb30), [])}
)
LET nodes = union_distinct(flatten(tree_1[**].e36), flatten(tree_1[**].gb30), [])
LET edges = union_distinct(flatten(tree_1[**].r34), [])
RETURN {"vertices":nodes,"edges":edges}`)
View Source
var TopGroupBy = []byte(`{
	"return": {
	  "entities": [
		9,
		10,
		68,
		69
	  ],
	  "relations": [
		8,
		67,
		76
	  ],
	  "groupBys": [
		13,
		72
	  ]
	},
	"entities": [
	  {
		"name": "parliament",
		"ID": 9,
		"constraints": []
	  },
	  {
		"name": "parties",
		"ID": 10,
		"constraints": []
	  },
	  {
		"name": "parliament",
		"ID": 68,
		"constraints": []
	  },
	  {
		"name": "parties",
		"ID": 69,
		"constraints": []
	  }
	],
	"relations": [
	  {
		"ID": 8,
		"name": "member_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 9,
		"toType": "entity",
		"toID": 10,
		"constraints": []
	  },
	  {
		"ID": 67,
		"name": "member_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 68,
		"toType": "entity",
		"toID": 69,
		"constraints": []
	  },
	  {
		"ID": 76,
		"name": "member_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "groupBy",
		"fromID": 72,
		"toType": "groupBy",
		"toID": 13,
		"constraints": []
	  }
	],
	"groupBys": [
	  {
		"ID": 13,
		"groupType": "entity",
		"groupID": [
		  9
		],
		"groupAttribute": "age",
		"byType": "entity",
		"byID": [
		  10
		],
		"byAttribute": "_id",
		"appliedModifier": "AVG",
		"relationID": 8,
		"constraints": [
		  {
			"attribute": "age",
			"value": "42",
			"dataType": "int",
			"matchType": "GET"
		  }
		]
	  },
	  {
		"ID": 72,
		"groupType": "entity",
		"groupID": [
		  69
		],
		"groupAttribute": "seats",
		"byType": "entity",
		"byID": [
		  68
		],
		"byAttribute": "_id",
		"appliedModifier": "AVG",
		"relationID": 67,
		"constraints": [
		  {
			"attribute": "seats",
			"value": "13",
			"dataType": "int",
			"matchType": "LT"
		  }
		]
	  }
	],
	"machineLearning": [],
	"limit": 5000
  }
`)
View Source
var TopGroupByResult = string(`LET tree_0 = (
	FOR e_9 IN parliament
	LET e10 = (
			FOR e_10 IN parties
			FOR r8 IN member_of
			FILTER r8._from == e_9._id AND r8._to == e_10._id
			FILTER length(e_10) != 0 AND length(r8) != 0
			RETURN {"e10": union_distinct([e_10], []), "r8": union_distinct([r8], [])}
	)
	FILTER length(e10) != 0 AND length(e_9) != 0
	RETURN {"e9": union_distinct([e_9], []), "e10": union_distinct(flatten(e10[**].e10), []), "r8": union_distinct(flatten(e10[**].r8), [])}
)
LET gt13 = (
	FOR x IN member_of
	LET variable_0 = (
			LET tmp = union_distinct(flatten(tree_0[**].e10), [])
					FOR y IN tmp
					FILTER y._id == x._to
					RETURN y._id
	)
	LET variable_1 = variable_0[0]
	LET variable_2 = (
			LET tmp = union_distinct(flatten(tree_0[**].e9), [])
					FOR y IN tmp
					FILTER y._id == x._from
					RETURN y.age
	)
	LET variable_3 = variable_2[0]
	FILTER variable_1 != NULL AND variable_3 != NULL
	RETURN {
			"group": variable_1,
			"by": variable_3
	}
)
LET g13 = (
	FOR x IN gt13
	COLLECT c = x.group INTO groups = x.by
	LET variable_0 = AVG(groups)
	FILTER variable_0 >= 42
	RETURN {
	_id: c,
	modifier: variable_0
	}
)
LET in13 = (
	FOR x IN g13[**]._id
	FOR y IN parties
	FILTER x == y._id
	RETURN y
)
LET tree_1 = (
	FOR e_68 IN parliament
	LET e69 = (
			FOR e_69 IN parties
			FOR r67 IN member_of
			FILTER r67._from == e_68._id AND r67._to == e_69._id
			FILTER length(e_69) != 0 AND length(r67) != 0
			RETURN {"e69": union_distinct([e_69], []), "r67": union_distinct([r67], [])}
	)
	FILTER length(e69) != 0 AND length(e_68) != 0
	RETURN {"e69": union_distinct(flatten(e69[**].e69), []), "r67": union_distinct(flatten(e69[**].r67), []), "e68": union_distinct([e_68], [])}
)
LET gt72 = (
	FOR x IN member_of
	LET variable_0 = (
			LET tmp = union_distinct(flatten(tree_1[**].e68), [])
					FOR y IN tmp
					FILTER y._id == x._from
					RETURN y._id
	)
	LET variable_1 = variable_0[0]
	LET variable_2 = (
			LET tmp = union_distinct(flatten(tree_1[**].e69), [])
					FOR y IN tmp
					FILTER y._id == x._to
					RETURN y.seats
	)
	LET variable_3 = variable_2[0]
	FILTER variable_1 != NULL AND variable_3 != NULL
	RETURN {
			"group": variable_1,
			"by": variable_3
	}
)
LET g72 = (
	FOR x IN gt72
	COLLECT c = x.group INTO groups = x.by
	LET variable_0 = AVG(groups)
	FILTER variable_0 < 13
	RETURN {
	_id: c,
	modifier: variable_0
	}
)
LET in72 = (
	FOR x IN g72[**]._id
	FOR y IN parliament
	FILTER x == y._id
	RETURN y
)
LET tree_2 = (
	FOR g_13 IN in13
	LET gb72 = (
			FOR g_72 IN in72
			FOR r76 IN member_of
			FILTER r76._from == g_72._id AND r76._to == g_13._id
			FILTER length(g_72) != 0 AND length(r76) != 0
			RETURN {"gb72": union_distinct([g_72], []), "r76": union_distinct([r76], [])}
	)
	FILTER length(gb72) != 0 AND length(g_13) != 0
	RETURN {"gb13": union_distinct([g_13], []), "gb72": union_distinct(flatten(gb72[**].gb72), []), "r76": union_distinct(flatten(gb72[**].r76), [])}
)
LET nodes = union_distinct(flatten(tree_2[**].gb13), flatten(tree_2[**].gb72), [])
LET edges = union_distinct(flatten(tree_2[**].r76), [])
RETURN {"vertices":nodes,"edges":edges}
`)
View Source
var TwoEntitiesNoFilter = []byte(`{
	"databaseName": "TweedeKamer",
	"return": {
		"entities": [
			0,
			1
		],
		"relations": [
			0
		]
	},
	"entities": [
		{
			"name": "parliament",
			"ID": 0,
			"constraints": []
		},
		{
			"name": "parties",
			"ID": 1,
			"constraints": []
		}
	],
	"relations": [
		{
			"ID": 0,
			"name": "member_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 0,
			"toType": "entity",
			"toID": 1,
			"constraints":[]
		}
	],
	"groupBys": [],		
	"limit": 5000,
	"modifiers": []
}`)
View Source
var TwoEntitiesNoFilterResult = string(`LET tree_0 = (
	FOR e_0 IN parliament
	LET e1 = (
			FOR e_1 IN parties
			FOR r0 IN member_of
			FILTER r0._from == e_0._id AND r0._to == e_1._id
			FILTER length(e_1) != 0 AND length(r0) != 0
			RETURN {"e1": union_distinct([e_1], []), "r0": union_distinct([r0], [])}
	)
	FILTER length(e1) != 0 AND length(e_0) != 0
	RETURN {"e0": union_distinct([e_0], []), "e1": union_distinct(flatten(e1[**].e1), []), "r0": union_distinct(flatten(e1[**].r0), [])}
)
LET nodes = union_distinct(flatten(tree_0[**].e0), flatten(tree_0[**].e1), [])
LET edges = union_distinct(flatten(tree_0[**].r0), [])
RETURN {"vertices":nodes,"edges":edges}`)
View Source
var TwoEntitiesOneEntityFilter = []byte(`{
	"databaseName": "TweedeKamer",
	"return": {
		"entities": [
			0,
			1
		],
		"relations": [
			0
		]
	},
	"entities": [
		{
			"name": "parliament",
			"ID": 0,
			"constraints": []
		},
		{
			"name": "parties",
			"ID": 1,
			"constraints": [
				{
					"attribute": "seats",
					"value": "10",
					"dataType": "int",
					"matchType": "LT"
				}
			]
		}
	],
	"relations": [
		{
			"ID": 0,
			"name": "member_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 0,
			"toType": "entity",
			"toID": 1,
			"constraints":[]
		}
	],
	"groupBys": [],		
	"limit": 5000,
	"modifiers": []
}`)
View Source
var TwoEntitiesOneEntityFilterOneRelationFilter = []byte(`{
	"return": {
		"entities": [
			0,
			1
		],
		"relations": [
			0
		]
	},
	"entities": [
		{
			"ID": 0,
			"name": "airports",
			"constraints": [
				{
					"attribute": "state",
					"value": "HI",
					"dataType": "string",
					"matchType": "exact"
				}
			]
		},
		{
			"ID": 1,
			"name": "airports",
			"constraints":[]
		}
	],
	"relations": [
		{
			"ID": 0,
			"name": "flights",
			"depth": {
				"min": 1,
				"max": 1
			},
			"FromType": "entity",
			"fromID": 0,
			"ToType": "entity",
			"toID": 1,
			"constraints": [
				{	
					"attribute": "Day",
					"value": "15",
					"dataType": "int",
					"matchType": "EQ",
					"inType": "",
					"inID": -1
				}
			]
		}
	],
	"groupBys": [],
	"limit": 5000
}`)
View Source
var TwoEntitiesOneEntityFilterOneRelationFilterResult = string(`LET tree_0 = (
	FOR e_0 IN airports
	FILTER e_0.state == "HI"
	LET e1 = (
			FOR e_1 IN airports
			FOR r0 IN flights
			FILTER r0.Day == 15
			FILTER r0._from == e_0._id AND r0._to == e_1._id
			FILTER length(e_1) != 0 AND length(r0) != 0
			RETURN {"e1": union_distinct([e_1], []), "r0": union_distinct([r0], [])}
	)
	FILTER length(e1) != 0 AND length(e_0) != 0
	RETURN {"e0": union_distinct([e_0], []), "e1": union_distinct(flatten(e1[**].e1), []), "r0": union_distinct(flatten(e1[**].r0), [])}
)
LET nodes = union_distinct(flatten(tree_0[**].e0), flatten(tree_0[**].e1), [])
LET edges = union_distinct(flatten(tree_0[**].r0), [])
RETURN {"vertices":nodes,"edges":edges}
`)
View Source
var TwoEntitiesOneEntityFilterResult = string(`LET tree_0 = (
	FOR e_0 IN parliament
	LET e1 = (
			FOR e_1 IN parties
			FOR r0 IN member_of
			FILTER e_1.seats < 10
			FILTER r0._from == e_0._id AND r0._to == e_1._id
			FILTER length(e_1) != 0 AND length(r0) != 0
			RETURN {"e1": union_distinct([e_1], []), "r0": union_distinct([r0], [])}
	)
	FILTER length(e1) != 0 AND length(e_0) != 0
	RETURN {"e0": union_distinct([e_0], []), "e1": union_distinct(flatten(e1[**].e1), []), "r0": union_distinct(flatten(e1[**].r0), [])}
)
LET nodes = union_distinct(flatten(tree_0[**].e0), flatten(tree_0[**].e1), [])
LET edges = union_distinct(flatten(tree_0[**].r0), [])
RETURN {"vertices":nodes,"edges":edges}`)
View Source
var TwoEntitiesTwoEntityFilters = []byte(`{
	"databaseName": "TweedeKamer",
	"return": {
		"entities": [
			0,
			1
		],
		"relations": [
			0
		]
	},
	"entities": [
		{
			"name": "parliament",
			"ID": 0,
			"constraints": [
				{
					"attribute": "age",
					"value": "45",
					"dataType": "int",
					"matchType": "GT"
				}
			]
		},
		{
			"name": "parties",
			"ID": 1,
			"constraints": [
				{
					"attribute": "seats",
					"value": "10",
					"dataType": "int",
					"matchType": "LT"
				}
			]
		}
	],
	"relations": [
		{
			"ID": 0,
			"name": "member_of",
			"depth": {
				"min": 1,
				"max": 1
			},
			"fromType": "entity",
			"fromID": 0,
			"toType": "entity",
			"toID": 1,
			"constraints":[]
		}
	],
	"groupBys": [],		
	"limit": 5000,
	"modifiers": []
}`)
View Source
var TwoEntitiesTwoEntityFiltersResult = string(`LET tree_0 = (
	FOR e_0 IN parliament
	FILTER e_0.age > 45
	LET e1 = (
			FOR e_1 IN parties
			FOR r0 IN member_of
			FILTER e_1.seats < 10
			FILTER r0._from == e_0._id AND r0._to == e_1._id
			FILTER length(e_1) != 0 AND length(r0) != 0
			RETURN {"e1": union_distinct([e_1], []), "r0": union_distinct([r0], [])}
	)
	FILTER length(e1) != 0 AND length(e_0) != 0
	RETURN {"e0": union_distinct([e_0], []), "e1": union_distinct(flatten(e1[**].e1), []), "r0": union_distinct(flatten(e1[**].r0), [])}
)
LET nodes = union_distinct(flatten(tree_0[**].e0), flatten(tree_0[**].e1), [])
LET edges = union_distinct(flatten(tree_0[**].r0), [])
RETURN {"vertices":nodes,"edges":edges}`)
View Source
var WayTooLargeQuery = []byte(`{
	"return": {
	  "entities": [
		9,
		10,
		68,
		69,
		93,
		104,
		119,
		126,
		145
	  ],
	  "relations": [
		8,
		67,
		76,
		92,
		98,
		118,
		124,
		144
	  ],
	  "groupBys": [
		13,
		72,
		106,
		138
	  ]
	},
	"entities": [
	  {
		"name": "parliament",
		"ID": 9,
		"constraints": []
	  },
	  {
		"name": "parties",
		"ID": 10,
		"constraints": []
	  },
	  {
		"name": "parliament",
		"ID": 68,
		"constraints": []
	  },
	  {
		"name": "parties",
		"ID": 69,
		"constraints": []
	  },
	  {
		"name": "parliament",
		"ID": 93,
		"constraints": [
		  {
			"attribute": "age",
			"value": "32",
			"dataType": "int",
			"matchType": "GET"
		  }
		]
	  },
	  {
		"name": "commissions",
		"ID": 104,
		"constraints": []
	  },
	  {
		"name": "parliament",
		"ID": 119,
		"constraints": [
		  {
			"attribute": "age",
			"value": "67",
			"dataType": "int",
			"matchType": "LET"
		  }
		]
	  },
	  {
		"name": "parties",
		"ID": 126,
		"constraints": [
		  {
			"attribute": "seats",
			"value": "14",
			"dataType": "int",
			"matchType": "LET"
		  }
		]
	  },
	  {
		"name": "parliament",
		"ID": 145,
		"constraints": []
	  }
	],
	"relations": [
	  {
		"ID": 8,
		"name": "member_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 9,
		"toType": "entity",
		"toID": 10,
		"constraints": []
	  },
	  {
		"ID": 67,
		"name": "member_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 68,
		"toType": "entity",
		"toID": 69,
		"constraints": []
	  },
	  {
		"ID": 76,
		"name": "member_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "groupBy",
		"fromID": 72,
		"toType": "groupBy",
		"toID": 13,
		"constraints": []
	  },
	  {
		"ID": 92,
		"name": "member_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 93,
		"toType": "groupBy",
		"toID": 13,
		"constraints": []
	  },
	  {
		"ID": 98,
		"name": "part_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 93,
		"toType": "entity",
		"toID": 104,
		"constraints": []
	  },
	  {
		"ID": 118,
		"name": "part_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 119,
		"toType": "groupBy",
		"toID": 106,
		"constraints": []
	  },
	  {
		"ID": 124,
		"name": "member_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 119,
		"toType": "entity",
		"toID": 126,
		"constraints": []
	  },
	  {
		"ID": 144,
		"name": "member_of",
		"depth": {
		  "min": 1,
		  "max": 1
		},
		"fromType": "entity",
		"fromID": 145,
		"toType": "groupBy",
		"toID": 138,
		"constraints": []
	  }
	],
	"groupBys": [
	  {
		"ID": 13,
		"groupType": "entity",
		"groupID": [
		  9
		],
		"groupAttribute": "age",
		"byType": "entity",
		"byID": [
		  10
		],
		"byAttribute": "_id",
		"appliedModifier": "AVG",
		"relationID": 8,
		"constraints": [
		  {
			"attribute": "age",
			"value": "42",
			"dataType": "int",
			"matchType": "GET"
		  }
		]
	  },
	  {
		"ID": 72,
		"groupType": "entity",
		"groupID": [
		  69
		],
		"groupAttribute": "seats",
		"byType": "entity",
		"byID": [
		  68
		],
		"byAttribute": "_id",
		"appliedModifier": "AVG",
		"relationID": 67,
		"constraints": [
		  {
			"attribute": "seats",
			"value": "13",
			"dataType": "int",
			"matchType": "LT"
		  }
		]
	  },
	  {
		"ID": 106,
		"groupType": "entity",
		"groupID": [
		  93
		],
		"groupAttribute": "age",
		"byType": "entity",
		"byID": [
		  104
		],
		"byAttribute": "_id",
		"appliedModifier": "AVG",
		"relationID": 98,
		"constraints": [
		  {
			"attribute": "age",
			"value": "69",
			"dataType": "int",
			"matchType": "LET"
		  }
		]
	  },
	  {
		"ID": 138,
		"groupType": "entity",
		"groupID": [
		  119
		],
		"groupAttribute": "age",
		"byType": "entity",
		"byID": [
		  126
		],
		"byAttribute": "_id",
		"appliedModifier": "PRODUCT",
		"relationID": 124,
		"constraints": [
		  {
			"attribute": "age",
			"value": "8008",
			"dataType": "int",
			"matchType": "GET"
		  }
		]
	  }
	],
	"machineLearning": [],
	"limit": 5000
  }
`)
View Source
var WayTooLargeQueryResult = string(`LET tree_0 = (
	FOR e_9 IN parliament
	LET e10 = (
			FOR e_10 IN parties
			FOR r8 IN member_of
			FILTER r8._from == e_9._id AND r8._to == e_10._id
			FILTER length(e_10) != 0 AND length(r8) != 0
			RETURN {"e10": union_distinct([e_10], []), "r8": union_distinct([r8], [])}
	)
	FILTER length(e10) != 0 AND length(e_9) != 0
	RETURN {"e9": union_distinct([e_9], []), "e10": union_distinct(flatten(e10[**].e10), []), "r8": union_distinct(flatten(e10[**].r8), [])}
)
LET gt13 = (
	FOR x IN member_of
	LET variable_0 = (
			LET tmp = union_distinct(flatten(tree_0[**].e10), [])
					FOR y IN tmp
					FILTER y._id == x._to
					RETURN y._id
	)
	LET variable_1 = variable_0[0]
	LET variable_2 = (
			LET tmp = union_distinct(flatten(tree_0[**].e9), [])
					FOR y IN tmp
					FILTER y._id == x._from
					RETURN y.age
	)
	LET variable_3 = variable_2[0]
	FILTER variable_1 != NULL AND variable_3 != NULL
	RETURN {
			"group": variable_1,
			"by": variable_3
	}
)
LET g13 = (
	FOR x IN gt13
	COLLECT c = x.group INTO groups = x.by
	LET variable_0 = AVG(groups)
	FILTER variable_0 >= 42
	RETURN {
	_id: c,
	modifier: variable_0
	}
)
LET in13 = (
	FOR x IN g13[**]._id
	FOR y IN parties
	FILTER x == y._id
	RETURN y
)
LET tree_1 = (
	FOR e_68 IN parliament
	LET e69 = (
			FOR e_69 IN parties
			FOR r67 IN member_of
			FILTER r67._from == e_68._id AND r67._to == e_69._id
			FILTER length(e_69) != 0 AND length(r67) != 0
			RETURN {"e69": union_distinct([e_69], []), "r67": union_distinct([r67], [])}
	)
	FILTER length(e69) != 0 AND length(e_68) != 0
	RETURN {"e68": union_distinct([e_68], []), "e69": union_distinct(flatten(e69[**].e69), []), "r67": union_distinct(flatten(e69[**].r67), [])}
)
LET gt72 = (
	FOR x IN member_of
	LET variable_0 = (
			LET tmp = union_distinct(flatten(tree_1[**].e68), [])
					FOR y IN tmp
					FILTER y._id == x._from
					RETURN y._id
	)
	LET variable_1 = variable_0[0]
	LET variable_2 = (
			LET tmp = union_distinct(flatten(tree_1[**].e69), [])
					FOR y IN tmp
					FILTER y._id == x._to
					RETURN y.seats
	)
	LET variable_3 = variable_2[0]
	FILTER variable_1 != NULL AND variable_3 != NULL
	RETURN {
			"group": variable_1,
			"by": variable_3
	}
)
LET g72 = (
	FOR x IN gt72
	COLLECT c = x.group INTO groups = x.by
	LET variable_0 = AVG(groups)
	FILTER variable_0 < 13
	RETURN {
	_id: c,
	modifier: variable_0
	}
)
LET in72 = (
	FOR x IN g72[**]._id
	FOR y IN parliament
	FILTER x == y._id
	RETURN y
)
LET tree_2 = (
	FOR e_104 IN commissions
	LET e93 = (
			FOR e_93 IN parliament
			FOR r98 IN part_of
			FILTER e_93.age >= 32
			FILTER r98._from == e_93._id AND r98._to == e_104._id
			LET gb13 = (
					FOR g_13 IN in13
					FOR r92 IN member_of
					FILTER r92._from == e_93._id AND r92._to == g_13._id
					LET gb72 = (
							FOR g_72 IN in72
							FOR r76 IN member_of
							FILTER r76._from == g_72._id AND r76._to == g_13._id
							FILTER length(g_72) != 0 AND length(r76) != 0
							RETURN {"gb72": union_distinct([g_72], []), "r76": union_distinct([r76], [])}
					)
					FILTER length(gb72) != 0 AND length(g_13) != 0 AND length(r92) != 0
					RETURN {"r92": union_distinct([r92], []), "gb72": union_distinct(flatten(gb72[**].gb72), []), "r76": union_distinct(flatten(gb72[**].r76), []), "gb13": union_distinct([g_13], [])}
			)
			FILTER length(gb13) != 0 AND length(e_93) != 0 AND length(r98) != 0
			RETURN {"e93": union_distinct([e_93], []), "r98": union_distinct([r98], []), "gb13": union_distinct(flatten(gb13[**].gb13), []), "r92": union_distinct(flatten(gb13[**].r92), []), "gb72": union_distinct(flatten(gb13[**].gb72), []), "r76": union_distinct(flatten(gb13[**].r76), [])}
	)
	FILTER length(e93) != 0 AND length(e_104) != 0
	RETURN {"r98": union_distinct(flatten(e93[**].r98), []), "gb13": union_distinct(flatten(e93[**].gb13), []), "r92": union_distinct(flatten(e93[**].r92), []), "gb72": union_distinct(flatten(e93[**].gb72), []), "r76": union_distinct(flatten(e93[**].r76), []), "e104": union_distinct([e_104], []), "e93": union_distinct(flatten(e93[**].e93), [])}
)
LET gt106 = (
	FOR x IN part_of
	LET variable_0 = (
			LET tmp = union_distinct(flatten(tree_2[**].e104), [])
					FOR y IN tmp
					FILTER y._id == x._to
					RETURN y._id
	)
	LET variable_1 = variable_0[0]
	LET variable_2 = (
			LET tmp = union_distinct(flatten(tree_2[**].e93), [])
					FOR y IN tmp
					FILTER y._id == x._from
					RETURN y.age
	)
	LET variable_3 = variable_2[0]
	FILTER variable_1 != NULL AND variable_3 != NULL
	RETURN {
			"group": variable_1,
			"by": variable_3
	}
)
LET g106 = (
	FOR x IN gt106
	COLLECT c = x.group INTO groups = x.by
	LET variable_0 = AVG(groups)
	FILTER variable_0 <= 69
	RETURN {
	_id: c,
	modifier: variable_0
	}
)
LET in106 = (
	FOR x IN g106[**]._id
	FOR y IN commissions
	FILTER x == y._id
	RETURN y
)
LET tree_3 = (
	FOR e_126 IN parties
	FILTER e_126.seats <= 14
	LET e119 = (
			FOR e_119 IN parliament
			FOR r124 IN member_of
			FILTER e_119.age <= 67
			FILTER r124._from == e_119._id AND r124._to == e_126._id
			LET gb106 = (
					FOR g_106 IN in106
					FOR r118 IN part_of
					FILTER r118._from == e_119._id AND r118._to == g_106._id
					FILTER length(g_106) != 0 AND length(r118) != 0
					RETURN {"gb106": union_distinct([g_106], []), "r118": union_distinct([r118], [])}
			)
			FILTER length(gb106) != 0 AND length(e_119) != 0 AND length(r124) != 0
			RETURN {"gb106": union_distinct(flatten(gb106[**].gb106), []), "r118": union_distinct(flatten(gb106[**].r118), []), "e119": union_distinct([e_119], []), "r124": union_distinct([r124], [])}
	)
	FILTER length(e119) != 0 AND length(e_126) != 0
	RETURN {"e119": union_distinct(flatten(e119[**].e119), []), "r124": union_distinct(flatten(e119[**].r124), []), "gb106": union_distinct(flatten(e119[**].gb106), []), "r118": union_distinct(flatten(e119[**].r118), []), "e126": union_distinct([e_126], [])}
)
LET gt138 = (
	FOR x IN member_of
	LET variable_0 = (
			LET tmp = union_distinct(flatten(tree_3[**].e126), [])
					FOR y IN tmp
					FILTER y._id == x._to
					RETURN y._id
	)
	LET variable_1 = variable_0[0]
	LET variable_2 = (
			LET tmp = union_distinct(flatten(tree_3[**].e119), [])
					FOR y IN tmp
					FILTER y._id == x._from
					RETURN y.age
	)
	LET variable_3 = variable_2[0]
	FILTER variable_1 != NULL AND variable_3 != NULL
	RETURN {
			"group": variable_1,
			"by": variable_3
	}
)
LET g138 = (
	FOR x IN gt138
	COLLECT c = x.group INTO groups = x.by
	LET variable_0 = PRODUCT(groups)
	FILTER variable_0 >= 8008
	RETURN {
	_id: c,
	modifier: variable_0
	}
)
LET in138 = (
	FOR x IN g138[**]._id
	FOR y IN parties
	FILTER x == y._id
	RETURN y
)
LET tree_4 = (
	FOR e_145 IN parliament
	LET gb138 = (
			FOR g_138 IN in138
			FOR r144 IN member_of
			FILTER r144._from == e_145._id AND r144._to == g_138._id
			FILTER length(g_138) != 0 AND length(r144) != 0
			RETURN {"gb138": union_distinct([g_138], []), "r144": union_distinct([r144], [])}
	)
	FILTER length(gb138) != 0 AND length(e_145) != 0
	RETURN {"e145": union_distinct([e_145], []), "gb138": union_distinct(flatten(gb138[**].gb138), []), "r144": union_distinct(flatten(gb138[**].r144), [])}
)
LET nodes = union_distinct(flatten(tree_4[**].gb138), flatten(tree_4[**].e145), [])
LET edges = union_distinct(flatten(tree_4[**].r144), [])
RETURN {"vertices":nodes,"edges":edges}
`)

Functions

This section is empty.

Types

type MockService

type MockService struct {
	// contains filtered or unexported fields
}

A MockService implements the query convert usecase interface (mock)

func NewMockService

func NewMockService() *MockService

NewMockService creates a new query convert service (mock)

Return: *MockService, returns a mock service

func (*MockService) ConvertQuery

func (s *MockService) ConvertQuery(JSONQuery *entity.IncomingQueryJSON) (*string, error)

ConvertQuery returns a hard coded string message (mock)

JSONQuer: *entity.IncomingQueryJSON, the incoming query in JSON format
Return: (*string, error), the result and a potential error

func (*MockService) ToggleError

func (s *MockService) ToggleError()

ToggleError decides whether the convert function throws an error

type Service

type Service struct {
}

Service implements the QueryConverter interface (in the query service)

func (*Service) ConvertQuery

func (s *Service) ConvertQuery(JSONQuery *entity.IncomingQueryJSON) (*string, *[]byte, error)

ConvertQuery converts an IncomingQueryJSON object into AQL

JSONQuery: *entity.IncomingQueryJSON, the query to be converted to AQL
Returns: *string, the AQL query and a possible error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL