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
- Cypher export for graph database execution
Install
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/simple_rule.py for a minimal end-to-end example.
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.1.tar.gz
(16.4 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.1.tar.gz.
File metadata
- Download URL: dpo_rewrite-0.1.1.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf8e6b5e8601a14f3c8d55d49cf5a8a85fd8c5ea0aaa74cc951632d663b695eb
|
|
| MD5 |
ba7d59010b77630d242b0055f99a2507
|
|
| BLAKE2b-256 |
d87cca5ffd7874313d5a6f078203a15689f205f79c0a13408e378775c993f84e
|
File details
Details for the file dpo_rewrite-0.1.1-py3-none-any.whl.
File metadata
- Download URL: dpo_rewrite-0.1.1-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 |
26e06d38aa32a1cf7c051f4d85404016d4763ecb6c33bc1e1ba6882d6e4ab5ee
|
|
| MD5 |
b798d3fe011ac3bf0b2daf64c668f5de
|
|
| BLAKE2b-256 |
fef24a3eeba9972e33e723cdaadd0f7b54868f57e520ab9e7fdd880e808b2025
|