query: # families who’ve had the same occupation for five generations
  SELECT DISTINCT ?occupationLabel ?person1Label ?person2Label ?person3Label ?person4Label ?person5Label WHERE {
    wd:Q5 ^wdt:P31 ?person1, ?person2, ?person3, ?person4, ?person5.
    ?person1 wdt:P22|wdt:P25 ?person2.
    ?person2 wdt:P22|wdt:P25 ?person3.
    ?person3 wdt:P22|wdt:P25 ?person4.
    ?person4 wdt:P22|wdt:P25 ?person5.
    ?occupation ^wdt:P106 ?person1, ?person2, ?person3, ?person4, ?person5.
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
  }