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

SPARQL - How to find every entity inside two categories and its subcategories

I'm trying to find every public university in Brazil, using Wikidata. The problem is that some of them are categorized as instance of university (Q3918) and public educational institution (Q23002037), but others are categorized as public university…
0
votes
1 answer

Function for importing JSON data into Google Spreadsheets doesnt work when the api contains " | "

I am trying to import JSON data to google sheets using a wikidata API. However, one of the symbols that are used in this api is the vertical bar: | . It is used as an "and" . For example if I want to import data in BOTH english and greek, then I…
0
votes
0 answers

Need help fetching a person's age from wikidata query using sparql

I recently started working on sparql to generate query for getting the age of a specific person (say, Donald Trump) The only thing I could understand is that it would be an instance of Person class. Can someone help me with what else needs to be…
0
votes
0 answers

How to get IMDb IDs of all films in a list page on Wikipedia?

I want to get the IMDb ID of all films in a list page on Wikipedia, for example: https://en.wikipedia.org/wiki/List_of_neo-noir_films I've tried making a query like this: (instance of: film, genre: neo-noir) SELECT ?film ?filmLabel ?IMDb_ID WHERE { …
privil
  • 3
  • 1
0
votes
1 answer

How to create dicts dynamically from iterating over a dictionary itself?

I'm using Wikipedia's Pageviews API in Python and I'm trying to get time and views for a list of pages. My idea was to create a dictionary with the wikipedia page (eg. Rome) as key and all the attributes as a dict of values. Then I want to create a…
0
votes
1 answer

How to get IMDb links of all films in a category page on Wikipedia?

I want to get the IMDb links of all films in a category page on Wikipedia, for example: https://en.wikipedia.org/wiki/Category:American_historical_films. I have heard of Wikidata Query Service and PetScan but honestly they are too complicated for me…
0
votes
1 answer

how to get all links(anchor text) pointing to a particular wikidata entity

I am working on a ML problem for which I need list of all the "anchor text"s whose link points to a particular wikidata entity. for example : For desired entity "Federal Reserve"(Q2044983). Links to this entity may appear in many pages(other entity…
boredaf
  • 98
  • 1
  • 8
0
votes
1 answer

Pass continue param to MWAPI inside Wikidata query

Is it possible to pass the continue parameter to a MWAPI call inside a Wikidata SPARQL query? For instance, I have this query which uses the MWAPI EntitySearch and that always returns at most 50 results. I want to be able to set continue hoping that…
0
votes
1 answer

sparql select wikidata group_by and concat

I want to extract a list o players and a list of clubs where it has played, separated by commas. SELECT DISTINCT ?playerLabel (GROUP_CONCAT(?teamLabel ; separator=',') as ?teams) WHERE { ?player wdt:P106 wd:Q937857 . ?player wdt:P2574 ?team…
dev2win
  • 11
  • 2
0
votes
1 answer

Extract pageviews from a all the pages of a wiki glossary?

How do I go about extracting only page views (all time or maximum year-wise- not really interested in daily, monthly, etc) of all the subpages from a glossary page. Example: https://en.wikipedia.org/wiki/Glossary_of_areas_of_mathematics I found this…
Akash
  • 35
  • 8
0
votes
1 answer

How to filter a variable by a property included in the variable in SPARQL?

I want to write a SPARQL query that would return the first name of a person based on the ranking of the name on Wikidata. For example, let's say I want the second first name of Mozart (Chrysostom). This is what I have so far (Mozart Wikidata ID is…
0
votes
0 answers

SPARQL query with wikidata

So I recently started using a project that had this SPARQL query. But it wasn't working anymore, can someone please tell me what changes are required. I am using SPARQLWrapper with this endpoint This is the query: SELECT ?label ?property ?thumbnail…
0
votes
1 answer

getting labels from Wikidata in graphDB

I have a list of artstyles in graphDB, i am trying to use the SERVICE function to get their labels from Wikidata with this query: PREFIX gp: PREFIX rdfs:…
0
votes
1 answer

Jena Query Optimization

I am pretty new to sparql and apache Jena so please forgive my naiveness. I loaded wikidata dump (705G) using TDB2 loader and executed some query examples from Wikidata Query Service. Most of the queries take longer time in Jena compare to Wikidata…
0
votes
0 answers

Wikidata SPARQL query timeout: country flags sorted by population

With the following SPARQL query I’m trying to list countries with their national flags in descending order of population. I cannot run it without it reaching a timeout limit. It runs in ~2s when the indicated line is commented out (but this returns…
Jollywatt
  • 1,382
  • 2
  • 12
  • 31