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)
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.14.0.tar.gz (533.5 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.14.0-cp313-cp313-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.13Windows x86-64

domainforge-0.14.0-cp313-cp313-manylinux_2_34_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

domainforge-0.14.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

domainforge-0.14.0-cp313-cp313-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

domainforge-0.14.0-cp313-cp313-macosx_10_12_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

domainforge-0.14.0-cp312-cp312-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.12Windows x86-64

domainforge-0.14.0-cp312-cp312-manylinux_2_34_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

domainforge-0.14.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

domainforge-0.14.0-cp312-cp312-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

domainforge-0.14.0-cp312-cp312-macosx_10_12_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

domainforge-0.14.0-cp311-cp311-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.11Windows x86-64

domainforge-0.14.0-cp311-cp311-manylinux_2_34_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

domainforge-0.14.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

domainforge-0.14.0-cp311-cp311-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

domainforge-0.14.0-cp311-cp311-macosx_10_12_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for domainforge-0.14.0.tar.gz
Algorithm Hash digest
SHA256 0273736a7578c9ec10d7ccd5403b3edd50c6c48139f80e98208545fd123ff8b7
MD5 12a98d29e766a6fe7202ef2fdaf33627
BLAKE2b-256 2aa411c09e467bf1f0b2921021ba9ef8332d4399eb19b9d46087d04f708a72ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for domainforge-0.14.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ad6fb3c0479332006b5de6b2bf535ce7a3175742f6f61e4b756339e94ba17350
MD5 5ea60b655003ab5a45769e6332028280
BLAKE2b-256 20bddbb0a560b792808c6816a4311fe79a6bd5b68d0225fa9f95d0991da2f932

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for domainforge-0.14.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 1848740974791e2cefa6e3e9ffad7aa123c22d4825b81d55ce91ff5bb579a4bb
MD5 f78d6dfc84ed0b5cbe471300983b695c
BLAKE2b-256 a098a409d4b405e3e8d37b03202ef6e6d49dbf8fb9c8e3083330d875d5821786

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for domainforge-0.14.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8a2778f48a780337ef7dccdee776e5507c62c567011c3923029d7505b004b2bf
MD5 fb47e2431d145cf9db426a5836924aac
BLAKE2b-256 00408741f33c07ceb3daaa354301385febc4e11cecaa1ef280c984c23836ec31

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for domainforge-0.14.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0bc4637fa9e46da07c6d6480cbd50eca5b44689e14762d173e7f0c1ee5a5e49d
MD5 56ee3b16df0fb9f6ef3dc4d134f66d1b
BLAKE2b-256 632035c257fe04e2a20636caf21bb8e4ff5704db38e561d2360126b2065205d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for domainforge-0.14.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0961caed6dded8c0b8c12e45edd29b35b361d3bd0726f3e938a63a72cfe05689
MD5 bb9e5f0d9941c1ee881f82a89d486660
BLAKE2b-256 07d61ea59b0296a4083aecb6859eb76ef56686f143f554d4ad47a16b0ebd156a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for domainforge-0.14.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 52ecdd678485898acf81977094dd0ec7039ad8b69423a32296d9df617fdc4df1
MD5 461197cd056578496bb0e4b17534c3fc
BLAKE2b-256 db95a40442adf34389c43cf27fa751a120a30cc4d302ea4fdb5a8054f3c8b64e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for domainforge-0.14.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 1f3789857b97de9f88001d3afe15be65472328a0fd5a3f5a6b5ae201c59e02f8
MD5 8340db67332f8abe182aaab02dc915e5
BLAKE2b-256 16dc7736bcdb85a7bd28d48129163d627985fd01fab4bacc07123d351dd2d5c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for domainforge-0.14.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4cd6e16ed4d4651033e405f39489fa7446d4a27eed377bd23e07ddb065844efa
MD5 54d4de971ff2b5cfda4602a0a70b6835
BLAKE2b-256 18e3c850b82761f0cc52f2c4c0218e84b2eca9d1237484995d8c1d9614e6ea8b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for domainforge-0.14.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0d15f40bbb8b05945751f2a6bbe0b2f836931d2faaf8464b85651716e3ce6ace
MD5 1728245558a6f969cb3cb44fc3d6d459
BLAKE2b-256 d6b63ac8603383a455fa904f8975ae9f38e70ccc61cf403778ab95799d475990

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for domainforge-0.14.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e9a77b098237d6ba7b09f47bacab8bf326669bdddc37affd64b4be8b23bf2666
MD5 1b8e577d2b0a84a31c8e93633e6be288
BLAKE2b-256 3eaf7f914ef5e409e9ac3b08e41ed76471ba7c1ec5456b38103f5611b90af0a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for domainforge-0.14.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 3e487760fcba57466850f71f4064a49665d3d24a9119f72b15c4c5ee27dc7739
MD5 f41b4897fbb290d32f05fcf7884ce80d
BLAKE2b-256 d4268abac6a54ab74fb868e2b417203cfbce24df7c687f5fa876c7701f5dd9c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for domainforge-0.14.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 db48c1e3f9325057b55bb0671fa3da7ef11fbc1beb7e030288acd22ad15f448b
MD5 5a7495ee05aabb3ada31587cf03c4c32
BLAKE2b-256 0e351eee970c0ca4052befb9b03e398e736d0c0f9af6b13e0f62d2ae671aa908

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for domainforge-0.14.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 50b91965450ceb4cb56047dcbc44556bf4b9eeef404541ad3c410813c3dca04d
MD5 f945066c69a6c9dff935964b6a8c95ee
BLAKE2b-256 97670b27940cb6602f8bf49c1d331b15877bd88bf43bffc28f21eb4a9fc97e0c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for domainforge-0.14.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 691416efc1a6cdd61497f4350937a2488f63ff0013a52bbc28d9855eaea7b793
MD5 2ca7281f35f7c08bfa5071755d0b7084
BLAKE2b-256 65c83fca929e946b8bb00a5167951f825b96209563544a690739543ba100b544

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for domainforge-0.14.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 da887b143d920091ef27aa36e2ac600a605d94b413803d0d1bceaa2fc6a389c8
MD5 4ffe6b7473a40fbbc4f6853917eec6ea
BLAKE2b-256 c778aa852de6dd89397e4d87d7fc2119414b41c721f780b8043422729a670342

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