Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"execution_count": null,
"id": "98bf6d5e82a415f6",
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
},
Expand Down Expand Up @@ -277,6 +276,39 @@
"RETURN gn_country, matches, ar_country"
]
},
{
"cell_type": "markdown",
"id": "31766ec9",
"metadata": {},
"source": [
"### Modifying the linked data graph\n",
"\n",
"We can use openCypher to insert new edges, creating alternative connections within the data to simplify querying and pathfinding.\n",
"\n",
"Execute the following query to extend the model. It adds a direct edge between airports whenever a direct route exists, allowing for more efficient traversal.\n",
"\n",
"This modification, known as \"edge shortcutting\" or \"transitive edge creation,\" is a common technique in graph data modeling to enhance pathfinding efficiency and speed up queries. It is particularly useful when integrating large graphs into a unified structure."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b8e296aa",
"metadata": {},
"outputs": [],
"source": [
"%%oc\n",
"\n",
"PREFIX nepo: <http://neptune.aws.com/ontology/airroutes/>\n",
"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n",
"\n",
"MATCH (origin: nepo::Airport)\n",
" <-[:nepo::source]-(r: nepo::Route)-[:nepo::destination]->\n",
" (destination: nepo::Airport)\n",
"\n",
"CREATE (origin)-[:nepo::hasDirectRouteTo]->(destination)"
]
},
{
"cell_type": "markdown",
"id": "e19cbac4",
Expand Down Expand Up @@ -328,7 +360,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.10.8"
}
},
"nbformat": 4,
Expand Down