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
AbstractFramework ecosystem
abstractsemantics is a small, standalone building block within the wider AbstractFramework ecosystem:
- AbstractFramework (umbrella): https://github.com/lpalbou/AbstractFramework
- AbstractCore (core primitives/contracts): https://github.com/lpalbou/abstractcore
- AbstractRuntime (execution + ingestion boundary): https://github.com/lpalbou/abstractruntime
In practice, this repo provides the shared allowed ids (predicates and entity types) and a small JSON Schema helper that downstream components (including runtimes) can use for validation and structured outputs.
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
This package makes no network calls and does not store/query data (see src/abstractsemantics/registry.py and src/abstractsemantics/schema.py).
Install
From PyPI:
pip install abstractsemantics
From source (editable, with test deps):
pip install -e ".[dev]"
Requires Python >=3.10 (see pyproject.toml).
For framework-wide dependency manifests, the no-op compatibility extras
abstractsemantics[apple], abstractsemantics[gpu],
abstractsemantics[all-apple], and abstractsemantics[all-gpu] are available.
They do not add dependencies because this package owns semantics definitions,
not hardware runtimes.
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)
Resolve a stable $ref (useful when a downstream system stores schema references rather than full dicts):
from abstractsemantics import KG_ASSERTION_SCHEMA_REF_V0, resolve_schema_ref
schema = resolve_schema_ref({"$ref": KG_ASSERTION_SCHEMA_REF_V0})
assert isinstance(schema, dict)
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).
Diagram (registry → schema → consumers)
flowchart LR
YAML[src/abstractsemantics/semantics.yaml] --> Loader[load_semantics_registry()]
Loader --> Reg[SemanticsRegistry]
Reg --> Builder[build_kg_assertion_schema_v0()]
Builder --> Schema[JSON Schema dict]
Schema --> Consumers[AbstractRuntime / other consumers]
Intended consumers (external)
Typical consumers include:
- AbstractRuntime (ingestion-boundary validation and structured-output contracts)
- authoring tools/UIs (dropdowns and semantic pickers backed by the registry)
- ingestion pipelines and storage/query layers that want a shared, explicit allowlist of ids
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:
CHANGELOG.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.4.tar.gz.
File metadata
- Download URL: abstractsemantics-0.0.4.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8d6c5730dbdec3986b625cb1606f28402b5ea46650f3d53dabad3a69a64f6b2
|
|
| MD5 |
ad3d0077018b17cee9744fa68f6d6811
|
|
| BLAKE2b-256 |
47f70bb8c9661ca39a283c53eeb1d8b0fd44ba0d2be1316fc46e095315eb6cfd
|
Provenance
The following attestation bundles were made for abstractsemantics-0.0.4.tar.gz:
Publisher:
release.yml on lpalbou/AbstractSemantics
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
abstractsemantics-0.0.4.tar.gz -
Subject digest:
a8d6c5730dbdec3986b625cb1606f28402b5ea46650f3d53dabad3a69a64f6b2 - Sigstore transparency entry: 1479057102
- Sigstore integration time:
-
Permalink:
lpalbou/AbstractSemantics@36afe5e4d0f03e29377992aef5afad1a3c7ba312 -
Branch / Tag:
refs/tags/v0.0.4 - Owner: https://github.com/lpalbou
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@36afe5e4d0f03e29377992aef5afad1a3c7ba312 -
Trigger Event:
push
-
Statement type:
File details
Details for the file abstractsemantics-0.0.4-py3-none-any.whl.
File metadata
- Download URL: abstractsemantics-0.0.4-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f86e47107e261464f4ee88fbf43dfc4b1a0caf8c522a92c95ca80c64d2d1e5a
|
|
| MD5 |
074a2e3f748c51b82ab97a4d4cd0f594
|
|
| BLAKE2b-256 |
ddb3c54ac877bfedce583ea6234d0bc6eee4340927095b68b0a623f8f7ddc5f4
|
Provenance
The following attestation bundles were made for abstractsemantics-0.0.4-py3-none-any.whl:
Publisher:
release.yml on lpalbou/AbstractSemantics
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
abstractsemantics-0.0.4-py3-none-any.whl -
Subject digest:
2f86e47107e261464f4ee88fbf43dfc4b1a0caf8c522a92c95ca80c64d2d1e5a - Sigstore transparency entry: 1479057280
- Sigstore integration time:
-
Permalink:
lpalbou/AbstractSemantics@36afe5e4d0f03e29377992aef5afad1a3c7ba312 -
Branch / Tag:
refs/tags/v0.0.4 - Owner: https://github.com/lpalbou
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@36afe5e4d0f03e29377992aef5afad1a3c7ba312 -
Trigger Event:
push
-
Statement type: