User:Culex/SPARQL
Jump to navigation
Jump to search
To check :
- Wikidata:SPARQL tutorial
- Wikidata:SPARQL query service/queries/examples
- User:Ash Crow/SPARQL
- User:SpinachBot
Frise chronologique des maires de Perpignan
[edit]The following query uses these:
- Properties: position held (P39) , start time (P580) , end time (P582)
#defaultView:Timeline select ?mayor ?mayorLabel ?start ?end where { ?mayor p:P39 ?position. ?position ps:P39 wd:Q62084660; pq:P580 ?start; pq:P582 ?end. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr,en". }
Bibliothèques en France
[edit]The following query uses these:
- Items: library (Q7075) , France (Q142)
- Properties: instance of (P31) , subclass of (P279) , country (P17) , coordinate location (P625) , headquarters location (P159)
Features: map (Q24515275)
#defaultView:Map
SELECT ?bibliothèque ?bibliothèqueLabel ?coord ?coordonnées WHERE {
?bibliothèque (wdt:P31/(wdt:P279*)) wd:Q7075.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
?bibliothèque wdt:P17 wd:Q142.
OPTIONAL { ?bibliothèque wdt:P625 ?coord. }
OPTIONAL {
?bibliothèque p:P159 ?position_du_siège.
?position_du_siège wdt:P625 ?coordonnées.
}
}
Hôpitaux du monde
[edit]The following query uses these:
- Items: hospital (Q16917)
- Properties: instance of (P31) , subclass of (P279) , coordinate location (P625)
Features: map (Q24515275)
#Map of hospitals
#added 2017-08
#defaultView:Map
SELECT * WHERE {
?item wdt:P31/wdt:P279* wd:Q16917;
wdt:P625 ?geo .
}
Noms de Céret dans plusieurs écritures/langues (trié par occurrence)
[edit](à trier sur wordclouds.com)
The following query uses these:
- Items: Céret (Q6643)
#title: Noms de Céret dans plusieurs écritures/langues (trié par occurrence) / Names of Céret in multiple scripts/languages (order by weight) SELECT ?word (COUNT(?label) AS ?weight) WHERE { wd:Q6643 rdfs:label ?label . BIND ( STR(?label) AS ?word ) } GROUP BY ?word ORDER BY DESC(?weight)
Lieux de tournages de films tournés dans le Pyrénées-Orientales
[edit]The following query uses these:
- Items: Pyrénées-Orientales (Q12709)
- Properties: filming location (P915) , located in the administrative territorial entity (P131) , coordinate location (P625)
Features: map (Q24515275)
#title: Lieux de tournages de films tournés dans les Pyrénées-Orientales
#defaultView:Map
SELECT ?film ?filmLabel ?lieu ?lieuLabel ?coord WHERE {
?film wdt:P915 ?lieu .
?lieu wdt:P131* wd:Q12709 .
?lieu wdt:P625 ?coord .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Timeline of François Arago
[edit]The following query uses these:
- Items: François Arago (Q154353)
- Properties: date of death (P570) , publication date (P577) , notable work (P800) , image (P18)
#title: Timeline of François Arago PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> #defaultView:Timeline SELECT DISTINCT ?timestamp ?entity ?relationLabel ?entityLabel (SAMPLE(?image) AS ?img) WHERE { BIND(wd:Q154353 AS ?person) { ?person ?property ?timestamp. ?entity wikibase:directClaim ?property. FILTER((DATATYPE(?timestamp)) = xsd:dateTime) } UNION { ?person ?entityToStatement ?statement. OPTIONAL {?person wdt:P570 ?dDate.} ?statement ?statementToQualifier ?timestamp. ?statement ?statementToValue ?entity. ?relation wikibase:statementProperty ?statementToValue. FILTER(REGEX(STR(?entityToStatement), "prop/P")) FILTER(REGEX(STR(?statementToQualifier), "prop/qualifier/P")) FILTER((DATATYPE(?timestamp)) = xsd:dateTime) BIND (IF(!BOUND(?dDate), now(), ?dDate) AS ?deathDate) FILTER(?timestamp <= ?deathDate) } UNION { BIND(wd:P50 AS ?relation) ?relation wikibase:directClaim ?property. ?entity ?property ?person. ?entity wdt:P577 ?timestamp. FILTER(NOT EXISTS { ?person wdt:P800 ?entity }) } UNION { BIND(wd:P800 AS ?relation) ?relation wikibase:directClaim ?property. ?person ?property ?entity. ?entity wdt:P577 ?timestamp. } OPTIONAL { ?entity wdt:P18 ?image } SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,fr" } } GROUP BY ?timestamp ?entity ?relationLabel ?entityLabel
Routes en France
[edit]The following query uses these:
- Items: road (Q34442) , France (Q142)
- Properties: instance of (P31) , subclass of (P279) , country (P17) , coordinate location (P625) , headquarters location (P159)
Features: map (Q24515275)
#defaultView:Map
SELECT ?route ?routeLabel ?coord ?coordonnées WHERE {
?route(wdt:P31/(wdt:P279*)) wd:Q34442.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
?route wdt:P17 wd:Q142.
OPTIONAL { ?route wdt:P625 ?coord. }
OPTIONAL {
?route p:P159 ?position_du_siège.
?position_du_siège wdt:P625 ?coordonnées.
}
}
Personnes nées dans les P-O par occupation (bubbles)
[edit]The following query uses these:
- Items: human (Q5) , Pyrénées-Orientales (Q12709)
- Properties: instance of (P31) , place of birth (P19) , occupation (P106) , located in the administrative territorial entity (P131)
Features: BubbleChart (Q24515280)
#defaultView:BubbleChart
SELECT ?occupationLabel (COUNT(DISTINCT ?person) as ?personCount)
WHERE {
?person wdt:P31 wd:Q5;
wdt:P19 ?birthPlace;
wdt:P106 ?occupation.
?birthPlace wdt:P131 wd:Q12709.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?occupationLabel ORDER BY DESC(?personCount)
Cartes des lieux de naissance de femmes dans les Pyrénées-Orientales (avec et sans photo)
[edit]The following query uses these:
- Properties: instance of (P31) , sex or gender (P21) , place of birth (P19) , located in the administrative territorial entity (P131) , coordinate location (P625) , image (P18)
Features: map (Q24515275)
#title: Cartes des lieux de naissance de femmes dans les Pyrénées-Orientales (avec et sans photo)
#defaultView:Map
SELECT ?personne ?personneLabel ?locLabel ?coord ?rgb WHERE {
?personne wdt:P31 wd:Q5 ;
wdt:P21 wd:Q6581072 ;
wdt:P19 ?loc .
?loc wdt:P131* wd:Q12709 ; wdt:P625 ?coord .
OPTIONAL { ?personne wdt:P18 ?image }
BIND(IF(BOUND(?image),"60BB00","666666") AS ?rgb).
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Ponts MH en France
[edit]The following query uses these:
- Properties: instance of (P31) , subclass of (P279) , heritage designation (P1435) , coordinate location (P625) , image (P18) , crosses (P177)
Features: map (Q24515275)
#defaultView:Map{"hide": ["?coords"]}
SELECT DISTINCT ?item ?itemLabel ?crosses ?crossesLabel ?coords ?image
WHERE
{
?item wdt:P31/wdt:P279* wd:Q12280 ;
wdt:P1435/wdt:P279* wd:Q916475 .
OPTIONAL { ?item wdt:P625 ?coords }
OPTIONAL { ?item wdt:P18 ?image }
OPTIONAL { ?item wdt:P177 ?crosses }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # le label viendra de préférence dans votre langue, et autrement en anglais
}
Voies de Canet-en-Roussillon géolocalisées dans Wikidata et dont la plaque de rue a été versée ou non sur WikiCommons
[edit]The following query uses these:
- Properties: located in the administrative territorial entity (P131) , coordinate location (P625) , instance of (P31) , subclass of (P279) , place name sign (P1766)
Features: map (Q24515275)
#defaultView:Map
SELECT ?voie ?voieLabel (SAMPLE(?coord) AS ?loc) (SAMPLE(?plaque) AS ?panneau) ?rgb {
hint:Query hint:optimizer "None" .
?voie wdt:P131+ wd:Q380514 ; wdt:P625 ?coord ; wdt:P31/wdt:P279* wd:Q83620 .
OPTIONAL { ?voie wdt:P1766 ?plaque }
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr" }
BIND(IF(BOUND(?plaque), "00F", "F00") AS ?rgb) .
}
GROUP BY ?voie ?voieLabel ?rgb