Class: WikidataPositionHistory::MandateRow

Inherits:
SPARQL::QueryRow show all
Defined in:
lib/sparql/mandates_query.rb

Overview

Represents a single row returned from the Mandates query

Instance Method Summary collapse

Methods inherited from SPARQL::QueryRow

#initialize

Constructor Details

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

Instance Method Details

#acting?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/sparql/mandates_query.rb', line 60

def acting?
  nature == 'Q4676846'
end

#end_dateObject



68
69
70
# File 'lib/sparql/mandates_query.rb', line 68

def end_date
  date_from(:end_date, :end_precision)
end

#itemObject

TODO: rename or remove. ‘item’ is meaningless/ambiguous



41
42
43
# File 'lib/sparql/mandates_query.rb', line 41

def item
  officeholder.qlink
end

#natureObject

TODO: switch to item_from



56
57
58
# File 'lib/sparql/mandates_query.rb', line 56

def nature
  QueryService::WikidataItem.new(row.dig(:nature, :value)).id
end

#nextObject

TODO: switch to item_from



51
52
53
# File 'lib/sparql/mandates_query.rb', line 51

def next
  QueryService::WikidataItem.new(row.dig(:next, :value)).qlink
end

#officeholderObject



36
37
38
# File 'lib/sparql/mandates_query.rb', line 36

def officeholder
  item_from(:item)
end

#ordinalObject



32
33
34
# File 'lib/sparql/mandates_query.rb', line 32

def ordinal
  raw(:ordinal)
end

#prevObject

TODO: switch to item_from



46
47
48
# File 'lib/sparql/mandates_query.rb', line 46

def prev
  QueryService::WikidataItem.new(row.dig(:prev, :value)).qlink
end

#start_dateObject



64
65
66
# File 'lib/sparql/mandates_query.rb', line 64

def start_date
  date_from(:start_date, :start_precision)
end