Preparation for deleting UC_Chinese category
Posted by mholmes on 12 Feb 2015 in Activity log
Quick query to find out the situation:
xquery version "3.0";
declare namespace output= "http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:method "text";
declare option output:encoding "utf-8";
let $eastAsian_Other :=
for $o in //owners_to_ethnicities
where $o/ote_ethnicity_id_fk="11"
return $o/ote_owner_id_fk,
$eaCount := count($eastAsian_Other),
$eaCount := count($eastAsian_Other),
$asiaOtherUnknown :=
for $o3 in //owners_to_ethnicities
where $o3/ote_ethnicity_id_fk="4"
return $o3/ote_owner_id_fk,
$aoCount := count($asiaOtherUnknown),
$uc_chinese :=
for $o2 in //owners_to_ethnicities
where $o2/ote_ethnicity_id_fk="10"
and not($o2/ote_owner_id_fk = $eastAsian_Other)
return $o2/ote_owner_id_fk,
$ucCount := count($uc_chinese),
$uc_chinese_not_ao :=
for $o4 in //owners_to_ethnicities
where $o4/ote_ethnicity_id_fk="10"
and not($o4/ote_owner_id_fk = $asiaOtherUnknown)
return $o4/ote_owner_id_fk,
$ucNotAoCount := count($uc_chinese_not_ao)
return concat('Found ', $eaCount, ' EastAsia_Other owners, ', $aoCount, ' Asia:Other_Unknown owners, ', $ucNotAoCount, ' owners who are UC_Chinese and not also Asia:Other_Unknown: ', string-join($uc_chinese_not_ao, ','), ' and ', $ucCount, ' UC_Chinese owners who are not also EA: ', string-join($uc_chinese, ','))
So if we're moving UC_Chinese to EastAsia_Other, then we just need to delete the UC_Chinese category; if we're moving them to Asia:Other_Unknown, we need to convert those which are not already in that group (361 out of 364).