Skip to content
This repository

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

Octocat-spinner-32 docs documentation changes December 30, 2013
Octocat-spinner-32 examples fixed stupid rdfa regression May 16, 2013
Octocat-spinner-32 rdflib Fix ambiguity between Literal(False) and None in Graph.items(...) April 20, 2014
Octocat-spinner-32 test test-case for #382 April 21, 2014
Octocat-spinner-32 test_reports enabled trig eval tests and fixed up trig parser December 30, 2013
Octocat-spinner-32 .coveragerc make code coverage main guard exclusion more tolerant June 27, 2013
Octocat-spinner-32 .gitignore fix tests from nose December 22, 2013
Octocat-spinner-32 .hgignore (Primarily convention) changes made on advice of pylint January 25, 2012
Octocat-spinner-32 .pep8 Conform to PEP8 February 07, 2013
Octocat-spinner-32 .travis.yml restrict travis to master only to avoid double testing of six branch … March 18, 2014
Octocat-spinner-32 CHANGELOG.md released 4.2.1 April 15, 2014
Octocat-spinner-32 CONTRIBUTORS moving towards 3.2.1, updated changelog/contributes/licesen. fixes #194 April 21, 2012
Octocat-spinner-32 LICENSE moving towards 3.2.1, updated changelog/contributes/licesen. fixes #194 April 21, 2012
Octocat-spinner-32 MANIFEST.in manifest update May 16, 2013
Octocat-spinner-32 README.md whitespace gardening March 04, 2014
Octocat-spinner-32 ez_setup.py adding ez_setup bits March 11, 2007
Octocat-spinner-32 requirements.py2.txt May 17th release of html5lib 1.0b1 add Py3-compatibility, so use offi… May 18, 2013
Octocat-spinner-32 requirements.py3.txt May 17th release of html5lib 1.0b1 add Py3-compatibility, so use offi… May 18, 2013
Octocat-spinner-32 run_tests.py Update issue 123 March 12, 2010
Octocat-spinner-32 run_tests_py3.sh copy skiptests when running py3 tests December 30, 2013
Octocat-spinner-32 setup.cfg Revert to mainstream, temporarily suspend doctests. April 12, 2013
Octocat-spinner-32 setup.py whitespace gardening March 04, 2014
Octocat-spinner-32 skiptests.list Immigrate rdflib-sparql (plus some prefiguring changes) March 21, 2013
Octocat-spinner-32 tox.ini change protocol, remove ssl requirement. May 21, 2013
README.md

RDFLib

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

or

$ pip install rdflib

Getting Started

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

import rdflib
g=rdflib.Graph()
g.load('http://dbpedia.org/resource/Semantic_Web')

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:

semweb=rdflib.URIRef('http://dbpedia.org/resource/Semantic_Web')
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:

dbpedia=Namespace('http://dbpedia.org/ontology/')

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

See also ./examples

Features

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:

Support

More information is available on the project webpage:

https://github.com/RDFLib/rdflib/

Continuous integration status details available from travis.ci, test coverage from coveralls:

Build Status Coverage Status

The documentation can be built by doing::

$ python setup.py build_sphinx

And is also available from ReadTheDocs:

http://readthedocs.org/docs/rdflib/

Support is available through the rdflib-dev group:

http://groups.google.com/group/rdflib-dev

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

Something went wrong with that request. Please try again.