Skip to content

Instantly share code, notes, and snippets.

@loretoparisi
Created April 1, 2022 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loretoparisi/e2ccf211c4a723e83944b8a8819146e3 to your computer and use it in GitHub Desktop.
Save loretoparisi/e2ccf211c4a723e83944b8a8819146e3 to your computer and use it in GitHub Desktop.
Wikidata Entity Properties Sparql query
SELECT ?wdLabel ?ooLabel
WHERE {
VALUES (?s) {(wd:%@)}
?s ?wdt ?o .
?wd wikibase:directClaim ?wdt .
?wd rdfs:label ?wdLabel .
OPTIONAL {
?o rdfs:label ?oLabel .
FILTER (lang(?oLabel) = "en")
}
FILTER (lang(?wdLabel) = "en")
BIND (COALESCE(?oLabel, ?o) AS ?ooLabel)
} ORDER BY xsd:integer(STRAFTER(STR(?wd), "http://www.wikidata.org/entity/P"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment