-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use relationship alias for this in directive on rich relationship (#246)
- Loading branch information
Showing
2 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
core/src/test/resources/issues/gh-245-cypher-directive-on-relationship.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
:toc: | ||
|
||
= Cypher Directive Computing Relationship Type To Field Test | ||
|
||
== Schema | ||
|
||
[source,graphql,schema=true] | ||
---- | ||
type Role @relation(name:"ACTED_IN", from:"actor", to:"movie") { | ||
actor: Person | ||
movie: Movie | ||
type: String @cypher(statement:""" | ||
RETURN type(this) | ||
""") | ||
} | ||
type Person { | ||
name: String | ||
born: Int | ||
roles: [Role] | ||
} | ||
type Movie { | ||
title: String | ||
released: Int | ||
characters: [Role] | ||
} | ||
---- | ||
|
||
== Queries | ||
|
||
=== Simple Cypher Directive on Field | ||
|
||
.GraphQL-Query | ||
[source,graphql] | ||
---- | ||
query { | ||
person { | ||
roles { | ||
type | ||
} | ||
} | ||
} | ||
---- | ||
|
||
.Cypher Params | ||
[source,json] | ||
---- | ||
{} | ||
---- | ||
|
||
.Cypher | ||
[source,cypher] | ||
---- | ||
MATCH (person:Person) | ||
RETURN person { | ||
roles: [(person)-[personRoles:ACTED_IN]->(personRolesMovie:Movie) | personRoles { | ||
type: apoc.cypher.runFirstColumnSingle('WITH $this AS this RETURN type(this)', { | ||
this: personRoles | ||
}) | ||
}] | ||
} AS person | ||
---- |