wikidata_position_history 1.8.0 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5c2ddb3cb683a9510a52f729a3d49afbf98eddd62b45550fd836b69902dbdb9
4
- data.tar.gz: e3c99ce76017a543011b0cd8f10f1d0858b27678a5f878a44076f74d82070c71
3
+ metadata.gz: 6a2bc5a49d34a368363b7e92ec9e1b0d08b141d96babd15eccf2913d99e9b7b0
4
+ data.tar.gz: 87594145f811917672fd4772722e086907d508479d73b43bfb21a0aac24e5d27
5
5
  SHA512:
6
- metadata.gz: 1b97796606a4d6877705a058e17c4b1f112fc9c0621054a479492c3cc9cc5f20477fb9842c54641f6fe79d3f78e205f5433944e2ac598cfe162ca7a5ea155b9c
7
- data.tar.gz: 0a5c78cb1e497494fd35102ace5edfac6942d1cbb958d74ec502b36ca70c06503045e7693a4c8423730f3c5d9c0ff371b18a1c504fc9cc8807afc5389e61670b
6
+ metadata.gz: 6eb361e602c3a34c97bd8b584b4029135d9bb8e14c1f99b2ed513ce049f8df780c9b09ac31941c31a7ebea544d0a6cc0065cb2210bc4af4448de66cfb40800c0
7
+ data.tar.gz: 1b07fb333e1f13d25985420ec6700f2b0dc81dc98a5c4a762713bcf8426c532b48e28f6d80646d7c5ea85692f63e921748a603708e4d9e7286f254bc8c665e21
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ # [1.9.0] 2020-09-11
4
+
5
+ ## Enhancements
6
+
7
+ * If a position has any successor or predecessor offices (in "replaces"
8
+ (P1365) or "replaced by" (P1366)) the report will now display those.
9
+
3
10
  # [1.8.0] 2020-09-09
4
11
 
5
12
  ## Enhancements
@@ -8,7 +8,8 @@ module WikidataPositionHistory
8
8
  <<~SPARQL
9
9
  # position-metadata
10
10
 
11
- SELECT DISTINCT ?item ?inception ?inception_precision ?abolition ?abolition_precision
11
+ SELECT DISTINCT ?item ?inception ?inception_precision ?abolition ?abolition_precision
12
+ ?replaces ?replacedBy
12
13
  ?isPosition ?isLegislator
13
14
  WHERE {
14
15
  VALUES ?item { wd:%s }
@@ -20,7 +21,8 @@ module WikidataPositionHistory
20
21
  OPTIONAL { ?item p:P576 [ a wikibase:BestRank ;
21
22
  psv:P576 [ wikibase:timeValue ?abolition; wikibase:timePrecision ?abolition_precision ]
22
23
  ] }
23
- SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
24
+ OPTIONAL { ?item wdt:P1365 ?replaces }
25
+ OPTIONAL { ?item wdt:P1366 ?replacedBy }
24
26
  }
25
27
  SPARQL
26
28
  end
@@ -53,6 +55,18 @@ module WikidataPositionHistory
53
55
  QueryService::WikidataDate.new(abolition_date_raw, abolition_date_precision)
54
56
  end
55
57
 
58
+ def replaces
59
+ return if replaces_raw.to_s.empty?
60
+
61
+ QueryService::WikidataItem.new(replaces_raw)
62
+ end
63
+
64
+ def replaced_by
65
+ return if replaced_by_raw.to_s.empty?
66
+
67
+ QueryService::WikidataItem.new(replaced_by_raw)
68
+ end
69
+
56
70
  def position?
57
71
  row.dig(:isPosition, :value) == 'true'
58
72
  end
@@ -65,6 +79,14 @@ module WikidataPositionHistory
65
79
 
66
80
  attr_reader :row
67
81
 
82
+ def replaces_raw
83
+ row.dig(:replaces, :value)
84
+ end
85
+
86
+ def replaced_by_raw
87
+ row.dig(:replacedBy, :value)
88
+ end
89
+
68
90
  def inception_date_raw
69
91
  row.dig(:inception, :value).to_s[0..9]
70
92
  end
@@ -55,6 +55,18 @@ module WikidataPositionHistory
55
55
  rows.map(&:item).first
56
56
  end
57
57
 
58
+ def replaces
59
+ return if replaces_list.empty?
60
+
61
+ replaces_list.map(&:qlink).join(', ')
62
+ end
63
+
64
+ def replaced_by
65
+ return if replaced_by_list.empty?
66
+
67
+ replaced_by_list.map(&:qlink).join(', ')
68
+ end
69
+
58
70
  def inception_date
59
71
  return if inception_dates.empty?
60
72
 
@@ -96,6 +108,14 @@ module WikidataPositionHistory
96
108
 
97
109
  attr_reader :rows
98
110
 
111
+ def replaces_list
112
+ rows.map(&:replaces).compact.uniq(&:id).sort_by(&:id)
113
+ end
114
+
115
+ def replaced_by_list
116
+ rows.map(&:replaced_by).compact.uniq(&:id).sort_by(&:id)
117
+ end
118
+
99
119
  def inception_dates
100
120
  rows.map(&:inception_date).compact.uniq(&:to_s).sort
101
121
  end
@@ -24,12 +24,24 @@ module WikidataPositionHistory
24
24
  {| class="wikitable" style="text-align: center; border: none;"
25
25
  <% if metadata.abolition_date -%>
26
26
  |-
27
- | colspan="3" style="padding:0.5em 2em; border: none; background: #fff; font-size: 1.25em; text-align: right;" | '''Position abolished''': <%= metadata.abolition_date %>
28
- | style="padding:0.5em 2em 0.5em 1em; border: none; background: #fff; text-align: left;" | \
27
+ | colspan="2" style="border: none; background: #fff; font-size: 1.15em; text-align: right;" | '''Position abolished''':
28
+ | style="border: none; background: #fff; text-align: left;" | <%= metadata.abolition_date %>
29
+ | style="border: none; background: #fff; text-align: left;" | \
29
30
  <% [metadata.abolition_warning].compact.each do |warning| -%>
30
31
  <span style="display: block">[[File:Pictogram voting comment.svg|15px|link=]]&nbsp;<span style="color: #d33; font-weight: bold; vertical-align: middle;"><%= warning.headline %></span>&nbsp;<ref><%= warning.explanation %></ref></span>\
31
32
  <% end %>
32
33
  <% end -%>
34
+ <% if metadata.replaced_by -%>
35
+ |-
36
+ | colspan="2" style="border: none; background: #fff; font-size: 1.15em; text-align: right;" | '''Replaced by''':
37
+ | style=" border: none; background: #fff; text-align: left;" | <%= metadata.replaced_by %>
38
+ | style=" border: none; background: #fff; text-align: left;" |
39
+ <% end -%>
40
+ <% if metadata.replaced_by || metadata.abolition_date -%>
41
+ |-
42
+ | colspan="3" style="padding:0.5em; border: none; background: #fff"> |&nbsp;
43
+ | colspan="1" style="padding:0.5em; border: none; background: #fff"> |&nbsp;
44
+ <% end -%>
33
45
  <% table_rows.map(&:values).each do |mandate, bio| -%>
34
46
  |-
35
47
  | style="padding:0.5em 2em" | <%= mandate.ordinal_string %>
@@ -40,14 +52,26 @@ module WikidataPositionHistory
40
52
  <span style="display: block">[[File:Pictogram voting comment.svg|15px|link=]]&nbsp;<span style="color: #d33; font-weight: bold; vertical-align: middle;"><%= warning.headline %></span>&nbsp;<ref><%= warning.explanation %></ref></span>\
41
53
  <% end %>
42
54
  <% end -%>
55
+ <% if metadata.replaced_by || metadata.abolition_date -%>
56
+ |-
57
+ | colspan="3" style="padding:0.5em; border: none; background: #fff"> |&nbsp;
58
+ | colspan="1" style="padding:0.5em; border: none; background: #fff"> |&nbsp;
59
+ <% end -%>
43
60
  <% if metadata.inception_date -%>
44
61
  |-
45
- | colspan="3" style="padding:0.5em 2em; border: none; background: #fff; font-size: 1.25em; text-align: right;" | '''Position created''': <%= metadata.inception_date %>
62
+ | colspan="2" style="border: none; background: #fff; font-size: 1.15em; text-align: right;" | '''Position created''':
63
+ | style="border: none; background: #fff; text-align: left;" | <%= metadata.inception_date %>
46
64
  | style="padding:0.5em 2em 0.5em 1em; border: none; background: #fff; text-align: left;" | \
47
65
  <% [metadata.inception_warning].compact.each do |warning| -%>
48
66
  <span style="display: block">[[File:Pictogram voting comment.svg|15px|link=]]&nbsp;<span style="color: #d33; font-weight: bold; vertical-align: middle;"><%= warning.headline %></span>&nbsp;<ref><%= warning.explanation %></ref></span>\
49
67
  <% end %>
50
68
  <% end -%>
69
+ <% if metadata.replaces -%>
70
+ |-
71
+ | colspan="2" style=" border: none; background: #fff; font-size: 1.15em; text-align: right;" | '''Replaces''':
72
+ | style="border: none; background: #fff; text-align: left;" | <%= metadata.replaces %>
73
+ | style="padding:0.5em 2em 0.5em 1em; border: none; background: #fff; text-align: left;" |
74
+ <% end -%>
51
75
  |}
52
76
 
53
77
  <div style="margin-bottom:5px; border-bottom:3px solid #2f74d0; font-size:8pt">
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WikidataPositionHistory
4
- VERSION = '1.8.0'
4
+ VERSION = '1.9.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wikidata_position_history
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Bowden
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-09-09 00:00:00.000000000 Z
12
+ date: 2020-09-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mediawiki-replaceable-content