wikidata

How to get associated (English) Wikipedia page from Wikidata page / Q number using Wikidata dump?

我的未来我决定 提交于 2019-12-13 04:03:42
问题 For @en text alone, a single item from the Wikidata dump contains multiple names: <http://www.wikidata.org/entity/Q26> <http://www.w3.org/2000/01/rdf-schema#label> "Northern Ireland"@en . <http://www.wikidata.org/entity/Q26> <http://www.w3.org/2004/02/skos/core#prefLabel> "Northern Ireland"@en . <http://www.wikidata.org/entity/Q26> <http://schema.org/name> "Northern Ireland"@en . On the Wikidata page for this article (http://www.wikidata.org/entity/Q26), which of these (if any) corresponds to

How to add a list as a parameter in sparql query in python

社会主义新天地 提交于 2019-12-13 03:51:59
问题 I am using SPARQLWrapper as follows to run my wikidata query. from SPARQLWrapper import SPARQLWrapper, JSON import pandas as pd sparql = SPARQLWrapper("https://query.wikidata.org/sparql") sparql.setQuery(""" SELECT DISTINCT ?item { VALUES ?searchTerm { "word2vec" "fasttext" "natural language processing" "deep learning" "support vector machine" } SERVICE wikibase:mwapi { bd:serviceParam wikibase:api "EntitySearch". bd:serviceParam wikibase:endpoint "www.wikidata.org". bd:serviceParam wikibase

Get all Wikidata items that have more than 10 languages?

人盡茶涼 提交于 2019-12-13 02:36:21
问题 I'm trying to get the most famous movies in the world from Wikidata with SPARQL. I have the following query: SELECT ?item WHERE { ?item wdt:P31 wd:Q11424. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } which returns ALL movies (about 214143). I basically only need movies that have, let's say, more than 10 language entries on wikipedia, as I'm guessing these will be the most famous ones. Is there a way to do this inside the query itself, without checking

How to enrich places with geonames ID

ぃ、小莉子 提交于 2019-12-12 13:15:32
问题 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 and created a new project In OpenRefine I have created my graph, then I have downloaded it as RDF/XML. Here a snapshot: <rdf:Description rdf:about="http://localhost:3333/0"> <rdfs:label>Aïre</rdfs:label> <crm:P1_is_identified_by>5A1CE163-105F-4BAF

Recover the “original” order

我只是一个虾纸丫 提交于 2019-12-12 10:19:50
问题 I am trying to recover the cast list for movies from wikidata. My sparql query for Dr. No is as follows: SELECT ?actor ?actorLabel WHERE { ?movie wdt:P161 ?actor . SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } FILTER(?movie = wd:Q102754) } LIMIT 1000 I can try it out at query.wikidata.org but the results are not in the order that I want. It gives 'Sean Connery', 'Zena Marshall', 'Ursula Andress'. The database has the data in the required order as you can see from https:/

How to check if a person exists on Wikipedia?

安稳与你 提交于 2019-12-11 17:22:52
问题 So I need a function. An example input would be like "donald trump" (I don't want it to be case-sensitive) If an article about the person exists on Wikipedia, function returns a summary and a picture. If not returns false Is this even possible? I couldn't figure out the correct API call. I've tried Wikidata API. It returns multiple objects for some inputs and I didn't know how to redirect it. 回答1: I created simple repo. You can check how it work on GitHub Page. This is search function: $('

How to get only Wikidata wdt (or other) predicates for an item via SPARQL?

旧巷老猫 提交于 2019-12-11 16:57:51
问题 Very new to this, so might have some terms wrong. I want to get a subset of triples for an entity (or entities). For example, this gives me 856 (as of now) triples for these two entities, including some labels and also /prop/direct/, /prop/direct-normalized/, and /prop/ predicates: CONSTRUCT {?s ?p ?o.} WHERE { VALUES ?s {wd:Q937 wd:Q670439} {?s ?p ?o.} } Try it But what if I only want the /prop/direct/ ( wdt ) triples? Would I use FILTER in some way? I suspect I'm missing the correct way to

Constructing all Wikidata triples in SPARQL that have to do with a certain identifier

狂风中的少年 提交于 2019-12-11 16:16:21
问题 I am trying to return a list of triples by using a construct query in the Wikidata SPARQL query service. I want all triples of people who have a GTAA_ID identifier. In addition to this, of all people who have a GTAA_ID, I want all triples containing the person with a GTAA_ID as the subject + all combinations of predicates and objects. Take the following example: Tom Hanks has a GTAA_ID (identifier). Tom Hanks also has a lot of other statements and identifiers in Wikidata. I want to retrieve

How to remove non-English entries from wikidata

旧街凉风 提交于 2019-12-11 16:02:03
问题 I am currently using the following SPARQL query to count the number of incoming links of a given node. SELECT (COUNT (*) AS ?count) WHERE {?s ?p wd:Q22673982 .} Code in Wikidata query editor: https://w.wiki/5DW However, the results include the count of non-English links as well. Is there a way to remove non-english links in wikidata results using SPARQL? I am happy to provide more details if needed. 来源: https://stackoverflow.com/questions/56724431/how-to-remove-non-english-entries-from

comparing labels in a federated query

空扰寡人 提交于 2019-12-11 07:08:10
问题 I have an instance of Wikibase running. I'm able to run federated queries with Wikidata successfully. I have certain queries that compare labels like this: PREFIX xwdt: <http://www.wikidata.org/prop/direct/> PREFIX xwd: <http://www.wikidata.org/entity/> PREFIX xpq: <http://www.wikidata.org/prop/qualifier/> PREFIX xps: <http://www.wikidata.org/prop/statement/> PREFIX xp: <http://www.wikidata.org/prop/> select ?item ?wditem ?itemLabel ?wid ?wditemlabel where { ?item wdt:P17 wd:Q39. ?item wdt