User:Wasabot/Code2

This code is for moving data from P1698 (P1698) into qualifier space of described by source (P1343) as a part of Wikidata:Bot_requests#Gray's_Anatomy_data. This process will be done after harvest_template.py has been processed (importing GrayPage data of Infobox_Anatomy at English Wikipedia into P1698 of Wikidata)

# -*- coding: utf-8  -*-

## Q4115189 is "Sandbox"
## P304 is "Page"
## P1343 is "described by sources"
## P1698 is "Gray's Anatomy 1918 subject"
## Q19558994 is "Gray's Anatomy 20th edition"

# All pages in Wikidata which have P1698 property (from http://wdq.wmflabs.org/api?q=claim%5B1698%5D )
list1698 = [497,499,1074,5880,7362,7365,8124,8481,9368,9371,9382,9384,9385,9386,9604,9612,9614,9618,9622,9625,9629,9631,9633,9654,9656,11083,11090,12716,13075,13100,13141,13143,16295,16298,16313,16317,16321,16331,16332,16336,16343,16359,16363,16364,16370,16399,19030,19065,19087,19544,19625,23929,29405,37425,38155,42586,44161,47997,48228,48286,50194,54393,56658,58184,64386,74560,74959,74963,83379,104280,120463,125276,126304,130050,130086,130243,132000,132318,133279,134955,142149,143480,143588,143633,146701,147912,156075,156104,156871,158716,162595,163987,164386,168002,168291,169342,170145,171093,172605,173710,173801,174471,174778,175449,176503,178366,178492,178748,181602,182895,184488,184490,185317,185438,185706,185765,186029,186102,189218,189637,189763,189961,190140,190634,192398,193107,193176,193302,193527,193818,195614,196002,199507,201328,201363,204113,206280,209704,212328,212344,212721,214275,215558,217259,219841,220815,221406,221972,223172,223903,225308,229081,232377,233316,233345,235378,237229,237632,238607,238956,239972,241186,241865,242160,243469,243784,244969,247359,247512,248868,251011,253168,254580,254643,254855,256331,256356,257609,258145,258328,259368,259485,259817,261411,262489,263574,264834,265092,265617,266980,268021,268930,271762,271987,272474,272830,273538,273543,273554,275150,277357,277881,278417,279039,281473,282371,282532,283395,283673,285715,286437,286978,288821,290248,302896,302950,305187,307869,317857,318773,319317,319577,319636,320524,320561,323438,331321,331858,334143,336484,337247,337824,339861,340154,340695,354111,356002,367570,368208,368521,369887,369939,371010,371122,372409,376151,376390,376687,377518,378352,379007,379858,383204,383249,383359,384631,384950,385089,385484,385981,388431,388926,389201,402431,405478,425667,426139,428090,428866,429285,430024,430715,430758,430892,431282,432126,441704,448692,449457,452419,460276,461113,462306,464543,473749,474159,474663,476952,478040,478619,484813,484819,484868,485130,485148,485350,485355,486752,486774,486797,486809,487078,487082,487467,487474,487595,487887,488711,488727,488907,488932,488936,489179,489189,489722,489947,490059,490098,490172,490195,491057,491726,492482,493410,493426,493430,493588,494694,496246,497385,497563,497574,497582,498171,498179,498798,498935,499316,499897,500323,500339,500563,500634,501553,502133,502164,502704,502781,503431,503643,503944,504536,507538,508792,510755,512572,515672,515848,515917,516280,516546,517011,518616,519216,519350,519368,523799,524064,526239,526403,526920,527634,530279,530315,530934,531029,531506,532558,535352,537123,537486,540598,542166,543323,543450,545030,545171,545676,545929,546196,547019,549079,552439,558594,559439,559526,560133,568055,568799,569097,571057,572915,573181,574632,575064,578786,579449,579641,579657,580326,581682,581944,582849,583232,584922,585053,585624,585871,585980,587430,588981,589085,590556,591137,591706,591800,594066,596725,596803,597112,597179,597392,597400,598769,599817,601016,604046,604987,605523,607735,608206,609753,610806,610866,611127,611369,612033,612258,612325,612431,613203,613885,614557,615264,615414,615689,615895,615993,616032,616071,617389,617973,619284,619632,623365,623377,626936,627204,629371,629460,629643,629692,629796,630581,631471,633960,636624,636846,637545,638147,638244,638316,638317,639039,640022,640127,643928,645694,646925,650401,650891,651620,655357,655501,656328,658424,659744,661721,662857,663261,663799,664358,664439,665030,666412,666904,667120,668063,669260,669440,672854,673203,673321,676442,677253,681698,682122,686571,690588,690632,691653,691942,692200,696698,706969,707052,707058,707089,707096,707098,707104,707105,707112,707113,707115,707121,707124,707135,707138,707145,707152,707174,707177,707194,707202,707204,707208,707218,707236,707257,707277,707303,707326,707334,707384,707393,707419,707433,707436,707443,707450,707468,707473,707477,707489,707535,707540,707588,707592,707595,707616,707624,707632,707638,707651,707659,707674,707680,707686,707692,707697,707703,707709,712294,712424,713102,717887,718035,718041,718062,718073,718149,718207,718283,718587,718591,718595,718815,719213,719219,719223,720875,721856,724537,724544,724551,724555,724563,724569,724575,724580,724765,725346,725408,725413,725616,725771,725774,725785,725788,725790,726832,727745,728889,729294,730302,730359,730403,730870,735353,735505,736500,736995,737313,739865,740337,740541,740900,741750,743294,744391,745438,745516,746123,746817,747023,747524,747904,748180,748286,749592,749637,750625,750873,751322,752369,752441,754337,755141,757083,760262,760318,760700,761745,762258,763062,763560,764361,765152,767053,767067,767116,767287,769415,774933,775482,775497,775533,776331,776972,779106,780355,780801,785307,786698,788191,790949,791211,792532,792567,813683,816052,827134,828232,832528,832547,832662,833434,833561,833567,833576,833871,834751,834774,834781,834816,834909,836581,836589,836597,836921,837917,837926,837928,837937,838638,839483,839508,840572,840592,841422,841423,841536,842547,843533,843875,845740,846480,846961,847084,847092,847112,847458,849294,852473,857926,857942,860971,861058,862867,868304,868506,869202,869311,869318,869654,869755,869760,873072,886843,897486,897631,897760,898014,899158,899783,900457,900610,901076,901101,901116,901538,901571,905716,909882,912037,912422,913348,913366,913628,913958,914148,914475,915235,915948,918118,918513,918518,920567,921517,921815,923875,924285,925516,925888,926216,927103,927901,928150,928286,929017,931622,932557,932571,932587,932609,932621,932883,932908,934888,936531,936699,937076,939933,941241,942068,942823,943060,943203,943251,943917,952595,953121,953556,954715,955020,955110,955788,957133,958194,958295,959491,962200,965012,966616,968032,968958,971379,972835,974231,975054,975459,976025,977144,977221,978804,979412,988861,992893,994554,1002789,1002794,1002795,1002802,1003175,1003242,1004109,1029907,1032731,1032735,1032740,1036097,1048080,1048134,1049279,1049298,1051407,1051430,1051437,1051445,1051688,1051835,1055786,1055797,1056395,1057225,1059818,1061328,1063420,1064403,1064676,1065866,1066345,1068553,1068559,1071881,1072007,1072039,1073818,1073869,1074839,1075671,1075747,1076379,1076385,1076423,1076491,1081574,1084533,1084757,1085907,1085940,1088104,1088115,1088126,1089155,1089522,1090267,1090541,1090548,1091300,1091321,1093272,1093858,1113124,1126170,1127402,1127928,1128309,1130000,1130003,1130004,1130212,1130461,1134467,1134588,1134638,1135563,1138975,1141026,1144893,1148039,1148721,1163035,1163923,1165743,1169223,1169783,1172095,1179995,1179996,1180005,1180012,1180045,1180066,1180067,1180072,1211892,1217108,1217111,1219805,1230052,1232438,1233836,1234069,1237098,1237109,1237446,1240479,1240490,1240492,1245807,1245816,1245818,1245822,1246415,1251960,1252081,1257300,1263586,1263601,1263617,1263629,1264801,1270222,1270633,1290782,1290783,1290785,1290815,1292303,1303003,1308051,1320251,1322802,1324752,1328793,1330812,1334595,1335221,1338545,1340752,1341063,1344255,1345983,1362202,1362819,1364012,1364876,1365325,1377526,1386945,1393590,1394389,1394547,1395415,1397347,1397352,1397355,1404198,1414441,1418135,1420571,1421005,1421253,1422057,1424568,1425513,1425589,1425593,1426052,1427600,1427665,1428231,1428240,1428669,1429453,1431311,1432727,1433253,1433379,1436580,1436583,1436590,1436597,1436603,1439390,1439392,1442272,1446138,1455226,1457751,1457958,1460988,1468271,1468492,1468494,1468875,1469743,1469966,1471133,1474138,1474177,1475438,1475923,1477923,1484346,1493493,1493499,1493504,1493507,1493508,1493509,1494188,1496243,1500559,1500758,1501677,1502241,1503735,1504050,1507124,1508879,1512017,1513669,1515961,1516257,1518719,1519198,1523307,1524395,1527057,1532008,1535320,1538474,1542293,1542860,1543208,1545154,1545429,1545875,1547173,1548876,1550250,1550323,1551135,1551145,1552748,1566641,1568840,1569338,1569526,1570144,1571074,1575134,1577203,1578686,1582250,1590935,1601362,1604164,1613890,1618109,1619734,1623349,1631914,1633822,1635066,1635075,1637370,1640207,1640627,1640816,1640852,1645412,1647118,1648555,1653896,1659799,1662950,1665277,1666234,1670335,1684243,1684283,1688555,1704861,1719061,1723682,1724194,1724233,1727667,1729105,1732695,1737948,1737968,1740177,1740954,1742236,1742964,1752136,1752822,1753038,1753760,1753794,1755764,1756762,1756826,1757887,1757893,1758126,1758798,1759640,1761014,1762220,1764136,1772886,1772935,1776131,1777112,1778517,1781342,1796515,1801229,1812578,1813955,1816515,1817831,1823851,1824640,1824647,1824650,1824652,1850432,1851435,1858490,1867659,1877663,1887448,1889778,1890233,1890743,1892025,1892060,1897537,1913658,1934644,1939737,1954084,1954102,1954132,1954164,1973610,1973755,1978103,1978114,1978117,1978125,1978134,1978139,1978150,1978161,1978198,1995284,2006950,2023302,2024775,2027917,2031424,2035682,2037774,2038676,2040445,2043581,2051688,2053927,2076795,2080394,2083654,2099449,2099513,2111659,2116409,2125260,2142447,2142471,2146063,2146296,2150283,2164516,2192288,2192944,2214048,2226294,2241227,2254233,2256690,2264329,2267382,2272222,2275919,2290527,2301793,2307492,2307505,2310633,2325957,2338025,2340707,2341350,2346242,2349469,2353265,2354353,2354409,2357246,2357631,2359065,2359165,2360339,2361541,2379958,2393792,2394641,2397680,2405172,2407406,2409399,2409648,2430155,2447635,2449224,2456426,2456429,2456456,2462411,2465231,2476958,2497823,2512768,2513033,2514016,2517379,2519137,2529769,2531387,2531753,2533722,2536335,2562556,2562565,2567282,2575284,2601133,2606107,2608511,2619732,2620085,2624223,2630631,2632491,2635603,2640512,2651862,2656768,2658295,2672189,2673594,2706844,2709123,2713281,2713567,2723068,2734884,2736974,2745412,2746562,2750165,2758245,2759368,2760639,2796182,2835952,2849638,2865763,2865983,2865986,2865999,2879939,2886255,2888640,2912094,2914731,2916078,2917070,2917413,2918521,2919618,2933953,2941792,2943378,2997445,3009555,3042621,3045429,3052544,3064609,3088530,3088602,3090687,3091615,3095145,3109007,3143036,3144280,3176575,3184389,3216080,3238424,3238429,3238433,3239259,3240164,3241072,3241280,3246226,3266889,3268027,3269830,3270170,3270318,3270735,3270899,3271220,3271563,3272509,3278179,3279041,3301573,3302518,3305334,3307119,3316775,3320884,3320895,3320949,3321279,3321474,3322746,3323019,3323498,3323540,3324269,3324276,3324292,3324363,3324393,3327889,3328345,3328349,3328703,3328736,3328741,3328747,3328967,3329079,3329123,3329385,3330358,3330753,3331428,3331433,3331820,3331828,3338317,3338329,3350337,3356933,3362895,3391674,3391876,3393910,3395843,3407433,3409626,3444008,3448908,3448931,3448955,3479076,3482204,3489753,3491648,3491693,3493644,3494051,3494094,3496540,3497796,3503790,3507797,3507868,3508689,3509884,3512204,3518027,3543470,3543924,3548125,3549771,3551060,3555260,3559311,3563476,3621993,3624368,3624371,3624376,3624378,3624379,3624383,3683232,3683549,3684643,3684644,3686401,3697092,3706503,3714500,3714502,3714504,3714505,3714508,3718931,3739877,3739885,3739886,3739888,3745573,3746580,3747274,3748991,3748995,3748997,3756509,3761740,3774464,3776165,3796498,3803863,3803865,3816207,3822866,3823855,3824661,3829579,3829580,3829581,3829583,3829591,3829592,3853846,3855298,3855299,3867495,3885822,3885823,3885825,3896384,3928649,3955308,3958433,3966104,3975895,3975896,3980079,3985025,3985171,3997080,4000150,4006434,4006435,4008426,4039197,4057496,4113701,4113709,4113797,4113799,4113807,4115035,4115039,4115114,4115123,4115124,4115125,4115128,4115129,4115130,4115298,4115301,4115302,4115374,4115390,4115394,4115552,4115553,4115692,4115976,4115977,4116535,4116536,4116537,4116594,4116637,4116714,4116731,4116732,4116843,4116851,4116864,4116887,4116890,4116893,4116983,4117071,4117091,4117095,4117097,4117172,4117182,4117816,4117834,4118376,4119723,4119770,4119887,4119889,4120209,4133186,4133300,4138815,4163340,4175733,4175787,4180183,4180189,4181327,4210529,4232918,4260603,4306347,4306444,4319460,4319750,4356164,4357062,4381076,4381683,4381818,4381851,4384275,4384578,4386011,4391932,4423908,4428834,4492237,4665114,4665121,4672537,4672703,4673239,4673242,4673243,4674719,4675817,4676181,4676185,4677927,4681417,4683049,4705111,4708355,4736445,4737956,4739730,4748561,4748565,4750998,4771318,4771319,4771320,4771323,4771326,4771332,4771334,4771336,4771339,4771340,4771341,4771342,4771344,4771345,4771348,4771356,4771357,4771358,4771361,4771363,4771369,4771374,4771383,4771388,4771392,4771394,4771396,4771397,4771398,4771401,4771403,4771407,4771409,4771410,4771413,4771418,4774862,4775342,4777779,4778753,4778754,4778758,4778760,4778765,4778769,4778770,4779445,4779447,4779799,4779803,4780470,4781025,4781028,4787730,4787737,4797532,4800935,4800937,4800938,4800943,4800944,4800963,4803815,4803816,4803818,4803822,4811189,4820036,4822343,4822344,4822345,4844892,4845565,4860300,4866183,4866184,4866185,4866401,4866402,4867299,4884045,4903640,4904823,4906678,4918599,4922501,4923862,4927079,4927815,4936775,4936935,4936938,4936942,4936943,4936946,4936948,4944713,4953276,4956395,4973820,4973830,4980522,4982430,4996095,5018678,5031084,5036393,5036394,5036397,5036399,5038329,5038330,5038337,5045538,5045547,5045549,5054361,5054375,5055060,5055066,5062101,5062115,5062161,5062943,5063274,5064104,5065333,5065335,5065343,5065347,5104979,5119951,5121741,5129640,5134733,5134739,5135128,5139269,5144814,5145992,5145994,5145995,5153517,5153530,5153541,5153544,5153550,5153588,5166068,5169147,5169422,5169423,5172190,5172191,5172197,5172687,5173044,5175168,5175169,5175187,5182129,5182144,5185093,5185094,5186109,5189786,5189789,5190124,5190125,5190131,5190132,5192289,5193078,5194195,5194237,5194249,5196689,5213758,5249153,5250368,5250371,5250372,5250374,5250383,5250384,5250403,5250405,5250417,5250421,5250422,5250428,5250448,5250449,5251486,5251638,5253372,5254857,5254868,5259480,5259911,5263717,5263718,5263721,5271782,5298763,5298765,5298766,5298767,5298768,5298769,5298783,5298789,5298790,5298792,5298796,5298800,5298801,5298809,5298810,5298813,5298990,5306004,5306281,5311589,5311616,5311617,5315859,5367024,5370243,5370246,5376355,5382068,5382913,5383066,5383755,5398637,5398638,5404132,5404134,5404136,5404142,5408858,5422034,5422038,5422059,5422241,5436624,5436627,5436628,5436629,5442934,5442935,5442937,5446487,5447591,5449291,5454158,5454211,5454235,5459037,5464266,5467182,5467184,5467189,5473394,5476258,5486588,5505906,5505915,5506108,5509192,5521146,5526784,5526791,5526820,5526873,5532388,5532399,5532402,5533224,5533226,5560024,5566616,5569232,5571242,5571927,5572479,5573344,5600832,5600890,5600891,5600909,5600912,5600920,5608274,5614448,5645489,5659844,5689371,5705015,5731676,5766006,5796755,5860395,5903589,5934112,5940703,5940709,5947899,5957038,5966441,5977887,5997438,5997581,5997584,5997955,5997958,5997960,5998330,5998331,5998334,5998345,5998353,6014713,6014730,6029277,6029281,6029289,6029292,6029296,6029299,6029302,6029315,6029317,6029326,6029330,6029332,6029342,6029346,6029373,6029380,6029401,6029407,6029414,6029430,6029436,6031439,6031456,6031461,6031465,6031527,6031619,6031621,6035682,6045625,6045628,6045781,6045857,6045946,6045954,6045974,6046002,6046500,6047271,6047369,6047770,6047791,6047801,6047876,6047879,6047950,6056132,6056234,6056249,6056254,6057189,6057216,6057329,6057436,6058287,6060736,6079258,6079266,6122610,6123223,6125157,6125961,6133133,6135922,6149477,6160164,6304968,6321762,6321987,6381103,6382772,6382778,6421864,6468852,6468853,6468854,6468858,6468860,6469079,6469097,6471979,6491954,6491958,6491980,6493457,6493472,6493480,6495559,6495571,6495580,6495587,6495588,6495635,6495641,6495642,6495645,6495654,6495656,6495661,6495668,6495669,6495673,6495699,6495704,6495719,6495724,6498170,6516939,6516975,6516978,6517004,6531539,6531621,6531630,6531632,6531656,6545844,6553359,6553986,6553990,6553993,6554087,6554089,6577825,6578319,6586555,6592857,6593307,6641139,6641170,6641174,6641978,6673454,6693939,6693941,6693944,6703062,6703074,6703135,6703136,6703140,6725774,6745831,6760434,6785590,6785598,6795553,6795554,6795555,6806020,6806024,6806027,6806029,6806032,6806042,6806063,6806069,6806071,6806077,6806087,6806089,6806090,6806113,6806157,6806168,6817075,6817077,6817080,6817082,6817497,6817501,6821212,6821433,6821608,6841131,6841656,6841662,6841671,6841702,6843024,6889453,6896271,6931272,6931275,6931277,6940379,6940380,6940386,6940389,6947744,6947745,6947748,6966579,6967224,6967245,6985533,6996829,7002059,7070478,7074696,7075178,7075181,7075563,7075565,7075573,7075695,7075700,7075705,7075707,7088225,7096533,7098088,7098791,7098802,7100073,7100078,7100080,7100089,7100091,7100093,7102483,7107434,7107435,7108723,7108726,7113250,7126817,7126821,7126822,7126845,7126846,7126851,7128135,7128136,7128138,7128139,7128142,7128148,7128149,7128151,7128152,7128693,7130422,7133679,7135465,7135798,7136027,7136029,7136184,7136260,7136261,7137055,7139433,7139910,7139919,7144431,7158835,7158842,7158924,7158925,7161792,7161795,7168172,7168384,7168569,7168571,7168573,7168574,7168576,7169520,7169521,7178844,7179108,7179110,7179117,7179125,7180875,7180877,7180880,7180882,7180883,7180884,7180885,7180889,7180893,7180894,7180895,7188110,7188112,7194153,7197989,7197992,7200295,7201013,7201578,7201586,7201587,7201589,7201590,7201591,7201592,7204943,7228256,7228291,7231328,7234163,7234169,7234170,7234171,7234173,7234174,7234175,7234180,7234188,7234189,7234190,7234191,7234192,7234198,7234200,7234204,7234205,7234209,7234211,7234213,7234218,7234221,7234230,7234231,7234234,7234238,7234239,7234242,7234244,7234246,7234249,7234250,7234253,7234257,7234258,7234261,7234268,7234269,7239346,7239349,7240586,7242185,7242406,7243140,7243155,7243576,7243623,7246888,7249747,7249923,7250180,7250982,7256997,7256999,7257004,7257007,7257010,7257269,7257270,7257273,7258155,7258320,7259523,7259537,7263301,7263305,7268346,7268347,7280266,7280322,7290377,7303197,7303257,7307229,7312500,7312502,7315908,7316999,7317051,7333597,7333599,7333621,7333714,7334366,7336352,7366580,7366585,7396634,7396918,7396928,7397390,7405740,7429752,7430194,7430500,7431334,7443737,7443755,7443862,7449447,7452373,7452374,7452375,7455062,7480957,7502021,7502066,7512456,7525203,7543026,7543650,7557486,7558250,7576380,7576646,7576647,7576648,7576651,7576652,7576658,7577436,7577439,7577472,7577475,7577531,7577652,7578544,7578546,7579022,7581930,7611580,7611584,7621088,7621106,7624331,7629687,7629692,7629706,7630773,7630933,7630934,7630977,7630997,7631109,7631531,7631656,7631739,7631952,7632190,7636092,7636093,7636096,7643297,7643300,7643301,7643302,7643313,7643317,7643318,7643320,7643325,7643328,7643334,7643589,7643592,7643601,7643603,7643610,7643614,7643620,7643626,7643630,7643634,7643637,7643641,7643652,7643656,7643661,7643664,7643666,7643668,7643672,7643673,7643674,7643678,7643681,7643684,7644664,7644667,7644699,7644700,7644726,7644733,7644737,7644743,7644746,7644752,7644759,7644761,7645117,7645364,7649249,7649728,7661740,7662629,7674135,7676079,7680269,7692862,7692864,7698933,7698995,7699643,7699644,7702747,7702748,7785071,7785073,7785090,7796114,7796136,7799734,7799740,7799758,7821671,7821673,7821674,7827454,7831068,7831071,7831072,7831074,7831078,7831292,7831314,7835343,7835420,7835425,7835431,7835432,7835437,7835438,7835443,7840109,7840119,7844835,7844857,7847942,7850859,7850860,7850869,7850870,7853102,7853103,7860413,7879707,7881319,7881324,7882660,7883898,7899040,7901043,7902648,7903731,7908497,7916297,7920285,7923217,7923222,7923449,7923455,7923461,7923467,7932302,7937030,7937031,7939198,7941372,7941948,8025129,8025131,8073852,8075875,8075876,8075877,8205398,8205462,8205486,8205488,8273077,8960673,9066221,9092880,9292294,9376071,10369487,10542436,11277687,11312041,11360524,11488371,11538360,11557485,11705017,11722446,11994504,12151385,12176598,12218719,12229608,12230575,12383332,12383338,12383339,12386787,12391838,12636757,13566427,13638013,14413567,14698418,14855650,15146576,15243378,15712163,16829139,16838399,16873995,16874478,16904122,16917723,16930523,16937467,16938766,16938916,16938977,16939254,16941189,16943184,16947454,16965170,16975997,16976550,16976591,16976792,16977220,16978053,16979549,16980004,16989580,16991495,16999361,16999822,17000144,17001932,17027450,17044312,17045130,17047744,17057138,17057227,17058094,17067224,17077735,17081678,17081695,17086517,17086709,17093776,17110088,17111429,17111598,17111613,17111677,17112340,17112348,17114092,17114663,17119378,17119505,17119890,17125352,17125905,17130627,17137094,17143043,17144300,18352168,18354585,18391868,18761122,19597010]

import pywikibot
import time
import sys
site = pywikibot.Site("wikidata", "wikidata")
repo = site.data_repository()
 
for num in range(0, 2652):
    print num, u"th process starts!"
    print u"      Current target is Q", list1698[num]
 
    # Get whole page data
    item = pywikibot.ItemPage(repo, u"Q" + str(list1698[num]))
    item.get()
 
    # Check whether P1343 claim already exists. If it exists, check if it is Q19558994 (Gray's Anatomy 20th edition). If it is not Q19558994, exit process.
    if item.claims:
        if 'P1343' in item.claims:
            print u"      Value of P1343 (described by sources) is", item.claims['P1343'][0].getTarget()
            if not str(item.claims['P1343'][0].getTarget()) == u"[[wikidata:Q19558994]]":
                print item.claims['P1343'][0].getTarget(), u"is not Q19558994 Gray's Anatomy 20th edition ! Needs editing manually!"
                sys.exit()
        else:
            # If 1343 doesn't exist, adding claim "P1343" ("described by sources") with value Q19558994 ("Gray's Anatomy 20th edition")
            Source = pywikibot.Claim(repo, u'P1343')
            book = pywikibot.ItemPage(repo, u'Q19558994')
            Source.setTarget(book)
            item.addClaim(Source)
            print u"      Claim described by sources is created!"
 
 
    # Get "GrayPage" number
    GrayPage = item.claims['P1698'][0].getTarget()
    print u"      GrayPage is ", GrayPage
 
 
    # Adding "GrayPage" into P1343 as qualifier
    qualifier = pywikibot.Claim(repo, u'P304')
    qualifier.setTarget(GrayPage)
    item.claims['P1343'][0].addQualifier(qualifier)
    print u"      page is added into P1343 as qualifier!"
 
    # Removing claim P1698 from the page
    item.removeClaims(item.claims['P1698'][0])
    print u"      Claim Gray's Anatomy 1918 subject is removed!"
 
    print num, u"th process ends!"
    print "......wating 15 seconds...."
    time.sleep(15)