AWS Database Blog

Announcing the General Availability of openCypher support for Amazon Neptune

Today, we announced the general availability of openCypher query language support with Amazon Neptune. Now you can use openCypher with Neptune to build or migrate graph applications to a fast, reliable, and fully managed graph database.

You can use the relationships in your data to expand your businesses by building knowledge graphs to link and discover data, identity graphs to better understand customers and journeys across devices, fraud graphs to detect fraudulent activities within transactions, and many other applications. But you may be impeded by the decisions that you need to make regarding the details of graph implementation, such as graph data models, query languages, and APIs. To give developers the most choice for building graph applications, Neptune’s purpose-built graph engine now supports three open graph query languages: openCypher, Apache TinkerPop Gremlin, and the World Wide Web Consortium’s (W3C) SPARQL 1.1. Support for openCypher is compatible with your existing property graphs, and developers can use both Gremlin and openCypher queries within the same graph.

Customers have asked us for a declarative graph query language for property graphs. Developers, business analysts, and data scientists like openCypher’s syntax, which is inspired by SQL, because it provides a familiar structure to compose queries for graph applications. openCypher provides an intuitive way to work with property graphs by providing developers a familiar syntax for querying graph applications. Customers familiar with the declarative style of SQL now have an option to get started on graphs and compose queries for graph applications.

Since our preview announcement, customers have run billions of queries using openCypher with Neptune, and we’ve worked backwards from your feedback. You have asked when openCypher will be generally available so you can take your applications into production with a fully managed graph database engine. We increased our coverage for openCypher clauses by implementing additional clauses that you have requested, such as MERGE, OPTIONAL MATCH, and UNION/UNION ALL, and also added functionality for critical tasks such as list and pattern comprehension, which simplifies building graph applications using openCypher on Neptune.

Additionally, we focused on improving the performance and scalability of queries, especially when using variable length paths in queries. Variable length paths allow you to answer questions when the number of connections is not known, such as finding how Dave and John are connected in a social network (as we demonstrate in the following example). With the GA release, openCypher is the first graph query language to run fully within Neptune’s new DFE query engine with the ability to deliver better performance by managing CPU cores, memory, and I/O more efficiently, and using a statistics-based query optimizer. Neptune has improved the performance of its openCypher queries, as well as allowed unbound and bi-directional variable length paths in scenarios where you’re unsure of how two nodes are connected. For example, the following query finds how Dave knows John in a social graph, not knowing how they are connected:

MATCH (n:Person {name: 'Dave'})-[:knows*1..3]→(f:Person {name: 'John'}) RETURN f 

Support in Neptune for openCypher now also includes parameterized queries using both the HTTPS and Bolt endpoints. Parameterized queries enable you to use placeholders in queries, allowing you to use the same query structure multiple times with different arguments.

In the following example, we find out how many people have the name John and are 20 years of age. We pass john and 20 as the parameters to the query to match:

curl -k \ https://localhost:8182/openCypher \ 
-d "query=MATCH (n {name: \$name, age: \$age}) RETURN n" \ 
-d "parameters={\"name\": \"john\", \"age\": 20}"

Using parameters allows you to write simpler queries and has the added benefit that Neptune can optimize the query for later use, which reduces the runtime of future queries.

Support for openCypher in Neptune works on new or existing property graphs, allowing you to use both Apache TinkerPop Gremlin and openCypher simultaneously on the same cluster and data via HTTPS, Bolt drivers, as well as from within Neptune notebooks.

If you’re already a Neptune customer who uses Gremlin, you can immediately start using openCypher to query your graphs. New customers can get started with loading and querying data using openCypher. When migrating to Neptune, you can easily connect to the graph database and continue to use your existing openCypher queries to build and run graph applications. openCypher provides access to all Neptune features, such as the Neptune workbench, which now supports querying and visualizing results of openCypher queries. As an openCypher customer, you can connect to your Neptune cluster via a REST endpoint or the Bolt Protocol with minimal configuration changes.

Summary

You can now use the openCypher query language with Neptune to build or migrate graph applications to a highly available, secure, and fully managed graph database. Neptune now supports three open graph query languages, giving you the most choice for building your graph applications. You can create a new Neptune cluster or upgrade an existing cluster to engine release 1.1.1.0 or higher to use openCypher with Neptune.

To get started using an existing graph, refer to Migrating an existing graph to Amazon Neptune. To learn more, see Accessing the Neptune Graph with openCypher.


About the Author

Navtanay Sinha is a Senior Product Manager at AWS. He works with graph technologies to help Amazon Neptune customers fully realize the potential of their graph database.

Dave Bechberger is a Sr. Graph Architect with the Amazon Neptune team. He used his years of experience working with customers to build graph database-backed applications as inspiration to co-author “Graph Databases in Action” by Manning.