Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A lightweight ORM for Linked Data: Consume Linked Data resources, modify the graph and write the changes back to their original source

Project Description

Ldtools is a simple library to handle RDF data in a convenient way. It can be used as a simple ORM for Linked Data Resources and their Origins. A resource “” might be mentioned by different origins. Ldtools helps to keep track of verified statements (authoritative) about resources and provides an API to query more information about resources.

Different rdf triple storage backends are provided for the retrieved data: RestBackend, FileBackend or MemoryBackend

The CLI ldtools can be used to retrieve information about linked data resources.


Just use pip:

pip install Ldtools

This will install all dependencies (argparse, rdflib) needed and provide the command line utility “ldtools”.

Alternatively, do a git clone and execute python install/develop.

How to use it?

Via the commandline, all information within a Linked Data resource can be retrieved by executing:


Further options can be utilised to influence whether the URIs that are discovered within the origin should be followed and how deep. Try:

ldtools --help

for more usage information.

Alternatively, the python console can be used:

First, we create an Origin object:

import pprint, rdflib
from ldtools.resource import Resource
from ldtools.origin import Origin

uri = ""
origin, created = Origin.objects.get_or_create(uri)

Process it, hopefully discovering more Origins in there (rdfs:seeAlso, owl:sameAs…):


If everything went well, there now is a Resource object for our uri:

resource, created = Resource.objects.get_or_create(uri, origin=origin)

Process all the other Origins we know about:


Result: 5 URIs crawled and 500 Resources discovered and processed.


  • The Semantic Web is out there and there is really not enough tools yet to work with Linked Data
  • SPARQL is not needed to get the RAW data from resources, this library demonstrates that. Just the basic Linked Data Stack: URIs, Content Negotiation, RDF needed
  • ldtools intends to make it easy to handle the data you get from an URI and to follow links you discover
  • Based on that, you can modify your objects and PUT them back to their origin


To run the tests, install spec and/or nose and run nose:

pip install spec coverage
nosetests --with-coverage --cover-package=ldtools
nosetests --with-specplugin

Build Status


Feel free to submit ideas and bugs to, I’ll be happy to accept pull requests for new features.

Thank you Travis CI for running the tests :)

Thanks to Django, Flask, peewee and sentry for inspiration regarding model structure!

Release History

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node

History Node

History Node

History Node


History Node


History Node


Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
Ldtools-0.8.1.tar.gz (16.5 kB) Copy SHA256 Checksum SHA256 Source Oct 10, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting