jsonld.to_rdf()¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_
|
the JSON-LD input. |
required | |
options
|
ToRdfOptions | None
|
optional processing options; see Options below. |
None
|
Returns:
| Type | Description |
|---|---|
|
the resulting RDF dataset (or a serialization of it). |
Options¶
documentLoader
instance-attribute
¶
The document loader (default: the global default document loader).
extractAllScripts
instance-attribute
¶
True to extract all JSON-LD script elements from HTML, False to extract just the first (default: True).
format
instance-attribute
¶
The format to use to output a string: application/n-quads for N-Quads.
identifierIssuer
instance-attribute
¶
An identifier issuer to use for blank node identifiers (default: IdentifierIssuer('_:b')).
legacyMode
instance-attribute
¶
True to return the RDF.js-like dataset dict used by PyLD versions lower than 4 instead of an rdflib.Dataset when format is not set (default: False).
processingMode
instance-attribute
¶
Either json-ld-1.0 or json-ld-1.1 (default: json-ld-1.1).
produceGeneralizedRdf
instance-attribute
¶
True to output generalized RDF, False to produce only standard RDF (default: False).
rdfDirection
instance-attribute
¶
Either i18n-datatype or compound-literal is supported (default: None).
When format is not set, jsonld.to_rdf() returns a
RDFLib rdflib.Dataset.
Set legacyMode to True to return the RDF.js-like dataset dict used by
PyLD versions lower than 4.
legacyMode only affects the unformatted return value. If format is set,
jsonld.to_rdf() returns the requested serialization.
Examples¶
Serializing JSON-LD to N-Quads¶
Example to_rdf.py
Transforming JSON-LD into an rdflib.Dataset¶
Example to_rdf_dataset.py
Transforming JSON-LD into an legacy RDF.js-like dict¶
Example to_rdf_legacy.py