DPO graph rewriting core for graph databases.
Project description
dpo-rewrite
Minimal DPO graph rewriting core for graph workflows and graph databases.
Scope
- DPO rule representation (
left,interface,right, optionalnac) - JSON import and schema validation
- Application to nx.MultiDiGraph
- Cypher export for graph database execution
Install
Available on PyPI:
pip install dpo-rewrite
Usage
from dpo_rewrite import load_rule, to_cypher, validate
payload = {
"left": {
"nodes": [{"id": "a", "label": "Node", "props": {"id": "A"}}],
"edges": [],
},
"interface": {
"nodes": [{"id": "a", "label": "Node", "props": {"id": "A"}}],
"edges": [],
},
"right": {
"nodes": [
{"id": "a", "label": "Node", "props": {"id": "A"}},
{"id": "b", "label": "Node", "props": {"id": "B"}},
],
"edges": [{"source": "a", "target": "b", "type": "LINKS_TO"}],
},
}
validate(payload)
rule = load_rule(payload)
cypher = to_cypher(rule)
print(cypher.query)
print(cypher.params)
Sample Script
See examples/ for a minimal end-to-end examples.
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
dpo_rewrite-0.1.3.tar.gz
(16.5 kB
view details)
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 dpo_rewrite-0.1.3.tar.gz.
File metadata
- Download URL: dpo_rewrite-0.1.3.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d468ffba643eed0c214c496e3e3b3f36653189b6a3b62e18cbb7e1115d2e5b77
|
|
| MD5 |
bd068082c291f50fe11a862c8ac8961b
|
|
| BLAKE2b-256 |
91324fd94bdcc7ec0c3e2595ca86cf9dd92e2f110844287a57d5d95328176f08
|
File details
Details for the file dpo_rewrite-0.1.3-py3-none-any.whl.
File metadata
- Download URL: dpo_rewrite-0.1.3-py3-none-any.whl
- Upload date:
- Size: 15.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04a9da8f0df41d10bdbdac0a7ab0d4cfa27f75e3fd2f616440ae269a03765eb6
|
|
| MD5 |
1cb8a149540e4e09ec4050b89a8c2a0b
|
|
| BLAKE2b-256 |
32ebd0651dde924820f444aecf3686de877ceb4c3c42f6600d893e09eb48a822
|