Skip to content
Snippets Groups Projects
Commit 4ad036ac authored by Fjodor's avatar Fjodor
Browse files

added print statement for testing, checked possible queries @Lorenzo

parent ab14486b
No related branches found
No related tags found
No related merge requests found
...@@ -191,16 +191,12 @@ func createQuery(JSONQuery *entity.IncomingQueryJSON) *string { ...@@ -191,16 +191,12 @@ func createQuery(JSONQuery *entity.IncomingQueryJSON) *string {
// Create UNION statements that create unique lists of all the nodes and relations // Create UNION statements that create unique lists of all the nodes and relations
// Thus removing all duplicates // Thus removing all duplicates
nodeUnion = "\nLET nodes = first(RETURN UNION_DISTINCT(" nodeUnion = "\nRETURN "
for _, relation := range relationsToReturn {
nodeUnion += fmt.Sprintf("flatten(%v[**].vertices), ", relation)
}
for _, node := range nodesToReturn { for _, node := range nodesToReturn {
nodeUnion += fmt.Sprintf("%v,", node) nodeUnion += fmt.Sprintf("%v,", node)
} }
nodeUnion += "[],[]))\n" // RETURN n0, n1, n2, nn, r0, r1, r2, r3, rn
relationUnion = "LET edges = first(RETURN UNION_DISTINCT(" relationUnion = "LET edges = first(RETURN UNION_DISTINCT("
for _, relation := range relationsToReturn { for _, relation := range relationsToReturn {
relationUnion += fmt.Sprintf("flatten(%v[**].edges), ", relation) relationUnion += fmt.Sprintf("flatten(%v[**].edges), ", relation)
......
package main package main
import( import (
"encoding/json"
"log" "log"
"git.science.uu.nl/datastrophe/query-conversion/cypher/queryConverter.go"
"git.science.uu.nl/datastrophe/query-conversion/cypher"
"git.science.uu.nl/datastrophe/query-conversion/entity"
) )
func main(){ func main() {
queryservice := new cypher.NewService() queryservice := cypher.NewService()
js = `{ js := []byte(`{
"return": { "return": {
"entities": [ "entities": [
0 0
], ],
"relations": [] "relations": []
}, },
...@@ -30,9 +33,10 @@ func main(){ ...@@ -30,9 +33,10 @@ func main(){
], ],
"relations": [], "relations": [],
"limit": 5000 "limit": 5000
}` }`)
var inc entity.IncomingQueryJSON
result, _ := cypher.convertQuery(JSON.marshal(js)) json.Unmarshal(js, &inc)
log.Println(result) result, _ := queryservice.ConvertQuery(&inc)
log.Println(*result)
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment