Questions tagged [wikidata]

Wikidata is a free, collaborative, multilingual database, collecting structured data to provide support for Wikipedia, Wikimedia Commons, and the other wikis of the Wikimedia movement. One can retrieve all data using Wikidata Query Service (Wikidata SPARQL endpoint) or Wikidata API (Wikidata MediaWiki API extension). If you are completely new both to SPARQL and MediaWiki API, please consider to ask your question on opendata.stackexchange.com.

Wikidata is a free, collaboratively edited knowledge base operated by the Wikimedia Foundation. It is intended to provide a common source of certain data types (for example, birth dates) which can be used by Wikimedia projects such as Wikipedia. This is similar to the way Wikimedia Commons provides storage for media files and access to those files for all Wikimedia projects.

Concepts:

Wikidata is a document-oriented database, focused around items. Each item represents a topic (or an administrative page used to maintain Wikipedia) and is identified by a unique number, prefixed with the letter Q — for example, the item for the topic Politics is Q7163. This enables the basic information required to identify the topic the item covers to be translated without favouring any one language.

Information is added to items by creating statements. Statements take the form of key-value pairs, with each statement consisting of a property (the key) and a value linked to the property.

Wikidata statement

Further reference:

887 questions
5
votes
1 answer

Find which direct property applied in a SPARQL query

I have a list of properties I want to apply to a specific entity mathematics: wd:Q395. In this case: instanceOf: 'wdt:P31' subclassOf: 'wdt:P279' The results are: Mathematics is instance of academic discipline and Mathematics is subclass of exact…
PMT
  • 1,082
  • 8
  • 18
5
votes
1 answer

How to use a Wikidata SPARQL Query and get the url to SVG image of chart

If I run this SPARQL query #defaultView:BubbleChart #TEMPLATE={"template":"Overall causes of death ranking of ?thing ","variables":{"?thing": {"query":"SELECT ?id (COUNT(?id) AS ?count) WHERE { ?sub wdt:P509 ?y. ?sub wdt:P31 ?id. } GROUP BY ?id…
Andy
  • 842
  • 1
  • 12
  • 24
5
votes
3 answers

Wikidata query duplicates

Sorry if my english is bad, but I don't really have any place where I can ask this question in my native language. I've been trying to create SPARQL query for Wikidata that should create a list of all horror fiction that was created in 1925-1950…
Dusk
  • 51
  • 3
5
votes
2 answers

How to access the Wikidata SPARQL interface from Java?

I am trying to query all instances of an entity from Wikidata. I found out that currently the only way to do this is to use the SPARQL endpoint. I found an example query which does about what I want to do and successfully executed it from the Web…
Andreas Hartmann
  • 1,825
  • 4
  • 23
  • 36
5
votes
2 answers

Get list of used values for some property

Can I get list of used values for some property? For example, I would like to get a list of all used distinct values of P166 (award received) property.
Alexander Sigachov
  • 1,541
  • 11
  • 16
5
votes
1 answer

Getting Interlanguage Links from a Wiki dump

I am trying to extract the interlanguage links from Wikipedia dumps. It seems that these links were moved to WikiData Project, and the access is provided only via API. This branch explains how to deal with the issue and suggests to switch to the…
Evgeny M
  • 77
  • 1
  • 8
5
votes
1 answer

How to get list of statements for a given Wikidata ID?

The only thing I managed to do is this link: https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q568&format=jsonfm But this produces lots of useless data. What I need is to get all the statements for the given item, but I can't see any of…
rsk82
  • 28,217
  • 50
  • 150
  • 240
4
votes
1 answer

SPARQL query gives different result as a subquery

When running the following query I get only one result as expected SELECT DISTINCT ?city ?country WHERE { FILTER (?city = wd:Q1748) . # Primary country ?city p:P17 ?c . ?c ps:P17 ?country ; wikibase:rank ?rank . FILTER NOT EXISTS {…
Bjørn RL
  • 55
  • 1
  • 6
4
votes
2 answers

How to scrape 'In more languages' table on Wikidata?

I'm trying to scrape the WHOLE 'In more languages' table on Wikidata pages, e.g. https://www.wikidata.org/wiki/Q3044 I have tried 2 approaches in R: library(rvest) url <- "https://www.wikidata.org/wiki/Q3044" pg <- url %>% read_html pg <- pg %>% …
4
votes
2 answers

Extracting RDF triples from Wikidata

I'm following this guide on querying from Wikidata. I can get a certain entity (if I know its code) using with: from wikidata.client import Client client = Client() entity = client.get('Q20145', load=True) entity >>>
Penguin
  • 1,923
  • 3
  • 21
  • 51
4
votes
1 answer

How to get the number of languages a Wikipedia page is available in? (SPARQL query)

I'm trying to have a list of Italian books from the 1980 on and the number of Wikipedia pages their original Wikipedia page has been translated into, for instance I would like to have: Book, number The name of the Rose, 5 Where 5 is the number of…
4
votes
1 answer

How do I query Wikidata for items modified in the last day?

I am trying to retrieve all wikidata items within a latitude/longitude bounding box that have been edited in the last 24 hours I get through the bounding box part ok, but I can't figure the "modified since" bit. This is the closest example I could…
simone
  • 4,667
  • 4
  • 25
  • 47
4
votes
2 answers

How to make an svg interactive to gather comments/annotations on depicted elements

I create directed graphs like the following from wikidata with the help of networkx and nxv. The result is an svg file which might be embedded in some html page. Now I want that every node and every edge is "clickable", such that a user can add…
cknoll
  • 2,130
  • 4
  • 18
  • 34
4
votes
0 answers

Why are SPARQL queries not working as expected in our Wikidata Docker WDQS

SPARQL queries not working as expected in our Wikidata Docker WDQS (wikidata query service). We are running wikibase docker on an AWS EC2. First I will describe the 3 queries that are not working, and then provide details about our setup. We…
JoeAquila
  • 41
  • 3
4
votes
0 answers

Shortest path with SPARQL and blazegraph

This code gives the descendants of Genghis Kahn up to a certain depth (as a graph which can be changed to a table) : PREFIX bd: PREFIX wd: PREFIX wdt:…
Tobi
  • 41
  • 1