Skip to main content

PyRDB2RDF

Project description

#########
PyRDB2RDF
#########

PyRDB2RDF provides RDFLib_ with an interface to relational databases as
RDF_ stores_. The underlying data is accessed via SQLAlchemy_. It is
mapped to RDF according to the specifications of RDB2RDF_. The
corresponding RDF graph is represented as an RDFLib Graph_.

Translating from relational data to RDF via `direct mapping`_ is
currently supported. Translating in the other direction and mapping
with R2RML_ are planned but not yet implemented.


.. _direct mapping: http://www.w3.org/TR/rdb-direct-mapping/

.. _R2RML: http://www.w3.org/TR/r2rml/

.. _RDB2RDF: http://www.w3.org/2001/sw/rdb2rdf/

.. _RDF: http://www.w3.org/TR/rdf11-concepts/

.. _RDFLib: http://rdflib.readthedocs.org/

.. _SQLAlchemy: http://www.sqlalchemy.org/

.. _stores: http://rdflib.readthedocs.org/en/latest/univrdfstore.html


************
Installation
************

.. code-block:: bash

pip install rdb2rdf


********
Examples
********

Serializing a database as N-Triples
===================================

Suppose the local PostgreSQL_ database ``test_dm`` contains data that
we want to translate to RDF and serialize as N-Triples_. The following
code achieves that.


.. _N-Triples: http://www.w3.org/TR/n-triples/

.. _PostgreSQL: http://www.postgresql.org/

.. code-block:: python

import rdflib as _rdf
import sqlalchemy as _sqla

db_str = 'postgresql://testuser:testpasswd@localhost/testdb'
db = _sqla.create_engine(db_str)
graph = _rdf.Graph('rdb2rdf_dm')
graph.open(db)

print(graph.serialize(format='nt'))


*********
Changelog
*********

0.1.2
=====

* Updated references to Spruce projects (lang, iri, types) and Goose
Types.

* Improved the setup script.

* Improved documentation.

0.1.1
=====

* Added a missing installation dependency.

0.1.0
=====

First public release.

Project details


Download files

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

Source Distribution

rdb2rdf-0.1.2.tar.gz (29.8 kB view details)

Uploaded Source

Built Distributions

rdb2rdf-0.1.2-py2.7.egg (16.6 kB view details)

Uploaded Egg

rdb2rdf-0.1.2-py2-none-any.whl (21.4 kB view details)

Uploaded Python 2

File details

Details for the file rdb2rdf-0.1.2.tar.gz.

File metadata

  • Download URL: rdb2rdf-0.1.2.tar.gz
  • Upload date:
  • Size: 29.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for rdb2rdf-0.1.2.tar.gz
Algorithm Hash digest
SHA256 00d2e01e6164b23467f9e5c553d6d6521bc84bf7fd45ca48644786789f78115c
MD5 21081666a75ab2a29a1ca31292ba6c23
BLAKE2b-256 26479debf49f1a9c908a3bdc030ad2c10013eb3ceb359e8b8e5aa8265a4fb191

See more details on using hashes here.

File details

Details for the file rdb2rdf-0.1.2-py2.7.egg.

File metadata

  • Download URL: rdb2rdf-0.1.2-py2.7.egg
  • Upload date:
  • Size: 16.6 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for rdb2rdf-0.1.2-py2.7.egg
Algorithm Hash digest
SHA256 3ac77419ce7cd9ef0ab88cf92d4c94aecb133b5fabd82a1227fbfad14e8f5d66
MD5 79bdf89177cf5ee0bd98b7c3094290e7
BLAKE2b-256 89d116b1590a870d18d621e809d2650ec89c82a3d3fecde5711f228290c3d093

See more details on using hashes here.

File details

Details for the file rdb2rdf-0.1.2-py2-none-any.whl.

File metadata

File hashes

Hashes for rdb2rdf-0.1.2-py2-none-any.whl
Algorithm Hash digest
SHA256 4dc1a04fe344afdeedd64c98f8d31c692f242bf3069c12d77e78d3b6df834a25
MD5 51467ab337a1bca5ee30419885b1a389
BLAKE2b-256 5187d51834c584b4e325746437ec75b1d7256105f5d8b0d2926a498155cd4be8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page