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
3
votes
1 answer

Retrieving properties last updated before/after arbitrary date

I'm interested in retrieving properties of a WikiData item, but only if the property was added or modified either before or after some date. So I have this SPARQL query that gets all properties for Q24. SELECT ?itemLabel ?propLabel…
stackoverflowuser2010
  • 38,621
  • 48
  • 169
  • 217
3
votes
1 answer

How to get the population of a location query (country or state/province and/or county) using wikipedia API?

I am trying to use the Covid-19 Dataset to build an SIR model. In order to build this model, I require the population of each location (country or province/state and/or county) to calculate the S (susceptible) in SIR. Since this dataset does not…
user10121139
3
votes
0 answers

Sparql request to Wikidata with subquery leads to timeout

It might be because of a wrong understanding of how selects with subqueries work, but I encounter the following problem. The following query should provide all the labels of a sub list of items (having occupation mathematician) limited by an…
Loic Rosnay
  • 335
  • 2
  • 14
3
votes
2 answers

Wikidata import into virtuoso

I would like to load wikidata into virtuoso. After days of searching I was unable to find any tutorial or at least somebody that uses virtuoso to sparql query wikidata. I would not like to spend money on a server to load 50G+ data for nothing. Why…
FranMercaes
  • 151
  • 1
  • 1
  • 12
3
votes
1 answer

SPARQL: Projecting on a non-existing variable

Try this query with and without the limit clause at the end on Wikidata endpoint. With LIMIT clause here, and without LIMIT clause here here. Now see the difference... I think that the reason for this is the ?duration variable in the projection of…
Median Hilal
  • 1,483
  • 9
  • 17
3
votes
0 answers

Find Wikidata properties with SPARQL and use them in the same query (Or: Using a subject as a predicate)

I am trying to construct a Wikidata query to find all properties of a certain type that are used on a given Wikidata item. Specifically, I'd like a list of links to authority identifiers from various organisations for a person. I've started by…
lascarides
  • 335
  • 3
  • 9
3
votes
2 answers

How to get the Wikidata labels for approximate terms?

I am using the below mentioned query to obtain the wikidata lable for a given term. SELECT ?item WHERE { ?item rdfs:label "Word2vec"@en } The output is wd:Q22673982 However, when I spell Word2vec as word2vec (i.e. all characters are simple…
EmJ
  • 4,398
  • 9
  • 44
  • 105
3
votes
1 answer

Get State/Province of a city with SPARQL query

I have the following SPARQL query: SELECT ?item ?itemLabel WHERE { ?item wdt:P17 wd:Q16; (wdt:P31/(wdt:P279*)) wd:Q515. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } which, in this case, returns cities in Canada. I…
user4918296
3
votes
1 answer

How to show Wikidata sitelink in wikipedia article

I have a local version of Wikipedia and Wikidata running. I would like to have an association between an article and wikidata object in the sidebar like in the standard installation. But in my version, the field Wikidata item is not shown under Tool…
Loredra L
  • 1,485
  • 2
  • 16
  • 32
3
votes
0 answers

SPARQL query for semantic similarity in Wikidata times out

I'd like to find entities "similar" to John Harrison in Wikidata. My naive SPARQL query always times out. SELECT ?similar ?similarLabel (COUNT(?p) AS ?similarity) WHERE { wd:Q314335 ?p ?o. ?similar ?p ?o. SERVICE wikibase:label {…
rickhg12hs
  • 10,638
  • 6
  • 24
  • 42
3
votes
1 answer

Wikidata+SPARQL: Get tickers of all companies listed on stock exchanges

I want to write a SPARQL query that gives me the wikidata_id, label, stock exchange, and ticker symbol for all instances of a company being listed on a stock exchange. My query so far looks like SELECT DISTINCT ?id ?idLabel ?exchangeLabel…
conradlee
  • 12,985
  • 17
  • 57
  • 93
3
votes
0 answers

Wikidata SPARQL query with label not working

I can't understand why with this query I can't get movement and genre labels: SELECT DISTINCT ?item ?itemLabel ?value ?inception ?creatorLabel ?image (group_concat(?genreLabel; separator=", ") AS ?genres) …
Lara M.
  • 855
  • 2
  • 10
  • 23
3
votes
1 answer

SPARQL: How do you pass a variable into a subquery?

This works: SELECT ?propLabel ?val WHERE { BIND("incoming"@en AS ?propLabel) { SELECT (COUNT(?s) AS ?val) WHERE { ?s ?p wd:Q8740. _:b72 wikibase:directClaim ?p. } } } But this does not, I assume because the…
T3db0t
  • 3,491
  • 4
  • 28
  • 45
3
votes
2 answers

Getting search results from wikidata website, but not API

I'm trying out the wikidata API but have some trouble with the search query "Jas 39 C Gripen". It returns results on the wikidata website, but not if I use the API. On The wikidata website I get two search results for the…
J. Margarine
  • 397
  • 1
  • 3
  • 8
3
votes
1 answer

Get records for a list of multiple entities on Wikidata

I am mapping multiple entities (Q entries) in Wikidata for which I need the same record of properties (P entries). For sake of this question, say I have a list of five Wikidata entities (Q1, Q2, Q3, Q4, Q5) for which I want to retrieve the same…