class WikidataPositionHistory::SPARQL::BioQuery

SPARQL for fetching biographical about all holders of a position

This is distinct from the mandate query itself to avoid complex GROUP BY scenarios where people have multiple values for biographical properties.

Public Instance Methods

raw_sparql() click to toggle source
# File lib/sparql/bio_query.rb, line 11
      def raw_sparql
        <<~SPARQL
          # holder-biodata

          SELECT DISTINCT ?item ?image
          WHERE {
            ?item wdt:P31 wd:Q5 ; p:P39/ps:P39 wd:%s .
            OPTIONAL { ?item wdt:P18 ?image }
          }
          ORDER BY ?item
        SPARQL
      end