Created
January 6, 2025 18:33
-
-
Save jswright61/71f9ee89d4caa978d68383afb73c42cc to your computer and use it in GitHub Desktop.
SPARQL Queries against Wikidata
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT distinct ?item ?itemLabel ?itemDescription # (SAMPLE(?birth) as ?birth_date) | |
| WHERE{ | |
| ?item ?label "Shannen Doherty"@en. | |
| ?item wdt:P31 wd:Q5. | |
| # ?id wdt:P569 ?birth . | |
| ?article schema:about ?item . | |
| ?article schema:inLanguage "en" . | |
| SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT DISTINCT | |
| ?id | |
| ?idLabel | |
| #?siteLinks | |
| (SAMPLE(?birth) as ?birth_date) | |
| (SAMPLE(?death_date) as ?dateOfDeath) | |
| (SAMPLE(?manner_of_deathLabel) as ?mannerOfDeath) | |
| (SAMPLE(?cause_of_deathLabel) as ?causeOfDeath) | |
| WHERE { | |
| ?id wdt:P31 wd:Q5. | |
| ?id wdt:P569 ?birth . | |
| #?person wikibase:sitelinks ?sitelinks. | |
| OPTIONAL{ | |
| ?id wdt:P570 ?death_date . | |
| ?id wdt:P1196 ?manner_of_death . | |
| ?id wdt:P509 ?cause_of_death . | |
| } | |
| SERVICE wikibase:label { | |
| bd:serviceParam wikibase:language "en". | |
| ?id rdfs:label ?idLabel . | |
| ?manner_of_death rdfs:label ?manner_of_deathLabel . | |
| ?cause_of_death rdfs:label ?cause_of_deathLabel. | |
| } | |
| #?id ?label "Shannen Doherty"@en . | |
| # label line above to search by name line VALUE ?id line below to search by QID - only 1 uncommented at a time | |
| VALUES ?id {wd:Q207598 wd:Q105221} | |
| } | |
| GROUP BY ?id ?idLabel | |
| ORDER BY (?idLabel) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT ?person ?personLabel ?died ?sitelinks | |
| WITH { | |
| SELECT * | |
| WHERE { | |
| ?person wdt:P31 wd:Q5; | |
| wdt:P570 ?died. | |
| FILTER (?died >= "2024-12-01T00:00:00Z"^^xsd:dateTime && ?died < "2025-01-01T00:00:00Z"^^xsd:dateTime) | |
| ?person wikibase:sitelinks ?sitelinks. | |
| } | |
| ORDER BY desc(?sitelinks) | |
| LIMIT 100 | |
| } AS %i | |
| WHERE { | |
| INCLUDE %i | |
| SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . } | |
| } | |
| ORDER BY desc(?sitelinks) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment