{ "cells": [ { "cell_type": "markdown", "id": "6e383e96-6c6b-46e3-a061-7b75a96ec756", "metadata": {}, "source": [ "# Storage and transactions" ] }, { "cell_type": "code", "execution_count": 1, "id": "1f17d433-96d1-47c1-8e3d-af5d996542e2", "metadata": {}, "outputs": [], "source": [ "%reload_ext pycozo.ipyext_direct" ] }, { "cell_type": "code", "execution_count": 2, "id": "5b4a724b-f8d9-44cd-8821-77edeadf772d", "metadata": {}, "outputs": [], "source": [ "%cozo_auth *******" ] }, { "cell_type": "markdown", "id": "c364f130-2d84-4563-9f35-18048025f9f9", "metadata": {}, "source": [ "## Stored relations" ] }, { "cell_type": "markdown", "id": "7b09219b-9a7c-4fa2-85ab-52b95ad69469", "metadata": {}, "source": [ "An obvious shortcoming of our previous acrobatics is that we have to carry around our love triangles network and enter it anew for every query, which leads to rapid deterioration of the `CTRL`, `C` and `V` keys. So let's fix that:" ] }, { "cell_type": "code", "execution_count": 3, "id": "5f1bc86f-eaa6-4793-8a56-78daa1288540", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Completed in 0ms
" ], "text/plain": [ "\n", " | status | \n", "
---|---|
0 | \n", "OK | \n", "
Completed in 0ms
" ], "text/plain": [ "\n", " | a | \n", "b | \n", "
---|---|---|
0 | \n", "alice | \n", "eve | \n", "
1 | \n", "bob | \n", "alice | \n", "
2 | \n", "charlie | \n", "eve | \n", "
3 | \n", "david | \n", "george | \n", "
4 | \n", "eve | \n", "alice | \n", "
5 | \n", "eve | \n", "bob | \n", "
6 | \n", "eve | \n", "charlie | \n", "
7 | \n", "george | \n", "george | \n", "
Completed in 0ms
" ], "text/plain": [ "\n", " | status | \n", "
---|---|
0 | \n", "OK | \n", "
Completed in 0ms
" ], "text/plain": [ "\n", " | a | \n", "b | \n", "
---|---|---|
0 | \n", "alice | \n", "eve | \n", "
1 | \n", "bob | \n", "alice | \n", "
2 | \n", "charlie | \n", "eve | \n", "
3 | \n", "david | \n", "george | \n", "
4 | \n", "eve | \n", "alice | \n", "
5 | \n", "eve | \n", "bob | \n", "
6 | \n", "eve | \n", "charlie | \n", "
7 | \n", "fred | \n", "alice | \n", "
8 | \n", "fred | \n", "eve | \n", "
9 | \n", "george | \n", "george | \n", "
Completed in 0ms
" ], "text/plain": [ "\n", " | status | \n", "
---|---|
0 | \n", "OK | \n", "
Completed in 0ms
" ], "text/plain": [ "\n", " | a | \n", "b | \n", "
---|---|---|
0 | \n", "alice | \n", "eve | \n", "
1 | \n", "bob | \n", "alice | \n", "
2 | \n", "charlie | \n", "eve | \n", "
3 | \n", "david | \n", "george | \n", "
4 | \n", "eve | \n", "bob | \n", "
5 | \n", "fred | \n", "alice | \n", "
6 | \n", "fred | \n", "eve | \n", "
7 | \n", "george | \n", "george | \n", "
Completed in 0ms
" ], "text/plain": [ "\n", " | status | \n", "
---|---|
0 | \n", "OK | \n", "
Completed in 0ms
" ], "text/plain": [ "\n", " | a | \n", "b | \n", "
---|---|---|
0 | \n", "eve | \n", "alice | \n", "
1 | \n", "eve | \n", "charlie | \n", "
Completed in 0ms
" ], "text/plain": [ "\n", " | name | \n", "arity | \n", "n_keys | \n", "n_non_keys | \n", "n_put_triggers | \n", "n_rm_triggers | \n", "n_replace_triggers | \n", "
---|---|---|---|---|---|---|---|
0 | \n", "airport | \n", "11 | \n", "1 | \n", "10 | \n", "0 | \n", "0 | \n", "0 | \n", "
1 | \n", "triangles | \n", "2 | \n", "2 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "
Completed in 0ms
" ], "text/plain": [ "\n", " | status | \n", "
---|---|
0 | \n", "OK | \n", "
Completed in 6ms
" ], "text/plain": [ "\n", " | name | \n", "arity | \n", "n_keys | \n", "n_non_keys | \n", "n_put_triggers | \n", "n_rm_triggers | \n", "n_replace_triggers | \n", "
---|---|---|---|---|---|---|---|
0 | \n", "airport | \n", "11 | \n", "1 | \n", "10 | \n", "0 | \n", "0 | \n", "0 | \n", "
1 | \n", "love_triangles | \n", "2 | \n", "2 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "
Completed in 0ms
" ], "text/plain": [ "\n", " | a | \n", "b | \n", "
---|---|---|
0 | \n", "eve | \n", "alice | \n", "
1 | \n", "eve | \n", "charlie | \n", "
Completed in 0ms
" ], "text/plain": [ "\n", " | status | \n", "
---|---|
0 | \n", "OK | \n", "