gjhiggins/rdflib — Issue #165: Add a resource oriented access to data
Author: gjhiggins
Created: 2011-10-19 01:33:54+00:00
State: open

Originally filed by lindstr...@gmail.com on 2011-04-05T09:59:25

The attached module implements a simple Description interface to a graph. From the docstring:

----
It contains methods directly corresponding to those methods of the Graph interface that relate to reading and writing data. The difference is that a Description also binds a current subject, making it possible to work without tracking both the graph and a current subject. This makes Description "resource oriented", as compared to the triple orientation of the Graph API.

Resulting generators are also wrapped so that any resource reference values are in turn wrapped in Descriptions.
----

The module docstring also exemplifies (i.e. tests) usage of all the methods. (The documentation is almost twice the lines of the implementation, and both should be easy to understand.)

I propose to add this to core RDFLib, since it's quite common to work in this way. For instance the popular (Java-based) Jena API has a Resource class for working in a similar manner. Current W3C work on a standard RDF API (taking place in the RDFa working group) also moves in this direction (with it's "Projection" interface).

While there are other implementations (Sparta, Oort, RDFAlchemy) supporting various ways do work in an even more object oriented manner ("O/R mapper" style), this implementation is very thin and (IMHO) adheres to the general RDFLib design (by honoring the Graph API).

If this is accepted, I will add this implementation to the repository, and do any updates/refactorings you deem necessary.