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
4
votes
0 answers

Using pywikibot, how to retrieve items with nested items inside?

Using this example, how do I retrieve the values of interaction on the electron page? I am stuck at this item_dict = item.get() clm_dict = item_dict["claims"] clm_list = clm_dict["P2069"] for clm in clm_list: clm_trgt = clm.getTarget() All I…
4
votes
1 answer

Can ISO 8601 represent a date such as "Summer 2011"?

Can ISO 8601 represent a date such as "Summer 2011"? The closest I can think of is "2011-07" or fallback to "2011". Of course if you are allowed to make use of time intervals you could use "2011-06-01/2011-08-31", but I am interested in…
Finn Årup Nielsen
  • 6,130
  • 1
  • 33
  • 43
4
votes
2 answers

With SPARQL, how to SELECT for node by identifer, specifically in wikidata?

Using the Wikidata SPARQL service, I would like to get the list of the 50 states and include the District of Columbia from Wikidata. I have come up with a kludgy query to do so: #-- wdt:P31 = instance of; wd:Q35657 = list of states SELECT ?state…
Raymond Yee
  • 549
  • 5
  • 13
4
votes
1 answer

How to get IMDb ID for some film article from the Russian Wikipedia?

I'm collecting data about some films in Russian and, using Wikipedia API, I can query data about required film in JSON format: https://ru.wikipedia.org/w/api.php?format=json&action=query&prop=revisions&rvprop=content&titles=%s where %s is a title…
cybersoft
  • 1,453
  • 13
  • 31
4
votes
0 answers

asp.net core and ajax

I'm working on ASP.NET Core application and not sure what is right way to use ajax in it. For example, I have model: public class Person { public int ID { get; set; } public string Wiki { get; set; } public string Name {…
Alexan
  • 8,165
  • 14
  • 74
  • 101
4
votes
1 answer

Path queries in Wikidata endpoint?

Consider the following snippet ASK WHERE { wd:Q734774 wdt:P31 wd:Q3918. } This works fine in Wikidata. I want to use some of the path syntax in the this snippet. Specifically I want to limit the number of the times "wdt:P31" used in the path.…
Daniel
  • 5,839
  • 9
  • 46
  • 85
4
votes
2 answers

Wikipedia API and SPARQL in a single query

I need to search for Wikipedia pages that contain some specific words in their full text. To improve the results I want to limit the results to pages describing entities that are instances of a specific entity. For searching the full text I can use…
BPas
  • 99
  • 5
4
votes
3 answers

SPARQL Matching Literals with **ANY** Language Tags without run into timeout

I need to select the entity that have a "taxon rank (P105)" of "species (Q7432)" which have a label that match a literal string such as "Topinambur". I'm testing the queries on https://query.wikidata.org; this query goes fine and return the entity…
Franco Rondini
  • 10,841
  • 8
  • 51
  • 77
4
votes
3 answers

Filter by type in Wikidata

This SPARQL request looks for all cities called "Berlin" in Wikidata: SELECT DISTINCT ?item ?itemLabel ?itemDescription WHERE { ?type (a | wdt:P279) wd:Q515. # Sub-type of city ?item wdt:P31 ?type. ?item rdfs:label "Berlin"@en. SERVICE…
Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373
4
votes
1 answer

Why multiple URLs for a single wikidata concept?

Each item or property of wikidata has a persistent URI that you can obtain by appending its ID. For example, the property P1566 (representing GeoNames ID) has the following URI http://www.wikidata.org/prop/direct/P1566 You can also access to this…
Jane Foster
  • 441
  • 2
  • 6
  • 14
4
votes
1 answer

Why is this SPARQL query missing so many results?

(First off, my apologies as this is a blatant cross-post. I thought opendata.SE would be the place for this, but it's gotten barely any views there and it appears to not be a very active site in general, so I figure I ought to try it here as it's…
Mason Wheeler
  • 82,511
  • 50
  • 270
  • 477
4
votes
1 answer

sparql wikidata identifiers reference

I use KMDb person ID to retrieve information from wikidata database. The result are three rows with three IMDB codes. If I look actress wikidata webpage (https://www.wikidata.org/wiki/Q7496795) I can see that only one of these has a reference. How…
Gionatha
  • 43
  • 5
4
votes
1 answer

How to reliably get the image used in the Wikipedia Infobox?

How do I (reliably) get the main image(s) used in the Wikipedia Infobox from the API? This question has been asked before and the accepted answer admits that it is just a guess. Subsequent answers seem like a hack, at best and don't return the…
user776942
4
votes
2 answers

Cannot access Wikidata API

I'm trying to use the Wikidata API, but all I'm getting is: Fetch API cannot load https://www.wikidata.org/w/api.php?action=wbsearchentities&search=Ingmar%20Bergman&language=en&limit=20&format=json&origin=http%3A%2F%2Fwww.dev.example.com%3A3000.…
4
votes
2 answers

How can I query wikidata with a freebase id from a youtube video?

I am using the youtube API to retrieve the freebase topic details of particular videos. Since freebase is closing down how do I use wikidata to query for a specific topic id? For example the following topic id /m/0181lj should give the following…
david_adler
  • 9,690
  • 6
  • 57
  • 97