Class: WikidataPositionHistory::SPARQL::BioQuery

Inherits:
ItemQuery
  • Object
show all
Defined in:
lib/sparql/bio_query.rb

Overview

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.

Instance Method Summary collapse

Methods inherited from ItemQuery

#initialize, #results_as, #wdqs_url

Constructor Details

This class inherits a constructor from WikidataPositionHistory::SPARQL::ItemQuery

Instance Method Details

#raw_sparqlObject



11
12
13
14
15
16
17
18
19
20
21
22
# 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