query: select ?work ?workLabel ?year ?typeLabel ?namesake ?namesakeLabel ?birthyear ?deathyear
  where {
    ?work wdt:P31 ?type . ?type wdt:P279* wd:Q7366 .
    # work is a type of song or poem
    ?work wdt:P138 ?namesake . ?namesake wdt:P31 wd:Q5 . 
    # named after a person
    optional { ?namesake wdt:P569 ?born . bind(year(?born) as ?birthyear) }
    optional { ?namesake wdt:P570 ?died . bind(year(?died) as ?deathyear) }
    optional { ?work wdt:P577|wdt:P571 ?date . bind(year(?date) as ?year) }
    # dates
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
  