Install & Compatibility
Where this runs
tested against v0.6.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.940 runs
installs and imports cleanly · install 0.0s · import 0.311s · 72MB
glibcpy 3.10–3.940 runs
installs and imports cleanly · install 2.0s · import 0.277s · 24MB
47MB installed
● package 47MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Graph
✓ from rdflib import Graph
✗ from rdflib_jsonld import JSONLDPlugin
Direct imports from `rdflib_jsonld` are no longer functional or necessary, as JSON-LD capabilities are integrated into `rdflib.Graph` methods like `parse()` and `serialize()`.
This quickstart demonstrates how to parse and serialize JSON-LD data using the core `rdflib` library (version 6.0.1 or newer). The `rdflib-jsonld` package is no longer required for this functionality.
from rdflib import Graph
json_ld_data = '''
{
"@context": "http://schema.org/",
"@type": "Person",
"name": "Jane Doe",
"jobTitle": "Professor",
"telephone": "(425) 123-4567",
"url": "http://www.janedoe.com"
}
'''
# Create a graph and parse JSON-LD data
g = Graph().parse(data=json_ld_data, format='json-ld')
print("Graph contains %d triples." % len(g))
# Serialize the graph back to JSON-LD
serialized_json_ld = g.serialize(format='json-ld', indent=4)
print("\nSerialized JSON-LD:")
print(serialized_json_ld)
# Example of querying a triple
from rdflib import URIRef, Literal, Namespace
from rdflib.namespace import RDF
schema = Namespace("http://schema.org/")
for s, p, o in g.triples((None, schema.name, None)):
print(f"Found name: {o}")
Debug
Known issues
breakingThe `rdflib-jsonld` package is deprecated and 'tombstoned'. Version 0.6.2 (the final release) removes all JSON-LD parsing and serialization functionality, instead printing a deprecation warning.fixUninstall `rdflib-jsonld` and ensure you are using `rdflib>=6.0.1`. JSON-LD capabilities are now built directly into `rdflib`.
affects: >=0.6.2
deprecatedFor all Python versions above 3.6, the functionality previously provided by `rdflib-jsonld` has been integrated into `rdflib` itself since version 6.0.1. Continuing to install `rdflib-jsonld` is unnecessary and may lead to warnings or unexpected behavior.fixUpgrade `rdflib` to version 6.0.1 or higher and remove `rdflib-jsonld` from your project's dependencies.
affects: <6.0.1 of rdflib (where rdflib-jsonld was needed), >6.0.1 of rdflib (where rdflib-jsonld is obsolete)
gotchaIf you are forced to use Python <= 3.6, you will need to rely on older, unsupported versions of `rdflib-jsonld` (<=0.5.0) with `rdflib 5.0.0`. This setup is not recommended or maintained.fixThe best fix is to upgrade your Python environment to 3.7+ and use `rdflib>=6.0.1`.
affects: All versions on Python <= 3.6
Errors
Common errors & fixes
DeprecationWarning: The rdflib-jsonld package has been integrated into rdflib as of rdflib==6.0.1. Please remove rdflib-jsonld from your project's dependencies.
You have both `rdflib-jsonld` and `rdflib>=6.0.1` installed. The `rdflib-jsonld` package is now obsolete and its presence triggers this warning.
fixRemove `rdflib-jsonld` from your environment: `pip uninstall rdflib-jsonld`. Ensure your `rdflib` version is 6.0.1 or newer.
from rdflib_jsonld import ... ImportError: cannot import name 'JSONLDPlugin' from 'rdflib_jsonld' (.../rdflib_jsonld/__init__.py)
You are trying to import specific components from `rdflib-jsonld` version 0.6.2 or newer, but its functionality has been deliberately removed. The `__init__.py` file for these versions does not expose any functional modules.
fixStop importing directly from `rdflib_jsonld`. JSON-LD functionality is now automatically available when using `rdflib.Graph().parse(format='json-ld')` or `rdflib.Graph().serialize(format='json-ld')` with `rdflib>=6.0.1`.
Graph contains 0 triples.
When trying to parse JSON-LD data after installing `rdflib-jsonld` version 0.6.2, no triples are added to the graph because the functionality was removed in this 'tombstoning' release.
fixUninstall `rdflib-jsonld` (if installed). Ensure you are using `rdflib>=6.0.1`. The core `rdflib` library now handles JSON-LD parsing and serialization natively.
Upgrade
Version history
0.6.2latest on PyPI · released Sep 18, 2021
Audit
Dependencies
rdflibrequiredHistorically, rdflib-jsonld extended rdflib. JSON-LD functionality is now part of rdflib core (>=6.0.1), making rdflib-jsonld obsolete.