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

Using FILTER on property in SPARQL

How do I select all properties that start with a certain prefix, e.g. wdt:? I would like to get all properties related to an item, but am not interested in schema:, rdf:, p: and so on. SELECT DISTINCT ?p WHERE { wd:Q2 ?p ?entity. } This query…
soerface
  • 6,417
  • 6
  • 29
  • 50
0
votes
3 answers

Wikidata query for finding presidents

I was learning the wikidata query language, and wanted to find the US president's name along with grand father, great grand father and so on... I tried this to get a father, but how to find the father's father and so on... SELECT ?valLabel…
user13686103
0
votes
0 answers

SPARQL endpoints and GraphDB

I am a student and I'm learning to use sparql. I would like to query an endpoint by running the sparql query from GRAPHDB. So looking online I found that the solution is to use SERVICE with the endpoint link. I have tried with the wikidata endpoint…
0
votes
1 answer

SPARQL Query: A sets of breeds cat along with the cats that belong to

I am trying to query all the cats breeds (wd:Q43577) along with the list of cats that belong to. Below, you will find my solution. The result of my solution is not relevant and contains a redundancy. Therefore, I need your help to find the best…
bilalox
  • 3
  • 1
  • 1
0
votes
1 answer

Wikidata - get the full subhierachy of one class as well as all nodes

I need the complete hierarchy that is under Food Q2095. All levels of subclasses should also be included. Additionally all entities that are attached to a (sub)class. How can I query this? SELECT ?node WHERE {?node ?pred wd:Q2095} Direct query at…
ozz
  • 175
  • 1
  • 11
0
votes
0 answers

SPARQL wikidata get state/province of all cities of a particular country

I am trying to get all cities and their states/province of a country. Here I got all cities of Canada successfully using this below query. Cities Wikidata SPARQL -- It works SELECT ?city ?cityLabel WHERE { ?city wdt:P17 wd:Q16; …
Karuppiah RK
  • 3,894
  • 9
  • 40
  • 80
0
votes
1 answer

Is it possible to update WikiData by API?

I have a few thousand edits that I could do: adding a wikidata id for wikipedia pages that do not gave one editing the instance of property for a number (of those and pre-existing ones) This is data I have that comes from analysing extracts of…
simone
  • 4,667
  • 4
  • 25
  • 47
0
votes
0 answers

How to query Wikidata entities including "also known as"

Note: Before anyone marks this as duplicate to How to query Wikidata for "also known as", no actual working answer was given there. The question I have is similar to that thread: How do I get matching entities from "also known as" using a query…
Hylke
  • 171
  • 2
  • 17
0
votes
0 answers

wikidata fetching entities id containing a literal

I am trying to obtain the wikidata entity_id containing a given literal, for example "crypto". I'm using: SELECT ?item WHERE { ?o rdfs:label ?ol FILTER (lang(?ol) = 'en') FILTER(contains(str(?ol),'crypto' )) } Of course, the wrong approach…
David G. Hdez
  • 125
  • 1
  • 8
0
votes
0 answers

Get company data from wikidata

I'm trying to get some company data from wikidata but for some reason it doesn't work for companies as "Groupe La Poste" or "Google" PREFIX rdfs: PREFIX skos:…
0
votes
0 answers

query wikidata using property and itemlabel

Hi i'm trying to work with wikidata in order to enrich text data for a classification nlp task, but i have zero knowledge and i'm running out of time. What I want to query in wikidata: Let's say I'd like to know that Mercedes-Benz is part of the …
Marco Fumagalli
  • 2,307
  • 3
  • 23
  • 41
0
votes
0 answers

wikidata get number of deaths (P1120)and associated time of COVID-19 pandemic (Q81068910)

I want to get 2019–20 COVID-19 pandemic (Q81068910) number of deaths (P1120)+ associated time for each country. I use the wikidata sparql as following, I cannot get the associated time of number of deaths (P1120). I try to add ?num wdt:P585 ?time…
0
votes
0 answers

Extracting companies and all their properties from Wikidata

I want to extract all companies from a specific stock index, e.g. Dow Jones together with all their properties from Wikidata. Take IBM for example, then the output should somehow look like this: instance of -> software company... part of -> Dow…
BeginnerGinner
  • 15
  • 1
  • 1
  • 4
0
votes
0 answers

Select members of parliament with SPARQL from Wikidata

Based on wikidata I want to make a list of all members of the European Parliament and I want some metadata about their membership like start date and the party they represent. As a start I run the following query: SELECT ?human ?humanLabel…
Ottotos
  • 633
  • 5
  • 14
0
votes
1 answer

How to get all property from an item based on its Q number?

I want to gather all properties of a item from wikidata. All queries I see so far assume you know properties you are looking for, but in my case, I'm not. For example, when querying for Q1798740, I would like a returned value that looks…
Manu H
  • 523
  • 1
  • 5
  • 17