Metadata-Version: 2.4
Name: jsonld-ex
Version: 0.3.0
Summary: JSON-LD 1.2 extensions for AI/ML data exchange, security hardening, and validation
Author-email: Muntaser Syed <jemsbhai@gmail.com>
License: MIT
Keywords: json-ld,linked-data,semantic-web,ai,ml,confidence,provenance,embeddings,security,validation
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: PyLD>=2.0.4
Provides-Extra: iot
Requires-Dist: cbor2>=5.6.0; extra == "iot"
Provides-Extra: mqtt
Requires-Dist: cbor2>=5.6.0; extra == "mqtt"
Requires-Dist: paho-mqtt>=2.0; extra == "mqtt"
Provides-Extra: mcp
Requires-Dist: mcp<2,>=1.7; python_version >= "3.10" and extra == "mcp"
Provides-Extra: bench
Requires-Dist: rdflib>=7.0; extra == "bench"
Requires-Dist: pyshacl>=0.26; extra == "bench"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
Requires-Dist: pytest-benchmark>=4.0; extra == "dev"
Requires-Dist: hypothesis>=6.0; extra == "dev"
Requires-Dist: mypy>=1.8; extra == "dev"
Requires-Dist: ruff>=0.2; extra == "dev"
Requires-Dist: cbor2>=5.6.0; extra == "dev"
Requires-Dist: rdflib>=7.0; extra == "dev"
Requires-Dist: pyshacl>=0.26; extra == "dev"
Requires-Dist: mcp<2,>=1.7; python_version >= "3.10" and extra == "dev"

# jsonld-ex

**JSON-LD 1.2 Extensions for AI/ML Data Exchange, Security, and Validation**

Reference implementation of proposed JSON-LD 1.2 extensions. Wraps [PyLD](https://github.com/digitalbazaar/pyld) for core processing and adds extension layers.

## Install

```bash
pip install jsonld-ex
```

## Quick Start

```python
from jsonld_ex import JsonLdEx, annotate

# Annotate a value with AI/ML provenance
name = annotate(
    "John Smith",
    confidence=0.95,
    source="https://ml-model.example.org/ner-v2",
    method="NER",
)
# {'@value': 'John Smith', '@confidence': 0.95, '@source': '...', '@method': 'NER'}

# Validate against a shape
from jsonld_ex import validate_node

shape = {
    "@type": "Person",
    "name": {"@required": True, "@type": "xsd:string"},
    "age": {"@type": "xsd:integer", "@minimum": 0, "@maximum": 150},
}

result = validate_node({"@type": "Person", "name": "John", "age": 30}, shape)
assert result.valid
```

## Features

- **AI/ML Extensions**: `@confidence`, `@source`, `@extractedAt`, `@method`, `@humanVerified`
- **Vector Embeddings**: `@vector` container type with dimension validation
- **Security**: `@integrity` context verification, allowlists, resource limits
- **Validation**: `@shape` native validation framework

## Documentation

Full documentation and specifications: [github.com/jemsbhai/jsonld-ex](https://github.com/jemsbhai/jsonld-ex)

## License

MIT
