Hi Kanishk,

Weird co-incidence.. that was the query we used to learn about using 
wikidata's query engine in a wikidata workshop in pune last year.

Disclaimer : I will not be able to take out more time than this to explain 
in a text medium. We can talk it over a screenshare if you need more help 
with this. Will give one tip: Drive the car, don't try to understand how 
the engine works at the beginning.

Indian politicians whose fathers were also politicians
http://tinyurl.com/y969tbvg

# Indian politicians whose fathers were also politicians
SELECT ?child ?childLabel ?father ?fatherLabel
WHERE 
{
  ?child wdt:P31 wd:Q5 . # human
  ?child wdt:P27 wd:Q668 . # Indian nationals
  ?child wdt:P106 wd:Q82955 . # ...who are politicians
  ?child wdt:P22   ?father . # ...who have *a* father
  ?father wdt:P106 wd:Q82955 . # ...who himself is also a politician
  
    SERVICE wikibase:label { bd:serviceParam wikibase:language 
"[AUTO_LANGUAGE],en". }
}


"P22" would be your focus here. that's the "father" property.

Wikidata property browser: http://tools.wmflabs.org/hay/propbrowse/
That page gives a good listing of all properties in wikidata (a property is 
the glue that links two wikidata entries together)

"P25" stands for mother. "P3373" : sibling. "P40" : child

There is a "P1038" for "relative", but that only gives 8 results in this 
query. Still, good to include that in case the other queries missed those 
data points.


-Nikhil VJ
Pune, India


On Monday, November 12, 2018 at 5:59:15 PM UTC+5:30, Kanishk Karan wrote:
>
> Hi, 
>
> Can anyone help me with this:
> I am wondering if it is possible to build a network of Indian politicians' 
> relatives who are politicians themselves, also highlighting a column of 
> which political parties they belong to?
>
> I am using Wikidata 
> <https://www.wikidata.org/wiki/Wikidata:WikiProject_every_politician/India>, 
> but not sure, how to go about it. Any help would be much appreciated. 
>
> Thanks. 
> Kanishk Karan
>
>
>

-- 
Datameet is a community of Data Science enthusiasts in India. Know more about 
us by visiting http://datameet.org
--- 
You received this message because you are subscribed to the Google Groups 
"datameet" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to