I'm creating an app that provides Wikidata info in slide-out menus on top of Wikipedia pages. Here's a video of a prototype: https://vimeo.com/146061825
Much of the app will be implemented as REST services in the cloud, and one item of functionality required will be a REST service that returns the Q id given a Wikipedia URL (in any language). Another REST service required will return a Wikipedia URL given a Wikidata Q id and language code (e.g. "en" or "pt-br").
Does anything like this currently exist?
Regards, James Weaver http://JavaFXpert.com http://CulturedEar.com
Hi,
On 11/20/2015 08:16 AM, james@j1w.xyz wrote:
Much of the app will be implemented as REST services in the cloud, and one item of functionality required will be a REST service that returns the Q id given a Wikipedia URL (in any language). Another REST service required will return a Wikipedia URL given a Wikidata Q id and language code (e.g. "en" or "pt-br").
Does anything like this currently exist?
Kind of.
https://en.wikipedia.org/w/api.php?action=query&titles=Douglas%20Adams&prop=pageprops&formatversion=2 maps a page title on the English Wikipedia to its Wikidata Q id.
https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q42&props=sitelinks will do the reverse.
I'm not aware of anything that converts direct URLs, you'll have to modify the output a little.
-- Legoktm
Am 20.11.2015 um 18:22 schrieb Legoktm:
Kind of.
https://en.wikipedia.org/w/api.php?action=query&titles=Douglas%20Adams&prop=pageprops&formatversion=2 maps a page title on the English Wikipedia to its Wikidata Q id.
You can also look this up directly on wikidata: https://www.wikidata.org/w/api.php?action=wbgetentities&sites=enwiki&titles=Douglas_Adams&props=
https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q42&props=sitelinks will do the reverse.
A bit more terse, and with full URLs in the output: https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q42&props=sitelinks|sitelinks/urls&sitefilter=enwiki
You can also let yourself be redirected directly: https://www.wikidata.org/wiki/Special:GoToLinkedPage/enwiki/Q42
Or the the reverse redirect: https://www.wikidata.org/wiki/Special:ItemByTitle/enwiki/Douglas_Adams
HTH
Daniel,
Ideally, this should be documented somewhere for the wbgetentities. (instead of this email thread)
Thad +ThadGuidry https://www.google.com/+ThadGuidry
On Fri, Nov 20, 2015 at 3:01 PM, Daniel Kinzler <daniel.kinzler@wikimedia.de
wrote:
Am 20.11.2015 um 18:22 schrieb Legoktm:
Kind of.
<
https://en.wikipedia.org/w/api.php?action=query&titles=Douglas%20Adams&a...
maps a page title on the English Wikipedia to its Wikidata Q id.
You can also look this up directly on wikidata: < https://www.wikidata.org/w/api.php?action=wbgetentities&sites=enwiki&...
<
https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q42&prop...
will do the reverse.
A bit more terse, and with full URLs in the output: < https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q42&prop...
You can also let yourself be redirected directly: https://www.wikidata.org/wiki/Special:GoToLinkedPage/enwiki/Q42
Or the the reverse redirect: https://www.wikidata.org/wiki/Special:ItemByTitle/enwiki/Douglas_Adams
HTH
-- Daniel Kinzler Senior Software Developer
Wikimedia Deutschland Gesellschaft zur Förderung Freien Wissens e.V.
Wikidata mailing list Wikidata@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata
Regarding the following query: https://www.wikidata.org/w/api.php?action=wbgetentities&sites=enwiki&...
The desired effect is for it to be redirected to "Multicellular organism", but the redirects doesn't seem to be working, even when putting it explicitly in the URL. Is there a way to cause a redirect with wbgetentities when used with the www.wikidata.org host?
Please advise, James Weaver
On Fri, Nov 20, 2015, at 04:01 PM, Daniel Kinzler wrote:
Am 20.11.2015 um 18:22 schrieb Legoktm:
Kind of.
https://en.wikipedia.org/w/api.php?action=query&titles=Douglas%20Adams&prop=pageprops&formatversion=2 maps a page title on the English Wikipedia to its Wikidata Q id.
You can also look this up directly on wikidata: https://www.wikidata.org/w/api.php?action=wbgetentities&sites=enwiki&titles=Douglas_Adams&props=
https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q42&props=sitelinks will do the reverse.
A bit more terse, and with full URLs in the output: https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q42&props=sitelinks|sitelinks/urls&sitefilter=enwiki
You can also let yourself be redirected directly: https://www.wikidata.org/wiki/Special:GoToLinkedPage/enwiki/Q42
Or the the reverse redirect: https://www.wikidata.org/wiki/Special:ItemByTitle/enwiki/Douglas_Adams
HTH
-- Daniel Kinzler Senior Software Developer
Wikimedia Deutschland Gesellschaft zur Förderung Freien Wissens e.V.
Wikidata mailing list Wikidata@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata
Hi there!
You actually need the normalize parameter (I have no idea where you got a redirect parameter from)
https://www.wikidata.org/w/api.php?action=wbgetentities&sites=enwiki&...
Addshore
On Tue, 8 Dec 2015 at 18:07 james@j1w.xyz wrote:
Regarding the following query:
https://www.wikidata.org/w/api.php?action=wbgetentities&sites=enwiki&...
The desired effect is for it to be redirected to "Multicellular organism", but the redirects doesn't seem to be working, even when putting it explicitly in the URL. Is there a way to cause a redirect with wbgetentities when used with the www.wikidata.org host?
Please advise, James Weaver
On Fri, Nov 20, 2015, at 04:01 PM, Daniel Kinzler wrote:
Am 20.11.2015 um 18:22 schrieb Legoktm:
Kind of.
<
https://en.wikipedia.org/w/api.php?action=query&titles=Douglas%20Adams&a...
maps a page title on the English Wikipedia to its Wikidata Q id.
You can also look this up directly on wikidata: <
https://www.wikidata.org/w/api.php?action=wbgetentities&sites=enwiki&...
<
https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q42&prop...
will do the reverse.
A bit more terse, and with full URLs in the output: <
https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q42&prop...
You can also let yourself be redirected directly: https://www.wikidata.org/wiki/Special:GoToLinkedPage/enwiki/Q42
Or the the reverse redirect: https://www.wikidata.org/wiki/Special:ItemByTitle/enwiki/Douglas_Adams
HTH
-- Daniel Kinzler Senior Software Developer
Wikimedia Deutschland Gesellschaft zur Förderung Freien Wissens e.V.
Wikidata mailing list Wikidata@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata
Wikidata mailing list Wikidata@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata
Am 08.12.2015 um 18:06 schrieb james@j1w.xyz:
Regarding the following query: https://www.wikidata.org/w/api.php?action=wbgetentities&sites=enwiki&...
The desired effect is for it to be redirected to "Multicellular organism", but the redirects doesn't seem to be working, even when putting it explicitly in the URL. Is there a way to cause a redirect with wbgetentities when used with the www.wikidata.org host?
There is no way to get a redirect from the API. You can get a redirected via Special:GoToLinkedPage or Special:ItemByTitle, as described in my mail.
Try this: https://www.wikidata.org/wiki/Special:ItemByTitle/enwiki/Multicellular