Giter Club home page Giter Club logo

rnd0101 / surfrdf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cosminbasca/surfrdf

0.0 1.0 0.0 878 KB

SuRF is a Python library for working with RDF data in an Object-Oriented way. In SuRF, RDF nodes (subjects and objects) are represented as Python objects and RDF arcs (predicates) as their attributes. SuRF is an Object RDF Mapper (ORM), similar in concept to Object Relational Mappers like SQLAlchemy. SuRF was inspired by ActiveRDF for Ruby.

Python 100.00%

surfrdf's Introduction

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

Install SuRF:

$ # with easy_install ... 
$ easy_install -U surf

$ # or with pip ... 
$ pip install --upgrade surf

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

  • surf.sparql_protocol, for stores with a SPARQL Protocol endpoint (e.g. Virtuoso)
  • surf.allegro_franz, for the AllegroGraph RDFStore
  • surf.sesame2, for stores with a Sesame2 HTTP API
  • surf.rdflib, for the experimental store implementation of rdflib (via rdfextras)

Example

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

>>> 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::

    $ pip install sphinx
    $ python setup.py build_sphinx

Unit tests

Run unit tests from the source directory:

    $ python setup.py test

Test plugins from their respective source directory, e.g.:

    $ cd plugins/surf.sparql_protocol/
    $ python setup.py test

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.