From 93df63d0614155e71aaa4c95ae1cfd5f3556c330 Mon Sep 17 00:00:00 2001 From: Gerhard Gonter <ggonter@gmail.com> Date: Tue, 27 Dec 2016 08:49:52 +0100 Subject: [PATCH] write all persons into authctrl.json --- .gitignore | 2 ++ lib/PDS.pm | 2 +- wdq1.pl | 18 ++++++++++++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index e7d115b..c00fa22 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,5 @@ Q* PDS_backing.pages latest index.html +P31_cnt +authctrl_P31_cnt.tsv diff --git a/lib/PDS.pm b/lib/PDS.pm index 68241a5..ba18b8b 100644 --- a/lib/PDS.pm +++ b/lib/PDS.pm @@ -219,7 +219,7 @@ sub print_page_info print "highest_page_num=[$self->{highest_page_num}]\n"; my $ps= $self->{page_skips}; - print "page_skips: ", join (', ', map { $_. ' <= '. $ps->{$_}.'x' } sort keys %$ps), "\n"; + print "page_skips: ", join (', ', map { $_. ' <= '. $ps->{$_}.'x' } sort { $a <=> $b } keys %$ps), "\n"; } sub load_page diff --git a/wdq1.pl b/wdq1.pl index 079e1a2..d1e4d7d 100755 --- a/wdq1.pl +++ b/wdq1.pl @@ -432,18 +432,32 @@ my $fo_count= $fo_rec->open(); my $authctrl; if ($ty eq 'item') { + my $use_authctrl= 0; foreach my $x (@authctrl) { if (exists ($jc->{$x})) { + $use_authctrl= 1; + last; + } + } + + if (!$use_authctrl && exists ($jc->{P31})) + { + my $P31= $jc->{P31}; + my $P31val= $P31->[0]->{mainsnak}->{datavalue}->{value}->{id}; + # print __LINE__, " P31=[$P31] => [$P31val]\n"; + $use_authctrl= 1 if ($P31val eq 'Q5'); + } + + if ($use_authctrl) + { $authctrl= { 'id' => $id, 'tlt_l' => \%tlt_l, 'tlt_d' => \%tlt_d, }; - last; - } } } -- GitLab