Wednesday, March 29, 2023

wikidata sparql examples

 Wikidata:SPARQL tutorial - Wikidata

Wikidata:SPARQL query service/queries/examples - Wikidata

Wikidata Query Service (movies on map)

Wikidata Query Builder

Wikidata Query Service

#Women Educated at Edinburgh university By Place of Birth

SELECT ?person ?personLabel 
(SAMPLE(?birth_date) as ?birth_date) 
(SAMPLE(?death_date ) as ?death_date ) 
(SAMPLE(?birth_place_label ) as ?birth_place_label ) 
(SAMPLE(?birth_place_coords ) as ?birth_place_coords ) 
(SAMPLE(?image ) as ?image ) 
(SAMPLE(?country ) as ?country) 
(COUNT(?article) as ?rank)
WHERE {  
  ?person wdt:P69 wd:Q160302 .
?person wdt:P31 wd:Q5 .
  ?person wdt:P21 wd:Q6581072 .
    OPTIONAL {?person wdt:P18 ?image }
  OPTIONAL {?person wdt:P18 ?image }
OPTIONAL {?person wdt:P569 ?birth_date }
  OPTIONAL {?person wdt:P27 ?countryItem .
              ?countryItem rdfs:label ?country filter (lang(?country) = "en")
        }
OPTIONAL {
             ?person wdt:P19 ?birth_place . 
             ?birth_place wdt:P625 ?birth_place_coords .
             ?birth_place rdfs:label ?birth_place_label filter ( lang(?birth_place_label) = "en" )
         }
OPTIONAL {?person wdt:P570 ?death_date } 
        OPTIONAL {?article schema:about ?person}     
   SERVICE wikibase:label {bd:serviceParam wikibase:language "en" }
}
GROUP BY ?person ?personLabel
ORDER BY DESC(?rank)
LIMIT 100

https://w.wiki/6V25 query

https://w.wiki/6V27 result
"timeline" view

"map" view



No comments: