Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
A common problem you face when working with graph databases is figuring out how to access the data easily and efficiently in your code. By using an OWL ontology to describe the common shape of our data, we can map OWL classes in our graph database to Python objects directly and easily, making it easy to read and write data from the database. This approach to database programming is commonly called object-relational mapping and has been popularized in libraries like Python’s SQLObject, Java’s Hibernate, and Ruby’s ActiveRecord. Performing this kind of mapping is very easy with a graph database and an OWL ontology, as we’ll demonstrate in this chapter. The RDFObject framework described here demonstrates how easy it is to tightly integrate code with graph data.