0

I am trying to get some lists of data from Wikipedia. So I am using Wikidata SPARQL query service. What I need to know is how can I fetch the data from the URL (Wikipedia page URL). Currently I am searching from name. Following is my query,

SELECT DISTINCT ?item ?itemLabel ?birthLocation ?birthLocationLabel WHERE {
  ?item (wdt:P31|wdt:P101|wdt:P106)/wdt:P279* wd:Q482980 ;
        rdfs:label "Enid Blyton"@en ;
        wdt:P19 ?birthLocation
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}

I need to search by URL instead of name. How can I achieve this? And also is that possible to get the sub links from the URL. I tried by I couldn't find any way to get them. So anybody can tell me what I am doing wrong here? I highly appreciate that. Thank you.

logi-kal
  • 7,107
  • 6
  • 31
  • 43
H Athukorala
  • 739
  • 11
  • 32
  • 2
    `SELECT DISTINCT ?item ?itemLabel ?birthLocation ?birthLocationLabel WHERE { schema:about ?item . ?item wdt:P19 ?birthLocation SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }` – UninformedUser Apr 29 '20 at 06:39
  • @UninformedUser It's working perfectly. Thank you very much. If you can post this as an answer. I can accept this as the answer. – H Athukorala Apr 29 '20 at 07:38
  • @UninformedUser And also how can I get the URL again as article field? – H Athukorala Apr 29 '20 at 08:56
  • 1
    `SELECT DISTINCT ?url ?item ?itemLabel ?birthLocation ?birthLocationLabel WHERE { VALUES ?url { } ?url schema:about ?item . ?item wdt:P19 ?birthLocation SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }` - feel free to answer your own question if you think this query works as intended. – UninformedUser Apr 29 '20 at 09:14
  • @UninformedUser It worked perfectly. Thank you. And yes sure I will post this as the answer. – H Athukorala May 01 '20 at 17:29

0 Answers0