Skip to main content

Object RDF Mapper

Project description

Status
======

.. image:: https://travis-ci.org/cosminbasca/surfrdf.svg?branch=master
:target: https://travis-ci.org/cosminbasca/surfrdf


Description
===========

*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*.


Documentation
=============

http://surf-rdf.readthedocs.io/en/latest/


Install
=======

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


Example
=======

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='http://www.w3.org/People/Berners-Lee/card.rdf')
True
>>> Person = session.get_class(ns.FOAF.Person)
>>> all_persons = Person.all()
>>> for person in all_persons:
... print person.foaf_name.first
...
Timothy Berners-Lee


Documentation
=============

You can read the documentation online at http://packages.python.org/SuRF/

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

.. code:: sh

$ pip install sphinx
$ python setup.py build_sphinx


Testing
=======

*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.

Filename, size & hash SHA256 hash help File type Python version Upload date
SuRF-1.1.9-py2-none-any.whl (81.0 kB) Copy SHA256 hash SHA256 Wheel 2.7 May 5, 2016
SuRF-1.1.9.tar.gz (55.1 kB) Copy SHA256 hash SHA256 Source None May 5, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page