To generate a knowledge graph about migrants in the theater in Europe.
Find a file
Daniel Hernandez da22d312a9 Add Step 1: Direct mapping from MariaDB to RDF.
Dockerfile and docker-compose.yml for MariaDB container,
map/step-01.rb implementing the W3C Direct Mapping for all 9 tables.
2026-02-26 16:42:30 +01:00
data Making test pass. 2026-02-22 21:11:19 +01:00
data_examples Making test pass. 2026-02-22 21:11:19 +01:00
map Add Step 1: Direct mapping from MariaDB to RDF. 2026-02-26 16:42:30 +01:00
spec Making test pass. 2026-02-22 21:11:19 +01:00
src Making test pass. 2026-02-22 21:11:19 +01:00
.gitignore Mapping persons religions. 2026-02-22 10:18:45 +01:00
db_schema.md Generating a single Markdown file describing the tables. 2026-02-22 11:57:04 +01:00
docker-compose.yml Add Step 1: Direct mapping from MariaDB to RDF. 2026-02-26 16:42:30 +01:00
Dockerfile Add Step 1: Direct mapping from MariaDB to RDF. 2026-02-26 16:42:30 +01:00
Gemfile Adding an RSpec test. 2026-02-22 20:26:08 +01:00
Gemfile.lock Adding an RSpec test. 2026-02-22 20:26:08 +01:00
graph-01.ttl Add Step 1: Direct mapping from MariaDB to RDF. 2026-02-26 16:42:30 +01:00
LICENSE Initial commit 2026-02-14 12:08:05 +00:00
ontology.ttl Separate the ontology from the data files. 2026-02-22 18:42:24 +01:00
Rakefile Renaming files 2026-02-22 19:06:30 +01:00
README.md Add Step 1: Direct mapping from MariaDB to RDF. 2026-02-26 16:42:30 +01:00
teatre-migrants.sql Include the input SQL file. 2026-02-26 15:29:50 +01:00

Theatre Migrants

To generate a knowledge graph about migrants in the theatre in Europe.

Generating the ontology

Next there are set of steps describing how to generate the migrants RDF graph.

Step 1 - Loading the input data into a relational database

Task

The file teatre-migrants.sql contains the dump of a MariaDB database. The tables involved in this schema are described in the file db_schema.md. We will load this data in MariaDB to access the data with SQL. To this end:

  1. Create a Dockerfile to create a docker container for MariaDB.

  2. Upload the dump into a database in the container.

  3. Create a Ruby script map/step-01.rb that uses the gem sequel to connect to the database. This Ruby script should return a file called graph-01.ttl containing all the data from the tables loaded in the database using the direct mapping from relational databases to RDF.

Summary

The Dockerfile creates a MariaDB 10.11 container that automatically loads teatre-migrants.sql on first start. The docker-compose.yml exposes the database on port 3306 with a healthcheck.

The script map/step-01.rb connects to the database via sequel and implements the W3C Direct Mapping for all 9 tables (location, migration_table, organisation, person, person_profession, personnames, relationship, religions, work). Each table row becomes an RDF resource identified by its primary key, each column becomes a datatype property, and each foreign key becomes an object property linking to the referenced row. The output file graph-01.ttl contains 162,029 triples.

To run:

docker compose up -d
bundle exec ruby map/step-01.rb

Step 2 -