Skip to main content

RDFLib plugin providing JSON-LD parsing and serialization

ARCHIVED

This `rdflib <https://pypi.org/project/rdflib/>`_ plugin is deprecated for, as of the 2021-09-17 release of rdflib 6.0.1, JSON-LD handing has been integrated. All functionality in this package has been removed, as of release 0.6.2.

This plugin is now ‘tombstoned’ meaning this - 0.6.2 - is a final release and all users of Python > 3.6 are encouraged to move to rdflib > 6.0.1.

If you are forced to keep using Python <= 3.6, you will need to keep using release <= 0.5.0 of this plugin with RDFlib 5.0.0.


This is an implementation of JSON-LD for RDFLib. For more information about this technology, see the JSON-LD website.

This implementation will:

  • read in an JSON-LD formatted document and create an RDF graph

  • serialize an RDF graph to JSON-LD formatted output

Installation

The easiest way to install the RDFLib JSON-LD plugin is directly from PyPi using pip by running the command below:

pip install rdflib-jsonld

Otherwise you can download the source and install it directly by running:

python setup.py install

Using the plug-in JSONLD serializer/parser with RDFLib

The plugin parser and serializer are automatically registered if installed by setuptools.

>>> from rdflib import Graph, plugin
>>> from rdflib.serializer import Serializer

>>> testrdf = """
... @prefix dcterms: <http://purl.org/dc/terms/> .
... <http://example.org/about>
...     dcterms:title "Someone's Homepage"@en .
... """

>>> g = Graph().parse(data=testrdf, format='n3')

>>> print(g.serialize(format='json-ld', indent=4))
{
    "@id": "http://example.org/about",
    "http://purl.org/dc/terms/title": [
        {
            "@language": "en",
            "@value": "Someone's Homepage"
        }
    ]
}

>>> context = {"@vocab": "http://purl.org/dc/terms/", "@language": "en"}
>>> print(g.serialize(format='json-ld', context=context, indent=4))
{
    "@context": {
        "@language": "en",
        "@vocab": "http://purl.org/dc/terms/"
    },
    "@id": "http://example.org/about",
    "title": "Someone's Homepage"
}

Release files for rdflib-jsonld 0.6.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rdflib-jsonld 0.6.2
File Size Uploaded
rdflib-jsonld-0.6.2.tar.gz 12.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rdflib-jsonld 0.6.2
File Interpreter ABI Platform
rdflib_jsonld-0.6.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 16.5 kB

Release files / rdflib-jsonld-0.6.2.tar.gz

Download URL rdflib-jsonld-0.6.2.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
107cd3019d41354c31687e64af5e3fd3c3e3fa5052ce635f5ce595fd31853a63
BLAKE2b-256 checksum
How to use checksums
cd1a627de985dffc11b486eb07be86dc9a16c25b4877905f5f6a0be3633addb0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.1

Release files / rdflib_jsonld-0.6.2-py2.py3-none-any.whl

Download URL rdflib_jsonld-0.6.2-py2.py3-none-any.whl
Size 4.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
011afe67672353ca9978ab9a4bee964dff91f14042f2d8a28c22a573779d2f8b
BLAKE2b-256 checksum
How to use checksums
2992da92898b2aab0da78207afc9c035a71bedef3544966374c44e9627d761c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.1

Release history Release notifications | RSS feed

This release

0.6.2 This release

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

1 release file

0.4.0

1 release file

0.3

1 release file

0.2

1 release file

0.2-dev

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page