Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cosminbasca/surfrdf
SuRF: a python Object RDF Mapper (ORM).
https://github.com/cosminbasca/surfrdf
Last synced: 3 months ago
JSON representation
SuRF: a python Object RDF Mapper (ORM).
- Host: GitHub
- URL: https://github.com/cosminbasca/surfrdf
- Owner: cosminbasca
- Created: 2014-05-20T14:44:47.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2021-10-22T10:07:52.000Z (about 3 years ago)
- Last Synced: 2024-07-08T03:06:39.051Z (4 months ago)
- Language: Python
- Homepage:
- Size: 851 KB
- Stars: 42
- Watchers: 7
- Forks: 21
- Open Issues: 21
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
Awesome Lists containing this project
- starred-awesome - surfrdf - SuRF: a python Object RDF Mapper (ORM). (Python)
README
Status
======.. image:: https://travis-ci.org/cosminbasca/surfrdf.svg?branch=master
:target: https://travis-ci.org/cosminbasca/surfrdfDescription
===========*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
=============You can read the latest documentation online at: http://surf-rdf.readthedocs.io/en/latest/
When building from source, you can build your own documentation by following these steps:.. code:: sh
$ cd docs
$ pip install -r requirements.txt
$ make htmlInstall
=======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 might need one of the following plugins (also installable with *pip*) for stores not supported by *rdflib* or
which do not expose a *SPARQL* endpoint:- *surf.allegro_franz*, for the AllegroGraph RDFStore
- *surf.sesame2*, for stores with a Sesame2 HTTP APIExample
=======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-LeeTesting
=======*SuRF* uses *tox* and *py.test* for testing:
.. code:: sh
$ # test over multiple python versions with tox
$ tox
$ # or run the tests in surf
$ py.test surf