Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Q
query-conversion
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GraphPolaris
query-conversion
Commits
4ad036ac
Commit
4ad036ac
authored
3 years ago
by
Fjodor
Browse files
Options
Downloads
Patches
Plain Diff
added print statement for testing, checked possible queries @Lorenzo
parent
ab14486b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cypher/convertQuery.go
+2
-6
2 additions, 6 deletions
cypher/convertQuery.go
main/main.go
+15
-11
15 additions, 11 deletions
main/main.go
with
17 additions
and
17 deletions
cypher/convertQuery.go
+
2
−
6
View file @
4ad036ac
...
...
@@ -191,16 +191,12 @@ func createQuery(JSONQuery *entity.IncomingQueryJSON) *string {
// Create UNION statements that create unique lists of all the nodes and relations
// Thus removing all duplicates
nodeUnion
=
"
\n
LET nodes = first(RETURN UNION_DISTINCT("
for
_
,
relation
:=
range
relationsToReturn
{
nodeUnion
+=
fmt
.
Sprintf
(
"flatten(%v[**].vertices), "
,
relation
)
}
nodeUnion
=
"
\n
RETURN "
for
_
,
node
:=
range
nodesToReturn
{
nodeUnion
+=
fmt
.
Sprintf
(
"%v,"
,
node
)
}
nodeUnion
+=
"[],[]))
\n
"
// RETURN n0, n1, n2, nn, r0, r1, r2, r3, rn
relationUnion
=
"LET edges = first(RETURN UNION_DISTINCT("
for
_
,
relation
:=
range
relationsToReturn
{
relationUnion
+=
fmt
.
Sprintf
(
"flatten(%v[**].edges), "
,
relation
)
...
...
This diff is collapsed.
Click to expand it.
main/main.go
+
15
−
11
View file @
4ad036ac
package
main
import
(
import
(
"encoding/json"
"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
(){
queryservice
:=
new
cypher
.
NewService
()
func
main
()
{
queryservice
:=
cypher
.
NewService
()
js
=
`{
js
:
=
[]
byte
(
`{
"return": {
"entities": [
0
0
],
"relations": []
},
...
...
@@ -30,9 +33,10 @@ func main(){
],
"relations": [],
"limit": 5000
}`
result
,
_
:=
cypher
.
convertQuery
(
JSON
.
marshal
(
js
))
log
.
Println
(
result
)
}`
)
var
inc
entity
.
IncomingQueryJSON
json
.
Unmarshal
(
js
,
&
inc
)
result
,
_
:=
queryservice
.
ConvertQuery
(
&
inc
)
log
.
Println
(
*
result
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment