File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,8 @@ permissions and limitations under the License.
7070 neptune analytics graph and added testing
7171 documentation ([ #113 ] ( https://github.com/aws/amazon-neptune-for-graphql/pull/113 ) )
7272* Updated query and mutation names to be less graph-specific ([ #124 ] ( https://github.com/aws/amazon-neptune-for-graphql/pull/124 ) )
73+ * Documented custom query to filter nodes by connected nodes'
74+ properties ([ #130 ] ( https://github.com/aws/amazon-neptune-for-graphql/pull/130 ) )
7375
7476### Bug Fixes
7577
Original file line number Diff line number Diff line change @@ -289,6 +289,33 @@ type Mutation {
289289}
290290```
291291
292+ You can add a custom query to filter nodes based on a connected node 's
293+ properties . This is an example of a query which can retrieve airports that have
294+ routes to a given country .
295+
296+ ```graphql
297+ type Query {
298+ getAirportsWithRoutesToCountry (country : String ): [Airport ] @graphQuery (statement : " MATCH (getAirportsWithRoutesToCountry_Airport:`airport`)-[:route]->(toAirport:`airport` {country: '$country'}) WITH DISTINCT getAirportsWithRoutesToCountry_Airport" )
299+ }
300+ ```
301+
302+ With this customized query , you can use a graphQL query to retrieve airports
303+ that have routes to CA and the CA airport properties :
304+
305+ ```graphql
306+ query GetAirportsWithRoutesToCountry {
307+ getAirportsWithRoutesToCountry (country : " CA" ) {
308+ city
309+ code
310+ country
311+ airportRoutesOut (filter : {country : {eq : " CA" }}) {
312+ city
313+ code
314+ }
315+ }
316+ }
317+ ```
318+
292319You can add a query or mutation using a Gremlin query. At this time Gremlin
293320queries are limited to return * scalar* values, or * elementMap()* for a single
294321node, or * elementMap().fold()* for a list of nodes.
@@ -389,6 +416,12 @@ For Example:
389416 "action" : " add" ,
390417 "value" : " outboundRoutesCountAdd: Int @graphQuery(statement: \" MATCH (this)-[r:route]->(a) RETURN count(r)\" )"
391418 },
419+ {
420+ "type" : " Query" ,
421+ "field" : " getAirportsWithRoutesToCountry" ,
422+ "action" : " add" ,
423+ "value" : " getAirportsWithRoutesToCountry(country:String): [Airport] @graphQuery(statement: \" MATCH (getAirportsWithRoutesToCountry_Airport:`airport`)-[:route]->(toAirport:`airport` {country: '$country'}) WITH DISTINCT getAirportsWithRoutesToCountry_Airport\" )"
424+ },
392425 {
393426 "type" : " Mutation" ,
394427 "field" : " deleteVersion" ,
You can’t perform that action at this time.
0 commit comments