From c9c768aa1736b7157d5c5f55240c28add5a45037 Mon Sep 17 00:00:00 2001 From: Daniel Hernandez Date: Sun, 22 Feb 2026 17:25:48 +0100 Subject: [PATCH] Create multiple mapping files. --- Gemfile | 1 + Gemfile.lock | 5 + data/000-found_countries_many.ttl | 0 data/000-found_countries_one.ttl | 187 ------------- data/000-found_countries_zero.ttl | 24 -- data/001-found_countries_one.ttl | 251 ------------------ data/001-found_countries_zero.ttl | 30 --- data/001-religions.ttl | 208 --------------- data/occupations.ttl | 177 ++++++++++++ data/religions_wikidata.ttl | 12 + ...many.ttl => religions_wikidata_review.ttl} | 8 +- src/link_religions_to_wikidata.rb | 52 ++++ src/map_migration_table.rb | 35 +++ src/map_occupations_from_person_profession.rb | 25 ++ src/map_organisation.rb | 27 ++ src/map_person_profession.rb | 27 ++ src/map_personnames.rb | 34 +++ src/map_persons.rb | 0 src/map_relationship.rb | 37 +++ src/map_work.rb | 39 +++ src/vocabularies.rb | 16 +- 21 files changed, 490 insertions(+), 705 deletions(-) delete mode 100644 data/000-found_countries_many.ttl delete mode 100644 data/000-found_countries_one.ttl delete mode 100644 data/000-found_countries_zero.ttl delete mode 100644 data/001-found_countries_one.ttl delete mode 100644 data/001-found_countries_zero.ttl delete mode 100644 data/001-religions.ttl create mode 100644 data/occupations.ttl create mode 100644 data/religions_wikidata.ttl rename data/{001-found_countries_many.ttl => religions_wikidata_review.ttl} (61%) create mode 100755 src/link_religions_to_wikidata.rb create mode 100755 src/map_migration_table.rb create mode 100755 src/map_occupations_from_person_profession.rb create mode 100755 src/map_organisation.rb create mode 100755 src/map_person_profession.rb create mode 100755 src/map_personnames.rb mode change 100644 => 100755 src/map_persons.rb create mode 100755 src/map_relationship.rb create mode 100755 src/map_work.rb diff --git a/Gemfile b/Gemfile index 6b219ca..a117cce 100644 --- a/Gemfile +++ b/Gemfile @@ -3,5 +3,6 @@ source 'https://rubygems.org' gem 'sequel' gem 'mysql2' gem 'sparql' +gem 'rdf-turtle' gem 'nokogiri' gem 'pry' diff --git a/Gemfile.lock b/Gemfile.lock index a04da3f..a0e2bb8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -36,6 +36,9 @@ GEM link_header (~> 0.0, >= 0.0.8) rdf-aggregate-repo (3.3.0) rdf (~> 3.3) + rdf-turtle (3.3.0) + ebnf (~> 2.4) + rdf (~> 3.3) rdf-xsd (3.3.0) rdf (~> 3.3) rexml (~> 3.2) @@ -72,6 +75,7 @@ DEPENDENCIES mysql2 nokogiri pry + rdf-turtle sequel sparql @@ -96,6 +100,7 @@ CHECKSUMS racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f rdf (3.3.1) sha256=dda6a2c95198915fc63d66ee270e35d4a76d431720747a2cf97ecd92062fa150 rdf-aggregate-repo (3.3.0) sha256=5693ccabf4dbbec7113c95e9aab028311f19d6022764fdebc6327f9d55a9efdc + rdf-turtle (3.3.0) sha256=10320428670be3510364195e68e365b888c458c4a462cfc8c28cdffccc64f699 rdf-xsd (3.3.0) sha256=fab51d27b20344237d9b622ef32e83e4c44940840bfc76a245ce6b6abba44772 readline (0.0.4) sha256=6138eef17be2b98298b672c3ea63bf9cb5158d401324f26e1e84f235879c1d6a reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835 diff --git a/data/000-found_countries_many.ttl b/data/000-found_countries_many.ttl deleted file mode 100644 index e69de29..0000000 diff --git a/data/000-found_countries_one.ttl b/data/000-found_countries_one.ttl deleted file mode 100644 index 3052d75..0000000 --- a/data/000-found_countries_one.ttl +++ /dev/null @@ -1,187 +0,0 @@ -@prefix schema: . -@prefix country: . -@prefix tm: . - -country:Argentina a schema:Country ; - rdfs:label "Argentina"@en ; - tm:wikidataEntity wd:Q414 . -country:Austria a schema:Country ; - rdfs:label "Austria"@en ; - tm:wikidataEntity wd:Q40 . -country:Australia a schema:Country ; - rdfs:label "Australia"@en ; - tm:wikidataEntity wd:Q408 . -country:Azerbaijan a schema:Country ; - rdfs:label "Azerbaijan"@en ; - tm:wikidataEntity wd:Q227 . -country:Belgium a schema:Country ; - rdfs:label "Belgium"@en ; - tm:wikidataEntity wd:Q31 . -country:Belarus a schema:Country ; - rdfs:label "Belarus"@en ; - tm:wikidataEntity wd:Q184 . -country:Bulgaria a schema:Country ; - rdfs:label "Bulgaria"@en ; - tm:wikidataEntity wd:Q219 . -country:Brazil a schema:Country ; - rdfs:label "Brazil"@en ; - tm:wikidataEntity wd:Q155 . -country:Canada a schema:Country ; - rdfs:label "Canada"@en ; - tm:wikidataEntity wd:Q16 . -country:Switzerland a schema:Country ; - rdfs:label "Switzerland"@en ; - tm:wikidataEntity wd:Q39 . -country:Chile a schema:Country ; - rdfs:label "Chile"@en ; - tm:wikidataEntity wd:Q298 . -country:Ukraine a schema:Country ; - rdfs:label "Ukraine"@en ; - tm:wikidataEntity wd:Q212 . -country:Costa_Rica a schema:Country ; - rdfs:label "Costa Rica"@en ; - tm:wikidataEntity wd:Q800 . -country:Cuba a schema:Country ; - rdfs:label "Cuba"@en ; - tm:wikidataEntity wd:Q241 . -country:Czech_Republic a schema:Country ; - rdfs:label "Czech Republic"@en ; - tm:wikidataEntity wd:Q213 . -country:Denmark a schema:Country ; - rdfs:label "Denmark"@en ; - tm:wikidataEntity wd:Q35 . -country:Algeria a schema:Country ; - rdfs:label "Algeria"@en ; - tm:wikidataEntity wd:Q262 . -country:Egypt a schema:Country ; - rdfs:label "Egypt"@en ; - tm:wikidataEntity wd:Q79 . -country:El_Salvador a schema:Country ; - rdfs:label "El Salvador"@en ; - tm:wikidataEntity wd:Q792 . -country:Spain a schema:Country ; - rdfs:label "Spain"@en ; - tm:wikidataEntity wd:Q29 . -country:Fiji a schema:Country ; - rdfs:label "Fiji"@en ; - tm:wikidataEntity wd:Q712 . -country:France a schema:Country ; - rdfs:label "France"@en ; - tm:wikidataEntity wd:Q142 . -country:United_Kingdom a schema:Country ; - rdfs:label "United Kingdom"@en ; - tm:wikidataEntity wd:Q145 . -country:Germany a schema:Country ; - rdfs:label "Germany"@en ; - tm:wikidataEntity wd:Q183 . -country:Greece a schema:Country ; - rdfs:label "Greece"@en ; - tm:wikidataEntity wd:Q41 . -country:Croatia a schema:Country ; - rdfs:label "Croatia"@en ; - tm:wikidataEntity wd:Q224 . -country:Hungary a schema:Country ; - rdfs:label "Hungary"@en ; - tm:wikidataEntity wd:Q28 . -country:Slovakia a schema:Country ; - rdfs:label "Slovakia"@en ; - tm:wikidataEntity wd:Q214 . -country:Indonesia a schema:Country ; - rdfs:label "Indonesia"@en ; - tm:wikidataEntity wd:Q252 . -country:Ireland a schema:Country ; - rdfs:label "Ireland"@en ; - tm:wikidataEntity wd:Q27 . -country:India a schema:Country ; - rdfs:label "India"@en ; - tm:wikidataEntity wd:Q668 . -country:Israel a schema:Country ; - rdfs:label "Israel"@en ; - tm:wikidataEntity wd:Q801 . -country:Italy a schema:Country ; - rdfs:label "Italy"@en ; - tm:wikidataEntity wd:Q38 . -country:Japan a schema:Country ; - rdfs:label "Japan"@en ; - tm:wikidataEntity wd:Q17 . -country:Latvia a schema:Country ; - rdfs:label "Latvia"@en ; - tm:wikidataEntity wd:Q211 . -country:Lithuania a schema:Country ; - rdfs:label "Lithuania"@en ; - tm:wikidataEntity wd:Q37 . -country:Sri_Lanka a schema:Country ; - rdfs:label "Sri Lanka"@en ; - tm:wikidataEntity wd:Q854 . -country:Monaco a schema:Country ; - rdfs:label "Monaco"@en ; - tm:wikidataEntity wd:Q235 . -country:Myanmar a schema:Country ; - rdfs:label "Myanmar"@en ; - tm:wikidataEntity wd:Q836 . -country:Moldova a schema:Country ; - rdfs:label "Moldova"@en ; - tm:wikidataEntity wd:Q217 . -country:Mexico a schema:Country ; - rdfs:label "Mexico"@en ; - tm:wikidataEntity wd:Q96 . -country:Netherlands a schema:Country ; - rdfs:label "Netherlands"@en ; - tm:wikidataEntity wd:Q55 . -country:Norway a schema:Country ; - rdfs:label "Norway"@en ; - tm:wikidataEntity wd:Q20 . -country:New_Zealand a schema:Country ; - rdfs:label "New Zealand"@en ; - tm:wikidataEntity wd:Q664 . -country:Panama a schema:Country ; - rdfs:label "Panama"@en ; - tm:wikidataEntity wd:Q804 . -country:Peru a schema:Country ; - rdfs:label "Peru"@en ; - tm:wikidataEntity wd:Q419 . -country:Poland a schema:Country ; - rdfs:label "Poland"@en ; - tm:wikidataEntity wd:Q36 . -country:Paraguay a schema:Country ; - rdfs:label "Paraguay"@en ; - tm:wikidataEntity wd:Q733 . -country:Palestine a schema:Country ; - rdfs:label "Palestine"@en ; - tm:wikidataEntity wd:Q219060 . -country:Portugal a schema:Country ; - rdfs:label "Portugal"@en ; - tm:wikidataEntity wd:Q45 . -country:Romania a schema:Country ; - rdfs:label "Romania"@en ; - tm:wikidataEntity wd:Q218 . -country:Russia a schema:Country ; - rdfs:label "Russia"@en ; - tm:wikidataEntity wd:Q159 . -country:Sweden a schema:Country ; - rdfs:label "Sweden"@en ; - tm:wikidataEntity wd:Q34 . -country:Singapore a schema:Country ; - rdfs:label "Singapore"@en ; - tm:wikidataEntity wd:Q334 . -country:Slovenia a schema:Country ; - rdfs:label "Slovenia"@en ; - tm:wikidataEntity wd:Q215 . -country:Serbia a schema:Country ; - rdfs:label "Serbia"@en ; - tm:wikidataEntity wd:Q403 . -country:Turkey a schema:Country ; - rdfs:label "Turkey"@en ; - tm:wikidataEntity wd:Q43 . -country:United_States a schema:Country ; - rdfs:label "United States"@en ; - tm:wikidataEntity wd:Q30 . -country:Uruguay a schema:Country ; - rdfs:label "Uruguay"@en ; - tm:wikidataEntity wd:Q77 . -country:Vietnam a schema:Country ; - rdfs:label "Vietnam"@en ; - tm:wikidataEntity wd:Q881 . -country:South_Africa a schema:Country ; - rdfs:label "South Africa"@en ; - tm:wikidataEntity wd:Q258 . diff --git a/data/000-found_countries_zero.ttl b/data/000-found_countries_zero.ttl deleted file mode 100644 index 92def20..0000000 --- a/data/000-found_countries_zero.ttl +++ /dev/null @@ -1,24 +0,0 @@ -Channel Islands -China -Columbia -Eastern Europe -England -Estland -Europe -Northern Ireland (UK) -ITaly -Korea - -USA -North America -Poland / Ukraine -Prussia -Scandinavia -Scotland -Soviet Union -England (UK) -Wales (UK) -USa -UAS -West Europe -Yugoslavia diff --git a/data/001-found_countries_one.ttl b/data/001-found_countries_one.ttl deleted file mode 100644 index 2a85647..0000000 --- a/data/001-found_countries_one.ttl +++ /dev/null @@ -1,251 +0,0 @@ -@prefix wd: . -@prefix wdt: . -@prefix rdfs: . -@prefix tm: . -@prefix schema: . -@prefix country: . - -country:Argentina a schema:Country ; - rdfs:label "Argentina"@en ; - tm:wikidataEntity wd:Q414 ; - tm:geonamesEntiy geo:3865483 . -country:Austria a schema:Country ; - rdfs:label "Austria"@en ; - tm:wikidataEntity wd:Q40 ; - tm:geonamesEntiy geo:2782113 . -country:Australia a schema:Country ; - rdfs:label "Australia"@en ; - tm:wikidataEntity wd:Q408 ; - tm:geonamesEntiy geo:2077456 . -country:Azerbaijan a schema:Country ; - rdfs:label "Azerbaijan"@en ; - tm:wikidataEntity wd:Q227 ; - tm:geonamesEntiy geo:587116 . -country:Belgium a schema:Country ; - rdfs:label "Belgium"@en ; - tm:wikidataEntity wd:Q31 ; - tm:geonamesEntiy geo:2802361 . -country:Belarus a schema:Country ; - rdfs:label "Belarus"@en ; - tm:wikidataEntity wd:Q184 ; - tm:geonamesEntiy geo:630336 . -country:Bulgaria a schema:Country ; - rdfs:label "Bulgaria"@en ; - tm:wikidataEntity wd:Q219 ; - tm:geonamesEntiy geo:732800 . -country:Brazil a schema:Country ; - rdfs:label "Brazil"@en ; - tm:wikidataEntity wd:Q155 ; - tm:geonamesEntiy geo:3469034 . -country:Canada a schema:Country ; - rdfs:label "Canada"@en ; - tm:wikidataEntity wd:Q16 ; - tm:geonamesEntiy geo:6251999 . -country:Switzerland a schema:Country ; - rdfs:label "Switzerland"@en ; - tm:wikidataEntity wd:Q39 ; - tm:geonamesEntiy geo:2658434 . -country:Chile a schema:Country ; - rdfs:label "Chile"@en ; - tm:wikidataEntity wd:Q298 ; - tm:geonamesEntiy geo:3895114 . -country:Ukraine a schema:Country ; - rdfs:label "Ukraine"@en ; - tm:wikidataEntity wd:Q212 ; - tm:geonamesEntiy geo:690791 . -country:Costa_Rica a schema:Country ; - rdfs:label "Costa Rica"@en ; - tm:wikidataEntity wd:Q800 ; - tm:geonamesEntiy geo:3624060 . -country:Cuba a schema:Country ; - rdfs:label "Cuba"@en ; - tm:wikidataEntity wd:Q241 ; - tm:geonamesEntiy geo:3562981 . -country:Czech_Republic a schema:Country ; - rdfs:label "Czech Republic"@en ; - tm:wikidataEntity wd:Q213 ; - tm:geonamesEntiy geo:3077311 . -country:Denmark a schema:Country ; - rdfs:label "Denmark"@en ; - tm:wikidataEntity wd:Q35 ; - tm:geonamesEntiy geo:2623032 . -country:Algeria a schema:Country ; - rdfs:label "Algeria"@en ; - tm:wikidataEntity wd:Q262 ; - tm:geonamesEntiy geo:2589581 . -country:Egypt a schema:Country ; - rdfs:label "Egypt"@en ; - tm:wikidataEntity wd:Q79 ; - tm:geonamesEntiy geo:357994 . -country:El_Salvador a schema:Country ; - rdfs:label "El Salvador"@en ; - tm:wikidataEntity wd:Q792 ; - tm:geonamesEntiy geo:3585968 . -country:Spain a schema:Country ; - rdfs:label "Spain"@en ; - tm:wikidataEntity wd:Q29 ; - tm:geonamesEntiy geo:2510769 . -country:Fiji a schema:Country ; - rdfs:label "Fiji"@en ; - tm:wikidataEntity wd:Q712 ; - tm:geonamesEntiy geo:2205218 . -country:France a schema:Country ; - rdfs:label "France"@en ; - tm:wikidataEntity wd:Q142 ; - tm:geonamesEntiy geo:3017382 . -country:United_Kingdom a schema:Country ; - rdfs:label "United Kingdom"@en ; - tm:wikidataEntity wd:Q145 ; - tm:geonamesEntiy geo:2635167 . -country:Germany a schema:Country ; - rdfs:label "Germany"@en ; - tm:wikidataEntity wd:Q183 ; - tm:geonamesEntiy geo:2921044 . -country:Greece a schema:Country ; - rdfs:label "Greece"@en ; - tm:wikidataEntity wd:Q41 ; - tm:geonamesEntiy geo:390903 . -country:Croatia a schema:Country ; - rdfs:label "Croatia"@en ; - tm:wikidataEntity wd:Q224 ; - tm:geonamesEntiy geo:3202326 . -country:Hungary a schema:Country ; - rdfs:label "Hungary"@en ; - tm:wikidataEntity wd:Q28 ; - tm:geonamesEntiy geo:719819 . -country:Slovakia a schema:Country ; - rdfs:label "Slovakia"@en ; - tm:wikidataEntity wd:Q214 ; - tm:geonamesEntiy geo:3057568 . -country:Indonesia a schema:Country ; - rdfs:label "Indonesia"@en ; - tm:wikidataEntity wd:Q252 ; - tm:geonamesEntiy geo:1643084 . -country:Ireland a schema:Country ; - rdfs:label "Ireland"@en ; - tm:wikidataEntity wd:Q27 ; - tm:geonamesEntiy geo:2963597 . -country:India a schema:Country ; - rdfs:label "India"@en ; - tm:wikidataEntity wd:Q668 ; - tm:geonamesEntiy geo:1269750 . -country:Israel a schema:Country ; - rdfs:label "Israel"@en ; - tm:wikidataEntity wd:Q801 ; - tm:geonamesEntiy geo:294640 . -country:Italy a schema:Country ; - rdfs:label "Italy"@en ; - tm:wikidataEntity wd:Q38 ; - tm:geonamesEntiy geo:3175395 . -country:Japan a schema:Country ; - rdfs:label "Japan"@en ; - tm:wikidataEntity wd:Q17 ; - tm:geonamesEntiy geo:1861060 . -country:Latvia a schema:Country ; - rdfs:label "Latvia"@en ; - tm:wikidataEntity wd:Q211 ; - tm:geonamesEntiy geo:458258 . -country:Lithuania a schema:Country ; - rdfs:label "Lithuania"@en ; - tm:wikidataEntity wd:Q37 ; - tm:geonamesEntiy geo:597427 . -country:Sri_Lanka a schema:Country ; - rdfs:label "Sri Lanka"@en ; - tm:wikidataEntity wd:Q854 ; - tm:geonamesEntiy geo:1227603 . -country:Monaco a schema:Country ; - rdfs:label "Monaco"@en ; - tm:wikidataEntity wd:Q235 ; - tm:geonamesEntiy geo:2993457 . -country:Myanmar a schema:Country ; - rdfs:label "Myanmar"@en ; - tm:wikidataEntity wd:Q836 ; - tm:geonamesEntiy geo:1327865 . -country:Moldova a schema:Country ; - rdfs:label "Moldova"@en ; - tm:wikidataEntity wd:Q217 ; - tm:geonamesEntiy geo:617790 . -country:Mexico a schema:Country ; - rdfs:label "Mexico"@en ; - tm:wikidataEntity wd:Q96 ; - tm:geonamesEntiy geo:3996063 . -country:Netherlands a schema:Country ; - rdfs:label "Netherlands"@en ; - tm:wikidataEntity wd:Q55 ; - tm:geonamesEntiy geo:2750405 . -country:Norway a schema:Country ; - rdfs:label "Norway"@en ; - tm:wikidataEntity wd:Q20 ; - tm:geonamesEntiy geo:3144096 . -country:New_Zealand a schema:Country ; - rdfs:label "New Zealand"@en ; - tm:wikidataEntity wd:Q664 ; - tm:geonamesEntiy geo:2186224 . -country:Panama a schema:Country ; - rdfs:label "Panama"@en ; - tm:wikidataEntity wd:Q804 ; - tm:geonamesEntiy geo:3703430 . -country:Peru a schema:Country ; - rdfs:label "Peru"@en ; - tm:wikidataEntity wd:Q419 ; - tm:geonamesEntiy geo:3932488 . -country:Poland a schema:Country ; - rdfs:label "Poland"@en ; - tm:wikidataEntity wd:Q36 ; - tm:geonamesEntiy geo:798544 . -country:Paraguay a schema:Country ; - rdfs:label "Paraguay"@en ; - tm:wikidataEntity wd:Q733 ; - tm:geonamesEntiy geo:3437598 . -country:Palestine a schema:Country ; - rdfs:label "Palestine"@en ; - tm:wikidataEntity wd:Q219060 ; - tm:geonamesEntiy geo:6254930 . -country:Portugal a schema:Country ; - rdfs:label "Portugal"@en ; - tm:wikidataEntity wd:Q45 ; - tm:geonamesEntiy geo:2264397 . -country:Romania a schema:Country ; - rdfs:label "Romania"@en ; - tm:wikidataEntity wd:Q218 ; - tm:geonamesEntiy geo:798549 . -country:Russia a schema:Country ; - rdfs:label "Russia"@en ; - tm:wikidataEntity wd:Q159 ; - tm:geonamesEntiy geo:2017370 . -country:Sweden a schema:Country ; - rdfs:label "Sweden"@en ; - tm:wikidataEntity wd:Q34 ; - tm:geonamesEntiy geo:2661886 . -country:Singapore a schema:Country ; - rdfs:label "Singapore"@en ; - tm:wikidataEntity wd:Q334 ; - tm:geonamesEntiy geo:1880251 . -country:Slovenia a schema:Country ; - rdfs:label "Slovenia"@en ; - tm:wikidataEntity wd:Q215 ; - tm:geonamesEntiy geo:3190538 . -country:Serbia a schema:Country ; - rdfs:label "Serbia"@en ; - tm:wikidataEntity wd:Q403 ; - tm:geonamesEntiy geo:6290252 . -country:Turkey a schema:Country ; - rdfs:label "Turkey"@en ; - tm:wikidataEntity wd:Q43 ; - tm:geonamesEntiy geo:298795 . -country:United_States a schema:Country ; - rdfs:label "United States"@en ; - tm:wikidataEntity wd:Q30 ; - tm:geonamesEntiy geo:6252001 . -country:Uruguay a schema:Country ; - rdfs:label "Uruguay"@en ; - tm:wikidataEntity wd:Q77 ; - tm:geonamesEntiy geo:3439705 . -country:Vietnam a schema:Country ; - rdfs:label "Vietnam"@en ; - tm:wikidataEntity wd:Q881 ; - tm:geonamesEntiy geo:1562822 . -country:South_Africa a schema:Country ; - rdfs:label "South Africa"@en ; - tm:wikidataEntity wd:Q258 ; - tm:geonamesEntiy geo:953987 . diff --git a/data/001-found_countries_zero.ttl b/data/001-found_countries_zero.ttl deleted file mode 100644 index b0e6d82..0000000 --- a/data/001-found_countries_zero.ttl +++ /dev/null @@ -1,30 +0,0 @@ -@prefix wd: . -@prefix wdt: . -@prefix rdfs: . -@prefix tm: . -@prefix schema: . -@prefix country: . - -Channel Islands -China -Columbia -Eastern Europe -England -Estland -Europe -Northern Ireland (UK) -ITaly -Korea -USA -North America -Poland / Ukraine -Prussia -Scandinavia -Scotland -Soviet Union -England (UK) -Wales (UK) -USa -UAS -West Europe -Yugoslavia diff --git a/data/001-religions.ttl b/data/001-religions.ttl deleted file mode 100644 index cf0097b..0000000 --- a/data/001-religions.ttl +++ /dev/null @@ -1,208 +0,0 @@ -@prefix tm: . -@prefix person: . -@prefix rdfs: . -@prefix religion: . -@prefix schema: . -@prefix xsd: . - -religion:196 a tm:ReligionAffiliation ; - tm:person person:BecMar-00 ; - tm:religion religion:Judaism ; - rdfs:comment "Was born to a Jewish family" . - -religion:199 a tm:ReligionAffiliation ; - tm:person person:GerBer-00 ; - tm:religion religion:Judaism ; - rdfs:comment "Jewish, her mother was an Orthodox Jew" . - -religion:205 a tm:ReligionAffiliation ; - tm:person person:GluAlm-00 ; - tm:religion religion:Judaism ; - rdfs:comment "Jewish, showing attraction to Anglican Christianity (attended the Episcopal Church in New Hartford), in addition, all three of her children were baptized" . - -religion:208 a tm:ReligionAffiliation ; - tm:person person:GolAbr-00 ; - tm:religion religion:Judaism ; - rdfs:comment "Yew" . - -religion:211 a tm:ReligionAffiliation ; - tm:person person:GolAbr-00 ; - tm:dateStartFuzzy "1883" ; - rdfs:comment "Bar Kochba (1883) steht im Zeichen des beginnenden Zionismus" . - -religion:217 a tm:ReligionAffiliation ; - tm:person person:HelAnn-00 ; - tm:religion religion:Judaism ; - rdfs:comment "May have converted from Judaism to Roman Catholicism as she married Carrera." . - -religion:218 a tm:ReligionAffiliation ; - tm:person person:HelAnn-00 ; - tm:religion religion:Christianity . - -religion:220 a tm:ReligionAffiliation ; - tm:person person:KalBer-00 ; - tm:religion religion:Judaism ; - rdfs:comment "Jewish; Fifteen hundred people attended her funeral, considered a disappointing turnout, considering her status in the Jewish community. She had come to be seen as \"a relic of the theatrical past, with a manner too romantic and grand even for the Yiddish stage\"\n" . - -religion:223 a tm:ReligionAffiliation ; - tm:person person:KreEli-00 ; - tm:religion religion:Judaism ; - rdfs:comment "baptised evangelical Christian (as a baby), comes from a Jewish family (negative thematised in the wedding to Paul von Thurn und Taxis)" . - -religion:224 a tm:ReligionAffiliation ; - tm:person person:KreEli-00 ; - tm:religion religion:Christianity . - -religion:226 a tm:ReligionAffiliation ; - tm:person person:KroSel-00 ; - tm:religion religion:Judaism ; - rdfs:comment "Family with jewish roots" . - -religion:229 a tm:ReligionAffiliation ; - tm:person person:LewAug-00 ; - tm:religion religion:Judaism ; - rdfs:comment "Israelitisch" . - -religion:232 a tm:ReligionAffiliation ; - tm:person person:LewAug-00 ; - tm:religion religion:Christianity ; - tm:dateStartFuzzy "1812" ; - tm:dateStart "1812-01-01"^^xsd:date ; - rdfs:comment "evangelical" . - -religion:235 a tm:ReligionAffiliation ; - tm:person person:LewAug-00 ; - tm:religion religion:Christianity ; - tm:dateStartFuzzy "1852" ; - tm:dateStart "1852-01-01"^^xsd:date ; - rdfs:comment "catholic" . - -religion:238 a tm:ReligionAffiliation ; - tm:person person:LewAug-00 ; - rdfs:comment "Ultramontanismus" . - -religion:244 a tm:ReligionAffiliation ; - tm:person person:MahGus-00 ; - tm:religion religion:Judaism ; - tm:dateStart "1897-02-23"^^xsd:date ; - rdfs:comment "converted to Catholicism and was baptized\n“My Judaism, as things are now in the world, prevents me from entering any court theater. - Not Vienna, not Berlin, not Dresden, not Munich is open to me. The same wind blows everywhere. \"(Letter to Friedrich Löhr 1804)" . - -religion:245 a tm:ReligionAffiliation ; - tm:person person:MahGus-00 ; - tm:religion religion:Christianity . - -religion:247 a tm:ReligionAffiliation ; - tm:person person:NazAll-00 ; - tm:religion religion:Judaism ; - rdfs:comment "Nazimova was born into a jewish family but raised a Catholic. Later she declared, her only faith was in her art." . - -religion:248 a tm:ReligionAffiliation ; - tm:person person:NazAll-00 ; - tm:religion religion:Christianity . - -religion:250 a tm:ReligionAffiliation ; - tm:person person:PolBer-00 ; - tm:religion religion:Judaism ; - rdfs:comment "He came from fervent jewish family" . - -religion:253 a tm:ReligionAffiliation ; - tm:person person:RehAda-00 ; - tm:religion religion:Christianity ; - tm:dateStart "1857-06-12"^^xsd:date ; - rdfs:comment "baptised in St Michael's Roman Catholic Church" . - -religion:259 a tm:ReligionAffiliation ; - tm:person person:SchErn-00 ; - tm:religion religion:Judaism ; - rdfs:comment "Baptized catholic but her maternal grandmother, Leah Kohn, was of Hungarian Jewish descent. Affirmed her Jewish ancestry proudly, fervently opposing the Hitler regime" . - -religion:260 a tm:ReligionAffiliation ; - tm:person person:SchErn-00 ; - tm:religion religion:Christianity . - -religion:262 a tm:ReligionAffiliation ; - tm:person person:StrAle-00 ; - tm:religion religion:Judaism ; - rdfs:comment "Jewish" . - -religion:265 a tm:ReligionAffiliation ; - tm:person person:StrAle-00 ; - tm:religion religion:Christianity ; - rdfs:comment "was destined to become a preacher" . - -religion:268 a tm:ReligionAffiliation ; - tm:person person:TucSop-00 ; - tm:religion religion:Judaism ; - rdfs:comment "Her parents were Russian Jews" . - -religion:272 a tm:ReligionAffiliation ; - tm:person person:HamOsc-00 ; - tm:religion religion:Judaism ; - rdfs:comment "Jewish" . - -religion:338 a tm:ReligionAffiliation ; - tm:person person:KorFri-00 ; - tm:religion religion:Judaism ; - rdfs:comment "jewish" . - -religion:347 a tm:ReligionAffiliation ; - tm:person person:LubErn-00 ; - tm:religion religion:Judaism ; - rdfs:comment "Ashkenazi Jewish" . - -religion:355 a tm:ReligionAffiliation ; - tm:person person:KreHei-00 ; - tm:religion religion:Judaism ; - tm:dateStartFuzzy "1871" ; - tm:dateStart "1871-01-01"^^xsd:date ; - tm:dateStartMax "1873" ; - tm:dateEndMin "1873-01-01"^^xsd:date ; - tm:dateEndMax "1873-12-31"^^xsd:date ; - rdfs:comment "He converted to the Catholic faith at the age of 54 as part of the assimilation of wider Jewish circles after the \"Interconfessional Laws\" of 1868 in Austria allowed a change of religion. He had all his children baptised Protestants in the places where they were born and where he had a stage engagement in each case." . - -religion:356 a tm:ReligionAffiliation ; - tm:person person:KreHei-00 ; - tm:religion religion:Christianity . - -religion:358 a tm:ReligionAffiliation ; - tm:person person:BoiCur-00 ; - tm:religion religion:Judaism ; - rdfs:comment "jewish" . - -religion:387 a tm:ReligionAffiliation ; - tm:person person:GruFri-00 ; - tm:religion religion:Judaism ; - rdfs:comment "Jewish" . - -religion:416 a tm:ReligionAffiliation ; - tm:person person:LevHer-00 ; - tm:religion religion:Judaism ; - rdfs:comment "Born in a Jewish family he was no active jude, but did not baptize" . - -religion:423 a tm:ReligionAffiliation ; - tm:person person:ZemAle-00 ; - tm:religion religion:Judaism ; - tm:dateStartFuzzy "1899" ; - tm:dateStart "1899-01-01"^^xsd:date ; - rdfs:comment "In 1899 he resigned from the Israelite religious community because the climate for Jews in Vienna was deteriorating." . - -religion:429 a tm:ReligionAffiliation ; - tm:person person:ZemAle-00 ; - tm:religion religion:Christianity ; - tm:dateStartFuzzy "1906" ; - tm:dateStart "1906-01-01"^^xsd:date ; - rdfs:comment "converting to Protestantism." . - -religion:431 a tm:ReligionAffiliation ; - tm:person person:KelAlf-00 ; - tm:religion religion:Christianity . - -religion:445 a tm:ReligionAffiliation ; - tm:person person:StrFri-00 ; - tm:religion religion:Christianity ; - tm:denomination "Protestant" . - -religion:446 a tm:ReligionAffiliation ; - tm:person person:HerAde-00 ; - tm:religion religion:Christianity . - diff --git a/data/occupations.ttl b/data/occupations.ttl new file mode 100644 index 0000000..3572f5a --- /dev/null +++ b/data/occupations.ttl @@ -0,0 +1,177 @@ +@prefix occupation: . +@prefix schema: . + +occupation:Actor a schema:Occupation ; + schema:name "Actor" . + +occupation:Advertiser a schema:Occupation ; + schema:name "Advertiser" . + +occupation:Agent a schema:Occupation ; + schema:name "Agent" . + +occupation:Assistant a schema:Occupation ; + schema:name "Assistant" . + +occupation:Author a schema:Occupation ; + schema:name "Author" . + +occupation:Ballet_master a schema:Occupation ; + schema:name "Ballet master" . + +occupation:Businesswoman a schema:Occupation ; + schema:name "Businesswoman" . + +occupation:Cartoonist a schema:Occupation ; + schema:name "Cartoonist" . + +occupation:Ceramist a schema:Occupation ; + schema:name "Ceramist" . + +occupation:Choreographer a schema:Occupation ; + schema:name "Choreographer" . + +occupation:Circus_Performer a schema:Occupation ; + schema:name "Circus Performer" . + +occupation:Comedian a schema:Occupation ; + schema:name "Comedian" . + +occupation:Composer a schema:Occupation ; + schema:name "Composer" . + +occupation:Customier a schema:Occupation ; + schema:name "Customier" . + +occupation:Cutter a schema:Occupation ; + schema:name "Cutter" . + +occupation:Dancer a schema:Occupation ; + schema:name "Dancer" . + +occupation:Director a schema:Occupation ; + schema:name "Director" . + +occupation:Dramaturg a schema:Occupation ; + schema:name "Dramaturg" . + +occupation:Elocution_teacher a schema:Occupation ; + schema:name "Elocution teacher" . + +occupation:Emcee a schema:Occupation ; + schema:name "Emcee" . + +occupation:English_Teacher a schema:Occupation ; + schema:name "English Teacher" . + +occupation:Farmer a schema:Occupation ; + schema:name "Farmer" . + +occupation:Feminist a schema:Occupation ; + schema:name "Feminist" . + +occupation:Film_producer a schema:Occupation ; + schema:name "Film producer" . + +occupation:Founder a schema:Occupation ; + schema:name "Founder" . + +occupation:French_Teacher a schema:Occupation ; + schema:name "French Teacher" . + +occupation:Hotel_Founder a schema:Occupation ; + schema:name "Hotel Founder" . + +occupation:Impresario a schema:Occupation ; + schema:name "Impresario" . + +occupation:Intendant a schema:Occupation ; + schema:name "Intendant" . + +occupation:Journalist a schema:Occupation ; + schema:name "Journalist" . + +occupation:Kleinkuenstler a schema:Occupation ; + schema:name "Kleinkuenstler" . + +occupation:Magician a schema:Occupation ; + schema:name "Magician" . + +occupation:Manager a schema:Occupation ; + schema:name "Manager" . + +occupation:Merchant a schema:Occupation ; + schema:name "Merchant" . + +occupation:Movie_Producer a schema:Occupation ; + schema:name "Movie Producer" . + +occupation:Music_Director a schema:Occupation ; + schema:name "Music Director" . + +occupation:Music_Educator a schema:Occupation ; + schema:name "Music Educator" . + +occupation:Musician a schema:Occupation ; + schema:name "Musician" . + +occupation:Opera a schema:Occupation ; + schema:name "Opera" . + +occupation:Opera_Correpetitor a schema:Occupation ; + schema:name "Opera Correpetitor" . + +occupation:Painter a schema:Occupation ; + schema:name "Painter" . + +occupation:Pantomime_Artist a schema:Occupation ; + schema:name "Pantomime Artist" . + +occupation:Performer a schema:Occupation ; + schema:name "Performer" . + +occupation:Photographer a schema:Occupation ; + schema:name "Photographer" . + +occupation:President a schema:Occupation ; + schema:name "President" . + +occupation:Priest a schema:Occupation ; + schema:name "Priest" . + +occupation:Producer a schema:Occupation ; + schema:name "Producer" . + +occupation:Rabbi a schema:Occupation ; + schema:name "Rabbi" . + +occupation:Rancher a schema:Occupation ; + schema:name "Rancher" . + +occupation:Reciter a schema:Occupation ; + schema:name "Reciter" . + +occupation:Seamstress a schema:Occupation ; + schema:name "Seamstress" . + +occupation:Singer a schema:Occupation ; + schema:name "Singer" . + +occupation:Stage_Designer a schema:Occupation ; + schema:name "Stage Designer" . + +occupation:Stage_manager a schema:Occupation ; + schema:name "Stage manager" . + +occupation:Teacher a schema:Occupation ; + schema:name "Teacher" . + +occupation:Technician a schema:Occupation ; + schema:name "Technician" . + +occupation:Trader a schema:Occupation ; + schema:name "Trader" . + +occupation:Translator a schema:Occupation ; + schema:name "Translator" . + diff --git a/data/religions_wikidata.ttl b/data/religions_wikidata.ttl new file mode 100644 index 0000000..2df0dcf --- /dev/null +++ b/data/religions_wikidata.ttl @@ -0,0 +1,12 @@ +@prefix rdfs: . +@prefix religion: . +@prefix schema: . +@prefix wd: . +@prefix wdt: . + + +religion:Buddhism schema:sameAs wd:Q748 . +religion:Christianity schema:sameAs wd:Q5043 . +religion:Hinduism schema:sameAs wd:Q9089 . +religion:Judaism schema:sameAs wd:Q9268 . +religion:Islam schema:sameAs wd:Q432 . diff --git a/data/001-found_countries_many.ttl b/data/religions_wikidata_review.ttl similarity index 61% rename from data/001-found_countries_many.ttl rename to data/religions_wikidata_review.ttl index aad3895..b8e8b39 100644 --- a/data/001-found_countries_many.ttl +++ b/data/religions_wikidata_review.ttl @@ -1,7 +1,7 @@ +@prefix rdfs: . +@prefix religion: . +@prefix schema: . @prefix wd: . @prefix wdt: . -@prefix rdfs: . -@prefix tm: . -@prefix schema: . -@prefix country: . + diff --git a/src/link_religions_to_wikidata.rb b/src/link_religions_to_wikidata.rb new file mode 100755 index 0000000..a112d3b --- /dev/null +++ b/src/link_religions_to_wikidata.rb @@ -0,0 +1,52 @@ +#!/usr/bin/env ruby + +require 'rdf' +require 'rdf/turtle' +require_relative 'database' +require_relative 'vocabularies' +require_relative 'migrants' + +graph = RDF::Graph.load(File.join('data', 'religions.ttl')) + +output = File.open(File.join('data', 'religions_wikidata.ttl'), 'w') +review = File.open(File.join('data', 'religions_wikidata_review.ttl'), 'w') + +ttl_prefixes = "#{prefixes(:wd, :wdt, :rdfs, :schema, :religion)}\n\n" + +output << ttl_prefixes +review << ttl_prefixes + +graph.query([nil, RDF.type, TM.Religion]) do |stmt| + subject = stmt.subject + label_stmt = graph.query([subject, RDFS.label, nil]).first + next unless label_stmt + + label = label_stmt.object + local_name = subject.to_s.sub(RELIGION.to_s, '') + + solutions = WIKIDATA.query(<<~SPARQL) + SELECT DISTINCT ?religion WHERE { + ?religion rdfs:label #{label.to_ntriples} . + ?religion wdt:P31/wdt:P279* wd:Q9174 . + } + SPARQL + case solutions.size + when 0 + review.puts "# No Wikidata entity found for #{label}" + review.puts "religion:#{local_name} rdfs:comment \"No Wikidata entity found\" ." + review.puts + when 1 + wd_id = get_wd_name(solutions.first[:religion].to_s) + output.puts "religion:#{local_name} schema:sameAs #{wd_id} ." + else + review.puts "# Multiple Wikidata entities found for #{label} — remove all but one:" + solutions.each do |solution| + wd_id = get_wd_name(solution[:religion].to_s) + review.puts "religion:#{local_name} schema:sameAs #{wd_id} ." + end + review.puts + end +end + +output.close +review.close diff --git a/src/map_migration_table.rb b/src/map_migration_table.rb new file mode 100755 index 0000000..283ea14 --- /dev/null +++ b/src/map_migration_table.rb @@ -0,0 +1,35 @@ +#!/usr/bin/env ruby + +require_relative 'database' +require_relative 'vocabularies' +require_relative 'migrants' + +output = File.open(File.join('data', 'migrations.ttl'), 'w') + +output.puts prefixes(:rdfs, :tm, :person, :location, :migration) +output.puts + +DB[:migration_table].each do |row| + id = row[:IDMig] + props = ["a tm:Migration"] + + props << "tm:person person:#{row[:IDPerson]}" unless row[:IDPerson].to_s.empty? + props << "tm:startPlace location:#{row[:IDStartPlace]}" unless row[:IDStartPlace].to_s.empty? + props << "tm:destPlace location:#{row[:IDDestPlace]}" unless row[:IDDestPlace].to_s.empty? + props << "tm:dateStartFuzzy #{ttl_literal(row[:DateStart_Fuzzy])}" unless row[:DateStart_Fuzzy].to_s.empty? + props << "tm:dateStartMin #{ttl_literal(row[:DateStart_Min])}" if row[:DateStart_Min] + props << "tm:dateStartMax #{ttl_literal(row[:DateStart_Max])}" if row[:DateStart_Max] + props << "tm:dateEndFuzzy #{ttl_literal(row[:DateEnd_Fuzzy])}" unless row[:DateEnd_Fuzzy].to_s.empty? + props << "tm:dateEndMin #{ttl_literal(row[:DateEnd_Min])}" if row[:DateEnd_Min] + props << "tm:dateEndMax #{ttl_literal(row[:DateEnd_Max])}" if row[:DateEnd_Max] + props << "tm:reason #{ttl_literal(row[:reason])}" unless row[:reason].to_s.empty? + props << "tm:reason2 #{ttl_literal(row[:reason2])}" unless row[:reason2].to_s.empty? + props << "tm:via #{ttl_literal(row[:via])}" unless row[:via].to_s.empty? + + output.puts "migration:#{id} #{props.first} ;" + props[1..-2].each { |p| output.puts " #{p} ;" } + output.puts " #{props.last} ." + output.puts +end + +output.close diff --git a/src/map_occupations_from_person_profession.rb b/src/map_occupations_from_person_profession.rb new file mode 100755 index 0000000..8a0d3fc --- /dev/null +++ b/src/map_occupations_from_person_profession.rb @@ -0,0 +1,25 @@ +#!/usr/bin/env ruby + +require 'set' +require_relative 'database' +require_relative 'vocabularies' +require_relative 'migrants' + +output = File.open(File.join('data', 'occupations.ttl'), 'w') + +output.puts prefixes(:schema, :occupation) +output.puts + +seen = Set.new + +DB[:person_profession].distinct.select(:profession).where(Sequel.~(profession: nil)).where(Sequel.~(profession: 'Other')).order(:profession).each do |row| + name = row[:profession].strip + next if name.empty? + next unless seen.add?(name.downcase) + + output.puts "occupation:#{toName(name)} a schema:Occupation ;" + output.puts " schema:name #{ttl_literal(name)} ." + output.puts +end + +output.close diff --git a/src/map_organisation.rb b/src/map_organisation.rb new file mode 100755 index 0000000..9493c5d --- /dev/null +++ b/src/map_organisation.rb @@ -0,0 +1,27 @@ +#!/usr/bin/env ruby + +require_relative 'database' +require_relative 'vocabularies' +require_relative 'migrants' + +output = File.open(File.join('data', 'organisations.ttl'), 'w') + +output.puts prefixes(:rdfs, :tm, :schema, :location, :organisation) +output.puts + +DB[:organisation].each do |row| + id = row[:IDOrganisation] + props = ["a schema:Organization"] + + props << "schema:name #{ttl_literal(row[:inst_name])}" unless row[:inst_name].to_s.empty? + props << "tm:institutionType #{ttl_literal(row[:InstType])}" unless row[:InstType].to_s.empty? + props << "schema:location location:#{row[:IDLocation]}" unless row[:IDLocation].to_s.empty? + props << "rdfs:comment #{ttl_literal(row[:comment])}" unless row[:comment].to_s.empty? + + output.puts "organisation:#{id} #{props.first} ;" + props[1..-2].each { |p| output.puts " #{p} ;" } + output.puts " #{props.last} ." + output.puts +end + +output.close diff --git a/src/map_person_profession.rb b/src/map_person_profession.rb new file mode 100755 index 0000000..b75773e --- /dev/null +++ b/src/map_person_profession.rb @@ -0,0 +1,27 @@ +#!/usr/bin/env ruby + +require_relative 'database' +require_relative 'vocabularies' +require_relative 'migrants' + +output = File.open(File.join('data', 'persons_occupations.ttl'), 'w') + +output.puts prefixes(:rdfs, :tm, :schema, :person, :profession, :occupation) +output.puts + +DB[:person_profession].each do |row| + puts "mapping persons occupations #{row[:IDProfPerson]}" + id = row[:IDProfPerson] + props = ["a tm:PersonOccupation"] + + props << "tm:person person:#{row[:IDPerson]}" unless row[:IDPerson].to_s.empty? + props << "schema:occupation occupation:#{toName(row[:profession])}" unless row[:profession].to_s.empty? + props << "tm:standardProfession #{ttl_literal(row[:Eprofession])}" unless row[:Eprofession].to_s.empty? + + output.puts "personOccupation:#{id} #{props.first} ;" + props[1..-2].each { |p| output.puts " #{p} ;" } + output.puts " #{props.last} ." + output.puts +end + +output.close diff --git a/src/map_personnames.rb b/src/map_personnames.rb new file mode 100755 index 0000000..23a14c4 --- /dev/null +++ b/src/map_personnames.rb @@ -0,0 +1,34 @@ +#!/usr/bin/env ruby + +require_relative 'database' +require_relative 'vocabularies' +require_relative 'migrants' + +output = File.open(File.join('data', 'personnames.ttl'), 'w') + +output.puts prefixes(:rdfs, :tm, :schema, :person, :personname) +output.puts + +DB[:personnames].each do |row| + id = row[:IDPersonname] + props = ["a tm:PersonName"] + + props << "tm:person person:#{row[:IDPerson]}" unless row[:IDPerson].to_s.empty? + props << "schema:givenName #{ttl_literal(row[:personName])}" unless row[:personName].to_s.empty? + props << "schema:familyName #{ttl_literal(row[:personSurName])}" unless row[:personSurName].to_s.empty? + props << "tm:nameType #{ttl_literal(row[:Nametype])}" unless row[:Nametype].to_s.empty? + props << "tm:dateStartFuzzy #{ttl_literal(row[:DateStart_Fuzzy])}" unless row[:DateStart_Fuzzy].to_s.empty? + props << "tm:dateStartMin #{ttl_literal(row[:DateStart_Min])}" if row[:DateStart_Min] + props << "tm:dateStartMax #{ttl_literal(row[:DateStart_Max])}" if row[:DateStart_Max] + props << "tm:dateEndFuzzy #{ttl_literal(row[:DateEnd_Fuzzy])}" unless row[:DateEnd_Fuzzy].to_s.empty? + props << "tm:dateEndMin #{ttl_literal(row[:DateEnd_Min])}" if row[:DateEnd_Min] + props << "tm:dateEndMax #{ttl_literal(row[:DateEnd_Max])}" if row[:DateEnd_Max] + props << "rdfs:comment #{ttl_literal(row[:comment])}" unless row[:comment].to_s.empty? + + output.puts "personname:#{id} #{props.first} ;" + props[1..-2].each { |p| output.puts " #{p} ;" } + output.puts " #{props.last} ." + output.puts +end + +output.close diff --git a/src/map_persons.rb b/src/map_persons.rb old mode 100644 new mode 100755 diff --git a/src/map_relationship.rb b/src/map_relationship.rb new file mode 100755 index 0000000..78b941b --- /dev/null +++ b/src/map_relationship.rb @@ -0,0 +1,37 @@ +#!/usr/bin/env ruby + +require_relative 'database' +require_relative 'vocabularies' +require_relative 'migrants' + +output = File.open(File.join('data', 'relationships.ttl'), 'w') + +output.puts prefixes(:rdfs, :tm, :person, :location, :organisation, :relationship) +output.puts + +DB[:relationship].each do |row| + id = row[:IDRel] + props = ["a tm:Relationship"] + + props << "tm:activePerson person:#{row[:IDPerson_active]}" unless row[:IDPerson_active].to_s.empty? + props << "tm:passivePerson person:#{row[:IDPerson_passive]}" unless row[:IDPerson_passive].to_s.empty? + props << "tm:relationshipType #{ttl_literal(row[:Relationshiptype])}" unless row[:Relationshiptype].to_s.empty? + props << "tm:relationshipTypePrecise #{ttl_literal(row[:relationshiptype_precise])}" unless row[:relationshiptype_precise].to_s.empty? + props << "tm:dateStartFuzzy #{ttl_literal(row[:DateStart_Fuzzy])}" unless row[:DateStart_Fuzzy].to_s.empty? + props << "tm:dateStartMin #{ttl_literal(row[:DateStart_Min])}" if row[:DateStart_Min] + props << "tm:dateStartMax #{ttl_literal(row[:DateStart_Max])}" if row[:DateStart_Max] + props << "tm:dateEndFuzzy #{ttl_literal(row[:DateEnd_Fuzzy])}" unless row[:DateEnd_Fuzzy].to_s.empty? + props << "tm:dateEndMin #{ttl_literal(row[:DateEnd_Min])}" if row[:DateEnd_Min] + props << "tm:dateEndMax #{ttl_literal(row[:DateEnd_Max])}" if row[:DateEnd_Max] + props << "tm:location location:#{row[:IDLocation]}" unless row[:IDLocation].to_s.empty? + props << "tm:organisation organisation:#{row[:IDOrganisation]}" unless row[:IDOrganisation].to_s.empty? + props << "tm:timePeriod #{ttl_literal(row[:Timeperiod])}" unless row[:Timeperiod].to_s.empty? + props << "rdfs:comment #{ttl_literal(row[:comment])}" unless row[:comment].to_s.empty? + + output.puts "relationship:#{id} #{props.first} ;" + props[1..-2].each { |p| output.puts " #{p} ;" } + output.puts " #{props.last} ." + output.puts +end + +output.close diff --git a/src/map_work.rb b/src/map_work.rb new file mode 100755 index 0000000..4bb806f --- /dev/null +++ b/src/map_work.rb @@ -0,0 +1,39 @@ +#!/usr/bin/env ruby + +require_relative 'database' +require_relative 'vocabularies' +require_relative 'migrants' + +output = File.open(File.join('data', 'works.ttl'), 'w') + +output.puts prefixes(:rdfs, :tm, :person, :location, :organisation, :work) +output.puts + +DB[:work].each do |row| + id = row[:IDWork] + props = ["a tm:WorkRecord"] + + props << "tm:person person:#{row[:IDPerson]}" unless row[:IDPerson].to_s.empty? + props << "tm:location location:#{row[:IDLocation]}" unless row[:IDLocation].to_s.empty? + props << "tm:organisation organisation:#{row[:IDOrganisation]}" unless row[:IDOrganisation].to_s.empty? + props << "tm:organisation organisation:#{row[:IDOrganisation2]}" unless row[:IDOrganisation2].to_s.empty? + props << "tm:dateStartFuzzy #{ttl_literal(row[:DateStart_Fuzzy])}" unless row[:DateStart_Fuzzy].to_s.empty? + props << "tm:dateStartMin #{ttl_literal(row[:DateStart_Min])}" if row[:DateStart_Min] + props << "tm:dateStartMax #{ttl_literal(row[:DateStart_Max])}" if row[:DateStart_Max] + props << "tm:dateEndFuzzy #{ttl_literal(row[:DateEnd_Fuzzy])}" unless row[:DateEnd_Fuzzy].to_s.empty? + props << "tm:dateEndMin #{ttl_literal(row[:DateEnd_Min])}" if row[:DateEnd_Min] + props << "tm:dateEndMax #{ttl_literal(row[:DateEnd_Max])}" if row[:DateEnd_Max] + props << "tm:employment #{ttl_literal(row[:Employment])}" unless row[:Employment].to_s.empty? + props << "tm:profession #{ttl_literal(row[:Profession])}" unless row[:Profession].to_s.empty? + props << "tm:profession2 #{ttl_literal(row[:Profession2])}" unless row[:Profession2].to_s.empty? + props << "tm:profession3 #{ttl_literal(row[:Profession3])}" unless row[:Profession3].to_s.empty? + props << "tm:employmentType #{ttl_literal(row[:EmploymentType])}" unless row[:EmploymentType].to_s.empty? + props << "rdfs:comment #{ttl_literal(row[:comment])}" unless row[:comment].to_s.empty? + + output.puts "work:#{id} #{props.first} ;" + props[1..-2].each { |p| output.puts " #{p} ;" } + output.puts " #{props.last} ." + output.puts +end + +output.close diff --git a/src/vocabularies.rb b/src/vocabularies.rb index d1c3e58..40e0d3a 100644 --- a/src/vocabularies.rb +++ b/src/vocabularies.rb @@ -10,11 +10,18 @@ XSD = RDF::Vocabulary.new('http://www.w3.org/2001/XMLSchema#') # Internal vocabularies COUNTRY = RDF::Vocabulary.new('https://daniel.degu.cl/data/theater-migrants/countries.ttl#Country-') -TM = RDF::Vocabulary.new('https://daniel.degu.cl/data/theater-migrants/mig.ttl#') +TM = RDF::Vocabulary.new('https://daniel.degu.cl/data/theather-migrants/ontology.ttl#') PERSON = RDF::Vocabulary.new('https://daniel.degu.cl/data/theater-migrants/persons.ttl#') LOCATION = RDF::Vocabulary.new('https://daniel.degu.cl/data/theater-migrants/locations.ttl#') +OCCUPATION = RDF::Vocabulary.new('https://daniel.degu.cl/data/theater-migrants/occupations.ttl#') +MIGRATION = RDF::Vocabulary.new('https://daniel.degu.cl/data/theater-migrants/migrations.ttl#') +ORGANISATION = RDF::Vocabulary.new('https://daniel.degu.cl/data/theater-migrants/organisations.ttl#') +PERSONNAME = RDF::Vocabulary.new('https://daniel.degu.cl/data/theater-migrants/personnames.ttl#') +PERSON_OCCUPATION = RDF::Vocabulary.new('https://daniel.degu.cl/data/theater-migrants/person_occupations.ttl#') REGION = RDF::Vocabulary.new('https://daniel.degu.cl/data/theater-migrants/regions.ttl#') +RELATIONSHIP = RDF::Vocabulary.new('https://daniel.degu.cl/data/theater-migrants/relationships.ttl#') RELIGION = RDF::Vocabulary.new('https://daniel.degu.cl/data/theater-migrants/religions.ttl#') +WORK = RDF::Vocabulary.new('https://daniel.degu.cl/data/theater-migrants/works.ttl#') # Mapping from symbols to prefixes PREFIXES = { @@ -26,9 +33,16 @@ PREFIXES = { tm: TM, person: PERSON, location: LOCATION, + migration: MIGRATION, + occupation: OCCUPATION, + organisation: ORGANISATION, + personname: PERSONNAME, + personOccupation: PROFESSION, region: REGION, + relationship: RELATIONSHIP, religion: RELIGION, skos: SKOS, + work: WORK, xsd: XSD }