From 6a2518988f3670c502301ea53a5501bcc176140d Mon Sep 17 00:00:00 2001 From: David Rouquet <david.rouquet@tetras-libre.fr> Date: Tue, 7 Jun 2022 09:37:28 +0000 Subject: [PATCH] =?UTF-8?q?T=C3=A9l=C3=A9verser=20un=20nouveau=20fichier?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tetras-mars-web-app-navigation.ipynb | 1113 ++++++++++++++++++++++++++ 1 file changed, 1113 insertions(+) create mode 100644 tetras-mars-web-app-navigation.ipynb diff --git a/tetras-mars-web-app-navigation.ipynb b/tetras-mars-web-app-navigation.ipynb new file mode 100644 index 0000000..6a40920 --- /dev/null +++ b/tetras-mars-web-app-navigation.ipynb @@ -0,0 +1,1113 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "160ab8ab-091e-4b00-b63a-c3746c71c540", + "metadata": {}, + "outputs": [ + { + "data": { + "application/javascript": [ + "\n", + "(function(root) {\n", + " function now() {\n", + " return new Date();\n", + " }\n", + "\n", + " var force = true;\n", + "\n", + " if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n", + " root._bokeh_onload_callbacks = [];\n", + " root._bokeh_is_loading = undefined;\n", + " }\n", + "\n", + " if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n", + " root._bokeh_timeout = Date.now() + 5000;\n", + " root._bokeh_failed_load = false;\n", + " }\n", + "\n", + " function run_callbacks() {\n", + " try {\n", + " root._bokeh_onload_callbacks.forEach(function(callback) {\n", + " if (callback != null)\n", + " callback();\n", + " });\n", + " } finally {\n", + " delete root._bokeh_onload_callbacks\n", + " }\n", + " console.debug(\"Bokeh: all callbacks have finished\");\n", + " }\n", + "\n", + " function load_libs(css_urls, js_urls, js_modules, callback) {\n", + " if (css_urls == null) css_urls = [];\n", + " if (js_urls == null) js_urls = [];\n", + " if (js_modules == null) js_modules = [];\n", + "\n", + " root._bokeh_onload_callbacks.push(callback);\n", + " if (root._bokeh_is_loading > 0) {\n", + " console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n", + " return null;\n", + " }\n", + " if (js_urls.length === 0 && js_modules.length === 0) {\n", + " run_callbacks();\n", + " return null;\n", + " }\n", + " console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n", + " root._bokeh_is_loading = css_urls.length + js_urls.length + js_modules.length;\n", + "\n", + " function on_load() {\n", + " root._bokeh_is_loading--;\n", + " if (root._bokeh_is_loading === 0) {\n", + " console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n", + " run_callbacks()\n", + " }\n", + " }\n", + "\n", + " function on_error() {\n", + " console.error(\"failed to load \" + url);\n", + " }\n", + "\n", + " for (var i = 0; i < css_urls.length; i++) {\n", + " var url = css_urls[i];\n", + " const element = document.createElement(\"link\");\n", + " element.onload = on_load;\n", + " element.onerror = on_error;\n", + " element.rel = \"stylesheet\";\n", + " element.type = \"text/css\";\n", + " element.href = url;\n", + " console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n", + " document.body.appendChild(element);\n", + " }\n", + "\n", + " var skip = [];\n", + " if (window.requirejs) {\n", + " window.requirejs.config({'paths': {'tabulator': 'https://unpkg.com/tabulator-tables@4.9.3/dist/js/tabulator'}});\n", + " require([\"tabulator\"], function(Tabulator,) {\n", + " window.Tabulator = Tabulator;\n", + " })\n", + " }\n", + " if (((window['tabulator'] !== undefined) && (!(window['tabulator'] instanceof HTMLElement))) || window.requirejs) {\n", + " var urls = ['https://unpkg.com/tabulator-tables@4.9.3/dist/js/tabulator.js', 'https://unpkg.com/moment@2.27.0/moment.js'];\n", + " for (var i = 0; i < urls.length; i++) {\n", + " skip.push(urls[i])\n", + " }\n", + " }\n", + " for (var i = 0; i < js_urls.length; i++) {\n", + " var url = js_urls[i];\n", + " if (skip.indexOf(url) >= 0) { on_load(); continue; }\n", + " var element = document.createElement('script');\n", + " element.onload = on_load;\n", + " element.onerror = on_error;\n", + " element.async = false;\n", + " element.src = url;\n", + " console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n", + " document.head.appendChild(element);\n", + " }\n", + " for (var i = 0; i < js_modules.length; i++) {\n", + " var url = js_modules[i];\n", + " if (skip.indexOf(url) >= 0) { on_load(); continue; }\n", + " var element = document.createElement('script');\n", + " element.onload = on_load;\n", + " element.onerror = on_error;\n", + " element.async = false;\n", + " element.src = url;\n", + " element.type = \"module\";\n", + " console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n", + " document.head.appendChild(element);\n", + " }\n", + " if (!js_urls.length && !js_modules.length) {\n", + " on_load()\n", + " }\n", + " };\n", + "\n", + " function inject_raw_css(css) {\n", + " const element = document.createElement(\"style\");\n", + " element.appendChild(document.createTextNode(css));\n", + " document.body.appendChild(element);\n", + " }\n", + "\n", + " var js_urls = [\"https://unpkg.com/tabulator-tables@4.9.3/dist/js/tabulator.js\", \"https://unpkg.com/moment@2.27.0/moment.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-2.3.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.3.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.3.2.min.js\", \"https://unpkg.com/@holoviz/panel@^0.11.3/dist/panel.min.js\"];\n", + " var js_modules = [];\n", + " var css_urls = [\"https://unpkg.com/tabulator-tables@4.9.3/dist/css/tabulator_simple.min.css\", \"https://unpkg.com/@holoviz/panel@0.11.3/dist/css/widgets.css\", \"https://unpkg.com/@holoviz/panel@0.11.3/dist/css/card.css\", \"https://unpkg.com/@holoviz/panel@0.11.3/dist/css/dataframe.css\", \"https://unpkg.com/@holoviz/panel@0.11.3/dist/css/alerts.css\", \"https://unpkg.com/@holoviz/panel@0.11.3/dist/css/loading.css\", \"https://unpkg.com/@holoviz/panel@0.11.3/dist/css/markdown.css\", \"https://unpkg.com/@holoviz/panel@0.11.3/dist/css/json.css\"];\n", + " var inline_js = [\n", + " function(Bokeh) {\n", + " inject_raw_css(\"\\n .bk.pn-loading.arcs:before {\\n background-image: url(\\\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBzdHlsZT0ibWFyZ2luOiBhdXRvOyBiYWNrZ3JvdW5kOiBub25lOyBkaXNwbGF5OiBibG9jazsgc2hhcGUtcmVuZGVyaW5nOiBhdXRvOyIgdmlld0JveD0iMCAwIDEwMCAxMDAiIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaWRZTWlkIj4gIDxjaXJjbGUgY3g9IjUwIiBjeT0iNTAiIHI9IjMyIiBzdHJva2Utd2lkdGg9IjgiIHN0cm9rZT0iI2MzYzNjMyIgc3Ryb2tlLWRhc2hhcnJheT0iNTAuMjY1NDgyNDU3NDM2NjkgNTAuMjY1NDgyNDU3NDM2NjkiIGZpbGw9Im5vbmUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCI+ICAgIDxhbmltYXRlVHJhbnNmb3JtIGF0dHJpYnV0ZU5hbWU9InRyYW5zZm9ybSIgdHlwZT0icm90YXRlIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgZHVyPSIxcyIga2V5VGltZXM9IjA7MSIgdmFsdWVzPSIwIDUwIDUwOzM2MCA1MCA1MCI+PC9hbmltYXRlVHJhbnNmb3JtPiAgPC9jaXJjbGU+PC9zdmc+\\\")\\n }\\n \");\n", + " },\n", + " function(Bokeh) {\n", + " Bokeh.set_log_level(\"info\");\n", + " },\n", + " function(Bokeh) {} // ensure no trailing comma for IE\n", + " ];\n", + "\n", + " function run_inline_js() {\n", + " if ((root.Bokeh !== undefined) || (force === true)) {\n", + " for (var i = 0; i < inline_js.length; i++) {\n", + " inline_js[i].call(root, root.Bokeh);\n", + " }} else if (Date.now() < root._bokeh_timeout) {\n", + " setTimeout(run_inline_js, 100);\n", + " } else if (!root._bokeh_failed_load) {\n", + " console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n", + " root._bokeh_failed_load = true;\n", + " }\n", + " }\n", + "\n", + " if (root._bokeh_is_loading === 0) {\n", + " console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n", + " run_inline_js();\n", + " } else {\n", + " load_libs(css_urls, js_urls, js_modules, function() {\n", + " console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n", + " run_inline_js();\n", + " });\n", + " }\n", + "}(window));" + ], + "application/vnd.holoviews_load.v0+json": "\n(function(root) {\n function now() {\n return new Date();\n }\n\n var force = true;\n\n if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n root._bokeh_onload_callbacks = [];\n root._bokeh_is_loading = undefined;\n }\n\n if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_failed_load = false;\n }\n\n function run_callbacks() {\n try {\n root._bokeh_onload_callbacks.forEach(function(callback) {\n if (callback != null)\n callback();\n });\n } finally {\n delete root._bokeh_onload_callbacks\n }\n console.debug(\"Bokeh: all callbacks have finished\");\n }\n\n function load_libs(css_urls, js_urls, js_modules, callback) {\n if (css_urls == null) css_urls = [];\n if (js_urls == null) js_urls = [];\n if (js_modules == null) js_modules = [];\n\n root._bokeh_onload_callbacks.push(callback);\n if (root._bokeh_is_loading > 0) {\n console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n return null;\n }\n if (js_urls.length === 0 && js_modules.length === 0) {\n run_callbacks();\n return null;\n }\n console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n root._bokeh_is_loading = css_urls.length + js_urls.length + js_modules.length;\n\n function on_load() {\n root._bokeh_is_loading--;\n if (root._bokeh_is_loading === 0) {\n console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n run_callbacks()\n }\n }\n\n function on_error() {\n console.error(\"failed to load \" + url);\n }\n\n for (var i = 0; i < css_urls.length; i++) {\n var url = css_urls[i];\n const element = document.createElement(\"link\");\n element.onload = on_load;\n element.onerror = on_error;\n element.rel = \"stylesheet\";\n element.type = \"text/css\";\n element.href = url;\n console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n document.body.appendChild(element);\n }\n\n var skip = [];\n if (window.requirejs) {\n window.requirejs.config({'paths': {'tabulator': 'https://unpkg.com/tabulator-tables@4.9.3/dist/js/tabulator'}});\n require([\"tabulator\"], function(Tabulator,) {\n window.Tabulator = Tabulator;\n })\n }\n if (((window['tabulator'] !== undefined) && (!(window['tabulator'] instanceof HTMLElement))) || window.requirejs) {\n var urls = ['https://unpkg.com/tabulator-tables@4.9.3/dist/js/tabulator.js', 'https://unpkg.com/moment@2.27.0/moment.js'];\n for (var i = 0; i < urls.length; i++) {\n skip.push(urls[i])\n }\n }\n for (var i = 0; i < js_urls.length; i++) {\n var url = js_urls[i];\n if (skip.indexOf(url) >= 0) { on_load(); continue; }\n var element = document.createElement('script');\n element.onload = on_load;\n element.onerror = on_error;\n element.async = false;\n element.src = url;\n console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.head.appendChild(element);\n }\n for (var i = 0; i < js_modules.length; i++) {\n var url = js_modules[i];\n if (skip.indexOf(url) >= 0) { on_load(); continue; }\n var element = document.createElement('script');\n element.onload = on_load;\n element.onerror = on_error;\n element.async = false;\n element.src = url;\n element.type = \"module\";\n console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.head.appendChild(element);\n }\n if (!js_urls.length && !js_modules.length) {\n on_load()\n }\n };\n\n function inject_raw_css(css) {\n const element = document.createElement(\"style\");\n element.appendChild(document.createTextNode(css));\n document.body.appendChild(element);\n }\n\n var js_urls = [\"https://unpkg.com/tabulator-tables@4.9.3/dist/js/tabulator.js\", \"https://unpkg.com/moment@2.27.0/moment.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-2.3.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.3.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.3.2.min.js\", \"https://unpkg.com/@holoviz/panel@^0.11.3/dist/panel.min.js\"];\n var js_modules = [];\n var css_urls = [\"https://unpkg.com/tabulator-tables@4.9.3/dist/css/tabulator_simple.min.css\", \"https://unpkg.com/@holoviz/panel@0.11.3/dist/css/widgets.css\", \"https://unpkg.com/@holoviz/panel@0.11.3/dist/css/card.css\", \"https://unpkg.com/@holoviz/panel@0.11.3/dist/css/dataframe.css\", \"https://unpkg.com/@holoviz/panel@0.11.3/dist/css/alerts.css\", \"https://unpkg.com/@holoviz/panel@0.11.3/dist/css/loading.css\", \"https://unpkg.com/@holoviz/panel@0.11.3/dist/css/markdown.css\", \"https://unpkg.com/@holoviz/panel@0.11.3/dist/css/json.css\"];\n var inline_js = [\n function(Bokeh) {\n inject_raw_css(\"\\n .bk.pn-loading.arcs:before {\\n background-image: url(\\\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBzdHlsZT0ibWFyZ2luOiBhdXRvOyBiYWNrZ3JvdW5kOiBub25lOyBkaXNwbGF5OiBibG9jazsgc2hhcGUtcmVuZGVyaW5nOiBhdXRvOyIgdmlld0JveD0iMCAwIDEwMCAxMDAiIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaWRZTWlkIj4gIDxjaXJjbGUgY3g9IjUwIiBjeT0iNTAiIHI9IjMyIiBzdHJva2Utd2lkdGg9IjgiIHN0cm9rZT0iI2MzYzNjMyIgc3Ryb2tlLWRhc2hhcnJheT0iNTAuMjY1NDgyNDU3NDM2NjkgNTAuMjY1NDgyNDU3NDM2NjkiIGZpbGw9Im5vbmUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCI+ICAgIDxhbmltYXRlVHJhbnNmb3JtIGF0dHJpYnV0ZU5hbWU9InRyYW5zZm9ybSIgdHlwZT0icm90YXRlIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgZHVyPSIxcyIga2V5VGltZXM9IjA7MSIgdmFsdWVzPSIwIDUwIDUwOzM2MCA1MCA1MCI+PC9hbmltYXRlVHJhbnNmb3JtPiAgPC9jaXJjbGU+PC9zdmc+\\\")\\n }\\n \");\n },\n function(Bokeh) {\n Bokeh.set_log_level(\"info\");\n },\n function(Bokeh) {} // ensure no trailing comma for IE\n ];\n\n function run_inline_js() {\n if ((root.Bokeh !== undefined) || (force === true)) {\n for (var i = 0; i < inline_js.length; i++) {\n inline_js[i].call(root, root.Bokeh);\n }} else if (Date.now() < root._bokeh_timeout) {\n setTimeout(run_inline_js, 100);\n } else if (!root._bokeh_failed_load) {\n console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n root._bokeh_failed_load = true;\n }\n }\n\n if (root._bokeh_is_loading === 0) {\n console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n run_inline_js();\n } else {\n load_libs(css_urls, js_urls, js_modules, function() {\n console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n run_inline_js();\n });\n }\n}(window));" + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/javascript": [ + "\n", + "if ((window.PyViz === undefined) || (window.PyViz instanceof HTMLElement)) {\n", + " window.PyViz = {comms: {}, comm_status:{}, kernels:{}, receivers: {}, plot_index: []}\n", + "}\n", + "\n", + "\n", + " function JupyterCommManager() {\n", + " }\n", + "\n", + " JupyterCommManager.prototype.register_target = function(plot_id, comm_id, msg_handler) {\n", + " if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n", + " var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n", + " comm_manager.register_target(comm_id, function(comm) {\n", + " comm.on_msg(msg_handler);\n", + " });\n", + " } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n", + " window.PyViz.kernels[plot_id].registerCommTarget(comm_id, function(comm) {\n", + " comm.onMsg = msg_handler;\n", + " });\n", + " } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n", + " google.colab.kernel.comms.registerTarget(comm_id, (comm) => {\n", + " var messages = comm.messages[Symbol.asyncIterator]();\n", + " function processIteratorResult(result) {\n", + " var message = result.value;\n", + " console.log(message)\n", + " var content = {data: message.data, comm_id};\n", + " var buffers = []\n", + " for (var buffer of message.buffers || []) {\n", + " buffers.push(new DataView(buffer))\n", + " }\n", + " var metadata = message.metadata || {};\n", + " var msg = {content, buffers, metadata}\n", + " msg_handler(msg);\n", + " return messages.next().then(processIteratorResult);\n", + " }\n", + " return messages.next().then(processIteratorResult);\n", + " })\n", + " }\n", + " }\n", + "\n", + " JupyterCommManager.prototype.get_client_comm = function(plot_id, comm_id, msg_handler) {\n", + " if (comm_id in window.PyViz.comms) {\n", + " return window.PyViz.comms[comm_id];\n", + " } else if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n", + " var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n", + " var comm = comm_manager.new_comm(comm_id, {}, {}, {}, comm_id);\n", + " if (msg_handler) {\n", + " comm.on_msg(msg_handler);\n", + " }\n", + " } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n", + " var comm = window.PyViz.kernels[plot_id].connectToComm(comm_id);\n", + " comm.open();\n", + " if (msg_handler) {\n", + " comm.onMsg = msg_handler;\n", + " }\n", + " } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n", + " var comm_promise = google.colab.kernel.comms.open(comm_id)\n", + " comm_promise.then((comm) => {\n", + " window.PyViz.comms[comm_id] = comm;\n", + " if (msg_handler) {\n", + " var messages = comm.messages[Symbol.asyncIterator]();\n", + " function processIteratorResult(result) {\n", + " var message = result.value;\n", + " var content = {data: message.data};\n", + " var metadata = message.metadata || {comm_id};\n", + " var msg = {content, metadata}\n", + " msg_handler(msg);\n", + " return messages.next().then(processIteratorResult);\n", + " }\n", + " return messages.next().then(processIteratorResult);\n", + " }\n", + " }) \n", + " var sendClosure = (data, metadata, buffers, disposeOnDone) => {\n", + " return comm_promise.then((comm) => {\n", + " comm.send(data, metadata, buffers, disposeOnDone);\n", + " });\n", + " };\n", + " var comm = {\n", + " send: sendClosure\n", + " };\n", + " }\n", + " window.PyViz.comms[comm_id] = comm;\n", + " return comm;\n", + " }\n", + " window.PyViz.comm_manager = new JupyterCommManager();\n", + " \n", + "\n", + "\n", + "var JS_MIME_TYPE = 'application/javascript';\n", + "var HTML_MIME_TYPE = 'text/html';\n", + "var EXEC_MIME_TYPE = 'application/vnd.holoviews_exec.v0+json';\n", + "var CLASS_NAME = 'output';\n", + "\n", + "/**\n", + " * Render data to the DOM node\n", + " */\n", + "function render(props, node) {\n", + " var div = document.createElement(\"div\");\n", + " var script = document.createElement(\"script\");\n", + " node.appendChild(div);\n", + " node.appendChild(script);\n", + "}\n", + "\n", + "/**\n", + " * Handle when a new output is added\n", + " */\n", + "function handle_add_output(event, handle) {\n", + " var output_area = handle.output_area;\n", + " var output = handle.output;\n", + " if ((output.data == undefined) || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n", + " return\n", + " }\n", + " var id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n", + " var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n", + " if (id !== undefined) {\n", + " var nchildren = toinsert.length;\n", + " var html_node = toinsert[nchildren-1].children[0];\n", + " html_node.innerHTML = output.data[HTML_MIME_TYPE];\n", + " var scripts = [];\n", + " var nodelist = html_node.querySelectorAll(\"script\");\n", + " for (var i in nodelist) {\n", + " if (nodelist.hasOwnProperty(i)) {\n", + " scripts.push(nodelist[i])\n", + " }\n", + " }\n", + "\n", + " scripts.forEach( function (oldScript) {\n", + " var newScript = document.createElement(\"script\");\n", + " var attrs = [];\n", + " var nodemap = oldScript.attributes;\n", + " for (var j in nodemap) {\n", + " if (nodemap.hasOwnProperty(j)) {\n", + " attrs.push(nodemap[j])\n", + " }\n", + " }\n", + " attrs.forEach(function(attr) { newScript.setAttribute(attr.name, attr.value) });\n", + " newScript.appendChild(document.createTextNode(oldScript.innerHTML));\n", + " oldScript.parentNode.replaceChild(newScript, oldScript);\n", + " });\n", + " if (JS_MIME_TYPE in output.data) {\n", + " toinsert[nchildren-1].children[1].textContent = output.data[JS_MIME_TYPE];\n", + " }\n", + " output_area._hv_plot_id = id;\n", + " if ((window.Bokeh !== undefined) && (id in Bokeh.index)) {\n", + " window.PyViz.plot_index[id] = Bokeh.index[id];\n", + " } else {\n", + " window.PyViz.plot_index[id] = null;\n", + " }\n", + " } else if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n", + " var bk_div = document.createElement(\"div\");\n", + " bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n", + " var script_attrs = bk_div.children[0].attributes;\n", + " for (var i = 0; i < script_attrs.length; i++) {\n", + " toinsert[toinsert.length - 1].childNodes[1].setAttribute(script_attrs[i].name, script_attrs[i].value);\n", + " }\n", + " // store reference to server id on output_area\n", + " output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n", + " }\n", + "}\n", + "\n", + "/**\n", + " * Handle when an output is cleared or removed\n", + " */\n", + "function handle_clear_output(event, handle) {\n", + " var id = handle.cell.output_area._hv_plot_id;\n", + " var server_id = handle.cell.output_area._bokeh_server_id;\n", + " if (((id === undefined) || !(id in PyViz.plot_index)) && (server_id !== undefined)) { return; }\n", + " var comm = window.PyViz.comm_manager.get_client_comm(\"hv-extension-comm\", \"hv-extension-comm\", function () {});\n", + " if (server_id !== null) {\n", + " comm.send({event_type: 'server_delete', 'id': server_id});\n", + " return;\n", + " } else if (comm !== null) {\n", + " comm.send({event_type: 'delete', 'id': id});\n", + " }\n", + " delete PyViz.plot_index[id];\n", + " if ((window.Bokeh !== undefined) & (id in window.Bokeh.index)) {\n", + " var doc = window.Bokeh.index[id].model.document\n", + " doc.clear();\n", + " const i = window.Bokeh.documents.indexOf(doc);\n", + " if (i > -1) {\n", + " window.Bokeh.documents.splice(i, 1);\n", + " }\n", + " }\n", + "}\n", + "\n", + "/**\n", + " * Handle kernel restart event\n", + " */\n", + "function handle_kernel_cleanup(event, handle) {\n", + " delete PyViz.comms[\"hv-extension-comm\"];\n", + " window.PyViz.plot_index = {}\n", + "}\n", + "\n", + "/**\n", + " * Handle update_display_data messages\n", + " */\n", + "function handle_update_output(event, handle) {\n", + " handle_clear_output(event, {cell: {output_area: handle.output_area}})\n", + " handle_add_output(event, handle)\n", + "}\n", + "\n", + "function register_renderer(events, OutputArea) {\n", + " function append_mime(data, metadata, element) {\n", + " // create a DOM node to render to\n", + " var toinsert = this.create_output_subarea(\n", + " metadata,\n", + " CLASS_NAME,\n", + " EXEC_MIME_TYPE\n", + " );\n", + " this.keyboard_manager.register_events(toinsert);\n", + " // Render to node\n", + " var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n", + " render(props, toinsert[0]);\n", + " element.append(toinsert);\n", + " return toinsert\n", + " }\n", + "\n", + " events.on('output_added.OutputArea', handle_add_output);\n", + " events.on('output_updated.OutputArea', handle_update_output);\n", + " events.on('clear_output.CodeCell', handle_clear_output);\n", + " events.on('delete.Cell', handle_clear_output);\n", + " events.on('kernel_ready.Kernel', handle_kernel_cleanup);\n", + "\n", + " OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n", + " safe: true,\n", + " index: 0\n", + " });\n", + "}\n", + "\n", + "if (window.Jupyter !== undefined) {\n", + " try {\n", + " var events = require('base/js/events');\n", + " var OutputArea = require('notebook/js/outputarea').OutputArea;\n", + " if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n", + " register_renderer(events, OutputArea);\n", + " }\n", + " } catch(err) {\n", + " }\n", + "}\n" + ], + "application/vnd.holoviews_load.v0+json": "\nif ((window.PyViz === undefined) || (window.PyViz instanceof HTMLElement)) {\n window.PyViz = {comms: {}, comm_status:{}, kernels:{}, receivers: {}, plot_index: []}\n}\n\n\n function JupyterCommManager() {\n }\n\n JupyterCommManager.prototype.register_target = function(plot_id, comm_id, msg_handler) {\n if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n comm_manager.register_target(comm_id, function(comm) {\n comm.on_msg(msg_handler);\n });\n } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n window.PyViz.kernels[plot_id].registerCommTarget(comm_id, function(comm) {\n comm.onMsg = msg_handler;\n });\n } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n google.colab.kernel.comms.registerTarget(comm_id, (comm) => {\n var messages = comm.messages[Symbol.asyncIterator]();\n function processIteratorResult(result) {\n var message = result.value;\n console.log(message)\n var content = {data: message.data, comm_id};\n var buffers = []\n for (var buffer of message.buffers || []) {\n buffers.push(new DataView(buffer))\n }\n var metadata = message.metadata || {};\n var msg = {content, buffers, metadata}\n msg_handler(msg);\n return messages.next().then(processIteratorResult);\n }\n return messages.next().then(processIteratorResult);\n })\n }\n }\n\n JupyterCommManager.prototype.get_client_comm = function(plot_id, comm_id, msg_handler) {\n if (comm_id in window.PyViz.comms) {\n return window.PyViz.comms[comm_id];\n } else if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n var comm = comm_manager.new_comm(comm_id, {}, {}, {}, comm_id);\n if (msg_handler) {\n comm.on_msg(msg_handler);\n }\n } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n var comm = window.PyViz.kernels[plot_id].connectToComm(comm_id);\n comm.open();\n if (msg_handler) {\n comm.onMsg = msg_handler;\n }\n } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n var comm_promise = google.colab.kernel.comms.open(comm_id)\n comm_promise.then((comm) => {\n window.PyViz.comms[comm_id] = comm;\n if (msg_handler) {\n var messages = comm.messages[Symbol.asyncIterator]();\n function processIteratorResult(result) {\n var message = result.value;\n var content = {data: message.data};\n var metadata = message.metadata || {comm_id};\n var msg = {content, metadata}\n msg_handler(msg);\n return messages.next().then(processIteratorResult);\n }\n return messages.next().then(processIteratorResult);\n }\n }) \n var sendClosure = (data, metadata, buffers, disposeOnDone) => {\n return comm_promise.then((comm) => {\n comm.send(data, metadata, buffers, disposeOnDone);\n });\n };\n var comm = {\n send: sendClosure\n };\n }\n window.PyViz.comms[comm_id] = comm;\n return comm;\n }\n window.PyViz.comm_manager = new JupyterCommManager();\n \n\n\nvar JS_MIME_TYPE = 'application/javascript';\nvar HTML_MIME_TYPE = 'text/html';\nvar EXEC_MIME_TYPE = 'application/vnd.holoviews_exec.v0+json';\nvar CLASS_NAME = 'output';\n\n/**\n * Render data to the DOM node\n */\nfunction render(props, node) {\n var div = document.createElement(\"div\");\n var script = document.createElement(\"script\");\n node.appendChild(div);\n node.appendChild(script);\n}\n\n/**\n * Handle when a new output is added\n */\nfunction handle_add_output(event, handle) {\n var output_area = handle.output_area;\n var output = handle.output;\n if ((output.data == undefined) || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n return\n }\n var id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n if (id !== undefined) {\n var nchildren = toinsert.length;\n var html_node = toinsert[nchildren-1].children[0];\n html_node.innerHTML = output.data[HTML_MIME_TYPE];\n var scripts = [];\n var nodelist = html_node.querySelectorAll(\"script\");\n for (var i in nodelist) {\n if (nodelist.hasOwnProperty(i)) {\n scripts.push(nodelist[i])\n }\n }\n\n scripts.forEach( function (oldScript) {\n var newScript = document.createElement(\"script\");\n var attrs = [];\n var nodemap = oldScript.attributes;\n for (var j in nodemap) {\n if (nodemap.hasOwnProperty(j)) {\n attrs.push(nodemap[j])\n }\n }\n attrs.forEach(function(attr) { newScript.setAttribute(attr.name, attr.value) });\n newScript.appendChild(document.createTextNode(oldScript.innerHTML));\n oldScript.parentNode.replaceChild(newScript, oldScript);\n });\n if (JS_MIME_TYPE in output.data) {\n toinsert[nchildren-1].children[1].textContent = output.data[JS_MIME_TYPE];\n }\n output_area._hv_plot_id = id;\n if ((window.Bokeh !== undefined) && (id in Bokeh.index)) {\n window.PyViz.plot_index[id] = Bokeh.index[id];\n } else {\n window.PyViz.plot_index[id] = null;\n }\n } else if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n var bk_div = document.createElement(\"div\");\n bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n var script_attrs = bk_div.children[0].attributes;\n for (var i = 0; i < script_attrs.length; i++) {\n toinsert[toinsert.length - 1].childNodes[1].setAttribute(script_attrs[i].name, script_attrs[i].value);\n }\n // store reference to server id on output_area\n output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n }\n}\n\n/**\n * Handle when an output is cleared or removed\n */\nfunction handle_clear_output(event, handle) {\n var id = handle.cell.output_area._hv_plot_id;\n var server_id = handle.cell.output_area._bokeh_server_id;\n if (((id === undefined) || !(id in PyViz.plot_index)) && (server_id !== undefined)) { return; }\n var comm = window.PyViz.comm_manager.get_client_comm(\"hv-extension-comm\", \"hv-extension-comm\", function () {});\n if (server_id !== null) {\n comm.send({event_type: 'server_delete', 'id': server_id});\n return;\n } else if (comm !== null) {\n comm.send({event_type: 'delete', 'id': id});\n }\n delete PyViz.plot_index[id];\n if ((window.Bokeh !== undefined) & (id in window.Bokeh.index)) {\n var doc = window.Bokeh.index[id].model.document\n doc.clear();\n const i = window.Bokeh.documents.indexOf(doc);\n if (i > -1) {\n window.Bokeh.documents.splice(i, 1);\n }\n }\n}\n\n/**\n * Handle kernel restart event\n */\nfunction handle_kernel_cleanup(event, handle) {\n delete PyViz.comms[\"hv-extension-comm\"];\n window.PyViz.plot_index = {}\n}\n\n/**\n * Handle update_display_data messages\n */\nfunction handle_update_output(event, handle) {\n handle_clear_output(event, {cell: {output_area: handle.output_area}})\n handle_add_output(event, handle)\n}\n\nfunction register_renderer(events, OutputArea) {\n function append_mime(data, metadata, element) {\n // create a DOM node to render to\n var toinsert = this.create_output_subarea(\n metadata,\n CLASS_NAME,\n EXEC_MIME_TYPE\n );\n this.keyboard_manager.register_events(toinsert);\n // Render to node\n var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n render(props, toinsert[0]);\n element.append(toinsert);\n return toinsert\n }\n\n events.on('output_added.OutputArea', handle_add_output);\n events.on('output_updated.OutputArea', handle_update_output);\n events.on('clear_output.CodeCell', handle_clear_output);\n events.on('delete.Cell', handle_clear_output);\n events.on('kernel_ready.Kernel', handle_kernel_cleanup);\n\n OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n safe: true,\n index: 0\n });\n}\n\nif (window.Jupyter !== undefined) {\n try {\n var events = require('base/js/events');\n var OutputArea = require('notebook/js/outputarea').OutputArea;\n if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n register_renderer(events, OutputArea);\n }\n } catch(err) {\n }\n}\n" + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "import panel as pn\n", + "import param\n", + "from glob import glob\n", + "import base64\n", + "import re\n", + "import requests\n", + "from subprocess import Popen, PIPE, STDOUT\n", + "import html\n", + "from cairosvg import svg2png\n", + "import graphviz\n", + "from rdflib import Graph\n", + "import os\n", + "from collections import OrderedDict\n", + "\n", + "pn.extension(comms='ipywidgets')" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "7b4685d7-698d-4a86-a0a4-a81d337bc9d7", + "metadata": {}, + "outputs": [], + "source": [ + "#######################################################################################################\n", + "# Parameters\n", + "#######################################################################################################\n", + "shaclBase = '/opt/dashboards/tools/shacl-1.3.2/bin/'\n", + "owl2vowlPath = '/opt/dashboards/tools/owl2vowl_0.3.7/owl2vowl.jar'\n", + "storeBase = '../store/CCTP-SRSA-IP-20210831/'\n", + "extractionGraph = '/opt/dashboards/tetras-lab-unl-demos/extraction-data-9.ttl'\n", + "pane_width = 1300" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "7b32d69a-52fb-4b9d-8cd9-5fb45c177284", + "metadata": {}, + "outputs": [], + "source": [ + "#######################################################################################################\n", + "# Extraction\n", + "#######################################################################################################\n", + "\n", + "def run_command(cmd):\n", + " with Popen(cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True) as p:\n", + " p.poll()\n", + " p.stdout.flush()\n", + " p.stderr.flush()\n", + " stdout, stderr = p.communicate()\n", + " return p.returncode, stdout, stderr\n", + "\n", + "# Run SHACL infer sh script. mode argument can take the values 'infer' or 'validate'\n", + "def shaclInfer(ttlPath, mode, ttlRulesPath = ''):\n", + " if ttlRulesPath == '':\n", + " cmd = ['sh', shaclBase+'/shacl'+mode+'.sh', '-datafile', ttlPath]\n", + " else:\n", + " cmd = ['sh', shaclBase+'/shacl'+mode+'.sh', '-datafile', ttlPath, '-shapesfile', ttlRulesPath]\n", + " #cmd = ' '.join(cmd) \n", + " #!{cmd}\n", + " code, out, err = run_command(cmd)\n", + " if code != 0:\n", + " print(\"Error in SHACL script: \\n\\n\"+err)\n", + " else:\n", + " return(out)\n", + " \n", + "def export_result(g):\n", + " export_file = 'output.ttl'\n", + " print(\"-- Export result as turtle: \" + export_file)\n", + " g.serialize(destination=export_file, base=base_uri, format='turtle')\n", + "\n", + "\n", + "#shaclInfer('/opt/dashboards/tetras-lab-unl-demos/demo-cctp-40.ttl', 'infer')\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "f66bfcd2-f2b9-4603-b1f2-d4fb643c8c3c", + "metadata": {}, + "outputs": [], + "source": [ + "g = Graph()\n", + "g.parse(extractionGraph)\n", + "g.parse('system-ontology.ttl')\n", + "\n", + "clearExecutionInstances = \"\"\"\n", + " PREFIX cts: <https://unsel.tetras-libre.fr/tenet/transduction-schemes#>\n", + " PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n", + " PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n", + "\n", + " DELETE {?x rdf:type ?c}\n", + " WHERE {\n", + " ?c rdfs:subClassOf* cts:Transduction_Schemes .\n", + " ?x rdf:type ?c .\n", + " }\n", + "\"\"\"\n", + "\n", + "addExecutionInstance = \"\"\"\n", + " PREFIX cts: <https://unsel.tetras-libre.fr/tenet/transduction-schemes#>\n", + " PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n", + " PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n", + "\n", + " INSERT DATA {{<exec_instance> rdf:type {}}}\n", + "\"\"\"\n", + "\n", + "# On exécute l'ensemble des règles d'extraction\n", + "g.parse(data = shaclInfer(extractionGraph, 'infer'))\n", + "g.serialize(destination=\"tmp.ttl\", base=\"http://tmp\", format='turtle')\n", + "\n", + "# On exécute ensuite seulement les règles de génération pour récupérer seulement le nécesaire à la visualisation\n", + "g.update(clearExecutionInstances)\n", + "g.update(addExecutionInstance.format('cts:generation'))\n", + "with open('/opt/dashboards/static/extraction.ttl', 'w') as outfile:\n", + " extractResult = shaclInfer('tmp.ttl', 'infer')\n", + " g.serialize(destination=\"tmp.ttl\", base=\"http://tmp\", format='turtle')\n", + " outfile.write(extractResult)\n", + " outfile.close()\n", + "\n", + "def owl2vowl(ttlFilePath, importList=[]):\n", + " # Run java parser\n", + " if importList == []:\n", + " cmd = ['java', '-jar', owl2vowlPath,\n", + " '-file', ttlFilePath] \n", + " else:\n", + " cmd = ['java', '-jar', owl2vowlPath,\n", + " '-file', ttlFilePath,\n", + " '-dependencies'] + importList \n", + " with Popen(cmd, stdout=PIPE, stderr=STDOUT) as p:\n", + " p.wait()\n", + " p.stdout.flush()\n", + " if p.returncode != 0:\n", + " print(\"Error in owl2vowl: \\n\\n\"+p.stdout.read().decode())\n", + " outFileName = ttlFilePath.split('/')[-1].replace('ttl','json')\n", + " os.rename(outFileName, '/opt/dashboards/static/webvowl_1.1.7/data/'+outFileName)\n", + " \n", + "owl2vowl('/opt/dashboards/static/extraction.ttl', importList=['system-ontology.ttl'])" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "40b54849-9333-4819-b953-6e816ffe474c", + "metadata": {}, + "outputs": [], + "source": [ + "#######################################################################################################\n", + "# Validation\n", + "#######################################################################################################\n", + "def pyshaclValidate():\n", + " from pyshacl import validate\n", + " data_file = open('tmp.ttl').read()\n", + " shapes_file = open('test-shacl-construct.shapes-order.ttl').read()\n", + " conforms, v_graph, v_text = validate(data_file, shacl_graph=shapes_file)\n", + " print(conforms)\n", + " print(v_graph)\n", + " print(v_text)\n", + " \n", + "possibleUnderspecificationQuery ='''\n", + "PREFIX owl: <http://www.w3.org/2002/07/owl#>\n", + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n", + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n", + "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n", + "PREFIX unl: <https://unl.tetras-libre.fr/rdf/schema#>\n", + "PREFIX net: <https://unsel.tetras-libre.fr/tenet/semantic-net#>\n", + "PREFIX cprm: <https://unsel.tetras-libre.fr/tenet/config/parameters#>\n", + "PREFIX req: <https://unsel.tetras-libre.fr/tenet/frame/requirement-ontology#>\n", + "PREFIX sys: <https://unsel.tetras-libre.fr/tenet/frame/system-ontology/>\n", + "PREFIX fprm: <https://unsel.tetras-libre.fr/tenet/frame/parameters#>\n", + "\n", + "SELECT ?thisId (CONCAT('Parle-t-on bien de tous les \"', ?entityLabel, '\" possibles ? (', ?subEntities, ')' ) AS ?message)\n", + "WHERE {\n", + "FILTER(?count>1)\n", + "{SELECT ?this ?thisId ?entityLabel (GROUP_CONCAT(?subEntityLabel;SEPARATOR=\", \") AS ?subEntities) (COUNT(?subEntityLabel) AS ?count)\n", + "WHERE {\n", + "\t?subEntity rdfs:subClassOf ?entity ; rdfs:label ?subEntityLabel .\n", + "\t{SELECT ?this ?entity ?thisId ?entityLabel\n", + "\tWHERE {\n", + " \t?this a unl:UNL_Sentence ; unl:has_id ?thisId .\n", + "\t\t?entity sys:from_structure ?this ; \n", + "\t\t\trdfs:subClassOf+ sys:Structure ;\n", + "\t\t\trdfs:label ?entityLabel .\n", + "\t\t FILTER (\n", + " \t\t!EXISTS {?subEntity1 rdfs:subClassOf ?entity; sys:from_structure ?this}\n", + " )\n", + "\t}} \n", + "}\n", + "GROUP BY ?this ?thisId ?entityLabel }\n", + "}\n", + "'''\n", + "\n", + "possibleClassEquivalenceQuery = '''PREFIX owl: <http://www.w3.org/2002/07/owl#>\n", + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n", + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n", + "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n", + "PREFIX unl: <https://unl.tetras-libre.fr/rdf/schema#>\n", + "PREFIX net: <https://unsel.tetras-libre.fr/tenet/semantic-net#>\n", + "PREFIX cprm: <https://unsel.tetras-libre.fr/tenet/config/parameters#>\n", + "PREFIX req: <https://unsel.tetras-libre.fr/tenet/frame/requirement-ontology#>\n", + "PREFIX sys: <https://unsel.tetras-libre.fr/tenet/frame/system-ontology/>\n", + "PREFIX fprm: <https://unsel.tetras-libre.fr/tenet/frame/parameters#>\n", + "\n", + "SELECT (CONCAT(?messageTMP, ?sentenceList, ')') AS ?message) ?sentenceList\n", + "WHERE {\n", + "SELECT ?messageTMP (GROUP_CONCAT(?sentenceId; SEPARATOR=\", \") AS ?sentenceList)\n", + "WHERE {\t\n", + "\tSELECT DISTINCT ?messageTMP ?sentenceId\n", + "\tWHERE {\n", + "\t\tFILTER (?count = 1)\n", + "\t\t?subEntity rdfs:subClassOf ?this ; rdfs:label ?subEntityLabel ; sys:from_structure ?subEntitySentence .\n", + "\t\t?this rdfs:label ?thisLabel ; sys:from_structure ?thisSentence .\n", + " \tBIND(CONCAT('\"', ?subEntityLabel, '\" est la seule sous classe de \"', ?thisLabel, '\". Ces classes sont-elles équivalentes ? <br/>(voir les exigences ') AS ?messageTMP)\n", + " \t\t{?thisSentence unl:has_id ?thisSentenceId .\n", + "\t\t\tBIND (?thisSentenceId AS ?sentenceId)} \n", + "\t\tUNION \n", + "\t\t\t{?subEntitySentence unl:has_id ?subEntitySentenceId .\n", + "\t\t\tBIND (?subEntitySentenceId AS ?sentenceId)}\n", + "\tFILTER(NOT EXISTS {?subEntity sys:from_structure ?thisSentence})\n", + "\t\t{SELECT ?this (COUNT(?subClass) AS ?count)\n", + "\t\tWHERE {\n", + " \t \t?this rdfs:subClassOf+ sys:Structure .\n", + "\t\t\t\t?subClass rdfs:subClassOf ?this\n", + "\t\t} GROUP BY ?this } \n", + "\t} ORDER BY ?sentenceId\n", + "} GROUP BY ?messageTMP\n", + "}'''\n", + "\n", + "unfeaturedDomainOrRangeQuery = '''PREFIX owl: <http://www.w3.org/2002/07/owl#>\n", + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n", + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n", + "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n", + "PREFIX unl: <https://unl.tetras-libre.fr/rdf/schema#>\n", + "PREFIX net: <https://unsel.tetras-libre.fr/tenet/semantic-net#>\n", + "PREFIX cprm: <https://unsel.tetras-libre.fr/tenet/config/parameters#>\n", + "PREFIX req: <https://unsel.tetras-libre.fr/tenet/frame/requirement-ontology#>\n", + "PREFIX sys: <https://unsel.tetras-libre.fr/tenet/frame/system-ontology/>\n", + "PREFIX fprm: <https://unsel.tetras-libre.fr/tenet/frame/parameters#>\n", + "\n", + "SELECT ?sentenceId (CONCAT(?messageTMP, GROUP_CONCAT(?featureLabel ; SEPARATOR=', ')) AS ?message)\n", + "WHERE {\n", + " SELECT DISTINCT ?sentenceId ?featureLabel (CONCAT( 'Dans cette exigence, \"', ?unfeaturedLabel, '\" pourrait être précisé par : ') AS ?messageTMP)\n", + " WHERE {\n", + " {\n", + " ?p rdfs:subPropertyOf+ sys:objectProperty ;\n", + " rdfs:domain ?featured ; \n", + " rdfs:range ?unfeatured .\n", + " }\n", + " UNION\n", + " {\n", + " ?p rdfs:subPropertyOf+ sys:objectProperty ;\n", + " rdfs:domain ?unfeatured ; \n", + " rdfs:range ?featured .\n", + " }\n", + " ?p rdfs:label ?pLabel .\n", + " ?featured sys:has_feature ?feature .\n", + " FILTER(NOT EXISTS {\n", + " ?unfeatured sys:has_feature ?feature\n", + " })\n", + " ?featuredInstance a ?featured ; sys:from_structure ?sentence.\n", + " ?unfeaturedInstance a ?unfeatured ; sys:from_structure ?sentence.\n", + " ?sentence unl:has_id ?sentenceId .\n", + " FILTER(NOT EXISTS {\n", + " ?featuredInstance a ?featured2 .\n", + " ?featured2 rdfs:subClassOf ?featured .\n", + " })\n", + " FILTER(NOT EXISTS {\n", + " ?unfeaturedInstance a ?unfeatured2 .\n", + " ?unfeatured2 rdfs:subClassOf ?unfeatured .\n", + " })\n", + " ?featured rdfs:label ?featuredLabel .\n", + " ?unfeatured rdfs:label ?unfeaturedLabel .\n", + " ?feature rdfs:label ?featureLabel .\n", + "}\n", + " } GROUP BY ?sentenceId ?messageTMP\n", + "'''\n", + "\n", + "unfeaturedDomainOrRangeWithRefQuery ='''PREFIX owl: <http://www.w3.org/2002/07/owl#>\n", + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n", + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n", + "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n", + "PREFIX unl: <https://unl.tetras-libre.fr/rdf/schema#>\n", + "PREFIX net: <https://unsel.tetras-libre.fr/tenet/semantic-net#>\n", + "PREFIX cprm: <https://unsel.tetras-libre.fr/tenet/config/parameters#>\n", + "PREFIX req: <https://unsel.tetras-libre.fr/tenet/frame/requirement-ontology#>\n", + "PREFIX sys: <https://unsel.tetras-libre.fr/tenet/frame/system-ontology/>\n", + "PREFIX fprm: <https://unsel.tetras-libre.fr/tenet/frame/parameters#>\n", + "\n", + "SELECT ?sentenceId (CONCAT('\"', ?unfeaturedLabel, '\" devrait être précisé par un ou plusieurs attributs parmis : ', ?featureList, '. <br/>(exemples de référence : ', GROUP_CONCAT(?sentence2id ; SEPARATOR=', '), ').') AS ?message) \n", + "WHERE {\n", + "{SELECT DISTINCT ?sentenceId ?unfeaturedLabel ?sentence2id (GROUP_CONCAT(?featureLabel ; SEPARATOR=', ') AS ?featureList) #\n", + "WHERE {\n", + " SELECT DISTINCT ?sentenceId ?sentence2id ?unfeaturedLabel ?featureLabel ?otherwiseFeaturedLabel ?featured2label\n", + " WHERE {\n", + " {\n", + " ?p rdfs:subPropertyOf+ sys:objectProperty ;\n", + " rdfs:domain ?featured ; \n", + " rdfs:range ?unfeatured .\n", + " }\n", + " UNION\n", + " {\n", + " ?p rdfs:subPropertyOf+ sys:objectProperty ;\n", + " rdfs:domain ?unfeatured ; \n", + " rdfs:range ?featured .\n", + " }\n", + " ?p rdfs:label ?pLabel .\n", + " ?featured sys:has_feature ?feature .\n", + " FILTER(NOT EXISTS {\n", + " ?unfeatured sys:has_feature ?feature\n", + " })\n", + " ?featuredInstance a ?featured ; sys:from_structure ?sentence.\n", + " ?unfeaturedInstance a ?unfeatured ; sys:from_structure ?sentence.\n", + " ?sentence unl:has_id ?sentenceId .\n", + "\n", + "\t?otherwiseFeatured rdfs:subClassOf ?unfeatured ; sys:has_feature ?feature2 ; rdfs:label ?otherwiseFeaturedLabel.\n", + " ?otherwiseFeaturedInstance a ?otherwiseFeatured ; sys:from_structure ?sentence2.\t\n", + "\t?sentence2 unl:has_id ?sentence2id .\n", + "\t{?otherwiseFeaturedInstance ?p2 ?featuredInstance2} UNION { ?featuredInstance2 ?p2 ?otherwiseFeaturedInstance}\n", + "\t?featuredInstance2 a ?featured2 .\n", + "\t?featured2 sys:has_feature ?feature2 ; rdfs:label ?featured2label.\n", + "\t\t\n", + " FILTER(NOT EXISTS {\n", + " ?featuredInstance a ?featured2 .\n", + " ?featured2 rdfs:subClassOf ?featured .\n", + " })\n", + " FILTER(NOT EXISTS {\n", + " ?unfeaturedInstance a ?unfeatured2 .\n", + " ?unfeatured2 rdfs:subClassOf ?unfeatured .\n", + " })\n", + " ?featured rdfs:label ?featuredLabel .\n", + " ?unfeatured rdfs:label ?unfeaturedLabel .\n", + " ?feature rdfs:label ?featureLabel .\n", + " }\n", + "} GROUP BY ?sentenceId ?unfeaturedLabel ?sentence2id}\n", + "} GROUP BY ?sentenceId ?unfeaturedLabel ?featureList\n", + "'''\n", + "\n", + "\n", + "possibleUnderspecification = g.query(possibleUnderspecificationQuery)\n", + "possibleClassEquivalence = g.query(possibleClassEquivalenceQuery)\n", + "unfeaturedDomainOrRange = g.query(unfeaturedDomainOrRangeQuery)\n", + "\n", + "errorReqDic = {}\n", + "warningReqDic = {}\n", + "infoReqDic = {}\n", + "\n", + "\n", + "for r in possibleUnderspecification : \n", + " if str(r['thisId']) in warningReqDic:\n", + " warningReqDic[str(r['thisId'])] += [str(r['message'])]\n", + " else:\n", + " warningReqDic[str(r['thisId'])] = [str(r['message'])] \n", + "\n", + "for r in possibleClassEquivalence : \n", + " sentenceList = str(r['sentenceList']).split(', ')\n", + " for sentence in sentenceList:\n", + " if sentence in errorReqDic:\n", + " errorReqDic[sentence] += [str(r['message'])]\n", + " else:\n", + " errorReqDic[sentence] = [str(r['message'])] \n", + "\n", + "for r in unfeaturedDomainOrRange : \n", + " if str(r['sentenceId']) in infoReqDic:\n", + " infoReqDic[str(r['sentenceId'])] += [str(r['message'])]\n", + " else:\n", + " infoReqDic[str(r['sentenceId'])] = [str(r['message'])] " + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "ca43f1f2-42ef-4355-a2e2-e27351a51b96", + "metadata": {}, + "outputs": [], + "source": [ + "#######################################################################################################\n", + "# Navigateur / éditeur de corpus UNL\n", + "#######################################################################################################\n", + "\n", + "def unl2stuff(unlFilePath, jarPath, outPrefix, outType):\n", + " # Run java parser\n", + " cmd = ['java', '-jar', jarPath,\n", + " '--input-file', unlFilePath,\n", + " '--output-file', outPrefix,\n", + " '--output-type', outType]\n", + " with Popen(cmd, stdout=PIPE, stderr=STDOUT) as p:\n", + " p.wait()\n", + " p.stdout.flush()\n", + " if p.returncode != 0:\n", + " print(\"Error in unl2rdf: \\n\\n\"+p.stdout.read().decode())\n", + " print('UNL;')\n", + " print(text)\n", + "\n", + "def unl2dotWeb(unldata) :\n", + " data={'unl': unldata, 'outputs':['dot', 'svg', 'rdf']}\n", + " try:\n", + " r = requests.post('https://unl.demo.tetras-libre.fr/unl2rdf', data=data)\n", + " except Exception as e:\n", + " return 'Error calling https://unl.demo.tetras-libre.fr/unl2rdf : \"{error}\"'.format(error=e)\n", + " html=r.text\n", + " # On utilise une regex au lieu de parser le html car ce dernier est mal formé\n", + " regexSvg = re.compile('<svg.*svg>',re.MULTILINE|re.DOTALL)\n", + " regexRdf = re.compile(\"<code id='rdf' class='collapse show'>(.*?)</code>\",re.MULTILINE|re.DOTALL)\n", + " try : \n", + " svg = regexSvg.search(html).group()\n", + " rdf = regexRdf.search(html).group(1) \n", + " except Exception as e :\n", + " svg = ''\n", + " rdf = ''\n", + " print(e)\n", + " return(svg, rdf)\n", + "\n", + "def postEditRdf(rdfPath, frStr, enStr):\n", + " textID = rdfPath.rsplit('/', 1)[0]\n", + " newPrefix = \"http://unsel.rdf-unl.org/\"+textID\n", + " with open(rdfPath,'r') as rdfFile :\n", + " rdfStr = rdfFile.read()\n", + " rdfFile.close()\n", + " regexBaseUri = re.compile(\"http://rdf-unl.org.*?sentence.*?ontology\")\n", + " rdfStr = rdfStr.replace('rdfs:label \"TBD : phrase en langue naturelle\"@inv ;', \n", + " '<https://unl.tetras-libre.fr/rdf/schema#has_id> \"{}\" ;\\n'.format(textID.split('/')[-2])+'rdfs:label \"\"\"{}\"\"\"@fr ;\\n'.format(frStr)+' rdfs:label \"\"\"{}\"\"\"@en ;\\n'.format(enStr))\n", + " baseUri = regexBaseUri.search(rdfStr).group()\n", + " oldPrefix = baseUri.rsplit('/', 1)[0]\n", + " rdfStr = rdfStr.replace(oldPrefix+'#ontology', newPrefix.rsplit('/', 1)[0]+'#ontology') \n", + " rdfStr = rdfStr.replace(oldPrefix+'#', \"http://unsel.rdf-unl.org/uw_lexeme#\")\n", + " rdfStr = \"# baseURI: \"+baseUri+\"\\n @prefix : <\"+baseUri.replace(\"ontology\",\"\")+\"> .\\n\"+rdfStr\n", + " rdfStr = rdfStr.replace(oldPrefix, newPrefix)\n", + " with open(rdfPath,'w') as rdfFile :\n", + " rdfStr = rdfFile.write(rdfStr)\n", + " rdfFile.close()\n", + "\n", + "def writeUnlFiles(unlStr, storePrefix):\n", + " srsaRef = selectDir.value\n", + " with open(storePrefix+'.unl','w') as unlFile:\n", + " unlFile.write(unlStr)\n", + " unlFile.close() \n", + " \n", + " regexFr = re.compile(\"{org:fr}\\n(.*?)\\n{/org}\",re.MULTILINE|re.DOTALL)\n", + " try:\n", + " frStr = regexFr.search(unlStr).group(1)\n", + " except AttributeError:\n", + " frStr = ''\n", + " regexEn = re.compile(\"{en}\\n(.*?)\\n{/en}\",re.MULTILINE|re.DOTALL)\n", + " try:\n", + " enStr = regexEn.search(unlStr).group(1) \n", + " except AttributeError:\n", + " enStr = '' \n", + " # Generate dot and ttl with UNL tools jar\n", + " unl2stuff(storePrefix+'.unl', '/opt/dashboards/tools/unl2rdf-app-0.9.jar', storePrefix, 'rdf')\n", + " postEditRdf(storePrefix+'.ttl', frStr, enStr)\n", + " unl2stuff(storePrefix+'.unl', '/opt/dashboards/tools/unl2rdf-app-0.9.jar', storePrefix, 'dot')\n", + " # Generate svg and png\n", + " graphviz.render('dot', 'svg', storePrefix+'.dot') \n", + " graphviz.render('dot', 'png', storePrefix+'.dot')\n", + " \n", + " # Send UNL code to https://unl.demo.tetras-libre.fr/unl2rdf to get SVG and RDF\n", + " #svg, rdf = unl2dotWeb(unlStr)\n", + " #rdf = html.unescape(rdf)\n", + " #with open(storePrefix+'.svg','w') as svgFile:\n", + " # svgFile.write(svg)\n", + " # svgFile.close()\n", + " #with open(storePrefix+'.ttl','w') as rdfFile:\n", + " # rdfFile.write(rdf)\n", + " # rdfFile.close()\n", + " # Convert svg to png and write to a file\n", + " #svg2png(bytestring=svg, write_to=storePrefix+'.png')\n", + " \n", + "\n", + "saveButtonClicks = 0\n", + "\n", + "def main_pane(directory): \n", + " saveButtonClicks = 0\n", + " saveButton = pn.widgets.Button(name='Enregistrer', button_type='success', width = 100)\n", + " saveButtonDic = dict(button=saveButton)\n", + " saveCommentButton = pn.widgets.Button(name='Enregistrer', button_type='success', width = 100)\n", + " \n", + " path = storeBase+directory+'/current/'\n", + " pathOrig = storeBase+directory+'/orig/'\n", + " svgPath = path+directory+'.svg'\n", + " pngPath = path+directory+'.png'\n", + " unlPath = path+directory+'.unl'\n", + " rdfPath = path+directory+'.ttl'\n", + " commentPath = path+directory+'.comments'\n", + " with open(commentPath) as commentFile:\n", + " commentStr = commentFile.read() \n", + " commentFile.close()\n", + " with open(unlPath) as unlFile:\n", + " unlStr = unlFile.read()\n", + " unlFile.close()\n", + " svgPathOrig = pathOrig+directory+'.svg'\n", + " pngPathOrig = pathOrig+directory+'.png'\n", + " unlPathOrig = pathOrig+directory+'.unl'\n", + " rdfPathOrig = pathOrig+directory+'.ttl'\n", + " with open(unlPathOrig) as unlFileOrig:\n", + " unlStrOrig = unlFileOrig.read()\n", + " unlFileOrig.close()\n", + " unlHtmlOrig = unlStrOrig.replace(\"\\n\",\"<br/>\")\n", + " if unlStrOrig == unlStr:\n", + " modIndicator = ''\n", + " else:\n", + " modIndicator = ' <u>modifié</u>'\n", + " regexFr = re.compile(\"{org:fr}\\n(.*?)\\n{/org}\",re.MULTILINE|re.DOTALL)\n", + " try:\n", + " frStr = regexFr.search(unlStr).group(1)\n", + " except AttributeError:\n", + " frStr = ''\n", + " regexEn = re.compile(\"{en}\\n(.*?)\\n{/en}\",re.MULTILINE|re.DOTALL)\n", + " try:\n", + " enStr = regexEn.search(unlStr).group(1) \n", + " except AttributeError:\n", + " enStr = ''\n", + " \n", + " unlOrig_html = pn.pane.HTML(unlHtmlOrig)\n", + " unl_input = pn.widgets.input.TextAreaInput(height=400)\n", + " unl_input.value = unlStr\n", + " comment_input = pn.widgets.input.TextAreaInput(height=300)\n", + " comment_input.value = commentStr\n", + " \n", + " downloadSvg = pn.widgets.FileDownload(sizing_mode='stretch_width', file=svgPath, embed=True, name='Télécharger le graphe en SVG :')\n", + " downloadPng = pn.widgets.FileDownload(sizing_mode='stretch_width', file=pngPath, embed=True, name='Télécharger le graphe en PNG :') \n", + " downloadRdf = pn.widgets.FileDownload(sizing_mode='stretch_width', file=rdfPath, embed=True, name='Télécharger le code UNL-RDF :')\n", + " downloadUnl = pn.widgets.FileDownload(sizing_mode='stretch_width', file=unlPath, embed=True, name='Télécharger le code UNL :')\n", + " \n", + " def compute_unl_graph_pane(button):\n", + " global saveButtonClicks\n", + " if saveButtonClicks != 0:\n", + " writeUnlFiles(unl_input.value, storeBase+selectDir.value+'/current/'+selectDir.value)\n", + " pane = pn.pane.PNG(pngPath, width = pane_width)\n", + " saveButtonClicks += 1\n", + " return(pane)\n", + " \n", + " unl_graph_pane = pn.interact(lambda button : compute_unl_graph_pane(button), **saveButtonDic)\n", + " \n", + " warnColumn = pn.Card(width=pane_width, header = \"**Alertes automatiques pour l'exigence :**\")\n", + " warnings = 0\n", + " try: \n", + " for warn in errorReqDic[directory]:\n", + " warnColumn.append(pn.pane.HTML('<div class=\"alert alert-danger\">{}</div>'.format(warn)))\n", + " warnings = 1\n", + " except :\n", + " pass\n", + " try: \n", + " for warn in warningReqDic[directory]:\n", + " warnColumn.append(pn.pane.HTML('<div class=\"alert alert-warning\">{}</div>'.format(warn)))\n", + " warnings = 1\n", + " except :\n", + " pass\n", + " try: \n", + " for warn in infoReqDic[directory]:\n", + " warnColumn.append(pn.pane.HTML('<div class=\"alert alert-info\">{}</div>'.format(warn)))\n", + " warnings = 1\n", + " except :\n", + " pass\n", + " if warnings == 0:\n", + " warnColumn.append(pn.pane.HTML('<div class=\"alert alert-info\">Pas d\\'anomalie détectée</div>'))\n", + " \n", + " pane = pn.Column(\n", + " pn.pane.HTML('<font size=\"tiny\">Confirmation de sélection : '+directory+'</font>'),\n", + " warnColumn,\n", + " pn.pane.HTML('FR : '+frStr),\n", + " pn.pane.HTML('EN : '+enStr),\n", + " unl_graph_pane[1],\n", + " pn.Card(pn.Column(saveCommentButton, comment_input, width = pane_width),\n", + " header='**Commentaires** *(cliquer pour afficher)*', \n", + " collapsed=True, width = pane_width), \n", + " pn.Card(pn.Column(saveButton, unl_input, width = pane_width),\n", + " header='**Code UNL**'+modIndicator+' *(cliquer pour afficher)*', \n", + " collapsed=True, width = pane_width),\n", + " pn.Card(pn.Column(\n", + " unlOrig_html,\n", + " pn.Card(pn.pane.PNG(pngPath, width = pane_width-20), header = \"**Graphe d'origine**\", width=pane_width-10)\n", + " ), \n", + " header=\"**Code UNL d'origine** *(cliquer pour afficher)*\", \n", + " collapsed=True, width = pane_width),\n", + " pn.WidgetBox(\n", + " pn.Row(downloadPng, downloadSvg),\n", + " pn.Row(downloadUnl, downloadRdf),\n", + " width=pane_width,\n", + " ),\n", + " width=pane_width, \n", + " )\n", + " \n", + " def saveComments(event):\n", + " with open(commentPath, 'w') as commentFile:\n", + " commentFile.write(comment_input.value) \n", + " commentFile.close()\n", + " saveCommentButton.on_click(saveComments)\n", + " \n", + " return(pane)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "5d4ec56e-d0bb-44c8-975b-49d409b6b160", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "f8ef621a0bea4f39bc03c09af31b11a4", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "BokehModel(combine_events=True, render_bundle={'docs_json': {'d793ca72-54cc-4453-993c-58ac1620b69e': {'defs': …" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#######################################################################################################\n", + "# Interface\n", + "#######################################################################################################\n", + "\n", + "pathList = glob(storeBase+'*')\n", + "dirList = sorted([x.split('/')[-1] for x in pathList])\n", + "warningList = sorted(list(errorReqDic.keys())+list(warningReqDic.keys())+list(infoReqDic.keys()))\n", + "\n", + "dirDic = {}\n", + "for directory in dirList:\n", + " if directory in warningList:\n", + " dirDic['**'+directory] = directory\n", + " else:\n", + " dirDic[directory] = directory\n", + "\n", + "dirDic = dict(sorted(dirDic.items()))\n", + " \n", + "selectDir = pn.widgets.Select(name='Sélectionnez une exigence : ', options=dirDic, width = 300)\n", + "dir_selector = dict(directory=selectDir)#, save=saveButton)\n", + "\n", + "unlNavigatorPane = pn.interact(lambda directory : main_pane(directory), **dir_selector)\n", + "\n", + "#unl_graph_pane = pn.interact(lambda button : compute_unl_graph_pane(button), **saveButtonDic)\n", + "\n", + "\n", + "# Main interface\n", + "pn.Column(\n", + " pn.Row(\n", + " pn.pane.HTML('<a href=\"https://unsel.tetras-lab.io/static/webvowl_1.1.7/index.html#extraction\" target=\"_blank\"><button type=\"button\" class=\"btn btn-outline-secondary btn-sm\">Visualiser le résultat d\\'extraction</button><a>'),\n", + " #pn.pane.HTML('<a href=\"https://unsel.tetras-lab.io/static/webvowl_1.1.7/index.html#extraction_SRSA-IP_STB_PHON_00100\" target=\"_blank\"><button type=\"button\" class=\"btn btn-outline-secondary btn-sm\">Visualiser l\\'extraction de SRSA-IP_STB_PHON_00100</button><a>'), \n", + " pn.widgets.FileDownload(file='/opt/dashboards/static/extraction.ttl', embed=True)\n", + " ),\n", + " pn.layout.Divider(), \n", + " pn.Card( \n", + " pn.Row(\n", + " pn.layout.HSpacer(),\n", + " pn.Column(\n", + " selectDir,\n", + " unlNavigatorPane[1],\n", + " ),\n", + " pn.layout.HSpacer(),\n", + " ),\n", + " title = \"Résultats par exigence\", width=pane_width+50\n", + " ),\n", + ")\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1209ed51-2cca-4a5b-9f6d-45c876f03176", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "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.6" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} -- GitLab