diff --git a/notebooks/query_cellar_R.ipynb b/notebooks/query_cellar_R.ipynb deleted file mode 100644 index 608427cd8..000000000 --- a/notebooks/query_cellar_R.ipynb +++ /dev/null @@ -1,116 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - }, - "vscode": { - "languageId": "r" - } - }, - "outputs": [], - "source": [ - "# Installing necessary packages\n", - "# install.packages('RCurl')\n", - "# install.packages('XML')\n", - "install.packages('SPARQL_1.16.tar.gz', repos = NULL, type =\"source\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - }, - "vscode": { - "languageId": "r" - } - }, - "outputs": [], - "source": [ - "# Importing necessary libraries\n", - "library(SPARQL)\n", - "\n", - "# Preparing link to endpoint\n", - "query_endpoint <- \"https://publications.europa.eu/webapi/rdf/sparql\"\n", - "\n", - "# Preparing query\n", - "query <- '\n", - "PREFIX epo: \n", - "PREFIX cccev: \n", - "SELECT (COUNT (DISTINCT(?Notice)) as ?NrOfNotices) WHERE {\n", - " ?Notice epo:hasPublicationDate ?Date .\n", - " ?Notice epo:announcesRole ?Buyer .\n", - " ?Buyer epo:playedBy ?Organization .\n", - " ?Oganization epo:hasBusinessSize .\n", - " ?Organization cccev:registeredAddress / epo:hasCountryCode .\n", - " VALUES ?Date {\n", - " \"20230905\" \"20230906\"\n", - " }\n", - "}\n", - "'" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - }, - "vscode": { - "languageId": "r" - } - }, - "outputs": [], - "source": [ - "# Quering endpoint\n", - "query_data <- SPARQL(query_endpoint, query)\n", - "\n", - "# Access results as table (dataframe)\n", - "data_frame <- query_data$results" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - }, - "vscode": { - "languageId": "r" - } - }, - "outputs": [], - "source": [ - "# Print result\n", - "print(data_frame)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "R", - "language": "R", - "name": "ir" - }, - "language_info": { - "codemirror_mode": "r", - "file_extension": ".r", - "mimetype": "text/x-r-source", - "name": "R", - "pygments_lexer": "r", - "version": "4.2.2" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/notebooks/query_cellar_python.ipynb b/notebooks/query_cellar_python.ipynb deleted file mode 100644 index a9371c1a7..000000000 --- a/notebooks/query_cellar_python.ipynb +++ /dev/null @@ -1,129 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - }, - "outputs": [], - "source": [ - "# Uncomment last line of this cell (by deleting #) to install necessary dependencies.\n", - "\n", - "#!pip install sparqlwrapper pandas Jinja2" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - }, - "outputs": [], - "source": [ - "# Import dependencies\n", - "from io import StringIO\n", - "from SPARQLWrapper import SPARQLWrapper, CSV\n", - "from pandas import read_csv\n", - "\n", - "# Prepare variable with sparql endpoint\n", - "QUERY_ENDPOINT: str = 'https://publications.europa.eu/webapi/rdf/sparql'\n", - "\n", - "# Example of sparql query\n", - "SPARQL_QUERY: str = \"\"\"\n", - "PREFIX epo: \n", - "PREFIX cccev: \n", - " \n", - "SELECT (COUNT (DISTINCT (?Notice)) as ?NrOfNotices) WHERE { \n", - " \n", - " ?Notice epo:hasPublicationDate ?Date .\n", - " ?Notice epo:announcesRole ?Buyer .\n", - " ?Buyer epo:playedBy ?Organization .\n", - " ?Organization cccev:registeredAddress / epo:hasCountryCode .\n", - "\n", - " VALUES ?Date {\n", - " \"20230905\" \"20230906\"\n", - " }\n", - "}\n", - "\"\"\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - }, - "outputs": [], - "source": [ - "# Prepare connection to sparql endpoint\n", - "sparql_endpoint = SPARQLWrapper(QUERY_ENDPOINT)\n", - "sparql_endpoint.setQuery(SPARQL_QUERY)\n", - "sparql_endpoint.setReturnFormat(CSV)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - }, - "outputs": [], - "source": [ - "# Request for query\n", - "endpoint_result = sparql_endpoint.query().convert()\n", - "# Convert endpoint result to table (dataframe)\n", - "result_data = StringIO(str(endpoint_result, 'utf-8'))\n", - "result_dataframe = read_csv(result_data)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - }, - "outputs": [], - "source": [ - "# Print result\n", - "result_dataframe.style" - ] - } - ], - "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.8.10" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/notebooks/sample_application.xlsx b/notebooks/sample_application.xlsx deleted file mode 100644 index 0e19e22cd..000000000 Binary files a/notebooks/sample_application.xlsx and /dev/null differ