RDFLib is a Python library for working with RDF, a simple yet powerful language for representing information.
Python Jupyter Notebook HTML Ruby Other
Latest commit 2a869ca Dec 5, 2016 @joernhees joernhees committed on GitHub Merge pull request #673 from SeguinBe/master
Adding the option of using POST for queries in SPARQLStore
Failed to load latest commit information.
benchmarks more automorphism detection Nov 30, 2014
docs Removed duplicate option from armstrong theme config Jul 1, 2015
examples DOC: unamed -> unnamed Dec 11, 2015
rdflib renamed self.default_query_method to self.query_method Dec 5, 2016
test make test 375 more portable (use sys.executable rather than python), … Nov 18, 2016
test_reports enabled trig eval tests and fixed up trig parser Dec 30, 2013
.coveragerc make code coverage main guard exclusion more tolerant Jun 27, 2013
.gitignore fix tests from nose Dec 22, 2013
.hgignore (Primarily convention) changes made on advice of pylint Jan 25, 2012
.pep8 Conform to PEP8 Feb 7, 2013
.travis.fuseki_install_optional.sh updated fuseki used in travis tests to 2.4.0 Jul 26, 2016
.travis.yml only run flake8 in latest py2 and py3 version Jul 27, 2016
CHANGELOG.md version 4.2.1 Aug 12, 2015
CONTRIBUTORS took the freedom to add me to the contributors ;) Feb 19, 2015
LICENSE new version and dates in license and readme as well Feb 19, 2015
MANIFEST.in manifest update May 16, 2013
README.md minor readme updates including more badges May 12, 2016
ez_setup.py adding ez_setup bits Mar 11, 2007
requirements.py2.txt Update requirements files for html5lib version Aug 30, 2016
requirements.py3.txt Update requirements files for html5lib version Aug 30, 2016
run_tests.py Update issue 123 Mar 12, 2010
run_tests_py3.sh run_tests_py3.sh shouldn't lose cmdline args Apr 1, 2015
setup.cfg remove double exclude line as py3 configparser complains otherwise Mar 18, 2015
setup.py Use find_packages for package discovery instead of writing manual met… Jan 28, 2016
skiptests.list Immigrate rdflib-sparql (plus some prefiguring changes) Mar 21, 2013
tox.ini adding python 3.5 support (activating tests) Sep 23, 2015



Build Status Coveralls branch GitHub stars PyPI PyPI PyPI

RDFLib is a Python library for working with RDF, a simple yet powerful language for representing information as graphs.

RDFLib may be installed with setuptools (easy_install) or pip::

$ easy_install rdflib


$ pip install rdflib

Alternatively manually download the package from the Python Package Index (PyPI) at https://pypi.python.org/pypi/rdflib

The current version of RDFLib is 4.2.1, see the CHANGELOG.md file for what's new.

Getting Started

RDFLib aims to be a pythonic RDF API, a Graph is a python collection of RDF Subject,Predicate,Object Triples:

import rdflib

for s,p,o in g:
    print s,p,o

The components of the triples are URIs (resources) or Literals (values), URIs are grouped together by namespace, common namespaces are included in RDFLib:

type=g.value(semweb, rdflib.RDFS.label)

Where rdflib.RDFS is the RDFS Namespace, graph.value returns an object of the triple-pattern given (or an arbitrary one if more exist). New Namespaces can also be defined:


abstracts=list(x for x in g.objects(semweb, dbpedia['abstract']) if x.language=='en')

See also ./examples


The library contains parsers and serializers for RDF/XML, N3, NTriples, N-Quads, Turtle, TriX, RDFa and Microdata.

The library presents a Graph interface which can be backed by any one of a number of Store implementations.

This core RDFLib package includes store implementations for in memory storage and persistent storage on top of the Berkeley DB.

A SPARQL 1.1 implementation is included - supporting SPARQL 1.1 Queries and Update statements.

RDFLib is open source and is maintained on GitHub. RDFLib releases, current and previous are listed on PyPI

RDFLib has a plugin-architecture for store-implementation, as well as parsers/serializers, several other projects exist which extend RDFLib features:


More information is available on the project webpage:


The documentation can be built by doing::

$ python setup.py build_sphinx

And is also available from ReadTheDocs:


Support is available through the rdflib-dev group:


and on the IRC channel #rdflib on the freenode.net server