wikidata

SPARQL query does not yield expected results

北城余情 提交于 2019-12-24 04:07:36
问题 I'm using this SPARQL query to obtain a list of European countries: SELECT ?item $itemLabel WHERE { ?item wdt:P31 wd:Q6256. #?item wdt:P30 wd:Q46 #?item wdt:P361* wd:Q46. ?item wdt:P30|wdt:P361* wd:Q46. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } ORDER BY ASC($itemLabel) Line 3 limits the results to instances of Q6256, i.e. countries. Line 4 (currently commented out) limits the results to items which are on the continent Q46 (Europe). Line 5 (currently commented out)

Using a year's natural number value in a SPARQL query

梦想与她 提交于 2019-12-24 00:57:45
问题 How do I query wikidata for a list of scientists that died in a prime-numbered year, and also were born in a prime-numbered year, using SPARQL? Here is what I have so far, which returns no results, and I'm assuming that's because people don't die in a number, but rather in a year... Also missing is the UNION statement for those born in a prime-numbered year, but we can omit that for the sake of focus. SELECT ?number ?scientist ?scientistLabel WHERE { ?number wdt:P31 wd:Q49008. ?scientist wdt

Getting search results from wikidata website, but not API

橙三吉。 提交于 2019-12-23 20:17:45
问题 I'm trying out the wikidata API but have some trouble with the search query "Jas 39 C Gripen". It returns results on the wikidata website, but not if I use the API. On The wikidata website I get two search results for the query https://www.wikidata.org/w/index.php?search=Jas+39+C+Gripen&title=Special:Search&fulltext=1 The same query using the API, does not return a result https://www.wikidata.org/w/api.php?action=wbsearchentities&format=json&language=en&type=item&continue=0&search=Jas%2039

What are values starting with “t” and how to ignore them for counting

牧云@^-^@ 提交于 2019-12-22 18:36:45
问题 I am trying to query the frequency of certain attributes in Wikidata, using SPARQL. For example, to find out what the frequency of different values for gender is, I have the following query: SELECT ?rid (COUNT(?rid) AS ?count) WHERE { ?qid wdt:P21 ?rid. BIND(wd:Q5 AS ?human) ?qid wdt:P31 ?human. } GROUP BY ?rid I get the following result: wd:Q6581097 2752163 wd:Q6581072 562339 wd:Q1052281 223 wd:Q1097630 68 wd:Q2449503 67 wd:Q48270 36 wd:Q44148 8 wd:Q43445 4 t152990852 1 t152990762 1

How to get list of statements for a given Wikidata ID?

纵然是瞬间 提交于 2019-12-22 07:46:25
问题 The only thing I managed to do is this link: https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q568&format=jsonfm But this produces lots of useless data. What I need is to get all the statements for the given item, but I can't see any of the statements in the query above. here it will be: { "instance of" : "chemical element", "element symbol" : "Li", "atomic number" : 3, "oxidation state" : 1, "subclass of" : ["chemical element", "alkali metal"] // etc... } Is there an API for this

sparql query on wikidata

拟墨画扇 提交于 2019-12-20 05:49:18
问题 i am very new to sparql and i am trying to run 3 queries on wikidata: Persons who are not painters and who are students of painters. Persons who are not painters and who are academic offspring or children of painters (note: an academic offspring of a person P is somebody who is/was a student of P , or a student of a student of P , or .... ). People who are academic offspring of themselves. i got stuck on the first one, i tried: SELECT DISTINCT ?human ?humanLabel WHERE { ?human wdt:P31 wd:Q5.

Get WikiData Identifier for city by GPS location

蹲街弑〆低调 提交于 2019-12-20 03:09:52
问题 I want to get the city /settlement at a specific gps location. meaning the closest one in a given range or at best the closest. i found some example queries in the wikimedia data examples. I try to adopt then but i get only errors or timeouts here is my current query: SELECT * WHERE { ?city wdt:P31/wdt:P279* wd:Q15642541 . // only settlements # Search by Nearest SERVICE wikibase:around { ?place wdt:P625 ?location . bd:serviceParam wikibase:center "Point(8.4024875340491 48.9993762209831)"^^geo

Wikidata results sorted by something similar to a PageRank

半世苍凉 提交于 2019-12-17 16:36:06
问题 In Wikidata (Wikidata SPARQL endpoint), is there a way to order the SPARQL query results with something like a PageRank? SELECT DISTINCT ?entity ?entityLabel WHERE { ?entity wdt:P31 wd:Q5. SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } LIMIT 100 OFFSET 0 Can we specify a field to order the results by and that field expresses that the entity at the top is more notable/important/recognizable that the following one and so on? 回答1: It seems that PageRank does not make much

How to check for a sub-property at all levels expanded from a SPARQL * wildcard?

一世执手 提交于 2019-12-14 03:48:50
问题 In Wikidata, I want to find an item's country. Either directly if the item has a country directly, or by climbing up the P131s (located in the administrative territorial entity) until I find a country. Here is the query: ?item wdt:P131*/wdt:P17 ?country. The query above works fine... except when a sub-division used to belong to another country, like for Q25270 (Prishtina). In such case, the result can be anachronistic. That's what I want to fix. Great news: in such cases we should only

How to filter results of wikidata to specific language

a 夏天 提交于 2019-12-13 18:04:15
问题 I have a query to get all Capitals. (Capital Cities) SELECT DISTINCT ?Stadt ?label ?Staat ?StaatLabel ?geographische_Koordinaten ?StadtLabel WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } ?Stadt wdt:P31 wd:Q5119. ?Stadt rdfs:label ?label. OPTIONAL { ?Stadt wdt:P17 ?Staat. } OPTIONAL { ?Stadt wdt:P625 ?geographische_Koordinaten. } } LIMIT 100 Try it here and the result is: wd:Q61 Washington D.C. wd:Q30 Vereinigte Staaten Point(-77.036666666 38.895)