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

How to enrich places with geonames ID

I have a list of places which I would enrich with the IDs from geonames. Since geonames by default it's embedded into WikiData I chose to go directly via SPARQL using WikiData endpoint. My workflow: I have imported the excel file into OpenRefine…
Pelide
  • 468
  • 1
  • 4
  • 19
4
votes
1 answer

Wikidata SPARQL Property Paths: asterisk and plus - wdt:P40+ vs wdt:P40/wdt:P40*

It seems that wdt:P40+ is not exactly the same as wdt:P40/wdt:P40*. Example: SELECT ?ancetre ?ancetreLabel WHERE { ?ancetre wdt:P40+ wd:Q346 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". } } It returns 852…
jlguenego
  • 1,192
  • 15
  • 23
4
votes
1 answer

How to get the Wikidata-related using page prop API of mediawiki

I saw a couple of solution to get the Wikidata Item from Wikipedia page. Generally, they use this pageprop query API: https://en.wikipedia.org/w/api.php?action=query&prop=pageprops&redirects=1&titles=LONDON But in my small version of media wiki,…
Loredra L
  • 1,485
  • 2
  • 16
  • 32
4
votes
1 answer

want to remove entity that has no label from the result

I'd like to ask one tricky thing about label. Using SERVICE keyword like SERVICE wikibase:label { bd:serviceParam wikibase:language "ko,en". } enable us to switch language label when the first preference is not mached to the target entity…
Keanu Paik
  • 304
  • 2
  • 12
4
votes
1 answer

Applying group_concat in wikidata queries for participants

I just learned about group_concat and order by, group by, and now I'm trying to apply them to query murder cases. I.E., to this one below to get all participants and targets. SELECT DISTINCT ?incident ?label ?participant ?participantLabel ?target…
belle
  • 87
  • 6
4
votes
1 answer

How to wait for Wikibase edit links to finish loading

I would like to write a Wikidata gadget, and need to wait for the page to be fully loaded, including the edit links next to each statement. I tried to wait for wikibase.view.ViewFactoryFactory but that didn't help - my code begins executing before…
Yuri Astrakhan
  • 8,808
  • 6
  • 63
  • 97
4
votes
1 answer

SPARQL question: how to return property labels and associated date qualifiers from Wikidata

I am trying to return results for a set of persons (Edinburgh University alumni) who have held political office. I would like to return the title label of the office held, along with the start and end dates for each office, with many individuals…
Al Mac
  • 49
  • 1
4
votes
2 answers

Using Wikidata label service in federated queries

I'm wondering if it is possible to use Wikidata label service in a federated query. E.g., the following query # Query from a local SPARQL enpoint select ?item ?itemLabel where { SERVICE { ?item…
floatingpurr
  • 7,749
  • 9
  • 46
  • 106
4
votes
1 answer

GROUP and COUNT in SPARQL

I am using WikiData SPARQL Endpoint to search for two entities: museums (wd:Q33506) and libraries (wd:Q7075) that have instagram and twitter accounts and from which country they are from. I am trying to count them and group them by country. SELECT…
Trinker
  • 93
  • 1
  • 9
4
votes
1 answer

How to show or filter by qualifier?

See eg. P297 at Q37024, there are a qualifier (P582). Show/debug This query is wrong, how to show the endtime's like the Q37024 case? SELECT ?item ?iso2_code ?endtime WHERE { ?item wdt:P297 ?iso2_code OPTIONAL { ?iso2_code pq:P582 ?endtime…
Peter Krauss
  • 13,174
  • 24
  • 167
  • 304
4
votes
1 answer

How to do a JSON or RDF bulk import of data in Wikidata?

I'm currently working with well structured RDF data on a OntoWiki knowledge base. I'm interested to import these data into a local wikidata. How is it possible? I didn't find a proper documentation. AFAIK, it seems Wikidata has MariaDB as backend…
Cyril
  • 485
  • 4
  • 15
4
votes
2 answers

SPARQL: Querying Wikidata labels for more than one language

I am trying to get labels in multiple languages from Wikidata's SPARQL endpoint. The following example is given here: SELECT ?country ?country_EN ?country_DE ?country_FR WHERE { ?country wdt:P31 wd:Q185441. # member state of the European…
Udi
  • 29,222
  • 9
  • 96
  • 129
4
votes
2 answers

How to get all allowed languages for Wikidata

I'm writing a tool for interacting with Wikidata where labels and descriptions are added to items. But I would like to validate that the language is supported before trying to add it. So my question is how do I get a list of the allowed language…
Lokal_Profil
  • 384
  • 1
  • 13
4
votes
2 answers

Setting a query timeout in Wikidata api

I've created a local version of the wikidata api using the instructions here, and I'd like to specify a custom timeout to override the 60 second timeout in the official api. I haven't found anything in RWStore.properties, but perhaps I'm missing…
dimid
  • 7,285
  • 1
  • 46
  • 85
4
votes
3 answers

Fuzzy entity query in Wikidata with Sparql times out

I'm trying to do a fuzzy (ie.. partial or case-insensitive) entity label lookup in Wikidata with Sparql (via the online endpoint). Unfortunately these return a "QueryTimeoutException: Query deadline is expired." I'm assuming this is because the…
bivouac0
  • 2,494
  • 1
  • 13
  • 28