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