From c4b43e992ad5a78f051332172e09310a5c042126 Mon Sep 17 00:00:00 2001 From: Daniel <d.hornung@indiscale.com> Date: Thu, 24 Feb 2022 16:09:55 +0100 Subject: [PATCH] DOC: Jupyter notebook for the first step with caosdb --- doc/notebooks/Live Demo CaosDB Octave.ipynb | 101 ++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 doc/notebooks/Live Demo CaosDB Octave.ipynb diff --git a/doc/notebooks/Live Demo CaosDB Octave.ipynb b/doc/notebooks/Live Demo CaosDB Octave.ipynb new file mode 100644 index 0000000..acf0404 --- /dev/null +++ b/doc/notebooks/Live Demo CaosDB Octave.ipynb @@ -0,0 +1,101 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "b165f725", + "metadata": {}, + "source": [ + "# Live demo: Octave's CaosDB package" + ] + }, + { + "cell_type": "markdown", + "id": "11f407ec", + "metadata": {}, + "source": [ + "## Load & connect\n", + "Let's load the CaosDB package, connect to the server and get some information about the server." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f7ad7c18", + "metadata": {}, + "outputs": [], + "source": [ + "pkg load caosdb;\n", + "c = Caosdb();\n", + "c.info()" + ] + }, + { + "cell_type": "markdown", + "id": "c77f09e5", + "metadata": {}, + "source": [ + "## Execute a query\n", + "The demo CaosDB contains a number of musical instruments and analyses about the instruments. Let's find an instrument that was not too cheap." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2273ac0d", + "metadata": {}, + "outputs": [], + "source": [ + "result = c.query(\"FIND MusicalInstrument WITH price > 2022 €\");\n", + "instrument_3 = result{3}" + ] + }, + { + "cell_type": "markdown", + "id": "07ec19e7", + "metadata": {}, + "source": [ + "## Further inspect the instrument\n", + "Records from CaosDB may contain properties. We want to find out how expensive the instrument actually was." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "aa1fd55b", + "metadata": {}, + "outputs": [], + "source": [ + "price = instrument_3.get_properties_as_struct().price" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Octave", + "language": "octave", + "name": "octave" + }, + "language_info": { + "file_extension": ".m", + "help_links": [ + { + "text": "GNU Octave", + "url": "https://www.gnu.org/software/octave/support.html" + }, + { + "text": "Octave Kernel", + "url": "https://github.com/Calysto/octave_kernel" + }, + { + "text": "MetaKernel Magics", + "url": "https://metakernel.readthedocs.io/en/latest/source/README.html" + } + ], + "mimetype": "text/x-octave", + "name": "octave", + "version": "6.2.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} -- GitLab