Skip to content

Commit 77fd485

Browse files
committed
Updated tutorial based on feedback from Nico
1 parent d4bab29 commit 77fd485

1 file changed

Lines changed: 55 additions & 43 deletions

File tree

notebooks/SemanticSQL-Tutorial.ipynb

Lines changed: 55 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@
1010
"This tutorial assumes you have read introductory material on\n",
1111
"https://github.com/INCATools/semantic-sql\n",
1212
"\n",
13-
"\n"
13+
"To run this notebook, we recommend cloning the repo and installing all dependencies via poetry:\n",
14+
"\n",
15+
"```\n",
16+
"git clone https://github.com/INCATools/semantic-sql.git\n",
17+
"cd semantic-sql\n",
18+
"poetry install\n",
19+
"poetry run jupyter notebook\n",
20+
"```\n"
1421
]
1522
},
1623
{
@@ -45,48 +52,53 @@
4552
},
4653
{
4754
"cell_type": "code",
48-
"execution_count": 41,
55+
"execution_count": 5,
4956
"id": "9f75b98c",
5057
"metadata": {},
5158
"outputs": [
5259
{
5360
"name": "stdout",
5461
"output_type": "stream",
5562
"text": [
56-
"--2022-08-15 17:46:55-- https://s3.amazonaws.com/bbop-sqlite/cl.db.gz\n",
57-
"Resolving s3.amazonaws.com (s3.amazonaws.com)... 52.216.81.11\n",
58-
"Connecting to s3.amazonaws.com (s3.amazonaws.com)|52.216.81.11|:443... connected.\n",
59-
"HTTP request sent, awaiting response... 200 OK\n",
60-
"Length: 124417954 (119M) [binary/octet-stream]\n",
61-
"Saving to: ‘cl.db.gz’\n",
62-
"\n",
63-
"cl.db.gz 100%[===================>] 118.65M 5.89MB/s in 29s \n",
64-
"\n",
65-
"2022-08-15 17:47:25 (4.06 MB/s) - ‘cl.db.gz’ saved [124417954/124417954]\n",
63+
"--2022-08-16 09:49:00-- https://s3.amazonaws.com/bbop-sqlite/cl.db.gz\n",
64+
"Resolving s3.amazonaws.com (s3.amazonaws.com)... 3.5.16.140\n",
65+
"Connecting to s3.amazonaws.com (s3.amazonaws.com)|3.5.16.140|:443... connected.\n",
66+
"HTTP request sent, awaiting response... 304 Not Modified\n",
67+
"File ‘cl.db.gz’ not modified on server. Omitting download.\n",
6668
"\n"
6769
]
6870
}
6971
],
7072
"source": [
71-
"!wget https://s3.amazonaws.com/bbop-sqlite/cl.db.gz -O cl.db.gz"
73+
"!wget -N https://s3.amazonaws.com/bbop-sqlite/cl.db.gz"
74+
]
75+
},
76+
{
77+
"cell_type": "markdown",
78+
"id": "2e6d48f5",
79+
"metadata": {},
80+
"source": [
81+
"next decompress it (keep the original around with `-k` so that subsequent runs of this notebook work)"
7282
]
7383
},
7484
{
7585
"cell_type": "code",
76-
"execution_count": 42,
86+
"execution_count": 6,
7787
"id": "f2e775f8",
7888
"metadata": {},
7989
"outputs": [],
8090
"source": [
81-
"!gzip -d cl.db.gz"
91+
"!gzip -dfk cl.db.gz"
8292
]
8393
},
8494
{
8595
"cell_type": "markdown",
8696
"id": "d3cb4a21",
8797
"metadata": {},
8898
"source": [
89-
"This is quite large so it make take a few minutes depending on your connection.\n",
99+
"The initial download is quite large so it make take a minute or so depending on your connection.\n",
100+
"\n",
101+
"### Connecting\n",
90102
"\n",
91103
"next, some Jupyter magic to connect to cl.db\n",
92104
"\n",
@@ -131,7 +143,7 @@
131143
},
132144
{
133145
"cell_type": "code",
134-
"execution_count": 4,
146+
"execution_count": 7,
135147
"id": "305a4293",
136148
"metadata": {},
137149
"outputs": [
@@ -261,7 +273,7 @@
261273
" ('CL:0000101', 'CL:0000101', 'rdfs:label', None, 'sensory neuron', 'xsd:string', None)]"
262274
]
263275
},
264-
"execution_count": 4,
276+
"execution_count": 7,
265277
"metadata": {},
266278
"output_type": "execute_result"
267279
}
@@ -294,7 +306,7 @@
294306
},
295307
{
296308
"cell_type": "code",
297-
"execution_count": 7,
309+
"execution_count": 8,
298310
"id": "5207ce6c",
299311
"metadata": {},
300312
"outputs": [
@@ -434,7 +446,7 @@
434446
" ('CL:0007011', 'CL:0007011', 'rdfs:subClassOf', 'CL:0000029', None, None, None)]"
435447
]
436448
},
437-
"execution_count": 7,
449+
"execution_count": 8,
438450
"metadata": {},
439451
"output_type": "execute_result"
440452
}
@@ -481,7 +493,7 @@
481493
},
482494
{
483495
"cell_type": "code",
484-
"execution_count": 6,
496+
"execution_count": 9,
485497
"id": "e9700bea",
486498
"metadata": {},
487499
"outputs": [
@@ -537,7 +549,7 @@
537549
" ('CL:0007011', 'rdfs:subClassOf', 'CL:0000107')]"
538550
]
539551
},
540-
"execution_count": 6,
552+
"execution_count": 9,
541553
"metadata": {},
542554
"output_type": "execute_result"
543555
}
@@ -558,7 +570,7 @@
558570
},
559571
{
560572
"cell_type": "code",
561-
"execution_count": 6,
573+
"execution_count": 11,
562574
"id": "8a5dd674",
563575
"metadata": {},
564576
"outputs": [
@@ -642,7 +654,7 @@
642654
" ('CL:0007011', 'rdfs:subClassOf', 'CL:0000107', None, 'autonomic neuron')]"
643655
]
644656
},
645-
"execution_count": 6,
657+
"execution_count": 11,
646658
"metadata": {},
647659
"output_type": "execute_result"
648660
}
@@ -688,7 +700,7 @@
688700
},
689701
{
690702
"cell_type": "code",
691-
"execution_count": 11,
703+
"execution_count": 13,
692704
"id": "e4d791ab",
693705
"metadata": {},
694706
"outputs": [
@@ -834,7 +846,7 @@
834846
" ('CL:0007011', 'RO:0002100', 'BFO:0000040')]"
835847
]
836848
},
837-
"execution_count": 11,
849+
"execution_count": 13,
838850
"metadata": {},
839851
"output_type": "execute_result"
840852
}
@@ -857,7 +869,7 @@
857869
},
858870
{
859871
"cell_type": "code",
860-
"execution_count": 40,
872+
"execution_count": 14,
861873
"id": "e13226a1",
862874
"metadata": {},
863875
"outputs": [
@@ -982,7 +994,7 @@
982994
" ('CL:2000086', 'neocortex basket cell')]"
983995
]
984996
},
985-
"execution_count": 40,
997+
"execution_count": 14,
986998
"metadata": {},
987999
"output_type": "execute_result"
9881000
}
@@ -1016,7 +1028,7 @@
10161028
},
10171029
{
10181030
"cell_type": "code",
1019-
"execution_count": 43,
1031+
"execution_count": 16,
10201032
"id": "c9cfcbdd",
10211033
"metadata": {},
10221034
"outputs": [
@@ -1044,7 +1056,7 @@
10441056
"[(29117,)]"
10451057
]
10461058
},
1047-
"execution_count": 43,
1059+
"execution_count": 16,
10481060
"metadata": {},
10491061
"output_type": "execute_result"
10501062
}
@@ -1122,7 +1134,7 @@
11221134
},
11231135
{
11241136
"cell_type": "code",
1125-
"execution_count": 7,
1137+
"execution_count": 17,
11261138
"id": "e1fa05a9",
11271139
"metadata": {},
11281140
"outputs": [],
@@ -1132,7 +1144,7 @@
11321144
},
11331145
{
11341146
"cell_type": "code",
1135-
"execution_count": 10,
1147+
"execution_count": 18,
11361148
"id": "e1d7b90c",
11371149
"metadata": {},
11381150
"outputs": [],
@@ -1155,7 +1167,7 @@
11551167
},
11561168
{
11571169
"cell_type": "code",
1158-
"execution_count": 12,
1170+
"execution_count": 20,
11591171
"id": "753403a0",
11601172
"metadata": {},
11611173
"outputs": [
@@ -1188,7 +1200,7 @@
11881200
},
11891201
{
11901202
"cell_type": "code",
1191-
"execution_count": 13,
1203+
"execution_count": 21,
11921204
"id": "14c2663b",
11931205
"metadata": {},
11941206
"outputs": [],
@@ -1198,7 +1210,7 @@
11981210
},
11991211
{
12001212
"cell_type": "code",
1201-
"execution_count": 14,
1213+
"execution_count": 22,
12021214
"id": "8bfc77cd",
12031215
"metadata": {},
12041216
"outputs": [],
@@ -1208,7 +1220,7 @@
12081220
},
12091221
{
12101222
"cell_type": "code",
1211-
"execution_count": 16,
1223+
"execution_count": 23,
12121224
"id": "a7ca1296",
12131225
"metadata": {},
12141226
"outputs": [
@@ -1253,7 +1265,7 @@
12531265
},
12541266
{
12551267
"cell_type": "code",
1256-
"execution_count": 22,
1268+
"execution_count": 24,
12571269
"id": "28bdc16d",
12581270
"metadata": {},
12591271
"outputs": [],
@@ -1264,7 +1276,7 @@
12641276
},
12651277
{
12661278
"cell_type": "code",
1267-
"execution_count": 23,
1279+
"execution_count": 25,
12681280
"id": "88d75a8d",
12691281
"metadata": {},
12701282
"outputs": [],
@@ -1286,7 +1298,7 @@
12861298
},
12871299
{
12881300
"cell_type": "code",
1289-
"execution_count": 27,
1301+
"execution_count": 26,
12901302
"id": "5884e222",
12911303
"metadata": {},
12921304
"outputs": [
@@ -1319,7 +1331,7 @@
13191331
},
13201332
{
13211333
"cell_type": "code",
1322-
"execution_count": 33,
1334+
"execution_count": 27,
13231335
"id": "7f80c503",
13241336
"metadata": {},
13251337
"outputs": [
@@ -1350,7 +1362,7 @@
13501362
},
13511363
{
13521364
"cell_type": "code",
1353-
"execution_count": 35,
1365+
"execution_count": 28,
13541366
"id": "6d5749c9",
13551367
"metadata": {},
13561368
"outputs": [
@@ -1399,7 +1411,7 @@
13991411
},
14001412
{
14011413
"cell_type": "code",
1402-
"execution_count": 28,
1414+
"execution_count": 29,
14031415
"id": "58709734",
14041416
"metadata": {},
14051417
"outputs": [
@@ -1447,7 +1459,7 @@
14471459
" | ----------------------------------------------------------------------\n",
14481460
" | Data and other attributes defined here:\n",
14491461
" | \n",
1450-
" | __mapper__ = <Mapper at 0x7fdfe078cee0; Edge>\n",
1462+
" | __mapper__ = <Mapper at 0x7ff21866fa90; Edge>\n",
14511463
" | \n",
14521464
" | __mapper_args__ = {'concrete': True}\n",
14531465
" | \n",

0 commit comments

Comments
 (0)