From 6870f9b726bc57be2b3411a3e8f37d7e7b4c9a02 Mon Sep 17 00:00:00 2001 From: Daniel Hernandez Date: Sat, 28 Feb 2026 09:06:36 +0100 Subject: [PATCH] Add Rake tasks to generate 1-hop and 2-hop example extracts. --- Rakefile | 21 +- data_examples/step_01_1hop.ttl | 300 ++++++++++++++++++ data_examples/step_01_2hop.ttl | 543 +++++++++++++++++++++++++++++++++ 3 files changed, 862 insertions(+), 2 deletions(-) create mode 100644 data_examples/step_01_1hop.ttl create mode 100644 data_examples/step_01_2hop.ttl diff --git a/Rakefile b/Rakefile index b3e74ed..44b097d 100644 --- a/Rakefile +++ b/Rakefile @@ -73,6 +73,18 @@ file 'data/graph-02.ttl' => ['data/graph-01.ttl', 'map/step-02.rb'] + UPDATE_QUE run 'map/step-02.rb' end +# ── Examples ───────────────────────────────────────────────────────────────── + +SPARQL = File.expand_path('~/.cargo/bin/sparql') + +file 'data_examples/step_01_1hop.ttl' => ['data/graph-01.ttl', 'queries/step_01_1hop_example.rq'] do + sh "#{SPARQL} queries/step_01_1hop_example.rq --graph data/graph-01.ttl > data_examples/step_01_1hop.ttl" +end + +file 'data_examples/step_01_2hop.ttl' => ['data/graph-01.ttl', 'queries/step_01_2hop_example.rq'] do + sh "#{SPARQL} queries/step_01_2hop_example.rq --graph data/graph-01.ttl > data_examples/step_01_2hop.ttl" +end + # ── Aggregate tasks ────────────────────────────────────────────────────────── GENERATED = %w[ @@ -96,12 +108,17 @@ GRAPHS = %w[ data/graph-02.ttl ].freeze -task default: GENERATED + GRAPHS +EXAMPLES = %w[ + data_examples/step_01_1hop.ttl + data_examples/step_01_2hop.ttl +].freeze + +task default: GENERATED + GRAPHS + EXAMPLES task :clean do review_files = %w[ data/countries_wikidata_review.ttl data/religions_wikidata_review.ttl ] - rm_f GENERATED + GRAPHS + review_files + rm_f GENERATED + GRAPHS + EXAMPLES + review_files end diff --git a/data_examples/step_01_1hop.ttl b/data_examples/step_01_1hop.ttl new file mode 100644 index 0000000..908e7cd --- /dev/null +++ b/data_examples/step_01_1hop.ttl @@ -0,0 +1,300 @@ + a ; + "AbeIre-00" ; + "Irene" ; + "Abendroth" ; + "Christian" ; + "female" ; + "https://www.t-migrants.gwi.uni-muenchen.de/wp-content/uploads/images/FS_PK267702alt.jpg" ; + "https://www.theatermuseum.at/online-sammlung/detail/546808/" ; + "Opera singer" ; + "1872-07-14" ; + "1872-07-14" ; + ; + "1932-09-01" ; + "1932-09-01" ; + ; + "https://en.wikipedia.org/wiki/Irene_Abendroth" ; + "https://www.wikidata.org/wiki/Q79002" ; + "https://d-nb.info/gnd/116002506" ; + "https://worldcat.org/identities/lccn-n97053925/" ; + "https://viaf.org/viaf/39572476" ; + "https://isni.org/isni/0000000035722792" ; + "https://snaccooperative.org/ark:/99166/w6bt189x#resources" ; + "Karl-Josef Kutsch, Leo Riemens: Großes Sängerlexikon, Bern: Saur 2003, pp. 3-4. \nWiener Staatsoper: Aufführungsarchiv, https://archiv.wiener-staatsoper.at/search/person/7243\nFremdenblatt - Organ für die böhmischen Kurorte, 8th July 1888, p. 2: https://anno.onb.ac.at/cgi-content/anno?aid=fbl&datum=18880708&query=%22Abendroth+Karlsbad%22~25&ref=anno-search&seite=2\n\n" ; + "Own" . + a ; + "5" ; + ; + ; + ; + "Education" . + a ; + "6" ; + ; + ; + ; + "1889" ; + "1889-01-01" ; + "1889-12-31" ; + "Labour" . + a ; + "7" ; + ; + ; + ; + "1890" ; + "1890-01-01" ; + "1890-12-31" ; + "Labour" . + a ; + "8" ; + ; + ; + ; + "1891" ; + "1891-01-01" ; + "1891-12-31" ; + "Labour" . + a ; + "9" ; + ; + ; + ; + "1894" ; + "1894-01-01" ; + "1894-12-31" ; + "Labour" . + a ; + "10" ; + ; + ; + ; + "1899" ; + "1899-01-01" ; + "1899-12-31" ; + "Labour" . + a ; + "11" ; + ; + ; + ; + "1909" ; + "1909-01-01" ; + "1909-12-31" ; + "Labour" . + a ; + "2114" ; + ; + ; + ; + "Education" . + a ; + "2117" ; + ; + ; + ; + "Labour" . + a ; + "2118" ; + ; + ; + ; + "1909" ; + "1909-01-01" ; + "1909-12-31" ; + "Other" . + a ; + "5120" ; + ; + "Singer" . + a ; + "2" ; + ; + ; + "" ; + ; + "" ; + "" . + a ; + "3" ; + ; + ; + "" ; + ; + "" . + a ; + "38" ; + ; + . + a ; + "93" ; + ; + ; + "" . + a ; + "16834" ; + ; + ; + "" ; + . + a ; + "16839" ; + ; + ; + "" ; + "Sister" . + a ; + "16844" ; + ; + ; + "" ; + . + a ; + "21686" ; + ; + ; + "" ; + . + a ; + "1" ; + ; + ; + "1888" ; + "1888-01-01" ; + "1888-12-31" ; + "-" ; + "Permanent" ; + "Singer" ; + "Tour" ; + "" . + a ; + "2" ; + ; + ; + ; + "1889" ; + "1889-01-01" ; + "1889-12-31" ; + "-" ; + "Singer" ; + "Tour" ; + "" . + a ; + "3" ; + ; + ; + ; + "1890" ; + "1890-01-01" ; + "1890-12-31" ; + "1891" ; + "1891-01-01" ; + "1891-12-31" ; + "Singer" ; + "Tour" ; + "" . + a ; + "4" ; + ; + ; + ; + "1891" ; + "1891-01-01" ; + "1891-12-31" ; + "1894" ; + "1894-01-01" ; + "1894-12-31" ; + "Singer" ; + "Tour" ; + "" . + a ; + "5" ; + ; + ; + ; + "1894" ; + "1894-01-01" ; + "1894-12-31" ; + "1897" ; + "1897-03-22" ; + "1897-03-22" ; + "Singer" ; + "Tour" ; + "" . + a ; + "6" ; + ; + ; + ; + "1899" ; + "1899-01-01" ; + "1899-12-31" ; + "1909" ; + "1909-01-01" ; + "1909-12-31" ; + "Singer" ; + "Tour" ; + "she left Vienna because of disagreements with Gustav Mahler (Director" . + a ; + "7" ; + ; + ; + ; + "1905" ; + "1905-01-01" ; + "1905-12-31" ; + "1907" ; + "1907-01-01" ; + "1907-12-31" ; + "Singer" ; + "Tour" ; + "Between 1905 and 1907 guest engagements at Berliner Hofoper" . + a ; + "8" ; + ; + ; + ; + "1905" ; + "1905-01-01" ; + "1905-12-31" ; + "1907" ; + "1907-01-01" ; + "1907-12-31" ; + "Singer" ; + "Tour" ; + "" . + a ; + "9" ; + ; + ; + ; + "1907" ; + "1907-01-01" ; + "1907-12-31" ; + "-" ; + "Singer" ; + "Tour" ; + "" . + a ; + "10" ; + ; + ; + ; + "1907" ; + "1907-01-01" ; + "1907-12-31" ; + "-" ; + "Singer" ; + "Tour" ; + "" . + a ; + "11" ; + ; + ; + ; + "1907" ; + "1907-01-01" ; + "1907-12-31" ; + "Singer" ; + "Tour" ; + "Deutsches Theater Prag" . diff --git a/data_examples/step_01_2hop.ttl b/data_examples/step_01_2hop.ttl new file mode 100644 index 0000000..4c5fc07 --- /dev/null +++ b/data_examples/step_01_2hop.ttl @@ -0,0 +1,543 @@ + a ; + "AbeIre-00" ; + "Irene" ; + "Abendroth" ; + "Christian" ; + "female" ; + "https://www.t-migrants.gwi.uni-muenchen.de/wp-content/uploads/images/FS_PK267702alt.jpg" ; + "https://www.theatermuseum.at/online-sammlung/detail/546808/" ; + "Opera singer" ; + "1872-07-14" ; + "1872-07-14" ; + ; + "1932-09-01" ; + "1932-09-01" ; + ; + "https://en.wikipedia.org/wiki/Irene_Abendroth" ; + "https://www.wikidata.org/wiki/Q79002" ; + "https://d-nb.info/gnd/116002506" ; + "https://worldcat.org/identities/lccn-n97053925/" ; + "https://viaf.org/viaf/39572476" ; + "https://isni.org/isni/0000000035722792" ; + "https://snaccooperative.org/ark:/99166/w6bt189x#resources" ; + "Karl-Josef Kutsch, Leo Riemens: Großes Sängerlexikon, Bern: Saur 2003, pp. 3-4. \nWiener Staatsoper: Aufführungsarchiv, https://archiv.wiener-staatsoper.at/search/person/7243\nFremdenblatt - Organ für die böhmischen Kurorte, 8th July 1888, p. 2: https://anno.onb.ac.at/cgi-content/anno?aid=fbl&datum=18880708&query=%22Abendroth+Karlsbad%22~25&ref=anno-search&seite=2\n\n" ; + "Own" . + a ; + "5" ; + ; + ; + ; + "Education" . + a ; + "6" ; + ; + ; + ; + "1889" ; + "1889-01-01" ; + "1889-12-31" ; + "Labour" . + a ; + "7" ; + ; + ; + ; + "1890" ; + "1890-01-01" ; + "1890-12-31" ; + "Labour" . + a ; + "8" ; + ; + ; + ; + "1891" ; + "1891-01-01" ; + "1891-12-31" ; + "Labour" . + a ; + "9" ; + ; + ; + ; + "1894" ; + "1894-01-01" ; + "1894-12-31" ; + "Labour" . + a ; + "10" ; + ; + ; + ; + "1899" ; + "1899-01-01" ; + "1899-12-31" ; + "Labour" . + a ; + "11" ; + ; + ; + ; + "1909" ; + "1909-01-01" ; + "1909-12-31" ; + "Labour" . + a ; + "2114" ; + ; + ; + ; + "Education" . + a ; + "2117" ; + ; + ; + ; + "Labour" . + a ; + "2118" ; + ; + ; + ; + "1909" ; + "1909-01-01" ; + "1909-12-31" ; + "Other" . + a ; + "5120" ; + ; + "Singer" . + a ; + "2" ; + ; + ; + "" ; + ; + "" ; + "" . + a ; + "3" ; + ; + ; + "" ; + ; + "" . + a ; + "38" ; + ; + . + a ; + "93" ; + ; + ; + "" . + a ; + "16834" ; + ; + ; + "" ; + . + a ; + "16839" ; + ; + ; + "" ; + "Sister" . + a ; + "16844" ; + ; + ; + "" ; + . + a ; + "21686" ; + ; + ; + "" ; + . + a ; + "1" ; + ; + ; + "1888" ; + "1888-01-01" ; + "1888-12-31" ; + "-" ; + "Permanent" ; + "Singer" ; + "Tour" ; + "" . + a ; + "2" ; + ; + ; + ; + "1889" ; + "1889-01-01" ; + "1889-12-31" ; + "-" ; + "Singer" ; + "Tour" ; + "" . + a ; + "3" ; + ; + ; + ; + "1890" ; + "1890-01-01" ; + "1890-12-31" ; + "1891" ; + "1891-01-01" ; + "1891-12-31" ; + "Singer" ; + "Tour" ; + "" . + a ; + "4" ; + ; + ; + ; + "1891" ; + "1891-01-01" ; + "1891-12-31" ; + "1894" ; + "1894-01-01" ; + "1894-12-31" ; + "Singer" ; + "Tour" ; + "" . + a ; + "5" ; + ; + ; + ; + "1894" ; + "1894-01-01" ; + "1894-12-31" ; + "1897" ; + "1897-03-22" ; + "1897-03-22" ; + "Singer" ; + "Tour" ; + "" . + a ; + "6" ; + ; + ; + ; + "1899" ; + "1899-01-01" ; + "1899-12-31" ; + "1909" ; + "1909-01-01" ; + "1909-12-31" ; + "Singer" ; + "Tour" ; + "she left Vienna because of disagreements with Gustav Mahler (Director" . + a ; + "7" ; + ; + ; + ; + "1905" ; + "1905-01-01" ; + "1905-12-31" ; + "1907" ; + "1907-01-01" ; + "1907-12-31" ; + "Singer" ; + "Tour" ; + "Between 1905 and 1907 guest engagements at Berliner Hofoper" . + a ; + "8" ; + ; + ; + ; + "1905" ; + "1905-01-01" ; + "1905-12-31" ; + "1907" ; + "1907-01-01" ; + "1907-12-31" ; + "Singer" ; + "Tour" ; + "" . + a ; + "9" ; + ; + ; + ; + "1907" ; + "1907-01-01" ; + "1907-12-31" ; + "-" ; + "Singer" ; + "Tour" ; + "" . + a ; + "10" ; + ; + ; + ; + "1907" ; + "1907-01-01" ; + "1907-12-31" ; + "-" ; + "Singer" ; + "Tour" ; + "" . + a ; + "11" ; + ; + ; + ; + "1907" ; + "1907-01-01" ; + "1907-12-31" ; + "Singer" ; + "Tour" ; + "Deutsches Theater Prag" . + a ; + "UA-Lv-00" ; + "Europe" ; + "Ukraine" ; + "Lviv" ; + "49.83" ; + "24.0142" ; + "https://en.wikipedia.org/wiki/Lviv" ; + "Q36036" ; + "702550" . + a ; + "AT-Weid-00" ; + "Europe" ; + "Austria" ; + "Statzendorf" ; + "Weidling" ; + "48.3081" ; + "15.6408" ; + "Q484858" . + a ; + "WilAur-00" ; + "Aurelie" ; + "Wilczek" ; + "female" ; + "https://www.t-migrants.gwi.uni-muenchen.de/wp-content/uploads/images/placeholder_t_mig_2024.png" ; + "-" ; + "Singer, Singing Teacher" ; + "1845-01-20" ; + "1845-01-20" ; + ; + "1927-08-06" ; + "1927-08-06" ; + ; + "https://de.wikipedia.org/wiki/Aurelie_Wilczek" ; + "https://www.wikidata.org/wiki/Q18018523" ; + "https://d-nb.info/gnd/1037100972" ; + "https://viaf.org/viaf/304930607" ; + "https://data.cerl.org/thesaurus/cnp02080470" ; + "born Strusin[e]/Galizien (Strussiw/UA)\n" ; + "Andrea Harrandt: Jäger (-Wilczek), Familie, in: Oesterreichisches Musiklexikon. Online-Ausgabe, Wien 2002 ff., OEML: http://www.musiklexikon.ac.at/ml/musik_J/Jaeger_Familie_2.xmlKarl-Josef Kutsch, Leo Riemens: Großes Sängerlexikon, Bern: Saur 2003, p. 2217. Ludwig Eisenberg: Großes biographisches Lexikon der deutschen Bühne im XIX. Jahrhundert.  Leipzig: List 1903, pp. 468- 469." ; + "Own" . + a ; + "LamFra-00" ; + "Francesco Lamperti" ; + "Lamperti" ; + "male" ; + "https://www.t-migrants.gwi.uni-muenchen.de/wp-content/uploads/images/placeholder_t_mig_2024.png" ; + "Own" . + a ; + "AbeMir-00" ; + "Mira" ; + "Abendroth" ; + "female" ; + "https://www.t-migrants.gwi.uni-muenchen.de/wp-content/uploads/images/placeholder_t_mig_2024.png" ; + "Own" . + a ; + "CamCle-00" ; + "Cleofonte" ; + "Campanini" ; + "female" ; + "https://www.t-migrants.gwi.uni-muenchen.de/wp-content/uploads/images/placeholder_t_mig_2024.png" ; + "Own" . + a ; + "IT-Mila-00" ; + "Europe" ; + "Italy" ; + "Milan" ; + "45.4669" ; + "9.19" ; + "https://en.wikipedia.org/wiki/Milan" ; + "Q490" ; + "3173435" . + a ; + "MamEmm-00" ; + "Emma" ; + "Mampé-Babnigg" ; + "female" ; + "https://www.t-migrants.gwi.uni-muenchen.de/wp-content/uploads/images/placeholder_t_mig_2024.png" ; + "Opera Singer,Soprano, Singing Teacher" ; + "1825-02-25" ; + "1825-02-25" ; + ; + "1904-05-05" ; + "1904-05-05" ; + ; + "https://de.wikipedia.org/wiki/Emma_Mampe-Babnigg" ; + "https://www.wikidata.org/wiki/Q17425396" ; + "https://d-nb.info/gnd/116021799" ; + "https://viaf.org/viaf/62289633" ; + "https://data.cerl.org/thesaurus/cnp01075147" ; + "Own" . + a ; + "CZ-Karlsb-00" ; + "Europe" ; + "Czech Republic" ; + "Karlovy Vary" ; + "50.2306" ; + "12.8725" ; + "https://en.wikipedia.org/wiki/Karlovy_Vary" ; + "Q384544" ; + "3073803" . + a ; + "LV-RIX-00" ; + "Europe" ; + "Latvia" ; + "Riga" ; + "56.9489" ; + "24.1064" ; + "https://en.wikipedia.org/wiki/Riga" ; + "Q1773" ; + "456172" . + a ; + "72" ; + "Oper Riga" ; + "Theatre" ; + "" . + a ; + "GER-MUC-00" ; + "Europe" ; + "Germany" ; + "Munich" ; + "48.1333" ; + "11.5667" ; + "https://en.wikipedia.org/wiki/Munich" ; + "Q1726" ; + "2867714" . + a ; + "73" ; + "Königl. Hoftheater in München" ; + "Theatre" ; + ; + "" . + a ; + "AT-VIE-00" ; + "Europe" ; + "Austria" ; + "Vienna" ; + "48.21" ; + "16.3634" ; + "https://en.wikipedia.org/wiki/Vienna" ; + "Q1741" ; + "2761369" . + a ; + "71" ; + "Hofoper Wien" ; + "Theatre" ; + "" . + a ; + "GER-Dresd-00" ; + "Europe" ; + "Germany" ; + "Dresden" ; + "51.05" ; + "13.74" ; + "https://en.wikipedia.org/wiki/Dresden" ; + "Q1731" ; + "2935022" . + a ; + "450" ; + "Hofoper Dresden" ; + "Theatre" ; + ; + "" . + a ; + "GER-BER-00" ; + "Europe" ; + "Germany" ; + "Berlin" ; + "52.52" ; + "13.405" ; + "https://en.wikipedia.org/wiki/Berlin" ; + "Q64" ; + "2950159" . + a ; + "75" ; + "Königliche Oper, Berlin" ; + "Theatre" ; + ; + "" . + a ; + "GER-STR-00" ; + "Europe" ; + "Germany" ; + "Stuttgart" ; + "48.782" ; + "9.184" ; + "https://en.wikipedia.org/wiki/Stuttgart" ; + "Q1022" ; + "2825297" . + a ; + "76" ; + "Hofoper Stuttgart" ; + "Theatre" ; + ; + "" . + a ; + "GER-Ffm-00" ; + "Europe" ; + "Germany" ; + "Frankfurt" ; + "50.1167" ; + "8.68333" ; + "https://en.wikipedia.org/wiki/Frankfurt" ; + "Q1794" ; + "2925533" . + a ; + "77" ; + "Oper Frankfurt" ; + "Theatre" ; + ; + "" . + a ; + "GER-Leip-00" ; + "Europe" ; + "Germany" ; + "Leipzig" ; + "51.3333" ; + "12.3833" ; + "https://en.wikipedia.org/wiki/Leipzig" ; + "Q2079" ; + "2879139" . + a ; + "78" ; + "Oper Leipzig" ; + "Theatre" ; + ; + "" . + a ; + "CZ-Prag-00" ; + "Europe" ; + "Czech Republic" ; + "Prague" ; + "50.0833" ; + "14.4167" ; + "https://en.wikipedia.org/wiki/Prague" ; + "Q1085" ; + "3067696" . + a ; + "79" ; + "Deutsches Theater Prag" ; + "Theatre" ; + ; + "" .