Translations:Project:SPARQL/examples/77/en

From Resistance in Belgium
  1. Federated query to retrieve additional information from Wikidata
 SERVICE <https://query.wikidata.org/sparql> {
   
   # Retrieves and generates the URLs of external identifiers
   OPTIONAL { 
     ?wikidata_ID wdt_wikidata:P2372 ?odisID.  # Retrieves the ODIS ID
     BIND(URI(CONCAT("https://www.odis.be/lnk/", STR(?odisID))) AS ?odisURL)  # Generates the ODIS URL
   }
   OPTIONAL { 
     ?wikidata_ID wdt_wikidata:P6234 ?bioNationaleID.  # Biographie Nationale of Belgium ID
     BIND(URI(CONCAT("https://academieroyale.be/fr/la-biographie-nationale-personnalites-detail/personnalites/", STR(?bioNationaleID), "/Vrai/")) AS ?bioNationaleURL)  # Generates the Biographie Nationale URL
   }
   OPTIONAL { 
     ?wikidata_ID wdt_wikidata:P214 ?viafID.  # VIAF ID
     BIND(URI(CONCAT("https://viaf.org/viaf/", STR(?viafID))) AS ?viafURL)  # Generates the VIAF URL
   }
   OPTIONAL { 
     ?wikidata_ID wdt_wikidata:P3430 ?snacID.  # SNAC ID
     BIND(URI(CONCAT("https://snaccooperative.org/ark:/99166/", STR(?snacID))) AS ?snacURL)  # Generates the SNAC URL
   }
   OPTIONAL { 
     ?wikidata_ID wdt_wikidata:P4724 ?maitronID.  # Maitron ID
     BIND(URI(CONCAT("https://maitron.fr/spip.php?article", STR(?maitronID))) AS ?maitronURL)  # Generates the Maitron URL
   }
   OPTIONAL { 
     ?wikidata_ID wdt_wikidata:P1979 ?JusteID.  # Righteous Among the Nations ID
     BIND(URI(CONCAT("https://collections.yadvashem.org/en/righteous/", STR(?JusteID))) AS ?JusteURL)  # Generates the Righteous Among the Nations URL
   }
   
   # Retrieves the English Wikipedia article
   OPTIONAL {
     ?article_en schema:about ?wikidata_ID ;
                 schema:inLanguage "en" ;
                 schema:isPartOf <https://en.wikipedia.org/> .  # English Wikipedia article
   }
   
   # Retrieves archives linked to the person
   OPTIONAL {
     ?wikidata_ID wdt_wikidata:P485 ?archives.  # Retrieves archives (P485)
     ?archives rdfs:label ?archivesLabel.  # Retrieves archive labels
     FILTER(LANG(?archivesLabel) = "en")  # Filters for labels in English
   }
 }