Session 12 of Going Meta (broadcast January 16, 2023) demonstrates how to use theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/jbarrasa/goingmeta/llms.txt
Use this file to discover all available pages before exploring further.
rdflib-neo4j adapter to treat Neo4j AuraDB as a native RDFLib graph store. Rather than exporting RDF to a file and importing it separately, you configure RDFLib’s Graph object to write triples directly into AuraDB over the neo4j+s:// protocol — making Python and the semantic web stack first-class citizens for populating your cloud graph database.
Watch Recording
Full session recording on YouTube
Source Code
Jupyter notebook and supporting files
Overview
| Broadcast | January 16, 2023 |
| Tags | Python RDFLib AuraDB |
| Key library | rdflib-neo4j |
What You Will Learn
- How the
rdflib-neo4jpackage exposes aneo4j-cypherstore backend for RDFLib - Connecting an RDFLib
Graphto a live Neo4j AuraDB instance - Writing individual RDF triples with
g.add() - Bulk-loading RDF files with
g.parse()and batched writes - Adding SKOS concepts programmatically and linking them to Wikidata entities
Step-by-Step Walkthrough
Install the adapter
Install
rdflib-neo4j from PyPI. This single package pulls in both RDFLib and the Neo4j Python driver.Create a Neo4j-backed RDFLib Graph
Instantiate an RDFLib
Graph using the neo4j-cypher store identifier. At this point no connection is made yet.Configure and open the AuraDB connection
Pass your AuraDB connection details as a dictionary. The
neo4j+s:// scheme enforces TLS, which AuraDB requires.Replace
<DB-ID-HERE> with your AuraDB instance ID and <PWD-HERE> with the generated password from the AuraDB console.Add triples programmatically
Use RDFLib’s
Namespace helper and g.add() to write individual subject–predicate–object triples. Each call translates into a Cypher write against AuraDB.Bulk-load an RDF file with batched writes
For larger datasets, wrap
g.parse() between startBatchedWrite() and endBatchedWrite() to group Cypher writes into efficient batches instead of one round-trip per triple.Key Concepts
Neo4jStore backend —rdflib-neo4j registers a custom RDFLib store called neo4j-cypher. When you call Graph(store='neo4j-cypher'), RDFLib routes all triple reads and writes through Cypher queries executed on Neo4j, meaning the graph you interact with through RDFLib’s API is the same property graph you can query with Cypher.
Batched writes — The startBatchedWrite() / endBatchedWrite() API accumulates triples in memory and flushes them in bulk. This is essential for loading ontologies or large SKOS concept schemes where thousands of triples are involved.
SKOS on AuraDB — Because rdflib-neo4j understands standard RDF vocabularies, SKOS concepts (skos:Concept, skos:prefLabel, skos:broader) are stored and remain queryable both via RDFLib’s SPARQL engine and directly through Cypher.
The
rdflib-neo4j adapter is maintained by the Neo4j team. See the rdflib-neo4j GitHub repository for the latest installation instructions and changelog.Resources
rdflib-neo4j on GitHub
Official adapter repository with full documentation
Neo4j AuraDB
Fully managed cloud graph database
RDFLib Documentation
RDFLib Python library reference
SKOS Reference
W3C Simple Knowledge Organization System