wikidata_position_history 1.4.2 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +79 -0
- data/lib/query_service.rb +17 -6
- data/lib/sparql/{bio_data.rb → bio_query.rb} +2 -2
- data/lib/sparql/item_query.rb +5 -1
- data/lib/sparql/{mandates.rb → mandates_query.rb} +3 -3
- data/lib/sparql/{position_data.rb → position_query.rb} +28 -6
- data/lib/wikidata_position_history.rb +3 -3
- data/lib/wikidata_position_history/checks.rb +37 -5
- data/lib/wikidata_position_history/report.rb +86 -17
- data/lib/wikidata_position_history/template.rb +26 -4
- data/lib/wikidata_position_history/version.rb +1 -1
- data/wikidata_position_history.gemspec +2 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5c2ddb3cb683a9510a52f729a3d49afbf98eddd62b45550fd836b69902dbdb9
|
4
|
+
data.tar.gz: e3c99ce76017a543011b0cd8f10f1d0858b27678a5f878a44076f74d82070c71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b97796606a4d6877705a058e17c4b1f112fc9c0621054a479492c3cc9cc5f20477fb9842c54641f6fe79d3f78e205f5433944e2ac598cfe162ca7a5ea155b9c
|
7
|
+
data.tar.gz: 0a5c78cb1e497494fd35102ace5edfac6942d1cbb958d74ec502b36ca70c06503045e7693a4c8423730f3c5d9c0ff371b18a1c504fc9cc8807afc5389e61670b
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,84 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
# [1.8.0] 2020-09-09
|
4
|
+
|
5
|
+
## Enhancements
|
6
|
+
|
7
|
+
* If the very latest person we know of having held this position also
|
8
|
+
has a 'replaced by' qualifier, that’s a sign that the successor should
|
9
|
+
really also have a suitable P39, and actually appear here too. So we
|
10
|
+
want to display a warning in such cases. Likewise if the earliest person
|
11
|
+
we know if also has a 'replaces'
|
12
|
+
|
13
|
+
* This report is meant to be used with positions that are held by only a
|
14
|
+
single person at a time. Using it to produce a report of everyone who
|
15
|
+
has been, say, a Member of the UK Parliament, is the sort of thing that
|
16
|
+
will cause all manner of havoc, as it will try to display tens of
|
17
|
+
thousands of people, all of whom have overlaps with other members etc.
|
18
|
+
So we now sanity-check first of all that the position isn't legislative,
|
19
|
+
and produce a nice "Don’t do that!" message in such cases.
|
20
|
+
|
21
|
+
* It seems that the recent ability to handle dates that are only know at
|
22
|
+
decade-level precision isn’t actually enough, as we have some that we
|
23
|
+
only know at century-level precision! (For example, that the position of
|
24
|
+
Lord Chancellor of Ireland was created some time in the 12th Century.)
|
25
|
+
Such dates will now appear in a nicer format.
|
26
|
+
|
27
|
+
* Sometimes updating the table looks like something has changed, but
|
28
|
+
really the only difference is that a few of people who have no dates
|
29
|
+
are shuffled around a bit in the list. This is because we previously
|
30
|
+
only sorted by date order, so people with no dates were effectively in a
|
31
|
+
random order. Now we sort those people by ID too, which should minimise
|
32
|
+
the number of times an update will appear in your watchlist, only to
|
33
|
+
discover nothing significant actually happened.
|
34
|
+
|
35
|
+
# [1.7.0] 2020-09-08
|
36
|
+
|
37
|
+
## Enchancements
|
38
|
+
|
39
|
+
* Yesterday’s future, when we said we’d do something a little better
|
40
|
+
with positions that have multiple inception or abolition dates, has
|
41
|
+
arrived. Now we display all of them (with a warning), rather than just
|
42
|
+
picking one semi-randomly.
|
43
|
+
|
44
|
+
## Improvements
|
45
|
+
|
46
|
+
* A query like https://w.wiki/bVz is taking about 6 seconds to run.
|
47
|
+
Changing that to https://w.wiki/bW3 drops that to about half a second.
|
48
|
+
If you were to guess that the first has now been replaced by the
|
49
|
+
second, you’d be entirely correct.
|
50
|
+
|
51
|
+
# [1.6.0] 2020-09-07
|
52
|
+
|
53
|
+
## Enhancements
|
54
|
+
|
55
|
+
* If a position has an inception date and/or abolition date, those will
|
56
|
+
now also be displayed. (If a position has more than one of either of
|
57
|
+
those — which really shouldn’t happen, but sometimes does — then the
|
58
|
+
behaviour may not be particularly sensible. Later evolutions of this
|
59
|
+
feature will hopefully handle that better.)
|
60
|
+
|
61
|
+
## Fixes
|
62
|
+
|
63
|
+
* Previously, any warnings would be displayed at the bottom of the page,
|
64
|
+
which was fine if this table was the only thing on the page, but would
|
65
|
+
be slightly odd if there was other discussion after it. Now the
|
66
|
+
footnotes are explicitly displayed immediately after the table.
|
67
|
+
|
68
|
+
# [1.5.0] 2020-09-06
|
69
|
+
|
70
|
+
## Enhancements
|
71
|
+
|
72
|
+
* When showing the results for a position from long long ago (such as
|
73
|
+
the High Kings of Ireland), display the dates as "862 – 879" not as
|
74
|
+
"0862 – 0879"
|
75
|
+
* If we only know that someone took (or left) office sometime in a given
|
76
|
+
decade (i.e. at date precision 8), display that as (say) "1930s"
|
77
|
+
|
78
|
+
## Fixes
|
79
|
+
|
80
|
+
* No longer blows up when a P39 has a start date, but no end date
|
81
|
+
|
3
82
|
# [1.4.2] 2020-09-05
|
4
83
|
|
5
84
|
## Fixes
|
data/lib/query_service.rb
CHANGED
@@ -54,6 +54,8 @@ module QueryService
|
|
54
54
|
class WikidataDate
|
55
55
|
include Comparable
|
56
56
|
|
57
|
+
DATELEN = { '11' => 10, '10' => 7, '9' => 4, '8' => 4, '7' => 2 }.freeze
|
58
|
+
|
57
59
|
def initialize(str, precision)
|
58
60
|
@str = str
|
59
61
|
@raw_precision = precision.to_s
|
@@ -66,12 +68,7 @@ module QueryService
|
|
66
68
|
end
|
67
69
|
|
68
70
|
def to_s
|
69
|
-
|
70
|
-
return str[0..6] if precision == '10'
|
71
|
-
return str[0..3] if precision == '9'
|
72
|
-
|
73
|
-
warn "Cannot handle precision #{precision} for #{str}"
|
74
|
-
str
|
71
|
+
precisioned_string.delete_prefix('0')
|
75
72
|
end
|
76
73
|
|
77
74
|
def empty?
|
@@ -99,5 +96,19 @@ module QueryService
|
|
99
96
|
def parts
|
100
97
|
to_s.split('-')
|
101
98
|
end
|
99
|
+
|
100
|
+
def truncated_string
|
101
|
+
return str[0...DATELEN[precision]] if DATELEN.key?(precision)
|
102
|
+
|
103
|
+
warn "Cannot handle precision #{precision} for #{str}"
|
104
|
+
str
|
105
|
+
end
|
106
|
+
|
107
|
+
def precisioned_string
|
108
|
+
return "#{truncated_string}. century" if precision == '7'
|
109
|
+
return "#{truncated_string}s" if precision == '8'
|
110
|
+
|
111
|
+
truncated_string
|
112
|
+
end
|
102
113
|
end
|
103
114
|
end
|
@@ -7,7 +7,7 @@ module WikidataPositionHistory
|
|
7
7
|
# This is distinct from the mandate query itself to avoid complex
|
8
8
|
# GROUP BY scenarios where people have multiple values for
|
9
9
|
# biographical properties.
|
10
|
-
class
|
10
|
+
class BioQuery < ItemQuery
|
11
11
|
def raw_sparql
|
12
12
|
<<~SPARQL
|
13
13
|
# holder-biodata
|
@@ -24,7 +24,7 @@ module WikidataPositionHistory
|
|
24
24
|
end
|
25
25
|
|
26
26
|
# Represents a single row returned from the Position query
|
27
|
-
class
|
27
|
+
class BioRow
|
28
28
|
def initialize(row)
|
29
29
|
@row = row
|
30
30
|
end
|
data/lib/sparql/item_query.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module WikidataPositionHistory
|
4
4
|
module SPARQL
|
5
5
|
# SPARQL for fetching all officeholdings of a position
|
6
|
-
class
|
6
|
+
class MandatesQuery < ItemQuery
|
7
7
|
def raw_sparql
|
8
8
|
<<~SPARQL
|
9
9
|
# position-mandates
|
@@ -21,14 +21,14 @@ module WikidataPositionHistory
|
|
21
21
|
OPTIONAL { ?posn pq:P1545 ?ordinal }
|
22
22
|
OPTIONAL { ?posn pq:P5102 ?nature }
|
23
23
|
}
|
24
|
-
ORDER BY DESC(?start_date)
|
24
|
+
ORDER BY DESC(?start_date) ?item
|
25
25
|
SPARQL
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
# Represents a single row returned from the Mandates query
|
31
|
-
class
|
31
|
+
class MandateRow
|
32
32
|
def initialize(row)
|
33
33
|
@row = row
|
34
34
|
end
|
@@ -3,35 +3,53 @@
|
|
3
3
|
module WikidataPositionHistory
|
4
4
|
module SPARQL
|
5
5
|
# SPARQL for fetching metadata about a position
|
6
|
-
class
|
6
|
+
class PositionQuery < ItemQuery
|
7
7
|
def raw_sparql
|
8
8
|
<<~SPARQL
|
9
9
|
# position-metadata
|
10
10
|
|
11
|
-
SELECT DISTINCT ?inception ?inception_precision ?abolition ?abolition_precision
|
11
|
+
SELECT DISTINCT ?item ?inception ?inception_precision ?abolition ?abolition_precision
|
12
|
+
?isPosition ?isLegislator
|
12
13
|
WHERE {
|
13
14
|
VALUES ?item { wd:%s }
|
14
|
-
BIND(EXISTS {
|
15
|
-
|
16
|
-
OPTIONAL { ?item p:
|
15
|
+
BIND(EXISTS { wd:%s wdt:P279+ wd:Q4164871 } as ?isPosition)
|
16
|
+
BIND(EXISTS { wd:%s wdt:P279+ wd:Q4175034 } as ?isLegislator)
|
17
|
+
OPTIONAL { ?item p:P571 [ a wikibase:BestRank ;
|
18
|
+
psv:P571 [ wikibase:timeValue ?inception; wikibase:timePrecision ?inception_precision ]
|
19
|
+
] }
|
20
|
+
OPTIONAL { ?item p:P576 [ a wikibase:BestRank ;
|
21
|
+
psv:P576 [ wikibase:timeValue ?abolition; wikibase:timePrecision ?abolition_precision ]
|
22
|
+
] }
|
17
23
|
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
|
18
24
|
}
|
19
25
|
SPARQL
|
20
26
|
end
|
27
|
+
|
28
|
+
def sparql_args
|
29
|
+
[itemid] * 3
|
30
|
+
end
|
21
31
|
end
|
22
32
|
end
|
23
33
|
|
24
34
|
# Represents a single row returned from the Position query
|
25
|
-
class
|
35
|
+
class PositionRow
|
26
36
|
def initialize(row)
|
27
37
|
@row = row
|
28
38
|
end
|
29
39
|
|
40
|
+
def item
|
41
|
+
QueryService::WikidataItem.new(row.dig(:item, :value))
|
42
|
+
end
|
43
|
+
|
30
44
|
def inception_date
|
45
|
+
return if inception_date_raw.empty?
|
46
|
+
|
31
47
|
QueryService::WikidataDate.new(inception_date_raw, inception_date_precision)
|
32
48
|
end
|
33
49
|
|
34
50
|
def abolition_date
|
51
|
+
return if abolition_date_raw.empty?
|
52
|
+
|
35
53
|
QueryService::WikidataDate.new(abolition_date_raw, abolition_date_precision)
|
36
54
|
end
|
37
55
|
|
@@ -39,6 +57,10 @@ module WikidataPositionHistory
|
|
39
57
|
row.dig(:isPosition, :value) == 'true'
|
40
58
|
end
|
41
59
|
|
60
|
+
def legislator?
|
61
|
+
row.dig(:isLegislator, :value) == 'true'
|
62
|
+
end
|
63
|
+
|
42
64
|
private
|
43
65
|
|
44
66
|
attr_reader :row
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'query_service'
|
4
4
|
require 'sparql/item_query'
|
5
|
-
require 'sparql/
|
6
|
-
require 'sparql/
|
7
|
-
require 'sparql/
|
5
|
+
require 'sparql/position_query'
|
6
|
+
require 'sparql/bio_query'
|
7
|
+
require 'sparql/mandates_query'
|
8
8
|
require 'wikidata_position_history/checks'
|
9
9
|
require 'wikidata_position_history/template'
|
10
10
|
require 'wikidata_position_history/report'
|
@@ -25,11 +25,11 @@ module WikidataPositionHistory
|
|
25
25
|
current.prev
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
28
|
+
def later_holder?
|
29
29
|
!!later
|
30
30
|
end
|
31
31
|
|
32
|
-
def
|
32
|
+
def earlier_holder?
|
33
33
|
!!earlier
|
34
34
|
end
|
35
35
|
end
|
@@ -92,7 +92,7 @@ module WikidataPositionHistory
|
|
92
92
|
# Does the 'replaces' match the previous item in the list?
|
93
93
|
class WrongPredecessor < Check
|
94
94
|
def problem?
|
95
|
-
|
95
|
+
earlier_holder? && !!predecessor && (earlier.item != predecessor)
|
96
96
|
end
|
97
97
|
|
98
98
|
def headline
|
@@ -104,10 +104,25 @@ module WikidataPositionHistory
|
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
107
|
+
# Is there a 'replaces' but no previous item in the list?
|
108
|
+
class MissingPredecessor < Check
|
109
|
+
def problem?
|
110
|
+
predecessor && !earlier_holder?
|
111
|
+
end
|
112
|
+
|
113
|
+
def headline
|
114
|
+
'Inconsistent predecessor'
|
115
|
+
end
|
116
|
+
|
117
|
+
def possible_explanation
|
118
|
+
"#{current.item} has a {{P|1365}} of #{predecessor}, but does not follow anyone here"
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
107
122
|
# Does the 'replaced by' match the next item in the list?
|
108
123
|
class WrongSuccessor < Check
|
109
124
|
def problem?
|
110
|
-
|
125
|
+
later_holder? && !!successor && (later.item != successor)
|
111
126
|
end
|
112
127
|
|
113
128
|
def headline
|
@@ -119,13 +134,30 @@ module WikidataPositionHistory
|
|
119
134
|
end
|
120
135
|
end
|
121
136
|
|
137
|
+
# Is there a 'replaced by' but no next item in the list?
|
138
|
+
class MissingSuccessor < Check
|
139
|
+
def problem?
|
140
|
+
successor && !later_holder?
|
141
|
+
end
|
142
|
+
|
143
|
+
def headline
|
144
|
+
'Inconsistent successor'
|
145
|
+
end
|
146
|
+
|
147
|
+
def possible_explanation
|
148
|
+
"#{current.item} has a {{P|1366}} of #{successor}, but is not followed by anyone here"
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
122
152
|
# Does the end date overlap with the successor's start date?
|
123
153
|
class Overlap < Check
|
124
154
|
def problem?
|
125
155
|
return false unless later
|
126
156
|
|
157
|
+
next_starts = later.start_date or return false
|
127
158
|
ends = current.end_date or return false
|
128
|
-
|
159
|
+
|
160
|
+
ends > next_starts
|
129
161
|
rescue ArgumentError
|
130
162
|
true
|
131
163
|
end
|
@@ -3,7 +3,9 @@
|
|
3
3
|
module WikidataPositionHistory
|
4
4
|
# Date for a single mandate row, to be passed to the report template
|
5
5
|
class MandateData
|
6
|
-
CHECKS = [Check::MissingFields, Check::
|
6
|
+
CHECKS = [Check::MissingFields, Check::Overlap,
|
7
|
+
Check::WrongPredecessor, Check::MissingPredecessor,
|
8
|
+
Check::WrongSuccessor, Check::MissingSuccessor].freeze
|
7
9
|
|
8
10
|
def initialize(later, current, earlier)
|
9
11
|
@later = later
|
@@ -40,6 +42,73 @@ module WikidataPositionHistory
|
|
40
42
|
attr_reader :later, :current, :earlier
|
41
43
|
end
|
42
44
|
|
45
|
+
# Data about the position itself, to be passed to the report template
|
46
|
+
class Metadata
|
47
|
+
# simplified version of a WikidataPositionHistory::Check
|
48
|
+
Warning = Struct.new(:headline, :explanation)
|
49
|
+
|
50
|
+
def initialize(rows)
|
51
|
+
@rows = rows
|
52
|
+
end
|
53
|
+
|
54
|
+
def item
|
55
|
+
rows.map(&:item).first
|
56
|
+
end
|
57
|
+
|
58
|
+
def inception_date
|
59
|
+
return if inception_dates.empty?
|
60
|
+
|
61
|
+
inception_dates.join(' / ')
|
62
|
+
end
|
63
|
+
|
64
|
+
def inception_warning
|
65
|
+
count = inception_dates.count
|
66
|
+
|
67
|
+
return if count == 1
|
68
|
+
return Warning.new('Missing field', "#{item_qlink} is missing {{P|571}}") if count.zero?
|
69
|
+
|
70
|
+
Warning.new('Multiple values', "#{item_qlink} has more than one {{P|571}}")
|
71
|
+
end
|
72
|
+
|
73
|
+
def abolition_date
|
74
|
+
return if abolition_dates.empty?
|
75
|
+
|
76
|
+
abolition_dates.join(' / ')
|
77
|
+
end
|
78
|
+
|
79
|
+
def abolition_warning
|
80
|
+
return unless abolition_dates.count > 1
|
81
|
+
|
82
|
+
Warning.new('Multiple values', "#{item_qlink} has more than one {{P|576}}")
|
83
|
+
end
|
84
|
+
|
85
|
+
def position?
|
86
|
+
# this should be the same everywhere
|
87
|
+
rows.map(&:position?).first
|
88
|
+
end
|
89
|
+
|
90
|
+
def legislator?
|
91
|
+
# this should be the same everywhere
|
92
|
+
rows.map(&:legislator?).first
|
93
|
+
end
|
94
|
+
|
95
|
+
private
|
96
|
+
|
97
|
+
attr_reader :rows
|
98
|
+
|
99
|
+
def inception_dates
|
100
|
+
rows.map(&:inception_date).compact.uniq(&:to_s).sort
|
101
|
+
end
|
102
|
+
|
103
|
+
def abolition_dates
|
104
|
+
rows.map(&:abolition_date).compact.uniq(&:to_s).sort
|
105
|
+
end
|
106
|
+
|
107
|
+
def item_qlink
|
108
|
+
item.qlink
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
43
112
|
# The entire wikitext generated for this report
|
44
113
|
class Report
|
45
114
|
def initialize(position_id, template_class = ReportTemplate)
|
@@ -50,9 +119,10 @@ module WikidataPositionHistory
|
|
50
119
|
attr_reader :position_id, :template_class
|
51
120
|
|
52
121
|
def wikitext
|
122
|
+
return legislator_template if metadata.legislator?
|
53
123
|
return no_items_output if mandates.empty?
|
54
124
|
|
55
|
-
output
|
125
|
+
template_class.new(template_params).output
|
56
126
|
end
|
57
127
|
|
58
128
|
def header
|
@@ -70,16 +140,22 @@ module WikidataPositionHistory
|
|
70
140
|
[header, wikitext].join("\n")
|
71
141
|
end
|
72
142
|
|
143
|
+
def template_params
|
144
|
+
{
|
145
|
+
metadata: metadata,
|
146
|
+
table_rows: table_rows,
|
147
|
+
sparql_url: sparql.wdqs_url,
|
148
|
+
}
|
149
|
+
end
|
150
|
+
|
73
151
|
private
|
74
152
|
|
75
153
|
def metadata
|
76
|
-
|
77
|
-
# multiple dates
|
78
|
-
@metadata ||= SPARQL::PositionData.new(position_id).results_as(PositionData).first
|
154
|
+
@metadata ||= Metadata.new(SPARQL::PositionQuery.new(position_id).results_as(PositionRow))
|
79
155
|
end
|
80
156
|
|
81
157
|
def biodata
|
82
|
-
@biodata ||= SPARQL::
|
158
|
+
@biodata ||= SPARQL::BioQuery.new(position_id).results_as(BioRow)
|
83
159
|
end
|
84
160
|
|
85
161
|
def biodata_for(officeholder)
|
@@ -91,26 +167,19 @@ module WikidataPositionHistory
|
|
91
167
|
end
|
92
168
|
|
93
169
|
def sparql
|
94
|
-
@sparql ||= SPARQL::
|
170
|
+
@sparql ||= SPARQL::MandatesQuery.new(position_id)
|
95
171
|
end
|
96
172
|
|
97
173
|
def mandates
|
98
|
-
@mandates ||= sparql.results_as(
|
174
|
+
@mandates ||= sparql.results_as(MandateRow)
|
99
175
|
end
|
100
176
|
|
101
177
|
def no_items_output
|
102
178
|
"\n{{PositionHolderHistory/error_no_holders|id=#{position_id}}}\n"
|
103
179
|
end
|
104
180
|
|
105
|
-
def
|
106
|
-
|
107
|
-
end
|
108
|
-
|
109
|
-
def template_params
|
110
|
-
{
|
111
|
-
table_rows: table_rows,
|
112
|
-
sparql_url: sparql.wdqs_url,
|
113
|
-
}
|
181
|
+
def legislator_template
|
182
|
+
"\n{{PositionHolderHistory/error_legislator|id=#{position_id}}}\n"
|
114
183
|
end
|
115
184
|
|
116
185
|
def table_rows
|
@@ -16,22 +16,44 @@ module WikidataPositionHistory
|
|
16
16
|
attr_reader :data
|
17
17
|
|
18
18
|
def template
|
19
|
-
@template ||= ERB.new(template_text)
|
19
|
+
@template ||= ERB.new(template_text, nil, '-')
|
20
20
|
end
|
21
21
|
|
22
22
|
def template_text
|
23
23
|
<<~ERB
|
24
24
|
{| class="wikitable" style="text-align: center; border: none;"
|
25
|
-
<%
|
25
|
+
<% if metadata.abolition_date -%>
|
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;" | \
|
29
|
+
<% [metadata.abolition_warning].compact.each do |warning| -%>
|
30
|
+
<span style="display: block">[[File:Pictogram voting comment.svg|15px|link=]] <span style="color: #d33; font-weight: bold; vertical-align: middle;"><%= warning.headline %></span> <ref><%= warning.explanation %></ref></span>\
|
31
|
+
<% end %>
|
32
|
+
<% end -%>
|
33
|
+
<% table_rows.map(&:values).each do |mandate, bio| -%>
|
34
|
+
|-
|
26
35
|
| style="padding:0.5em 2em" | <%= mandate.ordinal_string %>
|
27
36
|
| style="padding:0.5em 2em" | <%= bio.map(&:image_link).first %>
|
28
37
|
| style="padding:0.5em 2em" | <span style="font-size: <%= mandate.acting? ? '1.25em; font-style: italic;' : '1.5em' %>; display: block;"><%= mandate.person %></span> <%= mandate.dates %>
|
29
|
-
| style="padding:0.5em 2em 0.5em 1em; border: none; background: #fff; text-align: left;" |
|
30
|
-
<%
|
38
|
+
| style="padding:0.5em 2em 0.5em 1em; border: none; background: #fff; text-align: left;" | \
|
39
|
+
<% mandate.warnings.each do |warning| -%>
|
40
|
+
<span style="display: block">[[File:Pictogram voting comment.svg|15px|link=]] <span style="color: #d33; font-weight: bold; vertical-align: middle;"><%= warning.headline %></span> <ref><%= warning.explanation %></ref></span>\
|
41
|
+
<% end %>
|
42
|
+
<% end -%>
|
43
|
+
<% if metadata.inception_date -%>
|
44
|
+
|-
|
45
|
+
| colspan="3" style="padding:0.5em 2em; border: none; background: #fff; font-size: 1.25em; text-align: right;" | '''Position created''': <%= metadata.inception_date %>
|
46
|
+
| style="padding:0.5em 2em 0.5em 1em; border: none; background: #fff; text-align: left;" | \
|
47
|
+
<% [metadata.inception_warning].compact.each do |warning| -%>
|
48
|
+
<span style="display: block">[[File:Pictogram voting comment.svg|15px|link=]] <span style="color: #d33; font-weight: bold; vertical-align: middle;"><%= warning.headline %></span> <ref><%= warning.explanation %></ref></span>\
|
49
|
+
<% end %>
|
50
|
+
<% end -%>
|
51
|
+
|}
|
31
52
|
|
32
53
|
<div style="margin-bottom:5px; border-bottom:3px solid #2f74d0; font-size:8pt">
|
33
54
|
<div style="float:right">[<%= sparql_url %> WDQS]</div>
|
34
55
|
</div>
|
56
|
+
{{reflist}}
|
35
57
|
ERB
|
36
58
|
end
|
37
59
|
end
|
@@ -11,8 +11,8 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.authors = ['Tony Bowden', 'Mark Longair']
|
12
12
|
spec.email = ['tony@tmtm.com']
|
13
13
|
|
14
|
-
spec.summary = 'Generates a
|
15
|
-
spec.homepage = 'https://github.com/
|
14
|
+
spec.summary = 'Generates a table of historic holders of a Wikidata position'
|
15
|
+
spec.homepage = 'https://github.com/tmtmtmtm/wikidata-position-history/'
|
16
16
|
spec.license = 'MIT'
|
17
17
|
|
18
18
|
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
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.
|
4
|
+
version: 1.8.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-
|
12
|
+
date: 2020-09-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mediawiki-replaceable-content
|
@@ -204,17 +204,17 @@ files:
|
|
204
204
|
- exe/position-history-for-item
|
205
205
|
- exe/update_wikidata_page
|
206
206
|
- lib/query_service.rb
|
207
|
-
- lib/sparql/
|
207
|
+
- lib/sparql/bio_query.rb
|
208
208
|
- lib/sparql/item_query.rb
|
209
|
-
- lib/sparql/
|
210
|
-
- lib/sparql/
|
209
|
+
- lib/sparql/mandates_query.rb
|
210
|
+
- lib/sparql/position_query.rb
|
211
211
|
- lib/wikidata_position_history.rb
|
212
212
|
- lib/wikidata_position_history/checks.rb
|
213
213
|
- lib/wikidata_position_history/report.rb
|
214
214
|
- lib/wikidata_position_history/template.rb
|
215
215
|
- lib/wikidata_position_history/version.rb
|
216
216
|
- wikidata_position_history.gemspec
|
217
|
-
homepage: https://github.com/
|
217
|
+
homepage: https://github.com/tmtmtmtm/wikidata-position-history/
|
218
218
|
licenses:
|
219
219
|
- MIT
|
220
220
|
metadata:
|
@@ -238,5 +238,5 @@ rubyforge_project:
|
|
238
238
|
rubygems_version: 2.7.6.2
|
239
239
|
signing_key:
|
240
240
|
specification_version: 4
|
241
|
-
summary: Generates a
|
241
|
+
summary: Generates a table of historic holders of a Wikidata position
|
242
242
|
test_files: []
|