Skip to main content

Object RDF Mapper

Project description


.. image::


*SuRF* is a Python library for working with RDF data in an Object-Oriented manner. In SuRF, RDF nodes (subjects and
objects) are represented as Python objects and RDF edges (predicates) as their attributes. *SuRF* is an Object RDF
Mapper (ORM), similar in concept to Object Relational Mappers like *SQLAlchemy*.



Install SuRF:

.. code:: sh

$ pip install --upgrade surf

Starting with version **1.1.9** the *surf.rdflib* and *surf.sparql_protocol* plugins are bundled with *SuRF*.

You'll need one of the following plugins (also installable by `pip`):

- *surf.allegro_franz*, for the AllegroGraph RDFStore
- *surf.sesame2*, for stores with a Sesame2 HTTP API


The example below shows how to query a resource using the rdflib in-memory backend:

.. code:: python

>>> from surf import *
>>> store = Store(reader='rdflib',
... writer='rdflib',
... rdflib_store='IOMemory')
>>> session = Session(store)
>>> store.load_triples(source='')
>>> Person = session.get_class(ns.FOAF.Person)
>>> all_persons = Person.all()
>>> for person in all_persons:
... print person.foaf_name.first
Timothy Berners-Lee


You can read the documentation online at

To build the documentation yourself, install sphinx and run the build step:

.. code:: sh

$ pip install sphinx
$ python build_sphinx


*SuRF* uses *tox* and *py.test* for testing:

.. code:: sh

$ tox

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for SuRF, version 1.1.9
Filename, size File type Python version Upload date Hashes
Filename, size SuRF-1.1.9.tar.gz (55.1 kB) File type Source Python version None Upload date Hashes View
Filename, size SuRF-1.1.9-py2-none-any.whl (81.0 kB) File type Wheel Python version 2.7 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page