Add Step 6 SPARQL CONSTRUCT queries for tm: namespace mapping

11 CONSTRUCT queries transform graph-05 data from migrants: namespace
to the Theatre Migrants ontology (tm:) vocabulary: persons, places,
organisations, migrations, memberships (org:Membership), relationships,
person-professions, person-names, religion affiliations, occupations
(schema:Occupation), and enumeration instances (skos:Concept).
This commit is contained in:
Daniel Hernandez 2026-03-01 12:07:18 +01:00
parent 3d0829aa9d
commit 58a725a3d7
11 changed files with 405 additions and 0 deletions

View file

@ -0,0 +1,77 @@
# Construct person triples with tm: vocabulary.
# Drops internal IDs and redundant old authority-link predicates
# (already covered by owl:sameAs / wdtn:* from Step 5).
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX schema: <https://schema.org/>
PREFIX wdtn: <http://www.wikidata.org/prop/direct-normalized/>
PREFIX tm: <https://daniel.degu.cl/ontologies/theatre-migrants/>
PREFIX personp: <http://example.org/migrants/person#>
CONSTRUCT {
?s a schema:Person .
?s rdfs:label ?label .
?s rdfs:comment ?comment .
?s schema:givenName ?givenName .
?s schema:familyName ?familyName .
?s schema:birthDate ?birthDate .
?s schema:deathDate ?deathDate .
?s schema:gender ?gender .
?s schema:birthPlace ?birthPlace .
?s schema:deathPlace ?deathPlace .
?s schema:image ?image .
?s schema:citation ?citation .
?s schema:hasOccupation ?occupation .
?s schema:sameAs ?sameAs .
?s owl:sameAs ?owlSameAs .
?s wdtn:P214 ?viaf .
?s wdtn:P227 ?gnd .
?s wdtn:P213 ?isni .
?s wdtn:P244 ?lccn .
?s wdtn:P3430 ?snac .
?s wdtn:P1871 ?cerl .
?s tm:importSource ?importSource .
?s tm:nameType ?nameType .
?s tm:birthDateMax ?birthDateMax .
?s tm:deathDateMax ?deathDateMax .
?s tm:fuzzyBirthDate ?fuzzyBirthDate .
?s tm:fuzzyDeathDate ?fuzzyDeathDate .
?s tm:birthInfo ?birthInfo .
?s tm:deathInfo ?deathInfo .
?s tm:religionLabel ?religion .
?s tm:imageSource ?imageSource .
}
WHERE {
?s a schema:Person .
OPTIONAL { ?s rdfs:label ?label }
OPTIONAL { ?s rdfs:comment ?comment }
OPTIONAL { ?s schema:givenName ?givenName }
OPTIONAL { ?s schema:familyName ?familyName }
OPTIONAL { ?s schema:birthDate ?birthDate }
OPTIONAL { ?s schema:deathDate ?deathDate }
OPTIONAL { ?s schema:gender ?gender }
OPTIONAL { ?s schema:birthPlace ?birthPlace }
OPTIONAL { ?s schema:deathPlace ?deathPlace }
OPTIONAL { ?s schema:image ?image }
OPTIONAL { ?s schema:citation ?citation }
OPTIONAL { ?s schema:hasOccupation ?occupation }
OPTIONAL { ?s schema:sameAs ?sameAs }
OPTIONAL { ?s owl:sameAs ?owlSameAs }
OPTIONAL { ?s wdtn:P214 ?viaf }
OPTIONAL { ?s wdtn:P227 ?gnd }
OPTIONAL { ?s wdtn:P213 ?isni }
OPTIONAL { ?s wdtn:P244 ?lccn }
OPTIONAL { ?s wdtn:P3430 ?snac }
OPTIONAL { ?s wdtn:P1871 ?cerl }
OPTIONAL { ?s personp:Importsource ?importSource }
OPTIONAL { ?s personp:Nametype ?nameType }
OPTIONAL { ?s personp:birthdate_max ?birthDateMax }
OPTIONAL { ?s personp:deathdate_max ?deathDateMax }
OPTIONAL { ?s personp:fuzzybirthdate ?fuzzyBirthDate }
OPTIONAL { ?s personp:fuzzydeathdate ?fuzzyDeathDate }
OPTIONAL { ?s personp:Birth_Info ?birthInfo }
OPTIONAL { ?s personp:Death_Info ?deathInfo }
OPTIONAL { ?s personp:religion ?religion }
OPTIONAL { ?s personp:image_source ?imageSource }
}

View file

@ -0,0 +1,33 @@
# Construct place triples with tm: vocabulary.
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX schema: <https://schema.org/>
PREFIX wgs84: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX tm: <https://daniel.degu.cl/ontologies/theatre-migrants/>
PREFIX locationp: <http://example.org/migrants/location#>
CONSTRUCT {
?s a schema:Place .
?s owl:sameAs ?owlSameAs .
?s schema:sameAs ?sameAs .
?s wgs84:lat ?lat .
?s wgs84:long ?long .
?s tm:geoNamesID ?geoNamesID .
?s tm:continent ?continent .
?s tm:country ?country .
?s tm:state ?state .
?s tm:city ?city .
}
WHERE {
?s a schema:Place .
OPTIONAL { ?s owl:sameAs ?owlSameAs }
OPTIONAL { ?s schema:sameAs ?sameAs }
OPTIONAL { ?s wgs84:lat ?lat }
OPTIONAL { ?s wgs84:long ?long }
OPTIONAL { ?s locationp:GeoNamesID ?geoNamesID }
OPTIONAL { ?s locationp:Continent ?continent }
OPTIONAL { ?s locationp:Country ?country }
OPTIONAL { ?s locationp:State ?state }
OPTIONAL { ?s locationp:City ?city }
}

View file

@ -0,0 +1,21 @@
# Construct organisation triples with tm: vocabulary.
PREFIX schema: <https://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX tm: <https://daniel.degu.cl/ontologies/theatre-migrants/>
PREFIX orgp: <http://example.org/migrants/organisation#>
CONSTRUCT {
?s a schema:Organization .
?s schema:name ?name .
?s schema:location ?location .
?s rdfs:comment ?comment .
?s tm:institutionType ?instType .
}
WHERE {
?s a schema:Organization .
OPTIONAL { ?s schema:name ?name }
OPTIONAL { ?s schema:location ?location }
OPTIONAL { ?s rdfs:comment ?comment }
OPTIONAL { ?s orgp:InstType ?instType }
}

View file

@ -0,0 +1,36 @@
# Construct migration triples with tm: vocabulary.
PREFIX tm: <https://daniel.degu.cl/ontologies/theatre-migrants/>
PREFIX migrants: <http://example.org/migrants/>
PREFIX migp: <http://example.org/migrants/migration_table#>
CONSTRUCT {
?s a tm:Migration .
?s tm:migrant ?person .
?s tm:startPlace ?startPlace .
?s tm:destinationPlace ?destPlace .
?s tm:reason ?reason .
?s tm:secondaryReason ?reason2 .
?s tm:dateStartMin ?dsMin .
?s tm:dateStartMax ?dsMax .
?s tm:dateEndMin ?deMin .
?s tm:dateEndMax ?deMax .
?s tm:dateStartFuzzy ?dsFuzzy .
?s tm:dateEndFuzzy ?deFuzzy .
?s tm:via ?via .
}
WHERE {
?s a migrants:migration_table .
OPTIONAL { ?s migp:ref-IDPerson ?person }
OPTIONAL { ?s migp:ref-IDStartPlace ?startPlace }
OPTIONAL { ?s migp:ref-IDDestPlace ?destPlace }
OPTIONAL { ?s migp:reason ?reason }
OPTIONAL { ?s migp:reason2 ?reason2 }
OPTIONAL { ?s migp:DateStart_Min ?dsMin }
OPTIONAL { ?s migp:DateStart_Max ?dsMax }
OPTIONAL { ?s migp:DateEnd_Min ?deMin }
OPTIONAL { ?s migp:DateEnd_Max ?deMax }
OPTIONAL { ?s migp:DateStart_Fuzzy ?dsFuzzy }
OPTIONAL { ?s migp:DateEnd_Fuzzy ?deFuzzy }
OPTIONAL { ?s migp:via ?via }
}

View file

@ -0,0 +1,48 @@
# Construct work engagements as org:Membership with tm: vocabulary.
# Replaces migrants:work with org:Membership, using org:member and
# org:organization from the W3C Organization Ontology.
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX org: <http://www.w3.org/ns/org#>
PREFIX tm: <https://daniel.degu.cl/ontologies/theatre-migrants/>
PREFIX migrants: <http://example.org/migrants/>
PREFIX workp: <http://example.org/migrants/work#>
CONSTRUCT {
?s a org:Membership .
?s org:member ?person .
?s org:organization ?organisation .
?s tm:workLocation ?location .
?s tm:secondaryOrganisation ?org2 .
?s tm:profession ?profession .
?s tm:secondaryProfession ?profession2 .
?s tm:tertiaryProfession ?profession3 .
?s tm:employmentType ?emplType .
?s tm:employment ?employment .
?s rdfs:comment ?comment .
?s tm:dateStartMin ?dsMin .
?s tm:dateStartMax ?dsMax .
?s tm:dateEndMin ?deMin .
?s tm:dateEndMax ?deMax .
?s tm:dateStartFuzzy ?dsFuzzy .
?s tm:dateEndFuzzy ?deFuzzy .
}
WHERE {
?s a migrants:work .
OPTIONAL { ?s workp:ref-IDPerson ?person }
OPTIONAL { ?s workp:ref-IDOrganisation ?organisation }
OPTIONAL { ?s workp:ref-IDLocation ?location }
OPTIONAL { ?s workp:ref-IDOrganisation2 ?org2 }
OPTIONAL { ?s workp:Profession ?profession }
OPTIONAL { ?s workp:Profession2 ?profession2 }
OPTIONAL { ?s workp:Profession3 ?profession3 }
OPTIONAL { ?s workp:EmploymentType ?emplType }
OPTIONAL { ?s workp:Employment ?employment }
OPTIONAL { ?s workp:comment ?comment }
OPTIONAL { ?s workp:DateStart_Min ?dsMin }
OPTIONAL { ?s workp:DateStart_Max ?dsMax }
OPTIONAL { ?s workp:DateEnd_Min ?deMin }
OPTIONAL { ?s workp:DateEnd_Max ?deMax }
OPTIONAL { ?s workp:DateStart_Fuzzy ?dsFuzzy }
OPTIONAL { ?s workp:DateEnd_Fuzzy ?deFuzzy }
}

View file

@ -0,0 +1,41 @@
# Construct relationship triples with tm: vocabulary.
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX tm: <https://daniel.degu.cl/ontologies/theatre-migrants/>
PREFIX migrants: <http://example.org/migrants/>
PREFIX relp: <http://example.org/migrants/relationship#>
CONSTRUCT {
?s a tm:Relationship .
?s tm:activePerson ?active .
?s tm:passivePerson ?passive .
?s tm:relationshipLocation ?location .
?s tm:relationshipOrganisation ?organisation .
?s tm:relationshipType ?relType .
?s tm:relationshipTypePrecise ?relTypePrecise .
?s rdfs:comment ?comment .
?s tm:timePeriod ?timePeriod .
?s tm:dateStartMin ?dsMin .
?s tm:dateStartMax ?dsMax .
?s tm:dateEndMin ?deMin .
?s tm:dateEndMax ?deMax .
?s tm:dateStartFuzzy ?dsFuzzy .
?s tm:dateEndFuzzy ?deFuzzy .
}
WHERE {
?s a migrants:relationship .
OPTIONAL { ?s relp:ref-IDPerson_active ?active }
OPTIONAL { ?s relp:ref-IDPerson_passive ?passive }
OPTIONAL { ?s relp:ref-IDLocation ?location }
OPTIONAL { ?s relp:ref-IDOrganisation ?organisation }
OPTIONAL { ?s relp:Relationshiptype ?relType }
OPTIONAL { ?s relp:relationshiptype_precise ?relTypePrecise }
OPTIONAL { ?s relp:comment ?comment }
OPTIONAL { ?s relp:Timeperiod ?timePeriod }
OPTIONAL { ?s relp:DateStart_Min ?dsMin }
OPTIONAL { ?s relp:DateStart_Max ?dsMax }
OPTIONAL { ?s relp:DateEnd_Min ?deMin }
OPTIONAL { ?s relp:DateEnd_Max ?deMax }
OPTIONAL { ?s relp:DateStart_Fuzzy ?dsFuzzy }
OPTIONAL { ?s relp:DateEnd_Fuzzy ?deFuzzy }
}

View file

@ -0,0 +1,18 @@
# Construct person-profession association triples with tm: vocabulary.
PREFIX tm: <https://daniel.degu.cl/ontologies/theatre-migrants/>
PREFIX migrants: <http://example.org/migrants/>
PREFIX ppp: <http://example.org/migrants/person_profession#>
CONSTRUCT {
?s a tm:PersonProfession .
?s tm:personProfessionPerson ?person .
?s tm:enumeratedProfession ?eprofession .
?s tm:professionLabel ?profLabel .
}
WHERE {
?s a migrants:person_profession .
OPTIONAL { ?s ppp:ref-IDPerson ?person }
OPTIONAL { ?s ppp:Eprofession ?eprofession }
OPTIONAL { ?s ppp:profession ?profLabel }
}

View file

@ -0,0 +1,35 @@
# Construct person-name triples with tm: vocabulary.
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX tm: <https://daniel.degu.cl/ontologies/theatre-migrants/>
PREFIX migrants: <http://example.org/migrants/>
PREFIX pnp: <http://example.org/migrants/personnames#>
CONSTRUCT {
?s a tm:PersonName .
?s tm:personNamePerson ?person .
?s tm:nameType ?nameType .
?s tm:personName ?name .
?s tm:personSurName ?surname .
?s rdfs:comment ?comment .
?s tm:dateStartMin ?dsMin .
?s tm:dateStartMax ?dsMax .
?s tm:dateEndMin ?deMin .
?s tm:dateEndMax ?deMax .
?s tm:dateStartFuzzy ?dsFuzzy .
?s tm:dateEndFuzzy ?deFuzzy .
}
WHERE {
?s a migrants:personnames .
OPTIONAL { ?s pnp:ref-IDPerson ?person }
OPTIONAL { ?s pnp:Nametype ?nameType }
OPTIONAL { ?s pnp:personName ?name }
OPTIONAL { ?s pnp:personSurName ?surname }
OPTIONAL { ?s pnp:comment ?comment }
OPTIONAL { ?s pnp:DateStart_Min ?dsMin }
OPTIONAL { ?s pnp:DateStart_Max ?dsMax }
OPTIONAL { ?s pnp:DateEnd_Min ?deMin }
OPTIONAL { ?s pnp:DateEnd_Max ?deMax }
OPTIONAL { ?s pnp:DateStart_Fuzzy ?dsFuzzy }
OPTIONAL { ?s pnp:DateEnd_Fuzzy ?deFuzzy }
}

View file

@ -0,0 +1,31 @@
# Construct religion affiliation triples with tm: vocabulary.
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX tm: <https://daniel.degu.cl/ontologies/theatre-migrants/>
PREFIX migrants: <http://example.org/migrants/>
PREFIX relgp: <http://example.org/migrants/religions#>
CONSTRUCT {
?s a tm:ReligionAffiliation .
?s tm:religionAffiliationPerson ?person .
?s tm:religion ?religion .
?s tm:denomination ?denomination .
?s rdfs:comment ?comment .
?s tm:dateStartMin ?dsMin .
?s tm:dateStartMax ?dsMax .
?s tm:dateEndMin ?deMin .
?s tm:dateEndMax ?deMax .
?s tm:dateStartFuzzy ?dsFuzzy .
}
WHERE {
?s a migrants:religions .
OPTIONAL { ?s relgp:ref-IDPerson ?person }
OPTIONAL { ?s relgp:religion ?religion }
OPTIONAL { ?s relgp:denomination ?denomination }
OPTIONAL { ?s relgp:comment ?comment }
OPTIONAL { ?s relgp:date_start ?dsMin }
OPTIONAL { ?s relgp:DateStart_Max ?dsMax }
OPTIONAL { ?s relgp:DateEnd_Min ?deMin }
OPTIONAL { ?s relgp:DateEnd_Max ?deMax }
OPTIONAL { ?s relgp:DateStart_Fuzzy ?dsFuzzy }
}

View file

@ -0,0 +1,30 @@
# Construct occupation instances.
# Existing schema:Occupation instances pass through.
# migrants:Profession instances are retyped as schema:Occupation.
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX schema: <https://schema.org/>
PREFIX migrants: <http://example.org/migrants/>
CONSTRUCT {
?s a schema:Occupation .
?s schema:name ?name .
}
WHERE {
?s a schema:Occupation .
OPTIONAL { ?s schema:name ?name }
}
;
CONSTRUCT {
?s a schema:Occupation .
?s a skos:Concept .
?s rdfs:label ?label .
?s skos:prefLabel ?prefLabel .
?s schema:name ?label .
}
WHERE {
?s a migrants:Profession .
OPTIONAL { ?s rdfs:label ?label }
OPTIONAL { ?s skos:prefLabel ?prefLabel }
}

View file

@ -0,0 +1,35 @@
# Construct enumeration instances with tm: types.
# Replaces migrants: enum types with tm: equivalents.
# Excludes migrants:Profession (handled in 010-occupations.rq)
# and migrants:Gender (already covered by schema:GenderType).
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX tm: <https://daniel.degu.cl/ontologies/theatre-migrants/>
PREFIX migrants: <http://example.org/migrants/>
CONSTRUCT {
?s a skos:Concept .
?s a ?tmType .
?s rdfs:label ?label .
?s skos:prefLabel ?prefLabel .
}
WHERE {
VALUES (?oldType ?tmType) {
( migrants:Continent tm:Continent )
( migrants:Country tm:Country )
( migrants:State tm:State )
( migrants:City tm:City )
( migrants:MigrationReason tm:MigrationReason )
( migrants:InstitutionType tm:InstitutionType )
( migrants:Nametype tm:NameType )
( migrants:RelationshipType tm:RelationshipType )
( migrants:RelationshipTypePrecise tm:RelationshipTypePrecise )
( migrants:Religion tm:Religion )
( migrants:EmploymentType tm:EmploymentType )
( migrants:ImportSource tm:ImportSource )
}
?s a ?oldType .
OPTIONAL { ?s rdfs:label ?label }
OPTIONAL { ?s skos:prefLabel ?prefLabel }
}