Skip to main content

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


Download files

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

Source Distribution

bblocks_client-0.0.2.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

bblocks_client-0.0.2-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file bblocks_client-0.0.2.tar.gz.

File metadata

  • Download URL: bblocks_client-0.0.2.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bblocks_client-0.0.2.tar.gz
Algorithm Hash digest
SHA256 7f2a4e3c17cb549cb9d18ccb932496a598a471b72910bfbf8a638f4d1d4353ea
MD5 3e11dffef4b81ba49a0a268ab6c46475
BLAKE2b-256 cf8afc390a1315c750996f51c28fc6e4b035bdbcc32c3b42ab82f84b9ed59c33

See more details on using hashes here.

Provenance

The following attestation bundles were made for bblocks_client-0.0.2.tar.gz:

Publisher: python-publish.yml on ogcincubator/bblocks-client-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bblocks_client-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: bblocks_client-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bblocks_client-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bbaeb068da5f7d77057e07ad639694b4a968fa068c61ce5b23883fa72db7f547
MD5 d6cf3f5388fa72803f352c18d4c8ffbb
BLAKE2b-256 48530461f2f17b80f7862ad390fe8f441cb33596e1bbd768b249ee8a508da5a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for bblocks_client-0.0.2-py3-none-any.whl:

Publisher: python-publish.yml on ogcincubator/bblocks-client-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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