wikidata-api

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

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 retrieve the categorical details in wikidata

自古美人都是妖i 提交于 2019-12-11 04:24:22
问题 I have a list of instances as follows. myinstances = ['word2vec', 'tf-idf', 'dijkstra's algorithm'] For each myinstance in the above list, I want to find: 1. What are the other instances of `myinstance`'s category (i.e. only one hop) 2. What are the instances of `myinstance`'s category's category (i.e. two hops) For example, if we consider myinstance = word2vec What are the other instances of myinstance 's category (i.e. only one hop)? As shown in the figure below the other instances of its

Find which direct property applied in a SPARQL query

﹥>﹥吖頭↗ 提交于 2019-12-10 14:56:15
问题 I have a list of properties I want to apply to a specific entity mathematics: wd:Q395 . In this case: instanceOf: 'wdt:P31' subclassOf: 'wdt:P279' The results are: Mathematics is instance of academic discipline and Mathematics is subclass of exact science and formal science Instead of making two different queries I would like to make them all at once: SELECT ?field ?fieldLabel ?propertyApplied WHERE { wd:Q395 wdt:P31 | wdt:P279 ?field. SERVICE wikibase:label { bd:serviceParam wikibase

Extract related articles in different languages using Wikidata Toolkit

放肆的年华 提交于 2019-12-07 13:05:40
I'm trying to extract interlanguage related articles in Wikidata dump. After searching on the internet, I found out there is a tool named Wikidata Toolkit that helps to work with these type of data. But there is no information about how to find related articles in different languages. For example, the article: "Dresden" in the English language is related to the article: "Dresda" in the Italiano one. I mean the second one is the translated version of the first one. I tried to use the toolkit, but I couldn't find any solution. Please write some example about how to find this related article. you

How can I query wikidata with a freebase id from a youtube video?

六月ゝ 毕业季﹏ 提交于 2019-12-07 10:31:43
问题 I am using the youtube API to retrieve the freebase topic details of particular videos. Since freebase is closing down how do I use wikidata to query for a specific topic id? For example the following topic id /m/0181lj should give the following information I have tried playing with the wikidata REST API but I haven't found a request which matches what I need. Update Freebase have released the Knowledge graph which allows you to query via topicId as so https://kgsearch.googleapis.com/v1

MediaWiki Query and/or WikidataQuery to find Wikipedia article

隐身守侯 提交于 2019-12-06 13:24:11
This isn't so much a question abut AngularJS as it is about the Wikimedia and Wikidata query API's. Although I am trying to display the content of a Wikipedia article in AngularJS after doing a certain query that isn't the problem. I already know how to display it... the problem is the search for an article or articles. I'm trying to query Wikipedia by historical event date as well as by geo-location. Let's pick a random event, any event. Let's say " 1986 Mozambican Tupolev Tu-134 crash ". Link: http://en.wikipedia.org/wiki/1986_Mozambican_Tupolev_Tu-134_crash From the article, I can see the

How to get all links and their Wikidata IDs for a Wikipedia page?

▼魔方 西西 提交于 2019-12-06 11:29:03
问题 (When) will the following be possible? get the list of all links on a Wikipedia page with their respective Wikidata IDs in a single query/API call. receive additional information of the respective Wikidata items like a property value with the query. 回答1: To get all Wikipedia page links you have to use Wikipedia API, and to get all Wikidata item properties you need Wikidata API, so it is not possible to create one query with two requests to both APIs. But! The first part of your question is

How to get a list of all films on Wikidata?

百般思念 提交于 2019-12-06 08:09:56
问题 I was using Freebase to get all movies/films there for my website, but it's getting shut down soon. so I was searching for another free database for movies and came across Wikidata. To be honest it's too complicated to understand how to query all the movies. So I thought you guys could help me to get all the movies in Wikidata. In the future I want to include TV shows and series as well. Programming language doesn't matter, I want to use web query with a link. 回答1: you can look for all the

How to get Wikidata labels by ID using SPARQL?

☆樱花仙子☆ 提交于 2019-12-06 01:27:13
问题 How can I get the labels in English or any other language in Wikidata by ID using SPARQL endpoint? 回答1: Suppose wd:Q146190 is your wikidata entity ID get the label in a specific language of your specific entity ID: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX wd: <http://www.wikidata.org/entity/> SELECT * WHERE { wd:Q146190 rdfs:label ?label . FILTER (langMatches( lang(?label), "EN" ) ) } LIMIT 1 live example in english live example in german get all the labels in any language