query: # population of New York City, including sources
  #defaultView:LineChart
  SELECT ?time ?population (GROUP_CONCAT(?sourceLabel; separator = "; ") AS ?sources) WHERE {
    wd:Q60 p:P1082 [
      ps:P1082 ?population;
      pq:P585 ?time;
      prov:wasDerivedFrom ?reference
    ].
    OPTIONAL { ?reference pr:P248 ?statedIn. }
    OPTIONAL { ?reference pr:P854 ?referenceUrl. }
    BIND(COALESCE(?statedIn, ?referenceUrl) AS ?source)
    FILTER(BOUND(?source)) # we don’t want references which have neither “stated in” nor “reference URL”
    SERVICE wikibase:label {
      bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
      ?source rdfs:label ?sourceLabel.
    }
  }
  GROUP BY ?time ?population