Link Search Menu Expand Document

Python Flask Server for Patterns UI using the Blazegraph KG

A Python Flask server providing APIs used by the Pattens UI frontend. It is connected to the FONN SPARQL endpoint for the Patterns and Tunes knowledge graphs.

This software forms part of Polifonia Deliverable D5.6.

Prerequisites

Ensure you have Python and pip installed on your machine. I’d recommend using a environment manager like miniconda to keep everything sane.

Installing Dependencies

Clone the repository, navigate to the project folder and install the dependencies from requirements.txt.

git clone git@github.com:polifonia-project/pattern-explorations-backend.git
cd pattern-explorations-backend
pip install -r requirements.txt

Application Code

The main application code is in app.py, and the SPARQL queries are generated using a query factory in query_factory.py. The file fuzzy_search.py contains properties and methods related to the fuzzy tune title search feature.

Running the Server

Start the Flask server with:

python app.py

The server runs on localhost port 5000 by default.

requirements.txt

The required libraries are listed in requirements.txt:

Flask==2.3.2
Flask_Cors==3.0.10
Requests==2.31.0
fuzzywuzzy~=0.18.0
singleton-decorator
python-Levenshtein