docs: remove Advanced_Triplet_Store notebook and references

This commit is contained in:
KaifAhmad1
2025-12-21 17:40:01 +05:30
parent 409e8c3d5c
commit 6582481a28
3 changed files with 37 additions and 174 deletions
@@ -1,173 +0,0 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Advanced Triplet Store Guide\n",
"\n",
"This guide explores the advanced capabilities of the Semantica Triplet Store module, focusing on RDF data management, SPARQL querying, and multi-backend support (Blazegraph, Jena, RDF4J).\n",
"\n",
"## Key Features\n",
"- Unified interface for Blazegraph, Jena, and RDF4J\n",
"- Bulk loading with progress tracking\n",
"- SPARQL query execution and optimization\n",
"- Transaction support (backend-dependent)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from semantica.triplet_store import TripletStore\n",
"from semantica.semantic_extract.triplet_extractor import Triplet"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1. Initialization\n",
"\n",
"Initialize the Triplet Store with your preferred backend."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Initialize Blazegraph store\n",
"store = TripletStore(\n",
" backend=\"blazegraph\",\n",
" endpoint=\"http://localhost:9999/blazegraph\"\n",
")\n",
"\n",
"# Or Jena\n",
"# store = TripletStore(backend=\"jena\", endpoint=\"http://localhost:3030/ds\")\n",
"\n",
"# Or RDF4J\n",
"# store = TripletStore(backend=\"rdf4j\", endpoint=\"http://localhost:8080/rdf4j-server/repositories/myrepo\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2. Adding Triplets\n",
"\n",
"Add individual triplets or batch load them."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Single triplet\n",
"triplet = Triplet(\n",
" subject=\"http://example.org/Alice\",\n",
" predicate=\"http://xmlns.com/foaf/0.1/knows\",\n",
" object=\"http://example.org/Bob\"\n",
")\n",
"\n",
"store.add_triplet(triplet)\n",
"\n",
"# Bulk load\n",
"triplets = [\n",
" Triplet(\n",
" subject=\"http://example.org/Bob\",\n",
" predicate=\"http://xmlns.com/foaf/0.1/knows\",\n",
" object=\"http://example.org/Charlie\"\n",
" ),\n",
" Triplet(\n",
" subject=\"http://example.org/Charlie\",\n",
" predicate=\"http://xmlns.com/foaf/0.1/knows\",\n",
" object=\"http://example.org/Alice\"\n",
" )\n",
"]\n",
"\n",
"result = store.add_triplets(triplets, batch_size=100)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 3. SPARQL Querying\n",
"\n",
"Execute SPARQL queries to retrieve data."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"query = \"\"\"\n",
"SELECT ?s ?p ?o\n",
"WHERE {\n",
" ?s ?p ?o\n",
"}\n",
"LIMIT 10\n",
"\"\"\"\n",
"\n",
"results = store.execute_query(query)\n",
"for result in results.get(\"results\", {}).get(\"bindings\", []):\n",
" print(result)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 4. Deleting and Updating\n",
"\n",
"Manage triplet lifecycle."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"store.delete_triplet(triplet)\n",
"\n",
"# Update is delete + add\n",
"new_triplet = Triplet(\n",
" subject=\"http://example.org/Alice\",\n",
" predicate=\"http://xmlns.com/foaf/0.1/knows\",\n",
" object=\"http://example.org/David\"\n",
")\n",
"store.update_triplet(triplet, new_triplet)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
+1 -1
View File
@@ -223,7 +223,7 @@
"source": [
"## Next Steps\n",
"\n",
"Check out the **Advanced Triplet Store** guide in the `cookbook/advanced` folder for more complex operations like bulk loading optimization, transactions, and advanced SPARQL features."
"Check out the **Advanced Triplet Store** guide in the `cookbook/advanced` folder ([13_Advanced_Triplet_Store.ipynb](../advanced/13_Advanced_Triplet_Store.ipynb)) for more complex operations like bulk loading optimization, transactions, and advanced SPARQL features."
]
}
],