Skip to content
Snippets Groups Projects
Commit 095a24cc authored by Joris's avatar Joris
Browse files

log statements and commented clusters

parent 73119c95
No related branches found
No related tags found
1 merge request!2Groupby overhaul
......@@ -3,6 +3,7 @@ package cypher
import (
"errors"
"fmt"
"log"
"strings"
"git.science.uu.nl/graphpolaris/query-conversion/entity"
......@@ -14,16 +15,16 @@ func (s *Service) ConvertQuery(totalJSONQuery *entity.IncomingQueryJSON) (*strin
queryJSON := totalJSONQuery
query, rest, isRest := checkForQueryCluster(queryJSON)
// query, rest, isRest := checkForQueryCluster(queryJSON)
if isRest {
fmt.Println("Rest:")
fmt.Println(rest)
// if isRest {
// fmt.Println("Rest:")
// fmt.Println(rest)
// If something needs to be done with other query cluster, then add code here
}
// // If something needs to be done with other query cluster, then add code here
// }
finalCypher, err := createCypher(query)
finalCypher, err := createCypher(queryJSON)
if err != nil {
return nil, err
}
......@@ -132,6 +133,7 @@ func createQueryHierarchy(JSONQuery *entity.IncomingQueryJSON) (entity.Query, er
IDctr := 0
// Add relations all to query parts
log.Println(JSONQuery.Relations)
for _, rel := range JSONQuery.Relations {
part := entity.QueryPart{
QType: "relation",
......
......@@ -753,3 +753,62 @@ func Test5(t *testing.T) {
assert.Equal(t, trimmedAnswer, trimmedAnswer)
}
func Test6(t *testing.T) {
// Works, but, the AVG function is applied to a string, so that doesnt work, but the translation does :D
query := []byte(`{
"return": {
"entities": [
11,
12
],
"relations": [
10
],
"groupBys": []
},
"entities": [
{
"name": "Person",
"ID": 11,
"constraints": []
},
{
"name": "Movie",
"ID": 12,
"constraints": []
}
],
"relations": [
{
"ID": 10,
"name": "DIRECTED",
"depth": {
"min": 1,
"max": 1
},
"fromType": "entity",
"fromID": 11,
"toType": "entity",
"toID": 12,
"constraints": []
}
],
"groupBys": [],
"machineLearning": [],
"limit": 5000,
"databaseName": "Movies3"
}
`)
var JSONQuery entity.IncomingQueryJSON
json.Unmarshal(query, &JSONQuery)
s := NewService()
cypher, err := s.ConvertQuery(&JSONQuery)
if err != nil {
fmt.Println(err)
}
fmt.Println(*cypher)
t.Fail()
}
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