OGC Blocks client
Project description
bblocks-client
A Python client library for working with OGC Blocks registers.
OGC Blocks are reusable specification components that support validation, semantic annotation via JSON-LD, and federation across distributed registers.
Installation
pip install bblocks_client
Optional extras for validation and semantic uplift:
# JSON Schema validation
pip install bblocks_client[jsonschema]
# SHACL validation and semantic uplift (RDF/JSON-LD)
pip install bblocks_client[rdf]
# All extras
pip install bblocks_client[all]
Usage
Loading a register
from ogc.bblocks.register import load_register
register = load_register("https://example.org/bblocks/register.json")
# Look up a block by identifier
bblock = register.get_item_summary("my.org.bblock-id")
Imported registers (dependencies) are loaded automatically. Pass load_dependencies=False to skip this.
Accessing block metadata
get_item_summary() returns a BuildingBlockSummary with lightweight metadata.
get_item_full() fetches the full BuildingBlock, including examples and semantic uplift configuration.
bblock = register.get_item_full("my.org.bblock-id")
print(bblock.name)
print(bblock.status) # Status enum: stable, experimental, etc.
print(bblock.depends_on) # Set of dependency identifiers
print(bblock.ld_context) # URL to JSON-LD context
print(bblock.schema) # Dict of media-type -> schema URL
JSON Schema validation
Requires bblocks_client[jsonschema].
from ogc.bblocks.validate import validate_json
result = validate_json(bblock, {"type": "Feature", ...})
if not result.valid:
print(result.exception)
# Or raise directly:
result.raise_for_invalid()
SHACL validation
Requires bblocks_client[rdf].
from rdflib import Graph
from ogc.bblocks.validate import validate_shacl
graph = Graph().parse("data.ttl")
result = validate_shacl(bblock, graph)
print(result.report)
result.raise_for_invalid()
Semantic uplift (JSON to RDF)
Requires bblocks_client[rdf].
from ogc.bblocks.semantic_uplift import uplift_json
rdf_graph = uplift_json(bblock, {"name": "Alice", ...})
print(rdf_graph.serialize(format="turtle"))
This applies the block's JSON-LD context to the input data, producing an RDF graph. Pre- and post-processing steps (jq, SPARQL, SHACL rules) defined in the block are applied automatically.
License
Apache 2.0
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 bblocks_client-0.0.1.tar.gz.
File metadata
- Download URL: bblocks_client-0.0.1.tar.gz
- Upload date:
- Size: 14.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf773564fd3322dd56a549b601da752b2f3626f8940f731fd8e05e37d93e3d47
|
|
| MD5 |
2ef4d1e881881a023b2a6f4a4411d174
|
|
| BLAKE2b-256 |
38feabe0bfd84c1a7c5a8758f1e0251b41b3c43a42f14a067250824738ef6e5c
|
Provenance
The following attestation bundles were made for bblocks_client-0.0.1.tar.gz:
Publisher:
python-publish.yml on ogcincubator/bblocks-client-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bblocks_client-0.0.1.tar.gz -
Subject digest:
bf773564fd3322dd56a549b601da752b2f3626f8940f731fd8e05e37d93e3d47 - Sigstore transparency entry: 973161812
- Sigstore integration time:
-
Permalink:
ogcincubator/bblocks-client-python@44538ba06bbcb5bf80492ea9dabc91c82bc730ac -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/ogcincubator
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@44538ba06bbcb5bf80492ea9dabc91c82bc730ac -
Trigger Event:
push
-
Statement type:
File details
Details for the file bblocks_client-0.0.1-py3-none-any.whl.
File metadata
- Download URL: bblocks_client-0.0.1-py3-none-any.whl
- Upload date:
- Size: 12.4 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 |
1a5022671234be95e32d08adbaae844037c9811ba25d1fb3b7237d18a45a0a1d
|
|
| MD5 |
c55b896bdcf831dd6082444497132337
|
|
| BLAKE2b-256 |
d59631f7e69b0a92d3bad5906a00b920493f77ab1f177957c2ac341467ff8ef8
|
Provenance
The following attestation bundles were made for bblocks_client-0.0.1-py3-none-any.whl:
Publisher:
python-publish.yml on ogcincubator/bblocks-client-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bblocks_client-0.0.1-py3-none-any.whl -
Subject digest:
1a5022671234be95e32d08adbaae844037c9811ba25d1fb3b7237d18a45a0a1d - Sigstore transparency entry: 973161822
- Sigstore integration time:
-
Permalink:
ogcincubator/bblocks-client-python@44538ba06bbcb5bf80492ea9dabc91c82bc730ac -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/ogcincubator
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@44538ba06bbcb5bf80492ea9dabc91c82bc730ac -
Trigger Event:
push
-
Statement type: