MELODY — Semantic Graphs for Music
University project for the Graph Databases course: a graph database with a music domain ontology, populated with data about popular songs from 1958 to today, queryable with SPARQL and validated with SHACL.
Context
Group project for the Graph Databases course (A.Y. 2024/2025, University of Padua — IIIA hub). Goal: create a graph database with information about the most popular weekly songs from 1958 to today, starting from heterogeneous datasets.
With this information it is possible to evaluate song duration, keys used, genre evolution over time, and cross-references with the Grammys.
What I did
The project is a group effort (with Ludovico Di Martino and Manuel Rigobello): I contributed to ontology modelling, database population and the example queries.
How it is built
flowchart LR
G["Grammy dataset<br/>(Kaggle)"] --> P["RDF population<br/>(Python notebooks)"]
M["MusicOSet dataset<br/>(Spotify features)"] --> P
O["Ontology<br/>Protégé (TBox)"] --> P
P --> D[("GraphDB<br/>populated ABox")]
D --> Q["SPARQL queries"]
D --> S["SHACL validation"]
From heterogeneous datasets to a populated, validated ontology
- Ontology (TBox). Designed in Protégé: classes for songs, artists, chart weeks, genres, Grammy categories and properties (duration, key, chart position, …). Diagram included in the repository.

-
Population (ABox). Python notebooks transform CSV datasets (Grammy from Kaggle, MusicOSet with real Spotify audio features) into RDF/Turtle files, imported into GraphDB.
-
SPARQL queries. Example semantic queries: genre evolution over time, average duration per decade, relationships between Grammy-winning songs and charts, etc.
-
SHACL validation. Shapes to constrain the data: types, cardinalities and required properties — importable in GraphDB with validation enabled.
Design choices
- Ontology before data: the TBox (skeleton) is hand-drawn in Protégé before populating, so the semantic model is clean and the data adapts to it.
- Reusing existing datasets instead of scraping: Grammy (Kaggle) and MusicOSet (with real Spotify audio features) — reliable, cited sources.
- SHACL as a safety net: validation guarantees that data from different sources respects the schema, even after future additions.
Results
A SPARQL-queryable graph database with documented ontology, populated dataset and working SHACL validation — evaluated for the Graph Databases course. Public repository: FilippoGalli001/MELODY.