Skip to main content

SEA DSL - Semantic Enterprise Architecture Domain Specific Language

Project description

SEA DSL

PyPI Python Versions License CI

Python bindings for the SEA DSL (Semantic Enterprise Architecture) domain-specific language. Part of the DomainForge ecosystem.

Features

  • 🏗️ Domain Primitives — Entities, Resources, Flows, Roles, Relations, Instances
  • 📐 Unit System — First-class dimensional analysis with type-safe quantities
  • Policy Engine — Constraint validation with three-valued logic
  • 🔄 DSL Parsing — Parse SEA source code into queryable graph structures
  • 🌐 CALM Integration — Export/import FINOS CALM architecture-as-code format
  • Native Performance — Rust-powered core via PyO3

Installation

pip install domainforge

Requires: Python 3.11+

Quick Start

Parse from DSL

import domainforge

source = '''
    @namespace "supply_chain"

    Entity "Warehouse" in logistics
    Entity "Factory" in manufacturing

    Resource "Cameras" units

    Flow "Cameras" from "Warehouse" to "Factory" quantity 100
'''

graph = domainforge.Graph.parse(source)

print(f"Entities: {graph.entity_count()}")
print(f"Resources: {graph.resource_count()}")
print(f"Flows: {graph.flow_count()}")

Build Programmatically

import domainforge

graph = domainforge.Graph()

# Create primitives
warehouse = domainforge.Entity("Warehouse", "logistics")
factory = domainforge.Entity("Factory", "manufacturing")
cameras = domainforge.Resource("Cameras", "units")

graph.add_entity(warehouse)
graph.add_entity(factory)
graph.add_resource(cameras)

# Create flow
flow = domainforge.Flow(
    cameras.id(),
    warehouse.id(),
    factory.id(),
    100.0
)
graph.add_flow(flow)

# Query the graph
for entity in graph.all_entities():
    print(f"{entity.name()} in {entity.namespace()}")

Work with Attributes

entity = domainforge.Entity("Warehouse")
entity.set_attribute("capacity", 10000)
entity.set_attribute("location", "New York")

print(entity.get_attribute("capacity"))   # 10000
print(entity.get_attribute("location"))   # "New York"

CALM Integration

# Export to CALM JSON
calm_json = graph.export_calm()

# Import from CALM
imported_graph = domainforge.Graph.import_calm(calm_json)

API Reference

Core Classes

Class Description
Entity Business actors, locations, organizational units (WHO)
Resource Quantifiable subjects of value (WHAT)
Flow Transfers of resources between entities
Instance Entity type instances with named fields
ResourceInstance Physical instances at entity locations
Role Roles that entities can play
Relation Relationships between roles
Graph Container with validation and query capabilities

Graph Methods

# Add primitives
graph.add_entity(entity)
graph.add_resource(resource)
graph.add_flow(flow)
graph.add_instance(instance)
graph.add_role(role)
graph.add_relation(relation)

# Counts
graph.entity_count()
graph.resource_count()
graph.flow_count()

# Lookup
graph.find_entity_by_name("Warehouse")
graph.find_resource_by_name("Cameras")

# Flow queries
graph.flows_from(entity_id)
graph.flows_to(entity_id)

# Get all
graph.all_entities()
graph.all_resources()
graph.all_flows()

# Policy evaluation
graph.add_policy(policy)
graph.evaluate_policy(policy_json)
graph.set_evaluation_mode(use_three_valued=True)

# CALM integration
graph.export_calm()
Graph.import_calm(json_str)

NamespaceRegistry

# Load workspace registry
reg = domainforge.NamespaceRegistry.from_file('.sea-registry.toml')

# Resolve files
for binding in reg.resolve_files():
    print(f"{binding.path} => {binding.namespace}")

# Query namespace for file
ns = reg.namespace_for('/path/to/file.sea')

Development

Building from Source

# Clone the repository
git clone https://github.com/GodSpeedAI/DomainForge.git
cd DomainForge

# Install maturin
pip install maturin

# Build and install in development mode
maturin develop

# Run tests
pytest tests/

Using Just (Recommended)

just python-setup    # Create venv and install deps
just python-test     # Run test suite
just python-clean    # Remove venv

Platform Support

Pre-built wheels are available for:

Platform Architectures
Linux x86_64, aarch64
macOS x86_64, arm64 (Apple Silicon)
Windows x86_64

Build from source for other platforms.

Related Packages

Package Registry Description
domainforge-core crates.io Rust core library
domainforge PyPI Python bindings (this package)
@godspeedai/domainforge npm TypeScript/Node.js bindings

Policy Authority

DomainForge includes a Policy Authority system for executable business authority:

from domainforge import AuthorityEnvironment, evaluate_authority

# Create and validate environment
env = AuthorityEnvironment(config_json)
env.validate()

# Evaluate a request
trace_json, decision_json = env.evaluate(request_json, facts_json)

# Or use the convenience function
trace, decision = evaluate_authority(config_json, request_json, facts_json)

Available types:

  • FinalDecision — Allow, Deny, Escalate, NotApplicable, Reject
  • PolicyModality — Permission, Prohibition, Obligation, Override
  • SourceClass — CallerSupplied, RuntimeObserved, SystemOfRecord, Attested, ManualApproval, Derived, UnknownSource
  • ClaimLevel — AuditBacked, Validated, FormallyProven
  • AuthorityEnvironment — Full authority evaluation environment
  • evaluate_authority() — One-shot evaluation function

Documentation

License

Apache-2.0


Part of the DomainForge project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

domainforge-0.13.0.tar.gz (351.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

domainforge-0.13.0-cp313-cp313-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.13Windows x86-64

domainforge-0.13.0-cp313-cp313-manylinux_2_34_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

domainforge-0.13.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

domainforge-0.13.0-cp313-cp313-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

domainforge-0.13.0-cp313-cp313-macosx_10_12_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

domainforge-0.13.0-cp312-cp312-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.12Windows x86-64

domainforge-0.13.0-cp312-cp312-manylinux_2_34_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

domainforge-0.13.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

domainforge-0.13.0-cp312-cp312-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

domainforge-0.13.0-cp312-cp312-macosx_10_12_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

domainforge-0.13.0-cp311-cp311-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.11Windows x86-64

domainforge-0.13.0-cp311-cp311-manylinux_2_34_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

domainforge-0.13.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

domainforge-0.13.0-cp311-cp311-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

domainforge-0.13.0-cp311-cp311-macosx_10_12_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

Details for the file domainforge-0.13.0.tar.gz.

File metadata

  • Download URL: domainforge-0.13.0.tar.gz
  • Upload date:
  • Size: 351.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.10.1

File hashes

Hashes for domainforge-0.13.0.tar.gz
Algorithm Hash digest
SHA256 57f2869510562a316c5fd32889f550205c6e8cfaf7d4074332a1f8b4835e6914
MD5 618fb20b3e75845ddf181cceda2c8437
BLAKE2b-256 a5c0acd5caeff618fee9bcd88d29caf0dac7e092e59410da334510725b41b528

See more details on using hashes here.

File details

Details for the file domainforge-0.13.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for domainforge-0.13.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8e6b49467c067eefc845456f2f425a6421df6c69bae81c535f45eae05ad0159b
MD5 458748e23ff17008018fa20e3059127f
BLAKE2b-256 a2bb86efb94ef2617247e32c483dc7912ea8cce6c4ac79a02b2b618112ff81fe

See more details on using hashes here.

File details

Details for the file domainforge-0.13.0-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for domainforge-0.13.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 b70204760a2dbea334c3b0ab307af1ad696124cf3359408db9dd6662cdee53fb
MD5 733b537fb488fbda1961d6288cf2224f
BLAKE2b-256 56f37e1db77c456e4bc1ee8043c9f4543e94108d32766cfa29181c675270dadc

See more details on using hashes here.

File details

Details for the file domainforge-0.13.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for domainforge-0.13.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f25fd852af2bf1fa9d7e285fe70b7d11c442b18fcde0c06e14b69fcf7ffb5b5b
MD5 3759c28ce1a7c6d3e74e923e7f38c999
BLAKE2b-256 f7432f26ac866593796698bbbe57600f83ca8d0699994ab04f6d94c5a8ef03cc

See more details on using hashes here.

File details

Details for the file domainforge-0.13.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for domainforge-0.13.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 95d0af6bc0b912a8524731d41132bc2569aae6972e49c9a50136d223cf38f940
MD5 b46645bd5fca8026fbe4fcdb7a47d246
BLAKE2b-256 be3831ecd9cfc81319d138f4db871d20b006d1af516af67997af054338cfb270

See more details on using hashes here.

File details

Details for the file domainforge-0.13.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for domainforge-0.13.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b6b59e6fee87606f03d7c320a8fd3e9f2cbb180062a4091100a29925175a3c35
MD5 729428278842597a4490fe642a20a62a
BLAKE2b-256 a000f70777526abd09914c171ce540a7f3adfd538217c240030055e1eb76a032

See more details on using hashes here.

File details

Details for the file domainforge-0.13.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for domainforge-0.13.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a9c08593beade0ded59760ebcc9dbb5c8f8d5dd286fce40cc1a1a20803651660
MD5 c384a64ac0938c12852fe5b731343c12
BLAKE2b-256 a7b4175241f30b4084c66817dee31cdf3dc3984999465403b3eb8a9aa80d4dfc

See more details on using hashes here.

File details

Details for the file domainforge-0.13.0-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for domainforge-0.13.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 42a2c506b3a16cd273d5647ae0524898e866f7539ef4d254d5552bb3bec9ce6f
MD5 53ae766bc7a02418bba7b6adc3dbd63c
BLAKE2b-256 cdf703c6cf6bc0acc88eb4c5efdff24f29aabbc528e0d135cad9df222f53f010

See more details on using hashes here.

File details

Details for the file domainforge-0.13.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for domainforge-0.13.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5d9052e392055a7b7b8069a1c6ea30fe1fae47009698471999bee6538250e815
MD5 3830c723eb96a44f499316019d5fc69e
BLAKE2b-256 60fd60c3d48c9b604a0df94163f579d432b82b47ab3dd7701e4788402db40e35

See more details on using hashes here.

File details

Details for the file domainforge-0.13.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for domainforge-0.13.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f8696bf548b5b3056069b5c8c8fa7c54c9264bdfde98627c62b1afbe78824d04
MD5 6bdebfcc039e217f4b7e8bfcd8d90fa8
BLAKE2b-256 8faf5c666b332ae68324d5577c8df94aaa3d72ef0238f8cfa8d5bb596f4e94d5

See more details on using hashes here.

File details

Details for the file domainforge-0.13.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for domainforge-0.13.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 61371c531e19d97aa4e41be7fa0502dd5b85df029732ba23328ee47ed5d56bc1
MD5 d77a7ead80020dbef090ec0e58f2a536
BLAKE2b-256 bfb4b28720644d780a2698ae5520c2f1161072500e040b980a248166ec536cb7

See more details on using hashes here.

File details

Details for the file domainforge-0.13.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for domainforge-0.13.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 01243b315a75c5d01e825a5b7954ca2443ef987b6ba8823b1249fc4898f73aef
MD5 467f7f33c5f69573581dbae744f415da
BLAKE2b-256 47b0c681dfca03e923885ba716f08ab724c95cc5c77f4b0907ad90e72276132f

See more details on using hashes here.

File details

Details for the file domainforge-0.13.0-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for domainforge-0.13.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 3dec9e21b4538177e40817b380d51631894c144636156e09bc589162abf1fd7e
MD5 a77aa0d9a27a28f68a5f4dce74484ccd
BLAKE2b-256 aec018e98f13ea6800b47166cc85f67ce54987e811e089a9da86df80dfb8bcac

See more details on using hashes here.

File details

Details for the file domainforge-0.13.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for domainforge-0.13.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 147ea72aa65f2e40575c9fda7cab7f9c7f4a626dc2ce26dcb87cf355986d6be8
MD5 5e072da16b4530bce63760a7ad80676e
BLAKE2b-256 066535841c834685c714c5066acb4794bc2d52cc805e1f5d88589815faa5379f

See more details on using hashes here.

File details

Details for the file domainforge-0.13.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for domainforge-0.13.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f73a8d65b8b465ae8320c8ae3ad3ce514333e6cde5cf2c19e81de6de3669290d
MD5 8eee234a6c30c424257ecf45e85411a1
BLAKE2b-256 40ea5e49406ad6c1809101cc22f55086c2ceb6d85a8f8dd70cef2401646ed4ad

See more details on using hashes here.

File details

Details for the file domainforge-0.13.0-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for domainforge-0.13.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 85d89e57c22c23162ac0c4bf63457c521464bcfc2e11f4167a9b909b98fe4645
MD5 c70131631c42249c068c64dc13f7b003
BLAKE2b-256 cac722af8e3d95597cdda44d50a9b5c06f76a69c430addb03400456135e2653e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page