# 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 }
}
