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

How to get the ontology from a string entity at WikiData or SPARQL after NER?

We are using Spacy for entity extraction in Python 3 for a non-English language. We get back a list of entities which we want to store in a database. To get a better understanding of the entities we want to use Wikidata or any other publicly…
0
votes
4 answers

SPARQL get all the data before it reaches timeout

I am trying to get all the city names of all countries in the world using this below query. Whenever I execute this below query it returns this message "Query timeout limit reached". Is there any other way to get all the data before it reaches…
Karuppiah RK
  • 3,894
  • 9
  • 40
  • 80
0
votes
1 answer

How to do `FILTER (x IN ( ... ) )` in SPARQL?

I'm trying to load all the subtaxons of Biota/Q2382433 (i.e. entities with P271 "parent taxon" pointing to Q2382433) in Wikidata. The following query works fine: SELECT ?item ?itemLabel (GROUP_CONCAT(DISTINCT ?class; SEPARATOR=", ") AS…
Jonas Sourlier
  • 13,684
  • 16
  • 77
  • 148
0
votes
1 answer

Querying distance units in Sparql - Wikidata example

I would like to know the simplest way to handle units of distance in Sparql. In this Wikidata example I would like to select all the mountains over 8000m; however when I run the text below it also includes all of the mountains over 8000ft. Is it…
alkey
  • 986
  • 4
  • 16
  • 33
0
votes
1 answer

SPARQL wikidata returns less countries instead of all

I am trying to list out all the countries. I tried this below query. It returns 166 results. But, I think total of more than 190, 200 countries are in the world. But, why it returns only 166 country names? Am I doing anything wrong here? This is…
Karuppiah RK
  • 3,894
  • 9
  • 40
  • 80
0
votes
0 answers

Obtain country from wikidata item using SPARQL

I am trying to get the country of a Wikidata item using SPARQL. I am quite new and I am not able to obtain only the property country (P17) and its label. I used this example and I am able to obtain all properties. Link. In this case using the output…
Javi Rando
  • 13
  • 3
0
votes
0 answers

Filter property values by type in wikidata

I am trying to set up a SPARQL query that lists museums for a specified country. My main goal is to find the city the museum is located. I'm new to wikidata, just started. So far, I have used the property…
Christian
  • 111
  • 2
0
votes
1 answer

In Wikidata SPARQL, how can I return other fields?

In my Wikidata query, I actually have 2 problems. Date of Birth + Gender + Description is not returned GROUP BY does not aggregate based on the name (Bad Aggregate Error) SELECT ?person ?label ?dob ?gender ?description WHERE { ?person wdt:P31…
TIMEX
  • 259,804
  • 351
  • 777
  • 1,080
0
votes
0 answers

SPARQL to get all properties not working in local wikidata

The following SPARQL is from SQID python script to generate a properties.json. The following SPARQL would work in query.wikidata.org PREFIX wikibase: SELECT ?id ?idLabel WHERE { ?id ?b wikibase:Property…
Loredra L
  • 1,485
  • 2
  • 16
  • 32
0
votes
0 answers

'instance of' is transitive or intransitive property?

In SPARQL (wikidata) 'instance of' is a transitive or intransitive property? And 'subclass of'? if A is an instance of B and B is an instance of c it is correct to say that A is an instance C? I thought so, but some data confused me. Wrong Example:…
Amedeo
  • 105
  • 1
  • 9
0
votes
1 answer

Wikidata SPARQL - get company entities and the location of their headquarters

I'm having trouble extracting location attributes of company HQ's. My query: finds all companies or sub-classes, and returns some basic properties such as ISIN and URL, and the Headquarter location. I have tried to use this example to extend the…
BenP
  • 825
  • 1
  • 10
  • 30
0
votes
0 answers

Questions on Filter of Monolingual Text

I send a query as below. Without filter, I got responses and in the response, I checked the values are there. but with the filter statement, I failed to get query. What's wrong with my query? P1813 property type is a Monolingual text, so I used the…
Keanu Paik
  • 304
  • 2
  • 12
0
votes
0 answers

Find information for many people in wikidata

I have a list of names (hundreds of them) that are already transformed to Q-numbers in wikidata using python. For each Q-number (person) I want to get some basic information such as place_of_birth, nationality, etc. SELECT DISTINCT ?name ?nameLabel…
0
votes
1 answer

Finding wikidata identifiers (properties & lexemes)

My problem: I'm writing an NLP program in python and I need to get the entity ID for properties and lexemes. So what I basically want is, e.g. if the input is the word/property "father" I want the return value to be "P22" (property number for…
0
votes
0 answers

Efficient filter query in Wikidata

I am trying to form an efficient filter query in SPARQL on Wikidata. Let me explain my process: I query the search-entities API using key words e.g. (Apple, Orange) The API query returns a list of relevant item ID's e.g. (wd:Q629269, wd:Q154950,…
BenP
  • 825
  • 1
  • 10
  • 30