Bidirectional converter between Prolog and DMN (Decision Model and Notation)
Project description
DMN-Prolog Bidirectional Converter
A Python tool for bidirectional conversion between Prolog code and DMN (Decision Model and Notation) for legal/business rule management.
Overview
This tool enables a powerful workflow for converting legal documents into executable decision logic:
Legal Document → LLM → Prolog → DMN → Review → Deploy (Prolog or DMN)
↑ ↓
└────────────────┘
(Bidirectional)
Why this approach?
- LLM-Friendly Input: Prolog syntax is simpler and more reliable for LLMs to generate than verbose DMN XML
- Human-Friendly Review: DMN provides visual decision tables that legal/business specialists can review
- Flexible Deployment: Deploy as either Prolog (for Prolog engines) or DMN (for DMN engines)
- Quality Control: Bidirectional conversion ensures consistency and reduces hallucination
Supported Prolog Subset
To ensure DMN compatibility, the converter supports a restricted Prolog subset:
- ✓ Horn clauses only (no negation-as-failure, no cuts)
- ✓ Deterministic rules (single output per input combination)
- ✓ Simple data types (atoms, numbers, strings, booleans)
- ✓ Decision table structure (pattern-matching rules)
- ✓ Limited recursion (≤ 3 levels)
- ✓ FEEL expression compatibility (comparison operators:
>=,=<,>,<,==,\=)
Installation
# Basic installation (conversion only)
pip install dmn-prolog-converter
# With validation support
pip install dmn-prolog-converter[validation]
# With all optional features
pip install dmn-prolog-converter[execution]
See CDMN_INTEGRATION.md for details.
Quick Start
Command Line
After installation, you'll have these commands available:
dmn-prolog # Main CLI tool with subcommands
prolog2dmn # Quick shortcut: Prolog → DMN
dmn2prolog # Quick shortcut: DMN → Prolog
z32dmn # Quick shortcut: Z3 → DMN
dmn2z3 # Quick shortcut: DMN → Z3
Example usage
# Convert Prolog to DMN
dmn-prolog convert rules.pl rules.dmn
# Convert DMN to Prolog
dmn-prolog convert rules.dmn rules.pl
# Validate DMN
dmn-prolog validate rules.dmn
# Show file info
dmn-prolog info rules.pl
dmn-prolog info rules.smt2
# Quick shortcuts
prolog2dmn input.pl output.dmn
dmn2prolog input.dmn output.pl
z32dmn input.smt2 output.dmn
dmn2z3 input.dmn output.smt2
See CLI_GUIDE.md for complete CLI documentation.
Limitations & Future Work
Current Limitations:
- No support for complex Prolog features (cuts, negation-as-failure, DCGs)
- Limited to decision tables (no decision requirement diagrams)
- No support for DMN business knowledge models or contexts
- Arithmetic expressions are basic
Future Enhancements:
- Support for DMN FEEL functions
- Decision requirement diagram generation
- Semantic validation of business logic
- Integration with LLM for natural language descriptions
- Support for more complex Prolog constructs (via approximation)
- Visual DMN table editor integration
Use Cases
- Legal Document Automation: Convert legal rules to executable format
- Business Rule Management: Maintain rules in both technical and business-friendly formats
- Legacy Migration: Migrate Prolog expert systems to DMN standard
- LLM-Powered Rule Generation: Let LLMs generate Prolog, convert to DMN for review
- Dual Deployment: Maintain single source, deploy to both Prolog and DMN engines
Contributing
Contributions welcome! Areas for improvement:
- Additional test cases
- Support for more Prolog patterns
- Enhanced FEEL expression generation
- Documentation improvements
License
MIT License - see LICENSE file for details
References
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 dmn_prolog_converter-1.0.1.tar.gz.
File metadata
- Download URL: dmn_prolog_converter-1.0.1.tar.gz
- Upload date:
- Size: 31.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83ae4100bdba041cd095d5976164d0b3145747acba68ac4a2a9d4b140fa6feae
|
|
| MD5 |
9cd722039603408f5a7cef3bfc59e023
|
|
| BLAKE2b-256 |
fad21bfd2219d170a725701e3df4754a1d265489fd9b203d5f0ac509f0f5354f
|
Provenance
The following attestation bundles were made for dmn_prolog_converter-1.0.1.tar.gz:
Publisher:
python-publish.yml on NewJerseyStyle/dmn_prolog_converter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dmn_prolog_converter-1.0.1.tar.gz -
Subject digest:
83ae4100bdba041cd095d5976164d0b3145747acba68ac4a2a9d4b140fa6feae - Sigstore transparency entry: 969503067
- Sigstore integration time:
-
Permalink:
NewJerseyStyle/dmn_prolog_converter@bd4ba39dd1b49bed910d6cdd4fb592c258c03438 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/NewJerseyStyle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@bd4ba39dd1b49bed910d6cdd4fb592c258c03438 -
Trigger Event:
release
-
Statement type:
File details
Details for the file dmn_prolog_converter-1.0.1-py3-none-any.whl.
File metadata
- Download URL: dmn_prolog_converter-1.0.1-py3-none-any.whl
- Upload date:
- Size: 32.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46ce95bc5f5a174d350b0124ad061acdfbf99ce496c9f234197c1af5fca94148
|
|
| MD5 |
170e90175629fe8071178669bafcdcf1
|
|
| BLAKE2b-256 |
5f89544397f98d7eb93775da536b4fba1880d13090931ffb17b61c1e0c2780c8
|
Provenance
The following attestation bundles were made for dmn_prolog_converter-1.0.1-py3-none-any.whl:
Publisher:
python-publish.yml on NewJerseyStyle/dmn_prolog_converter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dmn_prolog_converter-1.0.1-py3-none-any.whl -
Subject digest:
46ce95bc5f5a174d350b0124ad061acdfbf99ce496c9f234197c1af5fca94148 - Sigstore transparency entry: 969503070
- Sigstore integration time:
-
Permalink:
NewJerseyStyle/dmn_prolog_converter@bd4ba39dd1b49bed910d6cdd4fb592c258c03438 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/NewJerseyStyle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@bd4ba39dd1b49bed910d6cdd4fb592c258c03438 -
Trigger Event:
release
-
Statement type: