Query NetworkX graphs using openCypher syntax.
Project description
nxCypher
nxCypher is an openCypher graph query language implementation written in Python, for Python data structures. Originally forked from GrandCypher.
pip install nxcypher
You likely already know openCypher from the Neo4j Graph Database. Use it with your favorite graph libraries in Python!
Usage
Example Usage with NetworkX:
from nxcypher import NXCypher
import networkx as nx
NXCypher(nx.karate_club_graph()).run("""
MATCH (A)-[]->(B)
MATCH (B)-[]->(C)
WHERE A.club == "Mr. Hi"
RETURN A.club, B.club
""")
See examples.md for more!
Feature Parity
| Feature | Support |
|---|---|
Multiple MATCH clauses |
✅ |
WHERE-clause filtering on nodes |
✅ |
Anonymous -[]- edges |
✅ |
LIMIT |
✅ |
SKIP |
✅ |
Node/edge attributes with {} syntax |
✅ |
WHERE-clause filtering on edges |
✅ |
Named -[]- edges |
✅ |
Chained ()-[]->()-[]->() edges |
✅ |
Backwards ()<-[]-() edges |
✅ |
Anonymous () nodes |
✅ |
Undirected ()-[]-() edges |
✅ |
Boolean Arithmetic (AND/OR) |
✅ |
(:Type) node-labels |
✅ |
[:Type] edge-labels |
✅ |
DISTINCT |
✅ |
ORDER BY |
✅ |
IN |
✅ |
Aggregation functions (COUNT, SUM, MIN, MAX, AVG) |
✅ |
COUNT(*) aggregate |
✅ |
DISTINCT in aggregates (COUNT(DISTINCT x)) |
✅ |
COLLECT() aggregation |
✅ |
Aliasing of returned entities (return X as Y) |
✅ |
Negated edges (WHERE NOT (a)-->(b)) |
✅ |
OPTIONAL MATCH |
✅ |
Multiple independent OPTIONAL MATCH |
✅ |
WITH clause |
✅ |
UNWIND clause |
✅ |
Graph mutations (CREATE, SET, DELETE, DETACH DELETE) |
✅ |
REMOVE clause |
✅ |
MERGE clause with ON CREATE/ON MATCH |
✅ |
String functions (toLower, toUpper, trim) |
✅ |
List functions (size, head, tail) |
✅ |
Type functions (type, labels, keys) |
✅ |
CASE expressions (searched and simple) |
✅ |
UNION / UNION ALL |
✅ |
| List comprehensions | ✅ |
| ✅ = Supported | 🛣 = On Roadmap | 🥺 = Help Welcome | 🔴 = Not Planned |
Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines, including the DCO sign-off requirement.
License
nxCypher is licensed under the Apache License 2.0.
This project implements the openCypher query language. Cypher is a registered trademark of Neo4j, Inc. This project is not affiliated with or endorsed by Neo4j, Inc.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nxcypher-1.1.4.tar.gz.
File metadata
- Download URL: nxcypher-1.1.4.tar.gz
- Upload date:
- Size: 795.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a551ac2d2181b8bf32db5715eb47ece37bfbcd81d42f72fd68d20e075f8c30a
|
|
| MD5 |
5d28afafaee46e3446abdcd0cfd852af
|
|
| BLAKE2b-256 |
421b0fd8a8fd793f3e1c636e0d51d4dba5b696ffe40b0de70704c104a68104e4
|
File details
Details for the file nxcypher-1.1.4-py3-none-any.whl.
File metadata
- Download URL: nxcypher-1.1.4-py3-none-any.whl
- Upload date:
- Size: 236.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d138f75a9b9427483a45a043dd3e634ca798e6103cca31fb1a1b7a287cd53b9d
|
|
| MD5 |
cb63bf0042e3446f05be62dc67a033aa
|
|
| BLAKE2b-256 |
5c7cc9c70d4262aba06020af81442b11192ab7d182fa3c955ca695bc11ed0f16
|