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 <http://www.w3.org/TR/json-ld/>`_
for `RDFLib <https://github.com/RDFLib/rdflib>`_.
For more information about this technology, see the `JSON-LD website <http://json-ld.org/>`_.
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:
.. code-block:: shell
pip install rdflib-jsonld
Otherwise you can download the source and install it directly by running:
.. code-block:: shell
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.
.. code-block:: python
>>> 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"
}
Raw data
{
"_id": null,
"home_page": "https://github.com/RDFLib/rdflib-jsonld",
"name": "rdflib-jsonld",
"maintainer": "RDFLib Team",
"docs_url": null,
"requires_python": "",
"maintainer_email": "rdflib-dev@google.com",
"keywords": "",
"author": "",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/cd/1a/627de985dffc11b486eb07be86dc9a16c25b4877905f5f6a0be3633addb0/rdflib-jsonld-0.6.2.tar.gz",
"platform": "any",
"description": "RDFLib plugin providing JSON-LD parsing and serialization\n=========================================================\n\nARCHIVED\n--------\n*This `rdflib <https://pypi.org/project/rdflib/>`_ plugin is deprecated\nfor, as of the 2021-09-17 release of rdflib 6.0.1, JSON-LD handing has been\nintegrated. All functionality in this package has been removed, as of release 0.6.2.*\n\n*This plugin is now 'tombstoned' meaning this - 0.6.2 - is a final release and\nall users of Python > 3.6 are encouraged to move to rdflib > 6.0.1.*\n\n*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.*\n\n----\n\nThis is an implementation of `JSON-LD <http://www.w3.org/TR/json-ld/>`_\nfor `RDFLib <https://github.com/RDFLib/rdflib>`_.\nFor more information about this technology, see the `JSON-LD website <http://json-ld.org/>`_.\n\nThis implementation will:\n\n- read in an JSON-LD formatted document and create an RDF graph\n- serialize an RDF graph to JSON-LD formatted output\n\n\nInstallation\n------------\n\nThe easiest way to install the RDFLib JSON-LD plugin is directly from PyPi using pip by running the command below:\n\n.. code-block:: shell\n\n pip install rdflib-jsonld\n \n\n\nOtherwise you can download the source and install it directly by running:\n\n.. code-block:: shell\n\n python setup.py install\n \n\n\n\nUsing the plug-in JSONLD serializer/parser with RDFLib\n------------------------------------------------------\n\nThe plugin parser and serializer are automatically registered if installed by\nsetuptools.\n\n.. code-block:: python\n\n >>> from rdflib import Graph, plugin\n >>> from rdflib.serializer import Serializer\n \n >>> testrdf = \"\"\"\n ... @prefix dcterms: <http://purl.org/dc/terms/> .\n ... <http://example.org/about>\n ... dcterms:title \"Someone's Homepage\"@en .\n ... \"\"\"\n \n >>> g = Graph().parse(data=testrdf, format='n3')\n \n >>> print(g.serialize(format='json-ld', indent=4))\n {\n \"@id\": \"http://example.org/about\",\n \"http://purl.org/dc/terms/title\": [\n {\n \"@language\": \"en\",\n \"@value\": \"Someone's Homepage\"\n }\n ]\n }\n \n >>> context = {\"@vocab\": \"http://purl.org/dc/terms/\", \"@language\": \"en\"}\n >>> print(g.serialize(format='json-ld', context=context, indent=4))\n {\n \"@context\": {\n \"@language\": \"en\",\n \"@vocab\": \"http://purl.org/dc/terms/\"\n },\n \"@id\": \"http://example.org/about\",\n \"title\": \"Someone's Homepage\"\n }\n \n\n\n\n\n",
"bugtrack_url": null,
"license": "BSD",
"summary": "rdflib extension adding JSON-LD parser and serializer",
"version": "0.6.2",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "046d0cc01511e915699bd16a070c2a51",
"sha256": "011afe67672353ca9978ab9a4bee964dff91f14042f2d8a28c22a573779d2f8b"
},
"downloads": -1,
"filename": "rdflib_jsonld-0.6.2-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "046d0cc01511e915699bd16a070c2a51",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 4029,
"upload_time": "2021-09-18T03:04:26",
"upload_time_iso_8601": "2021-09-18T03:04:26.340029Z",
"url": "https://files.pythonhosted.org/packages/29/92/da92898b2aab0da78207afc9c035a71bedef3544966374c44e9627d761c5/rdflib_jsonld-0.6.2-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "67c1dfe0a529a326e136015f6bfa1994",
"sha256": "107cd3019d41354c31687e64af5e3fd3c3e3fa5052ce635f5ce595fd31853a63"
},
"downloads": -1,
"filename": "rdflib-jsonld-0.6.2.tar.gz",
"has_sig": false,
"md5_digest": "67c1dfe0a529a326e136015f6bfa1994",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 12449,
"upload_time": "2021-09-18T03:04:27",
"upload_time_iso_8601": "2021-09-18T03:04:27.881503Z",
"url": "https://files.pythonhosted.org/packages/cd/1a/627de985dffc11b486eb07be86dc9a16c25b4877905f5f6a0be3633addb0/rdflib-jsonld-0.6.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2021-09-18 03:04:27",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "RDFLib",
"github_project": "rdflib-jsonld",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "rdflib",
"specs": [
[
">=",
"5.0.0"
]
]
}
],
"tox": true,
"lcname": "rdflib-jsonld"
}