Project:SPARQL/exemples

From Resistance in Belgium
Revision as of 18:51, 15 October 2024 by Adminagr (talk | contribs) (Created page with "# Cette requête récupère la liste des personnes présentes dans la base de données # et domiciliées dans une certaine commune pendant/au lendemain de la Seconde Guerre mondiale")


Exemples de requêtes SPARQL

Cette page liste des exemples de requêtes SPARQL permettant d'interroger en profondeur les données de Resistance in Belgium voir aussi cette page d'exemples. Chaque requête peut être lancée en cliquant sur le lien "Essayez !" qui ouvre une interface de requête dédiée.

Note: Due to limited resources, the queries have been automatically translated into English, Dutch, and German. While there may be minor inaccuracies, we prioritised making these examples available in multiple languages to ensure broad access to the data for all users.


Recherche par nom de famille

{{SPARQL|query=

  1. This query has been automatically translated for pragmatic reasons and due to limited resources. Please be aware that some terms may not be fully accurate.
  1. Cette requête récupère la liste des personnes présentes dans la base de données et portant un certain nom de famille.
  1. title: Résistant⸱e⸱s ayant un certain nom de famille (ici : Barbieux)

SELECT ?personne ?personneLabel ?dateNaissance WHERE {

 ?personne  wdt:P1  wd:Q2 .                  # Sélectionne tous les éléments qui sont (P1) des personnes (Q2)
 ?personne  wdt:P3  "Barbieux" .             # Filtre pour ne prendre que des personnes dont le nom de famille (P3) est "Barbieux" (modifiez "Barbieux" selon le besoin)
 ?personne  wdt:P67 ?dateNaissance  .        # Ajoute la date de naissance (P67)
          
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,[AUTO_LANGUAGE]". }  # Récupère le libellé en français

}

ORDER BY ?personneLabel # Trie les résultats par ordre alphabétique des labels


Rechercher les membres d'une organisation de résistance

{{SPARQL|query=

  1. This query has been automatically translated for pragmatic reasons and due to limited resources. Please be aware that some terms may not be fully accurate.
  1. Cette requête récupère la liste des personnes présentes dans la base de données
  2. et dont on sait qu'elles appartenaient à une certaine organisation de résistance (ici : Tempo)
  1. title: Résistant⸱e⸱s membres d'une organisation de résistance (ici : Tempo)

SELECT ?personne ?nom ?prenom ?dateNaissance WHERE {

 ?personne  wdt:P1  wd:Q2 .                  # Sélectionne tous les éléments qui sont (P1) des personnes (Q2)
 ?personne wdt:P52 wd:Q4367 .                # Filtre par appartenance à une organisation ("membre de", P52), ici "Tempo" (Q4367) (remplacez Q4367 par l'organisation de votre choix en utilisant l'auto-complétion (Control + espace))
 ?personne  wdt:P67 ?dateNaissance  .        # Ajoute la date de naissance (P67)
 ?personne  wdt:P3 ?nom .                    # Récupère le nom de famille (P3)
 ?personne  wdt:P2 ?prenom .                 # Récupère le prénom (P2)
         
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,[AUTO_LANGUAGE]". }  # Récupère le libellé en français

}

ORDER BY LCASE(?nom) LCASE(?prenom) # Trie les résultats par nom de famille, puis par prénom (en ignorant la casse)

Recherche par domicile

<div lang="en" dir="ltr" class="mw-content-ltr">
# This query has been automatically translated for pragmatic reasons and due to limited resources. Please be aware that some terms may not be fully accurate.
</div>

# Cette requête récupère la liste des personnes présentes dans la base de données 
# et domiciliées dans une certaine commune pendant/au lendemain de la Seconde Guerre mondiale

#title: Résistant⸱e⸱s filtrés selon leur domicile (ici : Anderlecht)

SELECT ?personne ?nom ?prenom ?dateNaissance
WHERE {
  ?personne  wdt:P1  wd:Q2 .                  # Sélectionne tous les éléments qui sont (P1) des personnes (Q2)
  ?personne  wdt:P7  wd:Q102 .                # Filtre par domicile (P7), ici Anderlecht (Q102) (remplacez Q102 par la (section de) commune de votre choix en utilisant l'auto-complétion (Control + espace))
  ?personne  wdt:P67 ?dateNaissance  .        # Ajoute la date de naissance (P67)
  ?personne  wdt:P3 ?nom .                    # Récupère le nom de famille (P3)
  ?personne  wdt:P2 ?prenom .                 # Récupère le prénom (P2)
         
 SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,[AUTO_LANGUAGE]". }  # Récupère le libellé en français
}

ORDER BY LCASE(?nom) LCASE(?prenom)  # Trie les résultats par nom de famille, puis par prénom (en ignorant la casse)

Essayez !

Recherche par profession

<div lang="en" dir="ltr" class="mw-content-ltr">
# This query has been automatically translated for pragmatic reasons and due to limited resources. Please be aware that some terms may not be fully accurate.
</div>

# Cette requête récupère la liste des personnes présentes dans la base de données ayant une certaine profession (ici : coiffeur / kapper).

#title: Résistant⸱e⸱s ayant une certaine profession (ici : coiffeur / kapper)

SELECT ?personne ?nom ?prenom ?domicileLabel ?professionLabel
WHERE {
  ?personne  wdt:P1  wd:Q2 .               # Sélectionne toutes les personnes (P1) avec l'identifiant "Personne" (Q2)
  ?personne  wdt:P13 ?profession .         # Sélectionne leur profession (P13)
  ?personne  wdt:P3 ?nom .                    # Récupère le nom de famille (P3)
  ?personne  wdt:P2 ?prenom .                 # Récupère le prénom (P2)
  
  FILTER (CONTAINS(str(?profession), 'coiffeu')

Essayez !


Number of members of a resistance organisation

# This query has been automatically translated for pragmatic reasons and due to limited resources. Please be aware that some terms may not be fully accurate.
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
# This query retrieves the number of members per resistance organisation and displays the results as a bubble chart.
# You can click on each bubble or organisation name to access more details about the organisation in the database.
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
#title: Count of members per resistance organisation
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
#defaultView:BubbleChart  # Display as bubbles
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
SELECT ?organisation ?organisationLabel (COUNT(?person) AS ?numberOfMembers)
WHERE {
  ?person wdt:P1 wd:Q2 .              # Selects all elements that are (P1) persons (Q2)
  ?person wdt:P52 ?organisation .     # Filters by membership in an organisation ("member of", P52)
</div>

  <div lang="en" dir="ltr" class="mw-content-ltr">
FILTER EXISTS { 
   ?organisation wdt:P1/wdt:P9* wd:Q4  # Checks if the organisation is (P1) / is a subclass (P9) of a resistance organisation (Q4)
   }
   # To filter and display only resistance networks/missions, replace Q4 with Q38.
   # To filter and display only armed resistance movements, replace Q4 with Q37.
</div>

  
  <div lang="en" dir="ltr" class="mw-content-ltr">
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }  # Retrieves the labels in English
}
GROUP BY ?organisation ?organisationLabel
ORDER BY DESC(?numberOfMembers)

Essayez !

Places of death during the war

</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
# This query has been automatically translated for pragmatic reasons and due to limited resources. Please be aware that some terms may not be fully accurate.
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
# This query retrieves the places of death of resistance fighters up until the end of 1945 
# and displays them on a map with their names and, if available, the dates of death.
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
# Tip: You can click on the points on the map to view the names of the deceased individuals.
# Note: Foreign locations have been "modernised" to match the current data in the Geonames database.
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
#title: Places and dates of death during the war
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
#defaultView:Map{"hide":"?GPS"}  # Display as a map, hide the GPS coordinates
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
SELECT ?person ?personLabel ?placeOfDeath ?placeOfDeathLabel ?GPS ?dateOfDeath
WHERE {
  ?person wdt:P1 wd:Q2 .                      # Selects all people (P1 = Q2)
  ?person wdt:P48 ?placeOfDeath .             # Retrieves the places of death (P48)
  ?placeOfDeath wdt:P6 ?GPS .                 # Retrieves the GPS coordinates of the places of death (P6)
  OPTIONAL { ?person wdt:P68 ?dateOfDeath .   # Retrieves the date of death, if available
             FILTER(?dateOfDeath <= "1945-12-31"^^xsd:dateTime)  # Filters deaths: up until the end of 1945
  }
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,[AUTO_LANGUAGE]". }  # Retrieves the labels in English
}
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
ORDER BY ?placeOfDeathLabel

Essayez !


List the women who have been detained

# This query has been automatically translated for pragmatic reasons and due to limited resources. Please be aware that some terms may not be fully accurate.
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
#title: Women resistance fighters who were detained
SELECT DISTINCT ?person ?surname ?firstName ?startOfDetention ?endOfDetention ?professionLabel ?recognitionStatusLabel
WHERE {
</div>

  <div lang="en" dir="ltr" class="mw-content-ltr">
?person wdt:P1 wd:Q2 .                   # Selects persons (P1 = Q2)
  ?person wdt:P4 wd:Q6 .                   # Filters to select women (P4 = female Q6)
  
  ?person p:P53 ?detention_statement .     # Searches for persons who were detained (P53)
  ?detention_statement ps:P53 ?detention .
           
  OPTIONAL { ?detention_statement pq:P23 ?startOfDetention. FILTER (datatype(?startOfDetention) = xsd:edtf ) } # Retrieves the start of detention date if available (P23)
  OPTIONAL { ?detention_statement pq:P25 ?endOfDetention. FILTER (datatype(?endOfDetention) = xsd:edtf ) }     # Retrieves the end of detention date if available (P25)
</div>

  <div lang="en" dir="ltr" class="mw-content-ltr">
OPTIONAL { ?person wdt:P13 ?profession. }           # Retrieves the profession if available (P13)
  OPTIONAL { ?person wdt:P55 ?recognitionStatus. }    # Retrieves the national recognition status if obtained (P55)
</div>

  <div lang="en" dir="ltr" class="mw-content-ltr">
?person  wdt:P3 ?surname .             # Retrieves the surname (P3)
  ?person  wdt:P2 ?firstName .           # Retrieves the first name (P2)
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }  # Retrieves the labels in English
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
}
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
ORDER BY LCASE(?surname) LCASE(?firstName)  # Sorts case-insensitively

Essayez !


Recognised ARA/FFC Members or Letter of Appreciation Recipients

# This query has been automatically translated for pragmatic reasons and due to limited resources. Please be aware that some terms may not be fully accurate.
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
# This query retrieves the list of resistance fighters recognised as intelligence and action agents (ARA)
# or who received a letter of thanks (LR) or FFC (Forces Françaises Combattantes) status, along with their residence and linked archive file.
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
#title: ARA resistance fighters (recognised or letter of thanks) or FFC
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
SELECT DISTINCT ?person ?surname ?firstName ?residence ?residenceLabel ?recognisedStatusLabel ?LR ?archiveCollectionLabel ?inventoryNo WHERE {
</div>

  <div lang="en" dir="ltr" class="mw-content-ltr">
?person wdt:P1 wd:Q2 .                    # Selects persons (P1 = Q2)
  ?person  wdt:P3 ?surname .                # Retrieves the surname (P3)
  ?person  wdt:P2 ?firstName .              # Retrieves the first name (P2)
</div>

  <div lang="en" dir="ltr" class="mw-content-ltr">
{ ?person wdt:P55 ?recognisedStatus. 
    FILTER(?recognisedStatus IN (wd:Q17, wd:Q4487)) }  # Filters for recognised ARA statuses (Q17) or FFC (Q4487)
  UNION                                            # OR
  { ?person p:P54 ?statement.
    ?statement ps:P54 wd:Q17; pq:P56 wd:Q6665.     # Persons who received a letter of thanks (Q6665)
    BIND("letter of thanks ARA" AS ?LR)}
</div>

  <div lang="en" dir="ltr" class="mw-content-ltr">
OPTIONAL { ?person wdt:P7 ?residence. }         # Retrieves the residence if available (P7)
  OPTIONAL { ?person p:P34 ?archive_statement . 
             ?archive_statement ps:P34 ?archiveCollection ;
                                pq:P35 ?inventoryNo.}  # Reference to the archives
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,[AUTO_LANGUAGE]". }  # Retrieves the labels in English
}
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
ORDER BY LCASE(?surname) LCASE(?firstName)  # Sorts results by surname, then first name (case-insensitive)
LIMIT 100  # Limits the results to 100 to optimise performance. You can adjust or remove this limit as needed.

Essayez !


Enriching data on resistance members using external sources [federated query]

## This query has been automatically translated for pragmatic reasons and due to limited resources. Please be aware that some terms may not be fully accurate.
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
# This query retrieves additional information about the resistance fighters in the database, thanks to Wikidata, including Wikipedia articles and external archives (ODIS, Biographie Nationale, VIAF, SNAC, etc.).
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
#title: Enrichment of resistance fighter data via Wikidata
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
PREFIX wd_wikidata: <http://www.wikidata.org/entity/>  # Prefix for Wikidata
PREFIX wdt_wikidata: <http://www.wikidata.org/prop/direct/>  # Prefix for Wikidata direct properties
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
SELECT DISTINCT ?person ?surname ?firstName ?wikidata_ID ?article_en ?odisURL ?bioNationaleURL ?JusteURL ?maitronURL ?viafURL ?snacURL 
(GROUP_CONCAT(DISTINCT ?archivesLabel; SEPARATOR = ", ") AS ?archives)  # Concatenation of found archives
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
WHERE {
  ?person wdt:P1 wd:Q2 .                  # Selects all persons (P1 = Q2)
  ?person  wdt:P3 ?surname .              # Retrieves the surname (P3)
  ?person  wdt:P2 ?firstName .            # Retrieves the first name (P2)
</div>

  <div lang="en" dir="ltr" class="mw-content-ltr">
?person wdt:P15 ?wikidataIdentifier .   # Retrieves the Wikidata identifier (P15)
</div>

  <div lang="en" dir="ltr" class="mw-content-ltr">
# Generates a link to the corresponding Wikidata entity
  BIND(URI(CONCAT("http://www.wikidata.org/entity/", ?wikidataIdentifier)) AS ?wikidata_ID)
</div>

  <div lang="en" dir="ltr" class="mw-content-ltr">
# 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
    }
  }
</div>

  <div lang="en" dir="ltr" class="mw-content-ltr">
# Retrieves labels of persons in the defined language
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
GROUP BY ?person ?surname ?firstName ?wikidata_ID ?article_en ?odisURL ?JusteURL ?bioNationaleURL ?maitronURL ?viafURL ?snacURL
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
ORDER BY LCASE(?surname) LCASE(?firstName)  # Sorts results by surname, then first name (case-insensitive)

Essayez !