semsynth.jsonld_to_rdfa
jsonld_to_rdfa.py Generate static HTML with RDFa from nested compact JSON-LD.
Features: - Supports compact JSON-LD with @context, @type, @id. - Infers @vocab and prefixes; defaults to schema.org. - Hyperlinks all absolute IRIs (including @id and property values). - Recursively renders nested objects and arrays. - Detects repeating lists of similar objects and renders them as tables. - No third-party dependencies.
Functions
|
|
|
|
|
|
|
|
|
Ensure mappings carry the canonical JSON-LD context. |
|
Cell-friendly rendering (no leading label). |
|
|
|
|
|
|
|
Render a property value in RDFa. |
|
|
|
Return a stable list of shared keys for a list of dicts (ignoring @-keys). |
|
Minimal HTML tag builder. |
|
|
|
Classes
|
Special type indicating an unconstrained type. |
|
PurePath subclass that can make system calls. |
- semsynth.jsonld_to_rdfa.ensure_ns(v: str) str
- semsynth.jsonld_to_rdfa.extract_vocab_and_prefixes(context: Any) Tuple[str, Dict[str, str]]
- semsynth.jsonld_to_rdfa.is_iri(v: Any) bool
- semsynth.jsonld_to_rdfa.main() None
- semsynth.jsonld_to_rdfa.render_cell(prop: str, value: str | int | float | bool | dict | list | None, vocab: str, prefixes: Dict[str, str], depth: int) str
Cell-friendly rendering (no leading label).
- semsynth.jsonld_to_rdfa.render_iri(prop: str, iri: str) str
- semsynth.jsonld_to_rdfa.render_literal(prop: str, value: str | int | float | bool) str
- semsynth.jsonld_to_rdfa.render_object(obj: Dict[str, Any], vocab: str, prefixes: Dict[str, str], depth: int) str
- semsynth.jsonld_to_rdfa.render_property(prop: str, value: str | int | float | bool | dict | list | None, vocab: str, prefixes: Dict[str, str], depth: int) str
Render a property value in RDFa. Handles dict, list, and literals. Recursive.
- semsynth.jsonld_to_rdfa.render_rdfa(root: str | int | float | bool | dict | list | None, context: Any, title: str) str
- semsynth.jsonld_to_rdfa.repeating_headers(lst: List[dict]) List[str]
Return a stable list of shared keys for a list of dicts (ignoring @-keys).
- semsynth.jsonld_to_rdfa.tag(name: str, attrs: Dict[str, str | None] | None = None, content: str = '', self_close: bool = False) str
Minimal HTML tag builder. Escapes attribute values; content is trusted to be already-escaped as needed.
- semsynth.jsonld_to_rdfa.to_list(x: Any) List[Any]
- semsynth.jsonld_to_rdfa.types_to_iris(types: str | List[str], vocab: str) List[str]