Example code: Initializing an RDF database

(note: slides adapted from Introduction to the Semantic Web and RDF, PyCon, A.M. Kuchling

Here's a Python example using rdflib 1.2. (www.rdflib.net)

First, create an InformationStore, which is a database of triples. This store will be stored as a BerkeleyDB database, so it'll be persistent.

from rdflib.InformationStore import InformationStore

# Create an InformationStore to hold the RDF data
store = InformationStore()
store.open('/tmp/temporary-store')