This StackExchange answer describes how to get site links:

http://opendata.stackexchange.com/questions/6050/get-wikipedia-urls-sitelinks-in-wikidata-sparql-query#

You could graft in the appropriate clause from that answer to get enwiki
sitelinks.  It looks like there are a total of 37092 Twitter handles, of
which 29945 have links to enwiki and 29930 have an English label as well
(of course you could get the English names for the others by looking at the
title of the Wikipedia article).

Two things to be aware of are that this isn't a one-to-one correspondence
and the quality of the links varies, so, for example, @ADFP_Peru has 7
English wikipedia articles nominally "about" it, but none of them actually
describe the Peruvian professional football association. That article is
the rather generically named
https://en.wikipedia.org/wiki/Professional_Football_Sports_Association

There are only ~160 Twitter accounts with multiple articles though.  All 22
the links for the account @status should be ignored as their the result of
a bots bad parse of things like the link to
https://twitter.com/WAFCA/status/410033143148978176 in
https://en.wikipedia.org/wiki/Tye_Sheridan#cite_note-22

Tom

prefix schema: <http://schema.org/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?Twitter ?item ?item_label ?article WHERE {
  {?item wdt:P2002 ?Twitter FILTER(?Twitter = "ADFP_Peru") }
  {?item rdfs:label ?item_label filter (lang(?item_label) = "en") .}
  {
      ?article schema:about ?item .
      FILTER (SUBSTR(str(?article), 1, 25) = "https://en.wikipedia.org/";)
  }
}



On Mon, Nov 9, 2015 at 12:25 PM, Hampton Snowball <hamptonsnowb...@gmail.com
> wrote:

> Thank you for doing what you could! In terms of wikipedia links it does
> look like the wikidata records do link to wikpedia, e.g. at the bottom of
> this record:
>
> https://www.wikidata.org/wiki/Q25369
>
> Since there is multiple wikpedia entries, I guess I'd be going for the
> "en" english one.
>
> Best,
> HS
>
>
> On Mon, Nov 9, 2015 at 12:18 PM, Remko de Keijzer <re...@remkodekeijzer.nl
> > wrote:
>
>> No. The label is the label in Wikidata. Not a sitelink. You're not
>> querying Wikipedia, but Wikidata.
>> If you really need the sitelink, I hope someone else can help you
>> further, since I'm a mere beginner at SPARQL and was happy I could get this
>> result.
>>
>> --
>> Mbch331
>>
>> When you have eliminated the impossible, whatever remains, however 
>> improbable, must be the truth.
>> (Sir Arthur Conan Doyle)
>>
>> Op 9-11-2015 om 18:13 schreef Hampton Snowball:
>>
>> Maybe I misunderstood.  I think the item label is actually what's used in
>> the wikipedia article url, just convert spaces to underscores?
>>
>> Thanks!
>>
>> On Mon, Nov 9, 2015 at 11:47 AM, Hampton Snowball <
>> <hamptonsnowb...@gmail.com>hamptonsnowb...@gmail.com> wrote:
>>
>>> Thank you. Is there a way to export it though with the Wikipedia Article
>>> name with underscores or wikipedia url?  So like Barack_Obama or
>>> en.wikipedia.org/wiki/Barack_Obama.
>>>
>>> On Mon, Nov 9, 2015 at 11:34 AM, Remko de Keijzer <
>>> <re...@remkodekeijzer.nl>re...@remkodekeijzer.nl> wrote:
>>>
>>>> I think this: http://tinyurl.com/o5lahko is what you wanted. It's got
>>>> the item ID, the label and the value of P2002.
>>>>
>>>> --
>>>> Mbch331
>>>>
>>>> When you have eliminated the impossible, whatever remains, however 
>>>> improbable, must be the truth.
>>>> (Sir Arthur Conan Doyle)
>>>>
>>>> Op 9-11-2015 om 17:09 schreef Hampton Snowball:
>>>>
>>>> I'm looking to use the  <https://query.wikidata.org/>
>>>> https://query.wikidata.org/ interface to export to csv all wikidatas
>>>> with this property P2002.
>>>>
>>>>
>>>> <https://www.wikidata.org/w/index.php?title=Special:WhatLinksHere/Property:P2002&limit=500&from=21542767&back=20967485>
>>>> https://www.wikidata.org/w/index.php?title=Special:WhatLinksHere/Property:P2002&limit=500&from=21542767&back=20967485
>>>>
>>>> I am looking for the Wikipedia Article_Name + the value associated with
>>>> that property.
>>>>
>>>> Thanks in advance!
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Wikidata mailing 
>>>> listWikidata@lists.wikimedia.orghttps://lists.wikimedia.org/mailman/listinfo/wikidata
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Wikidata mailing list
>>>> Wikidata@lists.wikimedia.org
>>>> https://lists.wikimedia.org/mailman/listinfo/wikidata
>>>>
>>>>
>>>
>>
>>
>> _______________________________________________
>> Wikidata mailing 
>> listWikidata@lists.wikimedia.orghttps://lists.wikimedia.org/mailman/listinfo/wikidata
>>
>>
>>
>> _______________________________________________
>> 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
>
>
_______________________________________________
Wikidata mailing list
Wikidata@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata

Reply via email to