Semantics registry (predicates/types) for AbstractFramework.
Project description
AbstractSemantics (abstractsemantics)
Central, editable semantics registry (predicates + entity types) for AbstractFramework, with helpers to build a compact JSON Schema for knowledge-graph (KG) assertion structured outputs.
This package intentionally contains definitions, not storage:
- prefix mappings (CURIE namespaces)
- predicate allowlists (optional inverse pointers)
- entity-type allowlists
Status
Small, dependency-light package (only PyYAML) with a tiny public API:
- the default registry is shipped as package data (
abstractsemantics/semantics.yaml; in this repo:src/abstractsemantics/semantics.yaml) - the loader returns immutable dataclasses (
SemanticsRegistry) - the v0 schema builder produces a deterministic JSON Schema dict
Install
From PyPI:
pip install abstractsemantics
From source (editable, with test deps):
pip install -e ".[dev]"
Requires Python >=3.10 (see pyproject.toml).
Quickstart
Load the default registry and build the v0 structured-output schema:
from abstractsemantics import load_semantics_registry, build_kg_assertion_schema_v0
reg = load_semantics_registry()
print(len(reg.predicates), len(reg.entity_types))
schema = build_kg_assertion_schema_v0(registry=reg, include_predicate_aliases=True)
Use a custom registry YAML (must exist on disk):
export ABSTRACTSEMANTICS_REGISTRY_PATH=/absolute/path/to/semantics.yaml
from abstractsemantics import load_semantics_registry
reg = load_semantics_registry() # loads from ABSTRACTSEMANTICS_REGISTRY_PATH if set
Note: load_semantics_registry() only requires at least 1 predicate, but build_kg_assertion_schema_v0() requires both predicate ids and entity-type ids (it raises ValueError if entity_types is empty).
Intended consumers (external)
This package is designed to be consumed by:
- AbstractRuntime (validation at ingestion boundary)
- AbstractFlow (UI dropdowns + authoring support)
- AbstractMemory (storage/query on top of validated semantics)
Documentation
Start with:
docs/getting-started.md(recommended entrypoint)docs/README.md(documentation index)docs/architecture.md(what exists in this repo, with diagrams)docs/registry.md(registry YAML format)docs/schema.md(KG assertion JSON Schema +$ref)docs/faq.md(common questions and troubleshooting)
Project
- Changelog:
CHANGELOD.md - Contributing:
CONTRIBUTING.md - Security:
SECURITY.md - Acknowledgments:
ACKNOWLEDMENTS.md
License
MIT (see LICENSE).
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 abstractsemantics-0.0.2.tar.gz.
File metadata
- Download URL: abstractsemantics-0.0.2.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43c6423cfa893b342063ed77e713750541f28899d3ef508f4447350630ab0afa
|
|
| MD5 |
97dce91ea7913812c41e17f7dca04ccf
|
|
| BLAKE2b-256 |
8286f1141a38c71d64b556a96bab8f4992b4012e9d38eb1eea5728fc8f334050
|
File details
Details for the file abstractsemantics-0.0.2-py3-none-any.whl.
File metadata
- Download URL: abstractsemantics-0.0.2-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
198132545d67adad889f64f5cd001b3a883b6c078a8171351036d0690005486b
|
|
| MD5 |
4b5445fe1e81526dd4f2f7a73660c8b7
|
|
| BLAKE2b-256 |
a9dd0bc0e7f8374982fdc5f5389dd7111f0dfac599b0db3063083416f87272c8
|