{ "cells": [ { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "from rdflib import Graph\n", "from SPARQLWrapper import SPARQLWrapper\n", "from controller.TripleStore_Controller import TripleStore_Controller" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ ")>" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "g = Graph()\n", "data = \"\"\"@prefix rdf: .\n", "@prefix rdfs: .\n", "@prefix data: .\n", "@prefix xsd: .\n", "@prefix facility: .\n", "\n", "data:Project_079637bb-87d5-4fef-9704-d556364d90ba\n", " a facility:Project ;\n", " facility:hasName \"test1\"^^ ;\n", " facility:hasDescription \"test description\"^^ ;\n", " facility:projectID \"079637bb-87d5-4fef-9704-d556364d90ba\"^^ .\"\"\"\n", "g.parse(data=data, format=\"turtle\")" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "n_triples = g.serialize(format=\"nt\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "#controller = TripleStore_Controller(n_triples, \"cogito:test:1\")\n", "controller = TripleStore_Controller(n_triples, \"cogito:test:1\", \"cogito:file:test:1\")" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "controller.create_graph()" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "controller.delete_graph()" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [], "source": [ "controller = TripleStore_Controller(data, \"cogito:test:1\", \"cogito:file:test:1\")" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "' \"test1\"^^ .\\n \"test description\"^^ .\\n \"079637bb-87d5-4fef-9704-d556364d90ba\"^^ .\\n .\\n\\n'" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "controller.graph" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [], "source": [ "controller.create_graph()" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [], "source": [ "controller.delete_graph()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "interpreter": { "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6" }, "kernelspec": { "display_name": "Python 3.8.9 64-bit", "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.9.6" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }