Skip to content

Commit 1c80a17

Browse files
committed
Update example notebook
1 parent 3daba99 commit 1c80a17

1 file changed

Lines changed: 145 additions & 41 deletions

File tree

examples/noodles_fw.ipynb

Lines changed: 145 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "characteristic-renaissance",
5+
"id": "regulated-intermediate",
66
"metadata": {},
77
"source": [
88
"# FairWorkflows execution demo"
99
]
1010
},
1111
{
1212
"cell_type": "markdown",
13-
"id": "auburn-korea",
13+
"id": "handed-swedish",
1414
"metadata": {},
1515
"source": [
1616
"## Define the steps of your workflow\n",
@@ -20,7 +20,7 @@
2020
{
2121
"cell_type": "code",
2222
"execution_count": 1,
23-
"id": "natural-hunger",
23+
"id": "unusual-speed",
2424
"metadata": {},
2525
"outputs": [],
2626
"source": [
@@ -30,7 +30,7 @@
3030
{
3131
"cell_type": "code",
3232
"execution_count": 2,
33-
"id": "rational-retro",
33+
"id": "least-confusion",
3434
"metadata": {},
3535
"outputs": [],
3636
"source": [
@@ -43,7 +43,7 @@
4343
{
4444
"cell_type": "code",
4545
"execution_count": 3,
46-
"id": "forward-fundamentals",
46+
"id": "sized-desperate",
4747
"metadata": {},
4848
"outputs": [],
4949
"source": [
@@ -56,7 +56,7 @@
5656
{
5757
"cell_type": "code",
5858
"execution_count": 4,
59-
"id": "ahead-devices",
59+
"id": "closed-fortune",
6060
"metadata": {},
6161
"outputs": [],
6262
"source": [
@@ -69,7 +69,7 @@
6969
{
7070
"cell_type": "code",
7171
"execution_count": 5,
72-
"id": "metric-referral",
72+
"id": "growing-foster",
7373
"metadata": {},
7474
"outputs": [],
7575
"source": [
@@ -82,7 +82,7 @@
8282
},
8383
{
8484
"cell_type": "markdown",
85-
"id": "european-viking",
85+
"id": "palestinian-poverty",
8686
"metadata": {},
8787
"source": [
8888
"## Define your workflow using @fairworkflow\n",
@@ -92,7 +92,7 @@
9292
{
9393
"cell_type": "code",
9494
"execution_count": 6,
95-
"id": "atmospheric-granny",
95+
"id": "retired-assignment",
9696
"metadata": {},
9797
"outputs": [],
9898
"source": [
@@ -109,7 +109,7 @@
109109
},
110110
{
111111
"cell_type": "markdown",
112-
"id": "intimate-correction",
112+
"id": "protecting-street",
113113
"metadata": {},
114114
"source": [
115115
"## Create an instance of your workflow and display it"
@@ -118,7 +118,7 @@
118118
{
119119
"cell_type": "code",
120120
"execution_count": 7,
121-
"id": "hazardous-nancy",
121+
"id": "printable-storage",
122122
"metadata": {},
123123
"outputs": [
124124
{
@@ -140,7 +140,7 @@
140140
{
141141
"cell_type": "code",
142142
"execution_count": 8,
143-
"id": "under-costa",
143+
"id": "atomic-background",
144144
"metadata": {},
145145
"outputs": [
146146
{
@@ -164,17 +164,109 @@
164164
},
165165
{
166166
"cell_type": "markdown",
167-
"id": "informal-cosmetic",
167+
"id": "false-imagination",
168+
"metadata": {},
169+
"source": [
170+
"## Publish the (prospective) workflow\n",
171+
"You may publish the workflow, and its steps, as nanopublications in the usual manner:"
172+
]
173+
},
174+
{
175+
"cell_type": "code",
176+
"execution_count": 9,
177+
"id": "statewide-search",
178+
"metadata": {},
179+
"outputs": [
180+
{
181+
"name": "stdout",
182+
"output_type": "stream",
183+
"text": [
184+
"Published to http://purl.org/np/RANKki6Fh-QYTHJ39yhJNOEcQLZOJld1VZFEvaLeILgCA\n",
185+
"Published concept to http://purl.org/np/RANKki6Fh-QYTHJ39yhJNOEcQLZOJld1VZFEvaLeILgCA#step\n",
186+
"Published to http://purl.org/np/RAsljALsS_3aL57HIU-8tdyxYl3ESlSkQu3kCfWBxvZV0\n",
187+
"Published concept to http://purl.org/np/RAsljALsS_3aL57HIU-8tdyxYl3ESlSkQu3kCfWBxvZV0#step\n",
188+
"Published to http://purl.org/np/RAUod2ToGWqyvBbFqKRPB4ilwjx78fYR1l37ORKDXLsk4\n",
189+
"Published concept to http://purl.org/np/RAUod2ToGWqyvBbFqKRPB4ilwjx78fYR1l37ORKDXLsk4#step\n",
190+
"Published to http://purl.org/np/RAuKOFZgd1RehE5vOclqdvJo2zchDUUF33VIh8A_8DXtM\n",
191+
"Published concept to http://purl.org/np/RAuKOFZgd1RehE5vOclqdvJo2zchDUUF33VIh8A_8DXtM#step\n",
192+
"Published to http://purl.org/np/RAFHW530LVNe6DwMV4uvA5cDLItEuvEbHJhfczfW92nMg\n",
193+
"Published concept to http://purl.org/np/RAFHW530LVNe6DwMV4uvA5cDLItEuvEbHJhfczfW92nMg#plan\n"
194+
]
195+
},
196+
{
197+
"data": {
198+
"text/plain": [
199+
"{'nanopub_uri': 'http://purl.org/np/RAFHW530LVNe6DwMV4uvA5cDLItEuvEbHJhfczfW92nMg',\n",
200+
" 'concept_uri': 'http://purl.org/np/RAFHW530LVNe6DwMV4uvA5cDLItEuvEbHJhfczfW92nMg#plan'}"
201+
]
202+
},
203+
"execution_count": 9,
204+
"metadata": {},
205+
"output_type": "execute_result"
206+
}
207+
],
208+
"source": [
209+
"fw.publish_as_nanopub()"
210+
]
211+
},
212+
{
213+
"cell_type": "markdown",
214+
"id": "fabulous-hydrogen",
215+
"metadata": {},
216+
"source": [
217+
"Be warned though - the above will keep publishing to the 'real' nanopub server network. For testing you may prefer to publish to the test servers as follows (note that this will refuse to publish a workflow you have already published :"
218+
]
219+
},
220+
{
221+
"cell_type": "code",
222+
"execution_count": 10,
223+
"id": "breeding-barrier",
224+
"metadata": {},
225+
"outputs": [
226+
{
227+
"name": "stderr",
228+
"output_type": "stream",
229+
"text": [
230+
"/Users/robinrichardson/miniconda3/envs/fairworkflows/lib/python3.8/site-packages/fairworkflows/rdf_wrapper.py:213: UserWarning: Cannot publish() this Fair object. This rdf is already published (at http://purl.org/np/RAFHW530LVNe6DwMV4uvA5cDLItEuvEbHJhfczfW92nMg#plan) and has not been modified locally.\n",
231+
" warnings.warn(f'Cannot publish() this Fair object. '\n"
232+
]
233+
},
234+
{
235+
"data": {
236+
"text/plain": [
237+
"{'nanopub_uri': None, 'concept_uri': None}"
238+
]
239+
},
240+
"execution_count": 10,
241+
"metadata": {},
242+
"output_type": "execute_result"
243+
}
244+
],
245+
"source": [
246+
"fw.publish_as_nanopub(use_test_server=True)"
247+
]
248+
},
249+
{
250+
"cell_type": "markdown",
251+
"id": "large-biography",
252+
"metadata": {},
253+
"source": [
254+
"You can then find your nanopublications by replacing the base of the URI with http://test-server.nanopubs.lod.labs.vu.nl/"
255+
]
256+
},
257+
{
258+
"cell_type": "markdown",
259+
"id": "balanced-filing",
168260
"metadata": {},
169261
"source": [
170262
"## Execute your workflow using .execute()\n",
171-
"Set num_threads greater than 1 if you wish to exploit parallelisation in your workflow. A separate RetroProv object is also returned that can (optionally) be published as a nanopublication. This is not yet implemented, pending one of the RDF tasks set out in the planning document."
263+
"Set num_threads greater than 1 if you wish to exploit parallelisation in your workflow. A separate RetroProv object is also returned that can (optionally) be published as a nanopublication."
172264
]
173265
},
174266
{
175267
"cell_type": "code",
176-
"execution_count": 14,
177-
"id": "baking-perspective",
268+
"execution_count": 11,
269+
"id": "scheduled-forest",
178270
"metadata": {},
179271
"outputs": [
180272
{
@@ -183,7 +275,7 @@
183275
"-66"
184276
]
185277
},
186-
"execution_count": 14,
278+
"execution_count": 11,
187279
"metadata": {},
188280
"output_type": "execute_result"
189281
}
@@ -195,120 +287,132 @@
195287
},
196288
{
197289
"cell_type": "markdown",
198-
"id": "attached-spirit",
290+
"id": "pressing-hartford",
199291
"metadata": {},
200292
"source": [
201-
"## Get Plex RDF of workflow"
293+
" ## Retrospective prov\n",
294+
" The retrospective prov object is not yet implemented, pending one of the RDF tasks set out in the planning document. For now, you may see simply the provenance trace for this run. We wish to turn this into a (Plex) RDF nanopublication:"
202295
]
203296
},
204297
{
205298
"cell_type": "code",
206-
"execution_count": null,
207-
"id": "fifteen-floating",
299+
"execution_count": 12,
300+
"id": "straight-watch",
208301
"metadata": {},
209-
"outputs": [],
302+
"outputs": [
303+
{
304+
"name": "stdout",
305+
"output_type": "stream",
306+
"text": [
307+
"2021-01-24 21:31:39,751 - job 13: add(1, 4)\n",
308+
"2021-01-24 21:31:39,751 - job 14: sub(1, 4)\n",
309+
"2021-01-24 21:31:39,753 - result 13 [add(1, 4)]: retrieved -> 5\n",
310+
"2021-01-24 21:31:39,753 - job 15: weird(5, 3)\n",
311+
"2021-01-24 21:31:39,754 - result 14 [sub(1, 4)]: retrieved -> -3\n",
312+
"2021-01-24 21:31:39,754 - result 15 [weird(5, 3)]: retrieved -> 22\n",
313+
"2021-01-24 21:31:39,755 - job 16: mul(22, -3)\n",
314+
"2021-01-24 21:31:39,755 - result 16 [mul(22, -3)]: retrieved -> -66\n",
315+
"2021-01-24 21:31:39,755 - -end-of-queue-\n",
316+
"\n"
317+
]
318+
}
319+
],
210320
"source": [
211-
"fw.get_workflow()"
321+
"print(prov)"
212322
]
213323
},
214-
{
215-
"cell_type": "raw",
216-
"id": "cooked-ridge",
217-
"metadata": {},
218-
"source": []
219-
},
220324
{
221325
"cell_type": "code",
222326
"execution_count": null,
223-
"id": "governing-gauge",
327+
"id": "iraqi-messaging",
224328
"metadata": {},
225329
"outputs": [],
226330
"source": []
227331
},
228332
{
229333
"cell_type": "code",
230334
"execution_count": null,
231-
"id": "ultimate-setup",
335+
"id": "confident-emission",
232336
"metadata": {},
233337
"outputs": [],
234338
"source": []
235339
},
236340
{
237341
"cell_type": "code",
238342
"execution_count": null,
239-
"id": "distant-distance",
343+
"id": "exterior-duplicate",
240344
"metadata": {},
241345
"outputs": [],
242346
"source": []
243347
},
244348
{
245349
"cell_type": "code",
246350
"execution_count": null,
247-
"id": "opening-duration",
351+
"id": "administrative-complex",
248352
"metadata": {},
249353
"outputs": [],
250354
"source": []
251355
},
252356
{
253357
"cell_type": "code",
254358
"execution_count": null,
255-
"id": "constitutional-stand",
359+
"id": "killing-investing",
256360
"metadata": {},
257361
"outputs": [],
258362
"source": []
259363
},
260364
{
261365
"cell_type": "code",
262366
"execution_count": null,
263-
"id": "celtic-cookbook",
367+
"id": "mathematical-departure",
264368
"metadata": {},
265369
"outputs": [],
266370
"source": []
267371
},
268372
{
269373
"cell_type": "code",
270374
"execution_count": null,
271-
"id": "phantom-cowboy",
375+
"id": "caroline-lending",
272376
"metadata": {},
273377
"outputs": [],
274378
"source": []
275379
},
276380
{
277381
"cell_type": "code",
278382
"execution_count": null,
279-
"id": "controlled-premium",
383+
"id": "ultimate-monte",
280384
"metadata": {},
281385
"outputs": [],
282386
"source": []
283387
},
284388
{
285389
"cell_type": "code",
286390
"execution_count": null,
287-
"id": "artistic-quantity",
391+
"id": "greater-whole",
288392
"metadata": {},
289393
"outputs": [],
290394
"source": []
291395
},
292396
{
293397
"cell_type": "code",
294398
"execution_count": null,
295-
"id": "magnetic-lesbian",
399+
"id": "minimal-wagon",
296400
"metadata": {},
297401
"outputs": [],
298402
"source": []
299403
},
300404
{
301405
"cell_type": "code",
302406
"execution_count": null,
303-
"id": "alpine-ethnic",
407+
"id": "administrative-nation",
304408
"metadata": {},
305409
"outputs": [],
306410
"source": []
307411
},
308412
{
309413
"cell_type": "code",
310414
"execution_count": null,
311-
"id": "indoor-dating",
415+
"id": "analyzed-belief",
312416
"metadata": {},
313417
"outputs": [],
314418
"source": []

0 commit comments

Comments
 (0)