Skip to content
Snippets Groups Projects
Commit 6e184e31 authored by sivan's avatar sivan
Browse files

added benchmark and relation conversion function

parent 46a5bdb9
Branches
Tags
No related merge requests found
......@@ -199,6 +199,56 @@ func createNodeQuery(node *entityStruct, name string) *string {
return &result
}
// func createEdgeQuery(relation *relationStruct, name string) *string {
// /*
// LET n0 = (
// FOR x IN female
// FILTER x.birth_year > 1997 AND
// x.name LIKE "%Alice"
// RETURN x
// )
// LET n1 = (
// FOR x IN male
// FILTER x.birth_year < 1997 AND
// x.name == "Bob"
// RETURN x
// )
// FOR a1 IN n0
// FOR Node, Edge, Path IN {MINDEPTH}..{MAXDEPTH} OUTBOUND a1 {RelationType}
// FILTER Node IN {bobs i guess?}
// FILTER contstrains...
// Edge.{Constraints.type} {MatchType + DataType} {Value}
// RETURN Node, a1, Edge
// "Relations": [
// {
// "RelationType": "relation",
// "NodeFrom": 0,
// "NodeTo": 1,
// "Depth": { "Min": 1, "Max": 1 },
// "Constraints": {
// "type": { "Value": "friend", "DataType": "text", "MatchType": "exact" }
// }
// }
// ]
// */
// firstForStatement := fmt.Sprintf("FOR a1 IN n%s \n", fmt.Sprint(relation.NodeFrom)) //a1 moet wss iets automatisch zijn?
// secondForStatement := fmt.Sprintf("\tFOR node, edges, path IN %s..%s OUTBOUND a1 %s\n", fmt.Sprint(relation.Depth.Min), fmt.Sprint(relation.Depth.Max), relation.RelationType)
// connectionFilterStatement := fmt.Sprintf("\t\tFILTER node IN n%s\n", fmt.Sprint(relation.NodeTo))
// filter := *createAllQueryConstraints(&relation.Constraints, "edges[*]")
// returnStatement := "\n\tRETURN { node, edges, path }\n"
// // Concatenate all the statements
// result := firstForStatement + secondForStatement + connectionFilterStatement + filter + returnStatement
// return &result
// }
// Constraint datatypes
// text MatchTypes: exact/contains/startswith/endswith
// number MatchTypes: GT/LT/EQ
......
......
time = 2.9 sec
LET n0 = (
FOR x IN airports
FILTER x.city == "New York"
RETURN x
)
LET n1 = (
FOR x IN airports
FILTER x.state == "OH" AND
x.vip == false
RETURN x
)
FOR a1 IN n0
FOR node, edges, path IN 1..2 OUTBOUND a1 flights
FILTER node IN n1
FILTER edges.DayOfWeek == 6
LIMIT 100
RETURN { node, edges, path }
time = 1.3 sec
FOR x IN airports
FILTER x.city == "New York"
FOR node, edges, path IN 1..2 OUTBOUND x flights
FILTER node.state == "OH" AND node.vip == false
FILTER edges.DayOfWeek == 6
LIMIT 100
RETURN { node, edges, path }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment