Skip to content

Instantly share code, notes, and snippets.

@karlb
Last active September 25, 2023 17:25
Show Gist options
  • Save karlb/3dd3d382b08cddb3f90684ef8a44bee5 to your computer and use it in GitHub Desktop.
Save karlb/3dd3d382b08cddb3f90684ef8a44bee5 to your computer and use it in GitHub Desktop.
Wikidata queries
#defaultView:ImageGrid
SELECT DISTINCT *
WHERE {
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "EntitySearch" .
bd:serviceParam wikibase:endpoint "www.wikidata.org" .
bd:serviceParam mwapi:search ?company_name .
bd:serviceParam mwapi:language "en" .
?comp wikibase:apiOutputItem mwapi:item .
?num wikibase:apiOrdinal true .
}
VALUES ?company_name {"baloise"}
?comp p:P31/ps:P31/wdt:P279* ?company_or_similar. # only companies
?comp wdt:P154 ?logo.
VALUES ?company_or_similar {wd:Q783794 wd:Q4830453}
# FILTER (?comp = wd:Q6326486)
}
LIMIT 3
SELECT ?p ?propLabel ?o WHERE {
wd:L21636 ?p ?o.
OPTIONAL {
?prop wikibase:directClaim ?p.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment