OldMan is a Python Object Linked Data Mapper (OLDM).
An OLDM let you create, retrieve and update RDF representations of Web Resources by manipulating them as Python objects.
OldMan, in its core, is based on two W3C standards:
It is designed to support multiple protocols for interacting with data stores hosting these resources. Currently, only SPARQL is officially supported.
OldMan relies on the RDFlib Python library.
Why a new term?¶
Some similar projects employ the term Object RDF Mapper for denoting the mapping between objects and RDF graphs. This terminology uses the same initials than the well-known notion of Object Relational Mapper (ORM) that consider table rows instead of RDF graphs.
The Object Linked Data Mapper (OLDM) term avoids this confusion. It also emphasizes that the manipulated resources can be on the Web, not just in a local database. It should lead users to interact with data stores on which they not always have full control (e.g. a tiers Web API).
OldMan has one main objective: help you to declare your models using RDF triples and JSON-LD contexts instead of programming Python model classes yourself.
However, OldMan does not force you to express all your domain logic in a declarative style. OldMan makes easy for you to add dynamically plain-old Python methods to resource objects.
By adopting a declarative style:
- You can provide both RDF and JSON data to your clients.
- Your schema (including validation constraints) can be published and reused by hypermedia-driven Web clients.
- Your declared domain logic becomes independent of Python and its frameworks.
It also acknowledges that IRIs or compact URIs (CURIEs) -like strings are not always pleasant to use: arbitrary short names and objects are usually more user-friendly. However, you can still manipulate IRIs when it is relevant for you to do so. Everything remains mapped to IRIs.
Current core features¶
Resource-centric validation based on RDF vocabularies:
Inheritance (attributes and Python methods);
An attribute can require its value to be a collection (a set, a list or a language map);
Arbitrary attribute names (e.g. plural names for collections);
Separation between the client and data store models;
Extensibility to various sorts of data stores (not just SPARQL endpoints);
IRI generation for new resources (if not done by the remote data store);
Optional resource cache relying on the popular dogpile.cache library.
OldMan is a young project still in an early stage. Feel free to contribute and to subscribe to our mailing list oldman AT librelist.com.
Only Python 2.7 is currently supported, but support for Python 3.x is of course something we would like to consider.