Thieol
Joined 26 November 2012
Babel user information | ||||||
---|---|---|---|---|---|---|
| ||||||
Users by language |
Bot request: Wikidata:Requests for permissions/Bot
- Thieol's bot request: Wikidata:Requests for permissions/Bot/ThieolBot
- Labels and descriptions task force: Wikidata:Labels and descriptions task force & Wikidata:Labels and descriptions task force/fr
- Infobox phase 2: Wikidata:Infoboxes task force
- Mediawiki API: API
- Request for deletion: Wikidata:Requests for deletions
- Migratio progress: Wikidata:Wikidata migration/Progress
- Administrator notice board: noticeboard
- Bot: [1]
Wikidata statistics | ||
---|---|---|
Number of pages | 114,837,421 | |
User total | 6,484,229 | |
Active users list | 25,151 | |
Administrators | 71 | |
Users/administrator | 354 |
Creating SPARQL-WIKIDATA queries in python edit
For those of you who are interested in running SPARQL queries in python.
- install SPARQL Endpoint interface to Python (1.6.4) ( on Ubuntu, just type :
sudo apt-get install python-sparqlwrapper
)
- this is a simple program you can run :
from SPARQLWrapper import SPARQLWrapper, JSON
sparql = SPARQLWrapper("https://wdqs-beta.wmflabs.org/bigdata/namespace/wdq/sparql")
sparql.setQuery("""
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
SELECT ?p ?w ?l ?wl WHERE {
wd:Q30 p:P6/v:P6 ?p .
?p wdt:P26 ?w .
OPTIONAL {
?p rdfs:label ?l FILTER (LANG(?l) = "en") .
}
OPTIONAL {
?w rdfs:label ?wl FILTER (LANG(?wl) = "en").
}
}""")
sparql.setReturnFormat(JSON)
results = sparql.query().convert()
for result in results["results"]["bindings"]:
#print(result["p"]["value"]) + " " + result["w"]["value"]
print(result["l"]["value"]) + " : " + result["wl"]["value"]
- Enjoy !