brightgems / Sport-Ontology

An owl ontology related to sports

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sports-Ontology

Ontology creation

Ontology classes structure

The diagram was built using drawio. The file can be found under the /visualize directory, feel free to use it.

Classes

A full diagram with properties and data types was also built using WebVOWL Full

System requirements

Python 3.7+, Apache-jena-fuseki (see installatation steps below)

On Ubuntu 18.04 this means:

apt-get update -qq
apt-get install -qq build-essential virtualenv python3.7 python3.7-dev

Python dependencies

The requirements.txt and python .venv are shared between the web app and the ontology population.

virtualenv -p python3.7 .venv
.venv/bin/pip install -r requirements.txt

Each particular crawling/adding to ontology script needs to be run in order to generate an .owl file containing the ontology.

Apache jena-fuseki

We will use apache-jena/apache-jen-fuseki in order to create an endpoint for the ontology in order to run the queries

Step1: First of all, you need to download apache-jena and apache-jena-fuseki from here. They contain both Windows and Linux running files.

Step2: Download the zip corresponding to each one of them and unpack the content to a separate folder.

Step3: Setup the environment for apache-jena. The Windows related files are on /bat, whereas the Linux related files are on /bin On Linux / Mac

export JENA_HOME=the directory you downloaded Jena to
export PATH=$PATH:$JENA_HOME/bin

On Windows

SET JENA_HOME =the directory you downloaded Jena to
SET PATH=%PATH%;%JENA_HOME%\bat

Step4: Create a tdb database from the .owl file. You need to create an empty directory on your system (let's call it TDB_DIRECTORY) Go to the apache-fuseki directory content and run: On Linux / Mac

./tdbloader --loc TDB_DIRECTORY_PATH ontoly.owl_PATH

On Windows

.\tdbloader.bat --loc TDB_DIRECTORY_PATH ontoly.owl_PATH

Step5: Run fuseki server Go to the apache-jena-fuseki directory content and run (ontology_name is whatever you want): On Linux / Mac

./fuseki-server --loc=TDB_DIRECTORY_PATH \sport_ontology

On Windows

.\fuseki-server.bat --loc=TDB_DIRECTORY_PATH \sport_ontology

Step6: Go to localhost:3030 on any browser and enjoy your ontology, running queries and everything.

Web app

A small web app was created in order to have a fuseki endpoint - backend - frontend link. The app was created starting from a template available on creative-tim

Running the app

The requirements.txt and python .venv are shared between the web app and the ontology population.

cd web_app
export FLASK_APP=run.py
flask run --host=0.0.0.0 --port=5000

Access the dashboard in browser: http://127.0.0.1:5000/

App functionalities

The app acts as a dashboard with a sidebar providing actions for:

  • tennis: table result - list of tournaments (alongside prizes, surfaces, dates) won
  • tennis: plot chart result - tournaments won per year
  • tennis: bar chart result - top 5 opponents (number of loses against them)
  • soccer: table result - list of scores for a specific team/season/tournament
  • soccer: plot chart result - goals scored/conceded for a team/season
  • soccer: bar chart result - number of teams/country trained by a manager
  • sparql endpoint to run any query

Tennis Table Tennis Plot Tennis Bar Soccer Table Soccer Plot Soccer Bar SPARQL

About

An owl ontology related to sports


Languages

Language:CSS 76.8%Language:Python 13.2%Language:HTML 7.9%Language:JavaScript 2.1%