All Projects → opencypher → Cypher For Gremlin

opencypher / Cypher For Gremlin

Licence: other
Cypher for Gremlin adds Cypher support to any Gremlin graph database.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Cypher For Gremlin

Exram.gremlinq
A .NET object-graph-mapper for Apache TinkerPop™ Gremlin enabled databases.
Stars: ✭ 84 (-68.54%)
Mutual labels:  graph, gremlin, tinkerpop
Ogre
Clojure library for querying Apache TinkerPop graphs
Stars: ✭ 118 (-55.81%)
Mutual labels:  graph, gremlin, tinkerpop
Tinkerpop
Apache TinkerPop - a graph computing framework
Stars: ✭ 1,309 (+390.26%)
Mutual labels:  graph, gremlin, tinkerpop
Unipop
Data Integration Graph
Stars: ✭ 184 (-31.09%)
Mutual labels:  graph, gremlin, tinkerpop
janusgraph-docker
Yet another JanusGraph, Cassandra/Scylla and Elasticsearch in Docker Compose setup
Stars: ✭ 54 (-79.78%)
Mutual labels:  gremlin, tinkerpop, cypher
Janusgraph
JanusGraph: an open-source, distributed graph database
Stars: ✭ 4,277 (+1501.87%)
Mutual labels:  graph, gremlin, tinkerpop
Neo4j
Graphs for Everyone
Stars: ✭ 9,582 (+3488.76%)
Mutual labels:  graph, cypher
English2cypher
A model to transform english into Cypher queries, based off the CLEVR-graph dataset
Stars: ✭ 54 (-79.78%)
Mutual labels:  graph, cypher
Redisgraph
A graph database as a Redis module
Stars: ✭ 1,292 (+383.9%)
Mutual labels:  graph, cypher
Neo4j 3d Force Graph
Experiments with Neo4j & 3d-force-graph https://github.com/vasturiano/3d-force-graph
Stars: ✭ 159 (-40.45%)
Mutual labels:  graph, cypher
Neo4j Helm
Helm Charts for running Neo4j on Kubernetes
Stars: ✭ 43 (-83.9%)
Mutual labels:  graph, cypher
Movies Javascript Bolt
Neo4j Movies Example with webpack-in-browser app using the neo4j-javascript-driver
Stars: ✭ 123 (-53.93%)
Mutual labels:  graph, cypher
Movies Python Bolt
Neo4j Movies Example application with Flask backend using the neo4j-python-driver
Stars: ✭ 197 (-26.22%)
Mutual labels:  graph, cypher
Movies Java Bolt
Neo4j Movies Example application with SparkJava backend using the neo4j-java-driver
Stars: ✭ 66 (-75.28%)
Mutual labels:  graph, cypher
gizmo
OGM
Stars: ✭ 20 (-92.51%)
Mutual labels:  gremlin, tinkerpop
jelass
Janus + Elastic Search + Cassandra docker container with SSL Client Certificates implemented.
Stars: ✭ 13 (-95.13%)
Mutual labels:  gremlin, tinkerpop
gremtune
Golang Gremlin Tinkerpop client with AWS Neptune compatibility
Stars: ✭ 23 (-91.39%)
Mutual labels:  gremlin, tinkerpop
Opencypher
Specification of the Cypher property graph query language
Stars: ✭ 534 (+100%)
Mutual labels:  graph, cypher
Ingraph
Incremental view maintenance for openCypher graph queries.
Stars: ✭ 40 (-85.02%)
Mutual labels:  graph, cypher
Graph Notebook
Library extending Jupyter notebooks to integrate with Apache TinkerPop and RDF SPARQL.
Stars: ✭ 199 (-25.47%)
Mutual labels:  graph, gremlin

Cypher for Gremlin

CircleCI Maven Central

Cypher for Gremlin is a toolkit for users of Apache TinkerPop™ that allows querying Gremlin databases with Cypher, the industry's most widely used property graph query language defined and maintained by the openCypher project.

Cypher query is translated to one of Gremlin representations (Gremlin Groovy string, Traversal object or Gremlin bytecode):

Table of Contents

Overview

Highlights

Gremlin Console Plugin

Gremlin Console plugin that enables client-side translation of Cypher queries or communication with a Cypher-enabled Gremlin Server (click to play/view source):

Gremlin Server Client

Gremlin Server client wrapper that can send Cypher queries to a Cypher-enabled Gremlin Server or translate Cypher queries to Gremlin on client side, and send translated query to servers:

String cypher = "MATCH (p:person) WHERE p.age > 25 RETURN p.name";

Cluster cluster = Cluster.open(configuration);
Client gremlinClient = cluster.connect();

// Server has Gremlin Server plugin installed
// Send Cypher to server
CypherGremlinClient cypherGremlinClient = CypherGremlinClient.plugin(gremlinClient);
List<Map<String, Object>> cypherResults = cypherGremlinClient.submit(cypher).all();

// Client side translation
// Send Gremlin to server
CypherGremlinClient translatingGremlinClient = CypherGremlinClient.translating(gremlinClient);
List<Map<String, Object>> gremlinResults = translatingGremlinClient.submit(cypher).all();

assertThat(cypherResults).isEqualTo(gremlinResults);

Gremlin Neo4j Driver

Implementation of Neo4j API interfaces for users familiar with Neo4j:

Driver driver = GremlinDatabase.driver(uri);

try (Session session = driver.session()) {
    StatementResult result = session.run("MATCH (n) RETURN count(n) as count");
    int n = result.single().get("count").asInt();

    assertThat(n).isEqualTo(0); // 0
}

Gremlin Server Plugin

Gremlin Server plugin that enables Cypher query processing on Gremlin Server. For example connect using Gremlin-JavaScript 3.4.2+ by setting processor to cypher:

// npm install [email protected]

const gremlin = require('gremlin');
const client = new gremlin.driver.Client('ws://localhost:8182/gremlin', { traversalSource: 'g', processor: 'cypher'});
const cypherQuery = 'MATCH (n) RETURN n.name'

const results = await client.submit(cypherQuery);

for (const result of results) {
  console.log(result);
}

See examples for Gremlin-Java, Gremlin-Groovy, Gremlin-Python and Gremlin.Net

Cypher Traversal Source

For Gremlin Console Plugin and Gremlin Server Client its possible to combine Cypher and Gremlin in single query. Traversal can start with cypher step that allows to run Cypher query (which will be translated to Gremlin and works withRemote) then continue traversal using other Gremlin steps:

CypherTraversalSource g = graph.traversal(CypherTraversalSource.class);

GraphTraversal<Map<String, Object>, String> query = g
    .cypher("MATCH (n) RETURN n")
    .select("n")
    .outE()
    .label()
    .dedup();

Quick Start

  1. Run Docker images
  2. Start experimenting with Cypher for Gremlin with the Gremlin Console Cypher plugin. Follow the link for installation and usage instructions.
  3. For API usage take a look at the Cypher for Gremlin Demo project.

Toolkit

The toolkit is composed of:

Language Support

With Cypher for Gremlin you can use the following Cypher language features:

  • MATCH and OPTIONAL MATCH
  • WHERE, ORDER BY, SKIP, and LIMIT sub-clauses
  • RETURN, WITH, and UNWIND projections, including basic support for list and path comprehensions
  • CREATE, MERGE, SET, REMOVE, and (DETACH) DELETE
  • CASE expressions
  • UNION (ALL) operations
  • CALL procedures

It is not guaranteed that all instances and combinations of the listed features will work. However, in addition to integration tests, correctness of translation is verified by the Cypher Technology Compatibility Kit (TCK). The TCK is an openCypher artifact and contains a comprehensive set of test scenarios validating different features of the Cypher language.

Coverage of TCK M13 (excluding Temporal Types) on TinkerGraph:

  • 75% of the scenarios are supported with common Gremlin steps
  • Additional 15% with extensions to Gremlin to enable full support for Cypher functionality
  • See latest TCK Report for a detailed overview of language coverage.

You are very welcome to report any issues with the translation that you encounter.

Gremlin Implementations

Cypher for Gremlin is tested on following Gremlin implementations:

Each Gremlin implementation has its own level of Gremlin support and Gremlin step implementation specifics. In some cases, queries need to be adapted for target implementation using flavor.

Because of these specifics, Cypher support varies on different implementations. Refer to wiki for more details.

Related

Implementation

The translation process uses a reasonably sophisticated and flexible approach. Cypher query is parsed by the openCypher Frontend and translated to an internal representation by the Cypher for Gremlin. The internal representation is transformed by a set of rewriters to adapt the query for system specifics of different Gremlin implementations (JanusGraph, Cosmos DB, AWS Neptune), then converted to one of Gremlin representations (Gremlin Groovy string, Traversal object or Gremlin bytecode).

See also How to implement new Cypher feature?

Development

To build and run Cypher for Gremlin you need Java 8. The project is built using Gradle or the provided wrapper.

To build and run unit and integration tests:

./gradlew build

To automatically fix formatting errors in your changes:

./gradlew spotlessApply

How to contribute

We would love to find out about any issues you encounter and are happy to accept contributions following a Contributors License Agreement (CLA) signature as per the process outlined in our contribution guidelines.

License

The project is licensed under the Apache Software License, Version 2.0

Copyright

© Copyright 2018-2019 Neo4j, Inc.

Apache TinkerPop™, TinkerPop, and Apache are registered trademarks of the Apache Software Foundation.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].