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

WikiData SPARQL Query Fails, requires CONTAINS to work

The query below works when I include the line that uses CONTAINS for the filter, but fails if I simply check if the value (LCASE) is equal to "donald trump" (it is). Use this line, and it works: FILTER(CONTAINS(LCASE(?idLabel), "donald trump")…
Andy
  • 842
  • 1
  • 12
  • 24
0
votes
0 answers

Wikidata API Access-Control-Allow-Origin

When querying wikidata, I get a Access-Control-Allow-Origin error. My request is sent using Axios from a Reactjs web app: let query =…
ted
  • 13,596
  • 9
  • 65
  • 107
0
votes
0 answers

SPARQL - Extract Label from entity URI

I'm trying to extract a list of diseases that have symptoms from Wikidata. The thing is, when I query I get a list of entity URIs, not a list of labels, for the Symptoms column. My query, tested on here : SELECT ?disease ?diseaseLabel…
mariuss
  • 1,177
  • 2
  • 14
  • 30
0
votes
1 answer

How to find titles containing a string using SPARQL?

For example how can I find Wikimedia Commons categories containing the string "shape" in title, using SPARQL? Also I would like to ask how to change the script in order to: make the search case insensitive search whole words instead of…
Fructibus
  • 145
  • 7
0
votes
0 answers

How can I get all the triples from Wikidata, for all the proper nouns?

My end aim is to get all the Wikidata triples in the form {SubjectLabel, PredicateLabel, ObjectLabel}, preferable in CSV format, for all the proper nouns, such as People, Cities, Countries, Books, etc. I tried querying for all subjects having P31…
darth
  • 169
  • 1
  • 16
0
votes
1 answer

SPARQL Apache Jena - HTTPException 404

I have a problem with a Federated Query. It is used only as an example for my project. I retrieve all Wikimedia Categories via DBpedia SPARQL Endpoint in Wikidata, but thats not the problem as the query below works in Wikidata. But when I want to…
grajkowski
  • 349
  • 1
  • 3
  • 14
0
votes
1 answer

how to use Reality Gem to query wikidata to find properties such as part_of & Instance_of

I'm using Reality Gem to Query Wikidata, using this code below. But it gives nil output. i've checked using result.methods command but i dont't see any method to view "part_of" or "instance_of" property values require 'reality' result =…
0
votes
0 answers

SPARQL : Passing parameter from main query to SERVICE query

In the below query, I'd like to pass the ?wid parameter to the SERVICE query, but it is not passed and processed as another empty variable(like ?child) so the query returns undesired results(meaning that it behaves ?wid as an empty variable because…
cuneyttyler
  • 1,255
  • 2
  • 17
  • 27
0
votes
0 answers

Querying OWL File using SPARQL

I have an OWL file describing a simple ontology at http://purl.org/net/cnyt-literature. It has a couple of instances which have owl:sameAs property referring to DBpedia and Wikidata items. What I want to do is to have a federated SPARQL query for…
cuneyttyler
  • 1,255
  • 2
  • 17
  • 27
0
votes
1 answer

Why doesn't my query run on wikidata.dbpedia.org/sparql?

This query works on http://dbpedia.org/snorql/. But it isn't working on http://wikidata.dbpedia.org/sparql. How do I fix it so that it works in http://wikidata.dbpedia.org/sparql? PREFIX dbo: PREFIX dbpedia:…
0
votes
1 answer

Find Rank (Number) of US Presidents with Sparql (Wikidata)

I want to use a Sparql query to find the rank (Trump 45, Obama 44...) from Wikidata. This Property does not seem to exist for the entity President of the United States (Q11696). Does anyone have an idea how to solve this problem? Thanks!
0
votes
1 answer

How to Query Wikidata for US persidents?

How to Query Wikidata for US presidents, who started their presidency after 1970 AND have at least one daughter? I know how to query for US presidents but I don't know how to filter my search. SELECT ?presLabel ?spouseLabel ?picp ?picps…
DSaad
  • 181
  • 3
  • 12
0
votes
1 answer

result set of SPARQL query against WIKIDATA ignores offset

I expect to retrieve 10 citizens of Canada, whereas the result set ought to start at the lowest wikidata ID Q... it matches (i.e. the search should "start" at https://www.wikidata.org/wiki/Q1) : SELECT DISTINCT ?item ?itemLabel WHERE { …
MarkHelms
  • 55
  • 10
0
votes
1 answer

Selecting Food Calories from SPARQL

I've started looking into SPARQL and I admit I find it very obscure and difficult. I need to output the calories for all the foods. I don't really understand the difference between the wd: wdt: p: and ps: Similarly I am unclear on when to use P000…
Sorade
  • 915
  • 1
  • 14
  • 29
0
votes
1 answer

Query Wikidata by GeoNames ID

I try to query Wikidata for a city by its GeoNames ID. I can see the id of the property is P1556: https://www.wikidata.org/wiki/Property:P1566 So my query for Berlin (as an example) is: SELECT * WHERE { ?id wdt:P1566 wd:2950157 } But I don't…
Boas Enkler
  • 12,264
  • 16
  • 69
  • 143