Skip to content

I/O API

Module-level JSON-LD and RDF import/export. Preferred over OntoModel instance methods for new code.

For behavioral contract and stability tiers, see SPECS.md.

Module functions

ontosql.io.to_jsonld

to_jsonld(instance: OntoModel, *, registry: PrefixRegistry | None = None) -> dict[str, Any]

Export a semantic instance as a JSON-LD document dict.

ontosql.io.to_rdf

to_rdf(instance: OntoModel, *, format: str = 'turtle', registry: PrefixRegistry | None = None) -> str

Export a semantic instance as an RDF serialization string.

ontosql.io.from_jsonld

from_jsonld(entity_type: type[OntoModel], doc: dict[str, Any], *, mapper: type[Any], registry: PrefixRegistry | None = None) -> OntoModel

Hydrate an instance from a JSON-LD document using a mapper.