{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Jupyter Integration"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"sys.path.append(\"wrappers\")\n",
"from modelverse import *\n",
"\n",
"init()\n",
"login(\"admin\", \"admin\")"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"model_add(\"formalisms/FSA/metamodel\", \"formalisms/SimpleClassDiagrams\", open(\"../modelverse_GUI/models/FSA_MM.mvc\", 'r').read())\n",
"transformation_add_AL({\"FSA\": \"formalisms/FSA/metamodel\"}, {}, \"formalisms/FSA/simulate\", open(\"../modelverse_GUI/models/FSA_simulate.alc\", 'r').read())"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"model_add(\"models/my_FSA\", \"formalisms/FSA/metamodel\", \"\"\"\n",
" State a {\n",
" name = \"state_a\"\n",
" initial = True\n",
" }\n",
" State b {\n",
" name = \"state_b\"\n",
" initial = False\n",
" }\n",
" Transition (a, b) {\n",
" trigger = \"a\"\n",
" raise = \"b\"\n",
" script = $\n",
" include \"primitives.alh\"\n",
" include \"io.alh\"\n",
" Void function m():\n",
" output(\"TRANSITION\")\n",
" return!\n",
" $\n",
" }\n",
"\"\"\")"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from IPython.display import SVG, display\n",
"svg = SVG()\n",
"svg.data = show(\"models/my_FSA\")\n",
"display(svg)"
]
}
],
"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.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}