From a04642f187c34c698c6c7f69d075789181ac2db8 Mon Sep 17 00:00:00 2001 From: Vasilije <8619304+Vasilije1990@users.noreply.github.com> Date: Wed, 28 Feb 2024 10:57:38 +0100 Subject: [PATCH] Updated the graphs, added ids, made sure they are propagated among categories --- Demo_graph.ipynb | 370 +++++++++++++++++++++++------------------------ 1 file changed, 184 insertions(+), 186 deletions(-) diff --git a/Demo_graph.ipynb b/Demo_graph.ipynb index 9d6a4e23b..2143f9f80 100644 --- a/Demo_graph.ipynb +++ b/Demo_graph.ipynb @@ -855,7 +855,7 @@ }, { "cell_type": "code", - "execution_count": 175, + "execution_count": 203, "id": "58644c64-7ef0-415f-8e41-e2edcf5fd15b", "metadata": {}, "outputs": [], @@ -945,7 +945,7 @@ }, { "cell_type": "code", - "execution_count": 168, + "execution_count": 264, "id": "dd3f0e55-9f9d-4804-9ad6-31afd2088ab5", "metadata": {}, "outputs": [], @@ -963,7 +963,7 @@ }, { "cell_type": "code", - "execution_count": 170, + "execution_count": 265, "id": "199ef3ab-5e73-40d2-b531-6a402edf3f17", "metadata": {}, "outputs": [ @@ -972,7 +972,7 @@ "output_type": "stream", "text": [ "Nodes in the graph:\n", - "[('user123', {'created_at': '2024-02-27 18:11:57', 'updated_at': '2024-02-27 18:11:57', 'username': 'exampleUser', 'email': 'user@example.com'}), ('Temporal', {'created_at': '2024-02-27 18:11:57', 'updated_at': '2024-02-27 18:11:57', 'type': 'category'}), ('Temporal:Historical events', {'created_at': '2024-02-27 18:11:57', 'updated_at': '2024-02-27 18:11:57', 'type': 'subclass', 'content': 'Historical events'}), ('Temporal:Schedules and timelines', {'created_at': '2024-02-27 18:11:57', 'updated_at': '2024-02-27 18:11:57', 'type': 'subclass', 'content': 'Schedules and timelines'}), ('Positional', {'created_at': '2024-02-27 18:11:57', 'updated_at': '2024-02-27 18:11:57', 'type': 'category'}), ('Positional:Geographical locations', {'created_at': '2024-02-27 18:11:57', 'updated_at': '2024-02-27 18:11:57', 'type': 'subclass', 'content': 'Geographical locations'}), ('Positional:Spatial data', {'created_at': '2024-02-27 18:11:57', 'updated_at': '2024-02-27 18:11:57', 'type': 'subclass', 'content': 'Spatial data'}), ('Propositions', {'created_at': '2024-02-27 18:11:57', 'updated_at': '2024-02-27 18:11:57', 'type': 'category'}), ('Propositions:Hypotheses and theories', {'created_at': '2024-02-27 18:11:57', 'updated_at': '2024-02-27 18:11:57', 'type': 'subclass', 'content': 'Hypotheses and theories'}), ('Propositions:Claims and arguments', {'created_at': '2024-02-27 18:11:57', 'updated_at': '2024-02-27 18:11:57', 'type': 'subclass', 'content': 'Claims and arguments'}), ('Personalization', {'created_at': '2024-02-27 18:11:57', 'updated_at': '2024-02-27 18:11:57', 'type': 'category'}), ('Personalization:User preferences', {'created_at': '2024-02-27 18:11:57', 'updated_at': '2024-02-27 18:11:57', 'type': 'subclass', 'content': 'User preferences'}), ('Personalization:User information', {'created_at': '2024-02-27 18:11:57', 'updated_at': '2024-02-27 18:11:57', 'type': 'subclass', 'content': 'User information'}), ('Natural Language Text', {'created_at': '2024-02-27 18:11:57', 'updated_at': '2024-02-27 18:11:57', 'type': 'category'}), ('Natural Language Text:News stories and blog posts', {'created_at': '2024-02-27 18:11:57', 'updated_at': '2024-02-27 18:11:57', 'type': 'subclass', 'content': 'News stories and blog posts'})]\n", + "[('user123', {'created_at': '2024-02-28 10:24:56', 'updated_at': '2024-02-28 10:24:56', 'username': 'exampleUser', 'email': 'user@example.com'}), ('Temporal', {'created_at': '2024-02-28 10:24:56', 'updated_at': '2024-02-28 10:24:56', 'type': 'category'}), ('Temporal:Historical events', {'created_at': '2024-02-28 10:24:56', 'updated_at': '2024-02-28 10:24:56', 'type': 'subclass', 'content': 'Historical events'}), ('Temporal:Schedules and timelines', {'created_at': '2024-02-28 10:24:56', 'updated_at': '2024-02-28 10:24:56', 'type': 'subclass', 'content': 'Schedules and timelines'}), ('Positional', {'created_at': '2024-02-28 10:24:56', 'updated_at': '2024-02-28 10:24:56', 'type': 'category'}), ('Positional:Geographical locations', {'created_at': '2024-02-28 10:24:56', 'updated_at': '2024-02-28 10:24:56', 'type': 'subclass', 'content': 'Geographical locations'}), ('Positional:Spatial data', {'created_at': '2024-02-28 10:24:56', 'updated_at': '2024-02-28 10:24:56', 'type': 'subclass', 'content': 'Spatial data'}), ('Propositions', {'created_at': '2024-02-28 10:24:56', 'updated_at': '2024-02-28 10:24:56', 'type': 'category'}), ('Propositions:Hypotheses and theories', {'created_at': '2024-02-28 10:24:56', 'updated_at': '2024-02-28 10:24:56', 'type': 'subclass', 'content': 'Hypotheses and theories'}), ('Propositions:Claims and arguments', {'created_at': '2024-02-28 10:24:56', 'updated_at': '2024-02-28 10:24:56', 'type': 'subclass', 'content': 'Claims and arguments'}), ('Personalization', {'created_at': '2024-02-28 10:24:56', 'updated_at': '2024-02-28 10:24:56', 'type': 'category'}), ('Personalization:User preferences', {'created_at': '2024-02-28 10:24:56', 'updated_at': '2024-02-28 10:24:56', 'type': 'subclass', 'content': 'User preferences'}), ('Personalization:User information', {'created_at': '2024-02-28 10:24:56', 'updated_at': '2024-02-28 10:24:56', 'type': 'subclass', 'content': 'User information'}), ('Natural Language Text', {'created_at': '2024-02-28 10:24:56', 'updated_at': '2024-02-28 10:24:56', 'type': 'category'}), ('Natural Language Text:News stories and blog posts', {'created_at': '2024-02-28 10:24:56', 'updated_at': '2024-02-28 10:24:56', 'type': 'subclass', 'content': 'News stories and blog posts'})]\n", "\n", "Edges in the graph:\n", "[('user123', 'Temporal', {'relationship': 'created'}), ('user123', 'Positional', {'relationship': 'created'}), ('user123', 'Propositions', {'relationship': 'created'}), ('user123', 'Personalization', {'relationship': 'created'}), ('user123', 'Natural Language Text', {'relationship': 'created'}), ('Temporal', 'Temporal:Historical events', {'relationship': 'includes'}), ('Temporal', 'Temporal:Schedules and timelines', {'relationship': 'includes'}), ('Positional', 'Positional:Geographical locations', {'relationship': 'includes'}), ('Positional', 'Positional:Spatial data', {'relationship': 'includes'}), ('Propositions', 'Propositions:Hypotheses and theories', {'relationship': 'includes'}), ('Propositions', 'Propositions:Claims and arguments', {'relationship': 'includes'}), ('Personalization', 'Personalization:User preferences', {'relationship': 'includes'}), ('Personalization', 'Personalization:User information', {'relationship': 'includes'}), ('Natural Language Text', 'Natural Language Text:News stories and blog posts', {'relationship': 'includes'})]\n" @@ -1002,67 +1002,44 @@ }, { "cell_type": "code", - "execution_count": 171, + "execution_count": 273, "id": "b3160a1d-a6ea-40ce-a521-37ad26d31ffb", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "CognitiveCategory(name='Natural Language Text', cognitive_subgroups=[CognitiveLayerSubgroup(id=1, name='News stories and blog posts', data_type='TEXT'), CognitiveLayerSubgroup(id=2, name='Personal narratives and stories', data_type='TEXT')])" + "CognitiveCategory(name='Natural Language Text', cognitive_subgroups=[CognitiveLayerSubgroup(id=1, name='News stories and blog posts', data_type='TEXT')])" ] }, - "execution_count": 171, + "execution_count": 273, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "required_layers_two" + "required_layers_one" ] }, { "cell_type": "code", - "execution_count": 172, + "execution_count": null, "id": "b254dfc9-ce85-4175-9d1e-c0f1ede67e3b", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "MultiDiGraph with 15 nodes and 14 edges\n" - ] - } - ], - "source": [ - "print(G)" - ] + "outputs": [], + "source": [] }, { "cell_type": "code", - "execution_count": 167, + "execution_count": null, "id": "a77b4f24-3046-4ab6-9ba1-c802096498df", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'Personal narratives and stories'" - ] - }, - "execution_count": 167, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "required_layers_two.dict()['cognitive_subgroups'][1]['nam" - ] + "outputs": [], + "source": [] }, { "cell_type": "code", - "execution_count": 177, + "execution_count": 268, "id": "4dab2ff0-0d12-4a00-a4e4-fb901e701bd3", "metadata": {}, "outputs": [], @@ -1072,7 +1049,7 @@ }, { "cell_type": "code", - "execution_count": 178, + "execution_count": 269, "id": "627d42fd-d2ce-4ccd-a2a1-2f7ac2f463cf", "metadata": {}, "outputs": [ @@ -1090,7 +1067,7 @@ }, { "cell_type": "code", - "execution_count": 179, + "execution_count": 272, "id": "512f15be-0114-4c8c-9754-e82f2fa16344", "metadata": {}, "outputs": [ @@ -1098,7 +1075,7 @@ "data": { "text/html": [ "\n", - "