lmdb_triplestore.c 1.7 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149
  1. /* Generated by Cython 0.28.4 */
  2. /* BEGIN: Cython Metadata
  3. {
  4. "distutils": {
  5. "depends": [],
  6. "extra_compile_args": [
  7. "-fopenmp"
  8. ],
  9. "extra_link_args": [
  10. "-fopenmp"
  11. ],
  12. "include_dirs": [
  13. "/home/scossu/code/lsup/src/ext/include",
  14. "/home/scossu/code/lsup/src/lakesuperior/cy_include"
  15. ],
  16. "libraries": [
  17. "crypto"
  18. ],
  19. "name": "lakesuperior.store.ldp_rs.term",
  20. "sources": [
  21. "/home/scossu/code/lsup/src/lakesuperior/store/ldp_rs/term.pyx",
  22. "/home/scossu/code/lsup/src/ext/lib/tpl.c",
  23. "/home/scossu/code/lsup/src/ext/lib/mdb.c",
  24. "/home/scossu/code/lsup/src/ext/lib/midl.c",
  25. "/home/scossu/code/lsup/src/lakesuperior/store/ldp_rs/lmdb_triplestore.pyx"
  26. ]
  27. },
  28. "module_name": "lakesuperior.store.ldp_rs.term"
  29. }
  30. END: Cython Metadata */
  31. #define PY_SSIZE_T_CLEAN
  32. #include "Python.h"
  33. #ifndef Py_PYTHON_H
  34. #error Python headers needed to compile C extensions, please install development version of Python.
  35. #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
  36. #error Cython requires Python 2.6+ or Python 3.3+.
  37. #else
  38. #define CYTHON_ABI "0_28_4"
  39. #define CYTHON_FUTURE_DIVISION 1
  40. #include <stddef.h>
  41. #ifndef offsetof
  42. #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
  43. #endif
  44. #if !defined(WIN32) && !defined(MS_WINDOWS)
  45. #ifndef __stdcall
  46. #define __stdcall
  47. #endif
  48. #ifndef __cdecl
  49. #define __cdecl
  50. #endif
  51. #ifndef __fastcall
  52. #define __fastcall
  53. #endif
  54. #endif
  55. #ifndef DL_IMPORT
  56. #define DL_IMPORT(t) t
  57. #endif
  58. #ifndef DL_EXPORT
  59. #define DL_EXPORT(t) t
  60. #endif
  61. #define __PYX_COMMA ,
  62. #ifndef HAVE_LONG_LONG
  63. #if PY_VERSION_HEX >= 0x02070000
  64. #define HAVE_LONG_LONG
  65. #endif
  66. #endif
  67. #ifndef PY_LONG_LONG
  68. #define PY_LONG_LONG LONG_LONG
  69. #endif
  70. #ifndef Py_HUGE_VAL
  71. #define Py_HUGE_VAL HUGE_VAL
  72. #endif
  73. #ifdef PYPY_VERSION
  74. #define CYTHON_COMPILING_IN_PYPY 1
  75. #define CYTHON_COMPILING_IN_PYSTON 0
  76. #define CYTHON_COMPILING_IN_CPYTHON 0
  77. #undef CYTHON_USE_TYPE_SLOTS
  78. #define CYTHON_USE_TYPE_SLOTS 0
  79. #undef CYTHON_USE_PYTYPE_LOOKUP
  80. #define CYTHON_USE_PYTYPE_LOOKUP 0
  81. #if PY_VERSION_HEX < 0x03050000
  82. #undef CYTHON_USE_ASYNC_SLOTS
  83. #define CYTHON_USE_ASYNC_SLOTS 0
  84. #elif !defined(CYTHON_USE_ASYNC_SLOTS)
  85. #define CYTHON_USE_ASYNC_SLOTS 1
  86. #endif
  87. #undef CYTHON_USE_PYLIST_INTERNALS
  88. #define CYTHON_USE_PYLIST_INTERNALS 0
  89. #undef CYTHON_USE_UNICODE_INTERNALS
  90. #define CYTHON_USE_UNICODE_INTERNALS 0
  91. #undef CYTHON_USE_UNICODE_WRITER
  92. #define CYTHON_USE_UNICODE_WRITER 0
  93. #undef CYTHON_USE_PYLONG_INTERNALS
  94. #define CYTHON_USE_PYLONG_INTERNALS 0
  95. #undef CYTHON_AVOID_BORROWED_REFS
  96. #define CYTHON_AVOID_BORROWED_REFS 1
  97. #undef CYTHON_ASSUME_SAFE_MACROS
  98. #define CYTHON_ASSUME_SAFE_MACROS 0
  99. #undef CYTHON_UNPACK_METHODS
  100. #define CYTHON_UNPACK_METHODS 0
  101. #undef CYTHON_FAST_THREAD_STATE
  102. #define CYTHON_FAST_THREAD_STATE 0
  103. #undef CYTHON_FAST_PYCALL
  104. #define CYTHON_FAST_PYCALL 0
  105. #undef CYTHON_PEP489_MULTI_PHASE_INIT
  106. #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  107. #undef CYTHON_USE_TP_FINALIZE
  108. #define CYTHON_USE_TP_FINALIZE 0
  109. #elif defined(PYSTON_VERSION)
  110. #define CYTHON_COMPILING_IN_PYPY 0
  111. #define CYTHON_COMPILING_IN_PYSTON 1
  112. #define CYTHON_COMPILING_IN_CPYTHON 0
  113. #ifndef CYTHON_USE_TYPE_SLOTS
  114. #define CYTHON_USE_TYPE_SLOTS 1
  115. #endif
  116. #undef CYTHON_USE_PYTYPE_LOOKUP
  117. #define CYTHON_USE_PYTYPE_LOOKUP 0
  118. #undef CYTHON_USE_ASYNC_SLOTS
  119. #define CYTHON_USE_ASYNC_SLOTS 0
  120. #undef CYTHON_USE_PYLIST_INTERNALS
  121. #define CYTHON_USE_PYLIST_INTERNALS 0
  122. #ifndef CYTHON_USE_UNICODE_INTERNALS
  123. #define CYTHON_USE_UNICODE_INTERNALS 1
  124. #endif
  125. #undef CYTHON_USE_UNICODE_WRITER
  126. #define CYTHON_USE_UNICODE_WRITER 0
  127. #undef CYTHON_USE_PYLONG_INTERNALS
  128. #define CYTHON_USE_PYLONG_INTERNALS 0
  129. #ifndef CYTHON_AVOID_BORROWED_REFS
  130. #define CYTHON_AVOID_BORROWED_REFS 0
  131. #endif
  132. #ifndef CYTHON_ASSUME_SAFE_MACROS
  133. #define CYTHON_ASSUME_SAFE_MACROS 1
  134. #endif
  135. #ifndef CYTHON_UNPACK_METHODS
  136. #define CYTHON_UNPACK_METHODS 1
  137. #endif
  138. #undef CYTHON_FAST_THREAD_STATE
  139. #define CYTHON_FAST_THREAD_STATE 0
  140. #undef CYTHON_FAST_PYCALL
  141. #define CYTHON_FAST_PYCALL 0
  142. #undef CYTHON_PEP489_MULTI_PHASE_INIT
  143. #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  144. #undef CYTHON_USE_TP_FINALIZE
  145. #define CYTHON_USE_TP_FINALIZE 0
  146. #else
  147. #define CYTHON_COMPILING_IN_PYPY 0
  148. #define CYTHON_COMPILING_IN_PYSTON 0
  149. #define CYTHON_COMPILING_IN_CPYTHON 1
  150. #ifndef CYTHON_USE_TYPE_SLOTS
  151. #define CYTHON_USE_TYPE_SLOTS 1
  152. #endif
  153. #if PY_VERSION_HEX < 0x02070000
  154. #undef CYTHON_USE_PYTYPE_LOOKUP
  155. #define CYTHON_USE_PYTYPE_LOOKUP 0
  156. #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
  157. #define CYTHON_USE_PYTYPE_LOOKUP 1
  158. #endif
  159. #if PY_MAJOR_VERSION < 3
  160. #undef CYTHON_USE_ASYNC_SLOTS
  161. #define CYTHON_USE_ASYNC_SLOTS 0
  162. #elif !defined(CYTHON_USE_ASYNC_SLOTS)
  163. #define CYTHON_USE_ASYNC_SLOTS 1
  164. #endif
  165. #if PY_VERSION_HEX < 0x02070000
  166. #undef CYTHON_USE_PYLONG_INTERNALS
  167. #define CYTHON_USE_PYLONG_INTERNALS 0
  168. #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
  169. #define CYTHON_USE_PYLONG_INTERNALS 1
  170. #endif
  171. #ifndef CYTHON_USE_PYLIST_INTERNALS
  172. #define CYTHON_USE_PYLIST_INTERNALS 1
  173. #endif
  174. #ifndef CYTHON_USE_UNICODE_INTERNALS
  175. #define CYTHON_USE_UNICODE_INTERNALS 1
  176. #endif
  177. #if PY_VERSION_HEX < 0x030300F0
  178. #undef CYTHON_USE_UNICODE_WRITER
  179. #define CYTHON_USE_UNICODE_WRITER 0
  180. #elif !defined(CYTHON_USE_UNICODE_WRITER)
  181. #define CYTHON_USE_UNICODE_WRITER 1
  182. #endif
  183. #ifndef CYTHON_AVOID_BORROWED_REFS
  184. #define CYTHON_AVOID_BORROWED_REFS 0
  185. #endif
  186. #ifndef CYTHON_ASSUME_SAFE_MACROS
  187. #define CYTHON_ASSUME_SAFE_MACROS 1
  188. #endif
  189. #ifndef CYTHON_UNPACK_METHODS
  190. #define CYTHON_UNPACK_METHODS 1
  191. #endif
  192. #ifndef CYTHON_FAST_THREAD_STATE
  193. #define CYTHON_FAST_THREAD_STATE 1
  194. #endif
  195. #ifndef CYTHON_FAST_PYCALL
  196. #define CYTHON_FAST_PYCALL 1
  197. #endif
  198. #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
  199. #define CYTHON_PEP489_MULTI_PHASE_INIT (0 && PY_VERSION_HEX >= 0x03050000)
  200. #endif
  201. #ifndef CYTHON_USE_TP_FINALIZE
  202. #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  203. #endif
  204. #endif
  205. #if !defined(CYTHON_FAST_PYCCALL)
  206. #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
  207. #endif
  208. #if CYTHON_USE_PYLONG_INTERNALS
  209. #include "longintrepr.h"
  210. #undef SHIFT
  211. #undef BASE
  212. #undef MASK
  213. #endif
  214. #ifndef __has_attribute
  215. #define __has_attribute(x) 0
  216. #endif
  217. #ifndef __has_cpp_attribute
  218. #define __has_cpp_attribute(x) 0
  219. #endif
  220. #ifndef CYTHON_RESTRICT
  221. #if defined(__GNUC__)
  222. #define CYTHON_RESTRICT __restrict__
  223. #elif defined(_MSC_VER) && _MSC_VER >= 1400
  224. #define CYTHON_RESTRICT __restrict
  225. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  226. #define CYTHON_RESTRICT restrict
  227. #else
  228. #define CYTHON_RESTRICT
  229. #endif
  230. #endif
  231. #ifndef CYTHON_UNUSED
  232. # if defined(__GNUC__)
  233. # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  234. # define CYTHON_UNUSED __attribute__ ((__unused__))
  235. # else
  236. # define CYTHON_UNUSED
  237. # endif
  238. # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
  239. # define CYTHON_UNUSED __attribute__ ((__unused__))
  240. # else
  241. # define CYTHON_UNUSED
  242. # endif
  243. #endif
  244. #ifndef CYTHON_MAYBE_UNUSED_VAR
  245. # if defined(__cplusplus)
  246. template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
  247. # else
  248. # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
  249. # endif
  250. #endif
  251. #ifndef CYTHON_NCP_UNUSED
  252. # if CYTHON_COMPILING_IN_CPYTHON
  253. # define CYTHON_NCP_UNUSED
  254. # else
  255. # define CYTHON_NCP_UNUSED CYTHON_UNUSED
  256. # endif
  257. #endif
  258. #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
  259. #ifdef _MSC_VER
  260. #ifndef _MSC_STDINT_H_
  261. #if _MSC_VER < 1300
  262. typedef unsigned char uint8_t;
  263. typedef unsigned int uint32_t;
  264. #else
  265. typedef unsigned __int8 uint8_t;
  266. typedef unsigned __int32 uint32_t;
  267. #endif
  268. #endif
  269. #else
  270. #include <stdint.h>
  271. #endif
  272. #ifndef CYTHON_FALLTHROUGH
  273. #if defined(__cplusplus) && __cplusplus >= 201103L
  274. #if __has_cpp_attribute(fallthrough)
  275. #define CYTHON_FALLTHROUGH [[fallthrough]]
  276. #elif __has_cpp_attribute(clang::fallthrough)
  277. #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
  278. #elif __has_cpp_attribute(gnu::fallthrough)
  279. #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
  280. #endif
  281. #endif
  282. #ifndef CYTHON_FALLTHROUGH
  283. #if __has_attribute(fallthrough)
  284. #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
  285. #else
  286. #define CYTHON_FALLTHROUGH
  287. #endif
  288. #endif
  289. #if defined(__clang__ ) && defined(__apple_build_version__)
  290. #if __apple_build_version__ < 7000000
  291. #undef CYTHON_FALLTHROUGH
  292. #define CYTHON_FALLTHROUGH
  293. #endif
  294. #endif
  295. #endif
  296. #ifndef CYTHON_INLINE
  297. #if defined(__clang__)
  298. #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  299. #elif defined(__GNUC__)
  300. #define CYTHON_INLINE __inline__
  301. #elif defined(_MSC_VER)
  302. #define CYTHON_INLINE __inline
  303. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  304. #define CYTHON_INLINE inline
  305. #else
  306. #define CYTHON_INLINE
  307. #endif
  308. #endif
  309. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  310. #define Py_OptimizeFlag 0
  311. #endif
  312. #define __PYX_BUILD_PY_SSIZE_T "n"
  313. #define CYTHON_FORMAT_SSIZE_T "z"
  314. #if PY_MAJOR_VERSION < 3
  315. #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  316. #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  317. PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  318. #define __Pyx_DefaultClassType PyClass_Type
  319. #else
  320. #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  321. #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  322. PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  323. #define __Pyx_DefaultClassType PyType_Type
  324. #endif
  325. #ifndef Py_TPFLAGS_CHECKTYPES
  326. #define Py_TPFLAGS_CHECKTYPES 0
  327. #endif
  328. #ifndef Py_TPFLAGS_HAVE_INDEX
  329. #define Py_TPFLAGS_HAVE_INDEX 0
  330. #endif
  331. #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  332. #define Py_TPFLAGS_HAVE_NEWBUFFER 0
  333. #endif
  334. #ifndef Py_TPFLAGS_HAVE_FINALIZE
  335. #define Py_TPFLAGS_HAVE_FINALIZE 0
  336. #endif
  337. #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  338. #ifndef METH_FASTCALL
  339. #define METH_FASTCALL 0x80
  340. #endif
  341. typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  342. typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
  343. Py_ssize_t nargs, PyObject *kwnames);
  344. #else
  345. #define __Pyx_PyCFunctionFast _PyCFunctionFast
  346. #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
  347. #endif
  348. #if CYTHON_FAST_PYCCALL
  349. #define __Pyx_PyFastCFunction_Check(func)\
  350. ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS)))))
  351. #else
  352. #define __Pyx_PyFastCFunction_Check(func) 0
  353. #endif
  354. #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  355. #define PyObject_Malloc(s) PyMem_Malloc(s)
  356. #define PyObject_Free(p) PyMem_Free(p)
  357. #define PyObject_Realloc(p) PyMem_Realloc(p)
  358. #endif
  359. #if CYTHON_COMPILING_IN_PYSTON
  360. #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
  361. #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
  362. #else
  363. #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
  364. #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
  365. #endif
  366. #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  367. #define __Pyx_PyThreadState_Current PyThreadState_GET()
  368. #elif PY_VERSION_HEX >= 0x03060000
  369. #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
  370. #elif PY_VERSION_HEX >= 0x03000000
  371. #define __Pyx_PyThreadState_Current PyThreadState_GET()
  372. #else
  373. #define __Pyx_PyThreadState_Current _PyThreadState_Current
  374. #endif
  375. #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
  376. #include "pythread.h"
  377. #define Py_tss_NEEDS_INIT 0
  378. typedef int Py_tss_t;
  379. static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  380. *key = PyThread_create_key();
  381. return 0; // PyThread_create_key reports success always
  382. }
  383. static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  384. Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  385. *key = Py_tss_NEEDS_INIT;
  386. return key;
  387. }
  388. static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  389. PyObject_Free(key);
  390. }
  391. static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  392. return *key != Py_tss_NEEDS_INIT;
  393. }
  394. static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  395. PyThread_delete_key(*key);
  396. *key = Py_tss_NEEDS_INIT;
  397. }
  398. static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  399. return PyThread_set_key_value(*key, value);
  400. }
  401. static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  402. return PyThread_get_key_value(*key);
  403. }
  404. #endif // TSS (Thread Specific Storage) API
  405. #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
  406. #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
  407. #else
  408. #define __Pyx_PyDict_NewPresized(n) PyDict_New()
  409. #endif
  410. #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  411. #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
  412. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
  413. #else
  414. #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
  415. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
  416. #endif
  417. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
  418. #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
  419. #else
  420. #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
  421. #endif
  422. #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  423. #define CYTHON_PEP393_ENABLED 1
  424. #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
  425. 0 : _PyUnicode_Ready((PyObject *)(op)))
  426. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
  427. #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  428. #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
  429. #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
  430. #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
  431. #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
  432. #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
  433. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
  434. #else
  435. #define CYTHON_PEP393_ENABLED 0
  436. #define PyUnicode_1BYTE_KIND 1
  437. #define PyUnicode_2BYTE_KIND 2
  438. #define PyUnicode_4BYTE_KIND 4
  439. #define __Pyx_PyUnicode_READY(op) (0)
  440. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
  441. #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  442. #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  443. #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
  444. #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
  445. #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  446. #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  447. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
  448. #endif
  449. #if CYTHON_COMPILING_IN_PYPY
  450. #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
  451. #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
  452. #else
  453. #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
  454. #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
  455. PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
  456. #endif
  457. #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  458. #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
  459. #endif
  460. #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  461. #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
  462. #endif
  463. #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  464. #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
  465. #endif
  466. #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
  467. #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
  468. #if PY_MAJOR_VERSION >= 3
  469. #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
  470. #else
  471. #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
  472. #endif
  473. #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  474. #define PyObject_ASCII(o) PyObject_Repr(o)
  475. #endif
  476. #if PY_MAJOR_VERSION >= 3
  477. #define PyBaseString_Type PyUnicode_Type
  478. #define PyStringObject PyUnicodeObject
  479. #define PyString_Type PyUnicode_Type
  480. #define PyString_Check PyUnicode_Check
  481. #define PyString_CheckExact PyUnicode_CheckExact
  482. #define PyObject_Unicode PyObject_Str
  483. #endif
  484. #if PY_MAJOR_VERSION >= 3
  485. #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  486. #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
  487. #else
  488. #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  489. #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
  490. #endif
  491. #ifndef PySet_CheckExact
  492. #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
  493. #endif
  494. #if CYTHON_ASSUME_SAFE_MACROS
  495. #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
  496. #else
  497. #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
  498. #endif
  499. #if PY_MAJOR_VERSION >= 3
  500. #define PyIntObject PyLongObject
  501. #define PyInt_Type PyLong_Type
  502. #define PyInt_Check(op) PyLong_Check(op)
  503. #define PyInt_CheckExact(op) PyLong_CheckExact(op)
  504. #define PyInt_FromString PyLong_FromString
  505. #define PyInt_FromUnicode PyLong_FromUnicode
  506. #define PyInt_FromLong PyLong_FromLong
  507. #define PyInt_FromSize_t PyLong_FromSize_t
  508. #define PyInt_FromSsize_t PyLong_FromSsize_t
  509. #define PyInt_AsLong PyLong_AsLong
  510. #define PyInt_AS_LONG PyLong_AS_LONG
  511. #define PyInt_AsSsize_t PyLong_AsSsize_t
  512. #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
  513. #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  514. #define PyNumber_Int PyNumber_Long
  515. #endif
  516. #if PY_MAJOR_VERSION >= 3
  517. #define PyBoolObject PyLongObject
  518. #endif
  519. #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  520. #ifndef PyUnicode_InternFromString
  521. #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  522. #endif
  523. #endif
  524. #if PY_VERSION_HEX < 0x030200A4
  525. typedef long Py_hash_t;
  526. #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  527. #define __Pyx_PyInt_AsHash_t PyInt_AsLong
  528. #else
  529. #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  530. #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
  531. #endif
  532. #if PY_MAJOR_VERSION >= 3
  533. #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
  534. #else
  535. #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
  536. #endif
  537. #if CYTHON_USE_ASYNC_SLOTS
  538. #if PY_VERSION_HEX >= 0x030500B1
  539. #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
  540. #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  541. #else
  542. #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  543. #endif
  544. #else
  545. #define __Pyx_PyType_AsAsync(obj) NULL
  546. #endif
  547. #ifndef __Pyx_PyAsyncMethodsStruct
  548. typedef struct {
  549. unaryfunc am_await;
  550. unaryfunc am_aiter;
  551. unaryfunc am_anext;
  552. } __Pyx_PyAsyncMethodsStruct;
  553. #endif
  554. #if defined(WIN32) || defined(MS_WINDOWS)
  555. #define _USE_MATH_DEFINES
  556. #endif
  557. #include <math.h>
  558. #ifdef NAN
  559. #define __PYX_NAN() ((float) NAN)
  560. #else
  561. static CYTHON_INLINE float __PYX_NAN() {
  562. float value;
  563. memset(&value, 0xFF, sizeof(value));
  564. return value;
  565. }
  566. #endif
  567. #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
  568. #define __Pyx_truncl trunc
  569. #else
  570. #define __Pyx_truncl truncl
  571. #endif
  572. #define __PYX_ERR(f_index, lineno, Ln_error) \
  573. { \
  574. __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
  575. }
  576. #ifndef __PYX_EXTERN_C
  577. #ifdef __cplusplus
  578. #define __PYX_EXTERN_C extern "C"
  579. #else
  580. #define __PYX_EXTERN_C extern
  581. #endif
  582. #endif
  583. #define __PYX_HAVE__lakesuperior__store__ldp_rs__lmdb_triplestore
  584. #define __PYX_HAVE_API__lakesuperior__store__ldp_rs__lmdb_triplestore
  585. /* Early includes */
  586. #include <stdint.h>
  587. #include <sys/types.h>
  588. #include "lmdb.h"
  589. #include <string.h>
  590. #include <stdlib.h>
  591. #include <openssl/sha.h>
  592. #ifdef _OPENMP
  593. #include <omp.h>
  594. #endif /* _OPENMP */
  595. #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
  596. #define CYTHON_WITHOUT_ASSERTIONS
  597. #endif
  598. typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
  599. const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
  600. #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
  601. #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
  602. #define __PYX_DEFAULT_STRING_ENCODING ""
  603. #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
  604. #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  605. #define __Pyx_uchar_cast(c) ((unsigned char)c)
  606. #define __Pyx_long_cast(x) ((long)x)
  607. #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
  608. (sizeof(type) < sizeof(Py_ssize_t)) ||\
  609. (sizeof(type) > sizeof(Py_ssize_t) &&\
  610. likely(v < (type)PY_SSIZE_T_MAX ||\
  611. v == (type)PY_SSIZE_T_MAX) &&\
  612. (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
  613. v == (type)PY_SSIZE_T_MIN))) ||\
  614. (sizeof(type) == sizeof(Py_ssize_t) &&\
  615. (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
  616. v == (type)PY_SSIZE_T_MAX))) )
  617. #if defined (__cplusplus) && __cplusplus >= 201103L
  618. #include <cstdlib>
  619. #define __Pyx_sst_abs(value) std::abs(value)
  620. #elif SIZEOF_INT >= SIZEOF_SIZE_T
  621. #define __Pyx_sst_abs(value) abs(value)
  622. #elif SIZEOF_LONG >= SIZEOF_SIZE_T
  623. #define __Pyx_sst_abs(value) labs(value)
  624. #elif defined (_MSC_VER)
  625. #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
  626. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  627. #define __Pyx_sst_abs(value) llabs(value)
  628. #elif defined (__GNUC__)
  629. #define __Pyx_sst_abs(value) __builtin_llabs(value)
  630. #else
  631. #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
  632. #endif
  633. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
  634. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
  635. #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
  636. #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
  637. #define __Pyx_PyBytes_FromString PyBytes_FromString
  638. #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
  639. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
  640. #if PY_MAJOR_VERSION < 3
  641. #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
  642. #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  643. #else
  644. #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
  645. #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
  646. #endif
  647. #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
  648. #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
  649. #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
  650. #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
  651. #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
  652. #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
  653. #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
  654. #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
  655. #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
  656. #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
  657. #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
  658. #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
  659. #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
  660. #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
  661. #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
  662. #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
  663. static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
  664. const Py_UNICODE *u_end = u;
  665. while (*u_end++) ;
  666. return (size_t)(u_end - u - 1);
  667. }
  668. #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
  669. #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
  670. #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
  671. #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
  672. #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
  673. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
  674. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
  675. static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
  676. #define __Pyx_PySequence_Tuple(obj)\
  677. (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
  678. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
  679. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
  680. #if CYTHON_ASSUME_SAFE_MACROS
  681. #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
  682. #else
  683. #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
  684. #endif
  685. #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
  686. #if PY_MAJOR_VERSION >= 3
  687. #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
  688. #else
  689. #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
  690. #endif
  691. #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
  692. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  693. static int __Pyx_sys_getdefaultencoding_not_ascii;
  694. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  695. PyObject* sys;
  696. PyObject* default_encoding = NULL;
  697. PyObject* ascii_chars_u = NULL;
  698. PyObject* ascii_chars_b = NULL;
  699. const char* default_encoding_c;
  700. sys = PyImport_ImportModule("sys");
  701. if (!sys) goto bad;
  702. default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
  703. Py_DECREF(sys);
  704. if (!default_encoding) goto bad;
  705. default_encoding_c = PyBytes_AsString(default_encoding);
  706. if (!default_encoding_c) goto bad;
  707. if (strcmp(default_encoding_c, "ascii") == 0) {
  708. __Pyx_sys_getdefaultencoding_not_ascii = 0;
  709. } else {
  710. char ascii_chars[128];
  711. int c;
  712. for (c = 0; c < 128; c++) {
  713. ascii_chars[c] = c;
  714. }
  715. __Pyx_sys_getdefaultencoding_not_ascii = 1;
  716. ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
  717. if (!ascii_chars_u) goto bad;
  718. ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
  719. if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
  720. PyErr_Format(
  721. PyExc_ValueError,
  722. "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
  723. default_encoding_c);
  724. goto bad;
  725. }
  726. Py_DECREF(ascii_chars_u);
  727. Py_DECREF(ascii_chars_b);
  728. }
  729. Py_DECREF(default_encoding);
  730. return 0;
  731. bad:
  732. Py_XDECREF(default_encoding);
  733. Py_XDECREF(ascii_chars_u);
  734. Py_XDECREF(ascii_chars_b);
  735. return -1;
  736. }
  737. #endif
  738. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
  739. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
  740. #else
  741. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
  742. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  743. static char* __PYX_DEFAULT_STRING_ENCODING;
  744. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  745. PyObject* sys;
  746. PyObject* default_encoding = NULL;
  747. char* default_encoding_c;
  748. sys = PyImport_ImportModule("sys");
  749. if (!sys) goto bad;
  750. default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
  751. Py_DECREF(sys);
  752. if (!default_encoding) goto bad;
  753. default_encoding_c = PyBytes_AsString(default_encoding);
  754. if (!default_encoding_c) goto bad;
  755. __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
  756. if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
  757. strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
  758. Py_DECREF(default_encoding);
  759. return 0;
  760. bad:
  761. Py_XDECREF(default_encoding);
  762. return -1;
  763. }
  764. #endif
  765. #endif
  766. /* Test for GCC > 2.95 */
  767. #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  768. #define likely(x) __builtin_expect(!!(x), 1)
  769. #define unlikely(x) __builtin_expect(!!(x), 0)
  770. #else /* !__GNUC__ or GCC < 2.95 */
  771. #define likely(x) (x)
  772. #define unlikely(x) (x)
  773. #endif /* __GNUC__ */
  774. static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
  775. static PyObject *__pyx_m = NULL;
  776. static PyObject *__pyx_d;
  777. static PyObject *__pyx_b;
  778. static PyObject *__pyx_cython_runtime = NULL;
  779. static PyObject *__pyx_empty_tuple;
  780. static PyObject *__pyx_empty_bytes;
  781. static PyObject *__pyx_empty_unicode;
  782. static int __pyx_lineno;
  783. static int __pyx_clineno = 0;
  784. static const char * __pyx_cfilenm= __FILE__;
  785. static const char *__pyx_filename;
  786. static const char *__pyx_f[] = {
  787. "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx",
  788. "stringsource",
  789. };
  790. /* NoFastGil.proto */
  791. #define __Pyx_PyGILState_Ensure PyGILState_Ensure
  792. #define __Pyx_PyGILState_Release PyGILState_Release
  793. #define __Pyx_FastGIL_Remember()
  794. #define __Pyx_FastGIL_Forget()
  795. #define __Pyx_FastGilFuncInit()
  796. /*--- Type declarations ---*/
  797. struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore;
  798. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet;
  799. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph;
  800. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr;
  801. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore;
  802. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple;
  803. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr;
  804. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts;
  805. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples;
  806. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms;
  807. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store__check;
  808. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__init_dbis;
  809. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__txn_begin;
  810. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__key_exists;
  811. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__cur_open;
  812. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore_get_dbi;
  813. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__put;
  814. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__get_data;
  815. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__delete;
  816. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore_close_env;
  817. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore_destroy;
  818. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore_get_data;
  819. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore_stats;
  820. /* "lakesuperior/store/base_lmdb_store.pxd":10
  821. * lmdb.MDB_dbi dbi
  822. *
  823. * void _check(int rc, str message=*) except * # <<<<<<<<<<<<<<
  824. *
  825. *
  826. */
  827. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store__check {
  828. int __pyx_n;
  829. PyObject *message;
  830. };
  831. /* "lakesuperior/store/base_lmdb_store.pxd":26
  832. * void _clear_stale_readers(self) except *
  833. * void _cur_close(self, lmdb.MDB_cursor *cur) except *
  834. * void _init_dbis(self, create=*) except * # <<<<<<<<<<<<<<
  835. * void _txn_begin(self, write=*, lmdb.MDB_txn *parent=*) except *
  836. * void _txn_commit(self) except *
  837. */
  838. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__init_dbis {
  839. int __pyx_n;
  840. PyObject *create;
  841. };
  842. /* "lakesuperior/store/base_lmdb_store.pxd":27
  843. * void _cur_close(self, lmdb.MDB_cursor *cur) except *
  844. * void _init_dbis(self, create=*) except *
  845. * void _txn_begin(self, write=*, lmdb.MDB_txn *parent=*) except * # <<<<<<<<<<<<<<
  846. * void _txn_commit(self) except *
  847. * void _txn_abort(self) except *
  848. */
  849. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__txn_begin {
  850. int __pyx_n;
  851. PyObject *write;
  852. MDB_txn *parent;
  853. };
  854. /* "lakesuperior/store/base_lmdb_store.pxd":30
  855. * void _txn_commit(self) except *
  856. * void _txn_abort(self) except *
  857. * inline bint _key_exists( # <<<<<<<<<<<<<<
  858. * self, unsigned char *key, unsigned char klen,
  859. * unsigned char *dblabel=*) except -1
  860. */
  861. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__key_exists {
  862. int __pyx_n;
  863. unsigned char *dblabel;
  864. };
  865. /* "lakesuperior/store/base_lmdb_store.pxd":35
  866. *
  867. * size_t _txn_id(self) except -1
  868. * lmdb.MDB_cursor *_cur_open( # <<<<<<<<<<<<<<
  869. * self, unsigned char *dblabel=*, lmdb.MDB_txn *txn=*) except *
  870. *
  871. */
  872. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__cur_open {
  873. int __pyx_n;
  874. unsigned char *dblabel;
  875. MDB_txn *txn;
  876. };
  877. /* "lakesuperior/store/base_lmdb_store.pxd":38
  878. * self, unsigned char *dblabel=*, lmdb.MDB_txn *txn=*) except *
  879. *
  880. * lmdb.MDB_dbi get_dbi( # <<<<<<<<<<<<<<
  881. * self, unsigned char *dblabel=*, lmdb.MDB_txn *txn=*)
  882. *
  883. */
  884. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore_get_dbi {
  885. int __pyx_n;
  886. unsigned char *dblabel;
  887. MDB_txn *txn;
  888. };
  889. /* "lakesuperior/store/base_lmdb_store.pxd":41
  890. * self, unsigned char *dblabel=*, lmdb.MDB_txn *txn=*)
  891. *
  892. * void _put( # <<<<<<<<<<<<<<
  893. * self, unsigned char *key, size_t key_size, unsigned char *data,
  894. * size_t data_size, unsigned char *dblabel=*,
  895. */
  896. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__put {
  897. int __pyx_n;
  898. unsigned char *dblabel;
  899. MDB_txn *txn;
  900. unsigned int flags;
  901. };
  902. /* "lakesuperior/store/base_lmdb_store.pxd":46
  903. * lmdb.MDB_txn *txn=*, unsigned int flags=*) except *
  904. *
  905. * void _get_data( # <<<<<<<<<<<<<<
  906. * self, unsigned char *key, size_t klen, lmdb.MDB_val *rv,
  907. * unsigned char *dblabel=*) except *
  908. */
  909. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__get_data {
  910. int __pyx_n;
  911. unsigned char *dblabel;
  912. };
  913. /* "lakesuperior/store/base_lmdb_store.pxd":50
  914. * unsigned char *dblabel=*) except *
  915. *
  916. * void _delete( # <<<<<<<<<<<<<<
  917. * self, unsigned char *key, size_t klen,
  918. * unsigned char *dblabel=*) except *
  919. */
  920. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__delete {
  921. int __pyx_n;
  922. unsigned char *dblabel;
  923. };
  924. /* "lakesuperior/store/base_lmdb_store.pxd":57
  925. * #int _reader_list_callback(self, const unsigned char *msg, void *str_)
  926. *
  927. * cpdef void close_env(self, bint commit_pending_transaction=*) except * # <<<<<<<<<<<<<<
  928. * cpdef void destroy(self, _path=*) except *
  929. * #cpdef get_dup_data(self, unsigned char *key, db=*)
  930. */
  931. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore_close_env {
  932. int __pyx_n;
  933. int commit_pending_transaction;
  934. };
  935. /* "lakesuperior/store/base_lmdb_store.pxd":58
  936. *
  937. * cpdef void close_env(self, bint commit_pending_transaction=*) except *
  938. * cpdef void destroy(self, _path=*) except * # <<<<<<<<<<<<<<
  939. * #cpdef get_dup_data(self, unsigned char *key, db=*)
  940. * #cpdef get_all_pairs(self, db=*)
  941. */
  942. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore_destroy {
  943. int __pyx_n;
  944. PyObject *_path;
  945. };
  946. /* "lakesuperior/store/base_lmdb_store.pxd":61
  947. * #cpdef get_dup_data(self, unsigned char *key, db=*)
  948. * #cpdef get_all_pairs(self, db=*)
  949. * cpdef bytes get_data(self, key, dblabel=*) # <<<<<<<<<<<<<<
  950. * cpdef dict stats(self, new_txn=*)
  951. * cpdef int txn_id(self)
  952. */
  953. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore_get_data {
  954. int __pyx_n;
  955. PyObject *dblabel;
  956. };
  957. /* "lakesuperior/store/base_lmdb_store.pxd":62
  958. * #cpdef get_all_pairs(self, db=*)
  959. * cpdef bytes get_data(self, key, dblabel=*)
  960. * cpdef dict stats(self, new_txn=*) # <<<<<<<<<<<<<<
  961. * cpdef int txn_id(self)
  962. * #cpdef str reader_list(self)
  963. */
  964. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore_stats {
  965. int __pyx_n;
  966. PyObject *new_txn;
  967. };
  968. struct __pyx_t_12lakesuperior_5store_6ldp_rs_4term_IdentifierTerm;
  969. struct __pyx_t_12lakesuperior_5store_6ldp_rs_4term_LiteralTerm;
  970. /* "lakesuperior/store/ldp_rs/term.pxd":10
  971. * #size_t pack_size
  972. *
  973. * struct IdentifierTerm: # <<<<<<<<<<<<<<
  974. * char type
  975. * unsigned char *data
  976. */
  977. struct __pyx_t_12lakesuperior_5store_6ldp_rs_4term_IdentifierTerm {
  978. char type;
  979. unsigned char *data;
  980. };
  981. /* "lakesuperior/store/ldp_rs/term.pxd":14
  982. * unsigned char *data
  983. *
  984. * struct LiteralTerm: # <<<<<<<<<<<<<<
  985. * char type
  986. * unsigned char *data
  987. */
  988. struct __pyx_t_12lakesuperior_5store_6ldp_rs_4term_LiteralTerm {
  989. char type;
  990. unsigned char *data;
  991. unsigned char *datatype;
  992. unsigned char *lang;
  993. };
  994. struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_stats;
  995. struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__len;
  996. struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_add;
  997. struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__remove;
  998. struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_triple_keys;
  999. struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_all_contexts;
  1000. struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__append;
  1001. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":81
  1002. *
  1003. *
  1004. * ctypedef unsigned char Key[KLEN] # <<<<<<<<<<<<<<
  1005. * ctypedef unsigned char DoubleKey[DBL_KLEN]
  1006. * ctypedef unsigned char TripleKey[TRP_KLEN]
  1007. */
  1008. typedef unsigned char __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Key[5];
  1009. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":82
  1010. *
  1011. * ctypedef unsigned char Key[KLEN]
  1012. * ctypedef unsigned char DoubleKey[DBL_KLEN] # <<<<<<<<<<<<<<
  1013. * ctypedef unsigned char TripleKey[TRP_KLEN]
  1014. * ctypedef unsigned char QuadKey[QUAD_KLEN]
  1015. */
  1016. typedef unsigned char __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_DoubleKey[10];
  1017. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":83
  1018. * ctypedef unsigned char Key[KLEN]
  1019. * ctypedef unsigned char DoubleKey[DBL_KLEN]
  1020. * ctypedef unsigned char TripleKey[TRP_KLEN] # <<<<<<<<<<<<<<
  1021. * ctypedef unsigned char QuadKey[QUAD_KLEN]
  1022. * ctypedef unsigned char Hash[HLEN]
  1023. */
  1024. typedef unsigned char __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_TripleKey[15];
  1025. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":84
  1026. * ctypedef unsigned char DoubleKey[DBL_KLEN]
  1027. * ctypedef unsigned char TripleKey[TRP_KLEN]
  1028. * ctypedef unsigned char QuadKey[QUAD_KLEN] # <<<<<<<<<<<<<<
  1029. * ctypedef unsigned char Hash[HLEN]
  1030. *
  1031. */
  1032. typedef unsigned char __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_QuadKey[20];
  1033. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":85
  1034. * ctypedef unsigned char TripleKey[TRP_KLEN]
  1035. * ctypedef unsigned char QuadKey[QUAD_KLEN]
  1036. * ctypedef unsigned char Hash[HLEN] # <<<<<<<<<<<<<<
  1037. *
  1038. *
  1039. */
  1040. typedef unsigned char __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Hash[20];
  1041. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":653
  1042. * # DB management methods.
  1043. *
  1044. * cpdef dict stats(self, new_txn=True): # <<<<<<<<<<<<<<
  1045. * """Gather statistics about the database."""
  1046. * st = self._stats()
  1047. */
  1048. struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_stats {
  1049. int __pyx_n;
  1050. PyObject *new_txn;
  1051. };
  1052. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":661
  1053. *
  1054. *
  1055. * cpdef size_t _len(self, context=None) except -1: # <<<<<<<<<<<<<<
  1056. * """
  1057. * Return the length of the dataset.
  1058. */
  1059. struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__len {
  1060. int __pyx_n;
  1061. PyObject *context;
  1062. };
  1063. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":696
  1064. * # Triple and graph methods.
  1065. *
  1066. * cpdef add(self, triple, context=None, quoted=False): # <<<<<<<<<<<<<<
  1067. * """
  1068. * Add a triple and start indexing.
  1069. */
  1070. struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_add {
  1071. int __pyx_n;
  1072. PyObject *context;
  1073. PyObject *quoted;
  1074. };
  1075. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":875
  1076. *
  1077. *
  1078. * cpdef void _remove(self, tuple triple_pattern, context=None) except *: # <<<<<<<<<<<<<<
  1079. * cdef:
  1080. * unsigned char spok[TRP_KLEN]
  1081. */
  1082. struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__remove {
  1083. int __pyx_n;
  1084. PyObject *context;
  1085. };
  1086. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1229
  1087. *
  1088. *
  1089. * cpdef ResultSet triple_keys(self, tuple triple_pattern, context=None): # <<<<<<<<<<<<<<
  1090. * """
  1091. * Top-level lookup method.
  1092. */
  1093. struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_triple_keys {
  1094. int __pyx_n;
  1095. PyObject *context;
  1096. };
  1097. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1784
  1098. *
  1099. *
  1100. * cpdef tuple all_contexts(self, triple=None): # <<<<<<<<<<<<<<
  1101. * """
  1102. * Get a list of all contexts.
  1103. */
  1104. struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_all_contexts {
  1105. int __pyx_n;
  1106. PyObject *triple;
  1107. };
  1108. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1939
  1109. *
  1110. *
  1111. * cdef void _append( # <<<<<<<<<<<<<<
  1112. * self, unsigned char *value, size_t vlen, Key *nkey,
  1113. * unsigned char *dblabel=b'', lmdb.MDB_txn *txn=NULL,
  1114. */
  1115. struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__append {
  1116. int __pyx_n;
  1117. unsigned char *dblabel;
  1118. MDB_txn *txn;
  1119. unsigned int flags;
  1120. };
  1121. /* "lakesuperior/store/base_lmdb_store.pxd":13
  1122. *
  1123. *
  1124. * cdef class BaseLmdbStore: # <<<<<<<<<<<<<<
  1125. * cdef:
  1126. * readonly bint is_txn_open
  1127. */
  1128. struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore {
  1129. PyObject_HEAD
  1130. struct __pyx_vtabstruct_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *__pyx_vtab;
  1131. int is_txn_open;
  1132. int _open;
  1133. unsigned int _readers;
  1134. PyObject *env_path;
  1135. MDB_dbi *dbis;
  1136. MDB_env *dbenv;
  1137. MDB_txn *txn;
  1138. MDB_cursor **curs;
  1139. };
  1140. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":131
  1141. *
  1142. *
  1143. * cdef class ResultSet: # <<<<<<<<<<<<<<
  1144. * """
  1145. * Pre-allocated result set.
  1146. */
  1147. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet {
  1148. PyObject_HEAD
  1149. struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_vtab;
  1150. unsigned char *data;
  1151. unsigned char itemsize;
  1152. size_t ct;
  1153. size_t size;
  1154. };
  1155. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":237
  1156. *
  1157. *
  1158. * cdef class SimpleGraph: # <<<<<<<<<<<<<<
  1159. * """
  1160. * Fast and simple implementation of a graph.
  1161. */
  1162. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph {
  1163. PyObject_HEAD
  1164. struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_vtab;
  1165. PyObject *data;
  1166. };
  1167. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":460
  1168. *
  1169. *
  1170. * cdef class Imr(SimpleGraph): # <<<<<<<<<<<<<<
  1171. * """
  1172. * In-memory resource data container.
  1173. */
  1174. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr {
  1175. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph __pyx_base;
  1176. PyObject *uri;
  1177. };
  1178. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":585
  1179. *
  1180. *
  1181. * cdef class LmdbTriplestore(BaseLmdbStore): # <<<<<<<<<<<<<<
  1182. *
  1183. * """
  1184. */
  1185. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore {
  1186. struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore __pyx_base;
  1187. };
  1188. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":206
  1189. * # Access methods.
  1190. *
  1191. * def to_tuple(self): # <<<<<<<<<<<<<<
  1192. * """
  1193. * Return the data set as a Python tuple.
  1194. */
  1195. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple {
  1196. PyObject_HEAD
  1197. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_self;
  1198. };
  1199. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":211
  1200. * """
  1201. * return tuple(
  1202. * self.data[i: i + self.itemsize] # <<<<<<<<<<<<<<
  1203. * for i in range(0, self.size, self.itemsize))
  1204. *
  1205. */
  1206. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr {
  1207. PyObject_HEAD
  1208. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple *__pyx_outer_scope;
  1209. PyObject *__pyx_v_i;
  1210. PyObject *__pyx_t_0;
  1211. Py_ssize_t __pyx_t_1;
  1212. PyObject *(*__pyx_t_2)(PyObject *);
  1213. };
  1214. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1157
  1215. *
  1216. * # TODO Deprecate RDFLib API?
  1217. * def contexts(self, triple=None): # <<<<<<<<<<<<<<
  1218. * """
  1219. * Get a list of all contexts.
  1220. */
  1221. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts {
  1222. PyObject_HEAD
  1223. PyObject *__pyx_v_ctx_uri;
  1224. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self;
  1225. PyObject *__pyx_v_triple;
  1226. PyObject *__pyx_t_0;
  1227. Py_ssize_t __pyx_t_1;
  1228. };
  1229. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1167
  1230. *
  1231. *
  1232. * def triples(self, triple_pattern, context=None): # <<<<<<<<<<<<<<
  1233. * """
  1234. * Generator over matching triples.
  1235. */
  1236. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples {
  1237. PyObject_HEAD
  1238. PyObject *__pyx_v_c_uri;
  1239. unsigned char __pyx_v_ck[5];
  1240. PyObject *__pyx_v_context;
  1241. PyObject *__pyx_v_contexts;
  1242. MDB_cursor *__pyx_v_cur;
  1243. struct MDB_val __pyx_v_data_v;
  1244. size_t __pyx_v_i;
  1245. size_t __pyx_v_j;
  1246. struct MDB_val __pyx_v_key_v;
  1247. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_rset;
  1248. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self;
  1249. unsigned char __pyx_v_spok[15];
  1250. PyObject *__pyx_v_triple_pattern;
  1251. size_t __pyx_t_0;
  1252. size_t __pyx_t_1;
  1253. size_t __pyx_t_2;
  1254. };
  1255. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1741
  1256. *
  1257. *
  1258. * def all_terms(self, term_type): # <<<<<<<<<<<<<<
  1259. * """
  1260. * Return all terms of a type (``s``, ``p``, or ``o``) in the store.
  1261. */
  1262. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms {
  1263. PyObject_HEAD
  1264. PyObject *__pyx_v_key;
  1265. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self;
  1266. PyObject *__pyx_v_term_type;
  1267. PyObject *__pyx_t_0;
  1268. Py_ssize_t __pyx_t_1;
  1269. PyObject *(*__pyx_t_2)(PyObject *);
  1270. };
  1271. /* "lakesuperior/store/base_lmdb_store.pxd":13
  1272. *
  1273. *
  1274. * cdef class BaseLmdbStore: # <<<<<<<<<<<<<<
  1275. * cdef:
  1276. * readonly bint is_txn_open
  1277. */
  1278. struct __pyx_vtabstruct_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore {
  1279. void (*_clear_stale_readers)(struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *);
  1280. void (*_cur_close)(struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *, MDB_cursor *);
  1281. void (*_init_dbis)(struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *, struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__init_dbis *__pyx_optional_args);
  1282. void (*_txn_begin)(struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *, struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__txn_begin *__pyx_optional_args);
  1283. void (*_txn_commit)(struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *);
  1284. void (*_txn_abort)(struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *);
  1285. int (*_key_exists)(struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *, unsigned char *, unsigned char, struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__key_exists *__pyx_optional_args);
  1286. size_t (*_txn_id)(struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *);
  1287. MDB_cursor *(*_cur_open)(struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *, struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__cur_open *__pyx_optional_args);
  1288. MDB_dbi (*get_dbi)(struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *, struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore_get_dbi *__pyx_optional_args);
  1289. void (*_put)(struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *, unsigned char *, size_t, unsigned char *, size_t, struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__put *__pyx_optional_args);
  1290. void (*_get_data)(struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *, unsigned char *, size_t, struct MDB_val *, struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__get_data *__pyx_optional_args);
  1291. void (*_delete)(struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *, unsigned char *, size_t, struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__delete *__pyx_optional_args);
  1292. PyObject *(*_stats)(struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *);
  1293. void (*close_env)(struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore_close_env *__pyx_optional_args);
  1294. void (*destroy)(struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore_destroy *__pyx_optional_args);
  1295. PyObject *(*get_data)(struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore_get_data *__pyx_optional_args);
  1296. PyObject *(*stats)(struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore_stats *__pyx_optional_args);
  1297. int (*txn_id)(struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *, int __pyx_skip_dispatch);
  1298. };
  1299. static struct __pyx_vtabstruct_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *__pyx_vtabptr_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore;
  1300. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":131
  1301. *
  1302. *
  1303. * cdef class ResultSet: # <<<<<<<<<<<<<<
  1304. * """
  1305. * Pre-allocated result set.
  1306. */
  1307. struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet {
  1308. void (*resize)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *, size_t);
  1309. unsigned char *(*get_item)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *, PyObject *);
  1310. };
  1311. static struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_vtabptr_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet;
  1312. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":237
  1313. *
  1314. *
  1315. * cdef class SimpleGraph: # <<<<<<<<<<<<<<
  1316. * """
  1317. * Fast and simple implementation of a graph.
  1318. */
  1319. struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph {
  1320. void (*_data_from_lookup)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *, PyObject *, struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *);
  1321. void (*set)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *, PyObject *, int __pyx_skip_dispatch);
  1322. void (*remove_triples)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *, PyObject *, int __pyx_skip_dispatch);
  1323. PyObject *(*as_rdflib)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *, int __pyx_skip_dispatch);
  1324. PyObject *(*_slice)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *, PyObject *, PyObject *, PyObject *);
  1325. PyObject *(*lookup)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch);
  1326. PyObject *(*terms)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *, PyObject *, int __pyx_skip_dispatch);
  1327. };
  1328. static struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_vtabptr_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph;
  1329. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":460
  1330. *
  1331. *
  1332. * cdef class Imr(SimpleGraph): # <<<<<<<<<<<<<<
  1333. * """
  1334. * In-memory resource data container.
  1335. */
  1336. struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr {
  1337. struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph __pyx_base;
  1338. };
  1339. static struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *__pyx_vtabptr_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr;
  1340. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":585
  1341. *
  1342. *
  1343. * cdef class LmdbTriplestore(BaseLmdbStore): # <<<<<<<<<<<<<<
  1344. *
  1345. * """
  1346. */
  1347. struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore {
  1348. struct __pyx_vtabstruct_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore __pyx_base;
  1349. size_t (*_len)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__len *__pyx_optional_args);
  1350. PyObject *(*add)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_add *__pyx_optional_args);
  1351. PyObject *(*add_graph)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, PyObject *, int __pyx_skip_dispatch);
  1352. void (*_add_graph)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, unsigned char *, size_t, int __pyx_skip_dispatch);
  1353. void (*_remove)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__remove *__pyx_optional_args);
  1354. void (*_index_triple)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, PyObject *, unsigned char *);
  1355. void (*_remove_graph)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, PyObject *, int __pyx_skip_dispatch);
  1356. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *(*triple_keys)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_triple_keys *__pyx_optional_args);
  1357. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *(*_lookup)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, PyObject *);
  1358. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *(*_lookup_1bound)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, unsigned char, PyObject *);
  1359. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *(*_lookup_2bound)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, unsigned char, PyObject *, unsigned char, PyObject *);
  1360. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *(*_all_term_keys)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, PyObject *, int __pyx_skip_dispatch);
  1361. PyObject *(*all_namespaces)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, int __pyx_skip_dispatch);
  1362. PyObject *(*all_contexts)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_all_contexts *__pyx_optional_args);
  1363. PyObject *(*from_key)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, unsigned char *);
  1364. PyObject *(*from_trp_key)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, unsigned char *);
  1365. void (*_to_key)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, PyObject *, __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Key *);
  1366. void (*_to_triple_key)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, PyObject *, __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_TripleKey *);
  1367. void (*_append)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, unsigned char *, size_t, __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Key *, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__append *__pyx_optional_args);
  1368. void (*_next_key)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, unsigned char *, __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Key *);
  1369. };
  1370. static struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_vtabptr_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore;
  1371. static CYTHON_INLINE void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__to_key(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, PyObject *, __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Key *);
  1372. static CYTHON_INLINE void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__to_triple_key(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, PyObject *, __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_TripleKey *);
  1373. /* --- Runtime support code (head) --- */
  1374. /* Refnanny.proto */
  1375. #ifndef CYTHON_REFNANNY
  1376. #define CYTHON_REFNANNY 0
  1377. #endif
  1378. #if CYTHON_REFNANNY
  1379. typedef struct {
  1380. void (*INCREF)(void*, PyObject*, int);
  1381. void (*DECREF)(void*, PyObject*, int);
  1382. void (*GOTREF)(void*, PyObject*, int);
  1383. void (*GIVEREF)(void*, PyObject*, int);
  1384. void* (*SetupContext)(const char*, int, const char*);
  1385. void (*FinishContext)(void**);
  1386. } __Pyx_RefNannyAPIStruct;
  1387. static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  1388. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  1389. #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  1390. #ifdef WITH_THREAD
  1391. #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  1392. if (acquire_gil) {\
  1393. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  1394. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
  1395. PyGILState_Release(__pyx_gilstate_save);\
  1396. } else {\
  1397. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
  1398. }
  1399. #else
  1400. #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  1401. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  1402. #endif
  1403. #define __Pyx_RefNannyFinishContext()\
  1404. __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  1405. #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  1406. #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  1407. #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  1408. #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  1409. #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  1410. #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  1411. #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  1412. #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
  1413. #else
  1414. #define __Pyx_RefNannyDeclarations
  1415. #define __Pyx_RefNannySetupContext(name, acquire_gil)
  1416. #define __Pyx_RefNannyFinishContext()
  1417. #define __Pyx_INCREF(r) Py_INCREF(r)
  1418. #define __Pyx_DECREF(r) Py_DECREF(r)
  1419. #define __Pyx_GOTREF(r)
  1420. #define __Pyx_GIVEREF(r)
  1421. #define __Pyx_XINCREF(r) Py_XINCREF(r)
  1422. #define __Pyx_XDECREF(r) Py_XDECREF(r)
  1423. #define __Pyx_XGOTREF(r)
  1424. #define __Pyx_XGIVEREF(r)
  1425. #endif
  1426. #define __Pyx_XDECREF_SET(r, v) do {\
  1427. PyObject *tmp = (PyObject *) r;\
  1428. r = v; __Pyx_XDECREF(tmp);\
  1429. } while (0)
  1430. #define __Pyx_DECREF_SET(r, v) do {\
  1431. PyObject *tmp = (PyObject *) r;\
  1432. r = v; __Pyx_DECREF(tmp);\
  1433. } while (0)
  1434. #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
  1435. #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
  1436. /* PyObjectGetAttrStr.proto */
  1437. #if CYTHON_USE_TYPE_SLOTS
  1438. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
  1439. #else
  1440. #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
  1441. #endif
  1442. /* GetBuiltinName.proto */
  1443. static PyObject *__Pyx_GetBuiltinName(PyObject *name);
  1444. /* PyThreadStateGet.proto */
  1445. #if CYTHON_FAST_THREAD_STATE
  1446. #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
  1447. #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
  1448. #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
  1449. #else
  1450. #define __Pyx_PyThreadState_declare
  1451. #define __Pyx_PyThreadState_assign
  1452. #define __Pyx_PyErr_Occurred() PyErr_Occurred()
  1453. #endif
  1454. /* PyErrFetchRestore.proto */
  1455. #if CYTHON_FAST_THREAD_STATE
  1456. #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
  1457. #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
  1458. #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
  1459. #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
  1460. #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
  1461. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  1462. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1463. #if CYTHON_COMPILING_IN_CPYTHON
  1464. #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
  1465. #else
  1466. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1467. #endif
  1468. #else
  1469. #define __Pyx_PyErr_Clear() PyErr_Clear()
  1470. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1471. #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
  1472. #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
  1473. #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
  1474. #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
  1475. #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
  1476. #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
  1477. #endif
  1478. /* Profile.proto */
  1479. #ifndef CYTHON_PROFILE
  1480. #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
  1481. #define CYTHON_PROFILE 0
  1482. #else
  1483. #define CYTHON_PROFILE 1
  1484. #endif
  1485. #endif
  1486. #ifndef CYTHON_TRACE_NOGIL
  1487. #define CYTHON_TRACE_NOGIL 0
  1488. #else
  1489. #if CYTHON_TRACE_NOGIL && !defined(CYTHON_TRACE)
  1490. #define CYTHON_TRACE 1
  1491. #endif
  1492. #endif
  1493. #ifndef CYTHON_TRACE
  1494. #define CYTHON_TRACE 0
  1495. #endif
  1496. #if CYTHON_TRACE
  1497. #undef CYTHON_PROFILE_REUSE_FRAME
  1498. #endif
  1499. #ifndef CYTHON_PROFILE_REUSE_FRAME
  1500. #define CYTHON_PROFILE_REUSE_FRAME 0
  1501. #endif
  1502. #if CYTHON_PROFILE || CYTHON_TRACE
  1503. #include "compile.h"
  1504. #include "frameobject.h"
  1505. #include "traceback.h"
  1506. #if CYTHON_PROFILE_REUSE_FRAME
  1507. #define CYTHON_FRAME_MODIFIER static
  1508. #define CYTHON_FRAME_DEL(frame)
  1509. #else
  1510. #define CYTHON_FRAME_MODIFIER
  1511. #define CYTHON_FRAME_DEL(frame) Py_CLEAR(frame)
  1512. #endif
  1513. #define __Pyx_TraceDeclarations\
  1514. static PyCodeObject *__pyx_frame_code = NULL;\
  1515. CYTHON_FRAME_MODIFIER PyFrameObject *__pyx_frame = NULL;\
  1516. int __Pyx_use_tracing = 0;
  1517. #define __Pyx_TraceFrameInit(codeobj)\
  1518. if (codeobj) __pyx_frame_code = (PyCodeObject*) codeobj;
  1519. #ifdef WITH_THREAD
  1520. #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
  1521. if (nogil) {\
  1522. if (CYTHON_TRACE_NOGIL) {\
  1523. PyThreadState *tstate;\
  1524. PyGILState_STATE state = PyGILState_Ensure();\
  1525. tstate = __Pyx_PyThreadState_Current;\
  1526. if (unlikely(tstate->use_tracing) && !tstate->tracing &&\
  1527. (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) {\
  1528. __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
  1529. }\
  1530. PyGILState_Release(state);\
  1531. if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
  1532. }\
  1533. } else {\
  1534. PyThreadState* tstate = PyThreadState_GET();\
  1535. if (unlikely(tstate->use_tracing) && !tstate->tracing &&\
  1536. (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) {\
  1537. __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
  1538. if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
  1539. }\
  1540. }
  1541. #else
  1542. #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
  1543. { PyThreadState* tstate = PyThreadState_GET();\
  1544. if (unlikely(tstate->use_tracing) && !tstate->tracing &&\
  1545. (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) {\
  1546. __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
  1547. if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
  1548. }\
  1549. }
  1550. #endif
  1551. #define __Pyx_TraceException()\
  1552. if (likely(!__Pyx_use_tracing)); else {\
  1553. PyThreadState* tstate = __Pyx_PyThreadState_Current;\
  1554. if (tstate->use_tracing &&\
  1555. (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) {\
  1556. tstate->tracing++;\
  1557. tstate->use_tracing = 0;\
  1558. PyObject *exc_info = __Pyx_GetExceptionTuple(tstate);\
  1559. if (exc_info) {\
  1560. if (CYTHON_TRACE && tstate->c_tracefunc)\
  1561. tstate->c_tracefunc(\
  1562. tstate->c_traceobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
  1563. tstate->c_profilefunc(\
  1564. tstate->c_profileobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
  1565. Py_DECREF(exc_info);\
  1566. }\
  1567. tstate->use_tracing = 1;\
  1568. tstate->tracing--;\
  1569. }\
  1570. }
  1571. static void __Pyx_call_return_trace_func(PyThreadState *tstate, PyFrameObject *frame, PyObject *result) {
  1572. PyObject *type, *value, *traceback;
  1573. __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
  1574. tstate->tracing++;
  1575. tstate->use_tracing = 0;
  1576. if (CYTHON_TRACE && tstate->c_tracefunc)
  1577. tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_RETURN, result);
  1578. if (tstate->c_profilefunc)
  1579. tstate->c_profilefunc(tstate->c_profileobj, frame, PyTrace_RETURN, result);
  1580. CYTHON_FRAME_DEL(frame);
  1581. tstate->use_tracing = 1;
  1582. tstate->tracing--;
  1583. __Pyx_ErrRestoreInState(tstate, type, value, traceback);
  1584. }
  1585. #ifdef WITH_THREAD
  1586. #define __Pyx_TraceReturn(result, nogil)\
  1587. if (likely(!__Pyx_use_tracing)); else {\
  1588. if (nogil) {\
  1589. if (CYTHON_TRACE_NOGIL) {\
  1590. PyThreadState *tstate;\
  1591. PyGILState_STATE state = PyGILState_Ensure();\
  1592. tstate = __Pyx_PyThreadState_Current;\
  1593. if (tstate->use_tracing) {\
  1594. __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
  1595. }\
  1596. PyGILState_Release(state);\
  1597. }\
  1598. } else {\
  1599. PyThreadState* tstate = __Pyx_PyThreadState_Current;\
  1600. if (tstate->use_tracing) {\
  1601. __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
  1602. }\
  1603. }\
  1604. }
  1605. #else
  1606. #define __Pyx_TraceReturn(result, nogil)\
  1607. if (likely(!__Pyx_use_tracing)); else {\
  1608. PyThreadState* tstate = __Pyx_PyThreadState_Current;\
  1609. if (tstate->use_tracing) {\
  1610. __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
  1611. }\
  1612. }
  1613. #endif
  1614. static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno);
  1615. static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, PyThreadState* tstate, const char *funcname, const char *srcfile, int firstlineno);
  1616. #else
  1617. #define __Pyx_TraceDeclarations
  1618. #define __Pyx_TraceFrameInit(codeobj)
  1619. #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error) if ((1)); else goto_error;
  1620. #define __Pyx_TraceException()
  1621. #define __Pyx_TraceReturn(result, nogil)
  1622. #endif
  1623. #if CYTHON_TRACE
  1624. static int __Pyx_call_line_trace_func(PyThreadState *tstate, PyFrameObject *frame, int lineno) {
  1625. int ret;
  1626. PyObject *type, *value, *traceback;
  1627. __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
  1628. __Pyx_PyFrame_SetLineNumber(frame, lineno);
  1629. tstate->tracing++;
  1630. tstate->use_tracing = 0;
  1631. ret = tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_LINE, NULL);
  1632. tstate->use_tracing = 1;
  1633. tstate->tracing--;
  1634. if (likely(!ret)) {
  1635. __Pyx_ErrRestoreInState(tstate, type, value, traceback);
  1636. } else {
  1637. Py_XDECREF(type);
  1638. Py_XDECREF(value);
  1639. Py_XDECREF(traceback);
  1640. }
  1641. return ret;
  1642. }
  1643. #ifdef WITH_THREAD
  1644. #define __Pyx_TraceLine(lineno, nogil, goto_error)\
  1645. if (likely(!__Pyx_use_tracing)); else {\
  1646. if (nogil) {\
  1647. if (CYTHON_TRACE_NOGIL) {\
  1648. int ret = 0;\
  1649. PyThreadState *tstate;\
  1650. PyGILState_STATE state = PyGILState_Ensure();\
  1651. tstate = __Pyx_PyThreadState_Current;\
  1652. if (unlikely(tstate->use_tracing && tstate->c_tracefunc && __pyx_frame->f_trace)) {\
  1653. ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
  1654. }\
  1655. PyGILState_Release(state);\
  1656. if (unlikely(ret)) goto_error;\
  1657. }\
  1658. } else {\
  1659. PyThreadState* tstate = __Pyx_PyThreadState_Current;\
  1660. if (unlikely(tstate->use_tracing && tstate->c_tracefunc && __pyx_frame->f_trace)) {\
  1661. int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
  1662. if (unlikely(ret)) goto_error;\
  1663. }\
  1664. }\
  1665. }
  1666. #else
  1667. #define __Pyx_TraceLine(lineno, nogil, goto_error)\
  1668. if (likely(!__Pyx_use_tracing)); else {\
  1669. PyThreadState* tstate = __Pyx_PyThreadState_Current;\
  1670. if (unlikely(tstate->use_tracing && tstate->c_tracefunc && __pyx_frame->f_trace)) {\
  1671. int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
  1672. if (unlikely(ret)) goto_error;\
  1673. }\
  1674. }
  1675. #endif
  1676. #else
  1677. #define __Pyx_TraceLine(lineno, nogil, goto_error) if ((1)); else goto_error;
  1678. #endif
  1679. /* WriteUnraisableException.proto */
  1680. static void __Pyx_WriteUnraisable(const char *name, int clineno,
  1681. int lineno, const char *filename,
  1682. int full_traceback, int nogil);
  1683. /* RaiseArgTupleInvalid.proto */
  1684. static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
  1685. Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
  1686. /* RaiseDoubleKeywords.proto */
  1687. static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
  1688. /* ParseKeywords.proto */
  1689. static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
  1690. PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
  1691. const char* function_name);
  1692. /* None.proto */
  1693. static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);
  1694. /* PyObjectCall.proto */
  1695. #if CYTHON_COMPILING_IN_CPYTHON
  1696. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
  1697. #else
  1698. #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
  1699. #endif
  1700. /* RaiseException.proto */
  1701. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
  1702. /* GetModuleGlobalName.proto */
  1703. static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
  1704. /* PyCFunctionFastCall.proto */
  1705. #if CYTHON_FAST_PYCCALL
  1706. static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
  1707. #else
  1708. #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
  1709. #endif
  1710. /* PyFunctionFastCall.proto */
  1711. #if CYTHON_FAST_PYCALL
  1712. #define __Pyx_PyFunction_FastCall(func, args, nargs)\
  1713. __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
  1714. #if 1 || PY_VERSION_HEX < 0x030600B1
  1715. static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
  1716. #else
  1717. #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
  1718. #endif
  1719. #endif
  1720. /* PyObjectCallMethO.proto */
  1721. #if CYTHON_COMPILING_IN_CPYTHON
  1722. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
  1723. #endif
  1724. /* PyObjectCallOneArg.proto */
  1725. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
  1726. /* FetchCommonType.proto */
  1727. static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
  1728. /* CythonFunction.proto */
  1729. #define __Pyx_CyFunction_USED 1
  1730. #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
  1731. #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
  1732. #define __Pyx_CYFUNCTION_CCLASS 0x04
  1733. #define __Pyx_CyFunction_GetClosure(f)\
  1734. (((__pyx_CyFunctionObject *) (f))->func_closure)
  1735. #define __Pyx_CyFunction_GetClassObj(f)\
  1736. (((__pyx_CyFunctionObject *) (f))->func_classobj)
  1737. #define __Pyx_CyFunction_Defaults(type, f)\
  1738. ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
  1739. #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
  1740. ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
  1741. typedef struct {
  1742. PyCFunctionObject func;
  1743. #if PY_VERSION_HEX < 0x030500A0
  1744. PyObject *func_weakreflist;
  1745. #endif
  1746. PyObject *func_dict;
  1747. PyObject *func_name;
  1748. PyObject *func_qualname;
  1749. PyObject *func_doc;
  1750. PyObject *func_globals;
  1751. PyObject *func_code;
  1752. PyObject *func_closure;
  1753. PyObject *func_classobj;
  1754. void *defaults;
  1755. int defaults_pyobjects;
  1756. int flags;
  1757. PyObject *defaults_tuple;
  1758. PyObject *defaults_kwdict;
  1759. PyObject *(*defaults_getter)(PyObject *);
  1760. PyObject *func_annotations;
  1761. } __pyx_CyFunctionObject;
  1762. static PyTypeObject *__pyx_CyFunctionType = 0;
  1763. #define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
  1764. __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
  1765. static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
  1766. int flags, PyObject* qualname,
  1767. PyObject *self,
  1768. PyObject *module, PyObject *globals,
  1769. PyObject* code);
  1770. static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
  1771. size_t size,
  1772. int pyobjects);
  1773. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
  1774. PyObject *tuple);
  1775. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
  1776. PyObject *dict);
  1777. static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
  1778. PyObject *dict);
  1779. static int __pyx_CyFunction_init(void);
  1780. /* ArgTypeTest.proto */
  1781. #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
  1782. ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
  1783. __Pyx__ArgTypeTest(obj, type, name, exact))
  1784. static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
  1785. /* ExtTypeTest.proto */
  1786. static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
  1787. /* IncludeStringH.proto */
  1788. #include <string.h>
  1789. /* pyfrozenset_new.proto */
  1790. static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it);
  1791. /* py_set_remove.proto */
  1792. static CYTHON_INLINE int __Pyx_PySet_Remove(PyObject *set, PyObject *key);
  1793. /* PyObjectFormatSimple.proto */
  1794. #if CYTHON_COMPILING_IN_PYPY
  1795. #define __Pyx_PyObject_FormatSimple(s, f) (\
  1796. likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
  1797. PyObject_Format(s, f))
  1798. #elif PY_MAJOR_VERSION < 3
  1799. #define __Pyx_PyObject_FormatSimple(s, f) (\
  1800. likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
  1801. likely(PyString_CheckExact(s)) ? PyUnicode_FromEncodedObject(s, NULL, "strict") :\
  1802. PyObject_Format(s, f))
  1803. #elif CYTHON_USE_TYPE_SLOTS
  1804. #define __Pyx_PyObject_FormatSimple(s, f) (\
  1805. likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
  1806. likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_str(s) :\
  1807. likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_str(s) :\
  1808. PyObject_Format(s, f))
  1809. #else
  1810. #define __Pyx_PyObject_FormatSimple(s, f) (\
  1811. likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
  1812. PyObject_Format(s, f))
  1813. #endif
  1814. /* BuildPyUnicode.proto */
  1815. static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength,
  1816. int prepend_sign, char padding_char);
  1817. /* CIntToPyUnicode.proto */
  1818. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char);
  1819. /* JoinPyUnicode.proto */
  1820. static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
  1821. Py_UCS4 max_char);
  1822. /* PySetContains.proto */
  1823. static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq);
  1824. /* PyObjectCallNoArg.proto */
  1825. #if CYTHON_COMPILING_IN_CPYTHON
  1826. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
  1827. #else
  1828. #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
  1829. #endif
  1830. /* PySequenceContains.proto */
  1831. static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
  1832. int result = PySequence_Contains(seq, item);
  1833. return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
  1834. }
  1835. /* RaiseTooManyValuesToUnpack.proto */
  1836. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
  1837. /* RaiseNeedMoreValuesToUnpack.proto */
  1838. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
  1839. /* IterFinish.proto */
  1840. static CYTHON_INLINE int __Pyx_IterFinish(void);
  1841. /* UnpackItemEndCheck.proto */
  1842. static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
  1843. /* set_iter.proto */
  1844. static CYTHON_INLINE PyObject* __Pyx_set_iterator(PyObject* iterable, int is_set,
  1845. Py_ssize_t* p_orig_length, int* p_source_is_set);
  1846. static CYTHON_INLINE int __Pyx_set_iter_next(
  1847. PyObject* iter_obj, Py_ssize_t orig_length,
  1848. Py_ssize_t* ppos, PyObject **value,
  1849. int source_is_set);
  1850. /* GetItemInt.proto */
  1851. #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1852. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1853. __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
  1854. (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
  1855. __Pyx_GetItemInt_Generic(o, to_py_func(i))))
  1856. #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1857. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1858. __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
  1859. (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
  1860. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  1861. int wraparound, int boundscheck);
  1862. #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1863. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1864. __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
  1865. (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
  1866. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  1867. int wraparound, int boundscheck);
  1868. static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
  1869. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
  1870. int is_list, int wraparound, int boundscheck);
  1871. /* ObjectGetItem.proto */
  1872. #if CYTHON_USE_TYPE_SLOTS
  1873. static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
  1874. #else
  1875. #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
  1876. #endif
  1877. /* PyErrExceptionMatches.proto */
  1878. #if CYTHON_FAST_THREAD_STATE
  1879. #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
  1880. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
  1881. #else
  1882. #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
  1883. #endif
  1884. /* GetAttr.proto */
  1885. static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
  1886. /* GetAttr3.proto */
  1887. static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
  1888. /* DictGetItem.proto */
  1889. #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
  1890. static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
  1891. #define __Pyx_PyObject_Dict_GetItem(obj, name)\
  1892. (likely(PyDict_CheckExact(obj)) ?\
  1893. __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
  1894. #else
  1895. #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
  1896. #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
  1897. #endif
  1898. /* SaveResetException.proto */
  1899. #if CYTHON_FAST_THREAD_STATE
  1900. #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
  1901. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1902. #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
  1903. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  1904. #else
  1905. #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
  1906. #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
  1907. #endif
  1908. /* FastTypeChecks.proto */
  1909. #if CYTHON_COMPILING_IN_CPYTHON
  1910. #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
  1911. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
  1912. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
  1913. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
  1914. #else
  1915. #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
  1916. #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
  1917. #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
  1918. #endif
  1919. #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
  1920. /* GetException.proto */
  1921. #if CYTHON_FAST_THREAD_STATE
  1922. #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
  1923. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1924. #else
  1925. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
  1926. #endif
  1927. /* SwapException.proto */
  1928. #if CYTHON_FAST_THREAD_STATE
  1929. #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
  1930. static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1931. #else
  1932. static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
  1933. #endif
  1934. /* BytesEquals.proto */
  1935. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
  1936. /* UnicodeEquals.proto */
  1937. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
  1938. /* ListAppend.proto */
  1939. #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
  1940. static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
  1941. PyListObject* L = (PyListObject*) list;
  1942. Py_ssize_t len = Py_SIZE(list);
  1943. if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
  1944. Py_INCREF(x);
  1945. PyList_SET_ITEM(list, len, x);
  1946. Py_SIZE(list) = len+1;
  1947. return 0;
  1948. }
  1949. return PyList_Append(list, x);
  1950. }
  1951. #else
  1952. #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
  1953. #endif
  1954. /* CIntToPyUnicode.proto */
  1955. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_size_t(size_t value, Py_ssize_t width, char padding_char, char format_char);
  1956. /* RaiseNoneIterError.proto */
  1957. static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
  1958. /* CIntToPyUnicode.proto */
  1959. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_unsigned_char(unsigned char value, Py_ssize_t width, char padding_char, char format_char);
  1960. /* None.proto */
  1961. static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
  1962. /* decode_c_string_utf16.proto */
  1963. static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
  1964. int byteorder = 0;
  1965. return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
  1966. }
  1967. static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
  1968. int byteorder = -1;
  1969. return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
  1970. }
  1971. static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
  1972. int byteorder = 1;
  1973. return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
  1974. }
  1975. /* decode_c_string.proto */
  1976. static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
  1977. const char* cstring, Py_ssize_t start, Py_ssize_t stop,
  1978. const char* encoding, const char* errors,
  1979. PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
  1980. /* Import.proto */
  1981. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
  1982. /* ImportFrom.proto */
  1983. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
  1984. /* HasAttr.proto */
  1985. static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
  1986. /* CallNextTpDealloc.proto */
  1987. static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc);
  1988. /* PyObject_GenericGetAttrNoDict.proto */
  1989. #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
  1990. static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
  1991. #else
  1992. #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
  1993. #endif
  1994. /* PyObject_GenericGetAttr.proto */
  1995. #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
  1996. static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
  1997. #else
  1998. #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
  1999. #endif
  2000. /* SetVTable.proto */
  2001. static int __Pyx_SetVtable(PyObject *dict, void *vtable);
  2002. /* SetupReduce.proto */
  2003. static int __Pyx_setup_reduce(PyObject* type_obj);
  2004. /* GetVTable.proto */
  2005. static void* __Pyx_GetVtable(PyObject *dict);
  2006. /* GetNameInClass.proto */
  2007. static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name);
  2008. /* CLineInTraceback.proto */
  2009. #ifdef CYTHON_CLINE_IN_TRACEBACK
  2010. #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
  2011. #else
  2012. static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
  2013. #endif
  2014. /* CodeObjectCache.proto */
  2015. typedef struct {
  2016. PyCodeObject* code_object;
  2017. int code_line;
  2018. } __Pyx_CodeObjectCacheEntry;
  2019. struct __Pyx_CodeObjectCache {
  2020. int count;
  2021. int max_count;
  2022. __Pyx_CodeObjectCacheEntry* entries;
  2023. };
  2024. static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
  2025. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
  2026. static PyCodeObject *__pyx_find_code_object(int code_line);
  2027. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
  2028. /* AddTraceback.proto */
  2029. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  2030. int py_line, const char *filename);
  2031. /* CIntToPy.proto */
  2032. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
  2033. /* CIntToPy.proto */
  2034. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value);
  2035. /* CIntToPy.proto */
  2036. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
  2037. /* CIntToPy.proto */
  2038. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_MDB_dbi(MDB_dbi value);
  2039. /* CIntToPy.proto */
  2040. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_char(char value);
  2041. /* CIntFromPy.proto */
  2042. static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);
  2043. /* CIntFromPy.proto */
  2044. static CYTHON_INLINE unsigned char __Pyx_PyInt_As_unsigned_char(PyObject *);
  2045. /* CIntFromPy.proto */
  2046. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
  2047. /* BytesContains.proto */
  2048. static CYTHON_INLINE int __Pyx_BytesContains(PyObject* bytes, char character);
  2049. /* CIntFromPy.proto */
  2050. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
  2051. /* PyObjectCallMethod1.proto */
  2052. static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
  2053. static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg);
  2054. /* CoroutineBase.proto */
  2055. typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyThreadState *, PyObject *);
  2056. typedef struct {
  2057. PyObject_HEAD
  2058. __pyx_coroutine_body_t body;
  2059. PyObject *closure;
  2060. PyObject *exc_type;
  2061. PyObject *exc_value;
  2062. PyObject *exc_traceback;
  2063. PyObject *gi_weakreflist;
  2064. PyObject *classobj;
  2065. PyObject *yieldfrom;
  2066. PyObject *gi_name;
  2067. PyObject *gi_qualname;
  2068. PyObject *gi_modulename;
  2069. PyObject *gi_code;
  2070. int resume_label;
  2071. char is_running;
  2072. } __pyx_CoroutineObject;
  2073. static __pyx_CoroutineObject *__Pyx__Coroutine_New(
  2074. PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  2075. PyObject *name, PyObject *qualname, PyObject *module_name);
  2076. static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
  2077. __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  2078. PyObject *name, PyObject *qualname, PyObject *module_name);
  2079. static int __Pyx_Coroutine_clear(PyObject *self);
  2080. static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
  2081. static PyObject *__Pyx_Coroutine_Close(PyObject *self);
  2082. static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
  2083. #define __Pyx_Coroutine_SwapException(self) {\
  2084. __Pyx_ExceptionSwap(&(self)->exc_type, &(self)->exc_value, &(self)->exc_traceback);\
  2085. __Pyx_Coroutine_ResetFrameBackpointer(self);\
  2086. }
  2087. #define __Pyx_Coroutine_ResetAndClearException(self) {\
  2088. __Pyx_ExceptionReset((self)->exc_type, (self)->exc_value, (self)->exc_traceback);\
  2089. (self)->exc_type = (self)->exc_value = (self)->exc_traceback = NULL;\
  2090. }
  2091. #if CYTHON_FAST_THREAD_STATE
  2092. #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
  2093. __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
  2094. #else
  2095. #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
  2096. __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
  2097. #endif
  2098. static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
  2099. static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__pyx_CoroutineObject *self);
  2100. /* PatchModuleWithCoroutine.proto */
  2101. static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);
  2102. /* PatchGeneratorABC.proto */
  2103. static int __Pyx_patch_abc(void);
  2104. /* Generator.proto */
  2105. #define __Pyx_Generator_USED
  2106. static PyTypeObject *__pyx_GeneratorType = 0;
  2107. #define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
  2108. #define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
  2109. __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
  2110. static PyObject *__Pyx_Generator_Next(PyObject *self);
  2111. static int __pyx_Generator_init(void);
  2112. /* CheckBinaryVersion.proto */
  2113. static int __Pyx_check_binary_version(void);
  2114. /* PyIdentifierFromString.proto */
  2115. #if !defined(__Pyx_PyIdentifier_FromString)
  2116. #if PY_MAJOR_VERSION < 3
  2117. #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
  2118. #else
  2119. #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
  2120. #endif
  2121. #endif
  2122. /* ModuleImport.proto */
  2123. static PyObject *__Pyx_ImportModule(const char *name);
  2124. /* TypeImport.proto */
  2125. static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
  2126. /* VoidPtrImport.proto */
  2127. static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig);
  2128. /* FunctionImport.proto */
  2129. static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig);
  2130. /* InitStrings.proto */
  2131. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
  2132. static void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_resize(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_self, size_t __pyx_v_ct); /* proto*/
  2133. static unsigned char *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_get_item(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_self, PyObject *__pyx_v_i); /* proto*/
  2134. static void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph__data_from_lookup(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_lookup, struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_store); /* proto*/
  2135. static void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_set(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_trp, int __pyx_skip_dispatch); /* proto*/
  2136. static void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_remove_triples(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_pattern, int __pyx_skip_dispatch); /* proto*/
  2137. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_as_rdflib(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
  2138. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph__slice(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_s, PyObject *__pyx_v_p, PyObject *__pyx_v_o); /* proto*/
  2139. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_lookup(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_s, PyObject *__pyx_v_p, PyObject *__pyx_v_o, int __pyx_skip_dispatch); /* proto*/
  2140. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_terms(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_type, int __pyx_skip_dispatch); /* proto*/
  2141. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_as_rdflib(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
  2142. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_stats(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_stats *__pyx_optional_args); /* proto*/
  2143. static size_t __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__len(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__len *__pyx_optional_args); /* proto*/
  2144. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_add(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_triple, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_add *__pyx_optional_args); /* proto*/
  2145. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_add_graph(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_graph, int __pyx_skip_dispatch); /* proto*/
  2146. static void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__add_graph(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, unsigned char *__pyx_v_pk_c, size_t __pyx_v_pk_size, int __pyx_skip_dispatch); /* proto*/
  2147. static void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__remove(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_triple_pattern, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__remove *__pyx_optional_args); /* proto*/
  2148. static void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__index_triple(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_op, unsigned char *__pyx_v_spok); /* proto*/
  2149. static void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__remove_graph(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_gr_uri, int __pyx_skip_dispatch); /* proto*/
  2150. static struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_triple_keys(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_triple_pattern, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_triple_keys *__pyx_optional_args); /* proto*/
  2151. static struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__lookup(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_triple_pattern); /* proto*/
  2152. static struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__lookup_1bound(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, unsigned char __pyx_v_idx, PyObject *__pyx_v_term); /* proto*/
  2153. static struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__lookup_2bound(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, unsigned char __pyx_v_idx1, PyObject *__pyx_v_term1, unsigned char __pyx_v_idx2, PyObject *__pyx_v_term2); /* proto*/
  2154. static struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__all_term_keys(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_term_type, int __pyx_skip_dispatch); /* proto*/
  2155. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_all_namespaces(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
  2156. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_all_contexts(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_all_contexts *__pyx_optional_args); /* proto*/
  2157. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_from_key(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, unsigned char *__pyx_v_key); /* proto*/
  2158. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_from_trp_key(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, unsigned char *__pyx_v_key); /* proto*/
  2159. static CYTHON_INLINE void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__to_key(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_term, __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Key *__pyx_v_key); /* proto*/
  2160. static CYTHON_INLINE void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__to_triple_key(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_terms, __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_TripleKey *__pyx_v_tkey); /* proto*/
  2161. static void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__append(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, unsigned char *__pyx_v_value, size_t __pyx_v_vlen, __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Key *__pyx_v_nkey, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__append *__pyx_optional_args); /* proto*/
  2162. static void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__next_key(CYTHON_UNUSED struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, unsigned char *__pyx_v_key, __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Key *__pyx_v_nkey); /* proto*/
  2163. /* Module declarations from 'lakesuperior.cy_include' */
  2164. /* Module declarations from 'libc.stdint' */
  2165. /* Module declarations from 'posix.types' */
  2166. /* Module declarations from 'lakesuperior.cy_include.cylmdb' */
  2167. /* Module declarations from 'lakesuperior.store.base_lmdb_store' */
  2168. static PyTypeObject *__pyx_ptype_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore = 0;
  2169. static int *__pyx_vp_12lakesuperior_5store_15base_lmdb_store_rc = 0;
  2170. #define __pyx_v_12lakesuperior_5store_15base_lmdb_store_rc (*__pyx_vp_12lakesuperior_5store_15base_lmdb_store_rc)
  2171. static size_t *__pyx_vp_12lakesuperior_5store_15base_lmdb_store_i = 0;
  2172. #define __pyx_v_12lakesuperior_5store_15base_lmdb_store_i (*__pyx_vp_12lakesuperior_5store_15base_lmdb_store_i)
  2173. static struct MDB_val *__pyx_vp_12lakesuperior_5store_15base_lmdb_store_key_v = 0;
  2174. #define __pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v (*__pyx_vp_12lakesuperior_5store_15base_lmdb_store_key_v)
  2175. static struct MDB_val *__pyx_vp_12lakesuperior_5store_15base_lmdb_store_data_v = 0;
  2176. #define __pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v (*__pyx_vp_12lakesuperior_5store_15base_lmdb_store_data_v)
  2177. static MDB_dbi *__pyx_vp_12lakesuperior_5store_15base_lmdb_store_dbi = 0;
  2178. #define __pyx_v_12lakesuperior_5store_15base_lmdb_store_dbi (*__pyx_vp_12lakesuperior_5store_15base_lmdb_store_dbi)
  2179. static void (*__pyx_f_12lakesuperior_5store_15base_lmdb_store__check)(int, struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store__check *__pyx_optional_args); /*proto*/
  2180. /* Module declarations from 'cpython.mem' */
  2181. /* Module declarations from 'libc.string' */
  2182. /* Module declarations from 'libc.stdlib' */
  2183. /* Module declarations from 'lakesuperior.store.ldp_rs.term' */
  2184. static unsigned char *__pyx_vp_12lakesuperior_5store_6ldp_rs_4term_term_type = 0;
  2185. #define __pyx_v_12lakesuperior_5store_6ldp_rs_4term_term_type (*__pyx_vp_12lakesuperior_5store_6ldp_rs_4term_term_type)
  2186. static unsigned char **__pyx_vp_12lakesuperior_5store_6ldp_rs_4term_pack_fmt = 0;
  2187. #define __pyx_v_12lakesuperior_5store_6ldp_rs_4term_pack_fmt (*__pyx_vp_12lakesuperior_5store_6ldp_rs_4term_pack_fmt)
  2188. static unsigned char **__pyx_vp_12lakesuperior_5store_6ldp_rs_4term_term_data = 0;
  2189. #define __pyx_v_12lakesuperior_5store_6ldp_rs_4term_term_data (*__pyx_vp_12lakesuperior_5store_6ldp_rs_4term_term_data)
  2190. static unsigned char **__pyx_vp_12lakesuperior_5store_6ldp_rs_4term_term_datatype = 0;
  2191. #define __pyx_v_12lakesuperior_5store_6ldp_rs_4term_term_datatype (*__pyx_vp_12lakesuperior_5store_6ldp_rs_4term_term_datatype)
  2192. static unsigned char **__pyx_vp_12lakesuperior_5store_6ldp_rs_4term_term_lang = 0;
  2193. #define __pyx_v_12lakesuperior_5store_6ldp_rs_4term_term_lang (*__pyx_vp_12lakesuperior_5store_6ldp_rs_4term_term_lang)
  2194. static int (*__pyx_f_12lakesuperior_5store_6ldp_rs_4term_serialize)(PyObject *, unsigned char **, size_t *); /*proto*/
  2195. static PyObject *(*__pyx_f_12lakesuperior_5store_6ldp_rs_4term_deserialize)(unsigned char *, size_t); /*proto*/
  2196. /* Module declarations from 'lakesuperior.store.ldp_rs.lmdb_triplestore' */
  2197. static PyTypeObject *__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet = 0;
  2198. static PyTypeObject *__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph = 0;
  2199. static PyTypeObject *__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr = 0;
  2200. static PyTypeObject *__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore = 0;
  2201. static PyTypeObject *__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple = 0;
  2202. static PyTypeObject *__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr = 0;
  2203. static PyTypeObject *__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts = 0;
  2204. static PyTypeObject *__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples = 0;
  2205. static PyTypeObject *__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms = 0;
  2206. static unsigned char __pyx_v_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_first_key[5];
  2207. static unsigned char __pyx_v_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_lookup_rank[3];
  2208. static unsigned char __pyx_v_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_lookup_ordering[3][3];
  2209. static unsigned char __pyx_v_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_lookup_ordering_2bound[3][3];
  2210. static CYTHON_INLINE void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore__hash(unsigned char const *, size_t, unsigned char *); /*proto*/
  2211. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_unpickle_SimpleGraph__set_state(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *, PyObject *); /*proto*/
  2212. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_unpickle_Imr__set_state(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *, PyObject *); /*proto*/
  2213. #define __Pyx_MODULE_NAME "lakesuperior.store.ldp_rs.lmdb_triplestore"
  2214. extern int __pyx_module_is_main_lakesuperior__store__ldp_rs__lmdb_triplestore;
  2215. int __pyx_module_is_main_lakesuperior__store__ldp_rs__lmdb_triplestore = 0;
  2216. /* Implementation of 'lakesuperior.store.ldp_rs.lmdb_triplestore' */
  2217. static PyObject *__pyx_builtin_MemoryError;
  2218. static PyObject *__pyx_builtin_range;
  2219. static PyObject *__pyx_builtin_TypeError;
  2220. static PyObject *__pyx_builtin_ValueError;
  2221. static PyObject *__pyx_builtin_hex;
  2222. static PyObject *__pyx_builtin_id;
  2223. static PyObject *__pyx_builtin_super;
  2224. static PyObject *__pyx_builtin_RuntimeError;
  2225. static PyObject *__pyx_builtin_enumerate;
  2226. static PyObject *__pyx_builtin_all;
  2227. static PyObject *__pyx_builtin_any;
  2228. static const char __pyx_k_c[] = "c:";
  2229. static const char __pyx_k_o[] = "o";
  2230. static const char __pyx_k_p[] = "p";
  2231. static const char __pyx_k_s[] = "s";
  2232. static const char __pyx_k__8[] = "<";
  2233. static const char __pyx_k__9[] = " @";
  2234. static const char __pyx_k_ct[] = "ct";
  2235. static const char __pyx_k_eq[] = "__eq__";
  2236. static const char __pyx_k_fn[] = "fn";
  2237. static const char __pyx_k_id[] = "id";
  2238. static const char __pyx_k_or[] = "__or__";
  2239. static const char __pyx_k_os[] = "os";
  2240. static const char __pyx_k_Add[] = "Add ";
  2241. static const char __pyx_k_DBI[] = "DBI: ";
  2242. static const char __pyx_k_Key[] = "Key ";
  2243. static const char __pyx_k__10[] = ">";
  2244. static const char __pyx_k__11[] = ".";
  2245. static const char __pyx_k__12[] = ", ";
  2246. static const char __pyx_k__27[] = ": ";
  2247. static const char __pyx_k_add[] = "add";
  2248. static const char __pyx_k_all[] = "all";
  2249. static const char __pyx_k_and[] = "__and__";
  2250. static const char __pyx_k_any[] = "any";
  2251. static const char __pyx_k_hex[] = "hex";
  2252. static const char __pyx_k_ior[] = "__ior__";
  2253. static const char __pyx_k_len[] = "_len";
  2254. static const char __pyx_k_luk[] = "luk: {}";
  2255. static const char __pyx_k_new[] = "__new__";
  2256. static const char __pyx_k_set[] = "set";
  2257. static const char __pyx_k_spo[] = "spo";
  2258. static const char __pyx_k_sub[] = "__sub__";
  2259. static const char __pyx_k_uri[] = "uri";
  2260. static const char __pyx_k_xor[] = "__xor__";
  2261. static const char __pyx_k_Node[] = "Node";
  2262. static const char __pyx_k_args[] = "args";
  2263. static const char __pyx_k_data[] = "data";
  2264. static const char __pyx_k_dict[] = "__dict__";
  2265. static const char __pyx_k_iand[] = "__iand__";
  2266. static const char __pyx_k_init[] = "__init__";
  2267. static const char __pyx_k_isub[] = "__isub__";
  2268. static const char __pyx_k_iter[] = "__iter__";
  2269. static const char __pyx_k_ixor[] = "__ixor__";
  2270. static const char __pyx_k_luk1[] = "luk1: {}";
  2271. static const char __pyx_k_luk2[] = "luk2: {}";
  2272. static const char __pyx_k_main[] = "__main__";
  2273. static const char __pyx_k_name[] = "__name__";
  2274. static const char __pyx_k_o_sp[] = "o:sp";
  2275. static const char __pyx_k_p_so[] = "p:so";
  2276. static const char __pyx_k_pk_c[] = "pk_c";
  2277. static const char __pyx_k_po_s[] = "po:s";
  2278. static const char __pyx_k_s_po[] = "s:po";
  2279. static const char __pyx_k_self[] = "self";
  2280. static const char __pyx_k_send[] = "send";
  2281. static const char __pyx_k_so_p[] = "so:p";
  2282. static const char __pyx_k_sp_o[] = "sp:o";
  2283. static const char __pyx_k_step[] = "step";
  2284. static const char __pyx_k_stop[] = "stop";
  2285. static const char __pyx_k_t_st[] = "t:st";
  2286. static const char __pyx_k_test[] = "__test__";
  2287. static const char __pyx_k_th_t[] = "th:t";
  2288. static const char __pyx_k_Graph[] = "Graph";
  2289. static const char __pyx_k_bytes[] = " bytes.";
  2290. static const char __pyx_k_c_spo[] = "c:spo";
  2291. static const char __pyx_k_class[] = "__class__";
  2292. static const char __pyx_k_close[] = "close";
  2293. static const char __pyx_k_debug[] = "debug";
  2294. static const char __pyx_k_flags[] = "flags";
  2295. static const char __pyx_k_index[] = "index";
  2296. static const char __pyx_k_other[] = "other";
  2297. static const char __pyx_k_range[] = "range";
  2298. static const char __pyx_k_spo_c[] = "spo:c";
  2299. static const char __pyx_k_start[] = "start";
  2300. static const char __pyx_k_stats[] = "stats";
  2301. static const char __pyx_k_store[] = "store";
  2302. static const char __pyx_k_super[] = "super";
  2303. static const char __pyx_k_terms[] = "terms";
  2304. static const char __pyx_k_throw[] = "throw";
  2305. static const char __pyx_k_uri_2[] = " uri=";
  2306. static const char __pyx_k_wraps[] = "wraps";
  2307. static const char __pyx_k_Remove[] = "Remove ";
  2308. static const char __pyx_k_format[] = "format";
  2309. static const char __pyx_k_import[] = "__import__";
  2310. static const char __pyx_k_length[] = " length=";
  2311. static const char __pyx_k_logger[] = "logger";
  2312. static const char __pyx_k_lookup[] = "lookup";
  2313. static const char __pyx_k_ns_pfx[] = "ns:pfx";
  2314. static const char __pyx_k_pfx_ns[] = "pfx:ns";
  2315. static const char __pyx_k_pickle[] = "pickle";
  2316. static const char __pyx_k_quoted[] = "quoted";
  2317. static const char __pyx_k_rdflib[] = "rdflib";
  2318. static const char __pyx_k_reduce[] = "__reduce__";
  2319. static const char __pyx_k_remove[] = "_remove";
  2320. static const char __pyx_k_strict[] = "strict";
  2321. static const char __pyx_k_triple[] = "triple";
  2322. static const char __pyx_k_update[] = "update";
  2323. static const char __pyx_k_Removed[] = "Removed: ";
  2324. static const char __pyx_k_asm_rng[] = "asm_rng: {}";
  2325. static const char __pyx_k_context[] = "context";
  2326. static const char __pyx_k_genexpr[] = "genexpr";
  2327. static const char __pyx_k_hashlib[] = "hashlib";
  2328. static const char __pyx_k_idx_add[] = "_idx_add";
  2329. static const char __pyx_k_logging[] = "logging";
  2330. static const char __pyx_k_new_txn[] = "new_txn";
  2331. static const char __pyx_k_options[] = "options";
  2332. static const char __pyx_k_pk_size[] = "pk_size";
  2333. static const char __pyx_k_triples[] = "triples";
  2334. static const char __pyx_k_wrapper[] = "_wrapper";
  2335. static const char __pyx_k_DB_label[] = "DB label: ";
  2336. static const char __pyx_k_Removing[] = "Removing ";
  2337. static const char __pyx_k_Sequence[] = "Sequence";
  2338. static const char __pyx_k_and_term[] = " and term ";
  2339. static const char __pyx_k_contexts[] = "contexts";
  2340. static const char __pyx_k_db_stats[] = "db_stats";
  2341. static const char __pyx_k_getstate[] = "__getstate__";
  2342. static const char __pyx_k_itemsize[] = "itemsize";
  2343. static const char __pyx_k_length_2[] = ", length=";
  2344. static const char __pyx_k_map_size[] = "map_size";
  2345. static const char __pyx_k_pyx_type[] = "__pyx_type";
  2346. static const char __pyx_k_resource[] = "resource";
  2347. static const char __pyx_k_setstate[] = "__setstate__";
  2348. static const char __pyx_k_to_tuple[] = "to_tuple";
  2349. static const char __pyx_k_use_data[] = "use_data";
  2350. static const char __pyx_k_Allocated[] = "Allocated ";
  2351. static const char __pyx_k_LmdbError[] = "LmdbError";
  2352. static const char __pyx_k_Page_size[] = "Page size: ";
  2353. static const char __pyx_k_TypeError[] = "TypeError";
  2354. static const char __pyx_k_add_graph[] = "add_graph";
  2355. static const char __pyx_k_all_terms[] = "all_terms";
  2356. static const char __pyx_k_as_rdflib[] = "as_rdflib";
  2357. static const char __pyx_k_dbi_flags[] = "dbi_flags";
  2358. static const char __pyx_k_enumerate[] = "enumerate";
  2359. static const char __pyx_k_from_main[] = " from main.";
  2360. static const char __pyx_k_functools[] = "functools";
  2361. static const char __pyx_k_getLogger[] = "getLogger";
  2362. static const char __pyx_k_is_txn_rw[] = "is_txn_rw";
  2363. static const char __pyx_k_pyx_state[] = "__pyx_state";
  2364. static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
  2365. static const char __pyx_k_Double_key[] = "Double key ";
  2366. static const char __pyx_k_Lookup_key[] = "Lookup key: {}";
  2367. static const char __pyx_k_Term_order[] = "Term order: {}";
  2368. static const char __pyx_k_ValueError[] = "ValueError";
  2369. static const char __pyx_k_dbi_labels[] = "dbi_labels";
  2370. static const char __pyx_k_identifier[] = "identifier";
  2371. static const char __pyx_k_idx_remove[] = "_idx_remove";
  2372. static const char __pyx_k_ms_entries[] = "ms_entries";
  2373. static const char __pyx_k_pyx_result[] = "__pyx_result";
  2374. static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
  2375. static const char __pyx_k_ret_offset[] = "ret_offset: {}";
  2376. static const char __pyx_k_term_order[] = "term order: {}";
  2377. static const char __pyx_k_to_indices[] = " to indices.";
  2378. static const char __pyx_k_Entries_for[] = "Entries for ";
  2379. static const char __pyx_k_LUK_offsets[] = "LUK offsets: {}, {}";
  2380. static const char __pyx_k_MemoryError[] = "MemoryError";
  2381. static const char __pyx_k_PickleError[] = "PickleError";
  2382. static const char __pyx_k_add_graph_2[] = "_add_graph";
  2383. static const char __pyx_k_at_position[] = " at position ";
  2384. static const char __pyx_k_i_in_0bound[] = "i in 0bound: ";
  2385. static const char __pyx_k_num_triples[] = "num_triples";
  2386. static const char __pyx_k_rdflib_term[] = "rdflib.term";
  2387. static const char __pyx_k_triple_keys[] = "triple_keys";
  2388. static const char __pyx_k_RuntimeError[] = "RuntimeError";
  2389. static const char __pyx_k_all_contexts[] = "all_contexts";
  2390. static const char __pyx_k_from_indices[] = " from indices.";
  2391. static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
  2392. static const char __pyx_k_rdflib_graph[] = "rdflib.graph";
  2393. static const char __pyx_k_remove_graph[] = "_remove_graph";
  2394. static const char __pyx_k_stringsource[] = "stringsource";
  2395. static const char __pyx_k_Triples_found[] = "Triples found: ";
  2396. static const char __pyx_k_all_term_keys[] = "_all_term_keys";
  2397. static const char __pyx_k_bytes_of_data[] = " bytes of data.";
  2398. static const char __pyx_k_lookup_1bound[] = "lookup 1bound: ";
  2399. static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
  2400. static const char __pyx_k_Database_label[] = "Database label: {}";
  2401. static const char __pyx_k_Invalid_triple[] = "Invalid triple: ";
  2402. static const char __pyx_k_KeyExistsError[] = "KeyExistsError";
  2403. static const char __pyx_k_Looking_in_key[] = "Looking in key: {}";
  2404. static const char __pyx_k_all_namespaces[] = "all_namespaces";
  2405. static const char __pyx_k_exists_already[] = " exists already.";
  2406. static const char __pyx_k_lookup_indices[] = "lookup_indices";
  2407. static const char __pyx_k_remove_triples[] = "remove_triples";
  2408. static const char __pyx_k_triple_pattern[] = "triple_pattern";
  2409. static const char __pyx_k_Adding_to_index[] = "Adding to index `{}`: {}, {}";
  2410. static const char __pyx_k_collections_abc[] = "collections.abc";
  2411. static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
  2412. static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
  2413. static const char __pyx_k_Entries_in_c_spo[] = "Entries in c:spo: ";
  2414. static const char __pyx_k_KeyNotFoundError[] = "KeyNotFoundError";
  2415. static const char __pyx_k_pyx_unpickle_Imr[] = "__pyx_unpickle_Imr";
  2416. static const char __pyx_k_Error_setting_key[] = "Error setting key {}.";
  2417. static const char __pyx_k_normalize_context[] = "_normalize_context";
  2418. static const char __pyx_k_Got_data_in_2bound[] = "Got data in 2bound ({}): {}";
  2419. static const char __pyx_k_Not_found_in_index[] = "Not found in index: ";
  2420. static const char __pyx_k_Wrong_slice_format[] = "Wrong slice format: ";
  2421. static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
  2422. static const char __pyx_k_Getting_triples_for[] = "Getting triples for: {}, {}";
  2423. static const char __pyx_k_Looking_up_in_graph[] = "Looking up in graph: ";
  2424. static const char __pyx_k_Removing_from_graph[] = "Removing from graph: ";
  2425. static const char __pyx_k_2bound_lookup_for_term[] = "2bound lookup for term ";
  2426. static const char __pyx_k_Getting_all_DB_triples[] = "Getting all DB triples.";
  2427. static const char __pyx_k_LmdbTriplestore_triples[] = "LmdbTriplestore.triples";
  2428. static const char __pyx_k_to_tuple_locals_genexpr[] = "to_tuple.<locals>.genexpr";
  2429. static const char __pyx_k_DATASET_DEFAULT_GRAPH_ID[] = "DATASET_DEFAULT_GRAPH_ID";
  2430. static const char __pyx_k_Error_gathering_DB_stats[] = "Error gathering DB stats.";
  2431. static const char __pyx_k_LmdbTriplestore_contexts[] = "LmdbTriplestore.contexts";
  2432. static const char __pyx_k_RDFLIB_DEFAULT_GRAPH_URI[] = "RDFLIB_DEFAULT_GRAPH_URI";
  2433. static const char __pyx_k_pyx_unpickle_SimpleGraph[] = "__pyx_unpickle_SimpleGraph";
  2434. static const char __pyx_k_use_data_locals__wrapper[] = "use_data.<locals>._wrapper";
  2435. static const char __pyx_k_LmdbTriplestore_all_terms[] = "LmdbTriplestore.all_terms";
  2436. static const char __pyx_k_Error_getting_data_for_key[] = "Error getting data for key '{}'.";
  2437. static const char __pyx_k_More_than_one_value_found_for[] = "More than one value found for {}, {}.";
  2438. static const char __pyx_k_BAD_DAY_Sequence_exhausted_No_mo[] = "BAD DAY: Sequence exhausted. No more combinations are possible.";
  2439. static const char __pyx_k_Incompatible_checksums_s_vs_0x8d[] = "Incompatible checksums (%s vs 0x8d777f3 = (data))";
  2440. static const char __pyx_k_Incompatible_checksums_s_vs_0xbf[] = "Incompatible checksums (%s vs 0xbf84141 = (data, uri))";
  2441. static const char __pyx_k_Index_operation_is_not_supported[] = "Index operation '{}' is not supported.";
  2442. static const char __pyx_k_Indices_and_not_found_in_LU_keys[] = "Indices {} and {} not found in LU keys.";
  2443. static const char __pyx_k_Store_not_specified_for_triple_l[] = "Store not specified for triple lookup.";
  2444. static const char __pyx_k_lakesuperior_store_base_lmdb_sto[] = "lakesuperior.store.base_lmdb_store";
  2445. static const char __pyx_k_lakesuperior_store_ldp_rs_lmdb_t[] = "lakesuperior.store.ldp_rs.lmdb_triplestore";
  2446. static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
  2447. static const char __pyx_k_self_curs_self_dbenv_self_dbis_s[] = "self.curs,self.dbenv,self.dbis,self.txn cannot be converted to a Python object for pickling";
  2448. static const char __pyx_k_lakesuperior_store_ldp_rs_lmdb_t_2[] = "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx";
  2449. static PyObject *__pyx_kp_u_2bound_lookup_for_term;
  2450. static PyObject *__pyx_kp_u_Add;
  2451. static PyObject *__pyx_kp_u_Adding_to_index;
  2452. static PyObject *__pyx_kp_u_Allocated;
  2453. static PyObject *__pyx_kp_u_BAD_DAY_Sequence_exhausted_No_mo;
  2454. static PyObject *__pyx_n_s_DATASET_DEFAULT_GRAPH_ID;
  2455. static PyObject *__pyx_kp_u_DBI;
  2456. static PyObject *__pyx_kp_u_DB_label;
  2457. static PyObject *__pyx_kp_u_Database_label;
  2458. static PyObject *__pyx_kp_u_Double_key;
  2459. static PyObject *__pyx_kp_u_Entries_for;
  2460. static PyObject *__pyx_kp_u_Entries_in_c_spo;
  2461. static PyObject *__pyx_kp_u_Error_gathering_DB_stats;
  2462. static PyObject *__pyx_kp_u_Error_getting_data_for_key;
  2463. static PyObject *__pyx_kp_u_Error_setting_key;
  2464. static PyObject *__pyx_kp_u_Getting_all_DB_triples;
  2465. static PyObject *__pyx_kp_u_Getting_triples_for;
  2466. static PyObject *__pyx_kp_u_Got_data_in_2bound;
  2467. static PyObject *__pyx_n_s_Graph;
  2468. static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x8d;
  2469. static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xbf;
  2470. static PyObject *__pyx_kp_u_Index_operation_is_not_supported;
  2471. static PyObject *__pyx_kp_u_Indices_and_not_found_in_LU_keys;
  2472. static PyObject *__pyx_kp_u_Invalid_triple;
  2473. static PyObject *__pyx_kp_u_Key;
  2474. static PyObject *__pyx_n_s_KeyExistsError;
  2475. static PyObject *__pyx_n_s_KeyNotFoundError;
  2476. static PyObject *__pyx_kp_u_LUK_offsets;
  2477. static PyObject *__pyx_n_s_LmdbError;
  2478. static PyObject *__pyx_n_s_LmdbTriplestore_all_terms;
  2479. static PyObject *__pyx_n_s_LmdbTriplestore_contexts;
  2480. static PyObject *__pyx_n_s_LmdbTriplestore_triples;
  2481. static PyObject *__pyx_kp_u_Looking_in_key;
  2482. static PyObject *__pyx_kp_u_Looking_up_in_graph;
  2483. static PyObject *__pyx_kp_u_Lookup_key;
  2484. static PyObject *__pyx_n_s_MemoryError;
  2485. static PyObject *__pyx_kp_u_More_than_one_value_found_for;
  2486. static PyObject *__pyx_n_s_Node;
  2487. static PyObject *__pyx_kp_u_Not_found_in_index;
  2488. static PyObject *__pyx_kp_u_Page_size;
  2489. static PyObject *__pyx_n_s_PickleError;
  2490. static PyObject *__pyx_n_s_RDFLIB_DEFAULT_GRAPH_URI;
  2491. static PyObject *__pyx_kp_u_Remove;
  2492. static PyObject *__pyx_kp_u_Removed;
  2493. static PyObject *__pyx_kp_u_Removing;
  2494. static PyObject *__pyx_kp_u_Removing_from_graph;
  2495. static PyObject *__pyx_n_s_RuntimeError;
  2496. static PyObject *__pyx_n_s_Sequence;
  2497. static PyObject *__pyx_kp_u_Store_not_specified_for_triple_l;
  2498. static PyObject *__pyx_kp_u_Term_order;
  2499. static PyObject *__pyx_kp_u_Triples_found;
  2500. static PyObject *__pyx_n_s_TypeError;
  2501. static PyObject *__pyx_n_s_ValueError;
  2502. static PyObject *__pyx_kp_u_Wrong_slice_format;
  2503. static PyObject *__pyx_kp_u__10;
  2504. static PyObject *__pyx_kp_u__11;
  2505. static PyObject *__pyx_kp_u__12;
  2506. static PyObject *__pyx_kp_u__27;
  2507. static PyObject *__pyx_kp_u__8;
  2508. static PyObject *__pyx_kp_u__9;
  2509. static PyObject *__pyx_n_s_add;
  2510. static PyObject *__pyx_n_s_add_graph;
  2511. static PyObject *__pyx_n_s_add_graph_2;
  2512. static PyObject *__pyx_n_s_all;
  2513. static PyObject *__pyx_n_s_all_contexts;
  2514. static PyObject *__pyx_n_s_all_namespaces;
  2515. static PyObject *__pyx_n_s_all_term_keys;
  2516. static PyObject *__pyx_n_s_all_terms;
  2517. static PyObject *__pyx_n_s_and;
  2518. static PyObject *__pyx_kp_u_and_term;
  2519. static PyObject *__pyx_n_s_any;
  2520. static PyObject *__pyx_n_s_args;
  2521. static PyObject *__pyx_n_s_as_rdflib;
  2522. static PyObject *__pyx_kp_u_asm_rng;
  2523. static PyObject *__pyx_kp_u_at_position;
  2524. static PyObject *__pyx_kp_u_bytes;
  2525. static PyObject *__pyx_kp_u_bytes_of_data;
  2526. static PyObject *__pyx_kp_u_c;
  2527. static PyObject *__pyx_kp_u_c_spo;
  2528. static PyObject *__pyx_n_s_class;
  2529. static PyObject *__pyx_n_s_cline_in_traceback;
  2530. static PyObject *__pyx_n_s_close;
  2531. static PyObject *__pyx_n_s_collections_abc;
  2532. static PyObject *__pyx_n_s_context;
  2533. static PyObject *__pyx_n_s_contexts;
  2534. static PyObject *__pyx_n_s_ct;
  2535. static PyObject *__pyx_n_s_data;
  2536. static PyObject *__pyx_n_u_db_stats;
  2537. static PyObject *__pyx_n_s_dbi_flags;
  2538. static PyObject *__pyx_n_s_dbi_labels;
  2539. static PyObject *__pyx_n_s_debug;
  2540. static PyObject *__pyx_n_s_dict;
  2541. static PyObject *__pyx_n_s_enumerate;
  2542. static PyObject *__pyx_n_s_eq;
  2543. static PyObject *__pyx_kp_u_exists_already;
  2544. static PyObject *__pyx_n_s_flags;
  2545. static PyObject *__pyx_n_s_fn;
  2546. static PyObject *__pyx_n_s_format;
  2547. static PyObject *__pyx_kp_u_from_indices;
  2548. static PyObject *__pyx_kp_u_from_main;
  2549. static PyObject *__pyx_n_s_functools;
  2550. static PyObject *__pyx_n_s_genexpr;
  2551. static PyObject *__pyx_n_s_getLogger;
  2552. static PyObject *__pyx_n_s_getstate;
  2553. static PyObject *__pyx_n_s_hashlib;
  2554. static PyObject *__pyx_n_s_hex;
  2555. static PyObject *__pyx_kp_u_i_in_0bound;
  2556. static PyObject *__pyx_n_s_iand;
  2557. static PyObject *__pyx_n_s_id;
  2558. static PyObject *__pyx_n_s_identifier;
  2559. static PyObject *__pyx_n_u_idx_add;
  2560. static PyObject *__pyx_n_u_idx_remove;
  2561. static PyObject *__pyx_n_s_import;
  2562. static PyObject *__pyx_n_s_index;
  2563. static PyObject *__pyx_n_s_init;
  2564. static PyObject *__pyx_n_s_ior;
  2565. static PyObject *__pyx_n_s_is_txn_rw;
  2566. static PyObject *__pyx_n_s_isub;
  2567. static PyObject *__pyx_n_s_itemsize;
  2568. static PyObject *__pyx_n_s_iter;
  2569. static PyObject *__pyx_n_s_ixor;
  2570. static PyObject *__pyx_n_s_lakesuperior_store_base_lmdb_sto;
  2571. static PyObject *__pyx_n_s_lakesuperior_store_ldp_rs_lmdb_t;
  2572. static PyObject *__pyx_kp_s_lakesuperior_store_ldp_rs_lmdb_t_2;
  2573. static PyObject *__pyx_n_s_len;
  2574. static PyObject *__pyx_kp_u_length;
  2575. static PyObject *__pyx_kp_u_length_2;
  2576. static PyObject *__pyx_n_s_logger;
  2577. static PyObject *__pyx_n_s_logging;
  2578. static PyObject *__pyx_n_s_lookup;
  2579. static PyObject *__pyx_kp_u_lookup_1bound;
  2580. static PyObject *__pyx_n_s_lookup_indices;
  2581. static PyObject *__pyx_kp_u_luk;
  2582. static PyObject *__pyx_kp_u_luk1;
  2583. static PyObject *__pyx_kp_u_luk2;
  2584. static PyObject *__pyx_n_s_main;
  2585. static PyObject *__pyx_n_u_map_size;
  2586. static PyObject *__pyx_n_u_ms_entries;
  2587. static PyObject *__pyx_n_s_name;
  2588. static PyObject *__pyx_n_s_new;
  2589. static PyObject *__pyx_n_s_new_txn;
  2590. static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
  2591. static PyObject *__pyx_n_s_normalize_context;
  2592. static PyObject *__pyx_kp_u_ns_pfx;
  2593. static PyObject *__pyx_n_u_num_triples;
  2594. static PyObject *__pyx_n_s_o;
  2595. static PyObject *__pyx_kp_b_o_sp;
  2596. static PyObject *__pyx_kp_u_o_sp;
  2597. static PyObject *__pyx_n_s_options;
  2598. static PyObject *__pyx_n_s_or;
  2599. static PyObject *__pyx_n_s_os;
  2600. static PyObject *__pyx_n_s_other;
  2601. static PyObject *__pyx_n_s_p;
  2602. static PyObject *__pyx_kp_b_p_so;
  2603. static PyObject *__pyx_kp_u_p_so;
  2604. static PyObject *__pyx_kp_u_pfx_ns;
  2605. static PyObject *__pyx_n_s_pickle;
  2606. static PyObject *__pyx_n_s_pk_c;
  2607. static PyObject *__pyx_n_s_pk_size;
  2608. static PyObject *__pyx_kp_b_po_s;
  2609. static PyObject *__pyx_kp_u_po_s;
  2610. static PyObject *__pyx_n_s_pyx_PickleError;
  2611. static PyObject *__pyx_n_s_pyx_checksum;
  2612. static PyObject *__pyx_n_s_pyx_result;
  2613. static PyObject *__pyx_n_s_pyx_state;
  2614. static PyObject *__pyx_n_s_pyx_type;
  2615. static PyObject *__pyx_n_s_pyx_unpickle_Imr;
  2616. static PyObject *__pyx_n_s_pyx_unpickle_SimpleGraph;
  2617. static PyObject *__pyx_n_s_pyx_vtable;
  2618. static PyObject *__pyx_n_s_quoted;
  2619. static PyObject *__pyx_n_s_range;
  2620. static PyObject *__pyx_n_s_rdflib;
  2621. static PyObject *__pyx_n_s_rdflib_graph;
  2622. static PyObject *__pyx_n_s_rdflib_term;
  2623. static PyObject *__pyx_n_s_reduce;
  2624. static PyObject *__pyx_n_s_reduce_cython;
  2625. static PyObject *__pyx_n_s_reduce_ex;
  2626. static PyObject *__pyx_n_s_remove;
  2627. static PyObject *__pyx_n_s_remove_graph;
  2628. static PyObject *__pyx_n_s_remove_triples;
  2629. static PyObject *__pyx_n_s_resource;
  2630. static PyObject *__pyx_kp_u_ret_offset;
  2631. static PyObject *__pyx_n_s_s;
  2632. static PyObject *__pyx_kp_b_s_po;
  2633. static PyObject *__pyx_kp_u_s_po;
  2634. static PyObject *__pyx_n_s_self;
  2635. static PyObject *__pyx_kp_s_self_curs_self_dbenv_self_dbis_s;
  2636. static PyObject *__pyx_n_s_send;
  2637. static PyObject *__pyx_n_s_set;
  2638. static PyObject *__pyx_n_s_setstate;
  2639. static PyObject *__pyx_n_s_setstate_cython;
  2640. static PyObject *__pyx_kp_b_so_p;
  2641. static PyObject *__pyx_kp_u_so_p;
  2642. static PyObject *__pyx_kp_b_sp_o;
  2643. static PyObject *__pyx_kp_u_sp_o;
  2644. static PyObject *__pyx_n_u_spo;
  2645. static PyObject *__pyx_kp_u_spo_c;
  2646. static PyObject *__pyx_n_s_start;
  2647. static PyObject *__pyx_n_s_stats;
  2648. static PyObject *__pyx_n_s_step;
  2649. static PyObject *__pyx_n_s_stop;
  2650. static PyObject *__pyx_n_s_store;
  2651. static PyObject *__pyx_n_s_strict;
  2652. static PyObject *__pyx_kp_s_stringsource;
  2653. static PyObject *__pyx_n_s_sub;
  2654. static PyObject *__pyx_n_s_super;
  2655. static PyObject *__pyx_kp_u_t_st;
  2656. static PyObject *__pyx_kp_u_term_order;
  2657. static PyObject *__pyx_n_s_terms;
  2658. static PyObject *__pyx_n_s_test;
  2659. static PyObject *__pyx_kp_u_th_t;
  2660. static PyObject *__pyx_n_s_throw;
  2661. static PyObject *__pyx_kp_u_to_indices;
  2662. static PyObject *__pyx_n_s_to_tuple;
  2663. static PyObject *__pyx_n_s_to_tuple_locals_genexpr;
  2664. static PyObject *__pyx_n_s_triple;
  2665. static PyObject *__pyx_n_s_triple_keys;
  2666. static PyObject *__pyx_n_s_triple_pattern;
  2667. static PyObject *__pyx_n_s_triples;
  2668. static PyObject *__pyx_n_s_update;
  2669. static PyObject *__pyx_n_s_uri;
  2670. static PyObject *__pyx_kp_u_uri_2;
  2671. static PyObject *__pyx_n_s_use_data;
  2672. static PyObject *__pyx_n_s_use_data_locals__wrapper;
  2673. static PyObject *__pyx_n_s_wrapper;
  2674. static PyObject *__pyx_n_s_wraps;
  2675. static PyObject *__pyx_n_s_xor;
  2676. static int __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet___cinit__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_self, size_t __pyx_v_ct, unsigned char __pyx_v_itemsize); /* proto */
  2677. static void __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_2__dealloc__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_self); /* proto */
  2678. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_8to_tuple_genexpr(PyObject *__pyx_self); /* proto */
  2679. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_4to_tuple(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_self); /* proto */
  2680. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_6get_item_obj(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_self, PyObject *__pyx_v_i); /* proto */
  2681. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_4data___get__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_self); /* proto */
  2682. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_8itemsize___get__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_self); /* proto */
  2683. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_2ct___get__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_self); /* proto */
  2684. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_4size___get__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_self); /* proto */
  2685. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_self); /* proto */
  2686. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
  2687. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_8use_data__wrapper(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
  2688. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_use_data(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fn); /* proto */
  2689. static int __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph___init__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_lookup, PyObject *__pyx_v_store); /* proto */
  2690. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_2add(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_dataset); /* proto */
  2691. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_4remove(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
  2692. static Py_ssize_t __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_6__len__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self); /* proto */
  2693. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_8__eq__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
  2694. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_10__repr__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self); /* proto */
  2695. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_12__str__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self); /* proto */
  2696. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_14__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
  2697. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_16__isub__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
  2698. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_18__and__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
  2699. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_20__iand__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
  2700. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_22__or__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
  2701. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_24__ior__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
  2702. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_26__xor__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
  2703. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_28__ixor__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
  2704. static int __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_30__contains__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
  2705. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_32__iter__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self); /* proto */
  2706. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_34__getitem__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
  2707. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_36set(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_trp); /* proto */
  2708. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_38remove_triples(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */
  2709. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_40as_rdflib(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self); /* proto */
  2710. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_42lookup(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_s, PyObject *__pyx_v_p, PyObject *__pyx_v_o); /* proto */
  2711. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_44terms(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_type); /* proto */
  2712. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_4data___get__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self); /* proto */
  2713. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_46__reduce_cython__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self); /* proto */
  2714. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_48__setstate_cython__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
  2715. static int __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr___init__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *__pyx_v_self, PyObject *__pyx_v_uri, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
  2716. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_10identifier___get__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *__pyx_v_self); /* proto */
  2717. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_5graph___get__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *__pyx_v_self); /* proto */
  2718. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_2__repr__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *__pyx_v_self); /* proto */
  2719. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_4__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
  2720. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_6__and__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
  2721. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_8__or__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
  2722. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_10__xor__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
  2723. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_12__getitem__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
  2724. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_14value(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *__pyx_v_self, PyObject *__pyx_v_p, PyObject *__pyx_v_strict); /* proto */
  2725. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_16as_rdflib(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *__pyx_v_self); /* proto */
  2726. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_3uri___get__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *__pyx_v_self); /* proto */
  2727. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_18__reduce_cython__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *__pyx_v_self); /* proto */
  2728. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_20__setstate_cython__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
  2729. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_stats(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_new_txn); /* proto */
  2730. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_2_len(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_context); /* proto */
  2731. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_4add(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_triple, PyObject *__pyx_v_context, PyObject *__pyx_v_quoted); /* proto */
  2732. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_6add_graph(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_graph); /* proto */
  2733. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_8_add_graph(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, unsigned char *__pyx_v_pk_c, size_t __pyx_v_pk_size); /* proto */
  2734. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_10_remove(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_triple_pattern, PyObject *__pyx_v_context); /* proto */
  2735. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_12_remove_graph(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_gr_uri); /* proto */
  2736. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_14contexts(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_triple); /* proto */
  2737. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_17triples(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_triple_pattern, PyObject *__pyx_v_context); /* proto */
  2738. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_20triple_keys(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_triple_pattern, PyObject *__pyx_v_context); /* proto */
  2739. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_22_all_term_keys(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_term_type); /* proto */
  2740. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_24all_terms(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_term_type); /* proto */
  2741. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_27all_namespaces(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self); /* proto */
  2742. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_29all_contexts(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_triple); /* proto */
  2743. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_31__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self); /* proto */
  2744. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_33__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
  2745. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_2__pyx_unpickle_SimpleGraph(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
  2746. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_4__pyx_unpickle_Imr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
  2747. static PyObject *__pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2748. static PyObject *__pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2749. static PyObject *__pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2750. static PyObject *__pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2751. static PyObject *__pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2752. static PyObject *__pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2753. static PyObject *__pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2754. static PyObject *__pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2755. static PyObject *__pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2756. static PyObject *__pyx_int_0;
  2757. static PyObject *__pyx_int_1;
  2758. static PyObject *__pyx_int_5;
  2759. static PyObject *__pyx_int_10;
  2760. static PyObject *__pyx_int_15;
  2761. static PyObject *__pyx_int_148338675;
  2762. static PyObject *__pyx_int_200819009;
  2763. static PyObject *__pyx_int_1099511627776;
  2764. static PyObject *__pyx_k__6;
  2765. static unsigned char *__pyx_k__30;
  2766. static PyObject *__pyx_tuple_;
  2767. static PyObject *__pyx_tuple__2;
  2768. static PyObject *__pyx_tuple__4;
  2769. static PyObject *__pyx_tuple__7;
  2770. static PyObject *__pyx_tuple__13;
  2771. static PyObject *__pyx_tuple__14;
  2772. static PyObject *__pyx_tuple__15;
  2773. static PyObject *__pyx_tuple__16;
  2774. static PyObject *__pyx_tuple__17;
  2775. static PyObject *__pyx_tuple__18;
  2776. static PyObject *__pyx_tuple__19;
  2777. static PyObject *__pyx_tuple__20;
  2778. static PyObject *__pyx_tuple__21;
  2779. static PyObject *__pyx_tuple__22;
  2780. static PyObject *__pyx_tuple__23;
  2781. static PyObject *__pyx_tuple__24;
  2782. static PyObject *__pyx_tuple__25;
  2783. static PyObject *__pyx_tuple__26;
  2784. static PyObject *__pyx_tuple__28;
  2785. static PyObject *__pyx_tuple__29;
  2786. static PyObject *__pyx_tuple__31;
  2787. static PyObject *__pyx_tuple__32;
  2788. static PyObject *__pyx_tuple__33;
  2789. static PyObject *__pyx_tuple__36;
  2790. static PyObject *__pyx_tuple__37;
  2791. static PyObject *__pyx_tuple__38;
  2792. static PyObject *__pyx_codeobj__3;
  2793. static PyObject *__pyx_codeobj__5;
  2794. static PyObject *__pyx_codeobj__34;
  2795. static PyObject *__pyx_codeobj__35;
  2796. /* Late includes */
  2797. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":122
  2798. *
  2799. *
  2800. * cdef inline void _hash( # <<<<<<<<<<<<<<
  2801. * const unsigned char *message, size_t message_size, Hash digest):
  2802. * """Get the hash value of a serialized object."""
  2803. */
  2804. static CYTHON_INLINE void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore__hash(unsigned char const *__pyx_v_message, size_t __pyx_v_message_size, unsigned char *__pyx_v_digest) {
  2805. __Pyx_TraceDeclarations
  2806. __Pyx_RefNannyDeclarations
  2807. __Pyx_RefNannySetupContext("_hash", 0);
  2808. __Pyx_TraceCall("_hash", __pyx_f[0], 122, 0, __PYX_ERR(0, 122, __pyx_L1_error));
  2809. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":125
  2810. * const unsigned char *message, size_t message_size, Hash digest):
  2811. * """Get the hash value of a serialized object."""
  2812. * SHA1(message, message_size, digest) # <<<<<<<<<<<<<<
  2813. *
  2814. *
  2815. */
  2816. (void)(SHA1(__pyx_v_message, __pyx_v_message_size, __pyx_v_digest));
  2817. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":122
  2818. *
  2819. *
  2820. * cdef inline void _hash( # <<<<<<<<<<<<<<
  2821. * const unsigned char *message, size_t message_size, Hash digest):
  2822. * """Get the hash value of a serialized object."""
  2823. */
  2824. /* function exit code */
  2825. goto __pyx_L0;
  2826. __pyx_L1_error:;
  2827. __Pyx_WriteUnraisable("lakesuperior.store.ldp_rs.lmdb_triplestore._hash", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  2828. __pyx_L0:;
  2829. __Pyx_TraceReturn(Py_None, 0);
  2830. __Pyx_RefNannyFinishContext();
  2831. }
  2832. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":152
  2833. * readonly size_t ct, size
  2834. *
  2835. * def __cinit__(self, size_t ct, unsigned char itemsize): # <<<<<<<<<<<<<<
  2836. * """
  2837. * Initialize and allocate memory for the data set.
  2838. */
  2839. /* Python wrapper */
  2840. static int __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  2841. static int __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  2842. size_t __pyx_v_ct;
  2843. unsigned char __pyx_v_itemsize;
  2844. int __pyx_r;
  2845. __Pyx_RefNannyDeclarations
  2846. __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  2847. {
  2848. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ct,&__pyx_n_s_itemsize,0};
  2849. PyObject* values[2] = {0,0};
  2850. if (unlikely(__pyx_kwds)) {
  2851. Py_ssize_t kw_args;
  2852. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  2853. switch (pos_args) {
  2854. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2855. CYTHON_FALLTHROUGH;
  2856. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2857. CYTHON_FALLTHROUGH;
  2858. case 0: break;
  2859. default: goto __pyx_L5_argtuple_error;
  2860. }
  2861. kw_args = PyDict_Size(__pyx_kwds);
  2862. switch (pos_args) {
  2863. case 0:
  2864. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ct)) != 0)) kw_args--;
  2865. else goto __pyx_L5_argtuple_error;
  2866. CYTHON_FALLTHROUGH;
  2867. case 1:
  2868. if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
  2869. else {
  2870. __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(0, 152, __pyx_L3_error)
  2871. }
  2872. }
  2873. if (unlikely(kw_args > 0)) {
  2874. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 152, __pyx_L3_error)
  2875. }
  2876. } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
  2877. goto __pyx_L5_argtuple_error;
  2878. } else {
  2879. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2880. values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2881. }
  2882. __pyx_v_ct = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_ct == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 152, __pyx_L3_error)
  2883. __pyx_v_itemsize = __Pyx_PyInt_As_unsigned_char(values[1]); if (unlikely((__pyx_v_itemsize == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(0, 152, __pyx_L3_error)
  2884. }
  2885. goto __pyx_L4_argument_unpacking_done;
  2886. __pyx_L5_argtuple_error:;
  2887. __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 152, __pyx_L3_error)
  2888. __pyx_L3_error:;
  2889. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.ResultSet.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2890. __Pyx_RefNannyFinishContext();
  2891. return -1;
  2892. __pyx_L4_argument_unpacking_done:;
  2893. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet___cinit__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_v_self), __pyx_v_ct, __pyx_v_itemsize);
  2894. /* function exit code */
  2895. __Pyx_RefNannyFinishContext();
  2896. return __pyx_r;
  2897. }
  2898. static int __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet___cinit__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_self, size_t __pyx_v_ct, unsigned char __pyx_v_itemsize) {
  2899. int __pyx_r;
  2900. __Pyx_TraceDeclarations
  2901. __Pyx_RefNannyDeclarations
  2902. int __pyx_t_1;
  2903. __Pyx_RefNannySetupContext("__cinit__", 0);
  2904. __Pyx_TraceCall("__cinit__", __pyx_f[0], 152, 0, __PYX_ERR(0, 152, __pyx_L1_error));
  2905. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":163
  2906. * char variables.
  2907. * """
  2908. * self.ct = ct # <<<<<<<<<<<<<<
  2909. * self.itemsize = itemsize
  2910. * self.size = self.itemsize * self.ct
  2911. */
  2912. __pyx_v_self->ct = __pyx_v_ct;
  2913. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":164
  2914. * """
  2915. * self.ct = ct
  2916. * self.itemsize = itemsize # <<<<<<<<<<<<<<
  2917. * self.size = self.itemsize * self.ct
  2918. *
  2919. */
  2920. __pyx_v_self->itemsize = __pyx_v_itemsize;
  2921. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":165
  2922. * self.ct = ct
  2923. * self.itemsize = itemsize
  2924. * self.size = self.itemsize * self.ct # <<<<<<<<<<<<<<
  2925. *
  2926. * #logger.debug('Got malloc sizes: {}, {}'.format(ct, itemsize))
  2927. */
  2928. __pyx_v_self->size = (__pyx_v_self->itemsize * __pyx_v_self->ct);
  2929. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":171
  2930. * # 'Allocating {0} ({1}x{2}) bytes of ResultSet data...'.format(
  2931. * # self.size, self.ct, self.itemsize))
  2932. * self.data = <unsigned char *>PyMem_Malloc(ct * itemsize) # <<<<<<<<<<<<<<
  2933. * if not self.data:
  2934. * raise MemoryError()
  2935. */
  2936. __pyx_v_self->data = ((unsigned char *)PyMem_Malloc((__pyx_v_ct * __pyx_v_itemsize)));
  2937. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":172
  2938. * # self.size, self.ct, self.itemsize))
  2939. * self.data = <unsigned char *>PyMem_Malloc(ct * itemsize)
  2940. * if not self.data: # <<<<<<<<<<<<<<
  2941. * raise MemoryError()
  2942. * #logger.debug('...done allocating @ {0:x}.'.format(
  2943. */
  2944. __pyx_t_1 = ((!(__pyx_v_self->data != 0)) != 0);
  2945. if (unlikely(__pyx_t_1)) {
  2946. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":173
  2947. * self.data = <unsigned char *>PyMem_Malloc(ct * itemsize)
  2948. * if not self.data:
  2949. * raise MemoryError() # <<<<<<<<<<<<<<
  2950. * #logger.debug('...done allocating @ {0:x}.'.format(
  2951. * # <unsigned long>self.data))
  2952. */
  2953. PyErr_NoMemory(); __PYX_ERR(0, 173, __pyx_L1_error)
  2954. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":172
  2955. * # self.size, self.ct, self.itemsize))
  2956. * self.data = <unsigned char *>PyMem_Malloc(ct * itemsize)
  2957. * if not self.data: # <<<<<<<<<<<<<<
  2958. * raise MemoryError()
  2959. * #logger.debug('...done allocating @ {0:x}.'.format(
  2960. */
  2961. }
  2962. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":152
  2963. * readonly size_t ct, size
  2964. *
  2965. * def __cinit__(self, size_t ct, unsigned char itemsize): # <<<<<<<<<<<<<<
  2966. * """
  2967. * Initialize and allocate memory for the data set.
  2968. */
  2969. /* function exit code */
  2970. __pyx_r = 0;
  2971. goto __pyx_L0;
  2972. __pyx_L1_error:;
  2973. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.ResultSet.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2974. __pyx_r = -1;
  2975. __pyx_L0:;
  2976. __Pyx_TraceReturn(Py_None, 0);
  2977. __Pyx_RefNannyFinishContext();
  2978. return __pyx_r;
  2979. }
  2980. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":178
  2981. *
  2982. *
  2983. * def __dealloc__(self): # <<<<<<<<<<<<<<
  2984. * #logger.debug(
  2985. * # 'Releasing {0} ({1}x{2}) bytes of ResultSet @ {3:x}...'.format(
  2986. */
  2987. /* Python wrapper */
  2988. static void __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
  2989. static void __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_3__dealloc__(PyObject *__pyx_v_self) {
  2990. __Pyx_RefNannyDeclarations
  2991. __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  2992. __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_2__dealloc__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_v_self));
  2993. /* function exit code */
  2994. __Pyx_RefNannyFinishContext();
  2995. }
  2996. static void __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_2__dealloc__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_self) {
  2997. __Pyx_TraceDeclarations
  2998. __Pyx_RefNannyDeclarations
  2999. __Pyx_RefNannySetupContext("__dealloc__", 0);
  3000. __Pyx_TraceCall("__dealloc__", __pyx_f[0], 178, 0, __PYX_ERR(0, 178, __pyx_L1_error));
  3001. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":183
  3002. * # self.size, self.ct, self.itemsize,
  3003. * # <unsigned long>self.data))
  3004. * PyMem_Free(self.data) # <<<<<<<<<<<<<<
  3005. * #logger.debug('...done releasing.')
  3006. *
  3007. */
  3008. PyMem_Free(__pyx_v_self->data);
  3009. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":178
  3010. *
  3011. *
  3012. * def __dealloc__(self): # <<<<<<<<<<<<<<
  3013. * #logger.debug(
  3014. * # 'Releasing {0} ({1}x{2}) bytes of ResultSet @ {3:x}...'.format(
  3015. */
  3016. /* function exit code */
  3017. goto __pyx_L0;
  3018. __pyx_L1_error:;
  3019. __Pyx_WriteUnraisable("lakesuperior.store.ldp_rs.lmdb_triplestore.ResultSet.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  3020. __pyx_L0:;
  3021. __Pyx_TraceReturn(Py_None, 0);
  3022. __Pyx_RefNannyFinishContext();
  3023. }
  3024. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":187
  3025. *
  3026. *
  3027. * cdef void resize(self, size_t ct) except *: # <<<<<<<<<<<<<<
  3028. * cdef unsigned char *tmp
  3029. * self.ct = ct
  3030. */
  3031. static void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_resize(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_self, size_t __pyx_v_ct) {
  3032. unsigned char *__pyx_v_tmp;
  3033. __Pyx_TraceDeclarations
  3034. __Pyx_RefNannyDeclarations
  3035. int __pyx_t_1;
  3036. __Pyx_RefNannySetupContext("resize", 0);
  3037. __Pyx_TraceCall("resize", __pyx_f[0], 187, 0, __PYX_ERR(0, 187, __pyx_L1_error));
  3038. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":189
  3039. * cdef void resize(self, size_t ct) except *:
  3040. * cdef unsigned char *tmp
  3041. * self.ct = ct # <<<<<<<<<<<<<<
  3042. * self.size = self.itemsize * self.ct
  3043. *
  3044. */
  3045. __pyx_v_self->ct = __pyx_v_ct;
  3046. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":190
  3047. * cdef unsigned char *tmp
  3048. * self.ct = ct
  3049. * self.size = self.itemsize * self.ct # <<<<<<<<<<<<<<
  3050. *
  3051. * #logger.debug(
  3052. */
  3053. __pyx_v_self->size = (__pyx_v_self->itemsize * __pyx_v_self->ct);
  3054. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":196
  3055. * # self.itemsize * ct, ct, self.itemsize,
  3056. * # <unsigned long>self.data))
  3057. * tmp = <unsigned char *>PyMem_Realloc(self.data, ct * self.itemsize) # <<<<<<<<<<<<<<
  3058. * if not tmp:
  3059. * raise MemoryError()
  3060. */
  3061. __pyx_v_tmp = ((unsigned char *)PyMem_Realloc(__pyx_v_self->data, (__pyx_v_ct * __pyx_v_self->itemsize)));
  3062. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":197
  3063. * # <unsigned long>self.data))
  3064. * tmp = <unsigned char *>PyMem_Realloc(self.data, ct * self.itemsize)
  3065. * if not tmp: # <<<<<<<<<<<<<<
  3066. * raise MemoryError()
  3067. * #logger.debug('...done resizing.')
  3068. */
  3069. __pyx_t_1 = ((!(__pyx_v_tmp != 0)) != 0);
  3070. if (unlikely(__pyx_t_1)) {
  3071. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":198
  3072. * tmp = <unsigned char *>PyMem_Realloc(self.data, ct * self.itemsize)
  3073. * if not tmp:
  3074. * raise MemoryError() # <<<<<<<<<<<<<<
  3075. * #logger.debug('...done resizing.')
  3076. *
  3077. */
  3078. PyErr_NoMemory(); __PYX_ERR(0, 198, __pyx_L1_error)
  3079. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":197
  3080. * # <unsigned long>self.data))
  3081. * tmp = <unsigned char *>PyMem_Realloc(self.data, ct * self.itemsize)
  3082. * if not tmp: # <<<<<<<<<<<<<<
  3083. * raise MemoryError()
  3084. * #logger.debug('...done resizing.')
  3085. */
  3086. }
  3087. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":201
  3088. * #logger.debug('...done resizing.')
  3089. *
  3090. * self.data = tmp # <<<<<<<<<<<<<<
  3091. *
  3092. *
  3093. */
  3094. __pyx_v_self->data = __pyx_v_tmp;
  3095. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":187
  3096. *
  3097. *
  3098. * cdef void resize(self, size_t ct) except *: # <<<<<<<<<<<<<<
  3099. * cdef unsigned char *tmp
  3100. * self.ct = ct
  3101. */
  3102. /* function exit code */
  3103. goto __pyx_L0;
  3104. __pyx_L1_error:;
  3105. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.ResultSet.resize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3106. __pyx_L0:;
  3107. __Pyx_TraceReturn(Py_None, 0);
  3108. __Pyx_RefNannyFinishContext();
  3109. }
  3110. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":206
  3111. * # Access methods.
  3112. *
  3113. * def to_tuple(self): # <<<<<<<<<<<<<<
  3114. * """
  3115. * Return the data set as a Python tuple.
  3116. */
  3117. /* Python wrapper */
  3118. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_5to_tuple(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  3119. static char __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_4to_tuple[] = "\n Return the data set as a Python tuple.\n ";
  3120. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_5to_tuple(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  3121. PyObject *__pyx_r = 0;
  3122. __Pyx_RefNannyDeclarations
  3123. __Pyx_RefNannySetupContext("to_tuple (wrapper)", 0);
  3124. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_4to_tuple(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_v_self));
  3125. /* function exit code */
  3126. __Pyx_RefNannyFinishContext();
  3127. return __pyx_r;
  3128. }
  3129. static PyObject *__pyx_gb_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_8to_tuple_2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
  3130. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":211
  3131. * """
  3132. * return tuple(
  3133. * self.data[i: i + self.itemsize] # <<<<<<<<<<<<<<
  3134. * for i in range(0, self.size, self.itemsize))
  3135. *
  3136. */
  3137. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_8to_tuple_genexpr(PyObject *__pyx_self) {
  3138. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
  3139. PyObject *__pyx_r = NULL;
  3140. __Pyx_RefNannyDeclarations
  3141. __Pyx_RefNannySetupContext("genexpr", 0);
  3142. __pyx_cur_scope = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr *)__pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr(__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);
  3143. if (unlikely(!__pyx_cur_scope)) {
  3144. __pyx_cur_scope = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr *)Py_None);
  3145. __Pyx_INCREF(Py_None);
  3146. __PYX_ERR(0, 211, __pyx_L1_error)
  3147. } else {
  3148. __Pyx_GOTREF(__pyx_cur_scope);
  3149. }
  3150. __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple *) __pyx_self;
  3151. __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  3152. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  3153. {
  3154. __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_8to_tuple_2generator3, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_to_tuple_locals_genexpr, __pyx_n_s_lakesuperior_store_ldp_rs_lmdb_t); if (unlikely(!gen)) __PYX_ERR(0, 211, __pyx_L1_error)
  3155. __Pyx_DECREF(__pyx_cur_scope);
  3156. __Pyx_RefNannyFinishContext();
  3157. return (PyObject *) gen;
  3158. }
  3159. /* function exit code */
  3160. __pyx_L1_error:;
  3161. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.ResultSet.to_tuple.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3162. __pyx_r = NULL;
  3163. __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  3164. __Pyx_XGIVEREF(__pyx_r);
  3165. __Pyx_RefNannyFinishContext();
  3166. return __pyx_r;
  3167. }
  3168. static PyObject *__pyx_gb_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_8to_tuple_2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
  3169. {
  3170. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
  3171. PyObject *__pyx_r = NULL;
  3172. __Pyx_TraceDeclarations
  3173. PyObject *__pyx_t_1 = NULL;
  3174. PyObject *__pyx_t_2 = NULL;
  3175. PyObject *__pyx_t_3 = NULL;
  3176. Py_ssize_t __pyx_t_4;
  3177. PyObject *(*__pyx_t_5)(PyObject *);
  3178. Py_ssize_t __pyx_t_6;
  3179. Py_ssize_t __pyx_t_7;
  3180. __Pyx_RefNannyDeclarations
  3181. __Pyx_RefNannySetupContext("genexpr", 0);
  3182. __Pyx_TraceCall("genexpr", __pyx_f[0], 211, 0, __PYX_ERR(0, 211, __pyx_L1_error));
  3183. switch (__pyx_generator->resume_label) {
  3184. case 0: goto __pyx_L3_first_run;
  3185. case 1: goto __pyx_L6_resume_from_yield;
  3186. default: /* CPython raises the right error here */
  3187. __Pyx_TraceReturn(Py_None, 0);
  3188. __Pyx_RefNannyFinishContext();
  3189. return NULL;
  3190. }
  3191. __pyx_L3_first_run:;
  3192. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 211, __pyx_L1_error)
  3193. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":212
  3194. * return tuple(
  3195. * self.data[i: i + self.itemsize]
  3196. * for i in range(0, self.size, self.itemsize)) # <<<<<<<<<<<<<<
  3197. *
  3198. *
  3199. */
  3200. if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 212, __pyx_L1_error) }
  3201. __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error)
  3202. __Pyx_GOTREF(__pyx_t_1);
  3203. if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 212, __pyx_L1_error) }
  3204. __pyx_t_2 = __Pyx_PyInt_From_unsigned_char(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error)
  3205. __Pyx_GOTREF(__pyx_t_2);
  3206. __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error)
  3207. __Pyx_GOTREF(__pyx_t_3);
  3208. __Pyx_INCREF(__pyx_int_0);
  3209. __Pyx_GIVEREF(__pyx_int_0);
  3210. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_0);
  3211. __Pyx_GIVEREF(__pyx_t_1);
  3212. PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  3213. __Pyx_GIVEREF(__pyx_t_2);
  3214. PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  3215. __pyx_t_1 = 0;
  3216. __pyx_t_2 = 0;
  3217. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error)
  3218. __Pyx_GOTREF(__pyx_t_2);
  3219. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3220. if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
  3221. __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
  3222. __pyx_t_5 = NULL;
  3223. } else {
  3224. __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error)
  3225. __Pyx_GOTREF(__pyx_t_3);
  3226. __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 212, __pyx_L1_error)
  3227. }
  3228. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3229. for (;;) {
  3230. if (likely(!__pyx_t_5)) {
  3231. if (likely(PyList_CheckExact(__pyx_t_3))) {
  3232. if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
  3233. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  3234. __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 212, __pyx_L1_error)
  3235. #else
  3236. __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error)
  3237. __Pyx_GOTREF(__pyx_t_2);
  3238. #endif
  3239. } else {
  3240. if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
  3241. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  3242. __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 212, __pyx_L1_error)
  3243. #else
  3244. __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error)
  3245. __Pyx_GOTREF(__pyx_t_2);
  3246. #endif
  3247. }
  3248. } else {
  3249. __pyx_t_2 = __pyx_t_5(__pyx_t_3);
  3250. if (unlikely(!__pyx_t_2)) {
  3251. PyObject* exc_type = PyErr_Occurred();
  3252. if (exc_type) {
  3253. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  3254. else __PYX_ERR(0, 212, __pyx_L1_error)
  3255. }
  3256. break;
  3257. }
  3258. __Pyx_GOTREF(__pyx_t_2);
  3259. }
  3260. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i);
  3261. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_i, __pyx_t_2);
  3262. __Pyx_GIVEREF(__pyx_t_2);
  3263. __pyx_t_2 = 0;
  3264. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":211
  3265. * """
  3266. * return tuple(
  3267. * self.data[i: i + self.itemsize] # <<<<<<<<<<<<<<
  3268. * for i in range(0, self.size, self.itemsize))
  3269. *
  3270. */
  3271. if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 211, __pyx_L1_error) }
  3272. __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_cur_scope->__pyx_v_i); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 211, __pyx_L1_error)
  3273. if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 211, __pyx_L1_error) }
  3274. __pyx_t_2 = __Pyx_PyInt_From_unsigned_char(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __pyx_L1_error)
  3275. __Pyx_GOTREF(__pyx_t_2);
  3276. __pyx_t_1 = PyNumber_Add(__pyx_cur_scope->__pyx_v_i, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error)
  3277. __Pyx_GOTREF(__pyx_t_1);
  3278. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3279. __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 211, __pyx_L1_error)
  3280. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3281. __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->data) + __pyx_t_6, __pyx_t_7 - __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error)
  3282. __Pyx_GOTREF(__pyx_t_1);
  3283. __pyx_r = __pyx_t_1;
  3284. __pyx_t_1 = 0;
  3285. __Pyx_XGIVEREF(__pyx_t_3);
  3286. __pyx_cur_scope->__pyx_t_0 = __pyx_t_3;
  3287. __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
  3288. __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
  3289. __Pyx_XGIVEREF(__pyx_r);
  3290. __Pyx_TraceReturn(__pyx_r, 0);
  3291. __Pyx_RefNannyFinishContext();
  3292. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  3293. /* return from generator, yielding value */
  3294. __pyx_generator->resume_label = 1;
  3295. return __pyx_r;
  3296. __pyx_L6_resume_from_yield:;
  3297. __pyx_t_3 = __pyx_cur_scope->__pyx_t_0;
  3298. __pyx_cur_scope->__pyx_t_0 = 0;
  3299. __Pyx_XGOTREF(__pyx_t_3);
  3300. __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
  3301. __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
  3302. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 211, __pyx_L1_error)
  3303. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":212
  3304. * return tuple(
  3305. * self.data[i: i + self.itemsize]
  3306. * for i in range(0, self.size, self.itemsize)) # <<<<<<<<<<<<<<
  3307. *
  3308. *
  3309. */
  3310. }
  3311. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3312. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  3313. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":211
  3314. * """
  3315. * return tuple(
  3316. * self.data[i: i + self.itemsize] # <<<<<<<<<<<<<<
  3317. * for i in range(0, self.size, self.itemsize))
  3318. *
  3319. */
  3320. /* function exit code */
  3321. PyErr_SetNone(PyExc_StopIteration);
  3322. goto __pyx_L0;
  3323. __pyx_L1_error:;
  3324. __Pyx_XDECREF(__pyx_t_1);
  3325. __Pyx_XDECREF(__pyx_t_2);
  3326. __Pyx_XDECREF(__pyx_t_3);
  3327. __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3328. __pyx_L0:;
  3329. __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  3330. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  3331. __pyx_generator->resume_label = -1;
  3332. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  3333. __Pyx_TraceReturn(__pyx_r, 0);
  3334. __Pyx_RefNannyFinishContext();
  3335. return __pyx_r;
  3336. }
  3337. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":206
  3338. * # Access methods.
  3339. *
  3340. * def to_tuple(self): # <<<<<<<<<<<<<<
  3341. * """
  3342. * Return the data set as a Python tuple.
  3343. */
  3344. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_4to_tuple(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_self) {
  3345. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple *__pyx_cur_scope;
  3346. PyObject *__pyx_r = NULL;
  3347. __Pyx_TraceDeclarations
  3348. __Pyx_RefNannyDeclarations
  3349. PyObject *__pyx_t_1 = NULL;
  3350. PyObject *__pyx_t_2 = NULL;
  3351. __Pyx_RefNannySetupContext("to_tuple", 0);
  3352. __pyx_cur_scope = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple *)__pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple(__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple, __pyx_empty_tuple, NULL);
  3353. if (unlikely(!__pyx_cur_scope)) {
  3354. __pyx_cur_scope = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple *)Py_None);
  3355. __Pyx_INCREF(Py_None);
  3356. __PYX_ERR(0, 206, __pyx_L1_error)
  3357. } else {
  3358. __Pyx_GOTREF(__pyx_cur_scope);
  3359. }
  3360. __Pyx_TraceCall("to_tuple", __pyx_f[0], 206, 0, __PYX_ERR(0, 206, __pyx_L1_error));
  3361. __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  3362. __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  3363. __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  3364. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":210
  3365. * Return the data set as a Python tuple.
  3366. * """
  3367. * return tuple( # <<<<<<<<<<<<<<
  3368. * self.data[i: i + self.itemsize]
  3369. * for i in range(0, self.size, self.itemsize))
  3370. */
  3371. __Pyx_XDECREF(__pyx_r);
  3372. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":211
  3373. * """
  3374. * return tuple(
  3375. * self.data[i: i + self.itemsize] # <<<<<<<<<<<<<<
  3376. * for i in range(0, self.size, self.itemsize))
  3377. *
  3378. */
  3379. __pyx_t_1 = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_8to_tuple_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error)
  3380. __Pyx_GOTREF(__pyx_t_1);
  3381. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":210
  3382. * Return the data set as a Python tuple.
  3383. * """
  3384. * return tuple( # <<<<<<<<<<<<<<
  3385. * self.data[i: i + self.itemsize]
  3386. * for i in range(0, self.size, self.itemsize))
  3387. */
  3388. __pyx_t_2 = __Pyx_PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error)
  3389. __Pyx_GOTREF(__pyx_t_2);
  3390. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3391. __pyx_r = __pyx_t_2;
  3392. __pyx_t_2 = 0;
  3393. goto __pyx_L0;
  3394. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":206
  3395. * # Access methods.
  3396. *
  3397. * def to_tuple(self): # <<<<<<<<<<<<<<
  3398. * """
  3399. * Return the data set as a Python tuple.
  3400. */
  3401. /* function exit code */
  3402. __pyx_L1_error:;
  3403. __Pyx_XDECREF(__pyx_t_1);
  3404. __Pyx_XDECREF(__pyx_t_2);
  3405. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.ResultSet.to_tuple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3406. __pyx_r = NULL;
  3407. __pyx_L0:;
  3408. __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  3409. __Pyx_XGIVEREF(__pyx_r);
  3410. __Pyx_TraceReturn(__pyx_r, 0);
  3411. __Pyx_RefNannyFinishContext();
  3412. return __pyx_r;
  3413. }
  3414. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":215
  3415. *
  3416. *
  3417. * def get_item_obj(self, i): # <<<<<<<<<<<<<<
  3418. * return self.get_item(i)[: self.itemsize]
  3419. *
  3420. */
  3421. /* Python wrapper */
  3422. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_7get_item_obj(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/
  3423. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_7get_item_obj(PyObject *__pyx_v_self, PyObject *__pyx_v_i) {
  3424. PyObject *__pyx_r = 0;
  3425. __Pyx_RefNannyDeclarations
  3426. __Pyx_RefNannySetupContext("get_item_obj (wrapper)", 0);
  3427. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_6get_item_obj(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_v_self), ((PyObject *)__pyx_v_i));
  3428. /* function exit code */
  3429. __Pyx_RefNannyFinishContext();
  3430. return __pyx_r;
  3431. }
  3432. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_6get_item_obj(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_self, PyObject *__pyx_v_i) {
  3433. PyObject *__pyx_r = NULL;
  3434. __Pyx_TraceDeclarations
  3435. __Pyx_RefNannyDeclarations
  3436. PyObject *__pyx_t_1 = NULL;
  3437. __Pyx_RefNannySetupContext("get_item_obj", 0);
  3438. __Pyx_TraceCall("get_item_obj", __pyx_f[0], 215, 0, __PYX_ERR(0, 215, __pyx_L1_error));
  3439. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":216
  3440. *
  3441. * def get_item_obj(self, i):
  3442. * return self.get_item(i)[: self.itemsize] # <<<<<<<<<<<<<<
  3443. *
  3444. *
  3445. */
  3446. __Pyx_XDECREF(__pyx_r);
  3447. __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(((const char*)((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_v_self->__pyx_vtab)->get_item(__pyx_v_self, __pyx_v_i)) + 0, __pyx_v_self->itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error)
  3448. __Pyx_GOTREF(__pyx_t_1);
  3449. __pyx_r = __pyx_t_1;
  3450. __pyx_t_1 = 0;
  3451. goto __pyx_L0;
  3452. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":215
  3453. *
  3454. *
  3455. * def get_item_obj(self, i): # <<<<<<<<<<<<<<
  3456. * return self.get_item(i)[: self.itemsize]
  3457. *
  3458. */
  3459. /* function exit code */
  3460. __pyx_L1_error:;
  3461. __Pyx_XDECREF(__pyx_t_1);
  3462. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.ResultSet.get_item_obj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3463. __pyx_r = NULL;
  3464. __pyx_L0:;
  3465. __Pyx_XGIVEREF(__pyx_r);
  3466. __Pyx_TraceReturn(__pyx_r, 0);
  3467. __Pyx_RefNannyFinishContext();
  3468. return __pyx_r;
  3469. }
  3470. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":219
  3471. *
  3472. *
  3473. * cdef unsigned char *get_item(self, i): # <<<<<<<<<<<<<<
  3474. * """
  3475. * Get an item at a given index position.
  3476. */
  3477. static unsigned char *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_get_item(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_self, PyObject *__pyx_v_i) {
  3478. unsigned char *__pyx_r;
  3479. __Pyx_TraceDeclarations
  3480. __Pyx_RefNannyDeclarations
  3481. PyObject *__pyx_t_1 = NULL;
  3482. PyObject *__pyx_t_2 = NULL;
  3483. PyObject *__pyx_t_3 = NULL;
  3484. unsigned char *__pyx_t_4;
  3485. __Pyx_RefNannySetupContext("get_item", 0);
  3486. __Pyx_TraceCall("get_item", __pyx_f[0], 219, 0, __PYX_ERR(0, 219, __pyx_L1_error));
  3487. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":225
  3488. * The item size is known by the ``itemsize`` property of the object.
  3489. * """
  3490. * return self.data + self.itemsize * i # <<<<<<<<<<<<<<
  3491. *
  3492. *
  3493. */
  3494. __pyx_t_1 = __Pyx_PyBytes_FromCString(__pyx_v_self->data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error)
  3495. __Pyx_GOTREF(__pyx_t_1);
  3496. __pyx_t_2 = __Pyx_PyInt_From_unsigned_char(__pyx_v_self->itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 225, __pyx_L1_error)
  3497. __Pyx_GOTREF(__pyx_t_2);
  3498. __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error)
  3499. __Pyx_GOTREF(__pyx_t_3);
  3500. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3501. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 225, __pyx_L1_error)
  3502. __Pyx_GOTREF(__pyx_t_2);
  3503. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3504. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3505. __pyx_t_4 = __Pyx_PyObject_AsWritableUString(__pyx_t_2); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 225, __pyx_L1_error)
  3506. __pyx_r = __pyx_t_4;
  3507. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3508. goto __pyx_L0;
  3509. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":219
  3510. *
  3511. *
  3512. * cdef unsigned char *get_item(self, i): # <<<<<<<<<<<<<<
  3513. * """
  3514. * Get an item at a given index position.
  3515. */
  3516. /* function exit code */
  3517. __pyx_L1_error:;
  3518. __Pyx_XDECREF(__pyx_t_1);
  3519. __Pyx_XDECREF(__pyx_t_2);
  3520. __Pyx_XDECREF(__pyx_t_3);
  3521. __Pyx_WriteUnraisable("lakesuperior.store.ldp_rs.lmdb_triplestore.ResultSet.get_item", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  3522. __pyx_r = 0;
  3523. __pyx_L0:;
  3524. __Pyx_TraceReturn(Py_None, 0);
  3525. __Pyx_RefNannyFinishContext();
  3526. return __pyx_r;
  3527. }
  3528. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":148
  3529. * """
  3530. * cdef:
  3531. * readonly unsigned char *data # <<<<<<<<<<<<<<
  3532. * readonly unsigned char itemsize
  3533. * readonly size_t ct, size
  3534. */
  3535. /* Python wrapper */
  3536. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_4data_1__get__(PyObject *__pyx_v_self); /*proto*/
  3537. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_4data_1__get__(PyObject *__pyx_v_self) {
  3538. PyObject *__pyx_r = 0;
  3539. __Pyx_RefNannyDeclarations
  3540. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  3541. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_4data___get__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_v_self));
  3542. /* function exit code */
  3543. __Pyx_RefNannyFinishContext();
  3544. return __pyx_r;
  3545. }
  3546. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_4data___get__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_self) {
  3547. PyObject *__pyx_r = NULL;
  3548. __Pyx_TraceDeclarations
  3549. __Pyx_RefNannyDeclarations
  3550. PyObject *__pyx_t_1 = NULL;
  3551. __Pyx_RefNannySetupContext("__get__", 0);
  3552. __Pyx_TraceCall("__get__", __pyx_f[0], 148, 0, __PYX_ERR(0, 148, __pyx_L1_error));
  3553. __Pyx_XDECREF(__pyx_r);
  3554. __pyx_t_1 = __Pyx_PyBytes_FromCString(__pyx_v_self->data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error)
  3555. __Pyx_GOTREF(__pyx_t_1);
  3556. __pyx_r = __pyx_t_1;
  3557. __pyx_t_1 = 0;
  3558. goto __pyx_L0;
  3559. /* function exit code */
  3560. __pyx_L1_error:;
  3561. __Pyx_XDECREF(__pyx_t_1);
  3562. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.ResultSet.data.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3563. __pyx_r = NULL;
  3564. __pyx_L0:;
  3565. __Pyx_XGIVEREF(__pyx_r);
  3566. __Pyx_TraceReturn(__pyx_r, 0);
  3567. __Pyx_RefNannyFinishContext();
  3568. return __pyx_r;
  3569. }
  3570. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":149
  3571. * cdef:
  3572. * readonly unsigned char *data
  3573. * readonly unsigned char itemsize # <<<<<<<<<<<<<<
  3574. * readonly size_t ct, size
  3575. *
  3576. */
  3577. /* Python wrapper */
  3578. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/
  3579. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_8itemsize_1__get__(PyObject *__pyx_v_self) {
  3580. PyObject *__pyx_r = 0;
  3581. __Pyx_RefNannyDeclarations
  3582. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  3583. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_8itemsize___get__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_v_self));
  3584. /* function exit code */
  3585. __Pyx_RefNannyFinishContext();
  3586. return __pyx_r;
  3587. }
  3588. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_8itemsize___get__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_self) {
  3589. PyObject *__pyx_r = NULL;
  3590. __Pyx_TraceDeclarations
  3591. __Pyx_RefNannyDeclarations
  3592. PyObject *__pyx_t_1 = NULL;
  3593. __Pyx_RefNannySetupContext("__get__", 0);
  3594. __Pyx_TraceCall("__get__", __pyx_f[0], 149, 0, __PYX_ERR(0, 149, __pyx_L1_error));
  3595. __Pyx_XDECREF(__pyx_r);
  3596. __pyx_t_1 = __Pyx_PyInt_From_unsigned_char(__pyx_v_self->itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error)
  3597. __Pyx_GOTREF(__pyx_t_1);
  3598. __pyx_r = __pyx_t_1;
  3599. __pyx_t_1 = 0;
  3600. goto __pyx_L0;
  3601. /* function exit code */
  3602. __pyx_L1_error:;
  3603. __Pyx_XDECREF(__pyx_t_1);
  3604. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.ResultSet.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3605. __pyx_r = NULL;
  3606. __pyx_L0:;
  3607. __Pyx_XGIVEREF(__pyx_r);
  3608. __Pyx_TraceReturn(__pyx_r, 0);
  3609. __Pyx_RefNannyFinishContext();
  3610. return __pyx_r;
  3611. }
  3612. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":150
  3613. * readonly unsigned char *data
  3614. * readonly unsigned char itemsize
  3615. * readonly size_t ct, size # <<<<<<<<<<<<<<
  3616. *
  3617. * def __cinit__(self, size_t ct, unsigned char itemsize):
  3618. */
  3619. /* Python wrapper */
  3620. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_2ct_1__get__(PyObject *__pyx_v_self); /*proto*/
  3621. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_2ct_1__get__(PyObject *__pyx_v_self) {
  3622. PyObject *__pyx_r = 0;
  3623. __Pyx_RefNannyDeclarations
  3624. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  3625. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_2ct___get__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_v_self));
  3626. /* function exit code */
  3627. __Pyx_RefNannyFinishContext();
  3628. return __pyx_r;
  3629. }
  3630. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_2ct___get__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_self) {
  3631. PyObject *__pyx_r = NULL;
  3632. __Pyx_TraceDeclarations
  3633. __Pyx_RefNannyDeclarations
  3634. PyObject *__pyx_t_1 = NULL;
  3635. __Pyx_RefNannySetupContext("__get__", 0);
  3636. __Pyx_TraceCall("__get__", __pyx_f[0], 150, 0, __PYX_ERR(0, 150, __pyx_L1_error));
  3637. __Pyx_XDECREF(__pyx_r);
  3638. __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->ct); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error)
  3639. __Pyx_GOTREF(__pyx_t_1);
  3640. __pyx_r = __pyx_t_1;
  3641. __pyx_t_1 = 0;
  3642. goto __pyx_L0;
  3643. /* function exit code */
  3644. __pyx_L1_error:;
  3645. __Pyx_XDECREF(__pyx_t_1);
  3646. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.ResultSet.ct.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3647. __pyx_r = NULL;
  3648. __pyx_L0:;
  3649. __Pyx_XGIVEREF(__pyx_r);
  3650. __Pyx_TraceReturn(__pyx_r, 0);
  3651. __Pyx_RefNannyFinishContext();
  3652. return __pyx_r;
  3653. }
  3654. /* Python wrapper */
  3655. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
  3656. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_4size_1__get__(PyObject *__pyx_v_self) {
  3657. PyObject *__pyx_r = 0;
  3658. __Pyx_RefNannyDeclarations
  3659. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  3660. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_4size___get__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_v_self));
  3661. /* function exit code */
  3662. __Pyx_RefNannyFinishContext();
  3663. return __pyx_r;
  3664. }
  3665. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_4size___get__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_self) {
  3666. PyObject *__pyx_r = NULL;
  3667. __Pyx_TraceDeclarations
  3668. __Pyx_RefNannyDeclarations
  3669. PyObject *__pyx_t_1 = NULL;
  3670. __Pyx_RefNannySetupContext("__get__", 0);
  3671. __Pyx_TraceCall("__get__", __pyx_f[0], 150, 0, __PYX_ERR(0, 150, __pyx_L1_error));
  3672. __Pyx_XDECREF(__pyx_r);
  3673. __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error)
  3674. __Pyx_GOTREF(__pyx_t_1);
  3675. __pyx_r = __pyx_t_1;
  3676. __pyx_t_1 = 0;
  3677. goto __pyx_L0;
  3678. /* function exit code */
  3679. __pyx_L1_error:;
  3680. __Pyx_XDECREF(__pyx_t_1);
  3681. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.ResultSet.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3682. __pyx_r = NULL;
  3683. __pyx_L0:;
  3684. __Pyx_XGIVEREF(__pyx_r);
  3685. __Pyx_TraceReturn(__pyx_r, 0);
  3686. __Pyx_RefNannyFinishContext();
  3687. return __pyx_r;
  3688. }
  3689. /* "(tree fragment)":1
  3690. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  3691. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  3692. * def __setstate_cython__(self, __pyx_state):
  3693. */
  3694. /* Python wrapper */
  3695. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  3696. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  3697. PyObject *__pyx_r = 0;
  3698. __Pyx_RefNannyDeclarations
  3699. __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  3700. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_8__reduce_cython__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_v_self));
  3701. /* function exit code */
  3702. __Pyx_RefNannyFinishContext();
  3703. return __pyx_r;
  3704. }
  3705. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_self) {
  3706. PyObject *__pyx_r = NULL;
  3707. __Pyx_TraceDeclarations
  3708. __Pyx_RefNannyDeclarations
  3709. PyObject *__pyx_t_1 = NULL;
  3710. __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  3711. __Pyx_TraceCall("__reduce_cython__", __pyx_f[1], 1, 0, __PYX_ERR(1, 1, __pyx_L1_error));
  3712. /* "(tree fragment)":2
  3713. * def __reduce_cython__(self):
  3714. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  3715. * def __setstate_cython__(self, __pyx_state):
  3716. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  3717. */
  3718. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  3719. __Pyx_GOTREF(__pyx_t_1);
  3720. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  3721. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3722. __PYX_ERR(1, 2, __pyx_L1_error)
  3723. /* "(tree fragment)":1
  3724. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  3725. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  3726. * def __setstate_cython__(self, __pyx_state):
  3727. */
  3728. /* function exit code */
  3729. __pyx_L1_error:;
  3730. __Pyx_XDECREF(__pyx_t_1);
  3731. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.ResultSet.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3732. __pyx_r = NULL;
  3733. __Pyx_XGIVEREF(__pyx_r);
  3734. __Pyx_TraceReturn(__pyx_r, 0);
  3735. __Pyx_RefNannyFinishContext();
  3736. return __pyx_r;
  3737. }
  3738. /* "(tree fragment)":3
  3739. * def __reduce_cython__(self):
  3740. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  3741. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  3742. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  3743. */
  3744. /* Python wrapper */
  3745. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
  3746. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  3747. PyObject *__pyx_r = 0;
  3748. __Pyx_RefNannyDeclarations
  3749. __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  3750. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_10__setstate_cython__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
  3751. /* function exit code */
  3752. __Pyx_RefNannyFinishContext();
  3753. return __pyx_r;
  3754. }
  3755. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  3756. PyObject *__pyx_r = NULL;
  3757. __Pyx_TraceDeclarations
  3758. __Pyx_RefNannyDeclarations
  3759. PyObject *__pyx_t_1 = NULL;
  3760. __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  3761. __Pyx_TraceCall("__setstate_cython__", __pyx_f[1], 3, 0, __PYX_ERR(1, 3, __pyx_L1_error));
  3762. /* "(tree fragment)":4
  3763. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  3764. * def __setstate_cython__(self, __pyx_state):
  3765. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  3766. */
  3767. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  3768. __Pyx_GOTREF(__pyx_t_1);
  3769. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  3770. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3771. __PYX_ERR(1, 4, __pyx_L1_error)
  3772. /* "(tree fragment)":3
  3773. * def __reduce_cython__(self):
  3774. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  3775. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  3776. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  3777. */
  3778. /* function exit code */
  3779. __pyx_L1_error:;
  3780. __Pyx_XDECREF(__pyx_t_1);
  3781. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.ResultSet.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3782. __pyx_r = NULL;
  3783. __Pyx_XGIVEREF(__pyx_r);
  3784. __Pyx_TraceReturn(__pyx_r, 0);
  3785. __Pyx_RefNannyFinishContext();
  3786. return __pyx_r;
  3787. }
  3788. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":229
  3789. *
  3790. *
  3791. * def use_data(fn): # <<<<<<<<<<<<<<
  3792. * @wraps(fn)
  3793. * def _wrapper(self, other):
  3794. */
  3795. /* Python wrapper */
  3796. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_1use_data(PyObject *__pyx_self, PyObject *__pyx_v_fn); /*proto*/
  3797. static PyMethodDef __pyx_mdef_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_1use_data = {"use_data", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_1use_data, METH_O, 0};
  3798. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_1use_data(PyObject *__pyx_self, PyObject *__pyx_v_fn) {
  3799. PyObject *__pyx_r = 0;
  3800. __Pyx_RefNannyDeclarations
  3801. __Pyx_RefNannySetupContext("use_data (wrapper)", 0);
  3802. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_use_data(__pyx_self, ((PyObject *)__pyx_v_fn));
  3803. /* function exit code */
  3804. __Pyx_RefNannyFinishContext();
  3805. return __pyx_r;
  3806. }
  3807. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":231
  3808. * def use_data(fn):
  3809. * @wraps(fn)
  3810. * def _wrapper(self, other): # <<<<<<<<<<<<<<
  3811. * if isinstance(other, SimpleGraph):
  3812. * other = other.data
  3813. */
  3814. /* Python wrapper */
  3815. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_8use_data_1_wrapper(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  3816. static PyMethodDef __pyx_mdef_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_8use_data_1_wrapper = {"_wrapper", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_8use_data_1_wrapper, METH_VARARGS|METH_KEYWORDS, 0};
  3817. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_8use_data_1_wrapper(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  3818. CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  3819. PyObject *__pyx_v_other = 0;
  3820. PyObject *__pyx_r = 0;
  3821. __Pyx_RefNannyDeclarations
  3822. __Pyx_RefNannySetupContext("_wrapper (wrapper)", 0);
  3823. {
  3824. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,0};
  3825. PyObject* values[2] = {0,0};
  3826. if (unlikely(__pyx_kwds)) {
  3827. Py_ssize_t kw_args;
  3828. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  3829. switch (pos_args) {
  3830. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  3831. CYTHON_FALLTHROUGH;
  3832. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  3833. CYTHON_FALLTHROUGH;
  3834. case 0: break;
  3835. default: goto __pyx_L5_argtuple_error;
  3836. }
  3837. kw_args = PyDict_Size(__pyx_kwds);
  3838. switch (pos_args) {
  3839. case 0:
  3840. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
  3841. else goto __pyx_L5_argtuple_error;
  3842. CYTHON_FALLTHROUGH;
  3843. case 1:
  3844. if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_other)) != 0)) kw_args--;
  3845. else {
  3846. __Pyx_RaiseArgtupleInvalid("_wrapper", 1, 2, 2, 1); __PYX_ERR(0, 231, __pyx_L3_error)
  3847. }
  3848. }
  3849. if (unlikely(kw_args > 0)) {
  3850. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_wrapper") < 0)) __PYX_ERR(0, 231, __pyx_L3_error)
  3851. }
  3852. } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
  3853. goto __pyx_L5_argtuple_error;
  3854. } else {
  3855. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  3856. values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  3857. }
  3858. __pyx_v_self = values[0];
  3859. __pyx_v_other = values[1];
  3860. }
  3861. goto __pyx_L4_argument_unpacking_done;
  3862. __pyx_L5_argtuple_error:;
  3863. __Pyx_RaiseArgtupleInvalid("_wrapper", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 231, __pyx_L3_error)
  3864. __pyx_L3_error:;
  3865. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.use_data._wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3866. __Pyx_RefNannyFinishContext();
  3867. return NULL;
  3868. __pyx_L4_argument_unpacking_done:;
  3869. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_8use_data__wrapper(__pyx_self, __pyx_v_self, __pyx_v_other);
  3870. /* function exit code */
  3871. __Pyx_RefNannyFinishContext();
  3872. return __pyx_r;
  3873. }
  3874. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_8use_data__wrapper(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  3875. PyObject *__pyx_r = NULL;
  3876. __Pyx_TraceDeclarations
  3877. __Pyx_RefNannyDeclarations
  3878. int __pyx_t_1;
  3879. int __pyx_t_2;
  3880. PyObject *__pyx_t_3 = NULL;
  3881. __Pyx_RefNannySetupContext("_wrapper", 0);
  3882. __Pyx_TraceCall("_wrapper", __pyx_f[0], 231, 0, __PYX_ERR(0, 231, __pyx_L1_error));
  3883. __Pyx_INCREF(__pyx_v_other);
  3884. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":232
  3885. * @wraps(fn)
  3886. * def _wrapper(self, other):
  3887. * if isinstance(other, SimpleGraph): # <<<<<<<<<<<<<<
  3888. * other = other.data
  3889. * return _wrapper
  3890. */
  3891. __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, __pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph);
  3892. __pyx_t_2 = (__pyx_t_1 != 0);
  3893. if (__pyx_t_2) {
  3894. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":233
  3895. * def _wrapper(self, other):
  3896. * if isinstance(other, SimpleGraph):
  3897. * other = other.data # <<<<<<<<<<<<<<
  3898. * return _wrapper
  3899. *
  3900. */
  3901. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 233, __pyx_L1_error)
  3902. __Pyx_GOTREF(__pyx_t_3);
  3903. __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_3);
  3904. __pyx_t_3 = 0;
  3905. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":232
  3906. * @wraps(fn)
  3907. * def _wrapper(self, other):
  3908. * if isinstance(other, SimpleGraph): # <<<<<<<<<<<<<<
  3909. * other = other.data
  3910. * return _wrapper
  3911. */
  3912. }
  3913. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":231
  3914. * def use_data(fn):
  3915. * @wraps(fn)
  3916. * def _wrapper(self, other): # <<<<<<<<<<<<<<
  3917. * if isinstance(other, SimpleGraph):
  3918. * other = other.data
  3919. */
  3920. /* function exit code */
  3921. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  3922. goto __pyx_L0;
  3923. __pyx_L1_error:;
  3924. __Pyx_XDECREF(__pyx_t_3);
  3925. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.use_data._wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3926. __pyx_r = NULL;
  3927. __pyx_L0:;
  3928. __Pyx_XDECREF(__pyx_v_other);
  3929. __Pyx_XGIVEREF(__pyx_r);
  3930. __Pyx_TraceReturn(__pyx_r, 0);
  3931. __Pyx_RefNannyFinishContext();
  3932. return __pyx_r;
  3933. }
  3934. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":229
  3935. *
  3936. *
  3937. * def use_data(fn): # <<<<<<<<<<<<<<
  3938. * @wraps(fn)
  3939. * def _wrapper(self, other):
  3940. */
  3941. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_use_data(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fn) {
  3942. PyObject *__pyx_v__wrapper = 0;
  3943. PyObject *__pyx_r = NULL;
  3944. __Pyx_TraceDeclarations
  3945. __Pyx_RefNannyDeclarations
  3946. PyObject *__pyx_t_1 = NULL;
  3947. PyObject *__pyx_t_2 = NULL;
  3948. PyObject *__pyx_t_3 = NULL;
  3949. PyObject *__pyx_t_4 = NULL;
  3950. PyObject *__pyx_t_5 = NULL;
  3951. __Pyx_TraceFrameInit(__pyx_codeobj__3)
  3952. __Pyx_RefNannySetupContext("use_data", 0);
  3953. __Pyx_TraceCall("use_data", __pyx_f[0], 229, 0, __PYX_ERR(0, 229, __pyx_L1_error));
  3954. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":230
  3955. *
  3956. * def use_data(fn):
  3957. * @wraps(fn) # <<<<<<<<<<<<<<
  3958. * def _wrapper(self, other):
  3959. * if isinstance(other, SimpleGraph):
  3960. */
  3961. __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_wraps); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 230, __pyx_L1_error)
  3962. __Pyx_GOTREF(__pyx_t_3);
  3963. __pyx_t_4 = NULL;
  3964. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  3965. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
  3966. if (likely(__pyx_t_4)) {
  3967. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  3968. __Pyx_INCREF(__pyx_t_4);
  3969. __Pyx_INCREF(function);
  3970. __Pyx_DECREF_SET(__pyx_t_3, function);
  3971. }
  3972. }
  3973. if (!__pyx_t_4) {
  3974. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_fn); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 230, __pyx_L1_error)
  3975. __Pyx_GOTREF(__pyx_t_2);
  3976. } else {
  3977. #if CYTHON_FAST_PYCALL
  3978. if (PyFunction_Check(__pyx_t_3)) {
  3979. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_fn};
  3980. __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 230, __pyx_L1_error)
  3981. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  3982. __Pyx_GOTREF(__pyx_t_2);
  3983. } else
  3984. #endif
  3985. #if CYTHON_FAST_PYCCALL
  3986. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  3987. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_fn};
  3988. __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 230, __pyx_L1_error)
  3989. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  3990. __Pyx_GOTREF(__pyx_t_2);
  3991. } else
  3992. #endif
  3993. {
  3994. __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 230, __pyx_L1_error)
  3995. __Pyx_GOTREF(__pyx_t_5);
  3996. __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
  3997. __Pyx_INCREF(__pyx_v_fn);
  3998. __Pyx_GIVEREF(__pyx_v_fn);
  3999. PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_fn);
  4000. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 230, __pyx_L1_error)
  4001. __Pyx_GOTREF(__pyx_t_2);
  4002. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4003. }
  4004. }
  4005. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4006. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":231
  4007. * def use_data(fn):
  4008. * @wraps(fn)
  4009. * def _wrapper(self, other): # <<<<<<<<<<<<<<
  4010. * if isinstance(other, SimpleGraph):
  4011. * other = other.data
  4012. */
  4013. __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_8use_data_1_wrapper, 0, __pyx_n_s_use_data_locals__wrapper, NULL, __pyx_n_s_lakesuperior_store_ldp_rs_lmdb_t, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 231, __pyx_L1_error)
  4014. __Pyx_GOTREF(__pyx_t_3);
  4015. __pyx_t_5 = NULL;
  4016. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
  4017. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
  4018. if (likely(__pyx_t_5)) {
  4019. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  4020. __Pyx_INCREF(__pyx_t_5);
  4021. __Pyx_INCREF(function);
  4022. __Pyx_DECREF_SET(__pyx_t_2, function);
  4023. }
  4024. }
  4025. if (!__pyx_t_5) {
  4026. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error)
  4027. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4028. __Pyx_GOTREF(__pyx_t_1);
  4029. } else {
  4030. #if CYTHON_FAST_PYCALL
  4031. if (PyFunction_Check(__pyx_t_2)) {
  4032. PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_3};
  4033. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error)
  4034. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  4035. __Pyx_GOTREF(__pyx_t_1);
  4036. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4037. } else
  4038. #endif
  4039. #if CYTHON_FAST_PYCCALL
  4040. if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
  4041. PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_3};
  4042. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error)
  4043. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  4044. __Pyx_GOTREF(__pyx_t_1);
  4045. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4046. } else
  4047. #endif
  4048. {
  4049. __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 230, __pyx_L1_error)
  4050. __Pyx_GOTREF(__pyx_t_4);
  4051. __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
  4052. __Pyx_GIVEREF(__pyx_t_3);
  4053. PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_3);
  4054. __pyx_t_3 = 0;
  4055. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error)
  4056. __Pyx_GOTREF(__pyx_t_1);
  4057. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4058. }
  4059. }
  4060. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4061. __pyx_v__wrapper = __pyx_t_1;
  4062. __pyx_t_1 = 0;
  4063. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":234
  4064. * if isinstance(other, SimpleGraph):
  4065. * other = other.data
  4066. * return _wrapper # <<<<<<<<<<<<<<
  4067. *
  4068. *
  4069. */
  4070. __Pyx_XDECREF(__pyx_r);
  4071. __Pyx_INCREF(__pyx_v__wrapper);
  4072. __pyx_r = __pyx_v__wrapper;
  4073. goto __pyx_L0;
  4074. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":229
  4075. *
  4076. *
  4077. * def use_data(fn): # <<<<<<<<<<<<<<
  4078. * @wraps(fn)
  4079. * def _wrapper(self, other):
  4080. */
  4081. /* function exit code */
  4082. __pyx_L1_error:;
  4083. __Pyx_XDECREF(__pyx_t_1);
  4084. __Pyx_XDECREF(__pyx_t_2);
  4085. __Pyx_XDECREF(__pyx_t_3);
  4086. __Pyx_XDECREF(__pyx_t_4);
  4087. __Pyx_XDECREF(__pyx_t_5);
  4088. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.use_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4089. __pyx_r = NULL;
  4090. __pyx_L0:;
  4091. __Pyx_XDECREF(__pyx_v__wrapper);
  4092. __Pyx_XGIVEREF(__pyx_r);
  4093. __Pyx_TraceReturn(__pyx_r, 0);
  4094. __Pyx_RefNannyFinishContext();
  4095. return __pyx_r;
  4096. }
  4097. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":248
  4098. * readonly set data
  4099. *
  4100. * def __init__( # <<<<<<<<<<<<<<
  4101. * self, set data=set(), tuple lookup=(), store=None):
  4102. * """
  4103. */
  4104. /* Python wrapper */
  4105. static int __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  4106. static char __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph___init__[] = "\n Initialize the graph with pre-existing data or by looking up a store.\n\n Either ``data``, or both ``lookup`` and ``store``, can be provided.\n ``lookup`` and ``store`` have precedence. If none of them is specified,\n an empty graph is initialized.\n\n :param rdflib.URIRef uri: The graph URI.\n This will serve as the subject for some queries.\n :param set data: Initial data as a set of 3-tuples of RDFLib terms.\n :param tuple lookup: tuple of a 3-tuple of lookup terms, and a context.\n E.g. ``((URIRef('urn:ns:a'), None, None), URIRef('urn:ns:ctx'))``.\n Any and all elements may be ``None``.\n :param lmdbStore store: the store to look data up.\n ";
  4107. #if CYTHON_COMPILING_IN_CPYTHON
  4108. struct wrapperbase __pyx_wrapperbase_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph___init__;
  4109. #endif
  4110. static int __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  4111. PyObject *__pyx_v_data = 0;
  4112. PyObject *__pyx_v_lookup = 0;
  4113. PyObject *__pyx_v_store = 0;
  4114. int __pyx_r;
  4115. __Pyx_RefNannyDeclarations
  4116. __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  4117. {
  4118. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,&__pyx_n_s_lookup,&__pyx_n_s_store,0};
  4119. PyObject* values[3] = {0,0,0};
  4120. values[0] = __pyx_k__6;
  4121. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":249
  4122. *
  4123. * def __init__(
  4124. * self, set data=set(), tuple lookup=(), store=None): # <<<<<<<<<<<<<<
  4125. * """
  4126. * Initialize the graph with pre-existing data or by looking up a store.
  4127. */
  4128. values[1] = ((PyObject*)__pyx_empty_tuple);
  4129. values[2] = ((PyObject *)Py_None);
  4130. if (unlikely(__pyx_kwds)) {
  4131. Py_ssize_t kw_args;
  4132. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  4133. switch (pos_args) {
  4134. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  4135. CYTHON_FALLTHROUGH;
  4136. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  4137. CYTHON_FALLTHROUGH;
  4138. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  4139. CYTHON_FALLTHROUGH;
  4140. case 0: break;
  4141. default: goto __pyx_L5_argtuple_error;
  4142. }
  4143. kw_args = PyDict_Size(__pyx_kwds);
  4144. switch (pos_args) {
  4145. case 0:
  4146. if (kw_args > 0) {
  4147. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data);
  4148. if (value) { values[0] = value; kw_args--; }
  4149. }
  4150. CYTHON_FALLTHROUGH;
  4151. case 1:
  4152. if (kw_args > 0) {
  4153. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lookup);
  4154. if (value) { values[1] = value; kw_args--; }
  4155. }
  4156. CYTHON_FALLTHROUGH;
  4157. case 2:
  4158. if (kw_args > 0) {
  4159. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_store);
  4160. if (value) { values[2] = value; kw_args--; }
  4161. }
  4162. }
  4163. if (unlikely(kw_args > 0)) {
  4164. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 248, __pyx_L3_error)
  4165. }
  4166. } else {
  4167. switch (PyTuple_GET_SIZE(__pyx_args)) {
  4168. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  4169. CYTHON_FALLTHROUGH;
  4170. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  4171. CYTHON_FALLTHROUGH;
  4172. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  4173. CYTHON_FALLTHROUGH;
  4174. case 0: break;
  4175. default: goto __pyx_L5_argtuple_error;
  4176. }
  4177. }
  4178. __pyx_v_data = ((PyObject*)values[0]);
  4179. __pyx_v_lookup = ((PyObject*)values[1]);
  4180. __pyx_v_store = values[2];
  4181. }
  4182. goto __pyx_L4_argument_unpacking_done;
  4183. __pyx_L5_argtuple_error:;
  4184. __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 248, __pyx_L3_error)
  4185. __pyx_L3_error:;
  4186. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4187. __Pyx_RefNannyFinishContext();
  4188. return -1;
  4189. __pyx_L4_argument_unpacking_done:;
  4190. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PySet_Type), 1, "data", 1))) __PYX_ERR(0, 249, __pyx_L1_error)
  4191. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lookup), (&PyTuple_Type), 1, "lookup", 1))) __PYX_ERR(0, 249, __pyx_L1_error)
  4192. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph___init__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self), __pyx_v_data, __pyx_v_lookup, __pyx_v_store);
  4193. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":248
  4194. * readonly set data
  4195. *
  4196. * def __init__( # <<<<<<<<<<<<<<
  4197. * self, set data=set(), tuple lookup=(), store=None):
  4198. * """
  4199. */
  4200. /* function exit code */
  4201. goto __pyx_L0;
  4202. __pyx_L1_error:;
  4203. __pyx_r = -1;
  4204. __pyx_L0:;
  4205. __Pyx_RefNannyFinishContext();
  4206. return __pyx_r;
  4207. }
  4208. static int __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph___init__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_lookup, PyObject *__pyx_v_store) {
  4209. int __pyx_r;
  4210. __Pyx_TraceDeclarations
  4211. __Pyx_RefNannyDeclarations
  4212. int __pyx_t_1;
  4213. PyObject *__pyx_t_2 = NULL;
  4214. int __pyx_t_3;
  4215. __Pyx_RefNannySetupContext("__init__", 0);
  4216. __Pyx_TraceCall("__init__", __pyx_f[0], 248, 0, __PYX_ERR(0, 248, __pyx_L1_error));
  4217. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":265
  4218. * :param lmdbStore store: the store to look data up.
  4219. * """
  4220. * if data: # <<<<<<<<<<<<<<
  4221. * self.data = set(data)
  4222. * else:
  4223. */
  4224. __pyx_t_1 = (__pyx_v_data != Py_None)&&(PySet_GET_SIZE(__pyx_v_data) != 0);
  4225. if (__pyx_t_1) {
  4226. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":266
  4227. * """
  4228. * if data:
  4229. * self.data = set(data) # <<<<<<<<<<<<<<
  4230. * else:
  4231. * if not lookup:
  4232. */
  4233. __pyx_t_2 = PySet_New(__pyx_v_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 266, __pyx_L1_error)
  4234. __Pyx_GOTREF(__pyx_t_2);
  4235. __Pyx_GIVEREF(__pyx_t_2);
  4236. __Pyx_GOTREF(__pyx_v_self->data);
  4237. __Pyx_DECREF(__pyx_v_self->data);
  4238. __pyx_v_self->data = ((PyObject*)__pyx_t_2);
  4239. __pyx_t_2 = 0;
  4240. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":265
  4241. * :param lmdbStore store: the store to look data up.
  4242. * """
  4243. * if data: # <<<<<<<<<<<<<<
  4244. * self.data = set(data)
  4245. * else:
  4246. */
  4247. goto __pyx_L3;
  4248. }
  4249. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":268
  4250. * self.data = set(data)
  4251. * else:
  4252. * if not lookup: # <<<<<<<<<<<<<<
  4253. * self.data = set()
  4254. * else:
  4255. */
  4256. /*else*/ {
  4257. __pyx_t_1 = (__pyx_v_lookup != Py_None)&&(PyTuple_GET_SIZE(__pyx_v_lookup) != 0);
  4258. __pyx_t_3 = ((!__pyx_t_1) != 0);
  4259. if (__pyx_t_3) {
  4260. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":269
  4261. * else:
  4262. * if not lookup:
  4263. * self.data = set() # <<<<<<<<<<<<<<
  4264. * else:
  4265. * if store is None:
  4266. */
  4267. __pyx_t_2 = PySet_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 269, __pyx_L1_error)
  4268. __Pyx_GOTREF(__pyx_t_2);
  4269. __Pyx_GIVEREF(__pyx_t_2);
  4270. __Pyx_GOTREF(__pyx_v_self->data);
  4271. __Pyx_DECREF(__pyx_v_self->data);
  4272. __pyx_v_self->data = ((PyObject*)__pyx_t_2);
  4273. __pyx_t_2 = 0;
  4274. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":268
  4275. * self.data = set(data)
  4276. * else:
  4277. * if not lookup: # <<<<<<<<<<<<<<
  4278. * self.data = set()
  4279. * else:
  4280. */
  4281. goto __pyx_L4;
  4282. }
  4283. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":271
  4284. * self.data = set()
  4285. * else:
  4286. * if store is None: # <<<<<<<<<<<<<<
  4287. * raise ValueError('Store not specified for triple lookup.')
  4288. * self._data_from_lookup(lookup, store)
  4289. */
  4290. /*else*/ {
  4291. __pyx_t_3 = (__pyx_v_store == Py_None);
  4292. __pyx_t_1 = (__pyx_t_3 != 0);
  4293. if (unlikely(__pyx_t_1)) {
  4294. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":272
  4295. * else:
  4296. * if store is None:
  4297. * raise ValueError('Store not specified for triple lookup.') # <<<<<<<<<<<<<<
  4298. * self._data_from_lookup(lookup, store)
  4299. *
  4300. */
  4301. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 272, __pyx_L1_error)
  4302. __Pyx_GOTREF(__pyx_t_2);
  4303. __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  4304. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4305. __PYX_ERR(0, 272, __pyx_L1_error)
  4306. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":271
  4307. * self.data = set()
  4308. * else:
  4309. * if store is None: # <<<<<<<<<<<<<<
  4310. * raise ValueError('Store not specified for triple lookup.')
  4311. * self._data_from_lookup(lookup, store)
  4312. */
  4313. }
  4314. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":273
  4315. * if store is None:
  4316. * raise ValueError('Store not specified for triple lookup.')
  4317. * self._data_from_lookup(lookup, store) # <<<<<<<<<<<<<<
  4318. *
  4319. *
  4320. */
  4321. if (!(likely(((__pyx_v_store) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_store, __pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore))))) __PYX_ERR(0, 273, __pyx_L1_error)
  4322. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self->__pyx_vtab)->_data_from_lookup(__pyx_v_self, __pyx_v_lookup, ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_store)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 273, __pyx_L1_error)
  4323. }
  4324. __pyx_L4:;
  4325. }
  4326. __pyx_L3:;
  4327. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":248
  4328. * readonly set data
  4329. *
  4330. * def __init__( # <<<<<<<<<<<<<<
  4331. * self, set data=set(), tuple lookup=(), store=None):
  4332. * """
  4333. */
  4334. /* function exit code */
  4335. __pyx_r = 0;
  4336. goto __pyx_L0;
  4337. __pyx_L1_error:;
  4338. __Pyx_XDECREF(__pyx_t_2);
  4339. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4340. __pyx_r = -1;
  4341. __pyx_L0:;
  4342. __Pyx_TraceReturn(Py_None, 0);
  4343. __Pyx_RefNannyFinishContext();
  4344. return __pyx_r;
  4345. }
  4346. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":276
  4347. *
  4348. *
  4349. * cdef void _data_from_lookup( # <<<<<<<<<<<<<<
  4350. * self, tuple lookup, LmdbTriplestore store) except *:
  4351. * cdef:
  4352. */
  4353. static void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph__data_from_lookup(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_lookup, struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_store) {
  4354. size_t __pyx_v_i;
  4355. unsigned char __pyx_v_spok[15];
  4356. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_keyset = NULL;
  4357. __Pyx_TraceDeclarations
  4358. __Pyx_RefNannyDeclarations
  4359. PyObject *__pyx_t_1 = NULL;
  4360. PyObject *__pyx_t_2 = NULL;
  4361. size_t __pyx_t_3;
  4362. size_t __pyx_t_4;
  4363. size_t __pyx_t_5;
  4364. unsigned char *__pyx_t_6;
  4365. int __pyx_t_7;
  4366. __Pyx_RefNannySetupContext("_data_from_lookup", 0);
  4367. __Pyx_TraceCall("_data_from_lookup", __pyx_f[0], 276, 0, __PYX_ERR(0, 276, __pyx_L1_error));
  4368. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":282
  4369. * unsigned char spok[TRP_KLEN]
  4370. *
  4371. * self.data = set() # <<<<<<<<<<<<<<
  4372. * keyset = store.triple_keys(*lookup)
  4373. *
  4374. */
  4375. __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 282, __pyx_L1_error)
  4376. __Pyx_GOTREF(__pyx_t_1);
  4377. __Pyx_GIVEREF(__pyx_t_1);
  4378. __Pyx_GOTREF(__pyx_v_self->data);
  4379. __Pyx_DECREF(__pyx_v_self->data);
  4380. __pyx_v_self->data = ((PyObject*)__pyx_t_1);
  4381. __pyx_t_1 = 0;
  4382. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":283
  4383. *
  4384. * self.data = set()
  4385. * keyset = store.triple_keys(*lookup) # <<<<<<<<<<<<<<
  4386. *
  4387. * for i in range(keyset.ct):
  4388. */
  4389. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_store), __pyx_n_s_triple_keys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __pyx_L1_error)
  4390. __Pyx_GOTREF(__pyx_t_1);
  4391. if (unlikely(__pyx_v_lookup == Py_None)) {
  4392. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  4393. __PYX_ERR(0, 283, __pyx_L1_error)
  4394. }
  4395. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_v_lookup, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 283, __pyx_L1_error)
  4396. __Pyx_GOTREF(__pyx_t_2);
  4397. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4398. if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet))))) __PYX_ERR(0, 283, __pyx_L1_error)
  4399. __pyx_v_keyset = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_2);
  4400. __pyx_t_2 = 0;
  4401. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":285
  4402. * keyset = store.triple_keys(*lookup)
  4403. *
  4404. * for i in range(keyset.ct): # <<<<<<<<<<<<<<
  4405. * spok = keyset.data + i * TRP_KLEN
  4406. * self.data.add(store.from_trp_key(spok[: TRP_KLEN]))
  4407. */
  4408. __pyx_t_3 = __pyx_v_keyset->ct;
  4409. __pyx_t_4 = __pyx_t_3;
  4410. for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
  4411. __pyx_v_i = __pyx_t_5;
  4412. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":286
  4413. *
  4414. * for i in range(keyset.ct):
  4415. * spok = keyset.data + i * TRP_KLEN # <<<<<<<<<<<<<<
  4416. * self.data.add(store.from_trp_key(spok[: TRP_KLEN]))
  4417. *
  4418. */
  4419. memcpy(&(__pyx_v_spok[0]), (__pyx_v_keyset->data + (__pyx_v_i * 15)), sizeof(__pyx_v_spok[0]) * (15 - 0));
  4420. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":287
  4421. * for i in range(keyset.ct):
  4422. * spok = keyset.data + i * TRP_KLEN
  4423. * self.data.add(store.from_trp_key(spok[: TRP_KLEN])) # <<<<<<<<<<<<<<
  4424. *
  4425. * # Basic set operations.
  4426. */
  4427. if (unlikely(__pyx_v_self->data == Py_None)) {
  4428. PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "add");
  4429. __PYX_ERR(0, 287, __pyx_L1_error)
  4430. }
  4431. __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_spok) + 0, 15 - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 287, __pyx_L1_error)
  4432. __Pyx_GOTREF(__pyx_t_2);
  4433. __pyx_t_6 = __Pyx_PyBytes_AsWritableUString(__pyx_t_2); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 287, __pyx_L1_error)
  4434. __pyx_t_1 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_store->__pyx_base.__pyx_vtab)->from_trp_key(__pyx_v_store, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error)
  4435. __Pyx_GOTREF(__pyx_t_1);
  4436. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4437. __pyx_t_7 = PySet_Add(__pyx_v_self->data, __pyx_t_1); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 287, __pyx_L1_error)
  4438. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4439. }
  4440. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":276
  4441. *
  4442. *
  4443. * cdef void _data_from_lookup( # <<<<<<<<<<<<<<
  4444. * self, tuple lookup, LmdbTriplestore store) except *:
  4445. * cdef:
  4446. */
  4447. /* function exit code */
  4448. goto __pyx_L0;
  4449. __pyx_L1_error:;
  4450. __Pyx_XDECREF(__pyx_t_1);
  4451. __Pyx_XDECREF(__pyx_t_2);
  4452. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph._data_from_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4453. __pyx_L0:;
  4454. __Pyx_XDECREF((PyObject *)__pyx_v_keyset);
  4455. __Pyx_TraceReturn(Py_None, 0);
  4456. __Pyx_RefNannyFinishContext();
  4457. }
  4458. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":291
  4459. * # Basic set operations.
  4460. *
  4461. * def add(self, dataset): # <<<<<<<<<<<<<<
  4462. * self.data.add(dataset)
  4463. *
  4464. */
  4465. /* Python wrapper */
  4466. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_3add(PyObject *__pyx_v_self, PyObject *__pyx_v_dataset); /*proto*/
  4467. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_3add(PyObject *__pyx_v_self, PyObject *__pyx_v_dataset) {
  4468. PyObject *__pyx_r = 0;
  4469. __Pyx_RefNannyDeclarations
  4470. __Pyx_RefNannySetupContext("add (wrapper)", 0);
  4471. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_2add(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self), ((PyObject *)__pyx_v_dataset));
  4472. /* function exit code */
  4473. __Pyx_RefNannyFinishContext();
  4474. return __pyx_r;
  4475. }
  4476. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_2add(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_dataset) {
  4477. PyObject *__pyx_r = NULL;
  4478. __Pyx_TraceDeclarations
  4479. __Pyx_RefNannyDeclarations
  4480. int __pyx_t_1;
  4481. __Pyx_RefNannySetupContext("add", 0);
  4482. __Pyx_TraceCall("add", __pyx_f[0], 291, 0, __PYX_ERR(0, 291, __pyx_L1_error));
  4483. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":292
  4484. *
  4485. * def add(self, dataset):
  4486. * self.data.add(dataset) # <<<<<<<<<<<<<<
  4487. *
  4488. * def remove(self, item):
  4489. */
  4490. if (unlikely(__pyx_v_self->data == Py_None)) {
  4491. PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "add");
  4492. __PYX_ERR(0, 292, __pyx_L1_error)
  4493. }
  4494. __pyx_t_1 = PySet_Add(__pyx_v_self->data, __pyx_v_dataset); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 292, __pyx_L1_error)
  4495. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":291
  4496. * # Basic set operations.
  4497. *
  4498. * def add(self, dataset): # <<<<<<<<<<<<<<
  4499. * self.data.add(dataset)
  4500. *
  4501. */
  4502. /* function exit code */
  4503. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  4504. goto __pyx_L0;
  4505. __pyx_L1_error:;
  4506. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4507. __pyx_r = NULL;
  4508. __pyx_L0:;
  4509. __Pyx_XGIVEREF(__pyx_r);
  4510. __Pyx_TraceReturn(__pyx_r, 0);
  4511. __Pyx_RefNannyFinishContext();
  4512. return __pyx_r;
  4513. }
  4514. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":294
  4515. * self.data.add(dataset)
  4516. *
  4517. * def remove(self, item): # <<<<<<<<<<<<<<
  4518. * self.data.remove(item)
  4519. *
  4520. */
  4521. /* Python wrapper */
  4522. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_5remove(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
  4523. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_5remove(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
  4524. PyObject *__pyx_r = 0;
  4525. __Pyx_RefNannyDeclarations
  4526. __Pyx_RefNannySetupContext("remove (wrapper)", 0);
  4527. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_4remove(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self), ((PyObject *)__pyx_v_item));
  4528. /* function exit code */
  4529. __Pyx_RefNannyFinishContext();
  4530. return __pyx_r;
  4531. }
  4532. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_4remove(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_item) {
  4533. PyObject *__pyx_r = NULL;
  4534. __Pyx_TraceDeclarations
  4535. __Pyx_RefNannyDeclarations
  4536. int __pyx_t_1;
  4537. __Pyx_RefNannySetupContext("remove", 0);
  4538. __Pyx_TraceCall("remove", __pyx_f[0], 294, 0, __PYX_ERR(0, 294, __pyx_L1_error));
  4539. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":295
  4540. *
  4541. * def remove(self, item):
  4542. * self.data.remove(item) # <<<<<<<<<<<<<<
  4543. *
  4544. * def __len__(self):
  4545. */
  4546. if (unlikely(__pyx_v_self->data == Py_None)) {
  4547. PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "remove");
  4548. __PYX_ERR(0, 295, __pyx_L1_error)
  4549. }
  4550. __pyx_t_1 = __Pyx_PySet_Remove(__pyx_v_self->data, __pyx_v_item); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 295, __pyx_L1_error)
  4551. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":294
  4552. * self.data.add(dataset)
  4553. *
  4554. * def remove(self, item): # <<<<<<<<<<<<<<
  4555. * self.data.remove(item)
  4556. *
  4557. */
  4558. /* function exit code */
  4559. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  4560. goto __pyx_L0;
  4561. __pyx_L1_error:;
  4562. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4563. __pyx_r = NULL;
  4564. __pyx_L0:;
  4565. __Pyx_XGIVEREF(__pyx_r);
  4566. __Pyx_TraceReturn(__pyx_r, 0);
  4567. __Pyx_RefNannyFinishContext();
  4568. return __pyx_r;
  4569. }
  4570. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":297
  4571. * self.data.remove(item)
  4572. *
  4573. * def __len__(self): # <<<<<<<<<<<<<<
  4574. * return len(self.data)
  4575. *
  4576. */
  4577. /* Python wrapper */
  4578. static Py_ssize_t __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_7__len__(PyObject *__pyx_v_self); /*proto*/
  4579. static Py_ssize_t __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_7__len__(PyObject *__pyx_v_self) {
  4580. Py_ssize_t __pyx_r;
  4581. __Pyx_RefNannyDeclarations
  4582. __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  4583. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_6__len__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self));
  4584. /* function exit code */
  4585. __Pyx_RefNannyFinishContext();
  4586. return __pyx_r;
  4587. }
  4588. static Py_ssize_t __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_6__len__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self) {
  4589. Py_ssize_t __pyx_r;
  4590. __Pyx_TraceDeclarations
  4591. __Pyx_RefNannyDeclarations
  4592. PyObject *__pyx_t_1 = NULL;
  4593. Py_ssize_t __pyx_t_2;
  4594. __Pyx_RefNannySetupContext("__len__", 0);
  4595. __Pyx_TraceCall("__len__", __pyx_f[0], 297, 0, __PYX_ERR(0, 297, __pyx_L1_error));
  4596. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":298
  4597. *
  4598. * def __len__(self):
  4599. * return len(self.data) # <<<<<<<<<<<<<<
  4600. *
  4601. * @use_data
  4602. */
  4603. __pyx_t_1 = __pyx_v_self->data;
  4604. __Pyx_INCREF(__pyx_t_1);
  4605. if (unlikely(__pyx_t_1 == Py_None)) {
  4606. PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
  4607. __PYX_ERR(0, 298, __pyx_L1_error)
  4608. }
  4609. __pyx_t_2 = PySet_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 298, __pyx_L1_error)
  4610. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4611. __pyx_r = __pyx_t_2;
  4612. goto __pyx_L0;
  4613. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":297
  4614. * self.data.remove(item)
  4615. *
  4616. * def __len__(self): # <<<<<<<<<<<<<<
  4617. * return len(self.data)
  4618. *
  4619. */
  4620. /* function exit code */
  4621. __pyx_L1_error:;
  4622. __Pyx_XDECREF(__pyx_t_1);
  4623. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4624. __pyx_r = -1;
  4625. __pyx_L0:;
  4626. __Pyx_TraceReturn(Py_None, 0);
  4627. __Pyx_RefNannyFinishContext();
  4628. return __pyx_r;
  4629. }
  4630. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":301
  4631. *
  4632. * @use_data
  4633. * def __eq__(self, other): # <<<<<<<<<<<<<<
  4634. * return self.data == other
  4635. *
  4636. */
  4637. /* Python wrapper */
  4638. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_9__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
  4639. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_9__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  4640. PyObject *__pyx_r = 0;
  4641. __Pyx_RefNannyDeclarations
  4642. __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0);
  4643. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_8__eq__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self), ((PyObject *)__pyx_v_other));
  4644. /* function exit code */
  4645. __Pyx_RefNannyFinishContext();
  4646. return __pyx_r;
  4647. }
  4648. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_8__eq__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_other) {
  4649. PyObject *__pyx_r = NULL;
  4650. __Pyx_TraceDeclarations
  4651. __Pyx_RefNannyDeclarations
  4652. PyObject *__pyx_t_1 = NULL;
  4653. __Pyx_RefNannySetupContext("__eq__", 0);
  4654. __Pyx_TraceCall("__eq__", __pyx_f[0], 301, 0, __PYX_ERR(0, 301, __pyx_L1_error));
  4655. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":302
  4656. * @use_data
  4657. * def __eq__(self, other):
  4658. * return self.data == other # <<<<<<<<<<<<<<
  4659. *
  4660. * def __repr__(self):
  4661. */
  4662. __Pyx_XDECREF(__pyx_r);
  4663. __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->data, __pyx_v_other, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error)
  4664. __pyx_r = __pyx_t_1;
  4665. __pyx_t_1 = 0;
  4666. goto __pyx_L0;
  4667. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":301
  4668. *
  4669. * @use_data
  4670. * def __eq__(self, other): # <<<<<<<<<<<<<<
  4671. * return self.data == other
  4672. *
  4673. */
  4674. /* function exit code */
  4675. __pyx_L1_error:;
  4676. __Pyx_XDECREF(__pyx_t_1);
  4677. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4678. __pyx_r = NULL;
  4679. __pyx_L0:;
  4680. __Pyx_XGIVEREF(__pyx_r);
  4681. __Pyx_TraceReturn(__pyx_r, 0);
  4682. __Pyx_RefNannyFinishContext();
  4683. return __pyx_r;
  4684. }
  4685. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":304
  4686. * return self.data == other
  4687. *
  4688. * def __repr__(self): # <<<<<<<<<<<<<<
  4689. * return (f'<{self.__class__.__name__} @{hex(id(self))} '
  4690. * f'length={len(self.data)}>')
  4691. */
  4692. /* Python wrapper */
  4693. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_11__repr__(PyObject *__pyx_v_self); /*proto*/
  4694. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_11__repr__(PyObject *__pyx_v_self) {
  4695. PyObject *__pyx_r = 0;
  4696. __Pyx_RefNannyDeclarations
  4697. __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  4698. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_10__repr__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self));
  4699. /* function exit code */
  4700. __Pyx_RefNannyFinishContext();
  4701. return __pyx_r;
  4702. }
  4703. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_10__repr__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self) {
  4704. PyObject *__pyx_r = NULL;
  4705. __Pyx_TraceDeclarations
  4706. __Pyx_RefNannyDeclarations
  4707. PyObject *__pyx_t_1 = NULL;
  4708. Py_ssize_t __pyx_t_2;
  4709. Py_UCS4 __pyx_t_3;
  4710. PyObject *__pyx_t_4 = NULL;
  4711. PyObject *__pyx_t_5 = NULL;
  4712. Py_ssize_t __pyx_t_6;
  4713. __Pyx_RefNannySetupContext("__repr__", 0);
  4714. __Pyx_TraceCall("__repr__", __pyx_f[0], 304, 0, __PYX_ERR(0, 304, __pyx_L1_error));
  4715. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":305
  4716. *
  4717. * def __repr__(self):
  4718. * return (f'<{self.__class__.__name__} @{hex(id(self))} ' # <<<<<<<<<<<<<<
  4719. * f'length={len(self.data)}>')
  4720. *
  4721. */
  4722. __Pyx_XDECREF(__pyx_r);
  4723. __pyx_t_1 = PyTuple_New(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 305, __pyx_L1_error)
  4724. __Pyx_GOTREF(__pyx_t_1);
  4725. __pyx_t_2 = 0;
  4726. __pyx_t_3 = 127;
  4727. __Pyx_INCREF(__pyx_kp_u__8);
  4728. __pyx_t_2 += 1;
  4729. __Pyx_GIVEREF(__pyx_kp_u__8);
  4730. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u__8);
  4731. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 305, __pyx_L1_error)
  4732. __Pyx_GOTREF(__pyx_t_4);
  4733. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 305, __pyx_L1_error)
  4734. __Pyx_GOTREF(__pyx_t_5);
  4735. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4736. __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 305, __pyx_L1_error)
  4737. __Pyx_GOTREF(__pyx_t_4);
  4738. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4739. __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  4740. __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  4741. __Pyx_GIVEREF(__pyx_t_4);
  4742. PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
  4743. __pyx_t_4 = 0;
  4744. __Pyx_INCREF(__pyx_kp_u__9);
  4745. __pyx_t_2 += 2;
  4746. __Pyx_GIVEREF(__pyx_kp_u__9);
  4747. PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__9);
  4748. __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 305, __pyx_L1_error)
  4749. __Pyx_GOTREF(__pyx_t_4);
  4750. __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_hex, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 305, __pyx_L1_error)
  4751. __Pyx_GOTREF(__pyx_t_5);
  4752. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4753. __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 305, __pyx_L1_error)
  4754. __Pyx_GOTREF(__pyx_t_4);
  4755. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4756. __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  4757. __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  4758. __Pyx_GIVEREF(__pyx_t_4);
  4759. PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4);
  4760. __pyx_t_4 = 0;
  4761. __Pyx_INCREF(__pyx_kp_u_length);
  4762. __pyx_t_2 += 8;
  4763. __Pyx_GIVEREF(__pyx_kp_u_length);
  4764. PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_length);
  4765. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":306
  4766. * def __repr__(self):
  4767. * return (f'<{self.__class__.__name__} @{hex(id(self))} '
  4768. * f'length={len(self.data)}>') # <<<<<<<<<<<<<<
  4769. *
  4770. * def __str__(self):
  4771. */
  4772. __pyx_t_4 = __pyx_v_self->data;
  4773. __Pyx_INCREF(__pyx_t_4);
  4774. if (unlikely(__pyx_t_4 == Py_None)) {
  4775. PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
  4776. __PYX_ERR(0, 306, __pyx_L1_error)
  4777. }
  4778. __pyx_t_6 = PySet_GET_SIZE(__pyx_t_4); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 306, __pyx_L1_error)
  4779. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4780. __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_t_6, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 306, __pyx_L1_error)
  4781. __Pyx_GOTREF(__pyx_t_4);
  4782. __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  4783. __Pyx_GIVEREF(__pyx_t_4);
  4784. PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_4);
  4785. __pyx_t_4 = 0;
  4786. __Pyx_INCREF(__pyx_kp_u__10);
  4787. __pyx_t_2 += 1;
  4788. __Pyx_GIVEREF(__pyx_kp_u__10);
  4789. PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_kp_u__10);
  4790. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":305
  4791. *
  4792. * def __repr__(self):
  4793. * return (f'<{self.__class__.__name__} @{hex(id(self))} ' # <<<<<<<<<<<<<<
  4794. * f'length={len(self.data)}>')
  4795. *
  4796. */
  4797. __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 7, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 305, __pyx_L1_error)
  4798. __Pyx_GOTREF(__pyx_t_4);
  4799. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4800. __pyx_r = __pyx_t_4;
  4801. __pyx_t_4 = 0;
  4802. goto __pyx_L0;
  4803. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":304
  4804. * return self.data == other
  4805. *
  4806. * def __repr__(self): # <<<<<<<<<<<<<<
  4807. * return (f'<{self.__class__.__name__} @{hex(id(self))} '
  4808. * f'length={len(self.data)}>')
  4809. */
  4810. /* function exit code */
  4811. __pyx_L1_error:;
  4812. __Pyx_XDECREF(__pyx_t_1);
  4813. __Pyx_XDECREF(__pyx_t_4);
  4814. __Pyx_XDECREF(__pyx_t_5);
  4815. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4816. __pyx_r = NULL;
  4817. __pyx_L0:;
  4818. __Pyx_XGIVEREF(__pyx_r);
  4819. __Pyx_TraceReturn(__pyx_r, 0);
  4820. __Pyx_RefNannyFinishContext();
  4821. return __pyx_r;
  4822. }
  4823. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":308
  4824. * f'length={len(self.data)}>')
  4825. *
  4826. * def __str__(self): # <<<<<<<<<<<<<<
  4827. * return str(self.data)
  4828. *
  4829. */
  4830. /* Python wrapper */
  4831. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_13__str__(PyObject *__pyx_v_self); /*proto*/
  4832. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_13__str__(PyObject *__pyx_v_self) {
  4833. PyObject *__pyx_r = 0;
  4834. __Pyx_RefNannyDeclarations
  4835. __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  4836. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_12__str__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self));
  4837. /* function exit code */
  4838. __Pyx_RefNannyFinishContext();
  4839. return __pyx_r;
  4840. }
  4841. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_12__str__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self) {
  4842. PyObject *__pyx_r = NULL;
  4843. __Pyx_TraceDeclarations
  4844. __Pyx_RefNannyDeclarations
  4845. PyObject *__pyx_t_1 = NULL;
  4846. __Pyx_RefNannySetupContext("__str__", 0);
  4847. __Pyx_TraceCall("__str__", __pyx_f[0], 308, 0, __PYX_ERR(0, 308, __pyx_L1_error));
  4848. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":309
  4849. *
  4850. * def __str__(self):
  4851. * return str(self.data) # <<<<<<<<<<<<<<
  4852. *
  4853. * @use_data
  4854. */
  4855. __Pyx_XDECREF(__pyx_r);
  4856. __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_self->data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 309, __pyx_L1_error)
  4857. __Pyx_GOTREF(__pyx_t_1);
  4858. __pyx_r = __pyx_t_1;
  4859. __pyx_t_1 = 0;
  4860. goto __pyx_L0;
  4861. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":308
  4862. * f'length={len(self.data)}>')
  4863. *
  4864. * def __str__(self): # <<<<<<<<<<<<<<
  4865. * return str(self.data)
  4866. *
  4867. */
  4868. /* function exit code */
  4869. __pyx_L1_error:;
  4870. __Pyx_XDECREF(__pyx_t_1);
  4871. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4872. __pyx_r = NULL;
  4873. __pyx_L0:;
  4874. __Pyx_XGIVEREF(__pyx_r);
  4875. __Pyx_TraceReturn(__pyx_r, 0);
  4876. __Pyx_RefNannyFinishContext();
  4877. return __pyx_r;
  4878. }
  4879. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":312
  4880. *
  4881. * @use_data
  4882. * def __sub__(self, other): # <<<<<<<<<<<<<<
  4883. * return self.data - other
  4884. *
  4885. */
  4886. /* Python wrapper */
  4887. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_15__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
  4888. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_15__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  4889. PyObject *__pyx_r = 0;
  4890. __Pyx_RefNannyDeclarations
  4891. __Pyx_RefNannySetupContext("__sub__ (wrapper)", 0);
  4892. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_14__sub__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));
  4893. /* function exit code */
  4894. __Pyx_RefNannyFinishContext();
  4895. return __pyx_r;
  4896. }
  4897. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_14__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  4898. PyObject *__pyx_r = NULL;
  4899. __Pyx_TraceDeclarations
  4900. __Pyx_RefNannyDeclarations
  4901. PyObject *__pyx_t_1 = NULL;
  4902. PyObject *__pyx_t_2 = NULL;
  4903. __Pyx_RefNannySetupContext("__sub__", 0);
  4904. __Pyx_TraceCall("__sub__", __pyx_f[0], 312, 0, __PYX_ERR(0, 312, __pyx_L1_error));
  4905. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":313
  4906. * @use_data
  4907. * def __sub__(self, other):
  4908. * return self.data - other # <<<<<<<<<<<<<<
  4909. *
  4910. * @use_data
  4911. */
  4912. __Pyx_XDECREF(__pyx_r);
  4913. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 313, __pyx_L1_error)
  4914. __Pyx_GOTREF(__pyx_t_1);
  4915. __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_v_other); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 313, __pyx_L1_error)
  4916. __Pyx_GOTREF(__pyx_t_2);
  4917. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4918. __pyx_r = __pyx_t_2;
  4919. __pyx_t_2 = 0;
  4920. goto __pyx_L0;
  4921. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":312
  4922. *
  4923. * @use_data
  4924. * def __sub__(self, other): # <<<<<<<<<<<<<<
  4925. * return self.data - other
  4926. *
  4927. */
  4928. /* function exit code */
  4929. __pyx_L1_error:;
  4930. __Pyx_XDECREF(__pyx_t_1);
  4931. __Pyx_XDECREF(__pyx_t_2);
  4932. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4933. __pyx_r = NULL;
  4934. __pyx_L0:;
  4935. __Pyx_XGIVEREF(__pyx_r);
  4936. __Pyx_TraceReturn(__pyx_r, 0);
  4937. __Pyx_RefNannyFinishContext();
  4938. return __pyx_r;
  4939. }
  4940. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":316
  4941. *
  4942. * @use_data
  4943. * def __isub__(self, other): # <<<<<<<<<<<<<<
  4944. * self.data -= other
  4945. * return self
  4946. */
  4947. /* Python wrapper */
  4948. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_17__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
  4949. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_17__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  4950. PyObject *__pyx_r = 0;
  4951. __Pyx_RefNannyDeclarations
  4952. __Pyx_RefNannySetupContext("__isub__ (wrapper)", 0);
  4953. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_16__isub__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self), ((PyObject *)__pyx_v_other));
  4954. /* function exit code */
  4955. __Pyx_RefNannyFinishContext();
  4956. return __pyx_r;
  4957. }
  4958. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_16__isub__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_other) {
  4959. PyObject *__pyx_r = NULL;
  4960. __Pyx_TraceDeclarations
  4961. __Pyx_RefNannyDeclarations
  4962. PyObject *__pyx_t_1 = NULL;
  4963. __Pyx_RefNannySetupContext("__isub__", 0);
  4964. __Pyx_TraceCall("__isub__", __pyx_f[0], 316, 0, __PYX_ERR(0, 316, __pyx_L1_error));
  4965. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":317
  4966. * @use_data
  4967. * def __isub__(self, other):
  4968. * self.data -= other # <<<<<<<<<<<<<<
  4969. * return self
  4970. *
  4971. */
  4972. __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_v_self->data, __pyx_v_other); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 317, __pyx_L1_error)
  4973. __Pyx_GOTREF(__pyx_t_1);
  4974. if (!(likely(PySet_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "set", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 317, __pyx_L1_error)
  4975. __Pyx_GIVEREF(__pyx_t_1);
  4976. __Pyx_GOTREF(__pyx_v_self->data);
  4977. __Pyx_DECREF(__pyx_v_self->data);
  4978. __pyx_v_self->data = ((PyObject*)__pyx_t_1);
  4979. __pyx_t_1 = 0;
  4980. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":318
  4981. * def __isub__(self, other):
  4982. * self.data -= other
  4983. * return self # <<<<<<<<<<<<<<
  4984. *
  4985. * @use_data
  4986. */
  4987. __Pyx_XDECREF(__pyx_r);
  4988. __Pyx_INCREF(((PyObject *)__pyx_v_self));
  4989. __pyx_r = ((PyObject *)__pyx_v_self);
  4990. goto __pyx_L0;
  4991. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":316
  4992. *
  4993. * @use_data
  4994. * def __isub__(self, other): # <<<<<<<<<<<<<<
  4995. * self.data -= other
  4996. * return self
  4997. */
  4998. /* function exit code */
  4999. __pyx_L1_error:;
  5000. __Pyx_XDECREF(__pyx_t_1);
  5001. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.__isub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5002. __pyx_r = NULL;
  5003. __pyx_L0:;
  5004. __Pyx_XGIVEREF(__pyx_r);
  5005. __Pyx_TraceReturn(__pyx_r, 0);
  5006. __Pyx_RefNannyFinishContext();
  5007. return __pyx_r;
  5008. }
  5009. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":321
  5010. *
  5011. * @use_data
  5012. * def __and__(self, other): # <<<<<<<<<<<<<<
  5013. * return self.data & other
  5014. *
  5015. */
  5016. /* Python wrapper */
  5017. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_19__and__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
  5018. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_19__and__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  5019. PyObject *__pyx_r = 0;
  5020. __Pyx_RefNannyDeclarations
  5021. __Pyx_RefNannySetupContext("__and__ (wrapper)", 0);
  5022. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_18__and__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));
  5023. /* function exit code */
  5024. __Pyx_RefNannyFinishContext();
  5025. return __pyx_r;
  5026. }
  5027. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_18__and__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  5028. PyObject *__pyx_r = NULL;
  5029. __Pyx_TraceDeclarations
  5030. __Pyx_RefNannyDeclarations
  5031. PyObject *__pyx_t_1 = NULL;
  5032. PyObject *__pyx_t_2 = NULL;
  5033. __Pyx_RefNannySetupContext("__and__", 0);
  5034. __Pyx_TraceCall("__and__", __pyx_f[0], 321, 0, __PYX_ERR(0, 321, __pyx_L1_error));
  5035. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":322
  5036. * @use_data
  5037. * def __and__(self, other):
  5038. * return self.data & other # <<<<<<<<<<<<<<
  5039. *
  5040. * @use_data
  5041. */
  5042. __Pyx_XDECREF(__pyx_r);
  5043. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 322, __pyx_L1_error)
  5044. __Pyx_GOTREF(__pyx_t_1);
  5045. __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_v_other); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 322, __pyx_L1_error)
  5046. __Pyx_GOTREF(__pyx_t_2);
  5047. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5048. __pyx_r = __pyx_t_2;
  5049. __pyx_t_2 = 0;
  5050. goto __pyx_L0;
  5051. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":321
  5052. *
  5053. * @use_data
  5054. * def __and__(self, other): # <<<<<<<<<<<<<<
  5055. * return self.data & other
  5056. *
  5057. */
  5058. /* function exit code */
  5059. __pyx_L1_error:;
  5060. __Pyx_XDECREF(__pyx_t_1);
  5061. __Pyx_XDECREF(__pyx_t_2);
  5062. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.__and__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5063. __pyx_r = NULL;
  5064. __pyx_L0:;
  5065. __Pyx_XGIVEREF(__pyx_r);
  5066. __Pyx_TraceReturn(__pyx_r, 0);
  5067. __Pyx_RefNannyFinishContext();
  5068. return __pyx_r;
  5069. }
  5070. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":325
  5071. *
  5072. * @use_data
  5073. * def __iand__(self, other): # <<<<<<<<<<<<<<
  5074. * self.data &= other
  5075. * return self
  5076. */
  5077. /* Python wrapper */
  5078. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_21__iand__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
  5079. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_21__iand__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  5080. PyObject *__pyx_r = 0;
  5081. __Pyx_RefNannyDeclarations
  5082. __Pyx_RefNannySetupContext("__iand__ (wrapper)", 0);
  5083. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_20__iand__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self), ((PyObject *)__pyx_v_other));
  5084. /* function exit code */
  5085. __Pyx_RefNannyFinishContext();
  5086. return __pyx_r;
  5087. }
  5088. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_20__iand__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_other) {
  5089. PyObject *__pyx_r = NULL;
  5090. __Pyx_TraceDeclarations
  5091. __Pyx_RefNannyDeclarations
  5092. PyObject *__pyx_t_1 = NULL;
  5093. __Pyx_RefNannySetupContext("__iand__", 0);
  5094. __Pyx_TraceCall("__iand__", __pyx_f[0], 325, 0, __PYX_ERR(0, 325, __pyx_L1_error));
  5095. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":326
  5096. * @use_data
  5097. * def __iand__(self, other):
  5098. * self.data &= other # <<<<<<<<<<<<<<
  5099. * return self
  5100. *
  5101. */
  5102. __pyx_t_1 = PyNumber_InPlaceAnd(__pyx_v_self->data, __pyx_v_other); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 326, __pyx_L1_error)
  5103. __Pyx_GOTREF(__pyx_t_1);
  5104. if (!(likely(PySet_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "set", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 326, __pyx_L1_error)
  5105. __Pyx_GIVEREF(__pyx_t_1);
  5106. __Pyx_GOTREF(__pyx_v_self->data);
  5107. __Pyx_DECREF(__pyx_v_self->data);
  5108. __pyx_v_self->data = ((PyObject*)__pyx_t_1);
  5109. __pyx_t_1 = 0;
  5110. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":327
  5111. * def __iand__(self, other):
  5112. * self.data &= other
  5113. * return self # <<<<<<<<<<<<<<
  5114. *
  5115. * @use_data
  5116. */
  5117. __Pyx_XDECREF(__pyx_r);
  5118. __Pyx_INCREF(((PyObject *)__pyx_v_self));
  5119. __pyx_r = ((PyObject *)__pyx_v_self);
  5120. goto __pyx_L0;
  5121. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":325
  5122. *
  5123. * @use_data
  5124. * def __iand__(self, other): # <<<<<<<<<<<<<<
  5125. * self.data &= other
  5126. * return self
  5127. */
  5128. /* function exit code */
  5129. __pyx_L1_error:;
  5130. __Pyx_XDECREF(__pyx_t_1);
  5131. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.__iand__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5132. __pyx_r = NULL;
  5133. __pyx_L0:;
  5134. __Pyx_XGIVEREF(__pyx_r);
  5135. __Pyx_TraceReturn(__pyx_r, 0);
  5136. __Pyx_RefNannyFinishContext();
  5137. return __pyx_r;
  5138. }
  5139. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":330
  5140. *
  5141. * @use_data
  5142. * def __or__(self, other): # <<<<<<<<<<<<<<
  5143. * return self.data | other
  5144. *
  5145. */
  5146. /* Python wrapper */
  5147. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_23__or__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
  5148. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_23__or__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  5149. PyObject *__pyx_r = 0;
  5150. __Pyx_RefNannyDeclarations
  5151. __Pyx_RefNannySetupContext("__or__ (wrapper)", 0);
  5152. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_22__or__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));
  5153. /* function exit code */
  5154. __Pyx_RefNannyFinishContext();
  5155. return __pyx_r;
  5156. }
  5157. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_22__or__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  5158. PyObject *__pyx_r = NULL;
  5159. __Pyx_TraceDeclarations
  5160. __Pyx_RefNannyDeclarations
  5161. PyObject *__pyx_t_1 = NULL;
  5162. PyObject *__pyx_t_2 = NULL;
  5163. __Pyx_RefNannySetupContext("__or__", 0);
  5164. __Pyx_TraceCall("__or__", __pyx_f[0], 330, 0, __PYX_ERR(0, 330, __pyx_L1_error));
  5165. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":331
  5166. * @use_data
  5167. * def __or__(self, other):
  5168. * return self.data | other # <<<<<<<<<<<<<<
  5169. *
  5170. * @use_data
  5171. */
  5172. __Pyx_XDECREF(__pyx_r);
  5173. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __pyx_L1_error)
  5174. __Pyx_GOTREF(__pyx_t_1);
  5175. __pyx_t_2 = PyNumber_Or(__pyx_t_1, __pyx_v_other); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 331, __pyx_L1_error)
  5176. __Pyx_GOTREF(__pyx_t_2);
  5177. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5178. __pyx_r = __pyx_t_2;
  5179. __pyx_t_2 = 0;
  5180. goto __pyx_L0;
  5181. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":330
  5182. *
  5183. * @use_data
  5184. * def __or__(self, other): # <<<<<<<<<<<<<<
  5185. * return self.data | other
  5186. *
  5187. */
  5188. /* function exit code */
  5189. __pyx_L1_error:;
  5190. __Pyx_XDECREF(__pyx_t_1);
  5191. __Pyx_XDECREF(__pyx_t_2);
  5192. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.__or__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5193. __pyx_r = NULL;
  5194. __pyx_L0:;
  5195. __Pyx_XGIVEREF(__pyx_r);
  5196. __Pyx_TraceReturn(__pyx_r, 0);
  5197. __Pyx_RefNannyFinishContext();
  5198. return __pyx_r;
  5199. }
  5200. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":334
  5201. *
  5202. * @use_data
  5203. * def __ior__(self, other): # <<<<<<<<<<<<<<
  5204. * self.data |= other
  5205. * return self
  5206. */
  5207. /* Python wrapper */
  5208. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_25__ior__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
  5209. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_25__ior__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  5210. PyObject *__pyx_r = 0;
  5211. __Pyx_RefNannyDeclarations
  5212. __Pyx_RefNannySetupContext("__ior__ (wrapper)", 0);
  5213. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_24__ior__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self), ((PyObject *)__pyx_v_other));
  5214. /* function exit code */
  5215. __Pyx_RefNannyFinishContext();
  5216. return __pyx_r;
  5217. }
  5218. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_24__ior__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_other) {
  5219. PyObject *__pyx_r = NULL;
  5220. __Pyx_TraceDeclarations
  5221. __Pyx_RefNannyDeclarations
  5222. PyObject *__pyx_t_1 = NULL;
  5223. __Pyx_RefNannySetupContext("__ior__", 0);
  5224. __Pyx_TraceCall("__ior__", __pyx_f[0], 334, 0, __PYX_ERR(0, 334, __pyx_L1_error));
  5225. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":335
  5226. * @use_data
  5227. * def __ior__(self, other):
  5228. * self.data |= other # <<<<<<<<<<<<<<
  5229. * return self
  5230. *
  5231. */
  5232. __pyx_t_1 = PyNumber_InPlaceOr(__pyx_v_self->data, __pyx_v_other); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 335, __pyx_L1_error)
  5233. __Pyx_GOTREF(__pyx_t_1);
  5234. if (!(likely(PySet_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "set", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 335, __pyx_L1_error)
  5235. __Pyx_GIVEREF(__pyx_t_1);
  5236. __Pyx_GOTREF(__pyx_v_self->data);
  5237. __Pyx_DECREF(__pyx_v_self->data);
  5238. __pyx_v_self->data = ((PyObject*)__pyx_t_1);
  5239. __pyx_t_1 = 0;
  5240. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":336
  5241. * def __ior__(self, other):
  5242. * self.data |= other
  5243. * return self # <<<<<<<<<<<<<<
  5244. *
  5245. * @use_data
  5246. */
  5247. __Pyx_XDECREF(__pyx_r);
  5248. __Pyx_INCREF(((PyObject *)__pyx_v_self));
  5249. __pyx_r = ((PyObject *)__pyx_v_self);
  5250. goto __pyx_L0;
  5251. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":334
  5252. *
  5253. * @use_data
  5254. * def __ior__(self, other): # <<<<<<<<<<<<<<
  5255. * self.data |= other
  5256. * return self
  5257. */
  5258. /* function exit code */
  5259. __pyx_L1_error:;
  5260. __Pyx_XDECREF(__pyx_t_1);
  5261. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.__ior__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5262. __pyx_r = NULL;
  5263. __pyx_L0:;
  5264. __Pyx_XGIVEREF(__pyx_r);
  5265. __Pyx_TraceReturn(__pyx_r, 0);
  5266. __Pyx_RefNannyFinishContext();
  5267. return __pyx_r;
  5268. }
  5269. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":339
  5270. *
  5271. * @use_data
  5272. * def __xor__(self, other): # <<<<<<<<<<<<<<
  5273. * return self.data ^ other
  5274. *
  5275. */
  5276. /* Python wrapper */
  5277. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_27__xor__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
  5278. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_27__xor__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  5279. PyObject *__pyx_r = 0;
  5280. __Pyx_RefNannyDeclarations
  5281. __Pyx_RefNannySetupContext("__xor__ (wrapper)", 0);
  5282. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_26__xor__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));
  5283. /* function exit code */
  5284. __Pyx_RefNannyFinishContext();
  5285. return __pyx_r;
  5286. }
  5287. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_26__xor__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  5288. PyObject *__pyx_r = NULL;
  5289. __Pyx_TraceDeclarations
  5290. __Pyx_RefNannyDeclarations
  5291. PyObject *__pyx_t_1 = NULL;
  5292. PyObject *__pyx_t_2 = NULL;
  5293. __Pyx_RefNannySetupContext("__xor__", 0);
  5294. __Pyx_TraceCall("__xor__", __pyx_f[0], 339, 0, __PYX_ERR(0, 339, __pyx_L1_error));
  5295. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":340
  5296. * @use_data
  5297. * def __xor__(self, other):
  5298. * return self.data ^ other # <<<<<<<<<<<<<<
  5299. *
  5300. * @use_data
  5301. */
  5302. __Pyx_XDECREF(__pyx_r);
  5303. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 340, __pyx_L1_error)
  5304. __Pyx_GOTREF(__pyx_t_1);
  5305. __pyx_t_2 = PyNumber_Xor(__pyx_t_1, __pyx_v_other); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 340, __pyx_L1_error)
  5306. __Pyx_GOTREF(__pyx_t_2);
  5307. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5308. __pyx_r = __pyx_t_2;
  5309. __pyx_t_2 = 0;
  5310. goto __pyx_L0;
  5311. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":339
  5312. *
  5313. * @use_data
  5314. * def __xor__(self, other): # <<<<<<<<<<<<<<
  5315. * return self.data ^ other
  5316. *
  5317. */
  5318. /* function exit code */
  5319. __pyx_L1_error:;
  5320. __Pyx_XDECREF(__pyx_t_1);
  5321. __Pyx_XDECREF(__pyx_t_2);
  5322. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.__xor__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5323. __pyx_r = NULL;
  5324. __pyx_L0:;
  5325. __Pyx_XGIVEREF(__pyx_r);
  5326. __Pyx_TraceReturn(__pyx_r, 0);
  5327. __Pyx_RefNannyFinishContext();
  5328. return __pyx_r;
  5329. }
  5330. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":343
  5331. *
  5332. * @use_data
  5333. * def __ixor__(self, other): # <<<<<<<<<<<<<<
  5334. * self.data ^= other
  5335. * return self
  5336. */
  5337. /* Python wrapper */
  5338. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_29__ixor__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
  5339. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_29__ixor__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  5340. PyObject *__pyx_r = 0;
  5341. __Pyx_RefNannyDeclarations
  5342. __Pyx_RefNannySetupContext("__ixor__ (wrapper)", 0);
  5343. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_28__ixor__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self), ((PyObject *)__pyx_v_other));
  5344. /* function exit code */
  5345. __Pyx_RefNannyFinishContext();
  5346. return __pyx_r;
  5347. }
  5348. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_28__ixor__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_other) {
  5349. PyObject *__pyx_r = NULL;
  5350. __Pyx_TraceDeclarations
  5351. __Pyx_RefNannyDeclarations
  5352. PyObject *__pyx_t_1 = NULL;
  5353. __Pyx_RefNannySetupContext("__ixor__", 0);
  5354. __Pyx_TraceCall("__ixor__", __pyx_f[0], 343, 0, __PYX_ERR(0, 343, __pyx_L1_error));
  5355. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":344
  5356. * @use_data
  5357. * def __ixor__(self, other):
  5358. * self.data ^= other # <<<<<<<<<<<<<<
  5359. * return self
  5360. *
  5361. */
  5362. __pyx_t_1 = PyNumber_InPlaceXor(__pyx_v_self->data, __pyx_v_other); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 344, __pyx_L1_error)
  5363. __Pyx_GOTREF(__pyx_t_1);
  5364. if (!(likely(PySet_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "set", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 344, __pyx_L1_error)
  5365. __Pyx_GIVEREF(__pyx_t_1);
  5366. __Pyx_GOTREF(__pyx_v_self->data);
  5367. __Pyx_DECREF(__pyx_v_self->data);
  5368. __pyx_v_self->data = ((PyObject*)__pyx_t_1);
  5369. __pyx_t_1 = 0;
  5370. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":345
  5371. * def __ixor__(self, other):
  5372. * self.data ^= other
  5373. * return self # <<<<<<<<<<<<<<
  5374. *
  5375. * def __contains__(self, item):
  5376. */
  5377. __Pyx_XDECREF(__pyx_r);
  5378. __Pyx_INCREF(((PyObject *)__pyx_v_self));
  5379. __pyx_r = ((PyObject *)__pyx_v_self);
  5380. goto __pyx_L0;
  5381. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":343
  5382. *
  5383. * @use_data
  5384. * def __ixor__(self, other): # <<<<<<<<<<<<<<
  5385. * self.data ^= other
  5386. * return self
  5387. */
  5388. /* function exit code */
  5389. __pyx_L1_error:;
  5390. __Pyx_XDECREF(__pyx_t_1);
  5391. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.__ixor__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5392. __pyx_r = NULL;
  5393. __pyx_L0:;
  5394. __Pyx_XGIVEREF(__pyx_r);
  5395. __Pyx_TraceReturn(__pyx_r, 0);
  5396. __Pyx_RefNannyFinishContext();
  5397. return __pyx_r;
  5398. }
  5399. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":347
  5400. * return self
  5401. *
  5402. * def __contains__(self, item): # <<<<<<<<<<<<<<
  5403. * return item in self.data
  5404. *
  5405. */
  5406. /* Python wrapper */
  5407. static int __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_31__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
  5408. static int __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_31__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
  5409. int __pyx_r;
  5410. __Pyx_RefNannyDeclarations
  5411. __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  5412. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_30__contains__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self), ((PyObject *)__pyx_v_item));
  5413. /* function exit code */
  5414. __Pyx_RefNannyFinishContext();
  5415. return __pyx_r;
  5416. }
  5417. static int __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_30__contains__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_item) {
  5418. int __pyx_r;
  5419. __Pyx_TraceDeclarations
  5420. __Pyx_RefNannyDeclarations
  5421. int __pyx_t_1;
  5422. __Pyx_RefNannySetupContext("__contains__", 0);
  5423. __Pyx_TraceCall("__contains__", __pyx_f[0], 347, 0, __PYX_ERR(0, 347, __pyx_L1_error));
  5424. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":348
  5425. *
  5426. * def __contains__(self, item):
  5427. * return item in self.data # <<<<<<<<<<<<<<
  5428. *
  5429. * def __iter__(self):
  5430. */
  5431. if (unlikely(__pyx_v_self->data == Py_None)) {
  5432. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  5433. __PYX_ERR(0, 348, __pyx_L1_error)
  5434. }
  5435. __pyx_t_1 = (__Pyx_PySet_ContainsTF(__pyx_v_item, __pyx_v_self->data, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 348, __pyx_L1_error)
  5436. __pyx_r = __pyx_t_1;
  5437. goto __pyx_L0;
  5438. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":347
  5439. * return self
  5440. *
  5441. * def __contains__(self, item): # <<<<<<<<<<<<<<
  5442. * return item in self.data
  5443. *
  5444. */
  5445. /* function exit code */
  5446. __pyx_L1_error:;
  5447. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5448. __pyx_r = -1;
  5449. __pyx_L0:;
  5450. __Pyx_TraceReturn(Py_None, 0);
  5451. __Pyx_RefNannyFinishContext();
  5452. return __pyx_r;
  5453. }
  5454. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":350
  5455. * return item in self.data
  5456. *
  5457. * def __iter__(self): # <<<<<<<<<<<<<<
  5458. * return self.data.__iter__()
  5459. *
  5460. */
  5461. /* Python wrapper */
  5462. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_33__iter__(PyObject *__pyx_v_self); /*proto*/
  5463. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_33__iter__(PyObject *__pyx_v_self) {
  5464. PyObject *__pyx_r = 0;
  5465. __Pyx_RefNannyDeclarations
  5466. __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  5467. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_32__iter__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self));
  5468. /* function exit code */
  5469. __Pyx_RefNannyFinishContext();
  5470. return __pyx_r;
  5471. }
  5472. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_32__iter__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self) {
  5473. PyObject *__pyx_r = NULL;
  5474. __Pyx_TraceDeclarations
  5475. __Pyx_RefNannyDeclarations
  5476. PyObject *__pyx_t_1 = NULL;
  5477. PyObject *__pyx_t_2 = NULL;
  5478. PyObject *__pyx_t_3 = NULL;
  5479. __Pyx_RefNannySetupContext("__iter__", 0);
  5480. __Pyx_TraceCall("__iter__", __pyx_f[0], 350, 0, __PYX_ERR(0, 350, __pyx_L1_error));
  5481. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":351
  5482. *
  5483. * def __iter__(self):
  5484. * return self.data.__iter__() # <<<<<<<<<<<<<<
  5485. *
  5486. *
  5487. */
  5488. __Pyx_XDECREF(__pyx_r);
  5489. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->data, __pyx_n_s_iter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 351, __pyx_L1_error)
  5490. __Pyx_GOTREF(__pyx_t_2);
  5491. __pyx_t_3 = NULL;
  5492. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
  5493. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  5494. if (likely(__pyx_t_3)) {
  5495. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  5496. __Pyx_INCREF(__pyx_t_3);
  5497. __Pyx_INCREF(function);
  5498. __Pyx_DECREF_SET(__pyx_t_2, function);
  5499. }
  5500. }
  5501. if (__pyx_t_3) {
  5502. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 351, __pyx_L1_error)
  5503. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5504. } else {
  5505. __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 351, __pyx_L1_error)
  5506. }
  5507. __Pyx_GOTREF(__pyx_t_1);
  5508. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  5509. __pyx_r = __pyx_t_1;
  5510. __pyx_t_1 = 0;
  5511. goto __pyx_L0;
  5512. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":350
  5513. * return item in self.data
  5514. *
  5515. * def __iter__(self): # <<<<<<<<<<<<<<
  5516. * return self.data.__iter__()
  5517. *
  5518. */
  5519. /* function exit code */
  5520. __pyx_L1_error:;
  5521. __Pyx_XDECREF(__pyx_t_1);
  5522. __Pyx_XDECREF(__pyx_t_2);
  5523. __Pyx_XDECREF(__pyx_t_3);
  5524. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5525. __pyx_r = NULL;
  5526. __pyx_L0:;
  5527. __Pyx_XGIVEREF(__pyx_r);
  5528. __Pyx_TraceReturn(__pyx_r, 0);
  5529. __Pyx_RefNannyFinishContext();
  5530. return __pyx_r;
  5531. }
  5532. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":356
  5533. * # Slicing.
  5534. *
  5535. * def __getitem__(self, item): # <<<<<<<<<<<<<<
  5536. * if isinstance(item, slice):
  5537. * s, p, o = item.start, item.stop, item.step
  5538. */
  5539. /* Python wrapper */
  5540. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_35__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
  5541. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_35__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
  5542. PyObject *__pyx_r = 0;
  5543. __Pyx_RefNannyDeclarations
  5544. __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  5545. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_34__getitem__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self), ((PyObject *)__pyx_v_item));
  5546. /* function exit code */
  5547. __Pyx_RefNannyFinishContext();
  5548. return __pyx_r;
  5549. }
  5550. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_34__getitem__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_item) {
  5551. PyObject *__pyx_v_s = NULL;
  5552. PyObject *__pyx_v_p = NULL;
  5553. PyObject *__pyx_v_o = NULL;
  5554. PyObject *__pyx_r = NULL;
  5555. __Pyx_TraceDeclarations
  5556. __Pyx_RefNannyDeclarations
  5557. int __pyx_t_1;
  5558. int __pyx_t_2;
  5559. PyObject *__pyx_t_3 = NULL;
  5560. PyObject *__pyx_t_4 = NULL;
  5561. PyObject *__pyx_t_5 = NULL;
  5562. Py_ssize_t __pyx_t_6;
  5563. Py_UCS4 __pyx_t_7;
  5564. __Pyx_RefNannySetupContext("__getitem__", 0);
  5565. __Pyx_TraceCall("__getitem__", __pyx_f[0], 356, 0, __PYX_ERR(0, 356, __pyx_L1_error));
  5566. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":357
  5567. *
  5568. * def __getitem__(self, item):
  5569. * if isinstance(item, slice): # <<<<<<<<<<<<<<
  5570. * s, p, o = item.start, item.stop, item.step
  5571. * return self._slice(s, p, o)
  5572. */
  5573. __pyx_t_1 = PySlice_Check(__pyx_v_item);
  5574. __pyx_t_2 = (__pyx_t_1 != 0);
  5575. if (likely(__pyx_t_2)) {
  5576. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":358
  5577. * def __getitem__(self, item):
  5578. * if isinstance(item, slice):
  5579. * s, p, o = item.start, item.stop, item.step # <<<<<<<<<<<<<<
  5580. * return self._slice(s, p, o)
  5581. * else:
  5582. */
  5583. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_item, __pyx_n_s_start); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 358, __pyx_L1_error)
  5584. __Pyx_GOTREF(__pyx_t_3);
  5585. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_item, __pyx_n_s_stop); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 358, __pyx_L1_error)
  5586. __Pyx_GOTREF(__pyx_t_4);
  5587. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_item, __pyx_n_s_step); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 358, __pyx_L1_error)
  5588. __Pyx_GOTREF(__pyx_t_5);
  5589. __pyx_v_s = __pyx_t_3;
  5590. __pyx_t_3 = 0;
  5591. __pyx_v_p = __pyx_t_4;
  5592. __pyx_t_4 = 0;
  5593. __pyx_v_o = __pyx_t_5;
  5594. __pyx_t_5 = 0;
  5595. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":359
  5596. * if isinstance(item, slice):
  5597. * s, p, o = item.start, item.stop, item.step
  5598. * return self._slice(s, p, o) # <<<<<<<<<<<<<<
  5599. * else:
  5600. * raise TypeError(f'Wrong slice format: {item}.')
  5601. */
  5602. __Pyx_XDECREF(__pyx_r);
  5603. __pyx_t_5 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self->__pyx_vtab)->_slice(__pyx_v_self, __pyx_v_s, __pyx_v_p, __pyx_v_o); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 359, __pyx_L1_error)
  5604. __Pyx_GOTREF(__pyx_t_5);
  5605. __pyx_r = __pyx_t_5;
  5606. __pyx_t_5 = 0;
  5607. goto __pyx_L0;
  5608. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":357
  5609. *
  5610. * def __getitem__(self, item):
  5611. * if isinstance(item, slice): # <<<<<<<<<<<<<<
  5612. * s, p, o = item.start, item.stop, item.step
  5613. * return self._slice(s, p, o)
  5614. */
  5615. }
  5616. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":361
  5617. * return self._slice(s, p, o)
  5618. * else:
  5619. * raise TypeError(f'Wrong slice format: {item}.') # <<<<<<<<<<<<<<
  5620. *
  5621. *
  5622. */
  5623. /*else*/ {
  5624. __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 361, __pyx_L1_error)
  5625. __Pyx_GOTREF(__pyx_t_5);
  5626. __pyx_t_6 = 0;
  5627. __pyx_t_7 = 127;
  5628. __Pyx_INCREF(__pyx_kp_u_Wrong_slice_format);
  5629. __pyx_t_6 += 20;
  5630. __Pyx_GIVEREF(__pyx_kp_u_Wrong_slice_format);
  5631. PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Wrong_slice_format);
  5632. __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_item, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 361, __pyx_L1_error)
  5633. __Pyx_GOTREF(__pyx_t_4);
  5634. __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_7;
  5635. __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  5636. __Pyx_GIVEREF(__pyx_t_4);
  5637. PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  5638. __pyx_t_4 = 0;
  5639. __Pyx_INCREF(__pyx_kp_u__11);
  5640. __pyx_t_6 += 1;
  5641. __Pyx_GIVEREF(__pyx_kp_u__11);
  5642. PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__11);
  5643. __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 361, __pyx_L1_error)
  5644. __Pyx_GOTREF(__pyx_t_4);
  5645. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5646. __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 361, __pyx_L1_error)
  5647. __Pyx_GOTREF(__pyx_t_5);
  5648. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5649. __Pyx_Raise(__pyx_t_5, 0, 0, 0);
  5650. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5651. __PYX_ERR(0, 361, __pyx_L1_error)
  5652. }
  5653. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":356
  5654. * # Slicing.
  5655. *
  5656. * def __getitem__(self, item): # <<<<<<<<<<<<<<
  5657. * if isinstance(item, slice):
  5658. * s, p, o = item.start, item.stop, item.step
  5659. */
  5660. /* function exit code */
  5661. __pyx_L1_error:;
  5662. __Pyx_XDECREF(__pyx_t_3);
  5663. __Pyx_XDECREF(__pyx_t_4);
  5664. __Pyx_XDECREF(__pyx_t_5);
  5665. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5666. __pyx_r = NULL;
  5667. __pyx_L0:;
  5668. __Pyx_XDECREF(__pyx_v_s);
  5669. __Pyx_XDECREF(__pyx_v_p);
  5670. __Pyx_XDECREF(__pyx_v_o);
  5671. __Pyx_XGIVEREF(__pyx_r);
  5672. __Pyx_TraceReturn(__pyx_r, 0);
  5673. __Pyx_RefNannyFinishContext();
  5674. return __pyx_r;
  5675. }
  5676. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":364
  5677. *
  5678. *
  5679. * cpdef void set(self, tuple trp) except *: # <<<<<<<<<<<<<<
  5680. * """
  5681. * Set a single value for subject and predicate.
  5682. */
  5683. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_37set(PyObject *__pyx_v_self, PyObject *__pyx_v_trp); /*proto*/
  5684. static void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_set(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_trp, int __pyx_skip_dispatch) {
  5685. __Pyx_TraceDeclarations
  5686. __Pyx_RefNannyDeclarations
  5687. PyObject *__pyx_t_1 = NULL;
  5688. PyObject *__pyx_t_2 = NULL;
  5689. PyObject *__pyx_t_3 = NULL;
  5690. PyObject *__pyx_t_4 = NULL;
  5691. PyObject *__pyx_t_5 = NULL;
  5692. int __pyx_t_6;
  5693. int __pyx_t_7;
  5694. int __pyx_t_8;
  5695. __Pyx_RefNannySetupContext("set", 0);
  5696. __Pyx_TraceCall("set", __pyx_f[0], 364, 0, __PYX_ERR(0, 364, __pyx_L1_error));
  5697. /* Check if called by wrapper */
  5698. if (unlikely(__pyx_skip_dispatch)) ;
  5699. /* Check if overridden in Python */
  5700. else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
  5701. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error)
  5702. __Pyx_GOTREF(__pyx_t_1);
  5703. if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_37set)) {
  5704. __Pyx_INCREF(__pyx_t_1);
  5705. __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
  5706. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  5707. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
  5708. if (likely(__pyx_t_4)) {
  5709. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  5710. __Pyx_INCREF(__pyx_t_4);
  5711. __Pyx_INCREF(function);
  5712. __Pyx_DECREF_SET(__pyx_t_3, function);
  5713. }
  5714. }
  5715. if (!__pyx_t_4) {
  5716. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_trp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 364, __pyx_L1_error)
  5717. __Pyx_GOTREF(__pyx_t_2);
  5718. } else {
  5719. #if CYTHON_FAST_PYCALL
  5720. if (PyFunction_Check(__pyx_t_3)) {
  5721. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_trp};
  5722. __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 364, __pyx_L1_error)
  5723. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  5724. __Pyx_GOTREF(__pyx_t_2);
  5725. } else
  5726. #endif
  5727. #if CYTHON_FAST_PYCCALL
  5728. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  5729. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_trp};
  5730. __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 364, __pyx_L1_error)
  5731. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  5732. __Pyx_GOTREF(__pyx_t_2);
  5733. } else
  5734. #endif
  5735. {
  5736. __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 364, __pyx_L1_error)
  5737. __Pyx_GOTREF(__pyx_t_5);
  5738. __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
  5739. __Pyx_INCREF(__pyx_v_trp);
  5740. __Pyx_GIVEREF(__pyx_v_trp);
  5741. PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_trp);
  5742. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 364, __pyx_L1_error)
  5743. __Pyx_GOTREF(__pyx_t_2);
  5744. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5745. }
  5746. }
  5747. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5748. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  5749. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5750. goto __pyx_L0;
  5751. }
  5752. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5753. }
  5754. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":370
  5755. * Remove all triples matching ``s`` and ``p`` before adding ``s p o``.
  5756. * """
  5757. * self.remove_triples((trp[0], trp[1], None)) # <<<<<<<<<<<<<<
  5758. * if None in trp:
  5759. * raise ValueError(f'Invalid triple: {trp}')
  5760. */
  5761. if (unlikely(__pyx_v_trp == Py_None)) {
  5762. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
  5763. __PYX_ERR(0, 370, __pyx_L1_error)
  5764. }
  5765. if (unlikely(__pyx_v_trp == Py_None)) {
  5766. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
  5767. __PYX_ERR(0, 370, __pyx_L1_error)
  5768. }
  5769. __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 370, __pyx_L1_error)
  5770. __Pyx_GOTREF(__pyx_t_1);
  5771. __Pyx_INCREF(PyTuple_GET_ITEM(__pyx_v_trp, 0));
  5772. __Pyx_GIVEREF(PyTuple_GET_ITEM(__pyx_v_trp, 0));
  5773. PyTuple_SET_ITEM(__pyx_t_1, 0, PyTuple_GET_ITEM(__pyx_v_trp, 0));
  5774. __Pyx_INCREF(PyTuple_GET_ITEM(__pyx_v_trp, 1));
  5775. __Pyx_GIVEREF(PyTuple_GET_ITEM(__pyx_v_trp, 1));
  5776. PyTuple_SET_ITEM(__pyx_t_1, 1, PyTuple_GET_ITEM(__pyx_v_trp, 1));
  5777. __Pyx_INCREF(Py_None);
  5778. __Pyx_GIVEREF(Py_None);
  5779. PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
  5780. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self->__pyx_vtab)->remove_triples(__pyx_v_self, __pyx_t_1, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 370, __pyx_L1_error)
  5781. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5782. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":371
  5783. * """
  5784. * self.remove_triples((trp[0], trp[1], None))
  5785. * if None in trp: # <<<<<<<<<<<<<<
  5786. * raise ValueError(f'Invalid triple: {trp}')
  5787. * self.data.add(trp)
  5788. */
  5789. __pyx_t_6 = (__Pyx_PySequence_ContainsTF(Py_None, __pyx_v_trp, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 371, __pyx_L1_error)
  5790. __pyx_t_7 = (__pyx_t_6 != 0);
  5791. if (unlikely(__pyx_t_7)) {
  5792. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":372
  5793. * self.remove_triples((trp[0], trp[1], None))
  5794. * if None in trp:
  5795. * raise ValueError(f'Invalid triple: {trp}') # <<<<<<<<<<<<<<
  5796. * self.data.add(trp)
  5797. *
  5798. */
  5799. __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_trp, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 372, __pyx_L1_error)
  5800. __Pyx_GOTREF(__pyx_t_1);
  5801. __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Invalid_triple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 372, __pyx_L1_error)
  5802. __Pyx_GOTREF(__pyx_t_2);
  5803. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5804. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 372, __pyx_L1_error)
  5805. __Pyx_GOTREF(__pyx_t_1);
  5806. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  5807. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  5808. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5809. __PYX_ERR(0, 372, __pyx_L1_error)
  5810. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":371
  5811. * """
  5812. * self.remove_triples((trp[0], trp[1], None))
  5813. * if None in trp: # <<<<<<<<<<<<<<
  5814. * raise ValueError(f'Invalid triple: {trp}')
  5815. * self.data.add(trp)
  5816. */
  5817. }
  5818. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":373
  5819. * if None in trp:
  5820. * raise ValueError(f'Invalid triple: {trp}')
  5821. * self.data.add(trp) # <<<<<<<<<<<<<<
  5822. *
  5823. *
  5824. */
  5825. if (unlikely(__pyx_v_self->data == Py_None)) {
  5826. PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "add");
  5827. __PYX_ERR(0, 373, __pyx_L1_error)
  5828. }
  5829. __pyx_t_8 = PySet_Add(__pyx_v_self->data, __pyx_v_trp); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 373, __pyx_L1_error)
  5830. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":364
  5831. *
  5832. *
  5833. * cpdef void set(self, tuple trp) except *: # <<<<<<<<<<<<<<
  5834. * """
  5835. * Set a single value for subject and predicate.
  5836. */
  5837. /* function exit code */
  5838. goto __pyx_L0;
  5839. __pyx_L1_error:;
  5840. __Pyx_XDECREF(__pyx_t_1);
  5841. __Pyx_XDECREF(__pyx_t_2);
  5842. __Pyx_XDECREF(__pyx_t_3);
  5843. __Pyx_XDECREF(__pyx_t_4);
  5844. __Pyx_XDECREF(__pyx_t_5);
  5845. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5846. __pyx_L0:;
  5847. __Pyx_TraceReturn(Py_None, 0);
  5848. __Pyx_RefNannyFinishContext();
  5849. }
  5850. /* Python wrapper */
  5851. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_37set(PyObject *__pyx_v_self, PyObject *__pyx_v_trp); /*proto*/
  5852. static char __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_36set[] = "\n Set a single value for subject and predicate.\n\n Remove all triples matching ``s`` and ``p`` before adding ``s p o``.\n ";
  5853. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_37set(PyObject *__pyx_v_self, PyObject *__pyx_v_trp) {
  5854. PyObject *__pyx_r = 0;
  5855. __Pyx_RefNannyDeclarations
  5856. __Pyx_RefNannySetupContext("set (wrapper)", 0);
  5857. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_trp), (&PyTuple_Type), 1, "trp", 1))) __PYX_ERR(0, 364, __pyx_L1_error)
  5858. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_36set(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self), ((PyObject*)__pyx_v_trp));
  5859. /* function exit code */
  5860. goto __pyx_L0;
  5861. __pyx_L1_error:;
  5862. __pyx_r = NULL;
  5863. __pyx_L0:;
  5864. __Pyx_RefNannyFinishContext();
  5865. return __pyx_r;
  5866. }
  5867. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_36set(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_trp) {
  5868. PyObject *__pyx_r = NULL;
  5869. __Pyx_TraceDeclarations
  5870. __Pyx_RefNannyDeclarations
  5871. PyObject *__pyx_t_1 = NULL;
  5872. __Pyx_RefNannySetupContext("set", 0);
  5873. __Pyx_TraceCall("set (wrapper)", __pyx_f[0], 364, 0, __PYX_ERR(0, 364, __pyx_L1_error));
  5874. __Pyx_XDECREF(__pyx_r);
  5875. __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_set(__pyx_v_self, __pyx_v_trp, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 364, __pyx_L1_error)
  5876. __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error)
  5877. __Pyx_GOTREF(__pyx_t_1);
  5878. __pyx_r = __pyx_t_1;
  5879. __pyx_t_1 = 0;
  5880. goto __pyx_L0;
  5881. /* function exit code */
  5882. __pyx_L1_error:;
  5883. __Pyx_XDECREF(__pyx_t_1);
  5884. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5885. __pyx_r = NULL;
  5886. __pyx_L0:;
  5887. __Pyx_XGIVEREF(__pyx_r);
  5888. __Pyx_TraceReturn(__pyx_r, 0);
  5889. __Pyx_RefNannyFinishContext();
  5890. return __pyx_r;
  5891. }
  5892. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":376
  5893. *
  5894. *
  5895. * cpdef void remove_triples(self, pattern) except *: # <<<<<<<<<<<<<<
  5896. * """
  5897. * Remove triples by pattern.
  5898. */
  5899. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_39remove_triples(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
  5900. static void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_remove_triples(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_pattern, int __pyx_skip_dispatch) {
  5901. PyObject *__pyx_v_s = NULL;
  5902. PyObject *__pyx_v_p = NULL;
  5903. PyObject *__pyx_v_o = NULL;
  5904. PyObject *__pyx_v_match = NULL;
  5905. __Pyx_TraceDeclarations
  5906. __Pyx_RefNannyDeclarations
  5907. PyObject *__pyx_t_1 = NULL;
  5908. PyObject *__pyx_t_2 = NULL;
  5909. PyObject *__pyx_t_3 = NULL;
  5910. PyObject *__pyx_t_4 = NULL;
  5911. PyObject *__pyx_t_5 = NULL;
  5912. PyObject *(*__pyx_t_6)(PyObject *);
  5913. Py_ssize_t __pyx_t_7;
  5914. PyObject *(*__pyx_t_8)(PyObject *);
  5915. Py_ssize_t __pyx_t_9;
  5916. Py_UCS4 __pyx_t_10;
  5917. PyObject *__pyx_t_11 = NULL;
  5918. int __pyx_t_12;
  5919. __Pyx_RefNannySetupContext("remove_triples", 0);
  5920. __Pyx_TraceCall("remove_triples", __pyx_f[0], 376, 0, __PYX_ERR(0, 376, __pyx_L1_error));
  5921. /* Check if called by wrapper */
  5922. if (unlikely(__pyx_skip_dispatch)) ;
  5923. /* Check if overridden in Python */
  5924. else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
  5925. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_remove_triples); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 376, __pyx_L1_error)
  5926. __Pyx_GOTREF(__pyx_t_1);
  5927. if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_39remove_triples)) {
  5928. __Pyx_INCREF(__pyx_t_1);
  5929. __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
  5930. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  5931. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
  5932. if (likely(__pyx_t_4)) {
  5933. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  5934. __Pyx_INCREF(__pyx_t_4);
  5935. __Pyx_INCREF(function);
  5936. __Pyx_DECREF_SET(__pyx_t_3, function);
  5937. }
  5938. }
  5939. if (!__pyx_t_4) {
  5940. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_pattern); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 376, __pyx_L1_error)
  5941. __Pyx_GOTREF(__pyx_t_2);
  5942. } else {
  5943. #if CYTHON_FAST_PYCALL
  5944. if (PyFunction_Check(__pyx_t_3)) {
  5945. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_pattern};
  5946. __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 376, __pyx_L1_error)
  5947. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  5948. __Pyx_GOTREF(__pyx_t_2);
  5949. } else
  5950. #endif
  5951. #if CYTHON_FAST_PYCCALL
  5952. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  5953. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_pattern};
  5954. __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 376, __pyx_L1_error)
  5955. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  5956. __Pyx_GOTREF(__pyx_t_2);
  5957. } else
  5958. #endif
  5959. {
  5960. __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 376, __pyx_L1_error)
  5961. __Pyx_GOTREF(__pyx_t_5);
  5962. __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
  5963. __Pyx_INCREF(__pyx_v_pattern);
  5964. __Pyx_GIVEREF(__pyx_v_pattern);
  5965. PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_pattern);
  5966. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 376, __pyx_L1_error)
  5967. __Pyx_GOTREF(__pyx_t_2);
  5968. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5969. }
  5970. }
  5971. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5972. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  5973. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5974. goto __pyx_L0;
  5975. }
  5976. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5977. }
  5978. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":382
  5979. * The pattern used is similar to :py:meth:`LmdbTripleStore.delete`.
  5980. * """
  5981. * s, p, o = pattern # <<<<<<<<<<<<<<
  5982. * for match in self.lookup(s, p, o):
  5983. * logger.debug(f'Removing from graph: {match}.')
  5984. */
  5985. if ((likely(PyTuple_CheckExact(__pyx_v_pattern))) || (PyList_CheckExact(__pyx_v_pattern))) {
  5986. PyObject* sequence = __pyx_v_pattern;
  5987. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  5988. if (unlikely(size != 3)) {
  5989. if (size > 3) __Pyx_RaiseTooManyValuesError(3);
  5990. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  5991. __PYX_ERR(0, 382, __pyx_L1_error)
  5992. }
  5993. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5994. if (likely(PyTuple_CheckExact(sequence))) {
  5995. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  5996. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  5997. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2);
  5998. } else {
  5999. __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
  6000. __pyx_t_2 = PyList_GET_ITEM(sequence, 1);
  6001. __pyx_t_3 = PyList_GET_ITEM(sequence, 2);
  6002. }
  6003. __Pyx_INCREF(__pyx_t_1);
  6004. __Pyx_INCREF(__pyx_t_2);
  6005. __Pyx_INCREF(__pyx_t_3);
  6006. #else
  6007. __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 382, __pyx_L1_error)
  6008. __Pyx_GOTREF(__pyx_t_1);
  6009. __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 382, __pyx_L1_error)
  6010. __Pyx_GOTREF(__pyx_t_2);
  6011. __pyx_t_3 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 382, __pyx_L1_error)
  6012. __Pyx_GOTREF(__pyx_t_3);
  6013. #endif
  6014. } else {
  6015. Py_ssize_t index = -1;
  6016. __pyx_t_5 = PyObject_GetIter(__pyx_v_pattern); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 382, __pyx_L1_error)
  6017. __Pyx_GOTREF(__pyx_t_5);
  6018. __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
  6019. index = 0; __pyx_t_1 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
  6020. __Pyx_GOTREF(__pyx_t_1);
  6021. index = 1; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  6022. __Pyx_GOTREF(__pyx_t_2);
  6023. index = 2; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
  6024. __Pyx_GOTREF(__pyx_t_3);
  6025. if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 3) < 0) __PYX_ERR(0, 382, __pyx_L1_error)
  6026. __pyx_t_6 = NULL;
  6027. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6028. goto __pyx_L4_unpacking_done;
  6029. __pyx_L3_unpacking_failed:;
  6030. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6031. __pyx_t_6 = NULL;
  6032. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  6033. __PYX_ERR(0, 382, __pyx_L1_error)
  6034. __pyx_L4_unpacking_done:;
  6035. }
  6036. __pyx_v_s = __pyx_t_1;
  6037. __pyx_t_1 = 0;
  6038. __pyx_v_p = __pyx_t_2;
  6039. __pyx_t_2 = 0;
  6040. __pyx_v_o = __pyx_t_3;
  6041. __pyx_t_3 = 0;
  6042. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":383
  6043. * """
  6044. * s, p, o = pattern
  6045. * for match in self.lookup(s, p, o): # <<<<<<<<<<<<<<
  6046. * logger.debug(f'Removing from graph: {match}.')
  6047. * self.data.remove(match)
  6048. */
  6049. __pyx_t_3 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self->__pyx_vtab)->lookup(__pyx_v_self, __pyx_v_s, __pyx_v_p, __pyx_v_o, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 383, __pyx_L1_error)
  6050. __Pyx_GOTREF(__pyx_t_3);
  6051. if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
  6052. __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0;
  6053. __pyx_t_8 = NULL;
  6054. } else {
  6055. __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 383, __pyx_L1_error)
  6056. __Pyx_GOTREF(__pyx_t_2);
  6057. __pyx_t_8 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 383, __pyx_L1_error)
  6058. }
  6059. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6060. for (;;) {
  6061. if (likely(!__pyx_t_8)) {
  6062. if (likely(PyList_CheckExact(__pyx_t_2))) {
  6063. if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_2)) break;
  6064. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  6065. __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 383, __pyx_L1_error)
  6066. #else
  6067. __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 383, __pyx_L1_error)
  6068. __Pyx_GOTREF(__pyx_t_3);
  6069. #endif
  6070. } else {
  6071. if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
  6072. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  6073. __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 383, __pyx_L1_error)
  6074. #else
  6075. __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 383, __pyx_L1_error)
  6076. __Pyx_GOTREF(__pyx_t_3);
  6077. #endif
  6078. }
  6079. } else {
  6080. __pyx_t_3 = __pyx_t_8(__pyx_t_2);
  6081. if (unlikely(!__pyx_t_3)) {
  6082. PyObject* exc_type = PyErr_Occurred();
  6083. if (exc_type) {
  6084. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  6085. else __PYX_ERR(0, 383, __pyx_L1_error)
  6086. }
  6087. break;
  6088. }
  6089. __Pyx_GOTREF(__pyx_t_3);
  6090. }
  6091. __Pyx_XDECREF_SET(__pyx_v_match, __pyx_t_3);
  6092. __pyx_t_3 = 0;
  6093. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":384
  6094. * s, p, o = pattern
  6095. * for match in self.lookup(s, p, o):
  6096. * logger.debug(f'Removing from graph: {match}.') # <<<<<<<<<<<<<<
  6097. * self.data.remove(match)
  6098. *
  6099. */
  6100. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 384, __pyx_L1_error)
  6101. __Pyx_GOTREF(__pyx_t_1);
  6102. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_debug); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 384, __pyx_L1_error)
  6103. __Pyx_GOTREF(__pyx_t_5);
  6104. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6105. __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 384, __pyx_L1_error)
  6106. __Pyx_GOTREF(__pyx_t_1);
  6107. __pyx_t_9 = 0;
  6108. __pyx_t_10 = 127;
  6109. __Pyx_INCREF(__pyx_kp_u_Removing_from_graph);
  6110. __pyx_t_9 += 21;
  6111. __Pyx_GIVEREF(__pyx_kp_u_Removing_from_graph);
  6112. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Removing_from_graph);
  6113. __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_match, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 384, __pyx_L1_error)
  6114. __Pyx_GOTREF(__pyx_t_4);
  6115. __pyx_t_10 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_10) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_10;
  6116. __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  6117. __Pyx_GIVEREF(__pyx_t_4);
  6118. PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
  6119. __pyx_t_4 = 0;
  6120. __Pyx_INCREF(__pyx_kp_u__11);
  6121. __pyx_t_9 += 1;
  6122. __Pyx_GIVEREF(__pyx_kp_u__11);
  6123. PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__11);
  6124. __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 384, __pyx_L1_error)
  6125. __Pyx_GOTREF(__pyx_t_4);
  6126. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6127. __pyx_t_1 = NULL;
  6128. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
  6129. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
  6130. if (likely(__pyx_t_1)) {
  6131. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
  6132. __Pyx_INCREF(__pyx_t_1);
  6133. __Pyx_INCREF(function);
  6134. __Pyx_DECREF_SET(__pyx_t_5, function);
  6135. }
  6136. }
  6137. if (!__pyx_t_1) {
  6138. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error)
  6139. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6140. __Pyx_GOTREF(__pyx_t_3);
  6141. } else {
  6142. #if CYTHON_FAST_PYCALL
  6143. if (PyFunction_Check(__pyx_t_5)) {
  6144. PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_4};
  6145. __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error)
  6146. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  6147. __Pyx_GOTREF(__pyx_t_3);
  6148. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6149. } else
  6150. #endif
  6151. #if CYTHON_FAST_PYCCALL
  6152. if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
  6153. PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_4};
  6154. __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error)
  6155. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  6156. __Pyx_GOTREF(__pyx_t_3);
  6157. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6158. } else
  6159. #endif
  6160. {
  6161. __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 384, __pyx_L1_error)
  6162. __Pyx_GOTREF(__pyx_t_11);
  6163. __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1); __pyx_t_1 = NULL;
  6164. __Pyx_GIVEREF(__pyx_t_4);
  6165. PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_4);
  6166. __pyx_t_4 = 0;
  6167. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error)
  6168. __Pyx_GOTREF(__pyx_t_3);
  6169. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  6170. }
  6171. }
  6172. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6173. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6174. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":385
  6175. * for match in self.lookup(s, p, o):
  6176. * logger.debug(f'Removing from graph: {match}.')
  6177. * self.data.remove(match) # <<<<<<<<<<<<<<
  6178. *
  6179. *
  6180. */
  6181. if (unlikely(__pyx_v_self->data == Py_None)) {
  6182. PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "remove");
  6183. __PYX_ERR(0, 385, __pyx_L1_error)
  6184. }
  6185. __pyx_t_12 = __Pyx_PySet_Remove(__pyx_v_self->data, __pyx_v_match); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 385, __pyx_L1_error)
  6186. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":383
  6187. * """
  6188. * s, p, o = pattern
  6189. * for match in self.lookup(s, p, o): # <<<<<<<<<<<<<<
  6190. * logger.debug(f'Removing from graph: {match}.')
  6191. * self.data.remove(match)
  6192. */
  6193. }
  6194. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6195. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":376
  6196. *
  6197. *
  6198. * cpdef void remove_triples(self, pattern) except *: # <<<<<<<<<<<<<<
  6199. * """
  6200. * Remove triples by pattern.
  6201. */
  6202. /* function exit code */
  6203. goto __pyx_L0;
  6204. __pyx_L1_error:;
  6205. __Pyx_XDECREF(__pyx_t_1);
  6206. __Pyx_XDECREF(__pyx_t_2);
  6207. __Pyx_XDECREF(__pyx_t_3);
  6208. __Pyx_XDECREF(__pyx_t_4);
  6209. __Pyx_XDECREF(__pyx_t_5);
  6210. __Pyx_XDECREF(__pyx_t_11);
  6211. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.remove_triples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6212. __pyx_L0:;
  6213. __Pyx_XDECREF(__pyx_v_s);
  6214. __Pyx_XDECREF(__pyx_v_p);
  6215. __Pyx_XDECREF(__pyx_v_o);
  6216. __Pyx_XDECREF(__pyx_v_match);
  6217. __Pyx_TraceReturn(Py_None, 0);
  6218. __Pyx_RefNannyFinishContext();
  6219. }
  6220. /* Python wrapper */
  6221. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_39remove_triples(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/
  6222. static char __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_38remove_triples[] = "\n Remove triples by pattern.\n\n The pattern used is similar to :py:meth:`LmdbTripleStore.delete`.\n ";
  6223. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_39remove_triples(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) {
  6224. PyObject *__pyx_r = 0;
  6225. __Pyx_RefNannyDeclarations
  6226. __Pyx_RefNannySetupContext("remove_triples (wrapper)", 0);
  6227. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_38remove_triples(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self), ((PyObject *)__pyx_v_pattern));
  6228. /* function exit code */
  6229. __Pyx_RefNannyFinishContext();
  6230. return __pyx_r;
  6231. }
  6232. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_38remove_triples(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_pattern) {
  6233. PyObject *__pyx_r = NULL;
  6234. __Pyx_TraceDeclarations
  6235. __Pyx_RefNannyDeclarations
  6236. PyObject *__pyx_t_1 = NULL;
  6237. __Pyx_RefNannySetupContext("remove_triples", 0);
  6238. __Pyx_TraceCall("remove_triples (wrapper)", __pyx_f[0], 376, 0, __PYX_ERR(0, 376, __pyx_L1_error));
  6239. __Pyx_XDECREF(__pyx_r);
  6240. __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_remove_triples(__pyx_v_self, __pyx_v_pattern, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 376, __pyx_L1_error)
  6241. __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 376, __pyx_L1_error)
  6242. __Pyx_GOTREF(__pyx_t_1);
  6243. __pyx_r = __pyx_t_1;
  6244. __pyx_t_1 = 0;
  6245. goto __pyx_L0;
  6246. /* function exit code */
  6247. __pyx_L1_error:;
  6248. __Pyx_XDECREF(__pyx_t_1);
  6249. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.remove_triples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6250. __pyx_r = NULL;
  6251. __pyx_L0:;
  6252. __Pyx_XGIVEREF(__pyx_r);
  6253. __Pyx_TraceReturn(__pyx_r, 0);
  6254. __Pyx_RefNannyFinishContext();
  6255. return __pyx_r;
  6256. }
  6257. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":388
  6258. *
  6259. *
  6260. * cpdef object as_rdflib(self): # <<<<<<<<<<<<<<
  6261. * """
  6262. * Return the data set as an RDFLib Graph.
  6263. */
  6264. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_41as_rdflib(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  6265. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_as_rdflib(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, int __pyx_skip_dispatch) {
  6266. PyObject *__pyx_v_gr = NULL;
  6267. PyObject *__pyx_v_trp = NULL;
  6268. PyObject *__pyx_r = NULL;
  6269. __Pyx_TraceDeclarations
  6270. __Pyx_RefNannyDeclarations
  6271. PyObject *__pyx_t_1 = NULL;
  6272. PyObject *__pyx_t_2 = NULL;
  6273. PyObject *__pyx_t_3 = NULL;
  6274. PyObject *__pyx_t_4 = NULL;
  6275. Py_ssize_t __pyx_t_5;
  6276. Py_ssize_t __pyx_t_6;
  6277. int __pyx_t_7;
  6278. int __pyx_t_8;
  6279. PyObject *__pyx_t_9 = NULL;
  6280. __Pyx_RefNannySetupContext("as_rdflib", 0);
  6281. __Pyx_TraceCall("as_rdflib", __pyx_f[0], 388, 0, __PYX_ERR(0, 388, __pyx_L1_error));
  6282. /* Check if called by wrapper */
  6283. if (unlikely(__pyx_skip_dispatch)) ;
  6284. /* Check if overridden in Python */
  6285. else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
  6286. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_as_rdflib); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 388, __pyx_L1_error)
  6287. __Pyx_GOTREF(__pyx_t_1);
  6288. if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_41as_rdflib)) {
  6289. __Pyx_XDECREF(__pyx_r);
  6290. __Pyx_INCREF(__pyx_t_1);
  6291. __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
  6292. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  6293. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
  6294. if (likely(__pyx_t_4)) {
  6295. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  6296. __Pyx_INCREF(__pyx_t_4);
  6297. __Pyx_INCREF(function);
  6298. __Pyx_DECREF_SET(__pyx_t_3, function);
  6299. }
  6300. }
  6301. if (__pyx_t_4) {
  6302. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 388, __pyx_L1_error)
  6303. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6304. } else {
  6305. __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 388, __pyx_L1_error)
  6306. }
  6307. __Pyx_GOTREF(__pyx_t_2);
  6308. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6309. __pyx_r = __pyx_t_2;
  6310. __pyx_t_2 = 0;
  6311. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6312. goto __pyx_L0;
  6313. }
  6314. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6315. }
  6316. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":393
  6317. * :rtype: rdflib.Graph
  6318. * """
  6319. * gr = Graph() # <<<<<<<<<<<<<<
  6320. * for trp in self.data:
  6321. * gr.add(trp)
  6322. */
  6323. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Graph); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 393, __pyx_L1_error)
  6324. __Pyx_GOTREF(__pyx_t_2);
  6325. __pyx_t_3 = NULL;
  6326. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
  6327. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  6328. if (likely(__pyx_t_3)) {
  6329. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  6330. __Pyx_INCREF(__pyx_t_3);
  6331. __Pyx_INCREF(function);
  6332. __Pyx_DECREF_SET(__pyx_t_2, function);
  6333. }
  6334. }
  6335. if (__pyx_t_3) {
  6336. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 393, __pyx_L1_error)
  6337. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6338. } else {
  6339. __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 393, __pyx_L1_error)
  6340. }
  6341. __Pyx_GOTREF(__pyx_t_1);
  6342. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6343. __pyx_v_gr = __pyx_t_1;
  6344. __pyx_t_1 = 0;
  6345. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":394
  6346. * """
  6347. * gr = Graph()
  6348. * for trp in self.data: # <<<<<<<<<<<<<<
  6349. * gr.add(trp)
  6350. *
  6351. */
  6352. __pyx_t_5 = 0;
  6353. __pyx_t_2 = __Pyx_set_iterator(__pyx_v_self->data, 1, (&__pyx_t_6), (&__pyx_t_7)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 394, __pyx_L1_error)
  6354. __Pyx_GOTREF(__pyx_t_2);
  6355. __Pyx_XDECREF(__pyx_t_1);
  6356. __pyx_t_1 = __pyx_t_2;
  6357. __pyx_t_2 = 0;
  6358. while (1) {
  6359. __pyx_t_8 = __Pyx_set_iter_next(__pyx_t_1, __pyx_t_6, &__pyx_t_5, &__pyx_t_2, __pyx_t_7);
  6360. if (unlikely(__pyx_t_8 == 0)) break;
  6361. if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 394, __pyx_L1_error)
  6362. __Pyx_GOTREF(__pyx_t_2);
  6363. __Pyx_XDECREF_SET(__pyx_v_trp, __pyx_t_2);
  6364. __pyx_t_2 = 0;
  6365. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":395
  6366. * gr = Graph()
  6367. * for trp in self.data:
  6368. * gr.add(trp) # <<<<<<<<<<<<<<
  6369. *
  6370. * return gr
  6371. */
  6372. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_gr, __pyx_n_s_add); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 395, __pyx_L1_error)
  6373. __Pyx_GOTREF(__pyx_t_3);
  6374. __pyx_t_4 = NULL;
  6375. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
  6376. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
  6377. if (likely(__pyx_t_4)) {
  6378. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  6379. __Pyx_INCREF(__pyx_t_4);
  6380. __Pyx_INCREF(function);
  6381. __Pyx_DECREF_SET(__pyx_t_3, function);
  6382. }
  6383. }
  6384. if (!__pyx_t_4) {
  6385. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_trp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 395, __pyx_L1_error)
  6386. __Pyx_GOTREF(__pyx_t_2);
  6387. } else {
  6388. #if CYTHON_FAST_PYCALL
  6389. if (PyFunction_Check(__pyx_t_3)) {
  6390. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_trp};
  6391. __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 395, __pyx_L1_error)
  6392. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  6393. __Pyx_GOTREF(__pyx_t_2);
  6394. } else
  6395. #endif
  6396. #if CYTHON_FAST_PYCCALL
  6397. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  6398. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_trp};
  6399. __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 395, __pyx_L1_error)
  6400. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  6401. __Pyx_GOTREF(__pyx_t_2);
  6402. } else
  6403. #endif
  6404. {
  6405. __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 395, __pyx_L1_error)
  6406. __Pyx_GOTREF(__pyx_t_9);
  6407. __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL;
  6408. __Pyx_INCREF(__pyx_v_trp);
  6409. __Pyx_GIVEREF(__pyx_v_trp);
  6410. PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_trp);
  6411. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 395, __pyx_L1_error)
  6412. __Pyx_GOTREF(__pyx_t_2);
  6413. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6414. }
  6415. }
  6416. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6417. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6418. }
  6419. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6420. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":397
  6421. * gr.add(trp)
  6422. *
  6423. * return gr # <<<<<<<<<<<<<<
  6424. *
  6425. *
  6426. */
  6427. __Pyx_XDECREF(__pyx_r);
  6428. __Pyx_INCREF(__pyx_v_gr);
  6429. __pyx_r = __pyx_v_gr;
  6430. goto __pyx_L0;
  6431. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":388
  6432. *
  6433. *
  6434. * cpdef object as_rdflib(self): # <<<<<<<<<<<<<<
  6435. * """
  6436. * Return the data set as an RDFLib Graph.
  6437. */
  6438. /* function exit code */
  6439. __pyx_L1_error:;
  6440. __Pyx_XDECREF(__pyx_t_1);
  6441. __Pyx_XDECREF(__pyx_t_2);
  6442. __Pyx_XDECREF(__pyx_t_3);
  6443. __Pyx_XDECREF(__pyx_t_4);
  6444. __Pyx_XDECREF(__pyx_t_9);
  6445. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.as_rdflib", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6446. __pyx_r = 0;
  6447. __pyx_L0:;
  6448. __Pyx_XDECREF(__pyx_v_gr);
  6449. __Pyx_XDECREF(__pyx_v_trp);
  6450. __Pyx_XGIVEREF(__pyx_r);
  6451. __Pyx_TraceReturn(__pyx_r, 0);
  6452. __Pyx_RefNannyFinishContext();
  6453. return __pyx_r;
  6454. }
  6455. /* Python wrapper */
  6456. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_41as_rdflib(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  6457. static char __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_40as_rdflib[] = "\n Return the data set as an RDFLib Graph.\n :rtype: rdflib.Graph\n ";
  6458. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_41as_rdflib(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  6459. PyObject *__pyx_r = 0;
  6460. __Pyx_RefNannyDeclarations
  6461. __Pyx_RefNannySetupContext("as_rdflib (wrapper)", 0);
  6462. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_40as_rdflib(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self));
  6463. /* function exit code */
  6464. __Pyx_RefNannyFinishContext();
  6465. return __pyx_r;
  6466. }
  6467. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_40as_rdflib(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self) {
  6468. PyObject *__pyx_r = NULL;
  6469. __Pyx_TraceDeclarations
  6470. __Pyx_RefNannyDeclarations
  6471. PyObject *__pyx_t_1 = NULL;
  6472. __Pyx_RefNannySetupContext("as_rdflib", 0);
  6473. __Pyx_TraceCall("as_rdflib (wrapper)", __pyx_f[0], 388, 0, __PYX_ERR(0, 388, __pyx_L1_error));
  6474. __Pyx_XDECREF(__pyx_r);
  6475. __pyx_t_1 = __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_as_rdflib(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 388, __pyx_L1_error)
  6476. __Pyx_GOTREF(__pyx_t_1);
  6477. __pyx_r = __pyx_t_1;
  6478. __pyx_t_1 = 0;
  6479. goto __pyx_L0;
  6480. /* function exit code */
  6481. __pyx_L1_error:;
  6482. __Pyx_XDECREF(__pyx_t_1);
  6483. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.as_rdflib", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6484. __pyx_r = NULL;
  6485. __pyx_L0:;
  6486. __Pyx_XGIVEREF(__pyx_r);
  6487. __Pyx_TraceReturn(__pyx_r, 0);
  6488. __Pyx_RefNannyFinishContext();
  6489. return __pyx_r;
  6490. }
  6491. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":400
  6492. *
  6493. *
  6494. * cdef _slice(self, s, p, o): # <<<<<<<<<<<<<<
  6495. * """
  6496. * Return terms filtered by other terms.
  6497. */
  6498. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph__slice(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_s, PyObject *__pyx_v_p, PyObject *__pyx_v_o) {
  6499. PyObject *__pyx_8genexpr1__pyx_v_r = NULL;
  6500. PyObject *__pyx_8genexpr2__pyx_v_r = NULL;
  6501. PyObject *__pyx_8genexpr3__pyx_v_r = NULL;
  6502. PyObject *__pyx_8genexpr4__pyx_v_r = NULL;
  6503. PyObject *__pyx_8genexpr5__pyx_v_r = NULL;
  6504. PyObject *__pyx_8genexpr6__pyx_v_r = NULL;
  6505. PyObject *__pyx_r = NULL;
  6506. __Pyx_TraceDeclarations
  6507. __Pyx_RefNannyDeclarations
  6508. int __pyx_t_1;
  6509. int __pyx_t_2;
  6510. int __pyx_t_3;
  6511. PyObject *__pyx_t_4 = NULL;
  6512. PyObject *__pyx_t_5 = NULL;
  6513. Py_ssize_t __pyx_t_6;
  6514. Py_ssize_t __pyx_t_7;
  6515. int __pyx_t_8;
  6516. PyObject *__pyx_t_9 = NULL;
  6517. int __pyx_t_10;
  6518. PyObject *__pyx_t_11 = NULL;
  6519. PyObject *__pyx_t_12 = NULL;
  6520. __Pyx_RefNannySetupContext("_slice", 0);
  6521. __Pyx_TraceCall("_slice", __pyx_f[0], 400, 0, __PYX_ERR(0, 400, __pyx_L1_error));
  6522. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":406
  6523. * This behaves like the rdflib.Graph slicing policy.
  6524. * """
  6525. * if s is None and p is None and o is None: # <<<<<<<<<<<<<<
  6526. * return self.data
  6527. * elif s is None and p is None:
  6528. */
  6529. __pyx_t_2 = (__pyx_v_s == Py_None);
  6530. __pyx_t_3 = (__pyx_t_2 != 0);
  6531. if (__pyx_t_3) {
  6532. } else {
  6533. __pyx_t_1 = __pyx_t_3;
  6534. goto __pyx_L4_bool_binop_done;
  6535. }
  6536. __pyx_t_3 = (__pyx_v_p == Py_None);
  6537. __pyx_t_2 = (__pyx_t_3 != 0);
  6538. if (__pyx_t_2) {
  6539. } else {
  6540. __pyx_t_1 = __pyx_t_2;
  6541. goto __pyx_L4_bool_binop_done;
  6542. }
  6543. __pyx_t_2 = (__pyx_v_o == Py_None);
  6544. __pyx_t_3 = (__pyx_t_2 != 0);
  6545. __pyx_t_1 = __pyx_t_3;
  6546. __pyx_L4_bool_binop_done:;
  6547. if (__pyx_t_1) {
  6548. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":407
  6549. * """
  6550. * if s is None and p is None and o is None:
  6551. * return self.data # <<<<<<<<<<<<<<
  6552. * elif s is None and p is None:
  6553. * return {(r[0], r[1]) for r in self.data if r[2] == o}
  6554. */
  6555. __Pyx_XDECREF(__pyx_r);
  6556. __Pyx_INCREF(__pyx_v_self->data);
  6557. __pyx_r = __pyx_v_self->data;
  6558. goto __pyx_L0;
  6559. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":406
  6560. * This behaves like the rdflib.Graph slicing policy.
  6561. * """
  6562. * if s is None and p is None and o is None: # <<<<<<<<<<<<<<
  6563. * return self.data
  6564. * elif s is None and p is None:
  6565. */
  6566. }
  6567. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":408
  6568. * if s is None and p is None and o is None:
  6569. * return self.data
  6570. * elif s is None and p is None: # <<<<<<<<<<<<<<
  6571. * return {(r[0], r[1]) for r in self.data if r[2] == o}
  6572. * elif s is None and o is None:
  6573. */
  6574. __pyx_t_3 = (__pyx_v_s == Py_None);
  6575. __pyx_t_2 = (__pyx_t_3 != 0);
  6576. if (__pyx_t_2) {
  6577. } else {
  6578. __pyx_t_1 = __pyx_t_2;
  6579. goto __pyx_L7_bool_binop_done;
  6580. }
  6581. __pyx_t_2 = (__pyx_v_p == Py_None);
  6582. __pyx_t_3 = (__pyx_t_2 != 0);
  6583. __pyx_t_1 = __pyx_t_3;
  6584. __pyx_L7_bool_binop_done:;
  6585. if (__pyx_t_1) {
  6586. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":409
  6587. * return self.data
  6588. * elif s is None and p is None:
  6589. * return {(r[0], r[1]) for r in self.data if r[2] == o} # <<<<<<<<<<<<<<
  6590. * elif s is None and o is None:
  6591. * return {(r[0], r[2]) for r in self.data if r[1] == p}
  6592. */
  6593. __Pyx_XDECREF(__pyx_r);
  6594. { /* enter inner scope */
  6595. __pyx_t_4 = PySet_New(NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 409, __pyx_L11_error)
  6596. __Pyx_GOTREF(__pyx_t_4);
  6597. __pyx_t_6 = 0;
  6598. __pyx_t_9 = __Pyx_set_iterator(__pyx_v_self->data, 1, (&__pyx_t_7), (&__pyx_t_8)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 409, __pyx_L11_error)
  6599. __Pyx_GOTREF(__pyx_t_9);
  6600. __Pyx_XDECREF(__pyx_t_5);
  6601. __pyx_t_5 = __pyx_t_9;
  6602. __pyx_t_9 = 0;
  6603. while (1) {
  6604. __pyx_t_10 = __Pyx_set_iter_next(__pyx_t_5, __pyx_t_7, &__pyx_t_6, &__pyx_t_9, __pyx_t_8);
  6605. if (unlikely(__pyx_t_10 == 0)) break;
  6606. if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 409, __pyx_L11_error)
  6607. __Pyx_GOTREF(__pyx_t_9);
  6608. __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_r, __pyx_t_9);
  6609. __pyx_t_9 = 0;
  6610. __pyx_t_9 = __Pyx_GetItemInt(__pyx_8genexpr1__pyx_v_r, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 409, __pyx_L11_error)
  6611. __Pyx_GOTREF(__pyx_t_9);
  6612. __pyx_t_11 = PyObject_RichCompare(__pyx_t_9, __pyx_v_o, Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 409, __pyx_L11_error)
  6613. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6614. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 409, __pyx_L11_error)
  6615. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  6616. if (__pyx_t_1) {
  6617. __pyx_t_11 = __Pyx_GetItemInt(__pyx_8genexpr1__pyx_v_r, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 409, __pyx_L11_error)
  6618. __Pyx_GOTREF(__pyx_t_11);
  6619. __pyx_t_9 = __Pyx_GetItemInt(__pyx_8genexpr1__pyx_v_r, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 409, __pyx_L11_error)
  6620. __Pyx_GOTREF(__pyx_t_9);
  6621. __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 409, __pyx_L11_error)
  6622. __Pyx_GOTREF(__pyx_t_12);
  6623. __Pyx_GIVEREF(__pyx_t_11);
  6624. PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11);
  6625. __Pyx_GIVEREF(__pyx_t_9);
  6626. PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_9);
  6627. __pyx_t_11 = 0;
  6628. __pyx_t_9 = 0;
  6629. if (unlikely(PySet_Add(__pyx_t_4, (PyObject*)__pyx_t_12))) __PYX_ERR(0, 409, __pyx_L11_error)
  6630. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  6631. }
  6632. }
  6633. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6634. __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_r); __pyx_8genexpr1__pyx_v_r = 0;
  6635. goto __pyx_L15_exit_scope;
  6636. __pyx_L11_error:;
  6637. __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_r); __pyx_8genexpr1__pyx_v_r = 0;
  6638. goto __pyx_L1_error;
  6639. __pyx_L15_exit_scope:;
  6640. } /* exit inner scope */
  6641. __pyx_r = __pyx_t_4;
  6642. __pyx_t_4 = 0;
  6643. goto __pyx_L0;
  6644. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":408
  6645. * if s is None and p is None and o is None:
  6646. * return self.data
  6647. * elif s is None and p is None: # <<<<<<<<<<<<<<
  6648. * return {(r[0], r[1]) for r in self.data if r[2] == o}
  6649. * elif s is None and o is None:
  6650. */
  6651. }
  6652. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":410
  6653. * elif s is None and p is None:
  6654. * return {(r[0], r[1]) for r in self.data if r[2] == o}
  6655. * elif s is None and o is None: # <<<<<<<<<<<<<<
  6656. * return {(r[0], r[2]) for r in self.data if r[1] == p}
  6657. * elif p is None and o is None:
  6658. */
  6659. __pyx_t_3 = (__pyx_v_s == Py_None);
  6660. __pyx_t_2 = (__pyx_t_3 != 0);
  6661. if (__pyx_t_2) {
  6662. } else {
  6663. __pyx_t_1 = __pyx_t_2;
  6664. goto __pyx_L16_bool_binop_done;
  6665. }
  6666. __pyx_t_2 = (__pyx_v_o == Py_None);
  6667. __pyx_t_3 = (__pyx_t_2 != 0);
  6668. __pyx_t_1 = __pyx_t_3;
  6669. __pyx_L16_bool_binop_done:;
  6670. if (__pyx_t_1) {
  6671. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":411
  6672. * return {(r[0], r[1]) for r in self.data if r[2] == o}
  6673. * elif s is None and o is None:
  6674. * return {(r[0], r[2]) for r in self.data if r[1] == p} # <<<<<<<<<<<<<<
  6675. * elif p is None and o is None:
  6676. * return {(r[1], r[2]) for r in self.data if r[0] == s}
  6677. */
  6678. __Pyx_XDECREF(__pyx_r);
  6679. { /* enter inner scope */
  6680. __pyx_t_4 = PySet_New(NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 411, __pyx_L20_error)
  6681. __Pyx_GOTREF(__pyx_t_4);
  6682. __pyx_t_7 = 0;
  6683. __pyx_t_12 = __Pyx_set_iterator(__pyx_v_self->data, 1, (&__pyx_t_6), (&__pyx_t_8)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 411, __pyx_L20_error)
  6684. __Pyx_GOTREF(__pyx_t_12);
  6685. __Pyx_XDECREF(__pyx_t_5);
  6686. __pyx_t_5 = __pyx_t_12;
  6687. __pyx_t_12 = 0;
  6688. while (1) {
  6689. __pyx_t_10 = __Pyx_set_iter_next(__pyx_t_5, __pyx_t_6, &__pyx_t_7, &__pyx_t_12, __pyx_t_8);
  6690. if (unlikely(__pyx_t_10 == 0)) break;
  6691. if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 411, __pyx_L20_error)
  6692. __Pyx_GOTREF(__pyx_t_12);
  6693. __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_r, __pyx_t_12);
  6694. __pyx_t_12 = 0;
  6695. __pyx_t_12 = __Pyx_GetItemInt(__pyx_8genexpr2__pyx_v_r, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 411, __pyx_L20_error)
  6696. __Pyx_GOTREF(__pyx_t_12);
  6697. __pyx_t_9 = PyObject_RichCompare(__pyx_t_12, __pyx_v_p, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 411, __pyx_L20_error)
  6698. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  6699. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 411, __pyx_L20_error)
  6700. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6701. if (__pyx_t_1) {
  6702. __pyx_t_9 = __Pyx_GetItemInt(__pyx_8genexpr2__pyx_v_r, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 411, __pyx_L20_error)
  6703. __Pyx_GOTREF(__pyx_t_9);
  6704. __pyx_t_12 = __Pyx_GetItemInt(__pyx_8genexpr2__pyx_v_r, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 411, __pyx_L20_error)
  6705. __Pyx_GOTREF(__pyx_t_12);
  6706. __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 411, __pyx_L20_error)
  6707. __Pyx_GOTREF(__pyx_t_11);
  6708. __Pyx_GIVEREF(__pyx_t_9);
  6709. PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9);
  6710. __Pyx_GIVEREF(__pyx_t_12);
  6711. PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_12);
  6712. __pyx_t_9 = 0;
  6713. __pyx_t_12 = 0;
  6714. if (unlikely(PySet_Add(__pyx_t_4, (PyObject*)__pyx_t_11))) __PYX_ERR(0, 411, __pyx_L20_error)
  6715. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  6716. }
  6717. }
  6718. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6719. __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_r); __pyx_8genexpr2__pyx_v_r = 0;
  6720. goto __pyx_L24_exit_scope;
  6721. __pyx_L20_error:;
  6722. __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_r); __pyx_8genexpr2__pyx_v_r = 0;
  6723. goto __pyx_L1_error;
  6724. __pyx_L24_exit_scope:;
  6725. } /* exit inner scope */
  6726. __pyx_r = __pyx_t_4;
  6727. __pyx_t_4 = 0;
  6728. goto __pyx_L0;
  6729. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":410
  6730. * elif s is None and p is None:
  6731. * return {(r[0], r[1]) for r in self.data if r[2] == o}
  6732. * elif s is None and o is None: # <<<<<<<<<<<<<<
  6733. * return {(r[0], r[2]) for r in self.data if r[1] == p}
  6734. * elif p is None and o is None:
  6735. */
  6736. }
  6737. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":412
  6738. * elif s is None and o is None:
  6739. * return {(r[0], r[2]) for r in self.data if r[1] == p}
  6740. * elif p is None and o is None: # <<<<<<<<<<<<<<
  6741. * return {(r[1], r[2]) for r in self.data if r[0] == s}
  6742. * elif s is None:
  6743. */
  6744. __pyx_t_3 = (__pyx_v_p == Py_None);
  6745. __pyx_t_2 = (__pyx_t_3 != 0);
  6746. if (__pyx_t_2) {
  6747. } else {
  6748. __pyx_t_1 = __pyx_t_2;
  6749. goto __pyx_L25_bool_binop_done;
  6750. }
  6751. __pyx_t_2 = (__pyx_v_o == Py_None);
  6752. __pyx_t_3 = (__pyx_t_2 != 0);
  6753. __pyx_t_1 = __pyx_t_3;
  6754. __pyx_L25_bool_binop_done:;
  6755. if (__pyx_t_1) {
  6756. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":413
  6757. * return {(r[0], r[2]) for r in self.data if r[1] == p}
  6758. * elif p is None and o is None:
  6759. * return {(r[1], r[2]) for r in self.data if r[0] == s} # <<<<<<<<<<<<<<
  6760. * elif s is None:
  6761. * return {r[0] for r in self.data if r[1] == p and r[2] == o}
  6762. */
  6763. __Pyx_XDECREF(__pyx_r);
  6764. { /* enter inner scope */
  6765. __pyx_t_4 = PySet_New(NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 413, __pyx_L29_error)
  6766. __Pyx_GOTREF(__pyx_t_4);
  6767. __pyx_t_6 = 0;
  6768. __pyx_t_11 = __Pyx_set_iterator(__pyx_v_self->data, 1, (&__pyx_t_7), (&__pyx_t_8)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 413, __pyx_L29_error)
  6769. __Pyx_GOTREF(__pyx_t_11);
  6770. __Pyx_XDECREF(__pyx_t_5);
  6771. __pyx_t_5 = __pyx_t_11;
  6772. __pyx_t_11 = 0;
  6773. while (1) {
  6774. __pyx_t_10 = __Pyx_set_iter_next(__pyx_t_5, __pyx_t_7, &__pyx_t_6, &__pyx_t_11, __pyx_t_8);
  6775. if (unlikely(__pyx_t_10 == 0)) break;
  6776. if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 413, __pyx_L29_error)
  6777. __Pyx_GOTREF(__pyx_t_11);
  6778. __Pyx_XDECREF_SET(__pyx_8genexpr3__pyx_v_r, __pyx_t_11);
  6779. __pyx_t_11 = 0;
  6780. __pyx_t_11 = __Pyx_GetItemInt(__pyx_8genexpr3__pyx_v_r, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 413, __pyx_L29_error)
  6781. __Pyx_GOTREF(__pyx_t_11);
  6782. __pyx_t_12 = PyObject_RichCompare(__pyx_t_11, __pyx_v_s, Py_EQ); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 413, __pyx_L29_error)
  6783. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  6784. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 413, __pyx_L29_error)
  6785. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  6786. if (__pyx_t_1) {
  6787. __pyx_t_12 = __Pyx_GetItemInt(__pyx_8genexpr3__pyx_v_r, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 413, __pyx_L29_error)
  6788. __Pyx_GOTREF(__pyx_t_12);
  6789. __pyx_t_11 = __Pyx_GetItemInt(__pyx_8genexpr3__pyx_v_r, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 413, __pyx_L29_error)
  6790. __Pyx_GOTREF(__pyx_t_11);
  6791. __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 413, __pyx_L29_error)
  6792. __Pyx_GOTREF(__pyx_t_9);
  6793. __Pyx_GIVEREF(__pyx_t_12);
  6794. PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_12);
  6795. __Pyx_GIVEREF(__pyx_t_11);
  6796. PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_11);
  6797. __pyx_t_12 = 0;
  6798. __pyx_t_11 = 0;
  6799. if (unlikely(PySet_Add(__pyx_t_4, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 413, __pyx_L29_error)
  6800. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6801. }
  6802. }
  6803. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6804. __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_r); __pyx_8genexpr3__pyx_v_r = 0;
  6805. goto __pyx_L33_exit_scope;
  6806. __pyx_L29_error:;
  6807. __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_r); __pyx_8genexpr3__pyx_v_r = 0;
  6808. goto __pyx_L1_error;
  6809. __pyx_L33_exit_scope:;
  6810. } /* exit inner scope */
  6811. __pyx_r = __pyx_t_4;
  6812. __pyx_t_4 = 0;
  6813. goto __pyx_L0;
  6814. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":412
  6815. * elif s is None and o is None:
  6816. * return {(r[0], r[2]) for r in self.data if r[1] == p}
  6817. * elif p is None and o is None: # <<<<<<<<<<<<<<
  6818. * return {(r[1], r[2]) for r in self.data if r[0] == s}
  6819. * elif s is None:
  6820. */
  6821. }
  6822. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":414
  6823. * elif p is None and o is None:
  6824. * return {(r[1], r[2]) for r in self.data if r[0] == s}
  6825. * elif s is None: # <<<<<<<<<<<<<<
  6826. * return {r[0] for r in self.data if r[1] == p and r[2] == o}
  6827. * elif p is None:
  6828. */
  6829. __pyx_t_1 = (__pyx_v_s == Py_None);
  6830. __pyx_t_3 = (__pyx_t_1 != 0);
  6831. if (__pyx_t_3) {
  6832. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":415
  6833. * return {(r[1], r[2]) for r in self.data if r[0] == s}
  6834. * elif s is None:
  6835. * return {r[0] for r in self.data if r[1] == p and r[2] == o} # <<<<<<<<<<<<<<
  6836. * elif p is None:
  6837. * return {r[1] for r in self.data if r[0] == s and r[2] == o}
  6838. */
  6839. __Pyx_XDECREF(__pyx_r);
  6840. { /* enter inner scope */
  6841. __pyx_t_4 = PySet_New(NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 415, __pyx_L36_error)
  6842. __Pyx_GOTREF(__pyx_t_4);
  6843. __pyx_t_7 = 0;
  6844. __pyx_t_9 = __Pyx_set_iterator(__pyx_v_self->data, 1, (&__pyx_t_6), (&__pyx_t_8)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 415, __pyx_L36_error)
  6845. __Pyx_GOTREF(__pyx_t_9);
  6846. __Pyx_XDECREF(__pyx_t_5);
  6847. __pyx_t_5 = __pyx_t_9;
  6848. __pyx_t_9 = 0;
  6849. while (1) {
  6850. __pyx_t_10 = __Pyx_set_iter_next(__pyx_t_5, __pyx_t_6, &__pyx_t_7, &__pyx_t_9, __pyx_t_8);
  6851. if (unlikely(__pyx_t_10 == 0)) break;
  6852. if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 415, __pyx_L36_error)
  6853. __Pyx_GOTREF(__pyx_t_9);
  6854. __Pyx_XDECREF_SET(__pyx_8genexpr4__pyx_v_r, __pyx_t_9);
  6855. __pyx_t_9 = 0;
  6856. __pyx_t_9 = __Pyx_GetItemInt(__pyx_8genexpr4__pyx_v_r, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 415, __pyx_L36_error)
  6857. __Pyx_GOTREF(__pyx_t_9);
  6858. __pyx_t_11 = PyObject_RichCompare(__pyx_t_9, __pyx_v_p, Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 415, __pyx_L36_error)
  6859. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6860. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 415, __pyx_L36_error)
  6861. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  6862. if (__pyx_t_1) {
  6863. } else {
  6864. __pyx_t_3 = __pyx_t_1;
  6865. goto __pyx_L40_bool_binop_done;
  6866. }
  6867. __pyx_t_11 = __Pyx_GetItemInt(__pyx_8genexpr4__pyx_v_r, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 415, __pyx_L36_error)
  6868. __Pyx_GOTREF(__pyx_t_11);
  6869. __pyx_t_9 = PyObject_RichCompare(__pyx_t_11, __pyx_v_o, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 415, __pyx_L36_error)
  6870. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  6871. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 415, __pyx_L36_error)
  6872. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6873. __pyx_t_3 = __pyx_t_1;
  6874. __pyx_L40_bool_binop_done:;
  6875. if (__pyx_t_3) {
  6876. __pyx_t_9 = __Pyx_GetItemInt(__pyx_8genexpr4__pyx_v_r, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 415, __pyx_L36_error)
  6877. __Pyx_GOTREF(__pyx_t_9);
  6878. if (unlikely(PySet_Add(__pyx_t_4, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 415, __pyx_L36_error)
  6879. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6880. }
  6881. }
  6882. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6883. __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_r); __pyx_8genexpr4__pyx_v_r = 0;
  6884. goto __pyx_L42_exit_scope;
  6885. __pyx_L36_error:;
  6886. __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_r); __pyx_8genexpr4__pyx_v_r = 0;
  6887. goto __pyx_L1_error;
  6888. __pyx_L42_exit_scope:;
  6889. } /* exit inner scope */
  6890. __pyx_r = __pyx_t_4;
  6891. __pyx_t_4 = 0;
  6892. goto __pyx_L0;
  6893. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":414
  6894. * elif p is None and o is None:
  6895. * return {(r[1], r[2]) for r in self.data if r[0] == s}
  6896. * elif s is None: # <<<<<<<<<<<<<<
  6897. * return {r[0] for r in self.data if r[1] == p and r[2] == o}
  6898. * elif p is None:
  6899. */
  6900. }
  6901. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":416
  6902. * elif s is None:
  6903. * return {r[0] for r in self.data if r[1] == p and r[2] == o}
  6904. * elif p is None: # <<<<<<<<<<<<<<
  6905. * return {r[1] for r in self.data if r[0] == s and r[2] == o}
  6906. * elif o is None:
  6907. */
  6908. __pyx_t_3 = (__pyx_v_p == Py_None);
  6909. __pyx_t_1 = (__pyx_t_3 != 0);
  6910. if (__pyx_t_1) {
  6911. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":417
  6912. * return {r[0] for r in self.data if r[1] == p and r[2] == o}
  6913. * elif p is None:
  6914. * return {r[1] for r in self.data if r[0] == s and r[2] == o} # <<<<<<<<<<<<<<
  6915. * elif o is None:
  6916. * return {r[2] for r in self.data if r[0] == s and r[1] == p}
  6917. */
  6918. __Pyx_XDECREF(__pyx_r);
  6919. { /* enter inner scope */
  6920. __pyx_t_4 = PySet_New(NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 417, __pyx_L45_error)
  6921. __Pyx_GOTREF(__pyx_t_4);
  6922. __pyx_t_6 = 0;
  6923. __pyx_t_9 = __Pyx_set_iterator(__pyx_v_self->data, 1, (&__pyx_t_7), (&__pyx_t_8)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 417, __pyx_L45_error)
  6924. __Pyx_GOTREF(__pyx_t_9);
  6925. __Pyx_XDECREF(__pyx_t_5);
  6926. __pyx_t_5 = __pyx_t_9;
  6927. __pyx_t_9 = 0;
  6928. while (1) {
  6929. __pyx_t_10 = __Pyx_set_iter_next(__pyx_t_5, __pyx_t_7, &__pyx_t_6, &__pyx_t_9, __pyx_t_8);
  6930. if (unlikely(__pyx_t_10 == 0)) break;
  6931. if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 417, __pyx_L45_error)
  6932. __Pyx_GOTREF(__pyx_t_9);
  6933. __Pyx_XDECREF_SET(__pyx_8genexpr5__pyx_v_r, __pyx_t_9);
  6934. __pyx_t_9 = 0;
  6935. __pyx_t_9 = __Pyx_GetItemInt(__pyx_8genexpr5__pyx_v_r, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 417, __pyx_L45_error)
  6936. __Pyx_GOTREF(__pyx_t_9);
  6937. __pyx_t_11 = PyObject_RichCompare(__pyx_t_9, __pyx_v_s, Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 417, __pyx_L45_error)
  6938. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6939. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 417, __pyx_L45_error)
  6940. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  6941. if (__pyx_t_3) {
  6942. } else {
  6943. __pyx_t_1 = __pyx_t_3;
  6944. goto __pyx_L49_bool_binop_done;
  6945. }
  6946. __pyx_t_11 = __Pyx_GetItemInt(__pyx_8genexpr5__pyx_v_r, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 417, __pyx_L45_error)
  6947. __Pyx_GOTREF(__pyx_t_11);
  6948. __pyx_t_9 = PyObject_RichCompare(__pyx_t_11, __pyx_v_o, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 417, __pyx_L45_error)
  6949. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  6950. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 417, __pyx_L45_error)
  6951. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6952. __pyx_t_1 = __pyx_t_3;
  6953. __pyx_L49_bool_binop_done:;
  6954. if (__pyx_t_1) {
  6955. __pyx_t_9 = __Pyx_GetItemInt(__pyx_8genexpr5__pyx_v_r, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 417, __pyx_L45_error)
  6956. __Pyx_GOTREF(__pyx_t_9);
  6957. if (unlikely(PySet_Add(__pyx_t_4, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 417, __pyx_L45_error)
  6958. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6959. }
  6960. }
  6961. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6962. __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_r); __pyx_8genexpr5__pyx_v_r = 0;
  6963. goto __pyx_L51_exit_scope;
  6964. __pyx_L45_error:;
  6965. __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_r); __pyx_8genexpr5__pyx_v_r = 0;
  6966. goto __pyx_L1_error;
  6967. __pyx_L51_exit_scope:;
  6968. } /* exit inner scope */
  6969. __pyx_r = __pyx_t_4;
  6970. __pyx_t_4 = 0;
  6971. goto __pyx_L0;
  6972. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":416
  6973. * elif s is None:
  6974. * return {r[0] for r in self.data if r[1] == p and r[2] == o}
  6975. * elif p is None: # <<<<<<<<<<<<<<
  6976. * return {r[1] for r in self.data if r[0] == s and r[2] == o}
  6977. * elif o is None:
  6978. */
  6979. }
  6980. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":418
  6981. * elif p is None:
  6982. * return {r[1] for r in self.data if r[0] == s and r[2] == o}
  6983. * elif o is None: # <<<<<<<<<<<<<<
  6984. * return {r[2] for r in self.data if r[0] == s and r[1] == p}
  6985. * else:
  6986. */
  6987. __pyx_t_1 = (__pyx_v_o == Py_None);
  6988. __pyx_t_3 = (__pyx_t_1 != 0);
  6989. if (__pyx_t_3) {
  6990. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":419
  6991. * return {r[1] for r in self.data if r[0] == s and r[2] == o}
  6992. * elif o is None:
  6993. * return {r[2] for r in self.data if r[0] == s and r[1] == p} # <<<<<<<<<<<<<<
  6994. * else:
  6995. * # all given
  6996. */
  6997. __Pyx_XDECREF(__pyx_r);
  6998. { /* enter inner scope */
  6999. __pyx_t_4 = PySet_New(NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 419, __pyx_L54_error)
  7000. __Pyx_GOTREF(__pyx_t_4);
  7001. __pyx_t_7 = 0;
  7002. __pyx_t_9 = __Pyx_set_iterator(__pyx_v_self->data, 1, (&__pyx_t_6), (&__pyx_t_8)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 419, __pyx_L54_error)
  7003. __Pyx_GOTREF(__pyx_t_9);
  7004. __Pyx_XDECREF(__pyx_t_5);
  7005. __pyx_t_5 = __pyx_t_9;
  7006. __pyx_t_9 = 0;
  7007. while (1) {
  7008. __pyx_t_10 = __Pyx_set_iter_next(__pyx_t_5, __pyx_t_6, &__pyx_t_7, &__pyx_t_9, __pyx_t_8);
  7009. if (unlikely(__pyx_t_10 == 0)) break;
  7010. if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 419, __pyx_L54_error)
  7011. __Pyx_GOTREF(__pyx_t_9);
  7012. __Pyx_XDECREF_SET(__pyx_8genexpr6__pyx_v_r, __pyx_t_9);
  7013. __pyx_t_9 = 0;
  7014. __pyx_t_9 = __Pyx_GetItemInt(__pyx_8genexpr6__pyx_v_r, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 419, __pyx_L54_error)
  7015. __Pyx_GOTREF(__pyx_t_9);
  7016. __pyx_t_11 = PyObject_RichCompare(__pyx_t_9, __pyx_v_s, Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 419, __pyx_L54_error)
  7017. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  7018. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 419, __pyx_L54_error)
  7019. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  7020. if (__pyx_t_1) {
  7021. } else {
  7022. __pyx_t_3 = __pyx_t_1;
  7023. goto __pyx_L58_bool_binop_done;
  7024. }
  7025. __pyx_t_11 = __Pyx_GetItemInt(__pyx_8genexpr6__pyx_v_r, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 419, __pyx_L54_error)
  7026. __Pyx_GOTREF(__pyx_t_11);
  7027. __pyx_t_9 = PyObject_RichCompare(__pyx_t_11, __pyx_v_p, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 419, __pyx_L54_error)
  7028. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  7029. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 419, __pyx_L54_error)
  7030. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  7031. __pyx_t_3 = __pyx_t_1;
  7032. __pyx_L58_bool_binop_done:;
  7033. if (__pyx_t_3) {
  7034. __pyx_t_9 = __Pyx_GetItemInt(__pyx_8genexpr6__pyx_v_r, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 419, __pyx_L54_error)
  7035. __Pyx_GOTREF(__pyx_t_9);
  7036. if (unlikely(PySet_Add(__pyx_t_4, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 419, __pyx_L54_error)
  7037. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  7038. }
  7039. }
  7040. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7041. __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_r); __pyx_8genexpr6__pyx_v_r = 0;
  7042. goto __pyx_L60_exit_scope;
  7043. __pyx_L54_error:;
  7044. __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_r); __pyx_8genexpr6__pyx_v_r = 0;
  7045. goto __pyx_L1_error;
  7046. __pyx_L60_exit_scope:;
  7047. } /* exit inner scope */
  7048. __pyx_r = __pyx_t_4;
  7049. __pyx_t_4 = 0;
  7050. goto __pyx_L0;
  7051. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":418
  7052. * elif p is None:
  7053. * return {r[1] for r in self.data if r[0] == s and r[2] == o}
  7054. * elif o is None: # <<<<<<<<<<<<<<
  7055. * return {r[2] for r in self.data if r[0] == s and r[1] == p}
  7056. * else:
  7057. */
  7058. }
  7059. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":422
  7060. * else:
  7061. * # all given
  7062. * return (s,p,o) in self.data # <<<<<<<<<<<<<<
  7063. *
  7064. *
  7065. */
  7066. /*else*/ {
  7067. __Pyx_XDECREF(__pyx_r);
  7068. __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 422, __pyx_L1_error)
  7069. __Pyx_GOTREF(__pyx_t_4);
  7070. __Pyx_INCREF(__pyx_v_s);
  7071. __Pyx_GIVEREF(__pyx_v_s);
  7072. PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_s);
  7073. __Pyx_INCREF(__pyx_v_p);
  7074. __Pyx_GIVEREF(__pyx_v_p);
  7075. PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_p);
  7076. __Pyx_INCREF(__pyx_v_o);
  7077. __Pyx_GIVEREF(__pyx_v_o);
  7078. PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_o);
  7079. if (unlikely(__pyx_v_self->data == Py_None)) {
  7080. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  7081. __PYX_ERR(0, 422, __pyx_L1_error)
  7082. }
  7083. __pyx_t_3 = (__Pyx_PySet_ContainsTF(__pyx_t_4, __pyx_v_self->data, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 422, __pyx_L1_error)
  7084. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7085. __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 422, __pyx_L1_error)
  7086. __Pyx_GOTREF(__pyx_t_4);
  7087. __pyx_r = __pyx_t_4;
  7088. __pyx_t_4 = 0;
  7089. goto __pyx_L0;
  7090. }
  7091. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":400
  7092. *
  7093. *
  7094. * cdef _slice(self, s, p, o): # <<<<<<<<<<<<<<
  7095. * """
  7096. * Return terms filtered by other terms.
  7097. */
  7098. /* function exit code */
  7099. __pyx_L1_error:;
  7100. __Pyx_XDECREF(__pyx_t_4);
  7101. __Pyx_XDECREF(__pyx_t_5);
  7102. __Pyx_XDECREF(__pyx_t_9);
  7103. __Pyx_XDECREF(__pyx_t_11);
  7104. __Pyx_XDECREF(__pyx_t_12);
  7105. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph._slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7106. __pyx_r = 0;
  7107. __pyx_L0:;
  7108. __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_r);
  7109. __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_r);
  7110. __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_r);
  7111. __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_r);
  7112. __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_r);
  7113. __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_r);
  7114. __Pyx_XGIVEREF(__pyx_r);
  7115. __Pyx_TraceReturn(__pyx_r, 0);
  7116. __Pyx_RefNannyFinishContext();
  7117. return __pyx_r;
  7118. }
  7119. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":425
  7120. *
  7121. *
  7122. * cpdef lookup(self, s, p, o): # <<<<<<<<<<<<<<
  7123. * """
  7124. * Look up triples by a pattern.
  7125. */
  7126. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_43lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  7127. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_lookup(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_s, PyObject *__pyx_v_p, PyObject *__pyx_v_o, int __pyx_skip_dispatch) {
  7128. PyObject *__pyx_8genexpr7__pyx_v_r = NULL;
  7129. PyObject *__pyx_8genexpr8__pyx_v_r = NULL;
  7130. PyObject *__pyx_8genexpr9__pyx_v_r = NULL;
  7131. PyObject *__pyx_9genexpr10__pyx_v_r = NULL;
  7132. PyObject *__pyx_9genexpr11__pyx_v_r = NULL;
  7133. PyObject *__pyx_9genexpr12__pyx_v_r = NULL;
  7134. PyObject *__pyx_r = NULL;
  7135. __Pyx_TraceDeclarations
  7136. __Pyx_RefNannyDeclarations
  7137. PyObject *__pyx_t_1 = NULL;
  7138. PyObject *__pyx_t_2 = NULL;
  7139. PyObject *__pyx_t_3 = NULL;
  7140. PyObject *__pyx_t_4 = NULL;
  7141. int __pyx_t_5;
  7142. PyObject *__pyx_t_6 = NULL;
  7143. Py_ssize_t __pyx_t_7;
  7144. Py_UCS4 __pyx_t_8;
  7145. int __pyx_t_9;
  7146. int __pyx_t_10;
  7147. int __pyx_t_11;
  7148. Py_ssize_t __pyx_t_12;
  7149. int __pyx_t_13;
  7150. __Pyx_RefNannySetupContext("lookup", 0);
  7151. __Pyx_TraceCall("lookup", __pyx_f[0], 425, 0, __PYX_ERR(0, 425, __pyx_L1_error));
  7152. /* Check if called by wrapper */
  7153. if (unlikely(__pyx_skip_dispatch)) ;
  7154. /* Check if overridden in Python */
  7155. else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
  7156. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_lookup); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 425, __pyx_L1_error)
  7157. __Pyx_GOTREF(__pyx_t_1);
  7158. if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_43lookup)) {
  7159. __Pyx_XDECREF(__pyx_r);
  7160. __Pyx_INCREF(__pyx_t_1);
  7161. __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
  7162. __pyx_t_5 = 0;
  7163. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  7164. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
  7165. if (likely(__pyx_t_4)) {
  7166. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  7167. __Pyx_INCREF(__pyx_t_4);
  7168. __Pyx_INCREF(function);
  7169. __Pyx_DECREF_SET(__pyx_t_3, function);
  7170. __pyx_t_5 = 1;
  7171. }
  7172. }
  7173. #if CYTHON_FAST_PYCALL
  7174. if (PyFunction_Check(__pyx_t_3)) {
  7175. PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_s, __pyx_v_p, __pyx_v_o};
  7176. __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 425, __pyx_L1_error)
  7177. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  7178. __Pyx_GOTREF(__pyx_t_2);
  7179. } else
  7180. #endif
  7181. #if CYTHON_FAST_PYCCALL
  7182. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  7183. PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_s, __pyx_v_p, __pyx_v_o};
  7184. __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 425, __pyx_L1_error)
  7185. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  7186. __Pyx_GOTREF(__pyx_t_2);
  7187. } else
  7188. #endif
  7189. {
  7190. __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 425, __pyx_L1_error)
  7191. __Pyx_GOTREF(__pyx_t_6);
  7192. if (__pyx_t_4) {
  7193. __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
  7194. }
  7195. __Pyx_INCREF(__pyx_v_s);
  7196. __Pyx_GIVEREF(__pyx_v_s);
  7197. PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_s);
  7198. __Pyx_INCREF(__pyx_v_p);
  7199. __Pyx_GIVEREF(__pyx_v_p);
  7200. PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_p);
  7201. __Pyx_INCREF(__pyx_v_o);
  7202. __Pyx_GIVEREF(__pyx_v_o);
  7203. PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_o);
  7204. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 425, __pyx_L1_error)
  7205. __Pyx_GOTREF(__pyx_t_2);
  7206. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7207. }
  7208. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7209. __pyx_r = __pyx_t_2;
  7210. __pyx_t_2 = 0;
  7211. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7212. goto __pyx_L0;
  7213. }
  7214. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7215. }
  7216. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":429
  7217. * Look up triples by a pattern.
  7218. * """
  7219. * logger.debug(f'Looking up in graph: {s}, {p}, {o}.') # <<<<<<<<<<<<<<
  7220. * if s is None and p is None and o is None:
  7221. * return self.data
  7222. */
  7223. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 429, __pyx_L1_error)
  7224. __Pyx_GOTREF(__pyx_t_2);
  7225. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 429, __pyx_L1_error)
  7226. __Pyx_GOTREF(__pyx_t_3);
  7227. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7228. __pyx_t_2 = PyTuple_New(7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 429, __pyx_L1_error)
  7229. __Pyx_GOTREF(__pyx_t_2);
  7230. __pyx_t_7 = 0;
  7231. __pyx_t_8 = 127;
  7232. __Pyx_INCREF(__pyx_kp_u_Looking_up_in_graph);
  7233. __pyx_t_7 += 21;
  7234. __Pyx_GIVEREF(__pyx_kp_u_Looking_up_in_graph);
  7235. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_Looking_up_in_graph);
  7236. __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_s, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 429, __pyx_L1_error)
  7237. __Pyx_GOTREF(__pyx_t_6);
  7238. __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_8;
  7239. __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
  7240. __Pyx_GIVEREF(__pyx_t_6);
  7241. PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6);
  7242. __pyx_t_6 = 0;
  7243. __Pyx_INCREF(__pyx_kp_u__12);
  7244. __pyx_t_7 += 2;
  7245. __Pyx_GIVEREF(__pyx_kp_u__12);
  7246. PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u__12);
  7247. __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_p, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 429, __pyx_L1_error)
  7248. __Pyx_GOTREF(__pyx_t_6);
  7249. __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_8;
  7250. __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
  7251. __Pyx_GIVEREF(__pyx_t_6);
  7252. PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_6);
  7253. __pyx_t_6 = 0;
  7254. __Pyx_INCREF(__pyx_kp_u__12);
  7255. __pyx_t_7 += 2;
  7256. __Pyx_GIVEREF(__pyx_kp_u__12);
  7257. PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_kp_u__12);
  7258. __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_o, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 429, __pyx_L1_error)
  7259. __Pyx_GOTREF(__pyx_t_6);
  7260. __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_8;
  7261. __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
  7262. __Pyx_GIVEREF(__pyx_t_6);
  7263. PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_t_6);
  7264. __pyx_t_6 = 0;
  7265. __Pyx_INCREF(__pyx_kp_u__11);
  7266. __pyx_t_7 += 1;
  7267. __Pyx_GIVEREF(__pyx_kp_u__11);
  7268. PyTuple_SET_ITEM(__pyx_t_2, 6, __pyx_kp_u__11);
  7269. __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_2, 7, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 429, __pyx_L1_error)
  7270. __Pyx_GOTREF(__pyx_t_6);
  7271. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7272. __pyx_t_2 = NULL;
  7273. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  7274. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  7275. if (likely(__pyx_t_2)) {
  7276. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  7277. __Pyx_INCREF(__pyx_t_2);
  7278. __Pyx_INCREF(function);
  7279. __Pyx_DECREF_SET(__pyx_t_3, function);
  7280. }
  7281. }
  7282. if (!__pyx_t_2) {
  7283. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 429, __pyx_L1_error)
  7284. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7285. __Pyx_GOTREF(__pyx_t_1);
  7286. } else {
  7287. #if CYTHON_FAST_PYCALL
  7288. if (PyFunction_Check(__pyx_t_3)) {
  7289. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_6};
  7290. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 429, __pyx_L1_error)
  7291. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  7292. __Pyx_GOTREF(__pyx_t_1);
  7293. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7294. } else
  7295. #endif
  7296. #if CYTHON_FAST_PYCCALL
  7297. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  7298. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_6};
  7299. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 429, __pyx_L1_error)
  7300. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  7301. __Pyx_GOTREF(__pyx_t_1);
  7302. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7303. } else
  7304. #endif
  7305. {
  7306. __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 429, __pyx_L1_error)
  7307. __Pyx_GOTREF(__pyx_t_4);
  7308. __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
  7309. __Pyx_GIVEREF(__pyx_t_6);
  7310. PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_6);
  7311. __pyx_t_6 = 0;
  7312. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 429, __pyx_L1_error)
  7313. __Pyx_GOTREF(__pyx_t_1);
  7314. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7315. }
  7316. }
  7317. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7318. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7319. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":430
  7320. * """
  7321. * logger.debug(f'Looking up in graph: {s}, {p}, {o}.')
  7322. * if s is None and p is None and o is None: # <<<<<<<<<<<<<<
  7323. * return self.data
  7324. * elif s is None and p is None:
  7325. */
  7326. __pyx_t_10 = (__pyx_v_s == Py_None);
  7327. __pyx_t_11 = (__pyx_t_10 != 0);
  7328. if (__pyx_t_11) {
  7329. } else {
  7330. __pyx_t_9 = __pyx_t_11;
  7331. goto __pyx_L4_bool_binop_done;
  7332. }
  7333. __pyx_t_11 = (__pyx_v_p == Py_None);
  7334. __pyx_t_10 = (__pyx_t_11 != 0);
  7335. if (__pyx_t_10) {
  7336. } else {
  7337. __pyx_t_9 = __pyx_t_10;
  7338. goto __pyx_L4_bool_binop_done;
  7339. }
  7340. __pyx_t_10 = (__pyx_v_o == Py_None);
  7341. __pyx_t_11 = (__pyx_t_10 != 0);
  7342. __pyx_t_9 = __pyx_t_11;
  7343. __pyx_L4_bool_binop_done:;
  7344. if (__pyx_t_9) {
  7345. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":431
  7346. * logger.debug(f'Looking up in graph: {s}, {p}, {o}.')
  7347. * if s is None and p is None and o is None:
  7348. * return self.data # <<<<<<<<<<<<<<
  7349. * elif s is None and p is None:
  7350. * return {r for r in self.data if r[2] == o}
  7351. */
  7352. __Pyx_XDECREF(__pyx_r);
  7353. __Pyx_INCREF(__pyx_v_self->data);
  7354. __pyx_r = __pyx_v_self->data;
  7355. goto __pyx_L0;
  7356. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":430
  7357. * """
  7358. * logger.debug(f'Looking up in graph: {s}, {p}, {o}.')
  7359. * if s is None and p is None and o is None: # <<<<<<<<<<<<<<
  7360. * return self.data
  7361. * elif s is None and p is None:
  7362. */
  7363. }
  7364. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":432
  7365. * if s is None and p is None and o is None:
  7366. * return self.data
  7367. * elif s is None and p is None: # <<<<<<<<<<<<<<
  7368. * return {r for r in self.data if r[2] == o}
  7369. * elif s is None and o is None:
  7370. */
  7371. __pyx_t_11 = (__pyx_v_s == Py_None);
  7372. __pyx_t_10 = (__pyx_t_11 != 0);
  7373. if (__pyx_t_10) {
  7374. } else {
  7375. __pyx_t_9 = __pyx_t_10;
  7376. goto __pyx_L7_bool_binop_done;
  7377. }
  7378. __pyx_t_10 = (__pyx_v_p == Py_None);
  7379. __pyx_t_11 = (__pyx_t_10 != 0);
  7380. __pyx_t_9 = __pyx_t_11;
  7381. __pyx_L7_bool_binop_done:;
  7382. if (__pyx_t_9) {
  7383. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":433
  7384. * return self.data
  7385. * elif s is None and p is None:
  7386. * return {r for r in self.data if r[2] == o} # <<<<<<<<<<<<<<
  7387. * elif s is None and o is None:
  7388. * return {r for r in self.data if r[1] == p}
  7389. */
  7390. __Pyx_XDECREF(__pyx_r);
  7391. { /* enter inner scope */
  7392. __pyx_t_1 = PySet_New(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 433, __pyx_L11_error)
  7393. __Pyx_GOTREF(__pyx_t_1);
  7394. __pyx_t_7 = 0;
  7395. __pyx_t_4 = __Pyx_set_iterator(__pyx_v_self->data, 1, (&__pyx_t_12), (&__pyx_t_5)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 433, __pyx_L11_error)
  7396. __Pyx_GOTREF(__pyx_t_4);
  7397. __Pyx_XDECREF(__pyx_t_3);
  7398. __pyx_t_3 = __pyx_t_4;
  7399. __pyx_t_4 = 0;
  7400. while (1) {
  7401. __pyx_t_13 = __Pyx_set_iter_next(__pyx_t_3, __pyx_t_12, &__pyx_t_7, &__pyx_t_4, __pyx_t_5);
  7402. if (unlikely(__pyx_t_13 == 0)) break;
  7403. if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 433, __pyx_L11_error)
  7404. __Pyx_GOTREF(__pyx_t_4);
  7405. __Pyx_XDECREF_SET(__pyx_8genexpr7__pyx_v_r, __pyx_t_4);
  7406. __pyx_t_4 = 0;
  7407. __pyx_t_4 = __Pyx_GetItemInt(__pyx_8genexpr7__pyx_v_r, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 433, __pyx_L11_error)
  7408. __Pyx_GOTREF(__pyx_t_4);
  7409. __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_v_o, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 433, __pyx_L11_error)
  7410. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7411. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 433, __pyx_L11_error)
  7412. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7413. if (__pyx_t_9) {
  7414. if (unlikely(PySet_Add(__pyx_t_1, (PyObject*)__pyx_8genexpr7__pyx_v_r))) __PYX_ERR(0, 433, __pyx_L11_error)
  7415. }
  7416. }
  7417. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7418. __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_r); __pyx_8genexpr7__pyx_v_r = 0;
  7419. goto __pyx_L15_exit_scope;
  7420. __pyx_L11_error:;
  7421. __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_r); __pyx_8genexpr7__pyx_v_r = 0;
  7422. goto __pyx_L1_error;
  7423. __pyx_L15_exit_scope:;
  7424. } /* exit inner scope */
  7425. __pyx_r = __pyx_t_1;
  7426. __pyx_t_1 = 0;
  7427. goto __pyx_L0;
  7428. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":432
  7429. * if s is None and p is None and o is None:
  7430. * return self.data
  7431. * elif s is None and p is None: # <<<<<<<<<<<<<<
  7432. * return {r for r in self.data if r[2] == o}
  7433. * elif s is None and o is None:
  7434. */
  7435. }
  7436. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":434
  7437. * elif s is None and p is None:
  7438. * return {r for r in self.data if r[2] == o}
  7439. * elif s is None and o is None: # <<<<<<<<<<<<<<
  7440. * return {r for r in self.data if r[1] == p}
  7441. * elif p is None and o is None:
  7442. */
  7443. __pyx_t_11 = (__pyx_v_s == Py_None);
  7444. __pyx_t_10 = (__pyx_t_11 != 0);
  7445. if (__pyx_t_10) {
  7446. } else {
  7447. __pyx_t_9 = __pyx_t_10;
  7448. goto __pyx_L16_bool_binop_done;
  7449. }
  7450. __pyx_t_10 = (__pyx_v_o == Py_None);
  7451. __pyx_t_11 = (__pyx_t_10 != 0);
  7452. __pyx_t_9 = __pyx_t_11;
  7453. __pyx_L16_bool_binop_done:;
  7454. if (__pyx_t_9) {
  7455. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":435
  7456. * return {r for r in self.data if r[2] == o}
  7457. * elif s is None and o is None:
  7458. * return {r for r in self.data if r[1] == p} # <<<<<<<<<<<<<<
  7459. * elif p is None and o is None:
  7460. * return {r for r in self.data if r[0] == s}
  7461. */
  7462. __Pyx_XDECREF(__pyx_r);
  7463. { /* enter inner scope */
  7464. __pyx_t_1 = PySet_New(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 435, __pyx_L20_error)
  7465. __Pyx_GOTREF(__pyx_t_1);
  7466. __pyx_t_12 = 0;
  7467. __pyx_t_6 = __Pyx_set_iterator(__pyx_v_self->data, 1, (&__pyx_t_7), (&__pyx_t_5)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 435, __pyx_L20_error)
  7468. __Pyx_GOTREF(__pyx_t_6);
  7469. __Pyx_XDECREF(__pyx_t_3);
  7470. __pyx_t_3 = __pyx_t_6;
  7471. __pyx_t_6 = 0;
  7472. while (1) {
  7473. __pyx_t_13 = __Pyx_set_iter_next(__pyx_t_3, __pyx_t_7, &__pyx_t_12, &__pyx_t_6, __pyx_t_5);
  7474. if (unlikely(__pyx_t_13 == 0)) break;
  7475. if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 435, __pyx_L20_error)
  7476. __Pyx_GOTREF(__pyx_t_6);
  7477. __Pyx_XDECREF_SET(__pyx_8genexpr8__pyx_v_r, __pyx_t_6);
  7478. __pyx_t_6 = 0;
  7479. __pyx_t_6 = __Pyx_GetItemInt(__pyx_8genexpr8__pyx_v_r, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 435, __pyx_L20_error)
  7480. __Pyx_GOTREF(__pyx_t_6);
  7481. __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_v_p, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 435, __pyx_L20_error)
  7482. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7483. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 435, __pyx_L20_error)
  7484. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7485. if (__pyx_t_9) {
  7486. if (unlikely(PySet_Add(__pyx_t_1, (PyObject*)__pyx_8genexpr8__pyx_v_r))) __PYX_ERR(0, 435, __pyx_L20_error)
  7487. }
  7488. }
  7489. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7490. __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_r); __pyx_8genexpr8__pyx_v_r = 0;
  7491. goto __pyx_L24_exit_scope;
  7492. __pyx_L20_error:;
  7493. __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_r); __pyx_8genexpr8__pyx_v_r = 0;
  7494. goto __pyx_L1_error;
  7495. __pyx_L24_exit_scope:;
  7496. } /* exit inner scope */
  7497. __pyx_r = __pyx_t_1;
  7498. __pyx_t_1 = 0;
  7499. goto __pyx_L0;
  7500. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":434
  7501. * elif s is None and p is None:
  7502. * return {r for r in self.data if r[2] == o}
  7503. * elif s is None and o is None: # <<<<<<<<<<<<<<
  7504. * return {r for r in self.data if r[1] == p}
  7505. * elif p is None and o is None:
  7506. */
  7507. }
  7508. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":436
  7509. * elif s is None and o is None:
  7510. * return {r for r in self.data if r[1] == p}
  7511. * elif p is None and o is None: # <<<<<<<<<<<<<<
  7512. * return {r for r in self.data if r[0] == s}
  7513. * elif s is None:
  7514. */
  7515. __pyx_t_11 = (__pyx_v_p == Py_None);
  7516. __pyx_t_10 = (__pyx_t_11 != 0);
  7517. if (__pyx_t_10) {
  7518. } else {
  7519. __pyx_t_9 = __pyx_t_10;
  7520. goto __pyx_L25_bool_binop_done;
  7521. }
  7522. __pyx_t_10 = (__pyx_v_o == Py_None);
  7523. __pyx_t_11 = (__pyx_t_10 != 0);
  7524. __pyx_t_9 = __pyx_t_11;
  7525. __pyx_L25_bool_binop_done:;
  7526. if (__pyx_t_9) {
  7527. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":437
  7528. * return {r for r in self.data if r[1] == p}
  7529. * elif p is None and o is None:
  7530. * return {r for r in self.data if r[0] == s} # <<<<<<<<<<<<<<
  7531. * elif s is None:
  7532. * return {r for r in self.data if r[1] == p and r[2] == o}
  7533. */
  7534. __Pyx_XDECREF(__pyx_r);
  7535. { /* enter inner scope */
  7536. __pyx_t_1 = PySet_New(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 437, __pyx_L29_error)
  7537. __Pyx_GOTREF(__pyx_t_1);
  7538. __pyx_t_7 = 0;
  7539. __pyx_t_4 = __Pyx_set_iterator(__pyx_v_self->data, 1, (&__pyx_t_12), (&__pyx_t_5)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 437, __pyx_L29_error)
  7540. __Pyx_GOTREF(__pyx_t_4);
  7541. __Pyx_XDECREF(__pyx_t_3);
  7542. __pyx_t_3 = __pyx_t_4;
  7543. __pyx_t_4 = 0;
  7544. while (1) {
  7545. __pyx_t_13 = __Pyx_set_iter_next(__pyx_t_3, __pyx_t_12, &__pyx_t_7, &__pyx_t_4, __pyx_t_5);
  7546. if (unlikely(__pyx_t_13 == 0)) break;
  7547. if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 437, __pyx_L29_error)
  7548. __Pyx_GOTREF(__pyx_t_4);
  7549. __Pyx_XDECREF_SET(__pyx_8genexpr9__pyx_v_r, __pyx_t_4);
  7550. __pyx_t_4 = 0;
  7551. __pyx_t_4 = __Pyx_GetItemInt(__pyx_8genexpr9__pyx_v_r, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 437, __pyx_L29_error)
  7552. __Pyx_GOTREF(__pyx_t_4);
  7553. __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_v_s, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 437, __pyx_L29_error)
  7554. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7555. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 437, __pyx_L29_error)
  7556. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7557. if (__pyx_t_9) {
  7558. if (unlikely(PySet_Add(__pyx_t_1, (PyObject*)__pyx_8genexpr9__pyx_v_r))) __PYX_ERR(0, 437, __pyx_L29_error)
  7559. }
  7560. }
  7561. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7562. __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_r); __pyx_8genexpr9__pyx_v_r = 0;
  7563. goto __pyx_L33_exit_scope;
  7564. __pyx_L29_error:;
  7565. __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_r); __pyx_8genexpr9__pyx_v_r = 0;
  7566. goto __pyx_L1_error;
  7567. __pyx_L33_exit_scope:;
  7568. } /* exit inner scope */
  7569. __pyx_r = __pyx_t_1;
  7570. __pyx_t_1 = 0;
  7571. goto __pyx_L0;
  7572. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":436
  7573. * elif s is None and o is None:
  7574. * return {r for r in self.data if r[1] == p}
  7575. * elif p is None and o is None: # <<<<<<<<<<<<<<
  7576. * return {r for r in self.data if r[0] == s}
  7577. * elif s is None:
  7578. */
  7579. }
  7580. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":438
  7581. * elif p is None and o is None:
  7582. * return {r for r in self.data if r[0] == s}
  7583. * elif s is None: # <<<<<<<<<<<<<<
  7584. * return {r for r in self.data if r[1] == p and r[2] == o}
  7585. * elif p is None:
  7586. */
  7587. __pyx_t_9 = (__pyx_v_s == Py_None);
  7588. __pyx_t_11 = (__pyx_t_9 != 0);
  7589. if (__pyx_t_11) {
  7590. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":439
  7591. * return {r for r in self.data if r[0] == s}
  7592. * elif s is None:
  7593. * return {r for r in self.data if r[1] == p and r[2] == o} # <<<<<<<<<<<<<<
  7594. * elif p is None:
  7595. * return {r for r in self.data if r[0] == s and r[2] == o}
  7596. */
  7597. __Pyx_XDECREF(__pyx_r);
  7598. { /* enter inner scope */
  7599. __pyx_t_1 = PySet_New(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L36_error)
  7600. __Pyx_GOTREF(__pyx_t_1);
  7601. __pyx_t_12 = 0;
  7602. __pyx_t_6 = __Pyx_set_iterator(__pyx_v_self->data, 1, (&__pyx_t_7), (&__pyx_t_5)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 439, __pyx_L36_error)
  7603. __Pyx_GOTREF(__pyx_t_6);
  7604. __Pyx_XDECREF(__pyx_t_3);
  7605. __pyx_t_3 = __pyx_t_6;
  7606. __pyx_t_6 = 0;
  7607. while (1) {
  7608. __pyx_t_13 = __Pyx_set_iter_next(__pyx_t_3, __pyx_t_7, &__pyx_t_12, &__pyx_t_6, __pyx_t_5);
  7609. if (unlikely(__pyx_t_13 == 0)) break;
  7610. if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 439, __pyx_L36_error)
  7611. __Pyx_GOTREF(__pyx_t_6);
  7612. __Pyx_XDECREF_SET(__pyx_9genexpr10__pyx_v_r, __pyx_t_6);
  7613. __pyx_t_6 = 0;
  7614. __pyx_t_6 = __Pyx_GetItemInt(__pyx_9genexpr10__pyx_v_r, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 439, __pyx_L36_error)
  7615. __Pyx_GOTREF(__pyx_t_6);
  7616. __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_v_p, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 439, __pyx_L36_error)
  7617. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7618. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 439, __pyx_L36_error)
  7619. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7620. if (__pyx_t_9) {
  7621. } else {
  7622. __pyx_t_11 = __pyx_t_9;
  7623. goto __pyx_L40_bool_binop_done;
  7624. }
  7625. __pyx_t_4 = __Pyx_GetItemInt(__pyx_9genexpr10__pyx_v_r, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 439, __pyx_L36_error)
  7626. __Pyx_GOTREF(__pyx_t_4);
  7627. __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_v_o, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 439, __pyx_L36_error)
  7628. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7629. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 439, __pyx_L36_error)
  7630. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7631. __pyx_t_11 = __pyx_t_9;
  7632. __pyx_L40_bool_binop_done:;
  7633. if (__pyx_t_11) {
  7634. if (unlikely(PySet_Add(__pyx_t_1, (PyObject*)__pyx_9genexpr10__pyx_v_r))) __PYX_ERR(0, 439, __pyx_L36_error)
  7635. }
  7636. }
  7637. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7638. __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_r); __pyx_9genexpr10__pyx_v_r = 0;
  7639. goto __pyx_L42_exit_scope;
  7640. __pyx_L36_error:;
  7641. __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_r); __pyx_9genexpr10__pyx_v_r = 0;
  7642. goto __pyx_L1_error;
  7643. __pyx_L42_exit_scope:;
  7644. } /* exit inner scope */
  7645. __pyx_r = __pyx_t_1;
  7646. __pyx_t_1 = 0;
  7647. goto __pyx_L0;
  7648. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":438
  7649. * elif p is None and o is None:
  7650. * return {r for r in self.data if r[0] == s}
  7651. * elif s is None: # <<<<<<<<<<<<<<
  7652. * return {r for r in self.data if r[1] == p and r[2] == o}
  7653. * elif p is None:
  7654. */
  7655. }
  7656. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":440
  7657. * elif s is None:
  7658. * return {r for r in self.data if r[1] == p and r[2] == o}
  7659. * elif p is None: # <<<<<<<<<<<<<<
  7660. * return {r for r in self.data if r[0] == s and r[2] == o}
  7661. * elif o is None:
  7662. */
  7663. __pyx_t_11 = (__pyx_v_p == Py_None);
  7664. __pyx_t_9 = (__pyx_t_11 != 0);
  7665. if (__pyx_t_9) {
  7666. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":441
  7667. * return {r for r in self.data if r[1] == p and r[2] == o}
  7668. * elif p is None:
  7669. * return {r for r in self.data if r[0] == s and r[2] == o} # <<<<<<<<<<<<<<
  7670. * elif o is None:
  7671. * return {r for r in self.data if r[0] == s and r[1] == p}
  7672. */
  7673. __Pyx_XDECREF(__pyx_r);
  7674. { /* enter inner scope */
  7675. __pyx_t_1 = PySet_New(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L45_error)
  7676. __Pyx_GOTREF(__pyx_t_1);
  7677. __pyx_t_7 = 0;
  7678. __pyx_t_6 = __Pyx_set_iterator(__pyx_v_self->data, 1, (&__pyx_t_12), (&__pyx_t_5)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 441, __pyx_L45_error)
  7679. __Pyx_GOTREF(__pyx_t_6);
  7680. __Pyx_XDECREF(__pyx_t_3);
  7681. __pyx_t_3 = __pyx_t_6;
  7682. __pyx_t_6 = 0;
  7683. while (1) {
  7684. __pyx_t_13 = __Pyx_set_iter_next(__pyx_t_3, __pyx_t_12, &__pyx_t_7, &__pyx_t_6, __pyx_t_5);
  7685. if (unlikely(__pyx_t_13 == 0)) break;
  7686. if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 441, __pyx_L45_error)
  7687. __Pyx_GOTREF(__pyx_t_6);
  7688. __Pyx_XDECREF_SET(__pyx_9genexpr11__pyx_v_r, __pyx_t_6);
  7689. __pyx_t_6 = 0;
  7690. __pyx_t_6 = __Pyx_GetItemInt(__pyx_9genexpr11__pyx_v_r, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 441, __pyx_L45_error)
  7691. __Pyx_GOTREF(__pyx_t_6);
  7692. __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_v_s, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 441, __pyx_L45_error)
  7693. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7694. __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 441, __pyx_L45_error)
  7695. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7696. if (__pyx_t_11) {
  7697. } else {
  7698. __pyx_t_9 = __pyx_t_11;
  7699. goto __pyx_L49_bool_binop_done;
  7700. }
  7701. __pyx_t_4 = __Pyx_GetItemInt(__pyx_9genexpr11__pyx_v_r, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 441, __pyx_L45_error)
  7702. __Pyx_GOTREF(__pyx_t_4);
  7703. __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_v_o, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 441, __pyx_L45_error)
  7704. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7705. __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 441, __pyx_L45_error)
  7706. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7707. __pyx_t_9 = __pyx_t_11;
  7708. __pyx_L49_bool_binop_done:;
  7709. if (__pyx_t_9) {
  7710. if (unlikely(PySet_Add(__pyx_t_1, (PyObject*)__pyx_9genexpr11__pyx_v_r))) __PYX_ERR(0, 441, __pyx_L45_error)
  7711. }
  7712. }
  7713. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7714. __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_r); __pyx_9genexpr11__pyx_v_r = 0;
  7715. goto __pyx_L51_exit_scope;
  7716. __pyx_L45_error:;
  7717. __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_r); __pyx_9genexpr11__pyx_v_r = 0;
  7718. goto __pyx_L1_error;
  7719. __pyx_L51_exit_scope:;
  7720. } /* exit inner scope */
  7721. __pyx_r = __pyx_t_1;
  7722. __pyx_t_1 = 0;
  7723. goto __pyx_L0;
  7724. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":440
  7725. * elif s is None:
  7726. * return {r for r in self.data if r[1] == p and r[2] == o}
  7727. * elif p is None: # <<<<<<<<<<<<<<
  7728. * return {r for r in self.data if r[0] == s and r[2] == o}
  7729. * elif o is None:
  7730. */
  7731. }
  7732. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":442
  7733. * elif p is None:
  7734. * return {r for r in self.data if r[0] == s and r[2] == o}
  7735. * elif o is None: # <<<<<<<<<<<<<<
  7736. * return {r for r in self.data if r[0] == s and r[1] == p}
  7737. * else:
  7738. */
  7739. __pyx_t_9 = (__pyx_v_o == Py_None);
  7740. __pyx_t_11 = (__pyx_t_9 != 0);
  7741. if (__pyx_t_11) {
  7742. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":443
  7743. * return {r for r in self.data if r[0] == s and r[2] == o}
  7744. * elif o is None:
  7745. * return {r for r in self.data if r[0] == s and r[1] == p} # <<<<<<<<<<<<<<
  7746. * else:
  7747. * # all given
  7748. */
  7749. __Pyx_XDECREF(__pyx_r);
  7750. { /* enter inner scope */
  7751. __pyx_t_1 = PySet_New(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 443, __pyx_L54_error)
  7752. __Pyx_GOTREF(__pyx_t_1);
  7753. __pyx_t_12 = 0;
  7754. __pyx_t_6 = __Pyx_set_iterator(__pyx_v_self->data, 1, (&__pyx_t_7), (&__pyx_t_5)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 443, __pyx_L54_error)
  7755. __Pyx_GOTREF(__pyx_t_6);
  7756. __Pyx_XDECREF(__pyx_t_3);
  7757. __pyx_t_3 = __pyx_t_6;
  7758. __pyx_t_6 = 0;
  7759. while (1) {
  7760. __pyx_t_13 = __Pyx_set_iter_next(__pyx_t_3, __pyx_t_7, &__pyx_t_12, &__pyx_t_6, __pyx_t_5);
  7761. if (unlikely(__pyx_t_13 == 0)) break;
  7762. if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 443, __pyx_L54_error)
  7763. __Pyx_GOTREF(__pyx_t_6);
  7764. __Pyx_XDECREF_SET(__pyx_9genexpr12__pyx_v_r, __pyx_t_6);
  7765. __pyx_t_6 = 0;
  7766. __pyx_t_6 = __Pyx_GetItemInt(__pyx_9genexpr12__pyx_v_r, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 443, __pyx_L54_error)
  7767. __Pyx_GOTREF(__pyx_t_6);
  7768. __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_v_s, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 443, __pyx_L54_error)
  7769. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7770. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 443, __pyx_L54_error)
  7771. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7772. if (__pyx_t_9) {
  7773. } else {
  7774. __pyx_t_11 = __pyx_t_9;
  7775. goto __pyx_L58_bool_binop_done;
  7776. }
  7777. __pyx_t_4 = __Pyx_GetItemInt(__pyx_9genexpr12__pyx_v_r, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 443, __pyx_L54_error)
  7778. __Pyx_GOTREF(__pyx_t_4);
  7779. __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_v_p, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 443, __pyx_L54_error)
  7780. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7781. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 443, __pyx_L54_error)
  7782. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7783. __pyx_t_11 = __pyx_t_9;
  7784. __pyx_L58_bool_binop_done:;
  7785. if (__pyx_t_11) {
  7786. if (unlikely(PySet_Add(__pyx_t_1, (PyObject*)__pyx_9genexpr12__pyx_v_r))) __PYX_ERR(0, 443, __pyx_L54_error)
  7787. }
  7788. }
  7789. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7790. __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_r); __pyx_9genexpr12__pyx_v_r = 0;
  7791. goto __pyx_L60_exit_scope;
  7792. __pyx_L54_error:;
  7793. __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_r); __pyx_9genexpr12__pyx_v_r = 0;
  7794. goto __pyx_L1_error;
  7795. __pyx_L60_exit_scope:;
  7796. } /* exit inner scope */
  7797. __pyx_r = __pyx_t_1;
  7798. __pyx_t_1 = 0;
  7799. goto __pyx_L0;
  7800. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":442
  7801. * elif p is None:
  7802. * return {r for r in self.data if r[0] == s and r[2] == o}
  7803. * elif o is None: # <<<<<<<<<<<<<<
  7804. * return {r for r in self.data if r[0] == s and r[1] == p}
  7805. * else:
  7806. */
  7807. }
  7808. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":446
  7809. * else:
  7810. * # all given
  7811. * return (s,p,o) if (s, p, o) in self.data else set() # <<<<<<<<<<<<<<
  7812. *
  7813. *
  7814. */
  7815. /*else*/ {
  7816. __Pyx_XDECREF(__pyx_r);
  7817. __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 446, __pyx_L1_error)
  7818. __Pyx_GOTREF(__pyx_t_3);
  7819. __Pyx_INCREF(__pyx_v_s);
  7820. __Pyx_GIVEREF(__pyx_v_s);
  7821. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_s);
  7822. __Pyx_INCREF(__pyx_v_p);
  7823. __Pyx_GIVEREF(__pyx_v_p);
  7824. PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_p);
  7825. __Pyx_INCREF(__pyx_v_o);
  7826. __Pyx_GIVEREF(__pyx_v_o);
  7827. PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_o);
  7828. if (unlikely(__pyx_v_self->data == Py_None)) {
  7829. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  7830. __PYX_ERR(0, 446, __pyx_L1_error)
  7831. }
  7832. __pyx_t_11 = (__Pyx_PySet_ContainsTF(__pyx_t_3, __pyx_v_self->data, Py_EQ)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 446, __pyx_L1_error)
  7833. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7834. if ((__pyx_t_11 != 0)) {
  7835. __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 446, __pyx_L1_error)
  7836. __Pyx_GOTREF(__pyx_t_3);
  7837. __Pyx_INCREF(__pyx_v_s);
  7838. __Pyx_GIVEREF(__pyx_v_s);
  7839. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_s);
  7840. __Pyx_INCREF(__pyx_v_p);
  7841. __Pyx_GIVEREF(__pyx_v_p);
  7842. PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_p);
  7843. __Pyx_INCREF(__pyx_v_o);
  7844. __Pyx_GIVEREF(__pyx_v_o);
  7845. PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_o);
  7846. __pyx_t_1 = __pyx_t_3;
  7847. __pyx_t_3 = 0;
  7848. } else {
  7849. __pyx_t_3 = PySet_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 446, __pyx_L1_error)
  7850. __Pyx_GOTREF(__pyx_t_3);
  7851. __pyx_t_1 = __pyx_t_3;
  7852. __pyx_t_3 = 0;
  7853. }
  7854. __pyx_r = __pyx_t_1;
  7855. __pyx_t_1 = 0;
  7856. goto __pyx_L0;
  7857. }
  7858. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":425
  7859. *
  7860. *
  7861. * cpdef lookup(self, s, p, o): # <<<<<<<<<<<<<<
  7862. * """
  7863. * Look up triples by a pattern.
  7864. */
  7865. /* function exit code */
  7866. __pyx_L1_error:;
  7867. __Pyx_XDECREF(__pyx_t_1);
  7868. __Pyx_XDECREF(__pyx_t_2);
  7869. __Pyx_XDECREF(__pyx_t_3);
  7870. __Pyx_XDECREF(__pyx_t_4);
  7871. __Pyx_XDECREF(__pyx_t_6);
  7872. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7873. __pyx_r = 0;
  7874. __pyx_L0:;
  7875. __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_r);
  7876. __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_r);
  7877. __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_r);
  7878. __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_r);
  7879. __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_r);
  7880. __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_r);
  7881. __Pyx_XGIVEREF(__pyx_r);
  7882. __Pyx_TraceReturn(__pyx_r, 0);
  7883. __Pyx_RefNannyFinishContext();
  7884. return __pyx_r;
  7885. }
  7886. /* Python wrapper */
  7887. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_43lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  7888. static char __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_42lookup[] = "\n Look up triples by a pattern.\n ";
  7889. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_43lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  7890. PyObject *__pyx_v_s = 0;
  7891. PyObject *__pyx_v_p = 0;
  7892. PyObject *__pyx_v_o = 0;
  7893. PyObject *__pyx_r = 0;
  7894. __Pyx_RefNannyDeclarations
  7895. __Pyx_RefNannySetupContext("lookup (wrapper)", 0);
  7896. {
  7897. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_p,&__pyx_n_s_o,0};
  7898. PyObject* values[3] = {0,0,0};
  7899. if (unlikely(__pyx_kwds)) {
  7900. Py_ssize_t kw_args;
  7901. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  7902. switch (pos_args) {
  7903. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  7904. CYTHON_FALLTHROUGH;
  7905. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  7906. CYTHON_FALLTHROUGH;
  7907. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  7908. CYTHON_FALLTHROUGH;
  7909. case 0: break;
  7910. default: goto __pyx_L5_argtuple_error;
  7911. }
  7912. kw_args = PyDict_Size(__pyx_kwds);
  7913. switch (pos_args) {
  7914. case 0:
  7915. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_s)) != 0)) kw_args--;
  7916. else goto __pyx_L5_argtuple_error;
  7917. CYTHON_FALLTHROUGH;
  7918. case 1:
  7919. if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
  7920. else {
  7921. __Pyx_RaiseArgtupleInvalid("lookup", 1, 3, 3, 1); __PYX_ERR(0, 425, __pyx_L3_error)
  7922. }
  7923. CYTHON_FALLTHROUGH;
  7924. case 2:
  7925. if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_o)) != 0)) kw_args--;
  7926. else {
  7927. __Pyx_RaiseArgtupleInvalid("lookup", 1, 3, 3, 2); __PYX_ERR(0, 425, __pyx_L3_error)
  7928. }
  7929. }
  7930. if (unlikely(kw_args > 0)) {
  7931. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lookup") < 0)) __PYX_ERR(0, 425, __pyx_L3_error)
  7932. }
  7933. } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
  7934. goto __pyx_L5_argtuple_error;
  7935. } else {
  7936. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  7937. values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  7938. values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  7939. }
  7940. __pyx_v_s = values[0];
  7941. __pyx_v_p = values[1];
  7942. __pyx_v_o = values[2];
  7943. }
  7944. goto __pyx_L4_argument_unpacking_done;
  7945. __pyx_L5_argtuple_error:;
  7946. __Pyx_RaiseArgtupleInvalid("lookup", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 425, __pyx_L3_error)
  7947. __pyx_L3_error:;
  7948. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7949. __Pyx_RefNannyFinishContext();
  7950. return NULL;
  7951. __pyx_L4_argument_unpacking_done:;
  7952. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_42lookup(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self), __pyx_v_s, __pyx_v_p, __pyx_v_o);
  7953. /* function exit code */
  7954. __Pyx_RefNannyFinishContext();
  7955. return __pyx_r;
  7956. }
  7957. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_42lookup(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_s, PyObject *__pyx_v_p, PyObject *__pyx_v_o) {
  7958. PyObject *__pyx_r = NULL;
  7959. __Pyx_TraceDeclarations
  7960. __Pyx_RefNannyDeclarations
  7961. PyObject *__pyx_t_1 = NULL;
  7962. __Pyx_RefNannySetupContext("lookup", 0);
  7963. __Pyx_TraceCall("lookup (wrapper)", __pyx_f[0], 425, 0, __PYX_ERR(0, 425, __pyx_L1_error));
  7964. __Pyx_XDECREF(__pyx_r);
  7965. __pyx_t_1 = __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_lookup(__pyx_v_self, __pyx_v_s, __pyx_v_p, __pyx_v_o, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 425, __pyx_L1_error)
  7966. __Pyx_GOTREF(__pyx_t_1);
  7967. __pyx_r = __pyx_t_1;
  7968. __pyx_t_1 = 0;
  7969. goto __pyx_L0;
  7970. /* function exit code */
  7971. __pyx_L1_error:;
  7972. __Pyx_XDECREF(__pyx_t_1);
  7973. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7974. __pyx_r = NULL;
  7975. __pyx_L0:;
  7976. __Pyx_XGIVEREF(__pyx_r);
  7977. __Pyx_TraceReturn(__pyx_r, 0);
  7978. __Pyx_RefNannyFinishContext();
  7979. return __pyx_r;
  7980. }
  7981. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":449
  7982. *
  7983. *
  7984. * cpdef set terms(self, str type): # <<<<<<<<<<<<<<
  7985. * """
  7986. * Get all terms of a type: subject, predicate or object.
  7987. */
  7988. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_45terms(PyObject *__pyx_v_self, PyObject *__pyx_v_type); /*proto*/
  7989. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_terms(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_type, int __pyx_skip_dispatch) {
  7990. PyObject *__pyx_v_i = NULL;
  7991. PyObject *__pyx_9genexpr13__pyx_v_r = NULL;
  7992. PyObject *__pyx_r = NULL;
  7993. __Pyx_TraceDeclarations
  7994. __Pyx_RefNannyDeclarations
  7995. PyObject *__pyx_t_1 = NULL;
  7996. PyObject *__pyx_t_2 = NULL;
  7997. PyObject *__pyx_t_3 = NULL;
  7998. PyObject *__pyx_t_4 = NULL;
  7999. PyObject *__pyx_t_5 = NULL;
  8000. Py_ssize_t __pyx_t_6;
  8001. Py_ssize_t __pyx_t_7;
  8002. int __pyx_t_8;
  8003. int __pyx_t_9;
  8004. __Pyx_RefNannySetupContext("terms", 0);
  8005. __Pyx_TraceCall("terms", __pyx_f[0], 449, 0, __PYX_ERR(0, 449, __pyx_L1_error));
  8006. /* Check if called by wrapper */
  8007. if (unlikely(__pyx_skip_dispatch)) ;
  8008. /* Check if overridden in Python */
  8009. else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
  8010. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_terms); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __pyx_L1_error)
  8011. __Pyx_GOTREF(__pyx_t_1);
  8012. if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_45terms)) {
  8013. __Pyx_XDECREF(__pyx_r);
  8014. __Pyx_INCREF(__pyx_t_1);
  8015. __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
  8016. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  8017. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
  8018. if (likely(__pyx_t_4)) {
  8019. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  8020. __Pyx_INCREF(__pyx_t_4);
  8021. __Pyx_INCREF(function);
  8022. __Pyx_DECREF_SET(__pyx_t_3, function);
  8023. }
  8024. }
  8025. if (!__pyx_t_4) {
  8026. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 449, __pyx_L1_error)
  8027. __Pyx_GOTREF(__pyx_t_2);
  8028. } else {
  8029. #if CYTHON_FAST_PYCALL
  8030. if (PyFunction_Check(__pyx_t_3)) {
  8031. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_type};
  8032. __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 449, __pyx_L1_error)
  8033. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  8034. __Pyx_GOTREF(__pyx_t_2);
  8035. } else
  8036. #endif
  8037. #if CYTHON_FAST_PYCCALL
  8038. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  8039. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_type};
  8040. __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 449, __pyx_L1_error)
  8041. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  8042. __Pyx_GOTREF(__pyx_t_2);
  8043. } else
  8044. #endif
  8045. {
  8046. __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 449, __pyx_L1_error)
  8047. __Pyx_GOTREF(__pyx_t_5);
  8048. __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
  8049. __Pyx_INCREF(__pyx_v_type);
  8050. __Pyx_GIVEREF(__pyx_v_type);
  8051. PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_type);
  8052. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 449, __pyx_L1_error)
  8053. __Pyx_GOTREF(__pyx_t_2);
  8054. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8055. }
  8056. }
  8057. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8058. if (!(likely(PySet_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "set", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 449, __pyx_L1_error)
  8059. __pyx_r = ((PyObject*)__pyx_t_2);
  8060. __pyx_t_2 = 0;
  8061. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8062. goto __pyx_L0;
  8063. }
  8064. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8065. }
  8066. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":455
  8067. * :param str type: One of ``s``, ``p`` or ``o``.
  8068. * """
  8069. * i = 'spo'.index(type) # <<<<<<<<<<<<<<
  8070. * return {r[i] for r in self.data}
  8071. *
  8072. */
  8073. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_n_u_spo, __pyx_n_s_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 455, __pyx_L1_error)
  8074. __Pyx_GOTREF(__pyx_t_2);
  8075. __pyx_t_3 = NULL;
  8076. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
  8077. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  8078. if (likely(__pyx_t_3)) {
  8079. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  8080. __Pyx_INCREF(__pyx_t_3);
  8081. __Pyx_INCREF(function);
  8082. __Pyx_DECREF_SET(__pyx_t_2, function);
  8083. }
  8084. }
  8085. if (!__pyx_t_3) {
  8086. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 455, __pyx_L1_error)
  8087. __Pyx_GOTREF(__pyx_t_1);
  8088. } else {
  8089. #if CYTHON_FAST_PYCALL
  8090. if (PyFunction_Check(__pyx_t_2)) {
  8091. PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_type};
  8092. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 455, __pyx_L1_error)
  8093. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  8094. __Pyx_GOTREF(__pyx_t_1);
  8095. } else
  8096. #endif
  8097. #if CYTHON_FAST_PYCCALL
  8098. if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
  8099. PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_type};
  8100. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 455, __pyx_L1_error)
  8101. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  8102. __Pyx_GOTREF(__pyx_t_1);
  8103. } else
  8104. #endif
  8105. {
  8106. __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 455, __pyx_L1_error)
  8107. __Pyx_GOTREF(__pyx_t_5);
  8108. __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
  8109. __Pyx_INCREF(__pyx_v_type);
  8110. __Pyx_GIVEREF(__pyx_v_type);
  8111. PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_type);
  8112. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 455, __pyx_L1_error)
  8113. __Pyx_GOTREF(__pyx_t_1);
  8114. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8115. }
  8116. }
  8117. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8118. __pyx_v_i = __pyx_t_1;
  8119. __pyx_t_1 = 0;
  8120. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":456
  8121. * """
  8122. * i = 'spo'.index(type)
  8123. * return {r[i] for r in self.data} # <<<<<<<<<<<<<<
  8124. *
  8125. *
  8126. */
  8127. __Pyx_XDECREF(__pyx_r);
  8128. { /* enter inner scope */
  8129. __pyx_t_1 = PySet_New(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 456, __pyx_L5_error)
  8130. __Pyx_GOTREF(__pyx_t_1);
  8131. __pyx_t_6 = 0;
  8132. __pyx_t_5 = __Pyx_set_iterator(__pyx_v_self->data, 1, (&__pyx_t_7), (&__pyx_t_8)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 456, __pyx_L5_error)
  8133. __Pyx_GOTREF(__pyx_t_5);
  8134. __Pyx_XDECREF(__pyx_t_2);
  8135. __pyx_t_2 = __pyx_t_5;
  8136. __pyx_t_5 = 0;
  8137. while (1) {
  8138. __pyx_t_9 = __Pyx_set_iter_next(__pyx_t_2, __pyx_t_7, &__pyx_t_6, &__pyx_t_5, __pyx_t_8);
  8139. if (unlikely(__pyx_t_9 == 0)) break;
  8140. if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 456, __pyx_L5_error)
  8141. __Pyx_GOTREF(__pyx_t_5);
  8142. __Pyx_XDECREF_SET(__pyx_9genexpr13__pyx_v_r, __pyx_t_5);
  8143. __pyx_t_5 = 0;
  8144. __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_9genexpr13__pyx_v_r, __pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 456, __pyx_L5_error)
  8145. __Pyx_GOTREF(__pyx_t_5);
  8146. if (unlikely(PySet_Add(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 456, __pyx_L5_error)
  8147. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8148. }
  8149. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8150. __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_r); __pyx_9genexpr13__pyx_v_r = 0;
  8151. goto __pyx_L8_exit_scope;
  8152. __pyx_L5_error:;
  8153. __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_r); __pyx_9genexpr13__pyx_v_r = 0;
  8154. goto __pyx_L1_error;
  8155. __pyx_L8_exit_scope:;
  8156. } /* exit inner scope */
  8157. __pyx_r = ((PyObject*)__pyx_t_1);
  8158. __pyx_t_1 = 0;
  8159. goto __pyx_L0;
  8160. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":449
  8161. *
  8162. *
  8163. * cpdef set terms(self, str type): # <<<<<<<<<<<<<<
  8164. * """
  8165. * Get all terms of a type: subject, predicate or object.
  8166. */
  8167. /* function exit code */
  8168. __pyx_L1_error:;
  8169. __Pyx_XDECREF(__pyx_t_1);
  8170. __Pyx_XDECREF(__pyx_t_2);
  8171. __Pyx_XDECREF(__pyx_t_3);
  8172. __Pyx_XDECREF(__pyx_t_4);
  8173. __Pyx_XDECREF(__pyx_t_5);
  8174. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.terms", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8175. __pyx_r = 0;
  8176. __pyx_L0:;
  8177. __Pyx_XDECREF(__pyx_v_i);
  8178. __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_r);
  8179. __Pyx_XGIVEREF(__pyx_r);
  8180. __Pyx_TraceReturn(__pyx_r, 0);
  8181. __Pyx_RefNannyFinishContext();
  8182. return __pyx_r;
  8183. }
  8184. /* Python wrapper */
  8185. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_45terms(PyObject *__pyx_v_self, PyObject *__pyx_v_type); /*proto*/
  8186. static char __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_44terms[] = "\n Get all terms of a type: subject, predicate or object.\n\n :param str type: One of ``s``, ``p`` or ``o``.\n ";
  8187. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_45terms(PyObject *__pyx_v_self, PyObject *__pyx_v_type) {
  8188. PyObject *__pyx_r = 0;
  8189. __Pyx_RefNannyDeclarations
  8190. __Pyx_RefNannySetupContext("terms (wrapper)", 0);
  8191. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_type), (&PyUnicode_Type), 1, "type", 1))) __PYX_ERR(0, 449, __pyx_L1_error)
  8192. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_44terms(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self), ((PyObject*)__pyx_v_type));
  8193. /* function exit code */
  8194. goto __pyx_L0;
  8195. __pyx_L1_error:;
  8196. __pyx_r = NULL;
  8197. __pyx_L0:;
  8198. __Pyx_RefNannyFinishContext();
  8199. return __pyx_r;
  8200. }
  8201. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_44terms(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v_type) {
  8202. PyObject *__pyx_r = NULL;
  8203. __Pyx_TraceDeclarations
  8204. __Pyx_RefNannyDeclarations
  8205. PyObject *__pyx_t_1 = NULL;
  8206. __Pyx_RefNannySetupContext("terms", 0);
  8207. __Pyx_TraceCall("terms (wrapper)", __pyx_f[0], 449, 0, __PYX_ERR(0, 449, __pyx_L1_error));
  8208. __Pyx_XDECREF(__pyx_r);
  8209. __pyx_t_1 = __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_terms(__pyx_v_self, __pyx_v_type, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __pyx_L1_error)
  8210. __Pyx_GOTREF(__pyx_t_1);
  8211. __pyx_r = __pyx_t_1;
  8212. __pyx_t_1 = 0;
  8213. goto __pyx_L0;
  8214. /* function exit code */
  8215. __pyx_L1_error:;
  8216. __Pyx_XDECREF(__pyx_t_1);
  8217. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.terms", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8218. __pyx_r = NULL;
  8219. __pyx_L0:;
  8220. __Pyx_XGIVEREF(__pyx_r);
  8221. __Pyx_TraceReturn(__pyx_r, 0);
  8222. __Pyx_RefNannyFinishContext();
  8223. return __pyx_r;
  8224. }
  8225. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":246
  8226. *
  8227. * cdef:
  8228. * readonly set data # <<<<<<<<<<<<<<
  8229. *
  8230. * def __init__(
  8231. */
  8232. /* Python wrapper */
  8233. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_4data_1__get__(PyObject *__pyx_v_self); /*proto*/
  8234. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_4data_1__get__(PyObject *__pyx_v_self) {
  8235. PyObject *__pyx_r = 0;
  8236. __Pyx_RefNannyDeclarations
  8237. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  8238. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_4data___get__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self));
  8239. /* function exit code */
  8240. __Pyx_RefNannyFinishContext();
  8241. return __pyx_r;
  8242. }
  8243. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_4data___get__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self) {
  8244. PyObject *__pyx_r = NULL;
  8245. __Pyx_TraceDeclarations
  8246. __Pyx_RefNannyDeclarations
  8247. __Pyx_RefNannySetupContext("__get__", 0);
  8248. __Pyx_TraceCall("__get__", __pyx_f[0], 246, 0, __PYX_ERR(0, 246, __pyx_L1_error));
  8249. __Pyx_XDECREF(__pyx_r);
  8250. __Pyx_INCREF(__pyx_v_self->data);
  8251. __pyx_r = __pyx_v_self->data;
  8252. goto __pyx_L0;
  8253. /* function exit code */
  8254. __pyx_L1_error:;
  8255. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.data.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8256. __pyx_r = NULL;
  8257. __pyx_L0:;
  8258. __Pyx_XGIVEREF(__pyx_r);
  8259. __Pyx_TraceReturn(__pyx_r, 0);
  8260. __Pyx_RefNannyFinishContext();
  8261. return __pyx_r;
  8262. }
  8263. /* "(tree fragment)":1
  8264. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  8265. * cdef bint use_setstate
  8266. * state = (self.data,)
  8267. */
  8268. /* Python wrapper */
  8269. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_47__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  8270. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_47__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  8271. PyObject *__pyx_r = 0;
  8272. __Pyx_RefNannyDeclarations
  8273. __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  8274. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_46__reduce_cython__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self));
  8275. /* function exit code */
  8276. __Pyx_RefNannyFinishContext();
  8277. return __pyx_r;
  8278. }
  8279. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_46__reduce_cython__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self) {
  8280. int __pyx_v_use_setstate;
  8281. PyObject *__pyx_v_state = NULL;
  8282. PyObject *__pyx_v__dict = NULL;
  8283. PyObject *__pyx_r = NULL;
  8284. __Pyx_TraceDeclarations
  8285. __Pyx_RefNannyDeclarations
  8286. PyObject *__pyx_t_1 = NULL;
  8287. int __pyx_t_2;
  8288. int __pyx_t_3;
  8289. PyObject *__pyx_t_4 = NULL;
  8290. PyObject *__pyx_t_5 = NULL;
  8291. __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  8292. __Pyx_TraceCall("__reduce_cython__", __pyx_f[1], 1, 0, __PYX_ERR(1, 1, __pyx_L1_error));
  8293. /* "(tree fragment)":3
  8294. * def __reduce_cython__(self):
  8295. * cdef bint use_setstate
  8296. * state = (self.data,) # <<<<<<<<<<<<<<
  8297. * _dict = getattr(self, '__dict__', None)
  8298. * if _dict is not None:
  8299. */
  8300. __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3, __pyx_L1_error)
  8301. __Pyx_GOTREF(__pyx_t_1);
  8302. __Pyx_INCREF(__pyx_v_self->data);
  8303. __Pyx_GIVEREF(__pyx_v_self->data);
  8304. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->data);
  8305. __pyx_v_state = ((PyObject*)__pyx_t_1);
  8306. __pyx_t_1 = 0;
  8307. /* "(tree fragment)":4
  8308. * cdef bint use_setstate
  8309. * state = (self.data,)
  8310. * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<<
  8311. * if _dict is not None:
  8312. * state += (_dict,)
  8313. */
  8314. __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  8315. __Pyx_GOTREF(__pyx_t_1);
  8316. __pyx_v__dict = __pyx_t_1;
  8317. __pyx_t_1 = 0;
  8318. /* "(tree fragment)":5
  8319. * state = (self.data,)
  8320. * _dict = getattr(self, '__dict__', None)
  8321. * if _dict is not None: # <<<<<<<<<<<<<<
  8322. * state += (_dict,)
  8323. * use_setstate = True
  8324. */
  8325. __pyx_t_2 = (__pyx_v__dict != Py_None);
  8326. __pyx_t_3 = (__pyx_t_2 != 0);
  8327. if (__pyx_t_3) {
  8328. /* "(tree fragment)":6
  8329. * _dict = getattr(self, '__dict__', None)
  8330. * if _dict is not None:
  8331. * state += (_dict,) # <<<<<<<<<<<<<<
  8332. * use_setstate = True
  8333. * else:
  8334. */
  8335. __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
  8336. __Pyx_GOTREF(__pyx_t_1);
  8337. __Pyx_INCREF(__pyx_v__dict);
  8338. __Pyx_GIVEREF(__pyx_v__dict);
  8339. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
  8340. __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
  8341. __Pyx_GOTREF(__pyx_t_4);
  8342. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8343. __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
  8344. __pyx_t_4 = 0;
  8345. /* "(tree fragment)":7
  8346. * if _dict is not None:
  8347. * state += (_dict,)
  8348. * use_setstate = True # <<<<<<<<<<<<<<
  8349. * else:
  8350. * use_setstate = self.data is not None
  8351. */
  8352. __pyx_v_use_setstate = 1;
  8353. /* "(tree fragment)":5
  8354. * state = (self.data,)
  8355. * _dict = getattr(self, '__dict__', None)
  8356. * if _dict is not None: # <<<<<<<<<<<<<<
  8357. * state += (_dict,)
  8358. * use_setstate = True
  8359. */
  8360. goto __pyx_L3;
  8361. }
  8362. /* "(tree fragment)":9
  8363. * use_setstate = True
  8364. * else:
  8365. * use_setstate = self.data is not None # <<<<<<<<<<<<<<
  8366. * if use_setstate:
  8367. * return __pyx_unpickle_SimpleGraph, (type(self), 0x8d777f3, None), state
  8368. */
  8369. /*else*/ {
  8370. __pyx_t_3 = (__pyx_v_self->data != ((PyObject*)Py_None));
  8371. __pyx_v_use_setstate = __pyx_t_3;
  8372. }
  8373. __pyx_L3:;
  8374. /* "(tree fragment)":10
  8375. * else:
  8376. * use_setstate = self.data is not None
  8377. * if use_setstate: # <<<<<<<<<<<<<<
  8378. * return __pyx_unpickle_SimpleGraph, (type(self), 0x8d777f3, None), state
  8379. * else:
  8380. */
  8381. __pyx_t_3 = (__pyx_v_use_setstate != 0);
  8382. if (__pyx_t_3) {
  8383. /* "(tree fragment)":11
  8384. * use_setstate = self.data is not None
  8385. * if use_setstate:
  8386. * return __pyx_unpickle_SimpleGraph, (type(self), 0x8d777f3, None), state # <<<<<<<<<<<<<<
  8387. * else:
  8388. * return __pyx_unpickle_SimpleGraph, (type(self), 0x8d777f3, state)
  8389. */
  8390. __Pyx_XDECREF(__pyx_r);
  8391. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_SimpleGraph); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 11, __pyx_L1_error)
  8392. __Pyx_GOTREF(__pyx_t_4);
  8393. __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 11, __pyx_L1_error)
  8394. __Pyx_GOTREF(__pyx_t_1);
  8395. __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  8396. __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  8397. PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  8398. __Pyx_INCREF(__pyx_int_148338675);
  8399. __Pyx_GIVEREF(__pyx_int_148338675);
  8400. PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_148338675);
  8401. __Pyx_INCREF(Py_None);
  8402. __Pyx_GIVEREF(Py_None);
  8403. PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
  8404. __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 11, __pyx_L1_error)
  8405. __Pyx_GOTREF(__pyx_t_5);
  8406. __Pyx_GIVEREF(__pyx_t_4);
  8407. PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  8408. __Pyx_GIVEREF(__pyx_t_1);
  8409. PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
  8410. __Pyx_INCREF(__pyx_v_state);
  8411. __Pyx_GIVEREF(__pyx_v_state);
  8412. PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
  8413. __pyx_t_4 = 0;
  8414. __pyx_t_1 = 0;
  8415. __pyx_r = __pyx_t_5;
  8416. __pyx_t_5 = 0;
  8417. goto __pyx_L0;
  8418. /* "(tree fragment)":10
  8419. * else:
  8420. * use_setstate = self.data is not None
  8421. * if use_setstate: # <<<<<<<<<<<<<<
  8422. * return __pyx_unpickle_SimpleGraph, (type(self), 0x8d777f3, None), state
  8423. * else:
  8424. */
  8425. }
  8426. /* "(tree fragment)":13
  8427. * return __pyx_unpickle_SimpleGraph, (type(self), 0x8d777f3, None), state
  8428. * else:
  8429. * return __pyx_unpickle_SimpleGraph, (type(self), 0x8d777f3, state) # <<<<<<<<<<<<<<
  8430. * def __setstate_cython__(self, __pyx_state):
  8431. * __pyx_unpickle_SimpleGraph__set_state(self, __pyx_state)
  8432. */
  8433. /*else*/ {
  8434. __Pyx_XDECREF(__pyx_r);
  8435. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_SimpleGraph); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
  8436. __Pyx_GOTREF(__pyx_t_5);
  8437. __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
  8438. __Pyx_GOTREF(__pyx_t_1);
  8439. __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  8440. __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  8441. PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  8442. __Pyx_INCREF(__pyx_int_148338675);
  8443. __Pyx_GIVEREF(__pyx_int_148338675);
  8444. PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_148338675);
  8445. __Pyx_INCREF(__pyx_v_state);
  8446. __Pyx_GIVEREF(__pyx_v_state);
  8447. PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
  8448. __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
  8449. __Pyx_GOTREF(__pyx_t_4);
  8450. __Pyx_GIVEREF(__pyx_t_5);
  8451. PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  8452. __Pyx_GIVEREF(__pyx_t_1);
  8453. PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
  8454. __pyx_t_5 = 0;
  8455. __pyx_t_1 = 0;
  8456. __pyx_r = __pyx_t_4;
  8457. __pyx_t_4 = 0;
  8458. goto __pyx_L0;
  8459. }
  8460. /* "(tree fragment)":1
  8461. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  8462. * cdef bint use_setstate
  8463. * state = (self.data,)
  8464. */
  8465. /* function exit code */
  8466. __pyx_L1_error:;
  8467. __Pyx_XDECREF(__pyx_t_1);
  8468. __Pyx_XDECREF(__pyx_t_4);
  8469. __Pyx_XDECREF(__pyx_t_5);
  8470. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8471. __pyx_r = NULL;
  8472. __pyx_L0:;
  8473. __Pyx_XDECREF(__pyx_v_state);
  8474. __Pyx_XDECREF(__pyx_v__dict);
  8475. __Pyx_XGIVEREF(__pyx_r);
  8476. __Pyx_TraceReturn(__pyx_r, 0);
  8477. __Pyx_RefNannyFinishContext();
  8478. return __pyx_r;
  8479. }
  8480. /* "(tree fragment)":14
  8481. * else:
  8482. * return __pyx_unpickle_SimpleGraph, (type(self), 0x8d777f3, state)
  8483. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  8484. * __pyx_unpickle_SimpleGraph__set_state(self, __pyx_state)
  8485. */
  8486. /* Python wrapper */
  8487. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_49__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
  8488. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_49__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  8489. PyObject *__pyx_r = 0;
  8490. __Pyx_RefNannyDeclarations
  8491. __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  8492. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_48__setstate_cython__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
  8493. /* function exit code */
  8494. __Pyx_RefNannyFinishContext();
  8495. return __pyx_r;
  8496. }
  8497. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_48__setstate_cython__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  8498. PyObject *__pyx_r = NULL;
  8499. __Pyx_TraceDeclarations
  8500. __Pyx_RefNannyDeclarations
  8501. PyObject *__pyx_t_1 = NULL;
  8502. __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  8503. __Pyx_TraceCall("__setstate_cython__", __pyx_f[1], 14, 0, __PYX_ERR(1, 14, __pyx_L1_error));
  8504. /* "(tree fragment)":15
  8505. * return __pyx_unpickle_SimpleGraph, (type(self), 0x8d777f3, state)
  8506. * def __setstate_cython__(self, __pyx_state):
  8507. * __pyx_unpickle_SimpleGraph__set_state(self, __pyx_state) # <<<<<<<<<<<<<<
  8508. */
  8509. if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 15, __pyx_L1_error)
  8510. __pyx_t_1 = __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_unpickle_SimpleGraph__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
  8511. __Pyx_GOTREF(__pyx_t_1);
  8512. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8513. /* "(tree fragment)":14
  8514. * else:
  8515. * return __pyx_unpickle_SimpleGraph, (type(self), 0x8d777f3, state)
  8516. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  8517. * __pyx_unpickle_SimpleGraph__set_state(self, __pyx_state)
  8518. */
  8519. /* function exit code */
  8520. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  8521. goto __pyx_L0;
  8522. __pyx_L1_error:;
  8523. __Pyx_XDECREF(__pyx_t_1);
  8524. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8525. __pyx_r = NULL;
  8526. __pyx_L0:;
  8527. __Pyx_XGIVEREF(__pyx_r);
  8528. __Pyx_TraceReturn(__pyx_r, 0);
  8529. __Pyx_RefNannyFinishContext();
  8530. return __pyx_r;
  8531. }
  8532. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":473
  8533. * readonly object uri
  8534. *
  8535. * def __init__(self, uri, *args, **kwargs): # <<<<<<<<<<<<<<
  8536. * """
  8537. * Initialize the graph with pre-existing data or by looking up a store.
  8538. */
  8539. /* Python wrapper */
  8540. static int __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  8541. static char __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr___init__[] = "\n Initialize the graph with pre-existing data or by looking up a store.\n\n Either ``data``, or ``lookup`` *and* ``store``, can be provide.\n ``lookup`` and ``store`` have precedence. If none of them is specified,\n an empty graph is initialized.\n\n :param rdflib.URIRef uri: The graph URI.\n This will serve as the subject for some queries.\n :param set data: Initial data as a set of 3-tuples of RDFLib terms.\n :param tuple lookup: tuple of a 3-tuple of lookup terms, and a context.\n E.g. ``((URIRef('urn:ns:a'), None, None), URIRef('urn:ns:ctx'))``.\n Any and all elements may be ``None``.\n :param lmdbStore store: the store to look data up.\n ";
  8542. #if CYTHON_COMPILING_IN_CPYTHON
  8543. struct wrapperbase __pyx_wrapperbase_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr___init__;
  8544. #endif
  8545. static int __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  8546. PyObject *__pyx_v_uri = 0;
  8547. PyObject *__pyx_v_args = 0;
  8548. PyObject *__pyx_v_kwargs = 0;
  8549. int __pyx_r;
  8550. __Pyx_RefNannyDeclarations
  8551. __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  8552. __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
  8553. __Pyx_GOTREF(__pyx_v_kwargs);
  8554. if (PyTuple_GET_SIZE(__pyx_args) > 1) {
  8555. __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
  8556. if (unlikely(!__pyx_v_args)) {
  8557. __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  8558. __Pyx_RefNannyFinishContext();
  8559. return -1;
  8560. }
  8561. __Pyx_GOTREF(__pyx_v_args);
  8562. } else {
  8563. __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  8564. }
  8565. {
  8566. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_uri,0};
  8567. PyObject* values[1] = {0};
  8568. if (unlikely(__pyx_kwds)) {
  8569. Py_ssize_t kw_args;
  8570. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  8571. switch (pos_args) {
  8572. default:
  8573. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  8574. CYTHON_FALLTHROUGH;
  8575. case 0: break;
  8576. }
  8577. kw_args = PyDict_Size(__pyx_kwds);
  8578. switch (pos_args) {
  8579. case 0:
  8580. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_uri)) != 0)) kw_args--;
  8581. else goto __pyx_L5_argtuple_error;
  8582. }
  8583. if (unlikely(kw_args > 0)) {
  8584. const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
  8585. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__init__") < 0)) __PYX_ERR(0, 473, __pyx_L3_error)
  8586. }
  8587. } else if (PyTuple_GET_SIZE(__pyx_args) < 1) {
  8588. goto __pyx_L5_argtuple_error;
  8589. } else {
  8590. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  8591. }
  8592. __pyx_v_uri = values[0];
  8593. }
  8594. goto __pyx_L4_argument_unpacking_done;
  8595. __pyx_L5_argtuple_error:;
  8596. __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 473, __pyx_L3_error)
  8597. __pyx_L3_error:;
  8598. __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  8599. __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  8600. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.Imr.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8601. __Pyx_RefNannyFinishContext();
  8602. return -1;
  8603. __pyx_L4_argument_unpacking_done:;
  8604. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr___init__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *)__pyx_v_self), __pyx_v_uri, __pyx_v_args, __pyx_v_kwargs);
  8605. /* function exit code */
  8606. __Pyx_XDECREF(__pyx_v_args);
  8607. __Pyx_XDECREF(__pyx_v_kwargs);
  8608. __Pyx_RefNannyFinishContext();
  8609. return __pyx_r;
  8610. }
  8611. static int __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr___init__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *__pyx_v_self, PyObject *__pyx_v_uri, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  8612. int __pyx_r;
  8613. __Pyx_TraceDeclarations
  8614. __Pyx_RefNannyDeclarations
  8615. PyObject *__pyx_t_1 = NULL;
  8616. PyObject *__pyx_t_2 = NULL;
  8617. __Pyx_RefNannySetupContext("__init__", 0);
  8618. __Pyx_TraceCall("__init__", __pyx_f[0], 473, 0, __PYX_ERR(0, 473, __pyx_L1_error));
  8619. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":489
  8620. * :param lmdbStore store: the store to look data up.
  8621. * """
  8622. * super().__init__(*args, **kwargs) # <<<<<<<<<<<<<<
  8623. *
  8624. * self.uri = uri
  8625. */
  8626. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 489, __pyx_L1_error)
  8627. __Pyx_GOTREF(__pyx_t_1);
  8628. __Pyx_INCREF(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr));
  8629. __Pyx_GIVEREF(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr));
  8630. PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr));
  8631. __Pyx_INCREF(((PyObject *)__pyx_v_self));
  8632. __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  8633. PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self));
  8634. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 489, __pyx_L1_error)
  8635. __Pyx_GOTREF(__pyx_t_2);
  8636. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8637. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 489, __pyx_L1_error)
  8638. __Pyx_GOTREF(__pyx_t_1);
  8639. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8640. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 489, __pyx_L1_error)
  8641. __Pyx_GOTREF(__pyx_t_2);
  8642. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8643. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8644. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":491
  8645. * super().__init__(*args, **kwargs)
  8646. *
  8647. * self.uri = uri # <<<<<<<<<<<<<<
  8648. *
  8649. *
  8650. */
  8651. __Pyx_INCREF(__pyx_v_uri);
  8652. __Pyx_GIVEREF(__pyx_v_uri);
  8653. __Pyx_GOTREF(__pyx_v_self->uri);
  8654. __Pyx_DECREF(__pyx_v_self->uri);
  8655. __pyx_v_self->uri = __pyx_v_uri;
  8656. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":473
  8657. * readonly object uri
  8658. *
  8659. * def __init__(self, uri, *args, **kwargs): # <<<<<<<<<<<<<<
  8660. * """
  8661. * Initialize the graph with pre-existing data or by looking up a store.
  8662. */
  8663. /* function exit code */
  8664. __pyx_r = 0;
  8665. goto __pyx_L0;
  8666. __pyx_L1_error:;
  8667. __Pyx_XDECREF(__pyx_t_1);
  8668. __Pyx_XDECREF(__pyx_t_2);
  8669. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.Imr.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8670. __pyx_r = -1;
  8671. __pyx_L0:;
  8672. __Pyx_TraceReturn(Py_None, 0);
  8673. __Pyx_RefNannyFinishContext();
  8674. return __pyx_r;
  8675. }
  8676. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":495
  8677. *
  8678. * @property
  8679. * def identifier(self): # <<<<<<<<<<<<<<
  8680. * """
  8681. * IMR URI. For compatibility with RDFLib Resource.
  8682. */
  8683. /* Python wrapper */
  8684. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_10identifier_1__get__(PyObject *__pyx_v_self); /*proto*/
  8685. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_10identifier_1__get__(PyObject *__pyx_v_self) {
  8686. PyObject *__pyx_r = 0;
  8687. __Pyx_RefNannyDeclarations
  8688. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  8689. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_10identifier___get__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *)__pyx_v_self));
  8690. /* function exit code */
  8691. __Pyx_RefNannyFinishContext();
  8692. return __pyx_r;
  8693. }
  8694. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_10identifier___get__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *__pyx_v_self) {
  8695. PyObject *__pyx_r = NULL;
  8696. __Pyx_TraceDeclarations
  8697. __Pyx_RefNannyDeclarations
  8698. __Pyx_RefNannySetupContext("__get__", 0);
  8699. __Pyx_TraceCall("__get__", __pyx_f[0], 495, 0, __PYX_ERR(0, 495, __pyx_L1_error));
  8700. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":501
  8701. * :rtype: string
  8702. * """
  8703. * return self.uri # <<<<<<<<<<<<<<
  8704. *
  8705. *
  8706. */
  8707. __Pyx_XDECREF(__pyx_r);
  8708. __Pyx_INCREF(__pyx_v_self->uri);
  8709. __pyx_r = __pyx_v_self->uri;
  8710. goto __pyx_L0;
  8711. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":495
  8712. *
  8713. * @property
  8714. * def identifier(self): # <<<<<<<<<<<<<<
  8715. * """
  8716. * IMR URI. For compatibility with RDFLib Resource.
  8717. */
  8718. /* function exit code */
  8719. __pyx_L1_error:;
  8720. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.Imr.identifier.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8721. __pyx_r = NULL;
  8722. __pyx_L0:;
  8723. __Pyx_XGIVEREF(__pyx_r);
  8724. __Pyx_TraceReturn(__pyx_r, 0);
  8725. __Pyx_RefNannyFinishContext();
  8726. return __pyx_r;
  8727. }
  8728. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":505
  8729. *
  8730. * @property
  8731. * def graph(self): # <<<<<<<<<<<<<<
  8732. * """
  8733. * Return a SimpleGraph with the same data.
  8734. */
  8735. /* Python wrapper */
  8736. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_5graph_1__get__(PyObject *__pyx_v_self); /*proto*/
  8737. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_5graph_1__get__(PyObject *__pyx_v_self) {
  8738. PyObject *__pyx_r = 0;
  8739. __Pyx_RefNannyDeclarations
  8740. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  8741. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_5graph___get__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *)__pyx_v_self));
  8742. /* function exit code */
  8743. __Pyx_RefNannyFinishContext();
  8744. return __pyx_r;
  8745. }
  8746. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_5graph___get__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *__pyx_v_self) {
  8747. PyObject *__pyx_r = NULL;
  8748. __Pyx_TraceDeclarations
  8749. __Pyx_RefNannyDeclarations
  8750. PyObject *__pyx_t_1 = NULL;
  8751. __Pyx_RefNannySetupContext("__get__", 0);
  8752. __Pyx_TraceCall("__get__", __pyx_f[0], 505, 0, __PYX_ERR(0, 505, __pyx_L1_error));
  8753. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":511
  8754. * :rtype: SimpleGraph
  8755. * """
  8756. * return SimpleGraph(self.data) # <<<<<<<<<<<<<<
  8757. *
  8758. *
  8759. */
  8760. __Pyx_XDECREF(__pyx_r);
  8761. __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph), __pyx_v_self->__pyx_base.data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 511, __pyx_L1_error)
  8762. __Pyx_GOTREF(__pyx_t_1);
  8763. __pyx_r = __pyx_t_1;
  8764. __pyx_t_1 = 0;
  8765. goto __pyx_L0;
  8766. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":505
  8767. *
  8768. * @property
  8769. * def graph(self): # <<<<<<<<<<<<<<
  8770. * """
  8771. * Return a SimpleGraph with the same data.
  8772. */
  8773. /* function exit code */
  8774. __pyx_L1_error:;
  8775. __Pyx_XDECREF(__pyx_t_1);
  8776. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.Imr.graph.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8777. __pyx_r = NULL;
  8778. __pyx_L0:;
  8779. __Pyx_XGIVEREF(__pyx_r);
  8780. __Pyx_TraceReturn(__pyx_r, 0);
  8781. __Pyx_RefNannyFinishContext();
  8782. return __pyx_r;
  8783. }
  8784. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":514
  8785. *
  8786. *
  8787. * def __repr__(self): # <<<<<<<<<<<<<<
  8788. * return (f'<{self.__class__.__name__} @{hex(id(self))} uri={self.uri}, '
  8789. * f'length={len(self.data)}>')
  8790. */
  8791. /* Python wrapper */
  8792. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_3__repr__(PyObject *__pyx_v_self); /*proto*/
  8793. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_3__repr__(PyObject *__pyx_v_self) {
  8794. PyObject *__pyx_r = 0;
  8795. __Pyx_RefNannyDeclarations
  8796. __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  8797. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_2__repr__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *)__pyx_v_self));
  8798. /* function exit code */
  8799. __Pyx_RefNannyFinishContext();
  8800. return __pyx_r;
  8801. }
  8802. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_2__repr__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *__pyx_v_self) {
  8803. PyObject *__pyx_r = NULL;
  8804. __Pyx_TraceDeclarations
  8805. __Pyx_RefNannyDeclarations
  8806. PyObject *__pyx_t_1 = NULL;
  8807. Py_ssize_t __pyx_t_2;
  8808. Py_UCS4 __pyx_t_3;
  8809. PyObject *__pyx_t_4 = NULL;
  8810. PyObject *__pyx_t_5 = NULL;
  8811. Py_ssize_t __pyx_t_6;
  8812. __Pyx_RefNannySetupContext("__repr__", 0);
  8813. __Pyx_TraceCall("__repr__", __pyx_f[0], 514, 0, __PYX_ERR(0, 514, __pyx_L1_error));
  8814. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":515
  8815. *
  8816. * def __repr__(self):
  8817. * return (f'<{self.__class__.__name__} @{hex(id(self))} uri={self.uri}, ' # <<<<<<<<<<<<<<
  8818. * f'length={len(self.data)}>')
  8819. *
  8820. */
  8821. __Pyx_XDECREF(__pyx_r);
  8822. __pyx_t_1 = PyTuple_New(9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __pyx_L1_error)
  8823. __Pyx_GOTREF(__pyx_t_1);
  8824. __pyx_t_2 = 0;
  8825. __pyx_t_3 = 127;
  8826. __Pyx_INCREF(__pyx_kp_u__8);
  8827. __pyx_t_2 += 1;
  8828. __Pyx_GIVEREF(__pyx_kp_u__8);
  8829. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u__8);
  8830. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 515, __pyx_L1_error)
  8831. __Pyx_GOTREF(__pyx_t_4);
  8832. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 515, __pyx_L1_error)
  8833. __Pyx_GOTREF(__pyx_t_5);
  8834. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  8835. __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 515, __pyx_L1_error)
  8836. __Pyx_GOTREF(__pyx_t_4);
  8837. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8838. __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  8839. __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  8840. __Pyx_GIVEREF(__pyx_t_4);
  8841. PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
  8842. __pyx_t_4 = 0;
  8843. __Pyx_INCREF(__pyx_kp_u__9);
  8844. __pyx_t_2 += 2;
  8845. __Pyx_GIVEREF(__pyx_kp_u__9);
  8846. PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__9);
  8847. __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 515, __pyx_L1_error)
  8848. __Pyx_GOTREF(__pyx_t_4);
  8849. __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_hex, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 515, __pyx_L1_error)
  8850. __Pyx_GOTREF(__pyx_t_5);
  8851. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  8852. __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 515, __pyx_L1_error)
  8853. __Pyx_GOTREF(__pyx_t_4);
  8854. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8855. __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  8856. __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  8857. __Pyx_GIVEREF(__pyx_t_4);
  8858. PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4);
  8859. __pyx_t_4 = 0;
  8860. __Pyx_INCREF(__pyx_kp_u_uri_2);
  8861. __pyx_t_2 += 5;
  8862. __Pyx_GIVEREF(__pyx_kp_u_uri_2);
  8863. PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_uri_2);
  8864. __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_self->uri, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 515, __pyx_L1_error)
  8865. __Pyx_GOTREF(__pyx_t_4);
  8866. __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3;
  8867. __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  8868. __Pyx_GIVEREF(__pyx_t_4);
  8869. PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_4);
  8870. __pyx_t_4 = 0;
  8871. __Pyx_INCREF(__pyx_kp_u_length_2);
  8872. __pyx_t_2 += 9;
  8873. __Pyx_GIVEREF(__pyx_kp_u_length_2);
  8874. PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_kp_u_length_2);
  8875. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":516
  8876. * def __repr__(self):
  8877. * return (f'<{self.__class__.__name__} @{hex(id(self))} uri={self.uri}, '
  8878. * f'length={len(self.data)}>') # <<<<<<<<<<<<<<
  8879. *
  8880. * @use_data
  8881. */
  8882. __pyx_t_4 = __pyx_v_self->__pyx_base.data;
  8883. __Pyx_INCREF(__pyx_t_4);
  8884. if (unlikely(__pyx_t_4 == Py_None)) {
  8885. PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
  8886. __PYX_ERR(0, 516, __pyx_L1_error)
  8887. }
  8888. __pyx_t_6 = PySet_GET_SIZE(__pyx_t_4); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 516, __pyx_L1_error)
  8889. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  8890. __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_t_6, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 516, __pyx_L1_error)
  8891. __Pyx_GOTREF(__pyx_t_4);
  8892. __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  8893. __Pyx_GIVEREF(__pyx_t_4);
  8894. PyTuple_SET_ITEM(__pyx_t_1, 7, __pyx_t_4);
  8895. __pyx_t_4 = 0;
  8896. __Pyx_INCREF(__pyx_kp_u__10);
  8897. __pyx_t_2 += 1;
  8898. __Pyx_GIVEREF(__pyx_kp_u__10);
  8899. PyTuple_SET_ITEM(__pyx_t_1, 8, __pyx_kp_u__10);
  8900. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":515
  8901. *
  8902. * def __repr__(self):
  8903. * return (f'<{self.__class__.__name__} @{hex(id(self))} uri={self.uri}, ' # <<<<<<<<<<<<<<
  8904. * f'length={len(self.data)}>')
  8905. *
  8906. */
  8907. __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 9, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 515, __pyx_L1_error)
  8908. __Pyx_GOTREF(__pyx_t_4);
  8909. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8910. __pyx_r = __pyx_t_4;
  8911. __pyx_t_4 = 0;
  8912. goto __pyx_L0;
  8913. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":514
  8914. *
  8915. *
  8916. * def __repr__(self): # <<<<<<<<<<<<<<
  8917. * return (f'<{self.__class__.__name__} @{hex(id(self))} uri={self.uri}, '
  8918. * f'length={len(self.data)}>')
  8919. */
  8920. /* function exit code */
  8921. __pyx_L1_error:;
  8922. __Pyx_XDECREF(__pyx_t_1);
  8923. __Pyx_XDECREF(__pyx_t_4);
  8924. __Pyx_XDECREF(__pyx_t_5);
  8925. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.Imr.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8926. __pyx_r = NULL;
  8927. __pyx_L0:;
  8928. __Pyx_XGIVEREF(__pyx_r);
  8929. __Pyx_TraceReturn(__pyx_r, 0);
  8930. __Pyx_RefNannyFinishContext();
  8931. return __pyx_r;
  8932. }
  8933. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":519
  8934. *
  8935. * @use_data
  8936. * def __sub__(self, other): # <<<<<<<<<<<<<<
  8937. * return self.__class__(uri=self.uri, data=self.data - other)
  8938. *
  8939. */
  8940. /* Python wrapper */
  8941. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_5__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
  8942. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_5__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  8943. PyObject *__pyx_r = 0;
  8944. __Pyx_RefNannyDeclarations
  8945. __Pyx_RefNannySetupContext("__sub__ (wrapper)", 0);
  8946. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_4__sub__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));
  8947. /* function exit code */
  8948. __Pyx_RefNannyFinishContext();
  8949. return __pyx_r;
  8950. }
  8951. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_4__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  8952. PyObject *__pyx_r = NULL;
  8953. __Pyx_TraceDeclarations
  8954. __Pyx_RefNannyDeclarations
  8955. PyObject *__pyx_t_1 = NULL;
  8956. PyObject *__pyx_t_2 = NULL;
  8957. PyObject *__pyx_t_3 = NULL;
  8958. PyObject *__pyx_t_4 = NULL;
  8959. __Pyx_RefNannySetupContext("__sub__", 0);
  8960. __Pyx_TraceCall("__sub__", __pyx_f[0], 519, 0, __PYX_ERR(0, 519, __pyx_L1_error));
  8961. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":520
  8962. * @use_data
  8963. * def __sub__(self, other):
  8964. * return self.__class__(uri=self.uri, data=self.data - other) # <<<<<<<<<<<<<<
  8965. *
  8966. * @use_data
  8967. */
  8968. __Pyx_XDECREF(__pyx_r);
  8969. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error)
  8970. __Pyx_GOTREF(__pyx_t_1);
  8971. __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 520, __pyx_L1_error)
  8972. __Pyx_GOTREF(__pyx_t_2);
  8973. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_uri); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 520, __pyx_L1_error)
  8974. __Pyx_GOTREF(__pyx_t_3);
  8975. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_uri, __pyx_t_3) < 0) __PYX_ERR(0, 520, __pyx_L1_error)
  8976. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8977. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 520, __pyx_L1_error)
  8978. __Pyx_GOTREF(__pyx_t_3);
  8979. __pyx_t_4 = PyNumber_Subtract(__pyx_t_3, __pyx_v_other); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 520, __pyx_L1_error)
  8980. __Pyx_GOTREF(__pyx_t_4);
  8981. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8982. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_data, __pyx_t_4) < 0) __PYX_ERR(0, 520, __pyx_L1_error)
  8983. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  8984. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 520, __pyx_L1_error)
  8985. __Pyx_GOTREF(__pyx_t_4);
  8986. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8987. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8988. __pyx_r = __pyx_t_4;
  8989. __pyx_t_4 = 0;
  8990. goto __pyx_L0;
  8991. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":519
  8992. *
  8993. * @use_data
  8994. * def __sub__(self, other): # <<<<<<<<<<<<<<
  8995. * return self.__class__(uri=self.uri, data=self.data - other)
  8996. *
  8997. */
  8998. /* function exit code */
  8999. __pyx_L1_error:;
  9000. __Pyx_XDECREF(__pyx_t_1);
  9001. __Pyx_XDECREF(__pyx_t_2);
  9002. __Pyx_XDECREF(__pyx_t_3);
  9003. __Pyx_XDECREF(__pyx_t_4);
  9004. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.Imr.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9005. __pyx_r = NULL;
  9006. __pyx_L0:;
  9007. __Pyx_XGIVEREF(__pyx_r);
  9008. __Pyx_TraceReturn(__pyx_r, 0);
  9009. __Pyx_RefNannyFinishContext();
  9010. return __pyx_r;
  9011. }
  9012. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":523
  9013. *
  9014. * @use_data
  9015. * def __and__(self, other): # <<<<<<<<<<<<<<
  9016. * return self.__class__(uri=self.uri, data=self.data & other)
  9017. *
  9018. */
  9019. /* Python wrapper */
  9020. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_7__and__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
  9021. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_7__and__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  9022. PyObject *__pyx_r = 0;
  9023. __Pyx_RefNannyDeclarations
  9024. __Pyx_RefNannySetupContext("__and__ (wrapper)", 0);
  9025. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_6__and__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));
  9026. /* function exit code */
  9027. __Pyx_RefNannyFinishContext();
  9028. return __pyx_r;
  9029. }
  9030. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_6__and__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  9031. PyObject *__pyx_r = NULL;
  9032. __Pyx_TraceDeclarations
  9033. __Pyx_RefNannyDeclarations
  9034. PyObject *__pyx_t_1 = NULL;
  9035. PyObject *__pyx_t_2 = NULL;
  9036. PyObject *__pyx_t_3 = NULL;
  9037. PyObject *__pyx_t_4 = NULL;
  9038. __Pyx_RefNannySetupContext("__and__", 0);
  9039. __Pyx_TraceCall("__and__", __pyx_f[0], 523, 0, __PYX_ERR(0, 523, __pyx_L1_error));
  9040. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":524
  9041. * @use_data
  9042. * def __and__(self, other):
  9043. * return self.__class__(uri=self.uri, data=self.data & other) # <<<<<<<<<<<<<<
  9044. *
  9045. * @use_data
  9046. */
  9047. __Pyx_XDECREF(__pyx_r);
  9048. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 524, __pyx_L1_error)
  9049. __Pyx_GOTREF(__pyx_t_1);
  9050. __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 524, __pyx_L1_error)
  9051. __Pyx_GOTREF(__pyx_t_2);
  9052. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_uri); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 524, __pyx_L1_error)
  9053. __Pyx_GOTREF(__pyx_t_3);
  9054. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_uri, __pyx_t_3) < 0) __PYX_ERR(0, 524, __pyx_L1_error)
  9055. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9056. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 524, __pyx_L1_error)
  9057. __Pyx_GOTREF(__pyx_t_3);
  9058. __pyx_t_4 = PyNumber_And(__pyx_t_3, __pyx_v_other); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 524, __pyx_L1_error)
  9059. __Pyx_GOTREF(__pyx_t_4);
  9060. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9061. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_data, __pyx_t_4) < 0) __PYX_ERR(0, 524, __pyx_L1_error)
  9062. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  9063. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 524, __pyx_L1_error)
  9064. __Pyx_GOTREF(__pyx_t_4);
  9065. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9066. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9067. __pyx_r = __pyx_t_4;
  9068. __pyx_t_4 = 0;
  9069. goto __pyx_L0;
  9070. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":523
  9071. *
  9072. * @use_data
  9073. * def __and__(self, other): # <<<<<<<<<<<<<<
  9074. * return self.__class__(uri=self.uri, data=self.data & other)
  9075. *
  9076. */
  9077. /* function exit code */
  9078. __pyx_L1_error:;
  9079. __Pyx_XDECREF(__pyx_t_1);
  9080. __Pyx_XDECREF(__pyx_t_2);
  9081. __Pyx_XDECREF(__pyx_t_3);
  9082. __Pyx_XDECREF(__pyx_t_4);
  9083. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.Imr.__and__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9084. __pyx_r = NULL;
  9085. __pyx_L0:;
  9086. __Pyx_XGIVEREF(__pyx_r);
  9087. __Pyx_TraceReturn(__pyx_r, 0);
  9088. __Pyx_RefNannyFinishContext();
  9089. return __pyx_r;
  9090. }
  9091. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":527
  9092. *
  9093. * @use_data
  9094. * def __or__(self, other): # <<<<<<<<<<<<<<
  9095. * return self.__class__(uri=self.uri, data=self.data | other)
  9096. *
  9097. */
  9098. /* Python wrapper */
  9099. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_9__or__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
  9100. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_9__or__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  9101. PyObject *__pyx_r = 0;
  9102. __Pyx_RefNannyDeclarations
  9103. __Pyx_RefNannySetupContext("__or__ (wrapper)", 0);
  9104. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_8__or__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));
  9105. /* function exit code */
  9106. __Pyx_RefNannyFinishContext();
  9107. return __pyx_r;
  9108. }
  9109. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_8__or__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  9110. PyObject *__pyx_r = NULL;
  9111. __Pyx_TraceDeclarations
  9112. __Pyx_RefNannyDeclarations
  9113. PyObject *__pyx_t_1 = NULL;
  9114. PyObject *__pyx_t_2 = NULL;
  9115. PyObject *__pyx_t_3 = NULL;
  9116. PyObject *__pyx_t_4 = NULL;
  9117. __Pyx_RefNannySetupContext("__or__", 0);
  9118. __Pyx_TraceCall("__or__", __pyx_f[0], 527, 0, __PYX_ERR(0, 527, __pyx_L1_error));
  9119. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":528
  9120. * @use_data
  9121. * def __or__(self, other):
  9122. * return self.__class__(uri=self.uri, data=self.data | other) # <<<<<<<<<<<<<<
  9123. *
  9124. * @use_data
  9125. */
  9126. __Pyx_XDECREF(__pyx_r);
  9127. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 528, __pyx_L1_error)
  9128. __Pyx_GOTREF(__pyx_t_1);
  9129. __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 528, __pyx_L1_error)
  9130. __Pyx_GOTREF(__pyx_t_2);
  9131. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_uri); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 528, __pyx_L1_error)
  9132. __Pyx_GOTREF(__pyx_t_3);
  9133. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_uri, __pyx_t_3) < 0) __PYX_ERR(0, 528, __pyx_L1_error)
  9134. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9135. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 528, __pyx_L1_error)
  9136. __Pyx_GOTREF(__pyx_t_3);
  9137. __pyx_t_4 = PyNumber_Or(__pyx_t_3, __pyx_v_other); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 528, __pyx_L1_error)
  9138. __Pyx_GOTREF(__pyx_t_4);
  9139. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9140. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_data, __pyx_t_4) < 0) __PYX_ERR(0, 528, __pyx_L1_error)
  9141. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  9142. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 528, __pyx_L1_error)
  9143. __Pyx_GOTREF(__pyx_t_4);
  9144. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9145. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9146. __pyx_r = __pyx_t_4;
  9147. __pyx_t_4 = 0;
  9148. goto __pyx_L0;
  9149. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":527
  9150. *
  9151. * @use_data
  9152. * def __or__(self, other): # <<<<<<<<<<<<<<
  9153. * return self.__class__(uri=self.uri, data=self.data | other)
  9154. *
  9155. */
  9156. /* function exit code */
  9157. __pyx_L1_error:;
  9158. __Pyx_XDECREF(__pyx_t_1);
  9159. __Pyx_XDECREF(__pyx_t_2);
  9160. __Pyx_XDECREF(__pyx_t_3);
  9161. __Pyx_XDECREF(__pyx_t_4);
  9162. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.Imr.__or__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9163. __pyx_r = NULL;
  9164. __pyx_L0:;
  9165. __Pyx_XGIVEREF(__pyx_r);
  9166. __Pyx_TraceReturn(__pyx_r, 0);
  9167. __Pyx_RefNannyFinishContext();
  9168. return __pyx_r;
  9169. }
  9170. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":531
  9171. *
  9172. * @use_data
  9173. * def __xor__(self, other): # <<<<<<<<<<<<<<
  9174. * return self.__class__(uri=self.uri, data=self.data ^ other)
  9175. *
  9176. */
  9177. /* Python wrapper */
  9178. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_11__xor__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
  9179. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_11__xor__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  9180. PyObject *__pyx_r = 0;
  9181. __Pyx_RefNannyDeclarations
  9182. __Pyx_RefNannySetupContext("__xor__ (wrapper)", 0);
  9183. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_10__xor__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other));
  9184. /* function exit code */
  9185. __Pyx_RefNannyFinishContext();
  9186. return __pyx_r;
  9187. }
  9188. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_10__xor__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  9189. PyObject *__pyx_r = NULL;
  9190. __Pyx_TraceDeclarations
  9191. __Pyx_RefNannyDeclarations
  9192. PyObject *__pyx_t_1 = NULL;
  9193. PyObject *__pyx_t_2 = NULL;
  9194. PyObject *__pyx_t_3 = NULL;
  9195. PyObject *__pyx_t_4 = NULL;
  9196. __Pyx_RefNannySetupContext("__xor__", 0);
  9197. __Pyx_TraceCall("__xor__", __pyx_f[0], 531, 0, __PYX_ERR(0, 531, __pyx_L1_error));
  9198. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":532
  9199. * @use_data
  9200. * def __xor__(self, other):
  9201. * return self.__class__(uri=self.uri, data=self.data ^ other) # <<<<<<<<<<<<<<
  9202. *
  9203. *
  9204. */
  9205. __Pyx_XDECREF(__pyx_r);
  9206. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L1_error)
  9207. __Pyx_GOTREF(__pyx_t_1);
  9208. __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 532, __pyx_L1_error)
  9209. __Pyx_GOTREF(__pyx_t_2);
  9210. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_uri); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 532, __pyx_L1_error)
  9211. __Pyx_GOTREF(__pyx_t_3);
  9212. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_uri, __pyx_t_3) < 0) __PYX_ERR(0, 532, __pyx_L1_error)
  9213. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9214. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 532, __pyx_L1_error)
  9215. __Pyx_GOTREF(__pyx_t_3);
  9216. __pyx_t_4 = PyNumber_Xor(__pyx_t_3, __pyx_v_other); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 532, __pyx_L1_error)
  9217. __Pyx_GOTREF(__pyx_t_4);
  9218. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9219. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_data, __pyx_t_4) < 0) __PYX_ERR(0, 532, __pyx_L1_error)
  9220. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  9221. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 532, __pyx_L1_error)
  9222. __Pyx_GOTREF(__pyx_t_4);
  9223. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9224. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9225. __pyx_r = __pyx_t_4;
  9226. __pyx_t_4 = 0;
  9227. goto __pyx_L0;
  9228. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":531
  9229. *
  9230. * @use_data
  9231. * def __xor__(self, other): # <<<<<<<<<<<<<<
  9232. * return self.__class__(uri=self.uri, data=self.data ^ other)
  9233. *
  9234. */
  9235. /* function exit code */
  9236. __pyx_L1_error:;
  9237. __Pyx_XDECREF(__pyx_t_1);
  9238. __Pyx_XDECREF(__pyx_t_2);
  9239. __Pyx_XDECREF(__pyx_t_3);
  9240. __Pyx_XDECREF(__pyx_t_4);
  9241. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.Imr.__xor__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9242. __pyx_r = NULL;
  9243. __pyx_L0:;
  9244. __Pyx_XGIVEREF(__pyx_r);
  9245. __Pyx_TraceReturn(__pyx_r, 0);
  9246. __Pyx_RefNannyFinishContext();
  9247. return __pyx_r;
  9248. }
  9249. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":535
  9250. *
  9251. *
  9252. * def __getitem__(self, item): # <<<<<<<<<<<<<<
  9253. * if isinstance(item, slice):
  9254. * s, p, o = item.start, item.stop, item.step
  9255. */
  9256. /* Python wrapper */
  9257. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_13__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
  9258. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_13__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
  9259. PyObject *__pyx_r = 0;
  9260. __Pyx_RefNannyDeclarations
  9261. __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  9262. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_12__getitem__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *)__pyx_v_self), ((PyObject *)__pyx_v_item));
  9263. /* function exit code */
  9264. __Pyx_RefNannyFinishContext();
  9265. return __pyx_r;
  9266. }
  9267. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_12__getitem__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *__pyx_v_self, PyObject *__pyx_v_item) {
  9268. PyObject *__pyx_v_s = NULL;
  9269. PyObject *__pyx_v_p = NULL;
  9270. PyObject *__pyx_v_o = NULL;
  9271. PyObject *__pyx_9genexpr14__pyx_v_r = NULL;
  9272. PyObject *__pyx_r = NULL;
  9273. __Pyx_TraceDeclarations
  9274. __Pyx_RefNannyDeclarations
  9275. int __pyx_t_1;
  9276. int __pyx_t_2;
  9277. PyObject *__pyx_t_3 = NULL;
  9278. PyObject *__pyx_t_4 = NULL;
  9279. PyObject *__pyx_t_5 = NULL;
  9280. Py_ssize_t __pyx_t_6;
  9281. Py_ssize_t __pyx_t_7;
  9282. int __pyx_t_8;
  9283. int __pyx_t_9;
  9284. PyObject *__pyx_t_10 = NULL;
  9285. Py_UCS4 __pyx_t_11;
  9286. __Pyx_RefNannySetupContext("__getitem__", 0);
  9287. __Pyx_TraceCall("__getitem__", __pyx_f[0], 535, 0, __PYX_ERR(0, 535, __pyx_L1_error));
  9288. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":536
  9289. *
  9290. * def __getitem__(self, item):
  9291. * if isinstance(item, slice): # <<<<<<<<<<<<<<
  9292. * s, p, o = item.start, item.stop, item.step
  9293. * return self._slice(s, p, o)
  9294. */
  9295. __pyx_t_1 = PySlice_Check(__pyx_v_item);
  9296. __pyx_t_2 = (__pyx_t_1 != 0);
  9297. if (__pyx_t_2) {
  9298. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":537
  9299. * def __getitem__(self, item):
  9300. * if isinstance(item, slice):
  9301. * s, p, o = item.start, item.stop, item.step # <<<<<<<<<<<<<<
  9302. * return self._slice(s, p, o)
  9303. *
  9304. */
  9305. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_item, __pyx_n_s_start); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 537, __pyx_L1_error)
  9306. __Pyx_GOTREF(__pyx_t_3);
  9307. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_item, __pyx_n_s_stop); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 537, __pyx_L1_error)
  9308. __Pyx_GOTREF(__pyx_t_4);
  9309. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_item, __pyx_n_s_step); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 537, __pyx_L1_error)
  9310. __Pyx_GOTREF(__pyx_t_5);
  9311. __pyx_v_s = __pyx_t_3;
  9312. __pyx_t_3 = 0;
  9313. __pyx_v_p = __pyx_t_4;
  9314. __pyx_t_4 = 0;
  9315. __pyx_v_o = __pyx_t_5;
  9316. __pyx_t_5 = 0;
  9317. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":538
  9318. * if isinstance(item, slice):
  9319. * s, p, o = item.start, item.stop, item.step
  9320. * return self._slice(s, p, o) # <<<<<<<<<<<<<<
  9321. *
  9322. * elif isinstance(item, Node):
  9323. */
  9324. __Pyx_XDECREF(__pyx_r);
  9325. __pyx_t_5 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._slice(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v_self), __pyx_v_s, __pyx_v_p, __pyx_v_o); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 538, __pyx_L1_error)
  9326. __Pyx_GOTREF(__pyx_t_5);
  9327. __pyx_r = __pyx_t_5;
  9328. __pyx_t_5 = 0;
  9329. goto __pyx_L0;
  9330. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":536
  9331. *
  9332. * def __getitem__(self, item):
  9333. * if isinstance(item, slice): # <<<<<<<<<<<<<<
  9334. * s, p, o = item.start, item.stop, item.step
  9335. * return self._slice(s, p, o)
  9336. */
  9337. }
  9338. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":540
  9339. * return self._slice(s, p, o)
  9340. *
  9341. * elif isinstance(item, Node): # <<<<<<<<<<<<<<
  9342. * # If a Node is given, return all values for that predicate.
  9343. * return {
  9344. */
  9345. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_Node); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 540, __pyx_L1_error)
  9346. __Pyx_GOTREF(__pyx_t_5);
  9347. __pyx_t_2 = PyObject_IsInstance(__pyx_v_item, __pyx_t_5); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 540, __pyx_L1_error)
  9348. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9349. __pyx_t_1 = (__pyx_t_2 != 0);
  9350. if (likely(__pyx_t_1)) {
  9351. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":542
  9352. * elif isinstance(item, Node):
  9353. * # If a Node is given, return all values for that predicate.
  9354. * return { # <<<<<<<<<<<<<<
  9355. * r[2] for r in self.data
  9356. * if r[0] == self.uri and r[1] == item}
  9357. */
  9358. __Pyx_XDECREF(__pyx_r);
  9359. { /* enter inner scope */
  9360. __pyx_t_5 = PySet_New(NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 542, __pyx_L6_error)
  9361. __Pyx_GOTREF(__pyx_t_5);
  9362. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":543
  9363. * # If a Node is given, return all values for that predicate.
  9364. * return {
  9365. * r[2] for r in self.data # <<<<<<<<<<<<<<
  9366. * if r[0] == self.uri and r[1] == item}
  9367. * else:
  9368. */
  9369. __pyx_t_6 = 0;
  9370. __pyx_t_3 = __Pyx_set_iterator(__pyx_v_self->__pyx_base.data, 1, (&__pyx_t_7), (&__pyx_t_8)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 543, __pyx_L6_error)
  9371. __Pyx_GOTREF(__pyx_t_3);
  9372. __Pyx_XDECREF(__pyx_t_4);
  9373. __pyx_t_4 = __pyx_t_3;
  9374. __pyx_t_3 = 0;
  9375. while (1) {
  9376. __pyx_t_9 = __Pyx_set_iter_next(__pyx_t_4, __pyx_t_7, &__pyx_t_6, &__pyx_t_3, __pyx_t_8);
  9377. if (unlikely(__pyx_t_9 == 0)) break;
  9378. if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 543, __pyx_L6_error)
  9379. __Pyx_GOTREF(__pyx_t_3);
  9380. __Pyx_XDECREF_SET(__pyx_9genexpr14__pyx_v_r, __pyx_t_3);
  9381. __pyx_t_3 = 0;
  9382. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":544
  9383. * return {
  9384. * r[2] for r in self.data
  9385. * if r[0] == self.uri and r[1] == item} # <<<<<<<<<<<<<<
  9386. * else:
  9387. * raise TypeError(f'Wrong slice format: {item}.')
  9388. */
  9389. __pyx_t_3 = __Pyx_GetItemInt(__pyx_9genexpr14__pyx_v_r, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 544, __pyx_L6_error)
  9390. __Pyx_GOTREF(__pyx_t_3);
  9391. __pyx_t_10 = PyObject_RichCompare(__pyx_t_3, __pyx_v_self->uri, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 544, __pyx_L6_error)
  9392. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9393. __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 544, __pyx_L6_error)
  9394. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  9395. if (__pyx_t_2) {
  9396. } else {
  9397. __pyx_t_1 = __pyx_t_2;
  9398. goto __pyx_L10_bool_binop_done;
  9399. }
  9400. __pyx_t_10 = __Pyx_GetItemInt(__pyx_9genexpr14__pyx_v_r, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 544, __pyx_L6_error)
  9401. __Pyx_GOTREF(__pyx_t_10);
  9402. __pyx_t_3 = PyObject_RichCompare(__pyx_t_10, __pyx_v_item, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 544, __pyx_L6_error)
  9403. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  9404. __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 544, __pyx_L6_error)
  9405. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9406. __pyx_t_1 = __pyx_t_2;
  9407. __pyx_L10_bool_binop_done:;
  9408. if (__pyx_t_1) {
  9409. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":543
  9410. * # If a Node is given, return all values for that predicate.
  9411. * return {
  9412. * r[2] for r in self.data # <<<<<<<<<<<<<<
  9413. * if r[0] == self.uri and r[1] == item}
  9414. * else:
  9415. */
  9416. __pyx_t_3 = __Pyx_GetItemInt(__pyx_9genexpr14__pyx_v_r, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 543, __pyx_L6_error)
  9417. __Pyx_GOTREF(__pyx_t_3);
  9418. if (unlikely(PySet_Add(__pyx_t_5, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 543, __pyx_L6_error)
  9419. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9420. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":544
  9421. * return {
  9422. * r[2] for r in self.data
  9423. * if r[0] == self.uri and r[1] == item} # <<<<<<<<<<<<<<
  9424. * else:
  9425. * raise TypeError(f'Wrong slice format: {item}.')
  9426. */
  9427. }
  9428. }
  9429. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  9430. __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_r); __pyx_9genexpr14__pyx_v_r = 0;
  9431. goto __pyx_L12_exit_scope;
  9432. __pyx_L6_error:;
  9433. __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_r); __pyx_9genexpr14__pyx_v_r = 0;
  9434. goto __pyx_L1_error;
  9435. __pyx_L12_exit_scope:;
  9436. } /* exit inner scope */
  9437. __pyx_r = __pyx_t_5;
  9438. __pyx_t_5 = 0;
  9439. goto __pyx_L0;
  9440. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":540
  9441. * return self._slice(s, p, o)
  9442. *
  9443. * elif isinstance(item, Node): # <<<<<<<<<<<<<<
  9444. * # If a Node is given, return all values for that predicate.
  9445. * return {
  9446. */
  9447. }
  9448. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":546
  9449. * if r[0] == self.uri and r[1] == item}
  9450. * else:
  9451. * raise TypeError(f'Wrong slice format: {item}.') # <<<<<<<<<<<<<<
  9452. *
  9453. *
  9454. */
  9455. /*else*/ {
  9456. __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 546, __pyx_L1_error)
  9457. __Pyx_GOTREF(__pyx_t_5);
  9458. __pyx_t_7 = 0;
  9459. __pyx_t_11 = 127;
  9460. __Pyx_INCREF(__pyx_kp_u_Wrong_slice_format);
  9461. __pyx_t_7 += 20;
  9462. __Pyx_GIVEREF(__pyx_kp_u_Wrong_slice_format);
  9463. PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Wrong_slice_format);
  9464. __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_item, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 546, __pyx_L1_error)
  9465. __Pyx_GOTREF(__pyx_t_4);
  9466. __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_11;
  9467. __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  9468. __Pyx_GIVEREF(__pyx_t_4);
  9469. PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  9470. __pyx_t_4 = 0;
  9471. __Pyx_INCREF(__pyx_kp_u__11);
  9472. __pyx_t_7 += 1;
  9473. __Pyx_GIVEREF(__pyx_kp_u__11);
  9474. PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__11);
  9475. __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_7, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 546, __pyx_L1_error)
  9476. __Pyx_GOTREF(__pyx_t_4);
  9477. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9478. __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 546, __pyx_L1_error)
  9479. __Pyx_GOTREF(__pyx_t_5);
  9480. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  9481. __Pyx_Raise(__pyx_t_5, 0, 0, 0);
  9482. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9483. __PYX_ERR(0, 546, __pyx_L1_error)
  9484. }
  9485. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":535
  9486. *
  9487. *
  9488. * def __getitem__(self, item): # <<<<<<<<<<<<<<
  9489. * if isinstance(item, slice):
  9490. * s, p, o = item.start, item.stop, item.step
  9491. */
  9492. /* function exit code */
  9493. __pyx_L1_error:;
  9494. __Pyx_XDECREF(__pyx_t_3);
  9495. __Pyx_XDECREF(__pyx_t_4);
  9496. __Pyx_XDECREF(__pyx_t_5);
  9497. __Pyx_XDECREF(__pyx_t_10);
  9498. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.Imr.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9499. __pyx_r = NULL;
  9500. __pyx_L0:;
  9501. __Pyx_XDECREF(__pyx_v_s);
  9502. __Pyx_XDECREF(__pyx_v_p);
  9503. __Pyx_XDECREF(__pyx_v_o);
  9504. __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_r);
  9505. __Pyx_XGIVEREF(__pyx_r);
  9506. __Pyx_TraceReturn(__pyx_r, 0);
  9507. __Pyx_RefNannyFinishContext();
  9508. return __pyx_r;
  9509. }
  9510. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":549
  9511. *
  9512. *
  9513. * def value(self, p, strict=False): # <<<<<<<<<<<<<<
  9514. * """
  9515. * Get an individual value.
  9516. */
  9517. /* Python wrapper */
  9518. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_15value(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  9519. static char __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_14value[] = "\n Get an individual value.\n\n :param rdflib.termNode p: Predicate to search for.\n :param bool strict: If set to ``True`` the method raises an error if\n more than one value is found. If ``False`` (the default) only\n the first found result is returned.\n :rtype: rdflib.term.Node\n ";
  9520. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_15value(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  9521. PyObject *__pyx_v_p = 0;
  9522. PyObject *__pyx_v_strict = 0;
  9523. PyObject *__pyx_r = 0;
  9524. __Pyx_RefNannyDeclarations
  9525. __Pyx_RefNannySetupContext("value (wrapper)", 0);
  9526. {
  9527. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_strict,0};
  9528. PyObject* values[2] = {0,0};
  9529. values[1] = ((PyObject *)Py_False);
  9530. if (unlikely(__pyx_kwds)) {
  9531. Py_ssize_t kw_args;
  9532. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  9533. switch (pos_args) {
  9534. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  9535. CYTHON_FALLTHROUGH;
  9536. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  9537. CYTHON_FALLTHROUGH;
  9538. case 0: break;
  9539. default: goto __pyx_L5_argtuple_error;
  9540. }
  9541. kw_args = PyDict_Size(__pyx_kwds);
  9542. switch (pos_args) {
  9543. case 0:
  9544. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
  9545. else goto __pyx_L5_argtuple_error;
  9546. CYTHON_FALLTHROUGH;
  9547. case 1:
  9548. if (kw_args > 0) {
  9549. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strict);
  9550. if (value) { values[1] = value; kw_args--; }
  9551. }
  9552. }
  9553. if (unlikely(kw_args > 0)) {
  9554. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "value") < 0)) __PYX_ERR(0, 549, __pyx_L3_error)
  9555. }
  9556. } else {
  9557. switch (PyTuple_GET_SIZE(__pyx_args)) {
  9558. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  9559. CYTHON_FALLTHROUGH;
  9560. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  9561. break;
  9562. default: goto __pyx_L5_argtuple_error;
  9563. }
  9564. }
  9565. __pyx_v_p = values[0];
  9566. __pyx_v_strict = values[1];
  9567. }
  9568. goto __pyx_L4_argument_unpacking_done;
  9569. __pyx_L5_argtuple_error:;
  9570. __Pyx_RaiseArgtupleInvalid("value", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 549, __pyx_L3_error)
  9571. __pyx_L3_error:;
  9572. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.Imr.value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9573. __Pyx_RefNannyFinishContext();
  9574. return NULL;
  9575. __pyx_L4_argument_unpacking_done:;
  9576. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_14value(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *)__pyx_v_self), __pyx_v_p, __pyx_v_strict);
  9577. /* function exit code */
  9578. __Pyx_RefNannyFinishContext();
  9579. return __pyx_r;
  9580. }
  9581. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_14value(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *__pyx_v_self, PyObject *__pyx_v_p, PyObject *__pyx_v_strict) {
  9582. PyObject *__pyx_v_values = NULL;
  9583. PyObject *__pyx_v_ret = NULL;
  9584. PyObject *__pyx_r = NULL;
  9585. __Pyx_TraceDeclarations
  9586. __Pyx_RefNannyDeclarations
  9587. PyObject *__pyx_t_1 = NULL;
  9588. int __pyx_t_2;
  9589. int __pyx_t_3;
  9590. Py_ssize_t __pyx_t_4;
  9591. PyObject *__pyx_t_5 = NULL;
  9592. PyObject *__pyx_t_6 = NULL;
  9593. int __pyx_t_7;
  9594. PyObject *__pyx_t_8 = NULL;
  9595. PyObject *(*__pyx_t_9)(PyObject *);
  9596. __Pyx_RefNannySetupContext("value", 0);
  9597. __Pyx_TraceCall("value", __pyx_f[0], 549, 0, __PYX_ERR(0, 549, __pyx_L1_error));
  9598. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":559
  9599. * :rtype: rdflib.term.Node
  9600. * """
  9601. * values = self[p] # <<<<<<<<<<<<<<
  9602. *
  9603. * if strict and len(values) > 1:
  9604. */
  9605. __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_p); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 559, __pyx_L1_error)
  9606. __Pyx_GOTREF(__pyx_t_1);
  9607. __pyx_v_values = __pyx_t_1;
  9608. __pyx_t_1 = 0;
  9609. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":561
  9610. * values = self[p]
  9611. *
  9612. * if strict and len(values) > 1: # <<<<<<<<<<<<<<
  9613. * raise RuntimeError('More than one value found for {}, {}.'.format(
  9614. * self.uri, p))
  9615. */
  9616. __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_strict); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 561, __pyx_L1_error)
  9617. if (__pyx_t_3) {
  9618. } else {
  9619. __pyx_t_2 = __pyx_t_3;
  9620. goto __pyx_L4_bool_binop_done;
  9621. }
  9622. __pyx_t_4 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 561, __pyx_L1_error)
  9623. __pyx_t_3 = ((__pyx_t_4 > 1) != 0);
  9624. __pyx_t_2 = __pyx_t_3;
  9625. __pyx_L4_bool_binop_done:;
  9626. if (unlikely(__pyx_t_2)) {
  9627. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":562
  9628. *
  9629. * if strict and len(values) > 1:
  9630. * raise RuntimeError('More than one value found for {}, {}.'.format( # <<<<<<<<<<<<<<
  9631. * self.uri, p))
  9632. *
  9633. */
  9634. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_More_than_one_value_found_for, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 562, __pyx_L1_error)
  9635. __Pyx_GOTREF(__pyx_t_5);
  9636. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":563
  9637. * if strict and len(values) > 1:
  9638. * raise RuntimeError('More than one value found for {}, {}.'.format(
  9639. * self.uri, p)) # <<<<<<<<<<<<<<
  9640. *
  9641. * for ret in values:
  9642. */
  9643. __pyx_t_6 = NULL;
  9644. __pyx_t_7 = 0;
  9645. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
  9646. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
  9647. if (likely(__pyx_t_6)) {
  9648. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
  9649. __Pyx_INCREF(__pyx_t_6);
  9650. __Pyx_INCREF(function);
  9651. __Pyx_DECREF_SET(__pyx_t_5, function);
  9652. __pyx_t_7 = 1;
  9653. }
  9654. }
  9655. #if CYTHON_FAST_PYCALL
  9656. if (PyFunction_Check(__pyx_t_5)) {
  9657. PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_self->uri, __pyx_v_p};
  9658. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 562, __pyx_L1_error)
  9659. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  9660. __Pyx_GOTREF(__pyx_t_1);
  9661. } else
  9662. #endif
  9663. #if CYTHON_FAST_PYCCALL
  9664. if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
  9665. PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_self->uri, __pyx_v_p};
  9666. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 562, __pyx_L1_error)
  9667. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  9668. __Pyx_GOTREF(__pyx_t_1);
  9669. } else
  9670. #endif
  9671. {
  9672. __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 562, __pyx_L1_error)
  9673. __Pyx_GOTREF(__pyx_t_8);
  9674. if (__pyx_t_6) {
  9675. __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
  9676. }
  9677. __Pyx_INCREF(__pyx_v_self->uri);
  9678. __Pyx_GIVEREF(__pyx_v_self->uri);
  9679. PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_self->uri);
  9680. __Pyx_INCREF(__pyx_v_p);
  9681. __Pyx_GIVEREF(__pyx_v_p);
  9682. PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_p);
  9683. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 562, __pyx_L1_error)
  9684. __Pyx_GOTREF(__pyx_t_1);
  9685. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  9686. }
  9687. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9688. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":562
  9689. *
  9690. * if strict and len(values) > 1:
  9691. * raise RuntimeError('More than one value found for {}, {}.'.format( # <<<<<<<<<<<<<<
  9692. * self.uri, p))
  9693. *
  9694. */
  9695. __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 562, __pyx_L1_error)
  9696. __Pyx_GOTREF(__pyx_t_5);
  9697. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9698. __Pyx_Raise(__pyx_t_5, 0, 0, 0);
  9699. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9700. __PYX_ERR(0, 562, __pyx_L1_error)
  9701. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":561
  9702. * values = self[p]
  9703. *
  9704. * if strict and len(values) > 1: # <<<<<<<<<<<<<<
  9705. * raise RuntimeError('More than one value found for {}, {}.'.format(
  9706. * self.uri, p))
  9707. */
  9708. }
  9709. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":565
  9710. * self.uri, p))
  9711. *
  9712. * for ret in values: # <<<<<<<<<<<<<<
  9713. * return ret
  9714. *
  9715. */
  9716. if (likely(PyList_CheckExact(__pyx_v_values)) || PyTuple_CheckExact(__pyx_v_values)) {
  9717. __pyx_t_5 = __pyx_v_values; __Pyx_INCREF(__pyx_t_5); __pyx_t_4 = 0;
  9718. __pyx_t_9 = NULL;
  9719. } else {
  9720. __pyx_t_4 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 565, __pyx_L1_error)
  9721. __Pyx_GOTREF(__pyx_t_5);
  9722. __pyx_t_9 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 565, __pyx_L1_error)
  9723. }
  9724. for (;;) {
  9725. if (likely(!__pyx_t_9)) {
  9726. if (likely(PyList_CheckExact(__pyx_t_5))) {
  9727. if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_5)) break;
  9728. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9729. __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 565, __pyx_L1_error)
  9730. #else
  9731. __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L1_error)
  9732. __Pyx_GOTREF(__pyx_t_1);
  9733. #endif
  9734. } else {
  9735. if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
  9736. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9737. __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 565, __pyx_L1_error)
  9738. #else
  9739. __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L1_error)
  9740. __Pyx_GOTREF(__pyx_t_1);
  9741. #endif
  9742. }
  9743. } else {
  9744. __pyx_t_1 = __pyx_t_9(__pyx_t_5);
  9745. if (unlikely(!__pyx_t_1)) {
  9746. PyObject* exc_type = PyErr_Occurred();
  9747. if (exc_type) {
  9748. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  9749. else __PYX_ERR(0, 565, __pyx_L1_error)
  9750. }
  9751. break;
  9752. }
  9753. __Pyx_GOTREF(__pyx_t_1);
  9754. }
  9755. __pyx_v_ret = __pyx_t_1;
  9756. __pyx_t_1 = 0;
  9757. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":566
  9758. *
  9759. * for ret in values:
  9760. * return ret # <<<<<<<<<<<<<<
  9761. *
  9762. * return None
  9763. */
  9764. __Pyx_XDECREF(__pyx_r);
  9765. __Pyx_INCREF(__pyx_v_ret);
  9766. __pyx_r = __pyx_v_ret;
  9767. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9768. goto __pyx_L0;
  9769. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":565
  9770. * self.uri, p))
  9771. *
  9772. * for ret in values: # <<<<<<<<<<<<<<
  9773. * return ret
  9774. *
  9775. */
  9776. }
  9777. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9778. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":568
  9779. * return ret
  9780. *
  9781. * return None # <<<<<<<<<<<<<<
  9782. *
  9783. *
  9784. */
  9785. __Pyx_XDECREF(__pyx_r);
  9786. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  9787. goto __pyx_L0;
  9788. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":549
  9789. *
  9790. *
  9791. * def value(self, p, strict=False): # <<<<<<<<<<<<<<
  9792. * """
  9793. * Get an individual value.
  9794. */
  9795. /* function exit code */
  9796. __pyx_L1_error:;
  9797. __Pyx_XDECREF(__pyx_t_1);
  9798. __Pyx_XDECREF(__pyx_t_5);
  9799. __Pyx_XDECREF(__pyx_t_6);
  9800. __Pyx_XDECREF(__pyx_t_8);
  9801. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.Imr.value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9802. __pyx_r = NULL;
  9803. __pyx_L0:;
  9804. __Pyx_XDECREF(__pyx_v_values);
  9805. __Pyx_XDECREF(__pyx_v_ret);
  9806. __Pyx_XGIVEREF(__pyx_r);
  9807. __Pyx_TraceReturn(__pyx_r, 0);
  9808. __Pyx_RefNannyFinishContext();
  9809. return __pyx_r;
  9810. }
  9811. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":571
  9812. *
  9813. *
  9814. * cpdef as_rdflib(self): # <<<<<<<<<<<<<<
  9815. * """
  9816. * Return the IMR as a RDFLib Resource.
  9817. */
  9818. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_17as_rdflib(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  9819. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_as_rdflib(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *__pyx_v_self, int __pyx_skip_dispatch) {
  9820. PyObject *__pyx_v_gr = NULL;
  9821. PyObject *__pyx_v_trp = NULL;
  9822. PyObject *__pyx_r = NULL;
  9823. __Pyx_TraceDeclarations
  9824. __Pyx_RefNannyDeclarations
  9825. PyObject *__pyx_t_1 = NULL;
  9826. PyObject *__pyx_t_2 = NULL;
  9827. PyObject *__pyx_t_3 = NULL;
  9828. PyObject *__pyx_t_4 = NULL;
  9829. Py_ssize_t __pyx_t_5;
  9830. Py_ssize_t __pyx_t_6;
  9831. int __pyx_t_7;
  9832. int __pyx_t_8;
  9833. PyObject *__pyx_t_9 = NULL;
  9834. __Pyx_RefNannySetupContext("as_rdflib", 0);
  9835. __Pyx_TraceCall("as_rdflib", __pyx_f[0], 571, 0, __PYX_ERR(0, 571, __pyx_L1_error));
  9836. /* Check if called by wrapper */
  9837. if (unlikely(__pyx_skip_dispatch)) ;
  9838. /* Check if overridden in Python */
  9839. else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
  9840. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_as_rdflib); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 571, __pyx_L1_error)
  9841. __Pyx_GOTREF(__pyx_t_1);
  9842. if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_17as_rdflib)) {
  9843. __Pyx_XDECREF(__pyx_r);
  9844. __Pyx_INCREF(__pyx_t_1);
  9845. __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
  9846. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  9847. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
  9848. if (likely(__pyx_t_4)) {
  9849. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  9850. __Pyx_INCREF(__pyx_t_4);
  9851. __Pyx_INCREF(function);
  9852. __Pyx_DECREF_SET(__pyx_t_3, function);
  9853. }
  9854. }
  9855. if (__pyx_t_4) {
  9856. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 571, __pyx_L1_error)
  9857. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  9858. } else {
  9859. __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 571, __pyx_L1_error)
  9860. }
  9861. __Pyx_GOTREF(__pyx_t_2);
  9862. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9863. __pyx_r = __pyx_t_2;
  9864. __pyx_t_2 = 0;
  9865. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9866. goto __pyx_L0;
  9867. }
  9868. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9869. }
  9870. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":577
  9871. * :rtype: rdflib.Resource
  9872. * """
  9873. * gr = Graph() # <<<<<<<<<<<<<<
  9874. * for trp in self.data:
  9875. * gr.add(trp)
  9876. */
  9877. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Graph); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 577, __pyx_L1_error)
  9878. __Pyx_GOTREF(__pyx_t_2);
  9879. __pyx_t_3 = NULL;
  9880. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
  9881. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  9882. if (likely(__pyx_t_3)) {
  9883. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  9884. __Pyx_INCREF(__pyx_t_3);
  9885. __Pyx_INCREF(function);
  9886. __Pyx_DECREF_SET(__pyx_t_2, function);
  9887. }
  9888. }
  9889. if (__pyx_t_3) {
  9890. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 577, __pyx_L1_error)
  9891. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9892. } else {
  9893. __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 577, __pyx_L1_error)
  9894. }
  9895. __Pyx_GOTREF(__pyx_t_1);
  9896. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9897. __pyx_v_gr = __pyx_t_1;
  9898. __pyx_t_1 = 0;
  9899. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":578
  9900. * """
  9901. * gr = Graph()
  9902. * for trp in self.data: # <<<<<<<<<<<<<<
  9903. * gr.add(trp)
  9904. *
  9905. */
  9906. __pyx_t_5 = 0;
  9907. __pyx_t_2 = __Pyx_set_iterator(__pyx_v_self->__pyx_base.data, 1, (&__pyx_t_6), (&__pyx_t_7)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 578, __pyx_L1_error)
  9908. __Pyx_GOTREF(__pyx_t_2);
  9909. __Pyx_XDECREF(__pyx_t_1);
  9910. __pyx_t_1 = __pyx_t_2;
  9911. __pyx_t_2 = 0;
  9912. while (1) {
  9913. __pyx_t_8 = __Pyx_set_iter_next(__pyx_t_1, __pyx_t_6, &__pyx_t_5, &__pyx_t_2, __pyx_t_7);
  9914. if (unlikely(__pyx_t_8 == 0)) break;
  9915. if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 578, __pyx_L1_error)
  9916. __Pyx_GOTREF(__pyx_t_2);
  9917. __Pyx_XDECREF_SET(__pyx_v_trp, __pyx_t_2);
  9918. __pyx_t_2 = 0;
  9919. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":579
  9920. * gr = Graph()
  9921. * for trp in self.data:
  9922. * gr.add(trp) # <<<<<<<<<<<<<<
  9923. *
  9924. * return gr.resource(identifier=self.uri)
  9925. */
  9926. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_gr, __pyx_n_s_add); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 579, __pyx_L1_error)
  9927. __Pyx_GOTREF(__pyx_t_3);
  9928. __pyx_t_4 = NULL;
  9929. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
  9930. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
  9931. if (likely(__pyx_t_4)) {
  9932. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  9933. __Pyx_INCREF(__pyx_t_4);
  9934. __Pyx_INCREF(function);
  9935. __Pyx_DECREF_SET(__pyx_t_3, function);
  9936. }
  9937. }
  9938. if (!__pyx_t_4) {
  9939. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_trp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error)
  9940. __Pyx_GOTREF(__pyx_t_2);
  9941. } else {
  9942. #if CYTHON_FAST_PYCALL
  9943. if (PyFunction_Check(__pyx_t_3)) {
  9944. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_trp};
  9945. __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error)
  9946. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  9947. __Pyx_GOTREF(__pyx_t_2);
  9948. } else
  9949. #endif
  9950. #if CYTHON_FAST_PYCCALL
  9951. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  9952. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_trp};
  9953. __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error)
  9954. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  9955. __Pyx_GOTREF(__pyx_t_2);
  9956. } else
  9957. #endif
  9958. {
  9959. __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 579, __pyx_L1_error)
  9960. __Pyx_GOTREF(__pyx_t_9);
  9961. __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL;
  9962. __Pyx_INCREF(__pyx_v_trp);
  9963. __Pyx_GIVEREF(__pyx_v_trp);
  9964. PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_trp);
  9965. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error)
  9966. __Pyx_GOTREF(__pyx_t_2);
  9967. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  9968. }
  9969. }
  9970. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9971. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9972. }
  9973. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9974. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":581
  9975. * gr.add(trp)
  9976. *
  9977. * return gr.resource(identifier=self.uri) # <<<<<<<<<<<<<<
  9978. *
  9979. *
  9980. */
  9981. __Pyx_XDECREF(__pyx_r);
  9982. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_gr, __pyx_n_s_resource); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 581, __pyx_L1_error)
  9983. __Pyx_GOTREF(__pyx_t_1);
  9984. __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __pyx_L1_error)
  9985. __Pyx_GOTREF(__pyx_t_2);
  9986. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_identifier, __pyx_v_self->uri) < 0) __PYX_ERR(0, 581, __pyx_L1_error)
  9987. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 581, __pyx_L1_error)
  9988. __Pyx_GOTREF(__pyx_t_3);
  9989. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9990. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9991. __pyx_r = __pyx_t_3;
  9992. __pyx_t_3 = 0;
  9993. goto __pyx_L0;
  9994. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":571
  9995. *
  9996. *
  9997. * cpdef as_rdflib(self): # <<<<<<<<<<<<<<
  9998. * """
  9999. * Return the IMR as a RDFLib Resource.
  10000. */
  10001. /* function exit code */
  10002. __pyx_L1_error:;
  10003. __Pyx_XDECREF(__pyx_t_1);
  10004. __Pyx_XDECREF(__pyx_t_2);
  10005. __Pyx_XDECREF(__pyx_t_3);
  10006. __Pyx_XDECREF(__pyx_t_4);
  10007. __Pyx_XDECREF(__pyx_t_9);
  10008. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.Imr.as_rdflib", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10009. __pyx_r = 0;
  10010. __pyx_L0:;
  10011. __Pyx_XDECREF(__pyx_v_gr);
  10012. __Pyx_XDECREF(__pyx_v_trp);
  10013. __Pyx_XGIVEREF(__pyx_r);
  10014. __Pyx_TraceReturn(__pyx_r, 0);
  10015. __Pyx_RefNannyFinishContext();
  10016. return __pyx_r;
  10017. }
  10018. /* Python wrapper */
  10019. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_17as_rdflib(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  10020. static char __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_16as_rdflib[] = "\n Return the IMR as a RDFLib Resource.\n\n :rtype: rdflib.Resource\n ";
  10021. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_17as_rdflib(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  10022. PyObject *__pyx_r = 0;
  10023. __Pyx_RefNannyDeclarations
  10024. __Pyx_RefNannySetupContext("as_rdflib (wrapper)", 0);
  10025. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_16as_rdflib(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *)__pyx_v_self));
  10026. /* function exit code */
  10027. __Pyx_RefNannyFinishContext();
  10028. return __pyx_r;
  10029. }
  10030. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_16as_rdflib(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *__pyx_v_self) {
  10031. PyObject *__pyx_r = NULL;
  10032. __Pyx_TraceDeclarations
  10033. __Pyx_RefNannyDeclarations
  10034. PyObject *__pyx_t_1 = NULL;
  10035. __Pyx_RefNannySetupContext("as_rdflib", 0);
  10036. __Pyx_TraceCall("as_rdflib (wrapper)", __pyx_f[0], 571, 0, __PYX_ERR(0, 571, __pyx_L1_error));
  10037. __Pyx_XDECREF(__pyx_r);
  10038. __pyx_t_1 = __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_as_rdflib(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 571, __pyx_L1_error)
  10039. __Pyx_GOTREF(__pyx_t_1);
  10040. __pyx_r = __pyx_t_1;
  10041. __pyx_t_1 = 0;
  10042. goto __pyx_L0;
  10043. /* function exit code */
  10044. __pyx_L1_error:;
  10045. __Pyx_XDECREF(__pyx_t_1);
  10046. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.Imr.as_rdflib", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10047. __pyx_r = NULL;
  10048. __pyx_L0:;
  10049. __Pyx_XGIVEREF(__pyx_r);
  10050. __Pyx_TraceReturn(__pyx_r, 0);
  10051. __Pyx_RefNannyFinishContext();
  10052. return __pyx_r;
  10053. }
  10054. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":471
  10055. * """
  10056. * cdef:
  10057. * readonly object uri # <<<<<<<<<<<<<<
  10058. *
  10059. * def __init__(self, uri, *args, **kwargs):
  10060. */
  10061. /* Python wrapper */
  10062. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_3uri_1__get__(PyObject *__pyx_v_self); /*proto*/
  10063. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_3uri_1__get__(PyObject *__pyx_v_self) {
  10064. PyObject *__pyx_r = 0;
  10065. __Pyx_RefNannyDeclarations
  10066. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  10067. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_3uri___get__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *)__pyx_v_self));
  10068. /* function exit code */
  10069. __Pyx_RefNannyFinishContext();
  10070. return __pyx_r;
  10071. }
  10072. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_3uri___get__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *__pyx_v_self) {
  10073. PyObject *__pyx_r = NULL;
  10074. __Pyx_TraceDeclarations
  10075. __Pyx_RefNannyDeclarations
  10076. __Pyx_RefNannySetupContext("__get__", 0);
  10077. __Pyx_TraceCall("__get__", __pyx_f[0], 471, 0, __PYX_ERR(0, 471, __pyx_L1_error));
  10078. __Pyx_XDECREF(__pyx_r);
  10079. __Pyx_INCREF(__pyx_v_self->uri);
  10080. __pyx_r = __pyx_v_self->uri;
  10081. goto __pyx_L0;
  10082. /* function exit code */
  10083. __pyx_L1_error:;
  10084. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.Imr.uri.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10085. __pyx_r = NULL;
  10086. __pyx_L0:;
  10087. __Pyx_XGIVEREF(__pyx_r);
  10088. __Pyx_TraceReturn(__pyx_r, 0);
  10089. __Pyx_RefNannyFinishContext();
  10090. return __pyx_r;
  10091. }
  10092. /* "(tree fragment)":1
  10093. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  10094. * cdef bint use_setstate
  10095. * state = (self.data, self.uri)
  10096. */
  10097. /* Python wrapper */
  10098. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_19__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  10099. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_19__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  10100. PyObject *__pyx_r = 0;
  10101. __Pyx_RefNannyDeclarations
  10102. __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  10103. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_18__reduce_cython__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *)__pyx_v_self));
  10104. /* function exit code */
  10105. __Pyx_RefNannyFinishContext();
  10106. return __pyx_r;
  10107. }
  10108. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_18__reduce_cython__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *__pyx_v_self) {
  10109. int __pyx_v_use_setstate;
  10110. PyObject *__pyx_v_state = NULL;
  10111. PyObject *__pyx_v__dict = NULL;
  10112. PyObject *__pyx_r = NULL;
  10113. __Pyx_TraceDeclarations
  10114. __Pyx_RefNannyDeclarations
  10115. PyObject *__pyx_t_1 = NULL;
  10116. int __pyx_t_2;
  10117. int __pyx_t_3;
  10118. PyObject *__pyx_t_4 = NULL;
  10119. int __pyx_t_5;
  10120. PyObject *__pyx_t_6 = NULL;
  10121. __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  10122. __Pyx_TraceCall("__reduce_cython__", __pyx_f[1], 1, 0, __PYX_ERR(1, 1, __pyx_L1_error));
  10123. /* "(tree fragment)":3
  10124. * def __reduce_cython__(self):
  10125. * cdef bint use_setstate
  10126. * state = (self.data, self.uri) # <<<<<<<<<<<<<<
  10127. * _dict = getattr(self, '__dict__', None)
  10128. * if _dict is not None:
  10129. */
  10130. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3, __pyx_L1_error)
  10131. __Pyx_GOTREF(__pyx_t_1);
  10132. __Pyx_INCREF(__pyx_v_self->__pyx_base.data);
  10133. __Pyx_GIVEREF(__pyx_v_self->__pyx_base.data);
  10134. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->__pyx_base.data);
  10135. __Pyx_INCREF(__pyx_v_self->uri);
  10136. __Pyx_GIVEREF(__pyx_v_self->uri);
  10137. PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self->uri);
  10138. __pyx_v_state = ((PyObject*)__pyx_t_1);
  10139. __pyx_t_1 = 0;
  10140. /* "(tree fragment)":4
  10141. * cdef bint use_setstate
  10142. * state = (self.data, self.uri)
  10143. * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<<
  10144. * if _dict is not None:
  10145. * state += (_dict,)
  10146. */
  10147. __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  10148. __Pyx_GOTREF(__pyx_t_1);
  10149. __pyx_v__dict = __pyx_t_1;
  10150. __pyx_t_1 = 0;
  10151. /* "(tree fragment)":5
  10152. * state = (self.data, self.uri)
  10153. * _dict = getattr(self, '__dict__', None)
  10154. * if _dict is not None: # <<<<<<<<<<<<<<
  10155. * state += (_dict,)
  10156. * use_setstate = True
  10157. */
  10158. __pyx_t_2 = (__pyx_v__dict != Py_None);
  10159. __pyx_t_3 = (__pyx_t_2 != 0);
  10160. if (__pyx_t_3) {
  10161. /* "(tree fragment)":6
  10162. * _dict = getattr(self, '__dict__', None)
  10163. * if _dict is not None:
  10164. * state += (_dict,) # <<<<<<<<<<<<<<
  10165. * use_setstate = True
  10166. * else:
  10167. */
  10168. __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
  10169. __Pyx_GOTREF(__pyx_t_1);
  10170. __Pyx_INCREF(__pyx_v__dict);
  10171. __Pyx_GIVEREF(__pyx_v__dict);
  10172. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
  10173. __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
  10174. __Pyx_GOTREF(__pyx_t_4);
  10175. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10176. __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
  10177. __pyx_t_4 = 0;
  10178. /* "(tree fragment)":7
  10179. * if _dict is not None:
  10180. * state += (_dict,)
  10181. * use_setstate = True # <<<<<<<<<<<<<<
  10182. * else:
  10183. * use_setstate = self.data is not None or self.uri is not None
  10184. */
  10185. __pyx_v_use_setstate = 1;
  10186. /* "(tree fragment)":5
  10187. * state = (self.data, self.uri)
  10188. * _dict = getattr(self, '__dict__', None)
  10189. * if _dict is not None: # <<<<<<<<<<<<<<
  10190. * state += (_dict,)
  10191. * use_setstate = True
  10192. */
  10193. goto __pyx_L3;
  10194. }
  10195. /* "(tree fragment)":9
  10196. * use_setstate = True
  10197. * else:
  10198. * use_setstate = self.data is not None or self.uri is not None # <<<<<<<<<<<<<<
  10199. * if use_setstate:
  10200. * return __pyx_unpickle_Imr, (type(self), 0xbf84141, None), state
  10201. */
  10202. /*else*/ {
  10203. __pyx_t_2 = (__pyx_v_self->__pyx_base.data != ((PyObject*)Py_None));
  10204. __pyx_t_5 = (__pyx_t_2 != 0);
  10205. if (!__pyx_t_5) {
  10206. } else {
  10207. __pyx_t_3 = __pyx_t_5;
  10208. goto __pyx_L4_bool_binop_done;
  10209. }
  10210. __pyx_t_5 = (__pyx_v_self->uri != Py_None);
  10211. __pyx_t_2 = (__pyx_t_5 != 0);
  10212. __pyx_t_3 = __pyx_t_2;
  10213. __pyx_L4_bool_binop_done:;
  10214. __pyx_v_use_setstate = __pyx_t_3;
  10215. }
  10216. __pyx_L3:;
  10217. /* "(tree fragment)":10
  10218. * else:
  10219. * use_setstate = self.data is not None or self.uri is not None
  10220. * if use_setstate: # <<<<<<<<<<<<<<
  10221. * return __pyx_unpickle_Imr, (type(self), 0xbf84141, None), state
  10222. * else:
  10223. */
  10224. __pyx_t_3 = (__pyx_v_use_setstate != 0);
  10225. if (__pyx_t_3) {
  10226. /* "(tree fragment)":11
  10227. * use_setstate = self.data is not None or self.uri is not None
  10228. * if use_setstate:
  10229. * return __pyx_unpickle_Imr, (type(self), 0xbf84141, None), state # <<<<<<<<<<<<<<
  10230. * else:
  10231. * return __pyx_unpickle_Imr, (type(self), 0xbf84141, state)
  10232. */
  10233. __Pyx_XDECREF(__pyx_r);
  10234. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_Imr); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 11, __pyx_L1_error)
  10235. __Pyx_GOTREF(__pyx_t_4);
  10236. __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 11, __pyx_L1_error)
  10237. __Pyx_GOTREF(__pyx_t_1);
  10238. __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  10239. __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  10240. PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  10241. __Pyx_INCREF(__pyx_int_200819009);
  10242. __Pyx_GIVEREF(__pyx_int_200819009);
  10243. PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_200819009);
  10244. __Pyx_INCREF(Py_None);
  10245. __Pyx_GIVEREF(Py_None);
  10246. PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
  10247. __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 11, __pyx_L1_error)
  10248. __Pyx_GOTREF(__pyx_t_6);
  10249. __Pyx_GIVEREF(__pyx_t_4);
  10250. PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  10251. __Pyx_GIVEREF(__pyx_t_1);
  10252. PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
  10253. __Pyx_INCREF(__pyx_v_state);
  10254. __Pyx_GIVEREF(__pyx_v_state);
  10255. PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_state);
  10256. __pyx_t_4 = 0;
  10257. __pyx_t_1 = 0;
  10258. __pyx_r = __pyx_t_6;
  10259. __pyx_t_6 = 0;
  10260. goto __pyx_L0;
  10261. /* "(tree fragment)":10
  10262. * else:
  10263. * use_setstate = self.data is not None or self.uri is not None
  10264. * if use_setstate: # <<<<<<<<<<<<<<
  10265. * return __pyx_unpickle_Imr, (type(self), 0xbf84141, None), state
  10266. * else:
  10267. */
  10268. }
  10269. /* "(tree fragment)":13
  10270. * return __pyx_unpickle_Imr, (type(self), 0xbf84141, None), state
  10271. * else:
  10272. * return __pyx_unpickle_Imr, (type(self), 0xbf84141, state) # <<<<<<<<<<<<<<
  10273. * def __setstate_cython__(self, __pyx_state):
  10274. * __pyx_unpickle_Imr__set_state(self, __pyx_state)
  10275. */
  10276. /*else*/ {
  10277. __Pyx_XDECREF(__pyx_r);
  10278. __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_Imr); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
  10279. __Pyx_GOTREF(__pyx_t_6);
  10280. __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
  10281. __Pyx_GOTREF(__pyx_t_1);
  10282. __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  10283. __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  10284. PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  10285. __Pyx_INCREF(__pyx_int_200819009);
  10286. __Pyx_GIVEREF(__pyx_int_200819009);
  10287. PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_200819009);
  10288. __Pyx_INCREF(__pyx_v_state);
  10289. __Pyx_GIVEREF(__pyx_v_state);
  10290. PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
  10291. __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
  10292. __Pyx_GOTREF(__pyx_t_4);
  10293. __Pyx_GIVEREF(__pyx_t_6);
  10294. PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
  10295. __Pyx_GIVEREF(__pyx_t_1);
  10296. PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
  10297. __pyx_t_6 = 0;
  10298. __pyx_t_1 = 0;
  10299. __pyx_r = __pyx_t_4;
  10300. __pyx_t_4 = 0;
  10301. goto __pyx_L0;
  10302. }
  10303. /* "(tree fragment)":1
  10304. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  10305. * cdef bint use_setstate
  10306. * state = (self.data, self.uri)
  10307. */
  10308. /* function exit code */
  10309. __pyx_L1_error:;
  10310. __Pyx_XDECREF(__pyx_t_1);
  10311. __Pyx_XDECREF(__pyx_t_4);
  10312. __Pyx_XDECREF(__pyx_t_6);
  10313. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.Imr.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10314. __pyx_r = NULL;
  10315. __pyx_L0:;
  10316. __Pyx_XDECREF(__pyx_v_state);
  10317. __Pyx_XDECREF(__pyx_v__dict);
  10318. __Pyx_XGIVEREF(__pyx_r);
  10319. __Pyx_TraceReturn(__pyx_r, 0);
  10320. __Pyx_RefNannyFinishContext();
  10321. return __pyx_r;
  10322. }
  10323. /* "(tree fragment)":14
  10324. * else:
  10325. * return __pyx_unpickle_Imr, (type(self), 0xbf84141, state)
  10326. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  10327. * __pyx_unpickle_Imr__set_state(self, __pyx_state)
  10328. */
  10329. /* Python wrapper */
  10330. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_21__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
  10331. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_21__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  10332. PyObject *__pyx_r = 0;
  10333. __Pyx_RefNannyDeclarations
  10334. __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  10335. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_20__setstate_cython__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
  10336. /* function exit code */
  10337. __Pyx_RefNannyFinishContext();
  10338. return __pyx_r;
  10339. }
  10340. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_20__setstate_cython__(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  10341. PyObject *__pyx_r = NULL;
  10342. __Pyx_TraceDeclarations
  10343. __Pyx_RefNannyDeclarations
  10344. PyObject *__pyx_t_1 = NULL;
  10345. __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  10346. __Pyx_TraceCall("__setstate_cython__", __pyx_f[1], 14, 0, __PYX_ERR(1, 14, __pyx_L1_error));
  10347. /* "(tree fragment)":15
  10348. * return __pyx_unpickle_Imr, (type(self), 0xbf84141, state)
  10349. * def __setstate_cython__(self, __pyx_state):
  10350. * __pyx_unpickle_Imr__set_state(self, __pyx_state) # <<<<<<<<<<<<<<
  10351. */
  10352. if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 15, __pyx_L1_error)
  10353. __pyx_t_1 = __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_unpickle_Imr__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
  10354. __Pyx_GOTREF(__pyx_t_1);
  10355. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10356. /* "(tree fragment)":14
  10357. * else:
  10358. * return __pyx_unpickle_Imr, (type(self), 0xbf84141, state)
  10359. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  10360. * __pyx_unpickle_Imr__set_state(self, __pyx_state)
  10361. */
  10362. /* function exit code */
  10363. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  10364. goto __pyx_L0;
  10365. __pyx_L1_error:;
  10366. __Pyx_XDECREF(__pyx_t_1);
  10367. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.Imr.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10368. __pyx_r = NULL;
  10369. __pyx_L0:;
  10370. __Pyx_XGIVEREF(__pyx_r);
  10371. __Pyx_TraceReturn(__pyx_r, 0);
  10372. __Pyx_RefNannyFinishContext();
  10373. return __pyx_r;
  10374. }
  10375. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":653
  10376. * # DB management methods.
  10377. *
  10378. * cpdef dict stats(self, new_txn=True): # <<<<<<<<<<<<<<
  10379. * """Gather statistics about the database."""
  10380. * st = self._stats()
  10381. */
  10382. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_1stats(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  10383. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_stats(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_stats *__pyx_optional_args) {
  10384. PyObject *__pyx_v_new_txn = ((PyObject *)Py_True);
  10385. PyObject *__pyx_v_st = NULL;
  10386. PyObject *__pyx_r = NULL;
  10387. __Pyx_TraceDeclarations
  10388. __Pyx_RefNannyDeclarations
  10389. PyObject *__pyx_t_1 = NULL;
  10390. PyObject *__pyx_t_2 = NULL;
  10391. PyObject *__pyx_t_3 = NULL;
  10392. PyObject *__pyx_t_4 = NULL;
  10393. PyObject *__pyx_t_5 = NULL;
  10394. __Pyx_RefNannySetupContext("stats", 0);
  10395. __Pyx_TraceCall("stats", __pyx_f[0], 653, 0, __PYX_ERR(0, 653, __pyx_L1_error));
  10396. if (__pyx_optional_args) {
  10397. if (__pyx_optional_args->__pyx_n > 0) {
  10398. __pyx_v_new_txn = __pyx_optional_args->new_txn;
  10399. }
  10400. }
  10401. /* Check if called by wrapper */
  10402. if (unlikely(__pyx_skip_dispatch)) ;
  10403. /* Check if overridden in Python */
  10404. else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
  10405. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_stats); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 653, __pyx_L1_error)
  10406. __Pyx_GOTREF(__pyx_t_1);
  10407. if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_1stats)) {
  10408. __Pyx_XDECREF(__pyx_r);
  10409. __Pyx_INCREF(__pyx_t_1);
  10410. __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
  10411. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  10412. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
  10413. if (likely(__pyx_t_4)) {
  10414. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  10415. __Pyx_INCREF(__pyx_t_4);
  10416. __Pyx_INCREF(function);
  10417. __Pyx_DECREF_SET(__pyx_t_3, function);
  10418. }
  10419. }
  10420. if (!__pyx_t_4) {
  10421. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_new_txn); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 653, __pyx_L1_error)
  10422. __Pyx_GOTREF(__pyx_t_2);
  10423. } else {
  10424. #if CYTHON_FAST_PYCALL
  10425. if (PyFunction_Check(__pyx_t_3)) {
  10426. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_new_txn};
  10427. __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 653, __pyx_L1_error)
  10428. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  10429. __Pyx_GOTREF(__pyx_t_2);
  10430. } else
  10431. #endif
  10432. #if CYTHON_FAST_PYCCALL
  10433. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  10434. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_new_txn};
  10435. __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 653, __pyx_L1_error)
  10436. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  10437. __Pyx_GOTREF(__pyx_t_2);
  10438. } else
  10439. #endif
  10440. {
  10441. __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 653, __pyx_L1_error)
  10442. __Pyx_GOTREF(__pyx_t_5);
  10443. __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
  10444. __Pyx_INCREF(__pyx_v_new_txn);
  10445. __Pyx_GIVEREF(__pyx_v_new_txn);
  10446. PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_new_txn);
  10447. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 653, __pyx_L1_error)
  10448. __Pyx_GOTREF(__pyx_t_2);
  10449. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  10450. }
  10451. }
  10452. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  10453. if (!(likely(PyDict_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 653, __pyx_L1_error)
  10454. __pyx_r = ((PyObject*)__pyx_t_2);
  10455. __pyx_t_2 = 0;
  10456. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10457. goto __pyx_L0;
  10458. }
  10459. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10460. }
  10461. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":655
  10462. * cpdef dict stats(self, new_txn=True):
  10463. * """Gather statistics about the database."""
  10464. * st = self._stats() # <<<<<<<<<<<<<<
  10465. * st['num_triples'] = st['db_stats']['spo:c']['ms_entries']
  10466. *
  10467. */
  10468. __pyx_t_1 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._stats(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 655, __pyx_L1_error)
  10469. __Pyx_GOTREF(__pyx_t_1);
  10470. __pyx_v_st = ((PyObject*)__pyx_t_1);
  10471. __pyx_t_1 = 0;
  10472. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":656
  10473. * """Gather statistics about the database."""
  10474. * st = self._stats()
  10475. * st['num_triples'] = st['db_stats']['spo:c']['ms_entries'] # <<<<<<<<<<<<<<
  10476. *
  10477. * return st
  10478. */
  10479. if (unlikely(__pyx_v_st == Py_None)) {
  10480. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
  10481. __PYX_ERR(0, 656, __pyx_L1_error)
  10482. }
  10483. __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_st, __pyx_n_u_db_stats); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 656, __pyx_L1_error)
  10484. __Pyx_GOTREF(__pyx_t_1);
  10485. __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_kp_u_spo_c); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 656, __pyx_L1_error)
  10486. __Pyx_GOTREF(__pyx_t_2);
  10487. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10488. __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_n_u_ms_entries); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 656, __pyx_L1_error)
  10489. __Pyx_GOTREF(__pyx_t_1);
  10490. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  10491. if (unlikely(__pyx_v_st == Py_None)) {
  10492. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
  10493. __PYX_ERR(0, 656, __pyx_L1_error)
  10494. }
  10495. if (unlikely(PyDict_SetItem(__pyx_v_st, __pyx_n_u_num_triples, __pyx_t_1) < 0)) __PYX_ERR(0, 656, __pyx_L1_error)
  10496. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10497. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":658
  10498. * st['num_triples'] = st['db_stats']['spo:c']['ms_entries']
  10499. *
  10500. * return st # <<<<<<<<<<<<<<
  10501. *
  10502. *
  10503. */
  10504. __Pyx_XDECREF(__pyx_r);
  10505. __Pyx_INCREF(__pyx_v_st);
  10506. __pyx_r = __pyx_v_st;
  10507. goto __pyx_L0;
  10508. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":653
  10509. * # DB management methods.
  10510. *
  10511. * cpdef dict stats(self, new_txn=True): # <<<<<<<<<<<<<<
  10512. * """Gather statistics about the database."""
  10513. * st = self._stats()
  10514. */
  10515. /* function exit code */
  10516. __pyx_L1_error:;
  10517. __Pyx_XDECREF(__pyx_t_1);
  10518. __Pyx_XDECREF(__pyx_t_2);
  10519. __Pyx_XDECREF(__pyx_t_3);
  10520. __Pyx_XDECREF(__pyx_t_4);
  10521. __Pyx_XDECREF(__pyx_t_5);
  10522. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.stats", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10523. __pyx_r = 0;
  10524. __pyx_L0:;
  10525. __Pyx_XDECREF(__pyx_v_st);
  10526. __Pyx_XGIVEREF(__pyx_r);
  10527. __Pyx_TraceReturn(__pyx_r, 0);
  10528. __Pyx_RefNannyFinishContext();
  10529. return __pyx_r;
  10530. }
  10531. /* Python wrapper */
  10532. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_1stats(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  10533. static char __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_stats[] = "Gather statistics about the database.";
  10534. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_1stats(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  10535. PyObject *__pyx_v_new_txn = 0;
  10536. PyObject *__pyx_r = 0;
  10537. __Pyx_RefNannyDeclarations
  10538. __Pyx_RefNannySetupContext("stats (wrapper)", 0);
  10539. {
  10540. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_new_txn,0};
  10541. PyObject* values[1] = {0};
  10542. values[0] = ((PyObject *)Py_True);
  10543. if (unlikely(__pyx_kwds)) {
  10544. Py_ssize_t kw_args;
  10545. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  10546. switch (pos_args) {
  10547. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  10548. CYTHON_FALLTHROUGH;
  10549. case 0: break;
  10550. default: goto __pyx_L5_argtuple_error;
  10551. }
  10552. kw_args = PyDict_Size(__pyx_kwds);
  10553. switch (pos_args) {
  10554. case 0:
  10555. if (kw_args > 0) {
  10556. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_new_txn);
  10557. if (value) { values[0] = value; kw_args--; }
  10558. }
  10559. }
  10560. if (unlikely(kw_args > 0)) {
  10561. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "stats") < 0)) __PYX_ERR(0, 653, __pyx_L3_error)
  10562. }
  10563. } else {
  10564. switch (PyTuple_GET_SIZE(__pyx_args)) {
  10565. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  10566. CYTHON_FALLTHROUGH;
  10567. case 0: break;
  10568. default: goto __pyx_L5_argtuple_error;
  10569. }
  10570. }
  10571. __pyx_v_new_txn = values[0];
  10572. }
  10573. goto __pyx_L4_argument_unpacking_done;
  10574. __pyx_L5_argtuple_error:;
  10575. __Pyx_RaiseArgtupleInvalid("stats", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 653, __pyx_L3_error)
  10576. __pyx_L3_error:;
  10577. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.stats", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10578. __Pyx_RefNannyFinishContext();
  10579. return NULL;
  10580. __pyx_L4_argument_unpacking_done:;
  10581. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_stats(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self), __pyx_v_new_txn);
  10582. /* function exit code */
  10583. __Pyx_RefNannyFinishContext();
  10584. return __pyx_r;
  10585. }
  10586. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_stats(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_new_txn) {
  10587. PyObject *__pyx_r = NULL;
  10588. __Pyx_TraceDeclarations
  10589. __Pyx_RefNannyDeclarations
  10590. PyObject *__pyx_t_1 = NULL;
  10591. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore_stats __pyx_t_2;
  10592. __Pyx_RefNannySetupContext("stats", 0);
  10593. __Pyx_TraceCall("stats (wrapper)", __pyx_f[0], 653, 0, __PYX_ERR(0, 653, __pyx_L1_error));
  10594. __Pyx_XDECREF(__pyx_r);
  10595. __pyx_t_2.__pyx_n = 1;
  10596. __pyx_t_2.new_txn = __pyx_v_new_txn;
  10597. __pyx_t_1 = __pyx_vtabptr_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore->__pyx_base.stats(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 653, __pyx_L1_error)
  10598. __Pyx_GOTREF(__pyx_t_1);
  10599. __pyx_r = __pyx_t_1;
  10600. __pyx_t_1 = 0;
  10601. goto __pyx_L0;
  10602. /* function exit code */
  10603. __pyx_L1_error:;
  10604. __Pyx_XDECREF(__pyx_t_1);
  10605. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.stats", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10606. __pyx_r = NULL;
  10607. __pyx_L0:;
  10608. __Pyx_XGIVEREF(__pyx_r);
  10609. __Pyx_TraceReturn(__pyx_r, 0);
  10610. __Pyx_RefNannyFinishContext();
  10611. return __pyx_r;
  10612. }
  10613. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":661
  10614. *
  10615. *
  10616. * cpdef size_t _len(self, context=None) except -1: # <<<<<<<<<<<<<<
  10617. * """
  10618. * Return the length of the dataset.
  10619. */
  10620. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_3_len(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  10621. static size_t __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__len(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__len *__pyx_optional_args) {
  10622. PyObject *__pyx_v_context = ((PyObject *)Py_None);
  10623. size_t __pyx_v_ct;
  10624. MDB_cursor *__pyx_v_cur;
  10625. size_t __pyx_r;
  10626. __Pyx_TraceDeclarations
  10627. __Pyx_RefNannyDeclarations
  10628. PyObject *__pyx_t_1 = NULL;
  10629. PyObject *__pyx_t_2 = NULL;
  10630. PyObject *__pyx_t_3 = NULL;
  10631. PyObject *__pyx_t_4 = NULL;
  10632. PyObject *__pyx_t_5 = NULL;
  10633. size_t __pyx_t_6;
  10634. int __pyx_t_7;
  10635. int __pyx_t_8;
  10636. MDB_cursor *__pyx_t_9;
  10637. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__cur_open __pyx_t_10;
  10638. PyObject *__pyx_t_11 = NULL;
  10639. PyObject *__pyx_t_12 = NULL;
  10640. PyObject *__pyx_t_13 = NULL;
  10641. int __pyx_t_14;
  10642. int __pyx_t_15;
  10643. char const *__pyx_t_16;
  10644. PyObject *__pyx_t_17 = NULL;
  10645. PyObject *__pyx_t_18 = NULL;
  10646. PyObject *__pyx_t_19 = NULL;
  10647. __Pyx_RefNannySetupContext("_len", 0);
  10648. __Pyx_TraceCall("_len", __pyx_f[0], 661, 0, __PYX_ERR(0, 661, __pyx_L1_error));
  10649. if (__pyx_optional_args) {
  10650. if (__pyx_optional_args->__pyx_n > 0) {
  10651. __pyx_v_context = __pyx_optional_args->context;
  10652. }
  10653. }
  10654. /* Check if called by wrapper */
  10655. if (unlikely(__pyx_skip_dispatch)) ;
  10656. /* Check if overridden in Python */
  10657. else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
  10658. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 661, __pyx_L1_error)
  10659. __Pyx_GOTREF(__pyx_t_1);
  10660. if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_3_len)) {
  10661. __Pyx_INCREF(__pyx_t_1);
  10662. __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
  10663. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  10664. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
  10665. if (likely(__pyx_t_4)) {
  10666. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  10667. __Pyx_INCREF(__pyx_t_4);
  10668. __Pyx_INCREF(function);
  10669. __Pyx_DECREF_SET(__pyx_t_3, function);
  10670. }
  10671. }
  10672. if (!__pyx_t_4) {
  10673. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_context); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 661, __pyx_L1_error)
  10674. __Pyx_GOTREF(__pyx_t_2);
  10675. } else {
  10676. #if CYTHON_FAST_PYCALL
  10677. if (PyFunction_Check(__pyx_t_3)) {
  10678. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_context};
  10679. __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 661, __pyx_L1_error)
  10680. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  10681. __Pyx_GOTREF(__pyx_t_2);
  10682. } else
  10683. #endif
  10684. #if CYTHON_FAST_PYCCALL
  10685. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  10686. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_context};
  10687. __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 661, __pyx_L1_error)
  10688. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  10689. __Pyx_GOTREF(__pyx_t_2);
  10690. } else
  10691. #endif
  10692. {
  10693. __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 661, __pyx_L1_error)
  10694. __Pyx_GOTREF(__pyx_t_5);
  10695. __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
  10696. __Pyx_INCREF(__pyx_v_context);
  10697. __Pyx_GIVEREF(__pyx_v_context);
  10698. PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_context);
  10699. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 661, __pyx_L1_error)
  10700. __Pyx_GOTREF(__pyx_t_2);
  10701. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  10702. }
  10703. }
  10704. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  10705. __pyx_t_6 = __Pyx_PyInt_As_size_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 661, __pyx_L1_error)
  10706. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  10707. __pyx_r = __pyx_t_6;
  10708. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10709. goto __pyx_L0;
  10710. }
  10711. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10712. }
  10713. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":672
  10714. * size_t ct
  10715. *
  10716. * if context is not None: # <<<<<<<<<<<<<<
  10717. * self._to_key(context, <Key *>key_v.mv_data)
  10718. * key_v.mv_size = KLEN
  10719. */
  10720. __pyx_t_7 = (__pyx_v_context != Py_None);
  10721. __pyx_t_8 = (__pyx_t_7 != 0);
  10722. if (__pyx_t_8) {
  10723. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":673
  10724. *
  10725. * if context is not None:
  10726. * self._to_key(context, <Key *>key_v.mv_data) # <<<<<<<<<<<<<<
  10727. * key_v.mv_size = KLEN
  10728. *
  10729. */
  10730. __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__to_key(__pyx_v_self, __pyx_v_context, ((__pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Key *)__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v.mv_data)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 673, __pyx_L1_error)
  10731. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":674
  10732. * if context is not None:
  10733. * self._to_key(context, <Key *>key_v.mv_data)
  10734. * key_v.mv_size = KLEN # <<<<<<<<<<<<<<
  10735. *
  10736. * cur = self._cur_open('c:spo')
  10737. */
  10738. __pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v.mv_size = 5;
  10739. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":676
  10740. * key_v.mv_size = KLEN
  10741. *
  10742. * cur = self._cur_open('c:spo') # <<<<<<<<<<<<<<
  10743. * try:
  10744. * _check(lmdb.mdb_cursor_get(
  10745. */
  10746. __pyx_t_10.__pyx_n = 1;
  10747. __pyx_t_10.dblabel = ((unsigned char *)((char const *)"c:spo"));
  10748. __pyx_t_9 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_open(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 676, __pyx_L1_error)
  10749. __pyx_v_cur = __pyx_t_9;
  10750. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":677
  10751. *
  10752. * cur = self._cur_open('c:spo')
  10753. * try: # <<<<<<<<<<<<<<
  10754. * _check(lmdb.mdb_cursor_get(
  10755. * cur, &key_v, NULL, lmdb.MDB_SET))
  10756. */
  10757. /*try:*/ {
  10758. {
  10759. __Pyx_PyThreadState_declare
  10760. __Pyx_PyThreadState_assign
  10761. __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
  10762. __Pyx_XGOTREF(__pyx_t_11);
  10763. __Pyx_XGOTREF(__pyx_t_12);
  10764. __Pyx_XGOTREF(__pyx_t_13);
  10765. /*try:*/ {
  10766. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":678
  10767. * cur = self._cur_open('c:spo')
  10768. * try:
  10769. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  10770. * cur, &key_v, NULL, lmdb.MDB_SET))
  10771. * _check(lmdb.mdb_cursor_count(cur, &ct))
  10772. */
  10773. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_cur, (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v), NULL, MDB_SET), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 678, __pyx_L7_error)
  10774. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":680
  10775. * _check(lmdb.mdb_cursor_get(
  10776. * cur, &key_v, NULL, lmdb.MDB_SET))
  10777. * _check(lmdb.mdb_cursor_count(cur, &ct)) # <<<<<<<<<<<<<<
  10778. * except KeyNotFoundError:
  10779. * return 0
  10780. */
  10781. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_count(__pyx_v_cur, (&__pyx_v_ct)), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 680, __pyx_L7_error)
  10782. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":677
  10783. *
  10784. * cur = self._cur_open('c:spo')
  10785. * try: # <<<<<<<<<<<<<<
  10786. * _check(lmdb.mdb_cursor_get(
  10787. * cur, &key_v, NULL, lmdb.MDB_SET))
  10788. */
  10789. }
  10790. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":684
  10791. * return 0
  10792. * else:
  10793. * return ct # <<<<<<<<<<<<<<
  10794. * finally:
  10795. * #pass
  10796. */
  10797. /*else:*/ {
  10798. __pyx_r = __pyx_v_ct;
  10799. goto __pyx_L10_except_return;
  10800. }
  10801. __pyx_L7_error:;
  10802. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  10803. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  10804. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  10805. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  10806. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  10807. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":681
  10808. * cur, &key_v, NULL, lmdb.MDB_SET))
  10809. * _check(lmdb.mdb_cursor_count(cur, &ct))
  10810. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  10811. * return 0
  10812. * else:
  10813. */
  10814. __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  10815. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 681, __pyx_L9_except_error)
  10816. __Pyx_GOTREF(__pyx_t_5);
  10817. __pyx_t_14 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_5);
  10818. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  10819. __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  10820. __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0;
  10821. if (__pyx_t_14) {
  10822. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._len", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10823. if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 681, __pyx_L9_except_error)
  10824. __Pyx_GOTREF(__pyx_t_3);
  10825. __Pyx_GOTREF(__pyx_t_2);
  10826. __Pyx_GOTREF(__pyx_t_1);
  10827. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":682
  10828. * _check(lmdb.mdb_cursor_count(cur, &ct))
  10829. * except KeyNotFoundError:
  10830. * return 0 # <<<<<<<<<<<<<<
  10831. * else:
  10832. * return ct
  10833. */
  10834. __pyx_r = 0;
  10835. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10836. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  10837. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  10838. goto __pyx_L10_except_return;
  10839. }
  10840. goto __pyx_L9_except_error;
  10841. __pyx_L9_except_error:;
  10842. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":677
  10843. *
  10844. * cur = self._cur_open('c:spo')
  10845. * try: # <<<<<<<<<<<<<<
  10846. * _check(lmdb.mdb_cursor_get(
  10847. * cur, &key_v, NULL, lmdb.MDB_SET))
  10848. */
  10849. __Pyx_XGIVEREF(__pyx_t_11);
  10850. __Pyx_XGIVEREF(__pyx_t_12);
  10851. __Pyx_XGIVEREF(__pyx_t_13);
  10852. __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
  10853. goto __pyx_L5_error;
  10854. __pyx_L10_except_return:;
  10855. __Pyx_XGIVEREF(__pyx_t_11);
  10856. __Pyx_XGIVEREF(__pyx_t_12);
  10857. __Pyx_XGIVEREF(__pyx_t_13);
  10858. __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
  10859. goto __pyx_L4_return;
  10860. }
  10861. }
  10862. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":687
  10863. * finally:
  10864. * #pass
  10865. * self._cur_close(cur) # <<<<<<<<<<<<<<
  10866. * else:
  10867. * return self.stats()['num_triples']
  10868. */
  10869. /*finally:*/ {
  10870. __pyx_L5_error:;
  10871. /*exception exit:*/{
  10872. __Pyx_PyThreadState_declare
  10873. __Pyx_PyThreadState_assign
  10874. __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
  10875. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  10876. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  10877. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  10878. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  10879. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  10880. if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
  10881. if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
  10882. __Pyx_XGOTREF(__pyx_t_13);
  10883. __Pyx_XGOTREF(__pyx_t_12);
  10884. __Pyx_XGOTREF(__pyx_t_11);
  10885. __Pyx_XGOTREF(__pyx_t_17);
  10886. __Pyx_XGOTREF(__pyx_t_18);
  10887. __Pyx_XGOTREF(__pyx_t_19);
  10888. __pyx_t_14 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename;
  10889. {
  10890. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_cur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 687, __pyx_L16_error)
  10891. }
  10892. if (PY_MAJOR_VERSION >= 3) {
  10893. __Pyx_XGIVEREF(__pyx_t_17);
  10894. __Pyx_XGIVEREF(__pyx_t_18);
  10895. __Pyx_XGIVEREF(__pyx_t_19);
  10896. __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
  10897. }
  10898. __Pyx_XGIVEREF(__pyx_t_13);
  10899. __Pyx_XGIVEREF(__pyx_t_12);
  10900. __Pyx_XGIVEREF(__pyx_t_11);
  10901. __Pyx_ErrRestore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
  10902. __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
  10903. __pyx_lineno = __pyx_t_14; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16;
  10904. goto __pyx_L1_error;
  10905. __pyx_L16_error:;
  10906. if (PY_MAJOR_VERSION >= 3) {
  10907. __Pyx_XGIVEREF(__pyx_t_17);
  10908. __Pyx_XGIVEREF(__pyx_t_18);
  10909. __Pyx_XGIVEREF(__pyx_t_19);
  10910. __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
  10911. }
  10912. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  10913. __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  10914. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  10915. __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
  10916. goto __pyx_L1_error;
  10917. }
  10918. __pyx_L4_return: {
  10919. __pyx_t_6 = __pyx_r;
  10920. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_cur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 687, __pyx_L1_error)
  10921. __pyx_r = __pyx_t_6;
  10922. goto __pyx_L0;
  10923. }
  10924. }
  10925. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":672
  10926. * size_t ct
  10927. *
  10928. * if context is not None: # <<<<<<<<<<<<<<
  10929. * self._to_key(context, <Key *>key_v.mv_data)
  10930. * key_v.mv_size = KLEN
  10931. */
  10932. }
  10933. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":689
  10934. * self._cur_close(cur)
  10935. * else:
  10936. * return self.stats()['num_triples'] # <<<<<<<<<<<<<<
  10937. *
  10938. *
  10939. */
  10940. /*else*/ {
  10941. __pyx_t_1 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.stats(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 689, __pyx_L1_error)
  10942. __Pyx_GOTREF(__pyx_t_1);
  10943. if (unlikely(__pyx_t_1 == Py_None)) {
  10944. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
  10945. __PYX_ERR(0, 689, __pyx_L1_error)
  10946. }
  10947. __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_t_1, __pyx_n_u_num_triples); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 689, __pyx_L1_error)
  10948. __Pyx_GOTREF(__pyx_t_2);
  10949. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10950. __pyx_t_6 = __Pyx_PyInt_As_size_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 689, __pyx_L1_error)
  10951. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  10952. __pyx_r = __pyx_t_6;
  10953. goto __pyx_L0;
  10954. }
  10955. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":661
  10956. *
  10957. *
  10958. * cpdef size_t _len(self, context=None) except -1: # <<<<<<<<<<<<<<
  10959. * """
  10960. * Return the length of the dataset.
  10961. */
  10962. /* function exit code */
  10963. __pyx_L1_error:;
  10964. __Pyx_XDECREF(__pyx_t_1);
  10965. __Pyx_XDECREF(__pyx_t_2);
  10966. __Pyx_XDECREF(__pyx_t_3);
  10967. __Pyx_XDECREF(__pyx_t_4);
  10968. __Pyx_XDECREF(__pyx_t_5);
  10969. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._len", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10970. __pyx_r = -1L;
  10971. __pyx_L0:;
  10972. __Pyx_TraceReturn(Py_None, 0);
  10973. __Pyx_RefNannyFinishContext();
  10974. return __pyx_r;
  10975. }
  10976. /* Python wrapper */
  10977. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_3_len(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  10978. static char __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_2_len[] = "\n Return the length of the dataset.\n\n The RDFLib interface defines `__len__` in a nonstandard way that\n causes a Cython compilation error, so this method is called by the\n `__len__` method of its Python counterpart.\n ";
  10979. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_3_len(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  10980. PyObject *__pyx_v_context = 0;
  10981. PyObject *__pyx_r = 0;
  10982. __Pyx_RefNannyDeclarations
  10983. __Pyx_RefNannySetupContext("_len (wrapper)", 0);
  10984. {
  10985. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,0};
  10986. PyObject* values[1] = {0};
  10987. values[0] = ((PyObject *)Py_None);
  10988. if (unlikely(__pyx_kwds)) {
  10989. Py_ssize_t kw_args;
  10990. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  10991. switch (pos_args) {
  10992. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  10993. CYTHON_FALLTHROUGH;
  10994. case 0: break;
  10995. default: goto __pyx_L5_argtuple_error;
  10996. }
  10997. kw_args = PyDict_Size(__pyx_kwds);
  10998. switch (pos_args) {
  10999. case 0:
  11000. if (kw_args > 0) {
  11001. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_context);
  11002. if (value) { values[0] = value; kw_args--; }
  11003. }
  11004. }
  11005. if (unlikely(kw_args > 0)) {
  11006. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_len") < 0)) __PYX_ERR(0, 661, __pyx_L3_error)
  11007. }
  11008. } else {
  11009. switch (PyTuple_GET_SIZE(__pyx_args)) {
  11010. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  11011. CYTHON_FALLTHROUGH;
  11012. case 0: break;
  11013. default: goto __pyx_L5_argtuple_error;
  11014. }
  11015. }
  11016. __pyx_v_context = values[0];
  11017. }
  11018. goto __pyx_L4_argument_unpacking_done;
  11019. __pyx_L5_argtuple_error:;
  11020. __Pyx_RaiseArgtupleInvalid("_len", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 661, __pyx_L3_error)
  11021. __pyx_L3_error:;
  11022. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._len", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11023. __Pyx_RefNannyFinishContext();
  11024. return NULL;
  11025. __pyx_L4_argument_unpacking_done:;
  11026. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_2_len(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self), __pyx_v_context);
  11027. /* function exit code */
  11028. __Pyx_RefNannyFinishContext();
  11029. return __pyx_r;
  11030. }
  11031. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_2_len(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_context) {
  11032. PyObject *__pyx_r = NULL;
  11033. __Pyx_TraceDeclarations
  11034. __Pyx_RefNannyDeclarations
  11035. size_t __pyx_t_1;
  11036. struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__len __pyx_t_2;
  11037. PyObject *__pyx_t_3 = NULL;
  11038. __Pyx_RefNannySetupContext("_len", 0);
  11039. __Pyx_TraceCall("_len (wrapper)", __pyx_f[0], 661, 0, __PYX_ERR(0, 661, __pyx_L1_error));
  11040. __Pyx_XDECREF(__pyx_r);
  11041. __pyx_t_2.__pyx_n = 1;
  11042. __pyx_t_2.context = __pyx_v_context;
  11043. __pyx_t_1 = __pyx_vtabptr_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore->_len(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((size_t)-1L))) __PYX_ERR(0, 661, __pyx_L1_error)
  11044. __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 661, __pyx_L1_error)
  11045. __Pyx_GOTREF(__pyx_t_3);
  11046. __pyx_r = __pyx_t_3;
  11047. __pyx_t_3 = 0;
  11048. goto __pyx_L0;
  11049. /* function exit code */
  11050. __pyx_L1_error:;
  11051. __Pyx_XDECREF(__pyx_t_3);
  11052. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._len", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11053. __pyx_r = NULL;
  11054. __pyx_L0:;
  11055. __Pyx_XGIVEREF(__pyx_r);
  11056. __Pyx_TraceReturn(__pyx_r, 0);
  11057. __Pyx_RefNannyFinishContext();
  11058. return __pyx_r;
  11059. }
  11060. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":696
  11061. * # Triple and graph methods.
  11062. *
  11063. * cpdef add(self, triple, context=None, quoted=False): # <<<<<<<<<<<<<<
  11064. * """
  11065. * Add a triple and start indexing.
  11066. */
  11067. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_5add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  11068. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_add(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_triple, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_add *__pyx_optional_args) {
  11069. PyObject *__pyx_v_context = ((PyObject *)Py_None);
  11070. PyObject *__pyx_v_quoted = ((PyObject *)Py_False);
  11071. MDB_cursor *__pyx_v_icur;
  11072. struct MDB_val __pyx_v_spo_v;
  11073. struct MDB_val __pyx_v_c_v;
  11074. struct MDB_val __pyx_v_null_v;
  11075. unsigned char __pyx_v_i;
  11076. unsigned char *__pyx_v_pk_t;
  11077. unsigned char __pyx_v_thash[20];
  11078. unsigned char __pyx_v_spock[20];
  11079. unsigned char __pyx_v_nkey[5];
  11080. size_t __pyx_v_term_size;
  11081. PyObject *__pyx_v_c = NULL;
  11082. PyObject *__pyx_v_s = NULL;
  11083. PyObject *__pyx_v_p = NULL;
  11084. PyObject *__pyx_v_o = NULL;
  11085. PyObject *__pyx_v_term = NULL;
  11086. PyObject *__pyx_r = NULL;
  11087. __Pyx_TraceDeclarations
  11088. __Pyx_RefNannyDeclarations
  11089. PyObject *__pyx_t_1 = NULL;
  11090. PyObject *__pyx_t_2 = NULL;
  11091. PyObject *__pyx_t_3 = NULL;
  11092. PyObject *__pyx_t_4 = NULL;
  11093. int __pyx_t_5;
  11094. PyObject *__pyx_t_6 = NULL;
  11095. int __pyx_t_7;
  11096. int __pyx_t_8;
  11097. PyObject *(*__pyx_t_9)(PyObject *);
  11098. MDB_cursor *__pyx_t_10;
  11099. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__cur_open __pyx_t_11;
  11100. unsigned char __pyx_t_12;
  11101. Py_ssize_t __pyx_t_13;
  11102. PyObject *__pyx_t_14 = NULL;
  11103. PyObject *__pyx_t_15 = NULL;
  11104. PyObject *__pyx_t_16 = NULL;
  11105. MDB_dbi __pyx_t_17;
  11106. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore_get_dbi __pyx_t_18;
  11107. struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__append __pyx_t_19;
  11108. PyObject *__pyx_t_20 = NULL;
  11109. PyObject *__pyx_t_21 = NULL;
  11110. PyObject *__pyx_t_22 = NULL;
  11111. PyObject *__pyx_t_23 = NULL;
  11112. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store__check __pyx_t_24;
  11113. int __pyx_t_25;
  11114. char const *__pyx_t_26;
  11115. PyObject *__pyx_t_27 = NULL;
  11116. PyObject *__pyx_t_28 = NULL;
  11117. PyObject *__pyx_t_29 = NULL;
  11118. unsigned char *__pyx_t_30;
  11119. __Pyx_RefNannySetupContext("add", 0);
  11120. __Pyx_TraceCall("add", __pyx_f[0], 696, 0, __PYX_ERR(0, 696, __pyx_L1_error));
  11121. if (__pyx_optional_args) {
  11122. if (__pyx_optional_args->__pyx_n > 0) {
  11123. __pyx_v_context = __pyx_optional_args->context;
  11124. if (__pyx_optional_args->__pyx_n > 1) {
  11125. __pyx_v_quoted = __pyx_optional_args->quoted;
  11126. }
  11127. }
  11128. }
  11129. /* Check if called by wrapper */
  11130. if (unlikely(__pyx_skip_dispatch)) ;
  11131. /* Check if overridden in Python */
  11132. else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
  11133. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 696, __pyx_L1_error)
  11134. __Pyx_GOTREF(__pyx_t_1);
  11135. if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_5add)) {
  11136. __Pyx_XDECREF(__pyx_r);
  11137. __Pyx_INCREF(__pyx_t_1);
  11138. __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
  11139. __pyx_t_5 = 0;
  11140. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  11141. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
  11142. if (likely(__pyx_t_4)) {
  11143. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  11144. __Pyx_INCREF(__pyx_t_4);
  11145. __Pyx_INCREF(function);
  11146. __Pyx_DECREF_SET(__pyx_t_3, function);
  11147. __pyx_t_5 = 1;
  11148. }
  11149. }
  11150. #if CYTHON_FAST_PYCALL
  11151. if (PyFunction_Check(__pyx_t_3)) {
  11152. PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_triple, __pyx_v_context, __pyx_v_quoted};
  11153. __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 696, __pyx_L1_error)
  11154. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  11155. __Pyx_GOTREF(__pyx_t_2);
  11156. } else
  11157. #endif
  11158. #if CYTHON_FAST_PYCCALL
  11159. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  11160. PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_triple, __pyx_v_context, __pyx_v_quoted};
  11161. __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 696, __pyx_L1_error)
  11162. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  11163. __Pyx_GOTREF(__pyx_t_2);
  11164. } else
  11165. #endif
  11166. {
  11167. __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 696, __pyx_L1_error)
  11168. __Pyx_GOTREF(__pyx_t_6);
  11169. if (__pyx_t_4) {
  11170. __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
  11171. }
  11172. __Pyx_INCREF(__pyx_v_triple);
  11173. __Pyx_GIVEREF(__pyx_v_triple);
  11174. PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_triple);
  11175. __Pyx_INCREF(__pyx_v_context);
  11176. __Pyx_GIVEREF(__pyx_v_context);
  11177. PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_context);
  11178. __Pyx_INCREF(__pyx_v_quoted);
  11179. __Pyx_GIVEREF(__pyx_v_quoted);
  11180. PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_quoted);
  11181. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 696, __pyx_L1_error)
  11182. __Pyx_GOTREF(__pyx_t_2);
  11183. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11184. }
  11185. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  11186. __pyx_r = __pyx_t_2;
  11187. __pyx_t_2 = 0;
  11188. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11189. goto __pyx_L0;
  11190. }
  11191. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11192. }
  11193. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":718
  11194. * size_t term_size
  11195. *
  11196. * c = self._normalize_context(context) # <<<<<<<<<<<<<<
  11197. * if c is None:
  11198. * c = RDFLIB_DEFAULT_GRAPH_URI
  11199. */
  11200. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_normalize_context); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 718, __pyx_L1_error)
  11201. __Pyx_GOTREF(__pyx_t_2);
  11202. __pyx_t_3 = NULL;
  11203. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
  11204. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  11205. if (likely(__pyx_t_3)) {
  11206. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  11207. __Pyx_INCREF(__pyx_t_3);
  11208. __Pyx_INCREF(function);
  11209. __Pyx_DECREF_SET(__pyx_t_2, function);
  11210. }
  11211. }
  11212. if (!__pyx_t_3) {
  11213. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_context); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 718, __pyx_L1_error)
  11214. __Pyx_GOTREF(__pyx_t_1);
  11215. } else {
  11216. #if CYTHON_FAST_PYCALL
  11217. if (PyFunction_Check(__pyx_t_2)) {
  11218. PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_context};
  11219. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 718, __pyx_L1_error)
  11220. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  11221. __Pyx_GOTREF(__pyx_t_1);
  11222. } else
  11223. #endif
  11224. #if CYTHON_FAST_PYCCALL
  11225. if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
  11226. PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_context};
  11227. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 718, __pyx_L1_error)
  11228. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  11229. __Pyx_GOTREF(__pyx_t_1);
  11230. } else
  11231. #endif
  11232. {
  11233. __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 718, __pyx_L1_error)
  11234. __Pyx_GOTREF(__pyx_t_6);
  11235. __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
  11236. __Pyx_INCREF(__pyx_v_context);
  11237. __Pyx_GIVEREF(__pyx_v_context);
  11238. PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_context);
  11239. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 718, __pyx_L1_error)
  11240. __Pyx_GOTREF(__pyx_t_1);
  11241. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11242. }
  11243. }
  11244. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  11245. __pyx_v_c = __pyx_t_1;
  11246. __pyx_t_1 = 0;
  11247. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":719
  11248. *
  11249. * c = self._normalize_context(context)
  11250. * if c is None: # <<<<<<<<<<<<<<
  11251. * c = RDFLIB_DEFAULT_GRAPH_URI
  11252. *
  11253. */
  11254. __pyx_t_7 = (__pyx_v_c == Py_None);
  11255. __pyx_t_8 = (__pyx_t_7 != 0);
  11256. if (__pyx_t_8) {
  11257. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":720
  11258. * c = self._normalize_context(context)
  11259. * if c is None:
  11260. * c = RDFLIB_DEFAULT_GRAPH_URI # <<<<<<<<<<<<<<
  11261. *
  11262. * # TODO: figure out how the RDFLib dispatcher is inherited
  11263. */
  11264. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_RDFLIB_DEFAULT_GRAPH_URI); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 720, __pyx_L1_error)
  11265. __Pyx_GOTREF(__pyx_t_1);
  11266. __Pyx_DECREF_SET(__pyx_v_c, __pyx_t_1);
  11267. __pyx_t_1 = 0;
  11268. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":719
  11269. *
  11270. * c = self._normalize_context(context)
  11271. * if c is None: # <<<<<<<<<<<<<<
  11272. * c = RDFLIB_DEFAULT_GRAPH_URI
  11273. *
  11274. */
  11275. }
  11276. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":726
  11277. * #Store.add(self, triple, context)
  11278. *
  11279. * s, p, o = triple # <<<<<<<<<<<<<<
  11280. * #logger.debug('Trying to add a triple.')
  11281. * icur = self._cur_open('th:t')
  11282. */
  11283. if ((likely(PyTuple_CheckExact(__pyx_v_triple))) || (PyList_CheckExact(__pyx_v_triple))) {
  11284. PyObject* sequence = __pyx_v_triple;
  11285. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  11286. if (unlikely(size != 3)) {
  11287. if (size > 3) __Pyx_RaiseTooManyValuesError(3);
  11288. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  11289. __PYX_ERR(0, 726, __pyx_L1_error)
  11290. }
  11291. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  11292. if (likely(PyTuple_CheckExact(sequence))) {
  11293. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  11294. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  11295. __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2);
  11296. } else {
  11297. __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
  11298. __pyx_t_2 = PyList_GET_ITEM(sequence, 1);
  11299. __pyx_t_6 = PyList_GET_ITEM(sequence, 2);
  11300. }
  11301. __Pyx_INCREF(__pyx_t_1);
  11302. __Pyx_INCREF(__pyx_t_2);
  11303. __Pyx_INCREF(__pyx_t_6);
  11304. #else
  11305. __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 726, __pyx_L1_error)
  11306. __Pyx_GOTREF(__pyx_t_1);
  11307. __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 726, __pyx_L1_error)
  11308. __Pyx_GOTREF(__pyx_t_2);
  11309. __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 726, __pyx_L1_error)
  11310. __Pyx_GOTREF(__pyx_t_6);
  11311. #endif
  11312. } else {
  11313. Py_ssize_t index = -1;
  11314. __pyx_t_3 = PyObject_GetIter(__pyx_v_triple); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 726, __pyx_L1_error)
  11315. __Pyx_GOTREF(__pyx_t_3);
  11316. __pyx_t_9 = Py_TYPE(__pyx_t_3)->tp_iternext;
  11317. index = 0; __pyx_t_1 = __pyx_t_9(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
  11318. __Pyx_GOTREF(__pyx_t_1);
  11319. index = 1; __pyx_t_2 = __pyx_t_9(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L4_unpacking_failed;
  11320. __Pyx_GOTREF(__pyx_t_2);
  11321. index = 2; __pyx_t_6 = __pyx_t_9(__pyx_t_3); if (unlikely(!__pyx_t_6)) goto __pyx_L4_unpacking_failed;
  11322. __Pyx_GOTREF(__pyx_t_6);
  11323. if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_3), 3) < 0) __PYX_ERR(0, 726, __pyx_L1_error)
  11324. __pyx_t_9 = NULL;
  11325. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  11326. goto __pyx_L5_unpacking_done;
  11327. __pyx_L4_unpacking_failed:;
  11328. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  11329. __pyx_t_9 = NULL;
  11330. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  11331. __PYX_ERR(0, 726, __pyx_L1_error)
  11332. __pyx_L5_unpacking_done:;
  11333. }
  11334. __pyx_v_s = __pyx_t_1;
  11335. __pyx_t_1 = 0;
  11336. __pyx_v_p = __pyx_t_2;
  11337. __pyx_t_2 = 0;
  11338. __pyx_v_o = __pyx_t_6;
  11339. __pyx_t_6 = 0;
  11340. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":728
  11341. * s, p, o = triple
  11342. * #logger.debug('Trying to add a triple.')
  11343. * icur = self._cur_open('th:t') # <<<<<<<<<<<<<<
  11344. * try:
  11345. * for i, term in enumerate((s, p, o, c)):
  11346. */
  11347. __pyx_t_11.__pyx_n = 1;
  11348. __pyx_t_11.dblabel = ((unsigned char *)((char const *)"th:t"));
  11349. __pyx_t_10 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_open(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_11); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 728, __pyx_L1_error)
  11350. __pyx_v_icur = __pyx_t_10;
  11351. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":729
  11352. * #logger.debug('Trying to add a triple.')
  11353. * icur = self._cur_open('th:t')
  11354. * try: # <<<<<<<<<<<<<<
  11355. * for i, term in enumerate((s, p, o, c)):
  11356. * serialize(term, &pk_t, &term_size)
  11357. */
  11358. /*try:*/ {
  11359. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":730
  11360. * icur = self._cur_open('th:t')
  11361. * try:
  11362. * for i, term in enumerate((s, p, o, c)): # <<<<<<<<<<<<<<
  11363. * serialize(term, &pk_t, &term_size)
  11364. * _hash(pk_t, term_size, thash)
  11365. */
  11366. __pyx_t_12 = 0;
  11367. __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 730, __pyx_L7_error)
  11368. __Pyx_GOTREF(__pyx_t_6);
  11369. __Pyx_INCREF(__pyx_v_s);
  11370. __Pyx_GIVEREF(__pyx_v_s);
  11371. PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_s);
  11372. __Pyx_INCREF(__pyx_v_p);
  11373. __Pyx_GIVEREF(__pyx_v_p);
  11374. PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_p);
  11375. __Pyx_INCREF(__pyx_v_o);
  11376. __Pyx_GIVEREF(__pyx_v_o);
  11377. PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_o);
  11378. __Pyx_INCREF(__pyx_v_c);
  11379. __Pyx_GIVEREF(__pyx_v_c);
  11380. PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_v_c);
  11381. __pyx_t_2 = __pyx_t_6; __Pyx_INCREF(__pyx_t_2); __pyx_t_13 = 0;
  11382. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11383. for (;;) {
  11384. if (__pyx_t_13 >= 4) break;
  11385. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  11386. __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_13); __Pyx_INCREF(__pyx_t_6); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 730, __pyx_L7_error)
  11387. #else
  11388. __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 730, __pyx_L7_error)
  11389. __Pyx_GOTREF(__pyx_t_6);
  11390. #endif
  11391. __Pyx_XDECREF_SET(__pyx_v_term, __pyx_t_6);
  11392. __pyx_t_6 = 0;
  11393. __pyx_v_i = __pyx_t_12;
  11394. __pyx_t_12 = (__pyx_t_12 + 1);
  11395. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":731
  11396. * try:
  11397. * for i, term in enumerate((s, p, o, c)):
  11398. * serialize(term, &pk_t, &term_size) # <<<<<<<<<<<<<<
  11399. * _hash(pk_t, term_size, thash)
  11400. * try:
  11401. */
  11402. __pyx_t_5 = __pyx_f_12lakesuperior_5store_6ldp_rs_4term_serialize(__pyx_v_term, (&__pyx_v_pk_t), (&__pyx_v_term_size)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 731, __pyx_L7_error)
  11403. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":732
  11404. * for i, term in enumerate((s, p, o, c)):
  11405. * serialize(term, &pk_t, &term_size)
  11406. * _hash(pk_t, term_size, thash) # <<<<<<<<<<<<<<
  11407. * try:
  11408. * key_v.mv_data = &thash
  11409. */
  11410. __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore__hash(__pyx_v_pk_t, __pyx_v_term_size, __pyx_v_thash);
  11411. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":733
  11412. * serialize(term, &pk_t, &term_size)
  11413. * _hash(pk_t, term_size, thash)
  11414. * try: # <<<<<<<<<<<<<<
  11415. * key_v.mv_data = &thash
  11416. * key_v.mv_size = HLEN
  11417. */
  11418. {
  11419. __Pyx_PyThreadState_declare
  11420. __Pyx_PyThreadState_assign
  11421. __Pyx_ExceptionSave(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
  11422. __Pyx_XGOTREF(__pyx_t_14);
  11423. __Pyx_XGOTREF(__pyx_t_15);
  11424. __Pyx_XGOTREF(__pyx_t_16);
  11425. /*try:*/ {
  11426. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":734
  11427. * _hash(pk_t, term_size, thash)
  11428. * try:
  11429. * key_v.mv_data = &thash # <<<<<<<<<<<<<<
  11430. * key_v.mv_size = HLEN
  11431. * _check(lmdb.mdb_get(
  11432. */
  11433. __pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v.mv_data = (&__pyx_v_thash);
  11434. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":735
  11435. * try:
  11436. * key_v.mv_data = &thash
  11437. * key_v.mv_size = HLEN # <<<<<<<<<<<<<<
  11438. * _check(lmdb.mdb_get(
  11439. * self.txn, self.get_dbi('th:t'), &key_v, &data_v))
  11440. */
  11441. __pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v.mv_size = 20;
  11442. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":737
  11443. * key_v.mv_size = HLEN
  11444. * _check(lmdb.mdb_get(
  11445. * self.txn, self.get_dbi('th:t'), &key_v, &data_v)) # <<<<<<<<<<<<<<
  11446. * memcpy(spock + (i * KLEN), data_v.mv_data, KLEN)
  11447. * #logger.debug('Hash {} found. Not adding.'.format(thash[: HLEN]))
  11448. */
  11449. __pyx_t_18.__pyx_n = 1;
  11450. __pyx_t_18.dblabel = ((unsigned char *)((char const *)"th:t"));
  11451. __pyx_t_17 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_dbi(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_18);
  11452. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":736
  11453. * key_v.mv_data = &thash
  11454. * key_v.mv_size = HLEN
  11455. * _check(lmdb.mdb_get( # <<<<<<<<<<<<<<
  11456. * self.txn, self.get_dbi('th:t'), &key_v, &data_v))
  11457. * memcpy(spock + (i * KLEN), data_v.mv_data, KLEN)
  11458. */
  11459. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_get(__pyx_v_self->__pyx_base.txn, __pyx_t_17, (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v), (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v)), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 736, __pyx_L11_error)
  11460. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":738
  11461. * _check(lmdb.mdb_get(
  11462. * self.txn, self.get_dbi('th:t'), &key_v, &data_v))
  11463. * memcpy(spock + (i * KLEN), data_v.mv_data, KLEN) # <<<<<<<<<<<<<<
  11464. * #logger.debug('Hash {} found. Not adding.'.format(thash[: HLEN]))
  11465. * except KeyNotFoundError:
  11466. */
  11467. (void)(memcpy((__pyx_v_spock + (__pyx_v_i * 5)), __pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v.mv_data, 5));
  11468. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":733
  11469. * serialize(term, &pk_t, &term_size)
  11470. * _hash(pk_t, term_size, thash)
  11471. * try: # <<<<<<<<<<<<<<
  11472. * key_v.mv_data = &thash
  11473. * key_v.mv_size = HLEN
  11474. */
  11475. }
  11476. __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
  11477. __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
  11478. __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
  11479. goto __pyx_L18_try_end;
  11480. __pyx_L11_error:;
  11481. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  11482. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  11483. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  11484. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  11485. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":740
  11486. * memcpy(spock + (i * KLEN), data_v.mv_data, KLEN)
  11487. * #logger.debug('Hash {} found. Not adding.'.format(thash[: HLEN]))
  11488. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  11489. * # If term is not found, add it...
  11490. * #logger.debug('Hash {} not found. Adding to DB.'.format(
  11491. */
  11492. __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_1, &__pyx_t_3);
  11493. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 740, __pyx_L13_except_error)
  11494. __Pyx_GOTREF(__pyx_t_4);
  11495. __pyx_t_5 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_6, __pyx_t_4);
  11496. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  11497. __Pyx_ErrRestore(__pyx_t_6, __pyx_t_1, __pyx_t_3);
  11498. __pyx_t_6 = 0; __pyx_t_1 = 0; __pyx_t_3 = 0;
  11499. if (__pyx_t_5) {
  11500. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11501. if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_6) < 0) __PYX_ERR(0, 740, __pyx_L13_except_error)
  11502. __Pyx_GOTREF(__pyx_t_3);
  11503. __Pyx_GOTREF(__pyx_t_1);
  11504. __Pyx_GOTREF(__pyx_t_6);
  11505. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":744
  11506. * #logger.debug('Hash {} not found. Adding to DB.'.format(
  11507. * # thash[: HLEN]))
  11508. * self._append(pk_t, term_size, &nkey, dblabel=b't:st') # <<<<<<<<<<<<<<
  11509. * free(pk_t)
  11510. * memcpy(spock + (i * KLEN), nkey, KLEN)
  11511. */
  11512. __pyx_t_19.__pyx_n = 1;
  11513. __pyx_t_19.dblabel = ((unsigned char *)((char const *)"t:st"));
  11514. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->_append(__pyx_v_self, __pyx_v_pk_t, __pyx_v_term_size, (&__pyx_v_nkey), &__pyx_t_19); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 744, __pyx_L13_except_error)
  11515. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":745
  11516. * # thash[: HLEN]))
  11517. * self._append(pk_t, term_size, &nkey, dblabel=b't:st')
  11518. * free(pk_t) # <<<<<<<<<<<<<<
  11519. * memcpy(spock + (i * KLEN), nkey, KLEN)
  11520. *
  11521. */
  11522. free(__pyx_v_pk_t);
  11523. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":746
  11524. * self._append(pk_t, term_size, &nkey, dblabel=b't:st')
  11525. * free(pk_t)
  11526. * memcpy(spock + (i * KLEN), nkey, KLEN) # <<<<<<<<<<<<<<
  11527. *
  11528. * # ...and index it.
  11529. */
  11530. (void)(memcpy((__pyx_v_spock + (__pyx_v_i * 5)), __pyx_v_nkey, 5));
  11531. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":751
  11532. * #logger.debug('Indexing on th:t: {}: {}'.format(
  11533. * # thash[: HLEN], nkey[: KLEN]))
  11534. * key_v.mv_data = thash # <<<<<<<<<<<<<<
  11535. * key_v.mv_size = HLEN
  11536. * data_v.mv_data = nkey
  11537. */
  11538. __pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v.mv_data = __pyx_v_thash;
  11539. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":752
  11540. * # thash[: HLEN], nkey[: KLEN]))
  11541. * key_v.mv_data = thash
  11542. * key_v.mv_size = HLEN # <<<<<<<<<<<<<<
  11543. * data_v.mv_data = nkey
  11544. * data_v.mv_size = KLEN
  11545. */
  11546. __pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v.mv_size = 20;
  11547. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":753
  11548. * key_v.mv_data = thash
  11549. * key_v.mv_size = HLEN
  11550. * data_v.mv_data = nkey # <<<<<<<<<<<<<<
  11551. * data_v.mv_size = KLEN
  11552. * _check(
  11553. */
  11554. __pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v.mv_data = __pyx_v_nkey;
  11555. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":754
  11556. * key_v.mv_size = HLEN
  11557. * data_v.mv_data = nkey
  11558. * data_v.mv_size = KLEN # <<<<<<<<<<<<<<
  11559. * _check(
  11560. * lmdb.mdb_cursor_put(icur, &key_v, &data_v, 0),
  11561. */
  11562. __pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v.mv_size = 5;
  11563. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":757
  11564. * _check(
  11565. * lmdb.mdb_cursor_put(icur, &key_v, &data_v, 0),
  11566. * 'Error setting key {}.'.format(thash)) # <<<<<<<<<<<<<<
  11567. * finally:
  11568. * #pass
  11569. */
  11570. __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Error_setting_key, __pyx_n_s_format); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 757, __pyx_L13_except_error)
  11571. __Pyx_GOTREF(__pyx_t_20);
  11572. __pyx_t_21 = __Pyx_PyObject_FromCString(__pyx_v_thash); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 757, __pyx_L13_except_error)
  11573. __Pyx_GOTREF(__pyx_t_21);
  11574. __pyx_t_22 = NULL;
  11575. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_20))) {
  11576. __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_20);
  11577. if (likely(__pyx_t_22)) {
  11578. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
  11579. __Pyx_INCREF(__pyx_t_22);
  11580. __Pyx_INCREF(function);
  11581. __Pyx_DECREF_SET(__pyx_t_20, function);
  11582. }
  11583. }
  11584. if (!__pyx_t_22) {
  11585. __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_20, __pyx_t_21); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 757, __pyx_L13_except_error)
  11586. __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  11587. __Pyx_GOTREF(__pyx_t_4);
  11588. } else {
  11589. #if CYTHON_FAST_PYCALL
  11590. if (PyFunction_Check(__pyx_t_20)) {
  11591. PyObject *__pyx_temp[2] = {__pyx_t_22, __pyx_t_21};
  11592. __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_20, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 757, __pyx_L13_except_error)
  11593. __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
  11594. __Pyx_GOTREF(__pyx_t_4);
  11595. __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  11596. } else
  11597. #endif
  11598. #if CYTHON_FAST_PYCCALL
  11599. if (__Pyx_PyFastCFunction_Check(__pyx_t_20)) {
  11600. PyObject *__pyx_temp[2] = {__pyx_t_22, __pyx_t_21};
  11601. __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_20, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 757, __pyx_L13_except_error)
  11602. __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
  11603. __Pyx_GOTREF(__pyx_t_4);
  11604. __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  11605. } else
  11606. #endif
  11607. {
  11608. __pyx_t_23 = PyTuple_New(1+1); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 757, __pyx_L13_except_error)
  11609. __Pyx_GOTREF(__pyx_t_23);
  11610. __Pyx_GIVEREF(__pyx_t_22); PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_22); __pyx_t_22 = NULL;
  11611. __Pyx_GIVEREF(__pyx_t_21);
  11612. PyTuple_SET_ITEM(__pyx_t_23, 0+1, __pyx_t_21);
  11613. __pyx_t_21 = 0;
  11614. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_t_23, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 757, __pyx_L13_except_error)
  11615. __Pyx_GOTREF(__pyx_t_4);
  11616. __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
  11617. }
  11618. }
  11619. __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  11620. if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 757, __pyx_L13_except_error)
  11621. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":755
  11622. * data_v.mv_data = nkey
  11623. * data_v.mv_size = KLEN
  11624. * _check( # <<<<<<<<<<<<<<
  11625. * lmdb.mdb_cursor_put(icur, &key_v, &data_v, 0),
  11626. * 'Error setting key {}.'.format(thash))
  11627. */
  11628. __pyx_t_24.__pyx_n = 1;
  11629. __pyx_t_24.message = ((PyObject*)__pyx_t_4);
  11630. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_put(__pyx_v_icur, (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v), (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v), 0), &__pyx_t_24); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 755, __pyx_L13_except_error)
  11631. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  11632. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  11633. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11634. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  11635. goto __pyx_L12_exception_handled;
  11636. }
  11637. goto __pyx_L13_except_error;
  11638. __pyx_L13_except_error:;
  11639. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":733
  11640. * serialize(term, &pk_t, &term_size)
  11641. * _hash(pk_t, term_size, thash)
  11642. * try: # <<<<<<<<<<<<<<
  11643. * key_v.mv_data = &thash
  11644. * key_v.mv_size = HLEN
  11645. */
  11646. __Pyx_XGIVEREF(__pyx_t_14);
  11647. __Pyx_XGIVEREF(__pyx_t_15);
  11648. __Pyx_XGIVEREF(__pyx_t_16);
  11649. __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
  11650. goto __pyx_L7_error;
  11651. __pyx_L12_exception_handled:;
  11652. __Pyx_XGIVEREF(__pyx_t_14);
  11653. __Pyx_XGIVEREF(__pyx_t_15);
  11654. __Pyx_XGIVEREF(__pyx_t_16);
  11655. __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
  11656. __pyx_L18_try_end:;
  11657. }
  11658. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":730
  11659. * icur = self._cur_open('th:t')
  11660. * try:
  11661. * for i, term in enumerate((s, p, o, c)): # <<<<<<<<<<<<<<
  11662. * serialize(term, &pk_t, &term_size)
  11663. * _hash(pk_t, term_size, thash)
  11664. */
  11665. }
  11666. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  11667. }
  11668. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":760
  11669. * finally:
  11670. * #pass
  11671. * self._cur_close(icur) # <<<<<<<<<<<<<<
  11672. * #logger.debug('Triple add action completed.')
  11673. *
  11674. */
  11675. /*finally:*/ {
  11676. /*normal exit:*/{
  11677. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_icur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 760, __pyx_L1_error)
  11678. goto __pyx_L8;
  11679. }
  11680. __pyx_L7_error:;
  11681. /*exception exit:*/{
  11682. __Pyx_PyThreadState_declare
  11683. __Pyx_PyThreadState_assign
  11684. __pyx_t_16 = 0; __pyx_t_15 = 0; __pyx_t_14 = 0; __pyx_t_27 = 0; __pyx_t_28 = 0; __pyx_t_29 = 0;
  11685. __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
  11686. __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
  11687. __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
  11688. __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
  11689. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  11690. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  11691. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  11692. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  11693. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  11694. if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_27, &__pyx_t_28, &__pyx_t_29);
  11695. if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_16, &__pyx_t_15, &__pyx_t_14) < 0)) __Pyx_ErrFetch(&__pyx_t_16, &__pyx_t_15, &__pyx_t_14);
  11696. __Pyx_XGOTREF(__pyx_t_16);
  11697. __Pyx_XGOTREF(__pyx_t_15);
  11698. __Pyx_XGOTREF(__pyx_t_14);
  11699. __Pyx_XGOTREF(__pyx_t_27);
  11700. __Pyx_XGOTREF(__pyx_t_28);
  11701. __Pyx_XGOTREF(__pyx_t_29);
  11702. __pyx_t_5 = __pyx_lineno; __pyx_t_25 = __pyx_clineno; __pyx_t_26 = __pyx_filename;
  11703. {
  11704. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_icur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 760, __pyx_L22_error)
  11705. }
  11706. if (PY_MAJOR_VERSION >= 3) {
  11707. __Pyx_XGIVEREF(__pyx_t_27);
  11708. __Pyx_XGIVEREF(__pyx_t_28);
  11709. __Pyx_XGIVEREF(__pyx_t_29);
  11710. __Pyx_ExceptionReset(__pyx_t_27, __pyx_t_28, __pyx_t_29);
  11711. }
  11712. __Pyx_XGIVEREF(__pyx_t_16);
  11713. __Pyx_XGIVEREF(__pyx_t_15);
  11714. __Pyx_XGIVEREF(__pyx_t_14);
  11715. __Pyx_ErrRestore(__pyx_t_16, __pyx_t_15, __pyx_t_14);
  11716. __pyx_t_16 = 0; __pyx_t_15 = 0; __pyx_t_14 = 0; __pyx_t_27 = 0; __pyx_t_28 = 0; __pyx_t_29 = 0;
  11717. __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_25; __pyx_filename = __pyx_t_26;
  11718. goto __pyx_L1_error;
  11719. __pyx_L22_error:;
  11720. if (PY_MAJOR_VERSION >= 3) {
  11721. __Pyx_XGIVEREF(__pyx_t_27);
  11722. __Pyx_XGIVEREF(__pyx_t_28);
  11723. __Pyx_XGIVEREF(__pyx_t_29);
  11724. __Pyx_ExceptionReset(__pyx_t_27, __pyx_t_28, __pyx_t_29);
  11725. }
  11726. __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
  11727. __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
  11728. __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
  11729. __pyx_t_27 = 0; __pyx_t_28 = 0; __pyx_t_29 = 0;
  11730. goto __pyx_L1_error;
  11731. }
  11732. __pyx_L8:;
  11733. }
  11734. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":763
  11735. * #logger.debug('Triple add action completed.')
  11736. *
  11737. * spo_v.mv_data = spock # <<<<<<<<<<<<<<
  11738. * spo_v.mv_size = TRP_KLEN
  11739. * c_v.mv_data = spock + TRP_KLEN
  11740. */
  11741. __pyx_v_spo_v.mv_data = __pyx_v_spock;
  11742. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":764
  11743. *
  11744. * spo_v.mv_data = spock
  11745. * spo_v.mv_size = TRP_KLEN # <<<<<<<<<<<<<<
  11746. * c_v.mv_data = spock + TRP_KLEN
  11747. * c_v.mv_size = KLEN
  11748. */
  11749. __pyx_v_spo_v.mv_size = 15;
  11750. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":765
  11751. * spo_v.mv_data = spock
  11752. * spo_v.mv_size = TRP_KLEN
  11753. * c_v.mv_data = spock + TRP_KLEN # <<<<<<<<<<<<<<
  11754. * c_v.mv_size = KLEN
  11755. * null_v.mv_data = b''
  11756. */
  11757. __pyx_v_c_v.mv_data = (__pyx_v_spock + 15);
  11758. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":766
  11759. * spo_v.mv_size = TRP_KLEN
  11760. * c_v.mv_data = spock + TRP_KLEN
  11761. * c_v.mv_size = KLEN # <<<<<<<<<<<<<<
  11762. * null_v.mv_data = b''
  11763. * null_v.mv_size = 0
  11764. */
  11765. __pyx_v_c_v.mv_size = 5;
  11766. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":767
  11767. * c_v.mv_data = spock + TRP_KLEN
  11768. * c_v.mv_size = KLEN
  11769. * null_v.mv_data = b'' # <<<<<<<<<<<<<<
  11770. * null_v.mv_size = 0
  11771. *
  11772. */
  11773. __pyx_v_null_v.mv_data = ((char *)"");
  11774. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":768
  11775. * c_v.mv_size = KLEN
  11776. * null_v.mv_data = b''
  11777. * null_v.mv_size = 0 # <<<<<<<<<<<<<<
  11778. *
  11779. * #logger.debug('Adding context.')
  11780. */
  11781. __pyx_v_null_v.mv_size = 0;
  11782. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":771
  11783. *
  11784. * #logger.debug('Adding context.')
  11785. * try: # <<<<<<<<<<<<<<
  11786. * _check(lmdb.mdb_put(
  11787. * self.txn, self.get_dbi('c:'), &c_v, &null_v,
  11788. */
  11789. {
  11790. __Pyx_PyThreadState_declare
  11791. __Pyx_PyThreadState_assign
  11792. __Pyx_ExceptionSave(&__pyx_t_29, &__pyx_t_28, &__pyx_t_27);
  11793. __Pyx_XGOTREF(__pyx_t_29);
  11794. __Pyx_XGOTREF(__pyx_t_28);
  11795. __Pyx_XGOTREF(__pyx_t_27);
  11796. /*try:*/ {
  11797. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":773
  11798. * try:
  11799. * _check(lmdb.mdb_put(
  11800. * self.txn, self.get_dbi('c:'), &c_v, &null_v, # <<<<<<<<<<<<<<
  11801. * lmdb.MDB_NOOVERWRITE))
  11802. * except KeyExistsError:
  11803. */
  11804. __pyx_t_18.__pyx_n = 1;
  11805. __pyx_t_18.dblabel = ((unsigned char *)((char const *)"c:"));
  11806. __pyx_t_17 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_dbi(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_18);
  11807. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":772
  11808. * #logger.debug('Adding context.')
  11809. * try:
  11810. * _check(lmdb.mdb_put( # <<<<<<<<<<<<<<
  11811. * self.txn, self.get_dbi('c:'), &c_v, &null_v,
  11812. * lmdb.MDB_NOOVERWRITE))
  11813. */
  11814. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_put(__pyx_v_self->__pyx_base.txn, __pyx_t_17, (&__pyx_v_c_v), (&__pyx_v_null_v), MDB_NOOVERWRITE), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L23_error)
  11815. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":771
  11816. *
  11817. * #logger.debug('Adding context.')
  11818. * try: # <<<<<<<<<<<<<<
  11819. * _check(lmdb.mdb_put(
  11820. * self.txn, self.get_dbi('c:'), &c_v, &null_v,
  11821. */
  11822. }
  11823. __Pyx_XDECREF(__pyx_t_29); __pyx_t_29 = 0;
  11824. __Pyx_XDECREF(__pyx_t_28); __pyx_t_28 = 0;
  11825. __Pyx_XDECREF(__pyx_t_27); __pyx_t_27 = 0;
  11826. goto __pyx_L28_try_end;
  11827. __pyx_L23_error:;
  11828. __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
  11829. __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
  11830. __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
  11831. __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
  11832. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  11833. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  11834. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  11835. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  11836. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  11837. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":775
  11838. * self.txn, self.get_dbi('c:'), &c_v, &null_v,
  11839. * lmdb.MDB_NOOVERWRITE))
  11840. * except KeyExistsError: # <<<<<<<<<<<<<<
  11841. * pass
  11842. * #logger.debug('Added c:.')
  11843. */
  11844. __Pyx_ErrFetch(&__pyx_t_2, &__pyx_t_6, &__pyx_t_1);
  11845. __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyExistsError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 775, __pyx_L25_except_error)
  11846. __Pyx_GOTREF(__pyx_t_3);
  11847. __pyx_t_25 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_2, __pyx_t_3);
  11848. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  11849. __Pyx_ErrRestore(__pyx_t_2, __pyx_t_6, __pyx_t_1);
  11850. __pyx_t_2 = 0; __pyx_t_6 = 0; __pyx_t_1 = 0;
  11851. if (__pyx_t_25) {
  11852. __Pyx_ErrRestore(0,0,0);
  11853. goto __pyx_L24_exception_handled;
  11854. }
  11855. goto __pyx_L25_except_error;
  11856. __pyx_L25_except_error:;
  11857. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":771
  11858. *
  11859. * #logger.debug('Adding context.')
  11860. * try: # <<<<<<<<<<<<<<
  11861. * _check(lmdb.mdb_put(
  11862. * self.txn, self.get_dbi('c:'), &c_v, &null_v,
  11863. */
  11864. __Pyx_XGIVEREF(__pyx_t_29);
  11865. __Pyx_XGIVEREF(__pyx_t_28);
  11866. __Pyx_XGIVEREF(__pyx_t_27);
  11867. __Pyx_ExceptionReset(__pyx_t_29, __pyx_t_28, __pyx_t_27);
  11868. goto __pyx_L1_error;
  11869. __pyx_L24_exception_handled:;
  11870. __Pyx_XGIVEREF(__pyx_t_29);
  11871. __Pyx_XGIVEREF(__pyx_t_28);
  11872. __Pyx_XGIVEREF(__pyx_t_27);
  11873. __Pyx_ExceptionReset(__pyx_t_29, __pyx_t_28, __pyx_t_27);
  11874. __pyx_L28_try_end:;
  11875. }
  11876. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":778
  11877. * pass
  11878. * #logger.debug('Added c:.')
  11879. * try: # <<<<<<<<<<<<<<
  11880. * # Add triple:context association.
  11881. * _check(lmdb.mdb_put(
  11882. */
  11883. {
  11884. __Pyx_PyThreadState_declare
  11885. __Pyx_PyThreadState_assign
  11886. __Pyx_ExceptionSave(&__pyx_t_27, &__pyx_t_28, &__pyx_t_29);
  11887. __Pyx_XGOTREF(__pyx_t_27);
  11888. __Pyx_XGOTREF(__pyx_t_28);
  11889. __Pyx_XGOTREF(__pyx_t_29);
  11890. /*try:*/ {
  11891. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":781
  11892. * # Add triple:context association.
  11893. * _check(lmdb.mdb_put(
  11894. * self.txn, self.get_dbi('spo:c'), &spo_v, &c_v, # <<<<<<<<<<<<<<
  11895. * lmdb.MDB_NODUPDATA))
  11896. * except KeyExistsError:
  11897. */
  11898. __pyx_t_18.__pyx_n = 1;
  11899. __pyx_t_18.dblabel = ((unsigned char *)((char const *)"spo:c"));
  11900. __pyx_t_17 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_dbi(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_18);
  11901. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":780
  11902. * try:
  11903. * # Add triple:context association.
  11904. * _check(lmdb.mdb_put( # <<<<<<<<<<<<<<
  11905. * self.txn, self.get_dbi('spo:c'), &spo_v, &c_v,
  11906. * lmdb.MDB_NODUPDATA))
  11907. */
  11908. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_put(__pyx_v_self->__pyx_base.txn, __pyx_t_17, (&__pyx_v_spo_v), (&__pyx_v_c_v), MDB_NODUPDATA), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L29_error)
  11909. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":778
  11910. * pass
  11911. * #logger.debug('Added c:.')
  11912. * try: # <<<<<<<<<<<<<<
  11913. * # Add triple:context association.
  11914. * _check(lmdb.mdb_put(
  11915. */
  11916. }
  11917. __Pyx_XDECREF(__pyx_t_27); __pyx_t_27 = 0;
  11918. __Pyx_XDECREF(__pyx_t_28); __pyx_t_28 = 0;
  11919. __Pyx_XDECREF(__pyx_t_29); __pyx_t_29 = 0;
  11920. goto __pyx_L34_try_end;
  11921. __pyx_L29_error:;
  11922. __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
  11923. __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
  11924. __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
  11925. __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
  11926. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  11927. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  11928. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  11929. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  11930. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  11931. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":783
  11932. * self.txn, self.get_dbi('spo:c'), &spo_v, &c_v,
  11933. * lmdb.MDB_NODUPDATA))
  11934. * except KeyExistsError: # <<<<<<<<<<<<<<
  11935. * pass
  11936. * #logger.debug('Added spo:c.')
  11937. */
  11938. __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_6, &__pyx_t_2);
  11939. __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyExistsError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 783, __pyx_L31_except_error)
  11940. __Pyx_GOTREF(__pyx_t_3);
  11941. __pyx_t_25 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_3);
  11942. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  11943. __Pyx_ErrRestore(__pyx_t_1, __pyx_t_6, __pyx_t_2);
  11944. __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_2 = 0;
  11945. if (__pyx_t_25) {
  11946. __Pyx_ErrRestore(0,0,0);
  11947. goto __pyx_L30_exception_handled;
  11948. }
  11949. goto __pyx_L31_except_error;
  11950. __pyx_L31_except_error:;
  11951. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":778
  11952. * pass
  11953. * #logger.debug('Added c:.')
  11954. * try: # <<<<<<<<<<<<<<
  11955. * # Add triple:context association.
  11956. * _check(lmdb.mdb_put(
  11957. */
  11958. __Pyx_XGIVEREF(__pyx_t_27);
  11959. __Pyx_XGIVEREF(__pyx_t_28);
  11960. __Pyx_XGIVEREF(__pyx_t_29);
  11961. __Pyx_ExceptionReset(__pyx_t_27, __pyx_t_28, __pyx_t_29);
  11962. goto __pyx_L1_error;
  11963. __pyx_L30_exception_handled:;
  11964. __Pyx_XGIVEREF(__pyx_t_27);
  11965. __Pyx_XGIVEREF(__pyx_t_28);
  11966. __Pyx_XGIVEREF(__pyx_t_29);
  11967. __Pyx_ExceptionReset(__pyx_t_27, __pyx_t_28, __pyx_t_29);
  11968. __pyx_L34_try_end:;
  11969. }
  11970. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":786
  11971. * pass
  11972. * #logger.debug('Added spo:c.')
  11973. * try: # <<<<<<<<<<<<<<
  11974. * # Index context:triple association.
  11975. * _check(lmdb.mdb_put(
  11976. */
  11977. {
  11978. __Pyx_PyThreadState_declare
  11979. __Pyx_PyThreadState_assign
  11980. __Pyx_ExceptionSave(&__pyx_t_29, &__pyx_t_28, &__pyx_t_27);
  11981. __Pyx_XGOTREF(__pyx_t_29);
  11982. __Pyx_XGOTREF(__pyx_t_28);
  11983. __Pyx_XGOTREF(__pyx_t_27);
  11984. /*try:*/ {
  11985. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":789
  11986. * # Index context:triple association.
  11987. * _check(lmdb.mdb_put(
  11988. * self.txn, self.get_dbi('c:spo'), &c_v, &spo_v, # <<<<<<<<<<<<<<
  11989. * lmdb.MDB_NODUPDATA))
  11990. * except KeyExistsError:
  11991. */
  11992. __pyx_t_18.__pyx_n = 1;
  11993. __pyx_t_18.dblabel = ((unsigned char *)((char const *)"c:spo"));
  11994. __pyx_t_17 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_dbi(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_18);
  11995. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":788
  11996. * try:
  11997. * # Index context:triple association.
  11998. * _check(lmdb.mdb_put( # <<<<<<<<<<<<<<
  11999. * self.txn, self.get_dbi('c:spo'), &c_v, &spo_v,
  12000. * lmdb.MDB_NODUPDATA))
  12001. */
  12002. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_put(__pyx_v_self->__pyx_base.txn, __pyx_t_17, (&__pyx_v_c_v), (&__pyx_v_spo_v), MDB_NODUPDATA), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 788, __pyx_L35_error)
  12003. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":786
  12004. * pass
  12005. * #logger.debug('Added spo:c.')
  12006. * try: # <<<<<<<<<<<<<<
  12007. * # Index context:triple association.
  12008. * _check(lmdb.mdb_put(
  12009. */
  12010. }
  12011. __Pyx_XDECREF(__pyx_t_29); __pyx_t_29 = 0;
  12012. __Pyx_XDECREF(__pyx_t_28); __pyx_t_28 = 0;
  12013. __Pyx_XDECREF(__pyx_t_27); __pyx_t_27 = 0;
  12014. goto __pyx_L40_try_end;
  12015. __pyx_L35_error:;
  12016. __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
  12017. __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
  12018. __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
  12019. __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
  12020. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  12021. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  12022. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  12023. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  12024. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  12025. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":791
  12026. * self.txn, self.get_dbi('c:spo'), &c_v, &spo_v,
  12027. * lmdb.MDB_NODUPDATA))
  12028. * except KeyExistsError: # <<<<<<<<<<<<<<
  12029. * pass
  12030. * #logger.debug('Added c:spo.')
  12031. */
  12032. __Pyx_ErrFetch(&__pyx_t_2, &__pyx_t_6, &__pyx_t_1);
  12033. __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyExistsError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 791, __pyx_L37_except_error)
  12034. __Pyx_GOTREF(__pyx_t_3);
  12035. __pyx_t_25 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_2, __pyx_t_3);
  12036. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  12037. __Pyx_ErrRestore(__pyx_t_2, __pyx_t_6, __pyx_t_1);
  12038. __pyx_t_2 = 0; __pyx_t_6 = 0; __pyx_t_1 = 0;
  12039. if (__pyx_t_25) {
  12040. __Pyx_ErrRestore(0,0,0);
  12041. goto __pyx_L36_exception_handled;
  12042. }
  12043. goto __pyx_L37_except_error;
  12044. __pyx_L37_except_error:;
  12045. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":786
  12046. * pass
  12047. * #logger.debug('Added spo:c.')
  12048. * try: # <<<<<<<<<<<<<<
  12049. * # Index context:triple association.
  12050. * _check(lmdb.mdb_put(
  12051. */
  12052. __Pyx_XGIVEREF(__pyx_t_29);
  12053. __Pyx_XGIVEREF(__pyx_t_28);
  12054. __Pyx_XGIVEREF(__pyx_t_27);
  12055. __Pyx_ExceptionReset(__pyx_t_29, __pyx_t_28, __pyx_t_27);
  12056. goto __pyx_L1_error;
  12057. __pyx_L36_exception_handled:;
  12058. __Pyx_XGIVEREF(__pyx_t_29);
  12059. __Pyx_XGIVEREF(__pyx_t_28);
  12060. __Pyx_XGIVEREF(__pyx_t_27);
  12061. __Pyx_ExceptionReset(__pyx_t_29, __pyx_t_28, __pyx_t_27);
  12062. __pyx_L40_try_end:;
  12063. }
  12064. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":796
  12065. *
  12066. * #logger.debug('All main data entered. Indexing.')
  12067. * self._index_triple(IDX_OP_ADD, spock[: TRP_KLEN]) # <<<<<<<<<<<<<<
  12068. *
  12069. *
  12070. */
  12071. __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_spock) + 0, 15 - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 796, __pyx_L1_error)
  12072. __Pyx_GOTREF(__pyx_t_1);
  12073. __pyx_t_30 = __Pyx_PyBytes_AsWritableUString(__pyx_t_1); if (unlikely((!__pyx_t_30) && PyErr_Occurred())) __PYX_ERR(0, 796, __pyx_L1_error)
  12074. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->_index_triple(__pyx_v_self, __pyx_n_u_idx_add, __pyx_t_30); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 796, __pyx_L1_error)
  12075. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12076. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":696
  12077. * # Triple and graph methods.
  12078. *
  12079. * cpdef add(self, triple, context=None, quoted=False): # <<<<<<<<<<<<<<
  12080. * """
  12081. * Add a triple and start indexing.
  12082. */
  12083. /* function exit code */
  12084. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  12085. goto __pyx_L0;
  12086. __pyx_L1_error:;
  12087. __Pyx_XDECREF(__pyx_t_1);
  12088. __Pyx_XDECREF(__pyx_t_2);
  12089. __Pyx_XDECREF(__pyx_t_3);
  12090. __Pyx_XDECREF(__pyx_t_4);
  12091. __Pyx_XDECREF(__pyx_t_6);
  12092. __Pyx_XDECREF(__pyx_t_20);
  12093. __Pyx_XDECREF(__pyx_t_21);
  12094. __Pyx_XDECREF(__pyx_t_22);
  12095. __Pyx_XDECREF(__pyx_t_23);
  12096. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12097. __pyx_r = 0;
  12098. __pyx_L0:;
  12099. __Pyx_XDECREF(__pyx_v_c);
  12100. __Pyx_XDECREF(__pyx_v_s);
  12101. __Pyx_XDECREF(__pyx_v_p);
  12102. __Pyx_XDECREF(__pyx_v_o);
  12103. __Pyx_XDECREF(__pyx_v_term);
  12104. __Pyx_XGIVEREF(__pyx_r);
  12105. __Pyx_TraceReturn(__pyx_r, 0);
  12106. __Pyx_RefNannyFinishContext();
  12107. return __pyx_r;
  12108. }
  12109. /* Python wrapper */
  12110. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_5add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  12111. static char __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_4add[] = "\n Add a triple and start indexing.\n\n :param tuple(rdflib.Identifier) triple: Tuple of three identifiers.\n :param context: Context identifier. ``None`` inserts in the default\n graph.\n :type context: rdflib.Identifier or None\n :param bool quoted: Not used.\n ";
  12112. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_5add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  12113. PyObject *__pyx_v_triple = 0;
  12114. PyObject *__pyx_v_context = 0;
  12115. PyObject *__pyx_v_quoted = 0;
  12116. PyObject *__pyx_r = 0;
  12117. __Pyx_RefNannyDeclarations
  12118. __Pyx_RefNannySetupContext("add (wrapper)", 0);
  12119. {
  12120. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_triple,&__pyx_n_s_context,&__pyx_n_s_quoted,0};
  12121. PyObject* values[3] = {0,0,0};
  12122. values[1] = ((PyObject *)Py_None);
  12123. values[2] = ((PyObject *)Py_False);
  12124. if (unlikely(__pyx_kwds)) {
  12125. Py_ssize_t kw_args;
  12126. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  12127. switch (pos_args) {
  12128. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  12129. CYTHON_FALLTHROUGH;
  12130. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  12131. CYTHON_FALLTHROUGH;
  12132. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  12133. CYTHON_FALLTHROUGH;
  12134. case 0: break;
  12135. default: goto __pyx_L5_argtuple_error;
  12136. }
  12137. kw_args = PyDict_Size(__pyx_kwds);
  12138. switch (pos_args) {
  12139. case 0:
  12140. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_triple)) != 0)) kw_args--;
  12141. else goto __pyx_L5_argtuple_error;
  12142. CYTHON_FALLTHROUGH;
  12143. case 1:
  12144. if (kw_args > 0) {
  12145. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_context);
  12146. if (value) { values[1] = value; kw_args--; }
  12147. }
  12148. CYTHON_FALLTHROUGH;
  12149. case 2:
  12150. if (kw_args > 0) {
  12151. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quoted);
  12152. if (value) { values[2] = value; kw_args--; }
  12153. }
  12154. }
  12155. if (unlikely(kw_args > 0)) {
  12156. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add") < 0)) __PYX_ERR(0, 696, __pyx_L3_error)
  12157. }
  12158. } else {
  12159. switch (PyTuple_GET_SIZE(__pyx_args)) {
  12160. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  12161. CYTHON_FALLTHROUGH;
  12162. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  12163. CYTHON_FALLTHROUGH;
  12164. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  12165. break;
  12166. default: goto __pyx_L5_argtuple_error;
  12167. }
  12168. }
  12169. __pyx_v_triple = values[0];
  12170. __pyx_v_context = values[1];
  12171. __pyx_v_quoted = values[2];
  12172. }
  12173. goto __pyx_L4_argument_unpacking_done;
  12174. __pyx_L5_argtuple_error:;
  12175. __Pyx_RaiseArgtupleInvalid("add", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 696, __pyx_L3_error)
  12176. __pyx_L3_error:;
  12177. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12178. __Pyx_RefNannyFinishContext();
  12179. return NULL;
  12180. __pyx_L4_argument_unpacking_done:;
  12181. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_4add(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self), __pyx_v_triple, __pyx_v_context, __pyx_v_quoted);
  12182. /* function exit code */
  12183. __Pyx_RefNannyFinishContext();
  12184. return __pyx_r;
  12185. }
  12186. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_4add(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_triple, PyObject *__pyx_v_context, PyObject *__pyx_v_quoted) {
  12187. PyObject *__pyx_r = NULL;
  12188. __Pyx_TraceDeclarations
  12189. __Pyx_RefNannyDeclarations
  12190. PyObject *__pyx_t_1 = NULL;
  12191. struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_add __pyx_t_2;
  12192. __Pyx_RefNannySetupContext("add", 0);
  12193. __Pyx_TraceCall("add (wrapper)", __pyx_f[0], 696, 0, __PYX_ERR(0, 696, __pyx_L1_error));
  12194. __Pyx_XDECREF(__pyx_r);
  12195. __pyx_t_2.__pyx_n = 2;
  12196. __pyx_t_2.context = __pyx_v_context;
  12197. __pyx_t_2.quoted = __pyx_v_quoted;
  12198. __pyx_t_1 = __pyx_vtabptr_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore->add(__pyx_v_self, __pyx_v_triple, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 696, __pyx_L1_error)
  12199. __Pyx_GOTREF(__pyx_t_1);
  12200. __pyx_r = __pyx_t_1;
  12201. __pyx_t_1 = 0;
  12202. goto __pyx_L0;
  12203. /* function exit code */
  12204. __pyx_L1_error:;
  12205. __Pyx_XDECREF(__pyx_t_1);
  12206. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12207. __pyx_r = NULL;
  12208. __pyx_L0:;
  12209. __Pyx_XGIVEREF(__pyx_r);
  12210. __Pyx_TraceReturn(__pyx_r, 0);
  12211. __Pyx_RefNannyFinishContext();
  12212. return __pyx_r;
  12213. }
  12214. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":799
  12215. *
  12216. *
  12217. * cpdef add_graph(self, graph): # <<<<<<<<<<<<<<
  12218. * """
  12219. * Add a graph to the database.
  12220. */
  12221. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_7add_graph(PyObject *__pyx_v_self, PyObject *__pyx_v_graph); /*proto*/
  12222. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_add_graph(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_graph, int __pyx_skip_dispatch) {
  12223. unsigned char *__pyx_v_pk_c;
  12224. size_t __pyx_v_pk_size;
  12225. PyObject *__pyx_r = NULL;
  12226. __Pyx_TraceDeclarations
  12227. __Pyx_RefNannyDeclarations
  12228. PyObject *__pyx_t_1 = NULL;
  12229. PyObject *__pyx_t_2 = NULL;
  12230. PyObject *__pyx_t_3 = NULL;
  12231. PyObject *__pyx_t_4 = NULL;
  12232. PyObject *__pyx_t_5 = NULL;
  12233. int __pyx_t_6;
  12234. int __pyx_t_7;
  12235. int __pyx_t_8;
  12236. __Pyx_RefNannySetupContext("add_graph", 0);
  12237. __Pyx_TraceCall("add_graph", __pyx_f[0], 799, 0, __PYX_ERR(0, 799, __pyx_L1_error));
  12238. __Pyx_INCREF(__pyx_v_graph);
  12239. /* Check if called by wrapper */
  12240. if (unlikely(__pyx_skip_dispatch)) ;
  12241. /* Check if overridden in Python */
  12242. else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
  12243. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add_graph); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 799, __pyx_L1_error)
  12244. __Pyx_GOTREF(__pyx_t_1);
  12245. if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_7add_graph)) {
  12246. __Pyx_XDECREF(__pyx_r);
  12247. __Pyx_INCREF(__pyx_t_1);
  12248. __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
  12249. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  12250. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
  12251. if (likely(__pyx_t_4)) {
  12252. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  12253. __Pyx_INCREF(__pyx_t_4);
  12254. __Pyx_INCREF(function);
  12255. __Pyx_DECREF_SET(__pyx_t_3, function);
  12256. }
  12257. }
  12258. if (!__pyx_t_4) {
  12259. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_graph); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 799, __pyx_L1_error)
  12260. __Pyx_GOTREF(__pyx_t_2);
  12261. } else {
  12262. #if CYTHON_FAST_PYCALL
  12263. if (PyFunction_Check(__pyx_t_3)) {
  12264. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_graph};
  12265. __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 799, __pyx_L1_error)
  12266. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  12267. __Pyx_GOTREF(__pyx_t_2);
  12268. } else
  12269. #endif
  12270. #if CYTHON_FAST_PYCCALL
  12271. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  12272. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_graph};
  12273. __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 799, __pyx_L1_error)
  12274. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  12275. __Pyx_GOTREF(__pyx_t_2);
  12276. } else
  12277. #endif
  12278. {
  12279. __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 799, __pyx_L1_error)
  12280. __Pyx_GOTREF(__pyx_t_5);
  12281. __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
  12282. __Pyx_INCREF(__pyx_v_graph);
  12283. __Pyx_GIVEREF(__pyx_v_graph);
  12284. PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_graph);
  12285. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 799, __pyx_L1_error)
  12286. __Pyx_GOTREF(__pyx_t_2);
  12287. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  12288. }
  12289. }
  12290. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  12291. __pyx_r = __pyx_t_2;
  12292. __pyx_t_2 = 0;
  12293. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12294. goto __pyx_L0;
  12295. }
  12296. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12297. }
  12298. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":818
  12299. * size_t pk_size
  12300. *
  12301. * if isinstance(graph, Graph): # <<<<<<<<<<<<<<
  12302. * graph = graph.identifier
  12303. *
  12304. */
  12305. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Graph); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 818, __pyx_L1_error)
  12306. __Pyx_GOTREF(__pyx_t_1);
  12307. __pyx_t_6 = PyObject_IsInstance(__pyx_v_graph, __pyx_t_1); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 818, __pyx_L1_error)
  12308. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12309. __pyx_t_7 = (__pyx_t_6 != 0);
  12310. if (__pyx_t_7) {
  12311. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":819
  12312. *
  12313. * if isinstance(graph, Graph):
  12314. * graph = graph.identifier # <<<<<<<<<<<<<<
  12315. *
  12316. * serialize(graph, &pk_c, &pk_size)
  12317. */
  12318. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_graph, __pyx_n_s_identifier); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 819, __pyx_L1_error)
  12319. __Pyx_GOTREF(__pyx_t_1);
  12320. __Pyx_DECREF_SET(__pyx_v_graph, __pyx_t_1);
  12321. __pyx_t_1 = 0;
  12322. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":818
  12323. * size_t pk_size
  12324. *
  12325. * if isinstance(graph, Graph): # <<<<<<<<<<<<<<
  12326. * graph = graph.identifier
  12327. *
  12328. */
  12329. }
  12330. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":821
  12331. * graph = graph.identifier
  12332. *
  12333. * serialize(graph, &pk_c, &pk_size) # <<<<<<<<<<<<<<
  12334. * self._add_graph(pk_c, pk_size)
  12335. * free(pk_c)
  12336. */
  12337. __pyx_t_8 = __pyx_f_12lakesuperior_5store_6ldp_rs_4term_serialize(__pyx_v_graph, (&__pyx_v_pk_c), (&__pyx_v_pk_size)); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 821, __pyx_L1_error)
  12338. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":822
  12339. *
  12340. * serialize(graph, &pk_c, &pk_size)
  12341. * self._add_graph(pk_c, pk_size) # <<<<<<<<<<<<<<
  12342. * free(pk_c)
  12343. *
  12344. */
  12345. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->_add_graph(__pyx_v_self, __pyx_v_pk_c, __pyx_v_pk_size, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 822, __pyx_L1_error)
  12346. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":823
  12347. * serialize(graph, &pk_c, &pk_size)
  12348. * self._add_graph(pk_c, pk_size)
  12349. * free(pk_c) # <<<<<<<<<<<<<<
  12350. *
  12351. *
  12352. */
  12353. free(__pyx_v_pk_c);
  12354. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":799
  12355. *
  12356. *
  12357. * cpdef add_graph(self, graph): # <<<<<<<<<<<<<<
  12358. * """
  12359. * Add a graph to the database.
  12360. */
  12361. /* function exit code */
  12362. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  12363. goto __pyx_L0;
  12364. __pyx_L1_error:;
  12365. __Pyx_XDECREF(__pyx_t_1);
  12366. __Pyx_XDECREF(__pyx_t_2);
  12367. __Pyx_XDECREF(__pyx_t_3);
  12368. __Pyx_XDECREF(__pyx_t_4);
  12369. __Pyx_XDECREF(__pyx_t_5);
  12370. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.add_graph", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12371. __pyx_r = 0;
  12372. __pyx_L0:;
  12373. __Pyx_XDECREF(__pyx_v_graph);
  12374. __Pyx_XGIVEREF(__pyx_r);
  12375. __Pyx_TraceReturn(__pyx_r, 0);
  12376. __Pyx_RefNannyFinishContext();
  12377. return __pyx_r;
  12378. }
  12379. /* Python wrapper */
  12380. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_7add_graph(PyObject *__pyx_v_self, PyObject *__pyx_v_graph); /*proto*/
  12381. static char __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_6add_graph[] = "\n Add a graph to the database.\n\n This creates an empty graph by associating the graph URI with the\n pickled `None` value. This prevents from removing the graph when all\n triples are removed.\n\n This may be called by read-only operations:\n https://github.com/RDFLib/rdflib/blob/master/rdflib/graph.py#L1623\n In which case it needs to open a write transaction. This is not ideal\n but the only way to handle datasets in RDFLib.\n\n :param rdflib.URIRef graph: URI of the named graph to add.\n ";
  12382. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_7add_graph(PyObject *__pyx_v_self, PyObject *__pyx_v_graph) {
  12383. PyObject *__pyx_r = 0;
  12384. __Pyx_RefNannyDeclarations
  12385. __Pyx_RefNannySetupContext("add_graph (wrapper)", 0);
  12386. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_6add_graph(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self), ((PyObject *)__pyx_v_graph));
  12387. /* function exit code */
  12388. __Pyx_RefNannyFinishContext();
  12389. return __pyx_r;
  12390. }
  12391. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_6add_graph(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_graph) {
  12392. PyObject *__pyx_r = NULL;
  12393. __Pyx_TraceDeclarations
  12394. __Pyx_RefNannyDeclarations
  12395. PyObject *__pyx_t_1 = NULL;
  12396. __Pyx_RefNannySetupContext("add_graph", 0);
  12397. __Pyx_TraceCall("add_graph (wrapper)", __pyx_f[0], 799, 0, __PYX_ERR(0, 799, __pyx_L1_error));
  12398. __Pyx_XDECREF(__pyx_r);
  12399. __pyx_t_1 = __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_add_graph(__pyx_v_self, __pyx_v_graph, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 799, __pyx_L1_error)
  12400. __Pyx_GOTREF(__pyx_t_1);
  12401. __pyx_r = __pyx_t_1;
  12402. __pyx_t_1 = 0;
  12403. goto __pyx_L0;
  12404. /* function exit code */
  12405. __pyx_L1_error:;
  12406. __Pyx_XDECREF(__pyx_t_1);
  12407. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.add_graph", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12408. __pyx_r = NULL;
  12409. __pyx_L0:;
  12410. __Pyx_XGIVEREF(__pyx_r);
  12411. __Pyx_TraceReturn(__pyx_r, 0);
  12412. __Pyx_RefNannyFinishContext();
  12413. return __pyx_r;
  12414. }
  12415. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":826
  12416. *
  12417. *
  12418. * cpdef void _add_graph( # <<<<<<<<<<<<<<
  12419. * self, unsigned char *pk_c, size_t pk_size) except *:
  12420. * """
  12421. */
  12422. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_9_add_graph(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  12423. static void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__add_graph(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, unsigned char *__pyx_v_pk_c, size_t __pyx_v_pk_size, int __pyx_skip_dispatch) {
  12424. unsigned char __pyx_v_c_hash[20];
  12425. unsigned char __pyx_v_ck[5];
  12426. MDB_txn *__pyx_v_tmp_txn;
  12427. __Pyx_TraceDeclarations
  12428. __Pyx_RefNannyDeclarations
  12429. PyObject *__pyx_t_1 = NULL;
  12430. PyObject *__pyx_t_2 = NULL;
  12431. PyObject *__pyx_t_3 = NULL;
  12432. PyObject *__pyx_t_4 = NULL;
  12433. PyObject *__pyx_t_5 = NULL;
  12434. PyObject *__pyx_t_6 = NULL;
  12435. int __pyx_t_7;
  12436. PyObject *__pyx_t_8 = NULL;
  12437. int __pyx_t_9;
  12438. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__key_exists __pyx_t_10;
  12439. int __pyx_t_11;
  12440. struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__append __pyx_t_12;
  12441. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__put __pyx_t_13;
  12442. PyObject *__pyx_t_14 = NULL;
  12443. PyObject *__pyx_t_15 = NULL;
  12444. PyObject *__pyx_t_16 = NULL;
  12445. __Pyx_RefNannySetupContext("_add_graph", 0);
  12446. __Pyx_TraceCall("_add_graph", __pyx_f[0], 826, 0, __PYX_ERR(0, 826, __pyx_L1_error));
  12447. /* Check if called by wrapper */
  12448. if (unlikely(__pyx_skip_dispatch)) ;
  12449. /* Check if overridden in Python */
  12450. else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
  12451. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add_graph_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 826, __pyx_L1_error)
  12452. __Pyx_GOTREF(__pyx_t_1);
  12453. if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_9_add_graph)) {
  12454. __pyx_t_3 = __Pyx_PyBytes_FromCString(__pyx_v_pk_c); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 826, __pyx_L1_error)
  12455. __Pyx_GOTREF(__pyx_t_3);
  12456. __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_pk_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 826, __pyx_L1_error)
  12457. __Pyx_GOTREF(__pyx_t_4);
  12458. __Pyx_INCREF(__pyx_t_1);
  12459. __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
  12460. __pyx_t_7 = 0;
  12461. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
  12462. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
  12463. if (likely(__pyx_t_6)) {
  12464. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
  12465. __Pyx_INCREF(__pyx_t_6);
  12466. __Pyx_INCREF(function);
  12467. __Pyx_DECREF_SET(__pyx_t_5, function);
  12468. __pyx_t_7 = 1;
  12469. }
  12470. }
  12471. #if CYTHON_FAST_PYCALL
  12472. if (PyFunction_Check(__pyx_t_5)) {
  12473. PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4};
  12474. __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 826, __pyx_L1_error)
  12475. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  12476. __Pyx_GOTREF(__pyx_t_2);
  12477. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  12478. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  12479. } else
  12480. #endif
  12481. #if CYTHON_FAST_PYCCALL
  12482. if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
  12483. PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4};
  12484. __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 826, __pyx_L1_error)
  12485. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  12486. __Pyx_GOTREF(__pyx_t_2);
  12487. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  12488. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  12489. } else
  12490. #endif
  12491. {
  12492. __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 826, __pyx_L1_error)
  12493. __Pyx_GOTREF(__pyx_t_8);
  12494. if (__pyx_t_6) {
  12495. __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
  12496. }
  12497. __Pyx_GIVEREF(__pyx_t_3);
  12498. PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3);
  12499. __Pyx_GIVEREF(__pyx_t_4);
  12500. PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
  12501. __pyx_t_3 = 0;
  12502. __pyx_t_4 = 0;
  12503. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 826, __pyx_L1_error)
  12504. __Pyx_GOTREF(__pyx_t_2);
  12505. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  12506. }
  12507. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  12508. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12509. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12510. goto __pyx_L0;
  12511. }
  12512. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12513. }
  12514. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":844
  12515. * lmdb.MDB_cursor *ck_cur
  12516. *
  12517. * _hash(pk_c, pk_size, c_hash) # <<<<<<<<<<<<<<
  12518. * #logger.debug('Adding a graph.')
  12519. * if not self._key_exists(c_hash, HLEN, b'th:t'):
  12520. */
  12521. __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore__hash(__pyx_v_pk_c, __pyx_v_pk_size, __pyx_v_c_hash);
  12522. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":846
  12523. * _hash(pk_c, pk_size, c_hash)
  12524. * #logger.debug('Adding a graph.')
  12525. * if not self._key_exists(c_hash, HLEN, b'th:t'): # <<<<<<<<<<<<<<
  12526. * # Insert context term if not existing.
  12527. * if self.is_txn_rw:
  12528. */
  12529. __pyx_t_10.__pyx_n = 1;
  12530. __pyx_t_10.dblabel = ((unsigned char *)((char const *)"th:t"));
  12531. __pyx_t_9 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._key_exists(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_c_hash, 20, &__pyx_t_10); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 846, __pyx_L1_error)
  12532. __pyx_t_11 = ((!(__pyx_t_9 != 0)) != 0);
  12533. if (__pyx_t_11) {
  12534. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":848
  12535. * if not self._key_exists(c_hash, HLEN, b'th:t'):
  12536. * # Insert context term if not existing.
  12537. * if self.is_txn_rw: # <<<<<<<<<<<<<<
  12538. * #logger.debug('Working in existing RW transaction.')
  12539. * # Use existing R/W transaction.
  12540. */
  12541. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_is_txn_rw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 848, __pyx_L1_error)
  12542. __Pyx_GOTREF(__pyx_t_1);
  12543. __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 848, __pyx_L1_error)
  12544. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12545. if (__pyx_t_11) {
  12546. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":852
  12547. * # Use existing R/W transaction.
  12548. * # Main entry.
  12549. * self._append(pk_c, pk_size, &ck, b't:st') # <<<<<<<<<<<<<<
  12550. * # Index.
  12551. * self._put(c_hash, HLEN, ck, KLEN, b'th:t')
  12552. */
  12553. __pyx_t_12.__pyx_n = 1;
  12554. __pyx_t_12.dblabel = ((unsigned char *)((char const *)"t:st"));
  12555. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->_append(__pyx_v_self, __pyx_v_pk_c, __pyx_v_pk_size, (&__pyx_v_ck), &__pyx_t_12); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 852, __pyx_L1_error)
  12556. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":854
  12557. * self._append(pk_c, pk_size, &ck, b't:st')
  12558. * # Index.
  12559. * self._put(c_hash, HLEN, ck, KLEN, b'th:t') # <<<<<<<<<<<<<<
  12560. * # Add to list of contexts.
  12561. * self._put(ck, KLEN, b'', 0, 'c:')
  12562. */
  12563. __pyx_t_13.__pyx_n = 1;
  12564. __pyx_t_13.dblabel = ((unsigned char *)((char const *)"th:t"));
  12565. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._put(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_c_hash, 20, __pyx_v_ck, 5, &__pyx_t_13); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 854, __pyx_L1_error)
  12566. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":856
  12567. * self._put(c_hash, HLEN, ck, KLEN, b'th:t')
  12568. * # Add to list of contexts.
  12569. * self._put(ck, KLEN, b'', 0, 'c:') # <<<<<<<<<<<<<<
  12570. * else:
  12571. * # Open new R/W transactions.
  12572. */
  12573. __pyx_t_13.__pyx_n = 1;
  12574. __pyx_t_13.dblabel = ((unsigned char *)((char const *)"c:"));
  12575. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._put(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_ck, 5, ((unsigned char *)((char const *)"")), 0, &__pyx_t_13); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 856, __pyx_L1_error)
  12576. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":848
  12577. * if not self._key_exists(c_hash, HLEN, b'th:t'):
  12578. * # Insert context term if not existing.
  12579. * if self.is_txn_rw: # <<<<<<<<<<<<<<
  12580. * #logger.debug('Working in existing RW transaction.')
  12581. * # Use existing R/W transaction.
  12582. */
  12583. goto __pyx_L4;
  12584. }
  12585. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":860
  12586. * # Open new R/W transactions.
  12587. * #logger.debug('Opening a temporary RW transaction.')
  12588. * _check(lmdb.mdb_txn_begin(self.dbenv, NULL, 0, &tmp_txn)) # <<<<<<<<<<<<<<
  12589. * try:
  12590. * self._append(
  12591. */
  12592. /*else*/ {
  12593. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_txn_begin(__pyx_v_self->__pyx_base.dbenv, NULL, 0, (&__pyx_v_tmp_txn)), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 860, __pyx_L1_error)
  12594. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":861
  12595. * #logger.debug('Opening a temporary RW transaction.')
  12596. * _check(lmdb.mdb_txn_begin(self.dbenv, NULL, 0, &tmp_txn))
  12597. * try: # <<<<<<<<<<<<<<
  12598. * self._append(
  12599. * pk_c, pk_size, &ck, dblabel=b't:st', txn=tmp_txn)
  12600. */
  12601. {
  12602. __Pyx_PyThreadState_declare
  12603. __Pyx_PyThreadState_assign
  12604. __Pyx_ExceptionSave(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
  12605. __Pyx_XGOTREF(__pyx_t_14);
  12606. __Pyx_XGOTREF(__pyx_t_15);
  12607. __Pyx_XGOTREF(__pyx_t_16);
  12608. /*try:*/ {
  12609. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":862
  12610. * _check(lmdb.mdb_txn_begin(self.dbenv, NULL, 0, &tmp_txn))
  12611. * try:
  12612. * self._append( # <<<<<<<<<<<<<<
  12613. * pk_c, pk_size, &ck, dblabel=b't:st', txn=tmp_txn)
  12614. * # Index.
  12615. */
  12616. __pyx_t_12.__pyx_n = 2;
  12617. __pyx_t_12.dblabel = ((unsigned char *)((char const *)"t:st"));
  12618. __pyx_t_12.txn = __pyx_v_tmp_txn;
  12619. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->_append(__pyx_v_self, __pyx_v_pk_c, __pyx_v_pk_size, (&__pyx_v_ck), &__pyx_t_12); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 862, __pyx_L5_error)
  12620. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":865
  12621. * pk_c, pk_size, &ck, dblabel=b't:st', txn=tmp_txn)
  12622. * # Index.
  12623. * self._put(c_hash, HLEN, ck, KLEN, b'th:t', txn=tmp_txn) # <<<<<<<<<<<<<<
  12624. * # Add to list of contexts.
  12625. * self._put(ck, KLEN, b'', 0, b'c:', txn=tmp_txn)
  12626. */
  12627. __pyx_t_13.__pyx_n = 2;
  12628. __pyx_t_13.dblabel = ((unsigned char *)((char const *)"th:t"));
  12629. __pyx_t_13.txn = __pyx_v_tmp_txn;
  12630. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._put(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_c_hash, 20, __pyx_v_ck, 5, &__pyx_t_13); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 865, __pyx_L5_error)
  12631. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":867
  12632. * self._put(c_hash, HLEN, ck, KLEN, b'th:t', txn=tmp_txn)
  12633. * # Add to list of contexts.
  12634. * self._put(ck, KLEN, b'', 0, b'c:', txn=tmp_txn) # <<<<<<<<<<<<<<
  12635. * _check(lmdb.mdb_txn_commit(tmp_txn))
  12636. * #logger.debug('Temp RW transaction closed.')
  12637. */
  12638. __pyx_t_13.__pyx_n = 2;
  12639. __pyx_t_13.dblabel = ((unsigned char *)((char const *)"c:"));
  12640. __pyx_t_13.txn = __pyx_v_tmp_txn;
  12641. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._put(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_ck, 5, ((unsigned char *)((char const *)"")), 0, &__pyx_t_13); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 867, __pyx_L5_error)
  12642. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":868
  12643. * # Add to list of contexts.
  12644. * self._put(ck, KLEN, b'', 0, b'c:', txn=tmp_txn)
  12645. * _check(lmdb.mdb_txn_commit(tmp_txn)) # <<<<<<<<<<<<<<
  12646. * #logger.debug('Temp RW transaction closed.')
  12647. * except:
  12648. */
  12649. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_txn_commit(__pyx_v_tmp_txn), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 868, __pyx_L5_error)
  12650. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":861
  12651. * #logger.debug('Opening a temporary RW transaction.')
  12652. * _check(lmdb.mdb_txn_begin(self.dbenv, NULL, 0, &tmp_txn))
  12653. * try: # <<<<<<<<<<<<<<
  12654. * self._append(
  12655. * pk_c, pk_size, &ck, dblabel=b't:st', txn=tmp_txn)
  12656. */
  12657. }
  12658. __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
  12659. __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
  12660. __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
  12661. goto __pyx_L10_try_end;
  12662. __pyx_L5_error:;
  12663. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  12664. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  12665. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  12666. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  12667. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  12668. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  12669. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  12670. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":870
  12671. * _check(lmdb.mdb_txn_commit(tmp_txn))
  12672. * #logger.debug('Temp RW transaction closed.')
  12673. * except: # <<<<<<<<<<<<<<
  12674. * lmdb.mdb_txn_abort(tmp_txn)
  12675. * raise
  12676. */
  12677. /*except:*/ {
  12678. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._add_graph", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12679. if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_5) < 0) __PYX_ERR(0, 870, __pyx_L7_except_error)
  12680. __Pyx_GOTREF(__pyx_t_1);
  12681. __Pyx_GOTREF(__pyx_t_2);
  12682. __Pyx_GOTREF(__pyx_t_5);
  12683. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":871
  12684. * #logger.debug('Temp RW transaction closed.')
  12685. * except:
  12686. * lmdb.mdb_txn_abort(tmp_txn) # <<<<<<<<<<<<<<
  12687. * raise
  12688. *
  12689. */
  12690. mdb_txn_abort(__pyx_v_tmp_txn);
  12691. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":872
  12692. * except:
  12693. * lmdb.mdb_txn_abort(tmp_txn)
  12694. * raise # <<<<<<<<<<<<<<
  12695. *
  12696. *
  12697. */
  12698. __Pyx_GIVEREF(__pyx_t_1);
  12699. __Pyx_GIVEREF(__pyx_t_2);
  12700. __Pyx_XGIVEREF(__pyx_t_5);
  12701. __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_2, __pyx_t_5);
  12702. __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_5 = 0;
  12703. __PYX_ERR(0, 872, __pyx_L7_except_error)
  12704. }
  12705. __pyx_L7_except_error:;
  12706. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":861
  12707. * #logger.debug('Opening a temporary RW transaction.')
  12708. * _check(lmdb.mdb_txn_begin(self.dbenv, NULL, 0, &tmp_txn))
  12709. * try: # <<<<<<<<<<<<<<
  12710. * self._append(
  12711. * pk_c, pk_size, &ck, dblabel=b't:st', txn=tmp_txn)
  12712. */
  12713. __Pyx_XGIVEREF(__pyx_t_14);
  12714. __Pyx_XGIVEREF(__pyx_t_15);
  12715. __Pyx_XGIVEREF(__pyx_t_16);
  12716. __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
  12717. goto __pyx_L1_error;
  12718. __pyx_L10_try_end:;
  12719. }
  12720. }
  12721. __pyx_L4:;
  12722. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":846
  12723. * _hash(pk_c, pk_size, c_hash)
  12724. * #logger.debug('Adding a graph.')
  12725. * if not self._key_exists(c_hash, HLEN, b'th:t'): # <<<<<<<<<<<<<<
  12726. * # Insert context term if not existing.
  12727. * if self.is_txn_rw:
  12728. */
  12729. }
  12730. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":826
  12731. *
  12732. *
  12733. * cpdef void _add_graph( # <<<<<<<<<<<<<<
  12734. * self, unsigned char *pk_c, size_t pk_size) except *:
  12735. * """
  12736. */
  12737. /* function exit code */
  12738. goto __pyx_L0;
  12739. __pyx_L1_error:;
  12740. __Pyx_XDECREF(__pyx_t_1);
  12741. __Pyx_XDECREF(__pyx_t_2);
  12742. __Pyx_XDECREF(__pyx_t_3);
  12743. __Pyx_XDECREF(__pyx_t_4);
  12744. __Pyx_XDECREF(__pyx_t_5);
  12745. __Pyx_XDECREF(__pyx_t_6);
  12746. __Pyx_XDECREF(__pyx_t_8);
  12747. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._add_graph", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12748. __pyx_L0:;
  12749. __Pyx_TraceReturn(Py_None, 0);
  12750. __Pyx_RefNannyFinishContext();
  12751. }
  12752. /* Python wrapper */
  12753. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_9_add_graph(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  12754. static char __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_8_add_graph[] = "\n Add a graph.\n\n :param pk_c: Pickled context URIRef object.\n :type pk_c: unsigned char*\n :param pk_size: Size of pickled string.\n :type pk_size: size_t\n ";
  12755. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_9_add_graph(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  12756. unsigned char *__pyx_v_pk_c;
  12757. size_t __pyx_v_pk_size;
  12758. PyObject *__pyx_r = 0;
  12759. __Pyx_RefNannyDeclarations
  12760. __Pyx_RefNannySetupContext("_add_graph (wrapper)", 0);
  12761. {
  12762. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pk_c,&__pyx_n_s_pk_size,0};
  12763. PyObject* values[2] = {0,0};
  12764. if (unlikely(__pyx_kwds)) {
  12765. Py_ssize_t kw_args;
  12766. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  12767. switch (pos_args) {
  12768. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  12769. CYTHON_FALLTHROUGH;
  12770. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  12771. CYTHON_FALLTHROUGH;
  12772. case 0: break;
  12773. default: goto __pyx_L5_argtuple_error;
  12774. }
  12775. kw_args = PyDict_Size(__pyx_kwds);
  12776. switch (pos_args) {
  12777. case 0:
  12778. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pk_c)) != 0)) kw_args--;
  12779. else goto __pyx_L5_argtuple_error;
  12780. CYTHON_FALLTHROUGH;
  12781. case 1:
  12782. if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pk_size)) != 0)) kw_args--;
  12783. else {
  12784. __Pyx_RaiseArgtupleInvalid("_add_graph", 1, 2, 2, 1); __PYX_ERR(0, 826, __pyx_L3_error)
  12785. }
  12786. }
  12787. if (unlikely(kw_args > 0)) {
  12788. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_add_graph") < 0)) __PYX_ERR(0, 826, __pyx_L3_error)
  12789. }
  12790. } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
  12791. goto __pyx_L5_argtuple_error;
  12792. } else {
  12793. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  12794. values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  12795. }
  12796. __pyx_v_pk_c = __Pyx_PyObject_AsWritableUString(values[0]); if (unlikely((!__pyx_v_pk_c) && PyErr_Occurred())) __PYX_ERR(0, 827, __pyx_L3_error)
  12797. __pyx_v_pk_size = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_pk_size == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 827, __pyx_L3_error)
  12798. }
  12799. goto __pyx_L4_argument_unpacking_done;
  12800. __pyx_L5_argtuple_error:;
  12801. __Pyx_RaiseArgtupleInvalid("_add_graph", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 826, __pyx_L3_error)
  12802. __pyx_L3_error:;
  12803. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._add_graph", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12804. __Pyx_RefNannyFinishContext();
  12805. return NULL;
  12806. __pyx_L4_argument_unpacking_done:;
  12807. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_8_add_graph(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self), __pyx_v_pk_c, __pyx_v_pk_size);
  12808. /* function exit code */
  12809. __Pyx_RefNannyFinishContext();
  12810. return __pyx_r;
  12811. }
  12812. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_8_add_graph(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, unsigned char *__pyx_v_pk_c, size_t __pyx_v_pk_size) {
  12813. PyObject *__pyx_r = NULL;
  12814. __Pyx_TraceDeclarations
  12815. __Pyx_RefNannyDeclarations
  12816. PyObject *__pyx_t_1 = NULL;
  12817. __Pyx_RefNannySetupContext("_add_graph", 0);
  12818. __Pyx_TraceCall("_add_graph (wrapper)", __pyx_f[0], 826, 0, __PYX_ERR(0, 826, __pyx_L1_error));
  12819. __Pyx_XDECREF(__pyx_r);
  12820. __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__add_graph(__pyx_v_self, __pyx_v_pk_c, __pyx_v_pk_size, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 826, __pyx_L1_error)
  12821. __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 826, __pyx_L1_error)
  12822. __Pyx_GOTREF(__pyx_t_1);
  12823. __pyx_r = __pyx_t_1;
  12824. __pyx_t_1 = 0;
  12825. goto __pyx_L0;
  12826. /* function exit code */
  12827. __pyx_L1_error:;
  12828. __Pyx_XDECREF(__pyx_t_1);
  12829. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._add_graph", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12830. __pyx_r = NULL;
  12831. __pyx_L0:;
  12832. __Pyx_XGIVEREF(__pyx_r);
  12833. __Pyx_TraceReturn(__pyx_r, 0);
  12834. __Pyx_RefNannyFinishContext();
  12835. return __pyx_r;
  12836. }
  12837. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":875
  12838. *
  12839. *
  12840. * cpdef void _remove(self, tuple triple_pattern, context=None) except *: # <<<<<<<<<<<<<<
  12841. * cdef:
  12842. * unsigned char spok[TRP_KLEN]
  12843. */
  12844. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_11_remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  12845. static void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__remove(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_triple_pattern, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__remove *__pyx_optional_args) {
  12846. PyObject *__pyx_v_context = ((PyObject *)Py_None);
  12847. unsigned char __pyx_v_spok[15];
  12848. size_t __pyx_v_i;
  12849. __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Key __pyx_v_ck;
  12850. struct MDB_val __pyx_v_spok_v;
  12851. struct MDB_val __pyx_v_ck_v;
  12852. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_match_set = NULL;
  12853. MDB_cursor *__pyx_v_dcur;
  12854. MDB_cursor *__pyx_v_icur;
  12855. __Pyx_TraceDeclarations
  12856. __Pyx_RefNannyDeclarations
  12857. PyObject *__pyx_t_1 = NULL;
  12858. PyObject *__pyx_t_2 = NULL;
  12859. PyObject *__pyx_t_3 = NULL;
  12860. PyObject *__pyx_t_4 = NULL;
  12861. int __pyx_t_5;
  12862. PyObject *__pyx_t_6 = NULL;
  12863. int __pyx_t_7;
  12864. int __pyx_t_8;
  12865. PyObject *__pyx_t_9 = NULL;
  12866. PyObject *__pyx_t_10 = NULL;
  12867. PyObject *__pyx_t_11 = NULL;
  12868. struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_triple_keys __pyx_t_12;
  12869. MDB_cursor *__pyx_t_13;
  12870. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__cur_open __pyx_t_14;
  12871. PyObject *__pyx_t_15 = NULL;
  12872. PyObject *__pyx_t_16 = NULL;
  12873. PyObject *__pyx_t_17 = NULL;
  12874. Py_ssize_t __pyx_t_18;
  12875. Py_UCS4 __pyx_t_19;
  12876. int __pyx_t_20;
  12877. char const *__pyx_t_21;
  12878. char const *__pyx_t_22;
  12879. __Pyx_RefNannySetupContext("_remove", 0);
  12880. __Pyx_TraceCall("_remove", __pyx_f[0], 875, 0, __PYX_ERR(0, 875, __pyx_L1_error));
  12881. if (__pyx_optional_args) {
  12882. if (__pyx_optional_args->__pyx_n > 0) {
  12883. __pyx_v_context = __pyx_optional_args->context;
  12884. }
  12885. }
  12886. /* Check if called by wrapper */
  12887. if (unlikely(__pyx_skip_dispatch)) ;
  12888. /* Check if overridden in Python */
  12889. else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
  12890. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_remove); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 875, __pyx_L1_error)
  12891. __Pyx_GOTREF(__pyx_t_1);
  12892. if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_11_remove)) {
  12893. __Pyx_INCREF(__pyx_t_1);
  12894. __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
  12895. __pyx_t_5 = 0;
  12896. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  12897. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
  12898. if (likely(__pyx_t_4)) {
  12899. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  12900. __Pyx_INCREF(__pyx_t_4);
  12901. __Pyx_INCREF(function);
  12902. __Pyx_DECREF_SET(__pyx_t_3, function);
  12903. __pyx_t_5 = 1;
  12904. }
  12905. }
  12906. #if CYTHON_FAST_PYCALL
  12907. if (PyFunction_Check(__pyx_t_3)) {
  12908. PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_triple_pattern, __pyx_v_context};
  12909. __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 875, __pyx_L1_error)
  12910. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  12911. __Pyx_GOTREF(__pyx_t_2);
  12912. } else
  12913. #endif
  12914. #if CYTHON_FAST_PYCCALL
  12915. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  12916. PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_triple_pattern, __pyx_v_context};
  12917. __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 875, __pyx_L1_error)
  12918. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  12919. __Pyx_GOTREF(__pyx_t_2);
  12920. } else
  12921. #endif
  12922. {
  12923. __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 875, __pyx_L1_error)
  12924. __Pyx_GOTREF(__pyx_t_6);
  12925. if (__pyx_t_4) {
  12926. __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
  12927. }
  12928. __Pyx_INCREF(__pyx_v_triple_pattern);
  12929. __Pyx_GIVEREF(__pyx_v_triple_pattern);
  12930. PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_triple_pattern);
  12931. __Pyx_INCREF(__pyx_v_context);
  12932. __Pyx_GIVEREF(__pyx_v_context);
  12933. PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_context);
  12934. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 875, __pyx_L1_error)
  12935. __Pyx_GOTREF(__pyx_t_2);
  12936. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  12937. }
  12938. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  12939. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12940. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12941. goto __pyx_L0;
  12942. }
  12943. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12944. }
  12945. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":878
  12946. * cdef:
  12947. * unsigned char spok[TRP_KLEN]
  12948. * size_t i = 0 # <<<<<<<<<<<<<<
  12949. * Key ck
  12950. * lmdb.MDB_val spok_v, ck_v
  12951. */
  12952. __pyx_v_i = 0;
  12953. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":883
  12954. *
  12955. * #logger.debug('Removing triple: {}'.format(triple_pattern))
  12956. * if context is not None: # <<<<<<<<<<<<<<
  12957. * try:
  12958. * self._to_key(context, &ck)
  12959. */
  12960. __pyx_t_7 = (__pyx_v_context != Py_None);
  12961. __pyx_t_8 = (__pyx_t_7 != 0);
  12962. if (__pyx_t_8) {
  12963. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":884
  12964. * #logger.debug('Removing triple: {}'.format(triple_pattern))
  12965. * if context is not None:
  12966. * try: # <<<<<<<<<<<<<<
  12967. * self._to_key(context, &ck)
  12968. * except KeyNotFoundError:
  12969. */
  12970. {
  12971. __Pyx_PyThreadState_declare
  12972. __Pyx_PyThreadState_assign
  12973. __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
  12974. __Pyx_XGOTREF(__pyx_t_9);
  12975. __Pyx_XGOTREF(__pyx_t_10);
  12976. __Pyx_XGOTREF(__pyx_t_11);
  12977. /*try:*/ {
  12978. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":885
  12979. * if context is not None:
  12980. * try:
  12981. * self._to_key(context, &ck) # <<<<<<<<<<<<<<
  12982. * except KeyNotFoundError:
  12983. * # If context is specified but not found, return to avoid
  12984. */
  12985. __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__to_key(__pyx_v_self, __pyx_v_context, (&__pyx_v_ck)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 885, __pyx_L4_error)
  12986. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":884
  12987. * #logger.debug('Removing triple: {}'.format(triple_pattern))
  12988. * if context is not None:
  12989. * try: # <<<<<<<<<<<<<<
  12990. * self._to_key(context, &ck)
  12991. * except KeyNotFoundError:
  12992. */
  12993. }
  12994. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  12995. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  12996. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  12997. goto __pyx_L9_try_end;
  12998. __pyx_L4_error:;
  12999. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  13000. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  13001. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  13002. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  13003. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  13004. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":886
  13005. * try:
  13006. * self._to_key(context, &ck)
  13007. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  13008. * # If context is specified but not found, return to avoid
  13009. * # deleting the wrong triples.
  13010. */
  13011. __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  13012. __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 886, __pyx_L6_except_error)
  13013. __Pyx_GOTREF(__pyx_t_6);
  13014. __pyx_t_5 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
  13015. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  13016. __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  13017. __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0;
  13018. if (__pyx_t_5) {
  13019. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  13020. if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 886, __pyx_L6_except_error)
  13021. __Pyx_GOTREF(__pyx_t_3);
  13022. __Pyx_GOTREF(__pyx_t_2);
  13023. __Pyx_GOTREF(__pyx_t_1);
  13024. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":889
  13025. * # If context is specified but not found, return to avoid
  13026. * # deleting the wrong triples.
  13027. * return # <<<<<<<<<<<<<<
  13028. *
  13029. * # Get the matching pattern.
  13030. */
  13031. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13032. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13033. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13034. goto __pyx_L7_except_return;
  13035. }
  13036. goto __pyx_L6_except_error;
  13037. __pyx_L6_except_error:;
  13038. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":884
  13039. * #logger.debug('Removing triple: {}'.format(triple_pattern))
  13040. * if context is not None:
  13041. * try: # <<<<<<<<<<<<<<
  13042. * self._to_key(context, &ck)
  13043. * except KeyNotFoundError:
  13044. */
  13045. __Pyx_XGIVEREF(__pyx_t_9);
  13046. __Pyx_XGIVEREF(__pyx_t_10);
  13047. __Pyx_XGIVEREF(__pyx_t_11);
  13048. __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
  13049. goto __pyx_L1_error;
  13050. __pyx_L7_except_return:;
  13051. __Pyx_XGIVEREF(__pyx_t_9);
  13052. __Pyx_XGIVEREF(__pyx_t_10);
  13053. __Pyx_XGIVEREF(__pyx_t_11);
  13054. __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
  13055. goto __pyx_L0;
  13056. __pyx_L9_try_end:;
  13057. }
  13058. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":883
  13059. *
  13060. * #logger.debug('Removing triple: {}'.format(triple_pattern))
  13061. * if context is not None: # <<<<<<<<<<<<<<
  13062. * try:
  13063. * self._to_key(context, &ck)
  13064. */
  13065. }
  13066. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":892
  13067. *
  13068. * # Get the matching pattern.
  13069. * match_set = self.triple_keys(triple_pattern, context) # <<<<<<<<<<<<<<
  13070. *
  13071. * dcur = self._cur_open('spo:c')
  13072. */
  13073. __pyx_t_12.__pyx_n = 1;
  13074. __pyx_t_12.context = __pyx_v_context;
  13075. __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->triple_keys(__pyx_v_self, __pyx_v_triple_pattern, 0, &__pyx_t_12)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 892, __pyx_L1_error)
  13076. __Pyx_GOTREF(__pyx_t_1);
  13077. __pyx_v_match_set = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_1);
  13078. __pyx_t_1 = 0;
  13079. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":894
  13080. * match_set = self.triple_keys(triple_pattern, context)
  13081. *
  13082. * dcur = self._cur_open('spo:c') # <<<<<<<<<<<<<<
  13083. * icur = self._cur_open('c:spo')
  13084. *
  13085. */
  13086. __pyx_t_14.__pyx_n = 1;
  13087. __pyx_t_14.dblabel = ((unsigned char *)((char const *)"spo:c"));
  13088. __pyx_t_13 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_open(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_14); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 894, __pyx_L1_error)
  13089. __pyx_v_dcur = __pyx_t_13;
  13090. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":895
  13091. *
  13092. * dcur = self._cur_open('spo:c')
  13093. * icur = self._cur_open('c:spo') # <<<<<<<<<<<<<<
  13094. *
  13095. * try:
  13096. */
  13097. __pyx_t_14.__pyx_n = 1;
  13098. __pyx_t_14.dblabel = ((unsigned char *)((char const *)"c:spo"));
  13099. __pyx_t_13 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_open(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_14); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 895, __pyx_L1_error)
  13100. __pyx_v_icur = __pyx_t_13;
  13101. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":897
  13102. * icur = self._cur_open('c:spo')
  13103. *
  13104. * try: # <<<<<<<<<<<<<<
  13105. * spok_v.mv_size = TRP_KLEN
  13106. * # If context was specified, remove only associations with that context.
  13107. */
  13108. /*try:*/ {
  13109. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":898
  13110. *
  13111. * try:
  13112. * spok_v.mv_size = TRP_KLEN # <<<<<<<<<<<<<<
  13113. * # If context was specified, remove only associations with that context.
  13114. * if context is not None:
  13115. */
  13116. __pyx_v_spok_v.mv_size = 15;
  13117. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":900
  13118. * spok_v.mv_size = TRP_KLEN
  13119. * # If context was specified, remove only associations with that context.
  13120. * if context is not None: # <<<<<<<<<<<<<<
  13121. * #logger.debug('Removing triples in matching context.')
  13122. * ck_v.mv_data = ck
  13123. */
  13124. __pyx_t_8 = (__pyx_v_context != Py_None);
  13125. __pyx_t_7 = (__pyx_t_8 != 0);
  13126. if (__pyx_t_7) {
  13127. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":902
  13128. * if context is not None:
  13129. * #logger.debug('Removing triples in matching context.')
  13130. * ck_v.mv_data = ck # <<<<<<<<<<<<<<
  13131. * ck_v.mv_size = KLEN
  13132. * while i < match_set.ct:
  13133. */
  13134. __pyx_v_ck_v.mv_data = __pyx_v_ck;
  13135. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":903
  13136. * #logger.debug('Removing triples in matching context.')
  13137. * ck_v.mv_data = ck
  13138. * ck_v.mv_size = KLEN # <<<<<<<<<<<<<<
  13139. * while i < match_set.ct:
  13140. * memcpy(
  13141. */
  13142. __pyx_v_ck_v.mv_size = 5;
  13143. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":904
  13144. * ck_v.mv_data = ck
  13145. * ck_v.mv_size = KLEN
  13146. * while i < match_set.ct: # <<<<<<<<<<<<<<
  13147. * memcpy(
  13148. * spok, match_set.data + match_set.itemsize * i,
  13149. */
  13150. while (1) {
  13151. __pyx_t_7 = ((__pyx_v_i < __pyx_v_match_set->ct) != 0);
  13152. if (!__pyx_t_7) break;
  13153. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":905
  13154. * ck_v.mv_size = KLEN
  13155. * while i < match_set.ct:
  13156. * memcpy( # <<<<<<<<<<<<<<
  13157. * spok, match_set.data + match_set.itemsize * i,
  13158. * TRP_KLEN)
  13159. */
  13160. (void)(memcpy(__pyx_v_spok, (__pyx_v_match_set->data + (__pyx_v_match_set->itemsize * __pyx_v_i)), 15));
  13161. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":908
  13162. * spok, match_set.data + match_set.itemsize * i,
  13163. * TRP_KLEN)
  13164. * spok_v.mv_data = spok # <<<<<<<<<<<<<<
  13165. * # Delete spo:c entry.
  13166. * try:
  13167. */
  13168. __pyx_v_spok_v.mv_data = __pyx_v_spok;
  13169. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":910
  13170. * spok_v.mv_data = spok
  13171. * # Delete spo:c entry.
  13172. * try: # <<<<<<<<<<<<<<
  13173. * _check(lmdb.mdb_cursor_get(
  13174. * dcur, &spok_v, &ck_v, lmdb.MDB_GET_BOTH))
  13175. */
  13176. {
  13177. __Pyx_PyThreadState_declare
  13178. __Pyx_PyThreadState_assign
  13179. __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
  13180. __Pyx_XGOTREF(__pyx_t_11);
  13181. __Pyx_XGOTREF(__pyx_t_10);
  13182. __Pyx_XGOTREF(__pyx_t_9);
  13183. /*try:*/ {
  13184. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":911
  13185. * # Delete spo:c entry.
  13186. * try:
  13187. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  13188. * dcur, &spok_v, &ck_v, lmdb.MDB_GET_BOTH))
  13189. * except KeyNotFoundError:
  13190. */
  13191. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_dcur, (&__pyx_v_spok_v), (&__pyx_v_ck_v), MDB_GET_BOTH), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 911, __pyx_L18_error)
  13192. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":910
  13193. * spok_v.mv_data = spok
  13194. * # Delete spo:c entry.
  13195. * try: # <<<<<<<<<<<<<<
  13196. * _check(lmdb.mdb_cursor_get(
  13197. * dcur, &spok_v, &ck_v, lmdb.MDB_GET_BOTH))
  13198. */
  13199. }
  13200. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":916
  13201. * pass
  13202. * else:
  13203. * _check(lmdb.mdb_cursor_del(dcur, 0)) # <<<<<<<<<<<<<<
  13204. *
  13205. * # Restore ck after delete.
  13206. */
  13207. /*else:*/ {
  13208. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_del(__pyx_v_dcur, 0), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 916, __pyx_L20_except_error)
  13209. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":919
  13210. *
  13211. * # Restore ck after delete.
  13212. * ck_v.mv_data = ck # <<<<<<<<<<<<<<
  13213. *
  13214. * # Delete c:spo entry.
  13215. */
  13216. __pyx_v_ck_v.mv_data = __pyx_v_ck;
  13217. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":922
  13218. *
  13219. * # Delete c:spo entry.
  13220. * try: # <<<<<<<<<<<<<<
  13221. * _check(lmdb.mdb_cursor_get(
  13222. * icur, &ck_v, &spok_v, lmdb.MDB_GET_BOTH))
  13223. */
  13224. {
  13225. __Pyx_PyThreadState_declare
  13226. __Pyx_PyThreadState_assign
  13227. __Pyx_ExceptionSave(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
  13228. __Pyx_XGOTREF(__pyx_t_15);
  13229. __Pyx_XGOTREF(__pyx_t_16);
  13230. __Pyx_XGOTREF(__pyx_t_17);
  13231. /*try:*/ {
  13232. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":923
  13233. * # Delete c:spo entry.
  13234. * try:
  13235. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  13236. * icur, &ck_v, &spok_v, lmdb.MDB_GET_BOTH))
  13237. * except KeyNotFoundError:
  13238. */
  13239. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_icur, (&__pyx_v_ck_v), (&__pyx_v_spok_v), MDB_GET_BOTH), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 923, __pyx_L26_error)
  13240. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":922
  13241. *
  13242. * # Delete c:spo entry.
  13243. * try: # <<<<<<<<<<<<<<
  13244. * _check(lmdb.mdb_cursor_get(
  13245. * icur, &ck_v, &spok_v, lmdb.MDB_GET_BOTH))
  13246. */
  13247. }
  13248. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":928
  13249. * pass
  13250. * else:
  13251. * _check(lmdb.mdb_cursor_del(icur, 0)) # <<<<<<<<<<<<<<
  13252. *
  13253. * # Delete lookup indices, only if no other context
  13254. */
  13255. /*else:*/ {
  13256. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_del(__pyx_v_icur, 0), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 928, __pyx_L28_except_error)
  13257. }
  13258. __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
  13259. __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
  13260. __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
  13261. goto __pyx_L33_try_end;
  13262. __pyx_L26_error:;
  13263. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  13264. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  13265. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  13266. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  13267. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  13268. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":925
  13269. * _check(lmdb.mdb_cursor_get(
  13270. * icur, &ck_v, &spok_v, lmdb.MDB_GET_BOTH))
  13271. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  13272. * pass
  13273. * else:
  13274. */
  13275. __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  13276. __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 925, __pyx_L28_except_error)
  13277. __Pyx_GOTREF(__pyx_t_6);
  13278. __pyx_t_5 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
  13279. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  13280. __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  13281. __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0;
  13282. if (__pyx_t_5) {
  13283. __Pyx_ErrRestore(0,0,0);
  13284. goto __pyx_L27_exception_handled;
  13285. }
  13286. goto __pyx_L28_except_error;
  13287. __pyx_L28_except_error:;
  13288. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":922
  13289. *
  13290. * # Delete c:spo entry.
  13291. * try: # <<<<<<<<<<<<<<
  13292. * _check(lmdb.mdb_cursor_get(
  13293. * icur, &ck_v, &spok_v, lmdb.MDB_GET_BOTH))
  13294. */
  13295. __Pyx_XGIVEREF(__pyx_t_15);
  13296. __Pyx_XGIVEREF(__pyx_t_16);
  13297. __Pyx_XGIVEREF(__pyx_t_17);
  13298. __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
  13299. goto __pyx_L20_except_error;
  13300. __pyx_L27_exception_handled:;
  13301. __Pyx_XGIVEREF(__pyx_t_15);
  13302. __Pyx_XGIVEREF(__pyx_t_16);
  13303. __Pyx_XGIVEREF(__pyx_t_17);
  13304. __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
  13305. __pyx_L33_try_end:;
  13306. }
  13307. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":932
  13308. * # Delete lookup indices, only if no other context
  13309. * # association is present.
  13310. * spok_v.mv_data = spok # <<<<<<<<<<<<<<
  13311. * try:
  13312. * _check(lmdb.mdb_cursor_get(
  13313. */
  13314. __pyx_v_spok_v.mv_data = __pyx_v_spok;
  13315. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":933
  13316. * # association is present.
  13317. * spok_v.mv_data = spok
  13318. * try: # <<<<<<<<<<<<<<
  13319. * _check(lmdb.mdb_cursor_get(
  13320. * dcur, &spok_v, NULL, lmdb.MDB_SET))
  13321. */
  13322. {
  13323. __Pyx_PyThreadState_declare
  13324. __Pyx_PyThreadState_assign
  13325. __Pyx_ExceptionSave(&__pyx_t_17, &__pyx_t_16, &__pyx_t_15);
  13326. __Pyx_XGOTREF(__pyx_t_17);
  13327. __Pyx_XGOTREF(__pyx_t_16);
  13328. __Pyx_XGOTREF(__pyx_t_15);
  13329. /*try:*/ {
  13330. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":934
  13331. * spok_v.mv_data = spok
  13332. * try:
  13333. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  13334. * dcur, &spok_v, NULL, lmdb.MDB_SET))
  13335. * except KeyNotFoundError:
  13336. */
  13337. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_dcur, (&__pyx_v_spok_v), NULL, MDB_SET), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 934, __pyx_L34_error)
  13338. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":933
  13339. * # association is present.
  13340. * spok_v.mv_data = spok
  13341. * try: # <<<<<<<<<<<<<<
  13342. * _check(lmdb.mdb_cursor_get(
  13343. * dcur, &spok_v, NULL, lmdb.MDB_SET))
  13344. */
  13345. }
  13346. __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
  13347. __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
  13348. __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
  13349. goto __pyx_L41_try_end;
  13350. __pyx_L34_error:;
  13351. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  13352. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  13353. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  13354. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  13355. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  13356. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":936
  13357. * _check(lmdb.mdb_cursor_get(
  13358. * dcur, &spok_v, NULL, lmdb.MDB_SET))
  13359. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  13360. * self._index_triple(IDX_OP_REMOVE, spok)
  13361. * i += 1
  13362. */
  13363. __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
  13364. __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 936, __pyx_L36_except_error)
  13365. __Pyx_GOTREF(__pyx_t_6);
  13366. __pyx_t_5 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_3, __pyx_t_6);
  13367. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  13368. __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_1);
  13369. __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0;
  13370. if (__pyx_t_5) {
  13371. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  13372. if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 936, __pyx_L36_except_error)
  13373. __Pyx_GOTREF(__pyx_t_1);
  13374. __Pyx_GOTREF(__pyx_t_2);
  13375. __Pyx_GOTREF(__pyx_t_3);
  13376. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":937
  13377. * dcur, &spok_v, NULL, lmdb.MDB_SET))
  13378. * except KeyNotFoundError:
  13379. * self._index_triple(IDX_OP_REMOVE, spok) # <<<<<<<<<<<<<<
  13380. * i += 1
  13381. *
  13382. */
  13383. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->_index_triple(__pyx_v_self, __pyx_n_u_idx_remove, __pyx_v_spok); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 937, __pyx_L36_except_error)
  13384. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13385. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13386. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13387. goto __pyx_L35_exception_handled;
  13388. }
  13389. goto __pyx_L36_except_error;
  13390. __pyx_L36_except_error:;
  13391. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":933
  13392. * # association is present.
  13393. * spok_v.mv_data = spok
  13394. * try: # <<<<<<<<<<<<<<
  13395. * _check(lmdb.mdb_cursor_get(
  13396. * dcur, &spok_v, NULL, lmdb.MDB_SET))
  13397. */
  13398. __Pyx_XGIVEREF(__pyx_t_17);
  13399. __Pyx_XGIVEREF(__pyx_t_16);
  13400. __Pyx_XGIVEREF(__pyx_t_15);
  13401. __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_16, __pyx_t_15);
  13402. goto __pyx_L20_except_error;
  13403. __pyx_L35_exception_handled:;
  13404. __Pyx_XGIVEREF(__pyx_t_17);
  13405. __Pyx_XGIVEREF(__pyx_t_16);
  13406. __Pyx_XGIVEREF(__pyx_t_15);
  13407. __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_16, __pyx_t_15);
  13408. __pyx_L41_try_end:;
  13409. }
  13410. }
  13411. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  13412. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  13413. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  13414. goto __pyx_L25_try_end;
  13415. __pyx_L18_error:;
  13416. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  13417. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  13418. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  13419. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  13420. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  13421. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":913
  13422. * _check(lmdb.mdb_cursor_get(
  13423. * dcur, &spok_v, &ck_v, lmdb.MDB_GET_BOTH))
  13424. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  13425. * pass
  13426. * else:
  13427. */
  13428. __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
  13429. __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 913, __pyx_L20_except_error)
  13430. __Pyx_GOTREF(__pyx_t_6);
  13431. __pyx_t_5 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_3, __pyx_t_6);
  13432. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  13433. __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_1);
  13434. __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0;
  13435. if (__pyx_t_5) {
  13436. __Pyx_ErrRestore(0,0,0);
  13437. goto __pyx_L19_exception_handled;
  13438. }
  13439. goto __pyx_L20_except_error;
  13440. __pyx_L20_except_error:;
  13441. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":910
  13442. * spok_v.mv_data = spok
  13443. * # Delete spo:c entry.
  13444. * try: # <<<<<<<<<<<<<<
  13445. * _check(lmdb.mdb_cursor_get(
  13446. * dcur, &spok_v, &ck_v, lmdb.MDB_GET_BOTH))
  13447. */
  13448. __Pyx_XGIVEREF(__pyx_t_11);
  13449. __Pyx_XGIVEREF(__pyx_t_10);
  13450. __Pyx_XGIVEREF(__pyx_t_9);
  13451. __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
  13452. goto __pyx_L13_error;
  13453. __pyx_L19_exception_handled:;
  13454. __Pyx_XGIVEREF(__pyx_t_11);
  13455. __Pyx_XGIVEREF(__pyx_t_10);
  13456. __Pyx_XGIVEREF(__pyx_t_9);
  13457. __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
  13458. __pyx_L25_try_end:;
  13459. }
  13460. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":938
  13461. * except KeyNotFoundError:
  13462. * self._index_triple(IDX_OP_REMOVE, spok)
  13463. * i += 1 # <<<<<<<<<<<<<<
  13464. *
  13465. * # If no context is specified, remove all associations.
  13466. */
  13467. __pyx_v_i = (__pyx_v_i + 1);
  13468. }
  13469. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":900
  13470. * spok_v.mv_size = TRP_KLEN
  13471. * # If context was specified, remove only associations with that context.
  13472. * if context is not None: # <<<<<<<<<<<<<<
  13473. * #logger.debug('Removing triples in matching context.')
  13474. * ck_v.mv_data = ck
  13475. */
  13476. goto __pyx_L15;
  13477. }
  13478. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":944
  13479. * #logger.debug('Removing triples in all contexts.')
  13480. * # Loop over all SPO matching the triple pattern.
  13481. * while i < match_set.ct: # <<<<<<<<<<<<<<
  13482. * spok = match_set.data + match_set.itemsize * i
  13483. * spok_v.mv_data = spok
  13484. */
  13485. /*else*/ {
  13486. while (1) {
  13487. __pyx_t_7 = ((__pyx_v_i < __pyx_v_match_set->ct) != 0);
  13488. if (!__pyx_t_7) break;
  13489. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":945
  13490. * # Loop over all SPO matching the triple pattern.
  13491. * while i < match_set.ct:
  13492. * spok = match_set.data + match_set.itemsize * i # <<<<<<<<<<<<<<
  13493. * spok_v.mv_data = spok
  13494. * # Loop over all context associations for this SPO.
  13495. */
  13496. memcpy(&(__pyx_v_spok[0]), (__pyx_v_match_set->data + (__pyx_v_match_set->itemsize * __pyx_v_i)), sizeof(__pyx_v_spok[0]) * (15 - 0));
  13497. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":946
  13498. * while i < match_set.ct:
  13499. * spok = match_set.data + match_set.itemsize * i
  13500. * spok_v.mv_data = spok # <<<<<<<<<<<<<<
  13501. * # Loop over all context associations for this SPO.
  13502. * try:
  13503. */
  13504. __pyx_v_spok_v.mv_data = __pyx_v_spok;
  13505. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":948
  13506. * spok_v.mv_data = spok
  13507. * # Loop over all context associations for this SPO.
  13508. * try: # <<<<<<<<<<<<<<
  13509. * _check(lmdb.mdb_cursor_get(
  13510. * dcur, &spok_v, &ck_v, lmdb.MDB_SET_KEY))
  13511. */
  13512. /*try:*/ {
  13513. {
  13514. __Pyx_PyThreadState_declare
  13515. __Pyx_PyThreadState_assign
  13516. __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
  13517. __Pyx_XGOTREF(__pyx_t_9);
  13518. __Pyx_XGOTREF(__pyx_t_10);
  13519. __Pyx_XGOTREF(__pyx_t_11);
  13520. /*try:*/ {
  13521. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":949
  13522. * # Loop over all context associations for this SPO.
  13523. * try:
  13524. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  13525. * dcur, &spok_v, &ck_v, lmdb.MDB_SET_KEY))
  13526. * except KeyNotFoundError:
  13527. */
  13528. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_dcur, (&__pyx_v_spok_v), (&__pyx_v_ck_v), MDB_SET_KEY), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 949, __pyx_L51_error)
  13529. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":948
  13530. * spok_v.mv_data = spok
  13531. * # Loop over all context associations for this SPO.
  13532. * try: # <<<<<<<<<<<<<<
  13533. * _check(lmdb.mdb_cursor_get(
  13534. * dcur, &spok_v, &ck_v, lmdb.MDB_SET_KEY))
  13535. */
  13536. }
  13537. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":955
  13538. * continue
  13539. * else:
  13540. * ck = <Key>ck_v.mv_data # <<<<<<<<<<<<<<
  13541. * logger.debug(f'Removing {spok[: TRP_KLEN]} from main.')
  13542. * while True:
  13543. */
  13544. /*else:*/ {
  13545. memcpy(&(__pyx_v_ck[0]), ((unsigned char *)__pyx_v_ck_v.mv_data), sizeof(__pyx_v_ck[0]) * (5));
  13546. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":956
  13547. * else:
  13548. * ck = <Key>ck_v.mv_data
  13549. * logger.debug(f'Removing {spok[: TRP_KLEN]} from main.') # <<<<<<<<<<<<<<
  13550. * while True:
  13551. *
  13552. */
  13553. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 956, __pyx_L53_except_error)
  13554. __Pyx_GOTREF(__pyx_t_2);
  13555. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 956, __pyx_L53_except_error)
  13556. __Pyx_GOTREF(__pyx_t_3);
  13557. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13558. __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 956, __pyx_L53_except_error)
  13559. __Pyx_GOTREF(__pyx_t_2);
  13560. __pyx_t_18 = 0;
  13561. __pyx_t_19 = 127;
  13562. __Pyx_INCREF(__pyx_kp_u_Removing);
  13563. __pyx_t_18 += 9;
  13564. __Pyx_GIVEREF(__pyx_kp_u_Removing);
  13565. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_Removing);
  13566. __pyx_t_6 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_spok) + 0, 15 - 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 956, __pyx_L53_except_error)
  13567. __Pyx_GOTREF(__pyx_t_6);
  13568. __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_6, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 956, __pyx_L53_except_error)
  13569. __Pyx_GOTREF(__pyx_t_4);
  13570. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  13571. __pyx_t_19 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_19) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_19;
  13572. __pyx_t_18 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  13573. __Pyx_GIVEREF(__pyx_t_4);
  13574. PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
  13575. __pyx_t_4 = 0;
  13576. __Pyx_INCREF(__pyx_kp_u_from_main);
  13577. __pyx_t_18 += 11;
  13578. __Pyx_GIVEREF(__pyx_kp_u_from_main);
  13579. PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_from_main);
  13580. __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_2, 3, __pyx_t_18, __pyx_t_19); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 956, __pyx_L53_except_error)
  13581. __Pyx_GOTREF(__pyx_t_4);
  13582. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13583. __pyx_t_2 = NULL;
  13584. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  13585. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  13586. if (likely(__pyx_t_2)) {
  13587. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  13588. __Pyx_INCREF(__pyx_t_2);
  13589. __Pyx_INCREF(function);
  13590. __Pyx_DECREF_SET(__pyx_t_3, function);
  13591. }
  13592. }
  13593. if (!__pyx_t_2) {
  13594. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 956, __pyx_L53_except_error)
  13595. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  13596. __Pyx_GOTREF(__pyx_t_1);
  13597. } else {
  13598. #if CYTHON_FAST_PYCALL
  13599. if (PyFunction_Check(__pyx_t_3)) {
  13600. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
  13601. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 956, __pyx_L53_except_error)
  13602. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  13603. __Pyx_GOTREF(__pyx_t_1);
  13604. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  13605. } else
  13606. #endif
  13607. #if CYTHON_FAST_PYCCALL
  13608. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  13609. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
  13610. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 956, __pyx_L53_except_error)
  13611. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  13612. __Pyx_GOTREF(__pyx_t_1);
  13613. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  13614. } else
  13615. #endif
  13616. {
  13617. __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 956, __pyx_L53_except_error)
  13618. __Pyx_GOTREF(__pyx_t_6);
  13619. __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL;
  13620. __Pyx_GIVEREF(__pyx_t_4);
  13621. PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
  13622. __pyx_t_4 = 0;
  13623. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 956, __pyx_L53_except_error)
  13624. __Pyx_GOTREF(__pyx_t_1);
  13625. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  13626. }
  13627. }
  13628. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13629. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13630. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":957
  13631. * ck = <Key>ck_v.mv_data
  13632. * logger.debug(f'Removing {spok[: TRP_KLEN]} from main.')
  13633. * while True: # <<<<<<<<<<<<<<
  13634. *
  13635. * # Delete c:spo association.
  13636. */
  13637. while (1) {
  13638. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":960
  13639. *
  13640. * # Delete c:spo association.
  13641. * try: # <<<<<<<<<<<<<<
  13642. * _check(lmdb.mdb_cursor_get(
  13643. * icur, &ck_v, &spok_v, lmdb.MDB_GET_BOTH))
  13644. */
  13645. {
  13646. __Pyx_PyThreadState_declare
  13647. __Pyx_PyThreadState_assign
  13648. __Pyx_ExceptionSave(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
  13649. __Pyx_XGOTREF(__pyx_t_15);
  13650. __Pyx_XGOTREF(__pyx_t_16);
  13651. __Pyx_XGOTREF(__pyx_t_17);
  13652. /*try:*/ {
  13653. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":961
  13654. * # Delete c:spo association.
  13655. * try:
  13656. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  13657. * icur, &ck_v, &spok_v, lmdb.MDB_GET_BOTH))
  13658. * except KeyNotFoundError:
  13659. */
  13660. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_icur, (&__pyx_v_ck_v), (&__pyx_v_spok_v), MDB_GET_BOTH), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 961, __pyx_L61_error)
  13661. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":960
  13662. *
  13663. * # Delete c:spo association.
  13664. * try: # <<<<<<<<<<<<<<
  13665. * _check(lmdb.mdb_cursor_get(
  13666. * icur, &ck_v, &spok_v, lmdb.MDB_GET_BOTH))
  13667. */
  13668. }
  13669. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":966
  13670. * pass
  13671. * else:
  13672. * lmdb.mdb_cursor_del(icur, 0) # <<<<<<<<<<<<<<
  13673. * # Restore the pointer to the deleted SPO.
  13674. * spok_v.mv_data = spok
  13675. */
  13676. /*else:*/ {
  13677. (void)(mdb_cursor_del(__pyx_v_icur, 0));
  13678. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":968
  13679. * lmdb.mdb_cursor_del(icur, 0)
  13680. * # Restore the pointer to the deleted SPO.
  13681. * spok_v.mv_data = spok # <<<<<<<<<<<<<<
  13682. * # Move on to next associated context.
  13683. * try:
  13684. */
  13685. __pyx_v_spok_v.mv_data = __pyx_v_spok;
  13686. }
  13687. __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
  13688. __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
  13689. __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
  13690. goto __pyx_L68_try_end;
  13691. __pyx_L61_error:;
  13692. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  13693. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  13694. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  13695. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  13696. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  13697. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":963
  13698. * _check(lmdb.mdb_cursor_get(
  13699. * icur, &ck_v, &spok_v, lmdb.MDB_GET_BOTH))
  13700. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  13701. * pass
  13702. * else:
  13703. */
  13704. __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_3, &__pyx_t_6);
  13705. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 963, __pyx_L63_except_error)
  13706. __Pyx_GOTREF(__pyx_t_4);
  13707. __pyx_t_5 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_4);
  13708. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  13709. __Pyx_ErrRestore(__pyx_t_1, __pyx_t_3, __pyx_t_6);
  13710. __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_6 = 0;
  13711. if (__pyx_t_5) {
  13712. __Pyx_ErrRestore(0,0,0);
  13713. goto __pyx_L62_exception_handled;
  13714. }
  13715. goto __pyx_L63_except_error;
  13716. __pyx_L63_except_error:;
  13717. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":960
  13718. *
  13719. * # Delete c:spo association.
  13720. * try: # <<<<<<<<<<<<<<
  13721. * _check(lmdb.mdb_cursor_get(
  13722. * icur, &ck_v, &spok_v, lmdb.MDB_GET_BOTH))
  13723. */
  13724. __Pyx_XGIVEREF(__pyx_t_15);
  13725. __Pyx_XGIVEREF(__pyx_t_16);
  13726. __Pyx_XGIVEREF(__pyx_t_17);
  13727. __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
  13728. goto __pyx_L53_except_error;
  13729. __pyx_L62_exception_handled:;
  13730. __Pyx_XGIVEREF(__pyx_t_15);
  13731. __Pyx_XGIVEREF(__pyx_t_16);
  13732. __Pyx_XGIVEREF(__pyx_t_17);
  13733. __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
  13734. __pyx_L68_try_end:;
  13735. }
  13736. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":970
  13737. * spok_v.mv_data = spok
  13738. * # Move on to next associated context.
  13739. * try: # <<<<<<<<<<<<<<
  13740. * _check(lmdb.mdb_cursor_get(
  13741. * dcur, &spok_v, &ck_v, lmdb.MDB_NEXT_DUP))
  13742. */
  13743. {
  13744. __Pyx_PyThreadState_declare
  13745. __Pyx_PyThreadState_assign
  13746. __Pyx_ExceptionSave(&__pyx_t_17, &__pyx_t_16, &__pyx_t_15);
  13747. __Pyx_XGOTREF(__pyx_t_17);
  13748. __Pyx_XGOTREF(__pyx_t_16);
  13749. __Pyx_XGOTREF(__pyx_t_15);
  13750. /*try:*/ {
  13751. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":971
  13752. * # Move on to next associated context.
  13753. * try:
  13754. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  13755. * dcur, &spok_v, &ck_v, lmdb.MDB_NEXT_DUP))
  13756. * except KeyNotFoundError:
  13757. */
  13758. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_dcur, (&__pyx_v_spok_v), (&__pyx_v_ck_v), MDB_NEXT_DUP), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 971, __pyx_L69_error)
  13759. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":970
  13760. * spok_v.mv_data = spok
  13761. * # Move on to next associated context.
  13762. * try: # <<<<<<<<<<<<<<
  13763. * _check(lmdb.mdb_cursor_get(
  13764. * dcur, &spok_v, &ck_v, lmdb.MDB_NEXT_DUP))
  13765. */
  13766. }
  13767. __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
  13768. __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
  13769. __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
  13770. goto __pyx_L76_try_end;
  13771. __pyx_L69_error:;
  13772. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  13773. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  13774. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  13775. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  13776. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  13777. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":973
  13778. * _check(lmdb.mdb_cursor_get(
  13779. * dcur, &spok_v, &ck_v, lmdb.MDB_NEXT_DUP))
  13780. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  13781. * break
  13782. * # Then delete the spo:c association.
  13783. */
  13784. __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_3, &__pyx_t_1);
  13785. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 973, __pyx_L71_except_error)
  13786. __Pyx_GOTREF(__pyx_t_4);
  13787. __pyx_t_5 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_6, __pyx_t_4);
  13788. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  13789. __Pyx_ErrRestore(__pyx_t_6, __pyx_t_3, __pyx_t_1);
  13790. __pyx_t_6 = 0; __pyx_t_3 = 0; __pyx_t_1 = 0;
  13791. if (__pyx_t_5) {
  13792. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  13793. if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_6) < 0) __PYX_ERR(0, 973, __pyx_L71_except_error)
  13794. __Pyx_GOTREF(__pyx_t_1);
  13795. __Pyx_GOTREF(__pyx_t_3);
  13796. __Pyx_GOTREF(__pyx_t_6);
  13797. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":974
  13798. * dcur, &spok_v, &ck_v, lmdb.MDB_NEXT_DUP))
  13799. * except KeyNotFoundError:
  13800. * break # <<<<<<<<<<<<<<
  13801. * # Then delete the spo:c association.
  13802. * try:
  13803. */
  13804. goto __pyx_L77_except_break;
  13805. __pyx_L77_except_break:;
  13806. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13807. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13808. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  13809. goto __pyx_L74_try_break;
  13810. }
  13811. goto __pyx_L71_except_error;
  13812. __pyx_L71_except_error:;
  13813. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":970
  13814. * spok_v.mv_data = spok
  13815. * # Move on to next associated context.
  13816. * try: # <<<<<<<<<<<<<<
  13817. * _check(lmdb.mdb_cursor_get(
  13818. * dcur, &spok_v, &ck_v, lmdb.MDB_NEXT_DUP))
  13819. */
  13820. __Pyx_XGIVEREF(__pyx_t_17);
  13821. __Pyx_XGIVEREF(__pyx_t_16);
  13822. __Pyx_XGIVEREF(__pyx_t_15);
  13823. __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_16, __pyx_t_15);
  13824. goto __pyx_L53_except_error;
  13825. __pyx_L74_try_break:;
  13826. __Pyx_XGIVEREF(__pyx_t_17);
  13827. __Pyx_XGIVEREF(__pyx_t_16);
  13828. __Pyx_XGIVEREF(__pyx_t_15);
  13829. __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_16, __pyx_t_15);
  13830. goto __pyx_L60_break;
  13831. __pyx_L76_try_end:;
  13832. }
  13833. }
  13834. __pyx_L60_break:;
  13835. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":976
  13836. * break
  13837. * # Then delete the spo:c association.
  13838. * try: # <<<<<<<<<<<<<<
  13839. * _check(lmdb.mdb_cursor_get(
  13840. * dcur, &spok_v, &ck_v, lmdb.MDB_SET))
  13841. */
  13842. {
  13843. __Pyx_PyThreadState_declare
  13844. __Pyx_PyThreadState_assign
  13845. __Pyx_ExceptionSave(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
  13846. __Pyx_XGOTREF(__pyx_t_15);
  13847. __Pyx_XGOTREF(__pyx_t_16);
  13848. __Pyx_XGOTREF(__pyx_t_17);
  13849. /*try:*/ {
  13850. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":977
  13851. * # Then delete the spo:c association.
  13852. * try:
  13853. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  13854. * dcur, &spok_v, &ck_v, lmdb.MDB_SET))
  13855. * except KeyNotFoundError:
  13856. */
  13857. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_dcur, (&__pyx_v_spok_v), (&__pyx_v_ck_v), MDB_SET), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 977, __pyx_L79_error)
  13858. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":976
  13859. * break
  13860. * # Then delete the spo:c association.
  13861. * try: # <<<<<<<<<<<<<<
  13862. * _check(lmdb.mdb_cursor_get(
  13863. * dcur, &spok_v, &ck_v, lmdb.MDB_SET))
  13864. */
  13865. }
  13866. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":982
  13867. * pass
  13868. * else:
  13869. * lmdb.mdb_cursor_del(dcur, lmdb.MDB_NODUPDATA) # <<<<<<<<<<<<<<
  13870. * self._index_triple(IDX_OP_REMOVE, spok)
  13871. * #ck_v.mv_data = ck # Unnecessary?
  13872. */
  13873. /*else:*/ {
  13874. (void)(mdb_cursor_del(__pyx_v_dcur, MDB_NODUPDATA));
  13875. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":983
  13876. * else:
  13877. * lmdb.mdb_cursor_del(dcur, lmdb.MDB_NODUPDATA)
  13878. * self._index_triple(IDX_OP_REMOVE, spok) # <<<<<<<<<<<<<<
  13879. * #ck_v.mv_data = ck # Unnecessary?
  13880. * finally:
  13881. */
  13882. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->_index_triple(__pyx_v_self, __pyx_n_u_idx_remove, __pyx_v_spok); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 983, __pyx_L81_except_error)
  13883. }
  13884. __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
  13885. __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
  13886. __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
  13887. goto __pyx_L86_try_end;
  13888. __pyx_L79_error:;
  13889. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  13890. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  13891. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  13892. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  13893. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  13894. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":979
  13895. * _check(lmdb.mdb_cursor_get(
  13896. * dcur, &spok_v, &ck_v, lmdb.MDB_SET))
  13897. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  13898. * pass
  13899. * else:
  13900. */
  13901. __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_3, &__pyx_t_1);
  13902. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 979, __pyx_L81_except_error)
  13903. __Pyx_GOTREF(__pyx_t_4);
  13904. __pyx_t_5 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_6, __pyx_t_4);
  13905. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  13906. __Pyx_ErrRestore(__pyx_t_6, __pyx_t_3, __pyx_t_1);
  13907. __pyx_t_6 = 0; __pyx_t_3 = 0; __pyx_t_1 = 0;
  13908. if (__pyx_t_5) {
  13909. __Pyx_ErrRestore(0,0,0);
  13910. goto __pyx_L80_exception_handled;
  13911. }
  13912. goto __pyx_L81_except_error;
  13913. __pyx_L81_except_error:;
  13914. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":976
  13915. * break
  13916. * # Then delete the spo:c association.
  13917. * try: # <<<<<<<<<<<<<<
  13918. * _check(lmdb.mdb_cursor_get(
  13919. * dcur, &spok_v, &ck_v, lmdb.MDB_SET))
  13920. */
  13921. __Pyx_XGIVEREF(__pyx_t_15);
  13922. __Pyx_XGIVEREF(__pyx_t_16);
  13923. __Pyx_XGIVEREF(__pyx_t_17);
  13924. __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
  13925. goto __pyx_L53_except_error;
  13926. __pyx_L80_exception_handled:;
  13927. __Pyx_XGIVEREF(__pyx_t_15);
  13928. __Pyx_XGIVEREF(__pyx_t_16);
  13929. __Pyx_XGIVEREF(__pyx_t_17);
  13930. __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
  13931. __pyx_L86_try_end:;
  13932. }
  13933. }
  13934. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  13935. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  13936. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  13937. goto __pyx_L58_try_end;
  13938. __pyx_L51_error:;
  13939. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  13940. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  13941. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  13942. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  13943. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  13944. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":951
  13945. * _check(lmdb.mdb_cursor_get(
  13946. * dcur, &spok_v, &ck_v, lmdb.MDB_SET_KEY))
  13947. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  13948. * # Move on to the next SPO.
  13949. * continue
  13950. */
  13951. __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_3, &__pyx_t_6);
  13952. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 951, __pyx_L53_except_error)
  13953. __Pyx_GOTREF(__pyx_t_4);
  13954. __pyx_t_5 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_4);
  13955. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  13956. __Pyx_ErrRestore(__pyx_t_1, __pyx_t_3, __pyx_t_6);
  13957. __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_6 = 0;
  13958. if (__pyx_t_5) {
  13959. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  13960. if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_3, &__pyx_t_1) < 0) __PYX_ERR(0, 951, __pyx_L53_except_error)
  13961. __Pyx_GOTREF(__pyx_t_6);
  13962. __Pyx_GOTREF(__pyx_t_3);
  13963. __Pyx_GOTREF(__pyx_t_1);
  13964. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":953
  13965. * except KeyNotFoundError:
  13966. * # Move on to the next SPO.
  13967. * continue # <<<<<<<<<<<<<<
  13968. * else:
  13969. * ck = <Key>ck_v.mv_data
  13970. */
  13971. goto __pyx_L88_except_continue;
  13972. __pyx_L88_except_continue:;
  13973. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  13974. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13975. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13976. goto __pyx_L57_try_continue;
  13977. }
  13978. goto __pyx_L53_except_error;
  13979. __pyx_L53_except_error:;
  13980. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":948
  13981. * spok_v.mv_data = spok
  13982. * # Loop over all context associations for this SPO.
  13983. * try: # <<<<<<<<<<<<<<
  13984. * _check(lmdb.mdb_cursor_get(
  13985. * dcur, &spok_v, &ck_v, lmdb.MDB_SET_KEY))
  13986. */
  13987. __Pyx_XGIVEREF(__pyx_t_9);
  13988. __Pyx_XGIVEREF(__pyx_t_10);
  13989. __Pyx_XGIVEREF(__pyx_t_11);
  13990. __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
  13991. goto __pyx_L49_error;
  13992. __pyx_L57_try_continue:;
  13993. __Pyx_XGIVEREF(__pyx_t_9);
  13994. __Pyx_XGIVEREF(__pyx_t_10);
  13995. __Pyx_XGIVEREF(__pyx_t_11);
  13996. __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
  13997. goto __pyx_L46_continue;
  13998. __pyx_L58_try_end:;
  13999. }
  14000. }
  14001. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":986
  14002. * #ck_v.mv_data = ck # Unnecessary?
  14003. * finally:
  14004. * i += 1 # <<<<<<<<<<<<<<
  14005. *
  14006. * finally:
  14007. */
  14008. /*finally:*/ {
  14009. /*normal exit:*/{
  14010. __pyx_v_i = (__pyx_v_i + 1);
  14011. goto __pyx_L50;
  14012. }
  14013. __pyx_L49_error:;
  14014. /*exception exit:*/{
  14015. __Pyx_PyThreadState_declare
  14016. __Pyx_PyThreadState_assign
  14017. __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_17 = 0; __pyx_t_16 = 0; __pyx_t_15 = 0;
  14018. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  14019. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  14020. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  14021. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  14022. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  14023. if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_17, &__pyx_t_16, &__pyx_t_15);
  14024. if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
  14025. __Pyx_XGOTREF(__pyx_t_11);
  14026. __Pyx_XGOTREF(__pyx_t_10);
  14027. __Pyx_XGOTREF(__pyx_t_9);
  14028. __Pyx_XGOTREF(__pyx_t_17);
  14029. __Pyx_XGOTREF(__pyx_t_16);
  14030. __Pyx_XGOTREF(__pyx_t_15);
  14031. __pyx_t_5 = __pyx_lineno; __pyx_t_20 = __pyx_clineno; __pyx_t_21 = __pyx_filename;
  14032. {
  14033. __pyx_v_i = (__pyx_v_i + 1);
  14034. }
  14035. if (PY_MAJOR_VERSION >= 3) {
  14036. __Pyx_XGIVEREF(__pyx_t_17);
  14037. __Pyx_XGIVEREF(__pyx_t_16);
  14038. __Pyx_XGIVEREF(__pyx_t_15);
  14039. __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_16, __pyx_t_15);
  14040. }
  14041. __Pyx_XGIVEREF(__pyx_t_11);
  14042. __Pyx_XGIVEREF(__pyx_t_10);
  14043. __Pyx_XGIVEREF(__pyx_t_9);
  14044. __Pyx_ErrRestore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
  14045. __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_17 = 0; __pyx_t_16 = 0; __pyx_t_15 = 0;
  14046. __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_20; __pyx_filename = __pyx_t_21;
  14047. goto __pyx_L13_error;
  14048. }
  14049. __pyx_L46_continue: {
  14050. __pyx_v_i = (__pyx_v_i + 1);
  14051. goto __pyx_L44_continue;
  14052. }
  14053. __pyx_L50:;
  14054. }
  14055. __pyx_L44_continue:;
  14056. }
  14057. }
  14058. __pyx_L15:;
  14059. }
  14060. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":991
  14061. * #pass
  14062. * #logger.debug('Closing spo:c in _remove.')
  14063. * self._cur_close(dcur) # <<<<<<<<<<<<<<
  14064. * #logger.debug('Closing c:spo in _remove.')
  14065. * self._cur_close(icur)
  14066. */
  14067. /*finally:*/ {
  14068. /*normal exit:*/{
  14069. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_dcur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 991, __pyx_L1_error)
  14070. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":993
  14071. * self._cur_close(dcur)
  14072. * #logger.debug('Closing c:spo in _remove.')
  14073. * self._cur_close(icur) # <<<<<<<<<<<<<<
  14074. *
  14075. *
  14076. */
  14077. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_icur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 993, __pyx_L1_error)
  14078. goto __pyx_L14;
  14079. }
  14080. __pyx_L13_error:;
  14081. /*exception exit:*/{
  14082. __Pyx_PyThreadState_declare
  14083. __Pyx_PyThreadState_assign
  14084. __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
  14085. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  14086. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  14087. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  14088. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  14089. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  14090. if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
  14091. if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17) < 0)) __Pyx_ErrFetch(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
  14092. __Pyx_XGOTREF(__pyx_t_15);
  14093. __Pyx_XGOTREF(__pyx_t_16);
  14094. __Pyx_XGOTREF(__pyx_t_17);
  14095. __Pyx_XGOTREF(__pyx_t_9);
  14096. __Pyx_XGOTREF(__pyx_t_10);
  14097. __Pyx_XGOTREF(__pyx_t_11);
  14098. __pyx_t_20 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_22 = __pyx_filename;
  14099. {
  14100. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":991
  14101. * #pass
  14102. * #logger.debug('Closing spo:c in _remove.')
  14103. * self._cur_close(dcur) # <<<<<<<<<<<<<<
  14104. * #logger.debug('Closing c:spo in _remove.')
  14105. * self._cur_close(icur)
  14106. */
  14107. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_dcur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 991, __pyx_L94_error)
  14108. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":993
  14109. * self._cur_close(dcur)
  14110. * #logger.debug('Closing c:spo in _remove.')
  14111. * self._cur_close(icur) # <<<<<<<<<<<<<<
  14112. *
  14113. *
  14114. */
  14115. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_icur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 993, __pyx_L94_error)
  14116. }
  14117. if (PY_MAJOR_VERSION >= 3) {
  14118. __Pyx_XGIVEREF(__pyx_t_9);
  14119. __Pyx_XGIVEREF(__pyx_t_10);
  14120. __Pyx_XGIVEREF(__pyx_t_11);
  14121. __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
  14122. }
  14123. __Pyx_XGIVEREF(__pyx_t_15);
  14124. __Pyx_XGIVEREF(__pyx_t_16);
  14125. __Pyx_XGIVEREF(__pyx_t_17);
  14126. __Pyx_ErrRestore(__pyx_t_15, __pyx_t_16, __pyx_t_17);
  14127. __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
  14128. __pyx_lineno = __pyx_t_20; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_22;
  14129. goto __pyx_L1_error;
  14130. __pyx_L94_error:;
  14131. if (PY_MAJOR_VERSION >= 3) {
  14132. __Pyx_XGIVEREF(__pyx_t_9);
  14133. __Pyx_XGIVEREF(__pyx_t_10);
  14134. __Pyx_XGIVEREF(__pyx_t_11);
  14135. __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
  14136. }
  14137. __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
  14138. __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
  14139. __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
  14140. __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
  14141. goto __pyx_L1_error;
  14142. }
  14143. __pyx_L14:;
  14144. }
  14145. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":875
  14146. *
  14147. *
  14148. * cpdef void _remove(self, tuple triple_pattern, context=None) except *: # <<<<<<<<<<<<<<
  14149. * cdef:
  14150. * unsigned char spok[TRP_KLEN]
  14151. */
  14152. /* function exit code */
  14153. goto __pyx_L0;
  14154. __pyx_L1_error:;
  14155. __Pyx_XDECREF(__pyx_t_1);
  14156. __Pyx_XDECREF(__pyx_t_2);
  14157. __Pyx_XDECREF(__pyx_t_3);
  14158. __Pyx_XDECREF(__pyx_t_4);
  14159. __Pyx_XDECREF(__pyx_t_6);
  14160. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  14161. __pyx_L0:;
  14162. __Pyx_XDECREF((PyObject *)__pyx_v_match_set);
  14163. __Pyx_TraceReturn(Py_None, 0);
  14164. __Pyx_RefNannyFinishContext();
  14165. }
  14166. /* Python wrapper */
  14167. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_11_remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  14168. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_11_remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  14169. PyObject *__pyx_v_triple_pattern = 0;
  14170. PyObject *__pyx_v_context = 0;
  14171. PyObject *__pyx_r = 0;
  14172. __Pyx_RefNannyDeclarations
  14173. __Pyx_RefNannySetupContext("_remove (wrapper)", 0);
  14174. {
  14175. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_triple_pattern,&__pyx_n_s_context,0};
  14176. PyObject* values[2] = {0,0};
  14177. values[1] = ((PyObject *)Py_None);
  14178. if (unlikely(__pyx_kwds)) {
  14179. Py_ssize_t kw_args;
  14180. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  14181. switch (pos_args) {
  14182. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  14183. CYTHON_FALLTHROUGH;
  14184. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  14185. CYTHON_FALLTHROUGH;
  14186. case 0: break;
  14187. default: goto __pyx_L5_argtuple_error;
  14188. }
  14189. kw_args = PyDict_Size(__pyx_kwds);
  14190. switch (pos_args) {
  14191. case 0:
  14192. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_triple_pattern)) != 0)) kw_args--;
  14193. else goto __pyx_L5_argtuple_error;
  14194. CYTHON_FALLTHROUGH;
  14195. case 1:
  14196. if (kw_args > 0) {
  14197. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_context);
  14198. if (value) { values[1] = value; kw_args--; }
  14199. }
  14200. }
  14201. if (unlikely(kw_args > 0)) {
  14202. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_remove") < 0)) __PYX_ERR(0, 875, __pyx_L3_error)
  14203. }
  14204. } else {
  14205. switch (PyTuple_GET_SIZE(__pyx_args)) {
  14206. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  14207. CYTHON_FALLTHROUGH;
  14208. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  14209. break;
  14210. default: goto __pyx_L5_argtuple_error;
  14211. }
  14212. }
  14213. __pyx_v_triple_pattern = ((PyObject*)values[0]);
  14214. __pyx_v_context = values[1];
  14215. }
  14216. goto __pyx_L4_argument_unpacking_done;
  14217. __pyx_L5_argtuple_error:;
  14218. __Pyx_RaiseArgtupleInvalid("_remove", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 875, __pyx_L3_error)
  14219. __pyx_L3_error:;
  14220. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  14221. __Pyx_RefNannyFinishContext();
  14222. return NULL;
  14223. __pyx_L4_argument_unpacking_done:;
  14224. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_triple_pattern), (&PyTuple_Type), 1, "triple_pattern", 1))) __PYX_ERR(0, 875, __pyx_L1_error)
  14225. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_10_remove(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self), __pyx_v_triple_pattern, __pyx_v_context);
  14226. /* function exit code */
  14227. goto __pyx_L0;
  14228. __pyx_L1_error:;
  14229. __pyx_r = NULL;
  14230. __pyx_L0:;
  14231. __Pyx_RefNannyFinishContext();
  14232. return __pyx_r;
  14233. }
  14234. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_10_remove(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_triple_pattern, PyObject *__pyx_v_context) {
  14235. PyObject *__pyx_r = NULL;
  14236. __Pyx_TraceDeclarations
  14237. __Pyx_RefNannyDeclarations
  14238. struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__remove __pyx_t_1;
  14239. PyObject *__pyx_t_2 = NULL;
  14240. __Pyx_RefNannySetupContext("_remove", 0);
  14241. __Pyx_TraceCall("_remove (wrapper)", __pyx_f[0], 875, 0, __PYX_ERR(0, 875, __pyx_L1_error));
  14242. __Pyx_XDECREF(__pyx_r);
  14243. __pyx_t_1.__pyx_n = 1;
  14244. __pyx_t_1.context = __pyx_v_context;
  14245. __pyx_vtabptr_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore->_remove(__pyx_v_self, __pyx_v_triple_pattern, 1, &__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 875, __pyx_L1_error)
  14246. __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 875, __pyx_L1_error)
  14247. __Pyx_GOTREF(__pyx_t_2);
  14248. __pyx_r = __pyx_t_2;
  14249. __pyx_t_2 = 0;
  14250. goto __pyx_L0;
  14251. /* function exit code */
  14252. __pyx_L1_error:;
  14253. __Pyx_XDECREF(__pyx_t_2);
  14254. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  14255. __pyx_r = NULL;
  14256. __pyx_L0:;
  14257. __Pyx_XGIVEREF(__pyx_r);
  14258. __Pyx_TraceReturn(__pyx_r, 0);
  14259. __Pyx_RefNannyFinishContext();
  14260. return __pyx_r;
  14261. }
  14262. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":996
  14263. *
  14264. *
  14265. * cdef void _index_triple(self, str op, TripleKey spok) except *: # <<<<<<<<<<<<<<
  14266. * """
  14267. * Update index for a triple and context (add or remove).
  14268. */
  14269. static void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__index_triple(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_op, unsigned char *__pyx_v_spok) {
  14270. unsigned char __pyx_v_keys[3][5];
  14271. unsigned char __pyx_v_dbl_keys[3][10];
  14272. size_t __pyx_v_i;
  14273. struct MDB_val __pyx_v_key_v;
  14274. struct MDB_val __pyx_v_dbl_key_v;
  14275. MDB_cursor *__pyx_v_cur1;
  14276. MDB_cursor *__pyx_v_cur2;
  14277. __Pyx_TraceDeclarations
  14278. __Pyx_RefNannyDeclarations
  14279. int __pyx_t_1;
  14280. int __pyx_t_2;
  14281. PyObject *__pyx_t_3 = NULL;
  14282. PyObject *__pyx_t_4 = NULL;
  14283. PyObject *__pyx_t_5 = NULL;
  14284. Py_ssize_t __pyx_t_6;
  14285. Py_UCS4 __pyx_t_7;
  14286. PyObject *__pyx_t_8 = NULL;
  14287. PyObject *__pyx_t_9 = NULL;
  14288. unsigned char *__pyx_t_10;
  14289. MDB_cursor *__pyx_t_11;
  14290. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__cur_open __pyx_t_12;
  14291. size_t __pyx_t_13;
  14292. PyObject *__pyx_t_14 = NULL;
  14293. PyObject *__pyx_t_15 = NULL;
  14294. PyObject *__pyx_t_16 = NULL;
  14295. int __pyx_t_17;
  14296. PyObject *__pyx_t_18 = NULL;
  14297. PyObject *__pyx_t_19 = NULL;
  14298. PyObject *__pyx_t_20 = NULL;
  14299. PyObject *__pyx_t_21 = NULL;
  14300. int __pyx_t_22;
  14301. char const *__pyx_t_23;
  14302. PyObject *__pyx_t_24 = NULL;
  14303. PyObject *__pyx_t_25 = NULL;
  14304. PyObject *__pyx_t_26 = NULL;
  14305. __Pyx_RefNannySetupContext("_index_triple", 0);
  14306. __Pyx_TraceCall("_index_triple", __pyx_f[0], 996, 0, __PYX_ERR(0, 996, __pyx_L1_error));
  14307. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1006
  14308. * unsigned char keys[3][KLEN]
  14309. * unsigned char dbl_keys[3][DBL_KLEN]
  14310. * size_t i = 0 # <<<<<<<<<<<<<<
  14311. * lmdb.MDB_val key_v, dbl_key_v
  14312. *
  14313. */
  14314. __pyx_v_i = 0;
  14315. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1009
  14316. * lmdb.MDB_val key_v, dbl_key_v
  14317. *
  14318. * keys[0] = spok # sk # <<<<<<<<<<<<<<
  14319. * keys[1] = spok + KLEN # pk
  14320. * keys[2] = spok + DBL_KLEN # ok
  14321. */
  14322. memcpy(&((__pyx_v_keys[0])[0]), __pyx_v_spok, sizeof((__pyx_v_keys[0])[0]) * (5 - 0));
  14323. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1010
  14324. *
  14325. * keys[0] = spok # sk
  14326. * keys[1] = spok + KLEN # pk # <<<<<<<<<<<<<<
  14327. * keys[2] = spok + DBL_KLEN # ok
  14328. *
  14329. */
  14330. memcpy(&((__pyx_v_keys[1])[0]), (__pyx_v_spok + 5), sizeof((__pyx_v_keys[1])[0]) * (5 - 0));
  14331. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1011
  14332. * keys[0] = spok # sk
  14333. * keys[1] = spok + KLEN # pk
  14334. * keys[2] = spok + DBL_KLEN # ok # <<<<<<<<<<<<<<
  14335. *
  14336. * dbl_keys[0] = spok + KLEN # pok
  14337. */
  14338. memcpy(&((__pyx_v_keys[2])[0]), (__pyx_v_spok + 10), sizeof((__pyx_v_keys[2])[0]) * (5 - 0));
  14339. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1013
  14340. * keys[2] = spok + DBL_KLEN # ok
  14341. *
  14342. * dbl_keys[0] = spok + KLEN # pok # <<<<<<<<<<<<<<
  14343. * memcpy(&dbl_keys[1], spok, KLEN) # sok, 1st part
  14344. * memcpy(&dbl_keys[1][KLEN], spok + DBL_KLEN, KLEN) # sok, 2nd part
  14345. */
  14346. memcpy(&((__pyx_v_dbl_keys[0])[0]), (__pyx_v_spok + 5), sizeof((__pyx_v_dbl_keys[0])[0]) * (10 - 0));
  14347. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1014
  14348. *
  14349. * dbl_keys[0] = spok + KLEN # pok
  14350. * memcpy(&dbl_keys[1], spok, KLEN) # sok, 1st part # <<<<<<<<<<<<<<
  14351. * memcpy(&dbl_keys[1][KLEN], spok + DBL_KLEN, KLEN) # sok, 2nd part
  14352. * dbl_keys[2] = spok # spk
  14353. */
  14354. (void)(memcpy((&(__pyx_v_dbl_keys[1])), __pyx_v_spok, 5));
  14355. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1015
  14356. * dbl_keys[0] = spok + KLEN # pok
  14357. * memcpy(&dbl_keys[1], spok, KLEN) # sok, 1st part
  14358. * memcpy(&dbl_keys[1][KLEN], spok + DBL_KLEN, KLEN) # sok, 2nd part # <<<<<<<<<<<<<<
  14359. * dbl_keys[2] = spok # spk
  14360. * #logger.debug('''Indices:
  14361. */
  14362. (void)(memcpy((&((__pyx_v_dbl_keys[1])[5])), (__pyx_v_spok + 10), 5));
  14363. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1016
  14364. * memcpy(&dbl_keys[1], spok, KLEN) # sok, 1st part
  14365. * memcpy(&dbl_keys[1][KLEN], spok + DBL_KLEN, KLEN) # sok, 2nd part
  14366. * dbl_keys[2] = spok # spk # <<<<<<<<<<<<<<
  14367. * #logger.debug('''Indices:
  14368. * #spok: {}
  14369. */
  14370. memcpy(&((__pyx_v_dbl_keys[2])[0]), __pyx_v_spok, sizeof((__pyx_v_dbl_keys[2])[0]) * (10 - 0));
  14371. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1029
  14372. * # keys[0][:KLEN], keys[1][:KLEN], keys[2][:KLEN],
  14373. * # dbl_keys[0][:DBL_KLEN], dbl_keys[1][:DBL_KLEN], dbl_keys[2][:DBL_KLEN]))
  14374. * key_v.mv_size = KLEN # <<<<<<<<<<<<<<
  14375. * dbl_key_v.mv_size = DBL_KLEN
  14376. *
  14377. */
  14378. __pyx_v_key_v.mv_size = 5;
  14379. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1030
  14380. * # dbl_keys[0][:DBL_KLEN], dbl_keys[1][:DBL_KLEN], dbl_keys[2][:DBL_KLEN]))
  14381. * key_v.mv_size = KLEN
  14382. * dbl_key_v.mv_size = DBL_KLEN # <<<<<<<<<<<<<<
  14383. *
  14384. * #logger.debug('Start indexing: {}.'.format(spok[: TRP_KLEN]))
  14385. */
  14386. __pyx_v_dbl_key_v.mv_size = 10;
  14387. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1033
  14388. *
  14389. * #logger.debug('Start indexing: {}.'.format(spok[: TRP_KLEN]))
  14390. * if op == IDX_OP_REMOVE: # <<<<<<<<<<<<<<
  14391. * logger.debug(f'Remove {spok[ : TRP_KLEN]} from indices.')
  14392. * else:
  14393. */
  14394. __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_op, __pyx_n_u_idx_remove, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1033, __pyx_L1_error)
  14395. __pyx_t_2 = (__pyx_t_1 != 0);
  14396. if (__pyx_t_2) {
  14397. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1034
  14398. * #logger.debug('Start indexing: {}.'.format(spok[: TRP_KLEN]))
  14399. * if op == IDX_OP_REMOVE:
  14400. * logger.debug(f'Remove {spok[ : TRP_KLEN]} from indices.') # <<<<<<<<<<<<<<
  14401. * else:
  14402. * logger.debug(f'Add {spok[ : TRP_KLEN]} to indices.')
  14403. */
  14404. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1034, __pyx_L1_error)
  14405. __Pyx_GOTREF(__pyx_t_4);
  14406. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_debug); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1034, __pyx_L1_error)
  14407. __Pyx_GOTREF(__pyx_t_5);
  14408. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  14409. __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1034, __pyx_L1_error)
  14410. __Pyx_GOTREF(__pyx_t_4);
  14411. __pyx_t_6 = 0;
  14412. __pyx_t_7 = 127;
  14413. __Pyx_INCREF(__pyx_kp_u_Remove);
  14414. __pyx_t_6 += 7;
  14415. __Pyx_GIVEREF(__pyx_kp_u_Remove);
  14416. PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_Remove);
  14417. __pyx_t_8 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_spok) + 0, 15 - 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1034, __pyx_L1_error)
  14418. __Pyx_GOTREF(__pyx_t_8);
  14419. __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_t_8, __pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1034, __pyx_L1_error)
  14420. __Pyx_GOTREF(__pyx_t_9);
  14421. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  14422. __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) : __pyx_t_7;
  14423. __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9);
  14424. __Pyx_GIVEREF(__pyx_t_9);
  14425. PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_9);
  14426. __pyx_t_9 = 0;
  14427. __Pyx_INCREF(__pyx_kp_u_from_indices);
  14428. __pyx_t_6 += 14;
  14429. __Pyx_GIVEREF(__pyx_kp_u_from_indices);
  14430. PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_from_indices);
  14431. __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1034, __pyx_L1_error)
  14432. __Pyx_GOTREF(__pyx_t_9);
  14433. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  14434. __pyx_t_4 = NULL;
  14435. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
  14436. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
  14437. if (likely(__pyx_t_4)) {
  14438. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
  14439. __Pyx_INCREF(__pyx_t_4);
  14440. __Pyx_INCREF(function);
  14441. __Pyx_DECREF_SET(__pyx_t_5, function);
  14442. }
  14443. }
  14444. if (!__pyx_t_4) {
  14445. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1034, __pyx_L1_error)
  14446. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  14447. __Pyx_GOTREF(__pyx_t_3);
  14448. } else {
  14449. #if CYTHON_FAST_PYCALL
  14450. if (PyFunction_Check(__pyx_t_5)) {
  14451. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_9};
  14452. __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1034, __pyx_L1_error)
  14453. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  14454. __Pyx_GOTREF(__pyx_t_3);
  14455. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  14456. } else
  14457. #endif
  14458. #if CYTHON_FAST_PYCCALL
  14459. if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
  14460. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_9};
  14461. __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1034, __pyx_L1_error)
  14462. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  14463. __Pyx_GOTREF(__pyx_t_3);
  14464. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  14465. } else
  14466. #endif
  14467. {
  14468. __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1034, __pyx_L1_error)
  14469. __Pyx_GOTREF(__pyx_t_8);
  14470. __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL;
  14471. __Pyx_GIVEREF(__pyx_t_9);
  14472. PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_9);
  14473. __pyx_t_9 = 0;
  14474. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1034, __pyx_L1_error)
  14475. __Pyx_GOTREF(__pyx_t_3);
  14476. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  14477. }
  14478. }
  14479. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  14480. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14481. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1033
  14482. *
  14483. * #logger.debug('Start indexing: {}.'.format(spok[: TRP_KLEN]))
  14484. * if op == IDX_OP_REMOVE: # <<<<<<<<<<<<<<
  14485. * logger.debug(f'Remove {spok[ : TRP_KLEN]} from indices.')
  14486. * else:
  14487. */
  14488. goto __pyx_L3;
  14489. }
  14490. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1036
  14491. * logger.debug(f'Remove {spok[ : TRP_KLEN]} from indices.')
  14492. * else:
  14493. * logger.debug(f'Add {spok[ : TRP_KLEN]} to indices.') # <<<<<<<<<<<<<<
  14494. *
  14495. * while i < 3:
  14496. */
  14497. /*else*/ {
  14498. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1036, __pyx_L1_error)
  14499. __Pyx_GOTREF(__pyx_t_5);
  14500. __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_debug); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1036, __pyx_L1_error)
  14501. __Pyx_GOTREF(__pyx_t_8);
  14502. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  14503. __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1036, __pyx_L1_error)
  14504. __Pyx_GOTREF(__pyx_t_5);
  14505. __pyx_t_6 = 0;
  14506. __pyx_t_7 = 127;
  14507. __Pyx_INCREF(__pyx_kp_u_Add);
  14508. __pyx_t_6 += 4;
  14509. __Pyx_GIVEREF(__pyx_kp_u_Add);
  14510. PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Add);
  14511. __pyx_t_9 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_spok) + 0, 15 - 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1036, __pyx_L1_error)
  14512. __Pyx_GOTREF(__pyx_t_9);
  14513. __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_9, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1036, __pyx_L1_error)
  14514. __Pyx_GOTREF(__pyx_t_4);
  14515. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  14516. __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_7;
  14517. __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  14518. __Pyx_GIVEREF(__pyx_t_4);
  14519. PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  14520. __pyx_t_4 = 0;
  14521. __Pyx_INCREF(__pyx_kp_u_to_indices);
  14522. __pyx_t_6 += 12;
  14523. __Pyx_GIVEREF(__pyx_kp_u_to_indices);
  14524. PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u_to_indices);
  14525. __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1036, __pyx_L1_error)
  14526. __Pyx_GOTREF(__pyx_t_4);
  14527. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  14528. __pyx_t_5 = NULL;
  14529. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
  14530. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
  14531. if (likely(__pyx_t_5)) {
  14532. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
  14533. __Pyx_INCREF(__pyx_t_5);
  14534. __Pyx_INCREF(function);
  14535. __Pyx_DECREF_SET(__pyx_t_8, function);
  14536. }
  14537. }
  14538. if (!__pyx_t_5) {
  14539. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1036, __pyx_L1_error)
  14540. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  14541. __Pyx_GOTREF(__pyx_t_3);
  14542. } else {
  14543. #if CYTHON_FAST_PYCALL
  14544. if (PyFunction_Check(__pyx_t_8)) {
  14545. PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
  14546. __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1036, __pyx_L1_error)
  14547. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  14548. __Pyx_GOTREF(__pyx_t_3);
  14549. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  14550. } else
  14551. #endif
  14552. #if CYTHON_FAST_PYCCALL
  14553. if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
  14554. PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
  14555. __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1036, __pyx_L1_error)
  14556. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  14557. __Pyx_GOTREF(__pyx_t_3);
  14558. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  14559. } else
  14560. #endif
  14561. {
  14562. __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1036, __pyx_L1_error)
  14563. __Pyx_GOTREF(__pyx_t_9);
  14564. __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); __pyx_t_5 = NULL;
  14565. __Pyx_GIVEREF(__pyx_t_4);
  14566. PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_4);
  14567. __pyx_t_4 = 0;
  14568. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1036, __pyx_L1_error)
  14569. __Pyx_GOTREF(__pyx_t_3);
  14570. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  14571. }
  14572. }
  14573. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  14574. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14575. }
  14576. __pyx_L3:;
  14577. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1038
  14578. * logger.debug(f'Add {spok[ : TRP_KLEN]} to indices.')
  14579. *
  14580. * while i < 3: # <<<<<<<<<<<<<<
  14581. * cur1 = self._cur_open(self.lookup_indices[i]) # s:po, p:so, o:sp
  14582. * cur2 = self._cur_open(self.lookup_indices[i + 3])# po:s, so:p, sp:o
  14583. */
  14584. while (1) {
  14585. __pyx_t_2 = ((__pyx_v_i < 3) != 0);
  14586. if (!__pyx_t_2) break;
  14587. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1039
  14588. *
  14589. * while i < 3:
  14590. * cur1 = self._cur_open(self.lookup_indices[i]) # s:po, p:so, o:sp # <<<<<<<<<<<<<<
  14591. * cur2 = self._cur_open(self.lookup_indices[i + 3])# po:s, so:p, sp:o
  14592. * try:
  14593. */
  14594. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_lookup_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1039, __pyx_L1_error)
  14595. __Pyx_GOTREF(__pyx_t_3);
  14596. __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1039, __pyx_L1_error)
  14597. __Pyx_GOTREF(__pyx_t_8);
  14598. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14599. __pyx_t_10 = __Pyx_PyObject_AsWritableUString(__pyx_t_8); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 1039, __pyx_L1_error)
  14600. __pyx_t_12.__pyx_n = 1;
  14601. __pyx_t_12.dblabel = __pyx_t_10;
  14602. __pyx_t_11 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_open(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_12); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1039, __pyx_L1_error)
  14603. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  14604. __pyx_v_cur1 = __pyx_t_11;
  14605. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1040
  14606. * while i < 3:
  14607. * cur1 = self._cur_open(self.lookup_indices[i]) # s:po, p:so, o:sp
  14608. * cur2 = self._cur_open(self.lookup_indices[i + 3])# po:s, so:p, sp:o # <<<<<<<<<<<<<<
  14609. * try:
  14610. * key_v.mv_data = keys[i]
  14611. */
  14612. __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_lookup_indices); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1040, __pyx_L1_error)
  14613. __Pyx_GOTREF(__pyx_t_8);
  14614. __pyx_t_13 = (__pyx_v_i + 3);
  14615. __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_8, __pyx_t_13, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1040, __pyx_L1_error)
  14616. __Pyx_GOTREF(__pyx_t_3);
  14617. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  14618. __pyx_t_10 = __Pyx_PyObject_AsWritableUString(__pyx_t_3); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 1040, __pyx_L1_error)
  14619. __pyx_t_12.__pyx_n = 1;
  14620. __pyx_t_12.dblabel = __pyx_t_10;
  14621. __pyx_t_11 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_open(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_12); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1040, __pyx_L1_error)
  14622. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14623. __pyx_v_cur2 = __pyx_t_11;
  14624. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1041
  14625. * cur1 = self._cur_open(self.lookup_indices[i]) # s:po, p:so, o:sp
  14626. * cur2 = self._cur_open(self.lookup_indices[i + 3])# po:s, so:p, sp:o
  14627. * try: # <<<<<<<<<<<<<<
  14628. * key_v.mv_data = keys[i]
  14629. * dbl_key_v.mv_data = dbl_keys[i]
  14630. */
  14631. /*try:*/ {
  14632. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1042
  14633. * cur2 = self._cur_open(self.lookup_indices[i + 3])# po:s, so:p, sp:o
  14634. * try:
  14635. * key_v.mv_data = keys[i] # <<<<<<<<<<<<<<
  14636. * dbl_key_v.mv_data = dbl_keys[i]
  14637. *
  14638. */
  14639. __pyx_v_key_v.mv_data = (__pyx_v_keys[__pyx_v_i]);
  14640. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1043
  14641. * try:
  14642. * key_v.mv_data = keys[i]
  14643. * dbl_key_v.mv_data = dbl_keys[i] # <<<<<<<<<<<<<<
  14644. *
  14645. * # Removal op indexing.
  14646. */
  14647. __pyx_v_dbl_key_v.mv_data = (__pyx_v_dbl_keys[__pyx_v_i]);
  14648. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1046
  14649. *
  14650. * # Removal op indexing.
  14651. * if op == IDX_OP_REMOVE: # <<<<<<<<<<<<<<
  14652. * try:
  14653. * _check(lmdb.mdb_cursor_get(
  14654. */
  14655. __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_op, __pyx_n_u_idx_remove, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1046, __pyx_L9_error)
  14656. __pyx_t_1 = (__pyx_t_2 != 0);
  14657. if (__pyx_t_1) {
  14658. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1047
  14659. * # Removal op indexing.
  14660. * if op == IDX_OP_REMOVE:
  14661. * try: # <<<<<<<<<<<<<<
  14662. * _check(lmdb.mdb_cursor_get(
  14663. * cur1, &key_v, &dbl_key_v, lmdb.MDB_GET_BOTH))
  14664. */
  14665. {
  14666. __Pyx_PyThreadState_declare
  14667. __Pyx_PyThreadState_assign
  14668. __Pyx_ExceptionSave(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
  14669. __Pyx_XGOTREF(__pyx_t_14);
  14670. __Pyx_XGOTREF(__pyx_t_15);
  14671. __Pyx_XGOTREF(__pyx_t_16);
  14672. /*try:*/ {
  14673. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1048
  14674. * if op == IDX_OP_REMOVE:
  14675. * try:
  14676. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  14677. * cur1, &key_v, &dbl_key_v, lmdb.MDB_GET_BOTH))
  14678. * logger.debug(f'Removed: {keys[i][: KLEN]}, '
  14679. */
  14680. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_cur1, (&__pyx_v_key_v), (&__pyx_v_dbl_key_v), MDB_GET_BOTH), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1048, __pyx_L12_error)
  14681. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1050
  14682. * _check(lmdb.mdb_cursor_get(
  14683. * cur1, &key_v, &dbl_key_v, lmdb.MDB_GET_BOTH))
  14684. * logger.debug(f'Removed: {keys[i][: KLEN]}, ' # <<<<<<<<<<<<<<
  14685. * f'{dbl_keys[i][: DBL_KLEN]}')
  14686. * except KeyNotFoundError:
  14687. */
  14688. __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1050, __pyx_L12_error)
  14689. __Pyx_GOTREF(__pyx_t_8);
  14690. __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_debug); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1050, __pyx_L12_error)
  14691. __Pyx_GOTREF(__pyx_t_9);
  14692. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  14693. __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1050, __pyx_L12_error)
  14694. __Pyx_GOTREF(__pyx_t_8);
  14695. __pyx_t_6 = 0;
  14696. __pyx_t_7 = 127;
  14697. __Pyx_INCREF(__pyx_kp_u_Removed);
  14698. __pyx_t_6 += 9;
  14699. __Pyx_GIVEREF(__pyx_kp_u_Removed);
  14700. PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_u_Removed);
  14701. __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(((const char*)(__pyx_v_keys[__pyx_v_i])) + 0, 5 - 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1050, __pyx_L12_error)
  14702. __Pyx_GOTREF(__pyx_t_4);
  14703. __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1050, __pyx_L12_error)
  14704. __Pyx_GOTREF(__pyx_t_5);
  14705. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  14706. __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_7;
  14707. __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
  14708. __Pyx_GIVEREF(__pyx_t_5);
  14709. PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5);
  14710. __pyx_t_5 = 0;
  14711. __Pyx_INCREF(__pyx_kp_u__12);
  14712. __pyx_t_6 += 2;
  14713. __Pyx_GIVEREF(__pyx_kp_u__12);
  14714. PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_kp_u__12);
  14715. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1051
  14716. * cur1, &key_v, &dbl_key_v, lmdb.MDB_GET_BOTH))
  14717. * logger.debug(f'Removed: {keys[i][: KLEN]}, '
  14718. * f'{dbl_keys[i][: DBL_KLEN]}') # <<<<<<<<<<<<<<
  14719. * except KeyNotFoundError:
  14720. * logger.debug(f'Not found in index: {keys[i][: KLEN]}, '
  14721. */
  14722. __pyx_t_5 = __Pyx_PyBytes_FromStringAndSize(((const char*)(__pyx_v_dbl_keys[__pyx_v_i])) + 0, 10 - 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1051, __pyx_L12_error)
  14723. __Pyx_GOTREF(__pyx_t_5);
  14724. __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1051, __pyx_L12_error)
  14725. __Pyx_GOTREF(__pyx_t_4);
  14726. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  14727. __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_7;
  14728. __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  14729. __Pyx_GIVEREF(__pyx_t_4);
  14730. PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_4);
  14731. __pyx_t_4 = 0;
  14732. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1050
  14733. * _check(lmdb.mdb_cursor_get(
  14734. * cur1, &key_v, &dbl_key_v, lmdb.MDB_GET_BOTH))
  14735. * logger.debug(f'Removed: {keys[i][: KLEN]}, ' # <<<<<<<<<<<<<<
  14736. * f'{dbl_keys[i][: DBL_KLEN]}')
  14737. * except KeyNotFoundError:
  14738. */
  14739. __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_8, 4, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1050, __pyx_L12_error)
  14740. __Pyx_GOTREF(__pyx_t_4);
  14741. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  14742. __pyx_t_8 = NULL;
  14743. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
  14744. __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
  14745. if (likely(__pyx_t_8)) {
  14746. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
  14747. __Pyx_INCREF(__pyx_t_8);
  14748. __Pyx_INCREF(function);
  14749. __Pyx_DECREF_SET(__pyx_t_9, function);
  14750. }
  14751. }
  14752. if (!__pyx_t_8) {
  14753. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1050, __pyx_L12_error)
  14754. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  14755. __Pyx_GOTREF(__pyx_t_3);
  14756. } else {
  14757. #if CYTHON_FAST_PYCALL
  14758. if (PyFunction_Check(__pyx_t_9)) {
  14759. PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_4};
  14760. __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1050, __pyx_L12_error)
  14761. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  14762. __Pyx_GOTREF(__pyx_t_3);
  14763. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  14764. } else
  14765. #endif
  14766. #if CYTHON_FAST_PYCCALL
  14767. if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
  14768. PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_4};
  14769. __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1050, __pyx_L12_error)
  14770. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  14771. __Pyx_GOTREF(__pyx_t_3);
  14772. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  14773. } else
  14774. #endif
  14775. {
  14776. __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1050, __pyx_L12_error)
  14777. __Pyx_GOTREF(__pyx_t_5);
  14778. __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __pyx_t_8 = NULL;
  14779. __Pyx_GIVEREF(__pyx_t_4);
  14780. PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4);
  14781. __pyx_t_4 = 0;
  14782. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1050, __pyx_L12_error)
  14783. __Pyx_GOTREF(__pyx_t_3);
  14784. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  14785. }
  14786. }
  14787. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  14788. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14789. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1047
  14790. * # Removal op indexing.
  14791. * if op == IDX_OP_REMOVE:
  14792. * try: # <<<<<<<<<<<<<<
  14793. * _check(lmdb.mdb_cursor_get(
  14794. * cur1, &key_v, &dbl_key_v, lmdb.MDB_GET_BOTH))
  14795. */
  14796. }
  14797. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1057
  14798. * pass
  14799. * else:
  14800. * _check(lmdb.mdb_cursor_del(cur1, 0)) # <<<<<<<<<<<<<<
  14801. *
  14802. * # Restore pointers after delete.
  14803. */
  14804. /*else:*/ {
  14805. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_del(__pyx_v_cur1, 0), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1057, __pyx_L14_except_error)
  14806. }
  14807. __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
  14808. __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
  14809. __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
  14810. goto __pyx_L19_try_end;
  14811. __pyx_L12_error:;
  14812. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  14813. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  14814. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  14815. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  14816. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  14817. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1052
  14818. * logger.debug(f'Removed: {keys[i][: KLEN]}, '
  14819. * f'{dbl_keys[i][: DBL_KLEN]}')
  14820. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  14821. * logger.debug(f'Not found in index: {keys[i][: KLEN]}, '
  14822. * f'{dbl_keys[i][: DBL_KLEN]}')
  14823. */
  14824. __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_9, &__pyx_t_5);
  14825. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1052, __pyx_L14_except_error)
  14826. __Pyx_GOTREF(__pyx_t_4);
  14827. __pyx_t_17 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_3, __pyx_t_4);
  14828. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  14829. __Pyx_ErrRestore(__pyx_t_3, __pyx_t_9, __pyx_t_5);
  14830. __pyx_t_3 = 0; __pyx_t_9 = 0; __pyx_t_5 = 0;
  14831. if (__pyx_t_17) {
  14832. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._index_triple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  14833. if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_9, &__pyx_t_3) < 0) __PYX_ERR(0, 1052, __pyx_L14_except_error)
  14834. __Pyx_GOTREF(__pyx_t_5);
  14835. __Pyx_GOTREF(__pyx_t_9);
  14836. __Pyx_GOTREF(__pyx_t_3);
  14837. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1053
  14838. * f'{dbl_keys[i][: DBL_KLEN]}')
  14839. * except KeyNotFoundError:
  14840. * logger.debug(f'Not found in index: {keys[i][: KLEN]}, ' # <<<<<<<<<<<<<<
  14841. * f'{dbl_keys[i][: DBL_KLEN]}')
  14842. * pass
  14843. */
  14844. __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1053, __pyx_L14_except_error)
  14845. __Pyx_GOTREF(__pyx_t_8);
  14846. __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_debug); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1053, __pyx_L14_except_error)
  14847. __Pyx_GOTREF(__pyx_t_18);
  14848. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  14849. __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1053, __pyx_L14_except_error)
  14850. __Pyx_GOTREF(__pyx_t_8);
  14851. __pyx_t_6 = 0;
  14852. __pyx_t_7 = 127;
  14853. __Pyx_INCREF(__pyx_kp_u_Not_found_in_index);
  14854. __pyx_t_6 += 20;
  14855. __Pyx_GIVEREF(__pyx_kp_u_Not_found_in_index);
  14856. PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_u_Not_found_in_index);
  14857. __pyx_t_19 = __Pyx_PyBytes_FromStringAndSize(((const char*)(__pyx_v_keys[__pyx_v_i])) + 0, 5 - 0); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1053, __pyx_L14_except_error)
  14858. __Pyx_GOTREF(__pyx_t_19);
  14859. __pyx_t_20 = __Pyx_PyObject_FormatSimple(__pyx_t_19, __pyx_empty_unicode); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1053, __pyx_L14_except_error)
  14860. __Pyx_GOTREF(__pyx_t_20);
  14861. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  14862. __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_20) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_20) : __pyx_t_7;
  14863. __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_20);
  14864. __Pyx_GIVEREF(__pyx_t_20);
  14865. PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_20);
  14866. __pyx_t_20 = 0;
  14867. __Pyx_INCREF(__pyx_kp_u__12);
  14868. __pyx_t_6 += 2;
  14869. __Pyx_GIVEREF(__pyx_kp_u__12);
  14870. PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_kp_u__12);
  14871. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1054
  14872. * except KeyNotFoundError:
  14873. * logger.debug(f'Not found in index: {keys[i][: KLEN]}, '
  14874. * f'{dbl_keys[i][: DBL_KLEN]}') # <<<<<<<<<<<<<<
  14875. * pass
  14876. * else:
  14877. */
  14878. __pyx_t_20 = __Pyx_PyBytes_FromStringAndSize(((const char*)(__pyx_v_dbl_keys[__pyx_v_i])) + 0, 10 - 0); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1054, __pyx_L14_except_error)
  14879. __Pyx_GOTREF(__pyx_t_20);
  14880. __pyx_t_19 = __Pyx_PyObject_FormatSimple(__pyx_t_20, __pyx_empty_unicode); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1054, __pyx_L14_except_error)
  14881. __Pyx_GOTREF(__pyx_t_19);
  14882. __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  14883. __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_19) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_19) : __pyx_t_7;
  14884. __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_19);
  14885. __Pyx_GIVEREF(__pyx_t_19);
  14886. PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_19);
  14887. __pyx_t_19 = 0;
  14888. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1053
  14889. * f'{dbl_keys[i][: DBL_KLEN]}')
  14890. * except KeyNotFoundError:
  14891. * logger.debug(f'Not found in index: {keys[i][: KLEN]}, ' # <<<<<<<<<<<<<<
  14892. * f'{dbl_keys[i][: DBL_KLEN]}')
  14893. * pass
  14894. */
  14895. __pyx_t_19 = __Pyx_PyUnicode_Join(__pyx_t_8, 4, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1053, __pyx_L14_except_error)
  14896. __Pyx_GOTREF(__pyx_t_19);
  14897. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  14898. __pyx_t_8 = NULL;
  14899. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_18))) {
  14900. __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_18);
  14901. if (likely(__pyx_t_8)) {
  14902. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
  14903. __Pyx_INCREF(__pyx_t_8);
  14904. __Pyx_INCREF(function);
  14905. __Pyx_DECREF_SET(__pyx_t_18, function);
  14906. }
  14907. }
  14908. if (!__pyx_t_8) {
  14909. __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_18, __pyx_t_19); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1053, __pyx_L14_except_error)
  14910. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  14911. __Pyx_GOTREF(__pyx_t_4);
  14912. } else {
  14913. #if CYTHON_FAST_PYCALL
  14914. if (PyFunction_Check(__pyx_t_18)) {
  14915. PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_19};
  14916. __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_18, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1053, __pyx_L14_except_error)
  14917. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  14918. __Pyx_GOTREF(__pyx_t_4);
  14919. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  14920. } else
  14921. #endif
  14922. #if CYTHON_FAST_PYCCALL
  14923. if (__Pyx_PyFastCFunction_Check(__pyx_t_18)) {
  14924. PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_19};
  14925. __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_18, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1053, __pyx_L14_except_error)
  14926. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  14927. __Pyx_GOTREF(__pyx_t_4);
  14928. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  14929. } else
  14930. #endif
  14931. {
  14932. __pyx_t_20 = PyTuple_New(1+1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1053, __pyx_L14_except_error)
  14933. __Pyx_GOTREF(__pyx_t_20);
  14934. __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_8); __pyx_t_8 = NULL;
  14935. __Pyx_GIVEREF(__pyx_t_19);
  14936. PyTuple_SET_ITEM(__pyx_t_20, 0+1, __pyx_t_19);
  14937. __pyx_t_19 = 0;
  14938. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_t_20, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1053, __pyx_L14_except_error)
  14939. __Pyx_GOTREF(__pyx_t_4);
  14940. __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  14941. }
  14942. }
  14943. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  14944. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  14945. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  14946. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  14947. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14948. goto __pyx_L13_exception_handled;
  14949. }
  14950. goto __pyx_L14_except_error;
  14951. __pyx_L14_except_error:;
  14952. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1047
  14953. * # Removal op indexing.
  14954. * if op == IDX_OP_REMOVE:
  14955. * try: # <<<<<<<<<<<<<<
  14956. * _check(lmdb.mdb_cursor_get(
  14957. * cur1, &key_v, &dbl_key_v, lmdb.MDB_GET_BOTH))
  14958. */
  14959. __Pyx_XGIVEREF(__pyx_t_14);
  14960. __Pyx_XGIVEREF(__pyx_t_15);
  14961. __Pyx_XGIVEREF(__pyx_t_16);
  14962. __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
  14963. goto __pyx_L9_error;
  14964. __pyx_L13_exception_handled:;
  14965. __Pyx_XGIVEREF(__pyx_t_14);
  14966. __Pyx_XGIVEREF(__pyx_t_15);
  14967. __Pyx_XGIVEREF(__pyx_t_16);
  14968. __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
  14969. __pyx_L19_try_end:;
  14970. }
  14971. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1060
  14972. *
  14973. * # Restore pointers after delete.
  14974. * key_v.mv_data = keys[i] # <<<<<<<<<<<<<<
  14975. * dbl_key_v.mv_data = dbl_keys[i]
  14976. * try:
  14977. */
  14978. __pyx_v_key_v.mv_data = (__pyx_v_keys[__pyx_v_i]);
  14979. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1061
  14980. * # Restore pointers after delete.
  14981. * key_v.mv_data = keys[i]
  14982. * dbl_key_v.mv_data = dbl_keys[i] # <<<<<<<<<<<<<<
  14983. * try:
  14984. * _check(lmdb.mdb_cursor_get(
  14985. */
  14986. __pyx_v_dbl_key_v.mv_data = (__pyx_v_dbl_keys[__pyx_v_i]);
  14987. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1062
  14988. * key_v.mv_data = keys[i]
  14989. * dbl_key_v.mv_data = dbl_keys[i]
  14990. * try: # <<<<<<<<<<<<<<
  14991. * _check(lmdb.mdb_cursor_get(
  14992. * cur2, &dbl_key_v, &key_v, lmdb.MDB_GET_BOTH))
  14993. */
  14994. {
  14995. __Pyx_PyThreadState_declare
  14996. __Pyx_PyThreadState_assign
  14997. __Pyx_ExceptionSave(&__pyx_t_16, &__pyx_t_15, &__pyx_t_14);
  14998. __Pyx_XGOTREF(__pyx_t_16);
  14999. __Pyx_XGOTREF(__pyx_t_15);
  15000. __Pyx_XGOTREF(__pyx_t_14);
  15001. /*try:*/ {
  15002. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1063
  15003. * dbl_key_v.mv_data = dbl_keys[i]
  15004. * try:
  15005. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  15006. * cur2, &dbl_key_v, &key_v, lmdb.MDB_GET_BOTH))
  15007. * logger.debug(f'Removed: {dbl_keys[i][: DBL_KLEN]}, '
  15008. */
  15009. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_cur2, (&__pyx_v_dbl_key_v), (&__pyx_v_key_v), MDB_GET_BOTH), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1063, __pyx_L22_error)
  15010. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1065
  15011. * _check(lmdb.mdb_cursor_get(
  15012. * cur2, &dbl_key_v, &key_v, lmdb.MDB_GET_BOTH))
  15013. * logger.debug(f'Removed: {dbl_keys[i][: DBL_KLEN]}, ' # <<<<<<<<<<<<<<
  15014. * f'{keys[i][: KLEN]}')
  15015. * except KeyNotFoundError:
  15016. */
  15017. __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1065, __pyx_L22_error)
  15018. __Pyx_GOTREF(__pyx_t_9);
  15019. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_debug); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1065, __pyx_L22_error)
  15020. __Pyx_GOTREF(__pyx_t_5);
  15021. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  15022. __pyx_t_9 = PyTuple_New(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1065, __pyx_L22_error)
  15023. __Pyx_GOTREF(__pyx_t_9);
  15024. __pyx_t_6 = 0;
  15025. __pyx_t_7 = 127;
  15026. __Pyx_INCREF(__pyx_kp_u_Removed);
  15027. __pyx_t_6 += 9;
  15028. __Pyx_GIVEREF(__pyx_kp_u_Removed);
  15029. PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_kp_u_Removed);
  15030. __pyx_t_4 = __Pyx_PyBytes_FromStringAndSize(((const char*)(__pyx_v_dbl_keys[__pyx_v_i])) + 0, 10 - 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1065, __pyx_L22_error)
  15031. __Pyx_GOTREF(__pyx_t_4);
  15032. __pyx_t_18 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_empty_unicode); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1065, __pyx_L22_error)
  15033. __Pyx_GOTREF(__pyx_t_18);
  15034. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  15035. __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) : __pyx_t_7;
  15036. __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18);
  15037. __Pyx_GIVEREF(__pyx_t_18);
  15038. PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_18);
  15039. __pyx_t_18 = 0;
  15040. __Pyx_INCREF(__pyx_kp_u__12);
  15041. __pyx_t_6 += 2;
  15042. __Pyx_GIVEREF(__pyx_kp_u__12);
  15043. PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_kp_u__12);
  15044. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1066
  15045. * cur2, &dbl_key_v, &key_v, lmdb.MDB_GET_BOTH))
  15046. * logger.debug(f'Removed: {dbl_keys[i][: DBL_KLEN]}, '
  15047. * f'{keys[i][: KLEN]}') # <<<<<<<<<<<<<<
  15048. * except KeyNotFoundError:
  15049. * logger.debug(f'Not found in index: '
  15050. */
  15051. __pyx_t_18 = __Pyx_PyBytes_FromStringAndSize(((const char*)(__pyx_v_keys[__pyx_v_i])) + 0, 5 - 0); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1066, __pyx_L22_error)
  15052. __Pyx_GOTREF(__pyx_t_18);
  15053. __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_18, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1066, __pyx_L22_error)
  15054. __Pyx_GOTREF(__pyx_t_4);
  15055. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  15056. __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_7;
  15057. __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
  15058. __Pyx_GIVEREF(__pyx_t_4);
  15059. PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_4);
  15060. __pyx_t_4 = 0;
  15061. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1065
  15062. * _check(lmdb.mdb_cursor_get(
  15063. * cur2, &dbl_key_v, &key_v, lmdb.MDB_GET_BOTH))
  15064. * logger.debug(f'Removed: {dbl_keys[i][: DBL_KLEN]}, ' # <<<<<<<<<<<<<<
  15065. * f'{keys[i][: KLEN]}')
  15066. * except KeyNotFoundError:
  15067. */
  15068. __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_9, 4, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1065, __pyx_L22_error)
  15069. __Pyx_GOTREF(__pyx_t_4);
  15070. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  15071. __pyx_t_9 = NULL;
  15072. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
  15073. __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
  15074. if (likely(__pyx_t_9)) {
  15075. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
  15076. __Pyx_INCREF(__pyx_t_9);
  15077. __Pyx_INCREF(function);
  15078. __Pyx_DECREF_SET(__pyx_t_5, function);
  15079. }
  15080. }
  15081. if (!__pyx_t_9) {
  15082. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1065, __pyx_L22_error)
  15083. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  15084. __Pyx_GOTREF(__pyx_t_3);
  15085. } else {
  15086. #if CYTHON_FAST_PYCALL
  15087. if (PyFunction_Check(__pyx_t_5)) {
  15088. PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_4};
  15089. __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1065, __pyx_L22_error)
  15090. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  15091. __Pyx_GOTREF(__pyx_t_3);
  15092. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  15093. } else
  15094. #endif
  15095. #if CYTHON_FAST_PYCCALL
  15096. if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
  15097. PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_4};
  15098. __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1065, __pyx_L22_error)
  15099. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  15100. __Pyx_GOTREF(__pyx_t_3);
  15101. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  15102. } else
  15103. #endif
  15104. {
  15105. __pyx_t_18 = PyTuple_New(1+1); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1065, __pyx_L22_error)
  15106. __Pyx_GOTREF(__pyx_t_18);
  15107. __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_9); __pyx_t_9 = NULL;
  15108. __Pyx_GIVEREF(__pyx_t_4);
  15109. PyTuple_SET_ITEM(__pyx_t_18, 0+1, __pyx_t_4);
  15110. __pyx_t_4 = 0;
  15111. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_18, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1065, __pyx_L22_error)
  15112. __Pyx_GOTREF(__pyx_t_3);
  15113. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  15114. }
  15115. }
  15116. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  15117. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15118. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1062
  15119. * key_v.mv_data = keys[i]
  15120. * dbl_key_v.mv_data = dbl_keys[i]
  15121. * try: # <<<<<<<<<<<<<<
  15122. * _check(lmdb.mdb_cursor_get(
  15123. * cur2, &dbl_key_v, &key_v, lmdb.MDB_GET_BOTH))
  15124. */
  15125. }
  15126. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1073
  15127. * pass
  15128. * else:
  15129. * _check(lmdb.mdb_cursor_del(cur2, 0)) # <<<<<<<<<<<<<<
  15130. *
  15131. * # Addition op indexing.
  15132. */
  15133. /*else:*/ {
  15134. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_del(__pyx_v_cur2, 0), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1073, __pyx_L24_except_error)
  15135. }
  15136. __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
  15137. __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
  15138. __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
  15139. goto __pyx_L29_try_end;
  15140. __pyx_L22_error:;
  15141. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  15142. __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
  15143. __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
  15144. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  15145. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  15146. __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
  15147. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  15148. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  15149. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1067
  15150. * logger.debug(f'Removed: {dbl_keys[i][: DBL_KLEN]}, '
  15151. * f'{keys[i][: KLEN]}')
  15152. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  15153. * logger.debug(f'Not found in index: '
  15154. * f'{dbl_keys[i][: DBL_KLEN]}, '
  15155. */
  15156. __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_5, &__pyx_t_18);
  15157. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1067, __pyx_L24_except_error)
  15158. __Pyx_GOTREF(__pyx_t_4);
  15159. __pyx_t_17 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_3, __pyx_t_4);
  15160. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  15161. __Pyx_ErrRestore(__pyx_t_3, __pyx_t_5, __pyx_t_18);
  15162. __pyx_t_3 = 0; __pyx_t_5 = 0; __pyx_t_18 = 0;
  15163. if (__pyx_t_17) {
  15164. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._index_triple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  15165. if (__Pyx_GetException(&__pyx_t_18, &__pyx_t_5, &__pyx_t_3) < 0) __PYX_ERR(0, 1067, __pyx_L24_except_error)
  15166. __Pyx_GOTREF(__pyx_t_18);
  15167. __Pyx_GOTREF(__pyx_t_5);
  15168. __Pyx_GOTREF(__pyx_t_3);
  15169. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1068
  15170. * f'{keys[i][: KLEN]}')
  15171. * except KeyNotFoundError:
  15172. * logger.debug(f'Not found in index: ' # <<<<<<<<<<<<<<
  15173. * f'{dbl_keys[i][: DBL_KLEN]}, '
  15174. * f'{keys[i][: KLEN]}')
  15175. */
  15176. __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1068, __pyx_L24_except_error)
  15177. __Pyx_GOTREF(__pyx_t_9);
  15178. __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_debug); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1068, __pyx_L24_except_error)
  15179. __Pyx_GOTREF(__pyx_t_20);
  15180. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  15181. __pyx_t_9 = PyTuple_New(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1068, __pyx_L24_except_error)
  15182. __Pyx_GOTREF(__pyx_t_9);
  15183. __pyx_t_6 = 0;
  15184. __pyx_t_7 = 127;
  15185. __Pyx_INCREF(__pyx_kp_u_Not_found_in_index);
  15186. __pyx_t_6 += 20;
  15187. __Pyx_GIVEREF(__pyx_kp_u_Not_found_in_index);
  15188. PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_kp_u_Not_found_in_index);
  15189. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1069
  15190. * except KeyNotFoundError:
  15191. * logger.debug(f'Not found in index: '
  15192. * f'{dbl_keys[i][: DBL_KLEN]}, ' # <<<<<<<<<<<<<<
  15193. * f'{keys[i][: KLEN]}')
  15194. * pass
  15195. */
  15196. __pyx_t_19 = __Pyx_PyBytes_FromStringAndSize(((const char*)(__pyx_v_dbl_keys[__pyx_v_i])) + 0, 10 - 0); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1069, __pyx_L24_except_error)
  15197. __Pyx_GOTREF(__pyx_t_19);
  15198. __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_t_19, __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1069, __pyx_L24_except_error)
  15199. __Pyx_GOTREF(__pyx_t_8);
  15200. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  15201. __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_7;
  15202. __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
  15203. __Pyx_GIVEREF(__pyx_t_8);
  15204. PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8);
  15205. __pyx_t_8 = 0;
  15206. __Pyx_INCREF(__pyx_kp_u__12);
  15207. __pyx_t_6 += 2;
  15208. __Pyx_GIVEREF(__pyx_kp_u__12);
  15209. PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_kp_u__12);
  15210. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1070
  15211. * logger.debug(f'Not found in index: '
  15212. * f'{dbl_keys[i][: DBL_KLEN]}, '
  15213. * f'{keys[i][: KLEN]}') # <<<<<<<<<<<<<<
  15214. * pass
  15215. * else:
  15216. */
  15217. __pyx_t_8 = __Pyx_PyBytes_FromStringAndSize(((const char*)(__pyx_v_keys[__pyx_v_i])) + 0, 5 - 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1070, __pyx_L24_except_error)
  15218. __Pyx_GOTREF(__pyx_t_8);
  15219. __pyx_t_19 = __Pyx_PyObject_FormatSimple(__pyx_t_8, __pyx_empty_unicode); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1070, __pyx_L24_except_error)
  15220. __Pyx_GOTREF(__pyx_t_19);
  15221. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  15222. __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_19) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_19) : __pyx_t_7;
  15223. __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_19);
  15224. __Pyx_GIVEREF(__pyx_t_19);
  15225. PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_19);
  15226. __pyx_t_19 = 0;
  15227. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1068
  15228. * f'{keys[i][: KLEN]}')
  15229. * except KeyNotFoundError:
  15230. * logger.debug(f'Not found in index: ' # <<<<<<<<<<<<<<
  15231. * f'{dbl_keys[i][: DBL_KLEN]}, '
  15232. * f'{keys[i][: KLEN]}')
  15233. */
  15234. __pyx_t_19 = __Pyx_PyUnicode_Join(__pyx_t_9, 4, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1068, __pyx_L24_except_error)
  15235. __Pyx_GOTREF(__pyx_t_19);
  15236. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  15237. __pyx_t_9 = NULL;
  15238. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) {
  15239. __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_20);
  15240. if (likely(__pyx_t_9)) {
  15241. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
  15242. __Pyx_INCREF(__pyx_t_9);
  15243. __Pyx_INCREF(function);
  15244. __Pyx_DECREF_SET(__pyx_t_20, function);
  15245. }
  15246. }
  15247. if (!__pyx_t_9) {
  15248. __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_20, __pyx_t_19); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1068, __pyx_L24_except_error)
  15249. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  15250. __Pyx_GOTREF(__pyx_t_4);
  15251. } else {
  15252. #if CYTHON_FAST_PYCALL
  15253. if (PyFunction_Check(__pyx_t_20)) {
  15254. PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_19};
  15255. __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_20, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1068, __pyx_L24_except_error)
  15256. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  15257. __Pyx_GOTREF(__pyx_t_4);
  15258. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  15259. } else
  15260. #endif
  15261. #if CYTHON_FAST_PYCCALL
  15262. if (__Pyx_PyFastCFunction_Check(__pyx_t_20)) {
  15263. PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_19};
  15264. __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_20, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1068, __pyx_L24_except_error)
  15265. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  15266. __Pyx_GOTREF(__pyx_t_4);
  15267. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  15268. } else
  15269. #endif
  15270. {
  15271. __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1068, __pyx_L24_except_error)
  15272. __Pyx_GOTREF(__pyx_t_8);
  15273. __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __pyx_t_9 = NULL;
  15274. __Pyx_GIVEREF(__pyx_t_19);
  15275. PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_19);
  15276. __pyx_t_19 = 0;
  15277. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1068, __pyx_L24_except_error)
  15278. __Pyx_GOTREF(__pyx_t_4);
  15279. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  15280. }
  15281. }
  15282. __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  15283. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  15284. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  15285. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  15286. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15287. goto __pyx_L23_exception_handled;
  15288. }
  15289. goto __pyx_L24_except_error;
  15290. __pyx_L24_except_error:;
  15291. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1062
  15292. * key_v.mv_data = keys[i]
  15293. * dbl_key_v.mv_data = dbl_keys[i]
  15294. * try: # <<<<<<<<<<<<<<
  15295. * _check(lmdb.mdb_cursor_get(
  15296. * cur2, &dbl_key_v, &key_v, lmdb.MDB_GET_BOTH))
  15297. */
  15298. __Pyx_XGIVEREF(__pyx_t_16);
  15299. __Pyx_XGIVEREF(__pyx_t_15);
  15300. __Pyx_XGIVEREF(__pyx_t_14);
  15301. __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_15, __pyx_t_14);
  15302. goto __pyx_L9_error;
  15303. __pyx_L23_exception_handled:;
  15304. __Pyx_XGIVEREF(__pyx_t_16);
  15305. __Pyx_XGIVEREF(__pyx_t_15);
  15306. __Pyx_XGIVEREF(__pyx_t_14);
  15307. __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_15, __pyx_t_14);
  15308. __pyx_L29_try_end:;
  15309. }
  15310. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1046
  15311. *
  15312. * # Removal op indexing.
  15313. * if op == IDX_OP_REMOVE: # <<<<<<<<<<<<<<
  15314. * try:
  15315. * _check(lmdb.mdb_cursor_get(
  15316. */
  15317. goto __pyx_L11;
  15318. }
  15319. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1076
  15320. *
  15321. * # Addition op indexing.
  15322. * elif op == IDX_OP_ADD: # <<<<<<<<<<<<<<
  15323. * logger.debug('Adding to index `{}`: {}, {}'.format(
  15324. * self.lookup_indices[i],
  15325. */
  15326. __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_op, __pyx_n_u_idx_add, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1076, __pyx_L9_error)
  15327. __pyx_t_2 = (__pyx_t_1 != 0);
  15328. if (likely(__pyx_t_2)) {
  15329. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1077
  15330. * # Addition op indexing.
  15331. * elif op == IDX_OP_ADD:
  15332. * logger.debug('Adding to index `{}`: {}, {}'.format( # <<<<<<<<<<<<<<
  15333. * self.lookup_indices[i],
  15334. * (<unsigned char *>key_v.mv_data)[ : key_v.mv_size],
  15335. */
  15336. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1077, __pyx_L9_error)
  15337. __Pyx_GOTREF(__pyx_t_5);
  15338. __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_debug); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1077, __pyx_L9_error)
  15339. __Pyx_GOTREF(__pyx_t_18);
  15340. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  15341. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Adding_to_index, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1077, __pyx_L9_error)
  15342. __Pyx_GOTREF(__pyx_t_4);
  15343. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1078
  15344. * elif op == IDX_OP_ADD:
  15345. * logger.debug('Adding to index `{}`: {}, {}'.format(
  15346. * self.lookup_indices[i], # <<<<<<<<<<<<<<
  15347. * (<unsigned char *>key_v.mv_data)[ : key_v.mv_size],
  15348. * (<unsigned char *>dbl_key_v.mv_data)[ : dbl_key_v.mv_size]))
  15349. */
  15350. __pyx_t_20 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_lookup_indices); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1078, __pyx_L9_error)
  15351. __Pyx_GOTREF(__pyx_t_20);
  15352. __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_20, __pyx_v_i, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1078, __pyx_L9_error)
  15353. __Pyx_GOTREF(__pyx_t_8);
  15354. __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  15355. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1079
  15356. * logger.debug('Adding to index `{}`: {}, {}'.format(
  15357. * self.lookup_indices[i],
  15358. * (<unsigned char *>key_v.mv_data)[ : key_v.mv_size], # <<<<<<<<<<<<<<
  15359. * (<unsigned char *>dbl_key_v.mv_data)[ : dbl_key_v.mv_size]))
  15360. *
  15361. */
  15362. __pyx_t_20 = __Pyx_PyBytes_FromStringAndSize(((const char*)((unsigned char *)__pyx_v_key_v.mv_data)) + 0, __pyx_v_key_v.mv_size - 0); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1079, __pyx_L9_error)
  15363. __Pyx_GOTREF(__pyx_t_20);
  15364. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1080
  15365. * self.lookup_indices[i],
  15366. * (<unsigned char *>key_v.mv_data)[ : key_v.mv_size],
  15367. * (<unsigned char *>dbl_key_v.mv_data)[ : dbl_key_v.mv_size])) # <<<<<<<<<<<<<<
  15368. *
  15369. * try:
  15370. */
  15371. __pyx_t_19 = __Pyx_PyBytes_FromStringAndSize(((const char*)((unsigned char *)__pyx_v_dbl_key_v.mv_data)) + 0, __pyx_v_dbl_key_v.mv_size - 0); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1080, __pyx_L9_error)
  15372. __Pyx_GOTREF(__pyx_t_19);
  15373. __pyx_t_9 = NULL;
  15374. __pyx_t_17 = 0;
  15375. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
  15376. __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
  15377. if (likely(__pyx_t_9)) {
  15378. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
  15379. __Pyx_INCREF(__pyx_t_9);
  15380. __Pyx_INCREF(function);
  15381. __Pyx_DECREF_SET(__pyx_t_4, function);
  15382. __pyx_t_17 = 1;
  15383. }
  15384. }
  15385. #if CYTHON_FAST_PYCALL
  15386. if (PyFunction_Check(__pyx_t_4)) {
  15387. PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_t_8, __pyx_t_20, __pyx_t_19};
  15388. __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_17, 3+__pyx_t_17); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1077, __pyx_L9_error)
  15389. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  15390. __Pyx_GOTREF(__pyx_t_5);
  15391. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  15392. __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  15393. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  15394. } else
  15395. #endif
  15396. #if CYTHON_FAST_PYCCALL
  15397. if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
  15398. PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_t_8, __pyx_t_20, __pyx_t_19};
  15399. __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_17, 3+__pyx_t_17); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1077, __pyx_L9_error)
  15400. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  15401. __Pyx_GOTREF(__pyx_t_5);
  15402. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  15403. __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  15404. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  15405. } else
  15406. #endif
  15407. {
  15408. __pyx_t_21 = PyTuple_New(3+__pyx_t_17); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 1077, __pyx_L9_error)
  15409. __Pyx_GOTREF(__pyx_t_21);
  15410. if (__pyx_t_9) {
  15411. __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_9); __pyx_t_9 = NULL;
  15412. }
  15413. __Pyx_GIVEREF(__pyx_t_8);
  15414. PyTuple_SET_ITEM(__pyx_t_21, 0+__pyx_t_17, __pyx_t_8);
  15415. __Pyx_GIVEREF(__pyx_t_20);
  15416. PyTuple_SET_ITEM(__pyx_t_21, 1+__pyx_t_17, __pyx_t_20);
  15417. __Pyx_GIVEREF(__pyx_t_19);
  15418. PyTuple_SET_ITEM(__pyx_t_21, 2+__pyx_t_17, __pyx_t_19);
  15419. __pyx_t_8 = 0;
  15420. __pyx_t_20 = 0;
  15421. __pyx_t_19 = 0;
  15422. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_21, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1077, __pyx_L9_error)
  15423. __Pyx_GOTREF(__pyx_t_5);
  15424. __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  15425. }
  15426. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  15427. __pyx_t_4 = NULL;
  15428. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_18))) {
  15429. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_18);
  15430. if (likely(__pyx_t_4)) {
  15431. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
  15432. __Pyx_INCREF(__pyx_t_4);
  15433. __Pyx_INCREF(function);
  15434. __Pyx_DECREF_SET(__pyx_t_18, function);
  15435. }
  15436. }
  15437. if (!__pyx_t_4) {
  15438. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_18, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1077, __pyx_L9_error)
  15439. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  15440. __Pyx_GOTREF(__pyx_t_3);
  15441. } else {
  15442. #if CYTHON_FAST_PYCALL
  15443. if (PyFunction_Check(__pyx_t_18)) {
  15444. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_5};
  15445. __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_18, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1077, __pyx_L9_error)
  15446. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  15447. __Pyx_GOTREF(__pyx_t_3);
  15448. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  15449. } else
  15450. #endif
  15451. #if CYTHON_FAST_PYCCALL
  15452. if (__Pyx_PyFastCFunction_Check(__pyx_t_18)) {
  15453. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_5};
  15454. __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_18, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1077, __pyx_L9_error)
  15455. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  15456. __Pyx_GOTREF(__pyx_t_3);
  15457. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  15458. } else
  15459. #endif
  15460. {
  15461. __pyx_t_21 = PyTuple_New(1+1); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 1077, __pyx_L9_error)
  15462. __Pyx_GOTREF(__pyx_t_21);
  15463. __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_4); __pyx_t_4 = NULL;
  15464. __Pyx_GIVEREF(__pyx_t_5);
  15465. PyTuple_SET_ITEM(__pyx_t_21, 0+1, __pyx_t_5);
  15466. __pyx_t_5 = 0;
  15467. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_t_21, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1077, __pyx_L9_error)
  15468. __Pyx_GOTREF(__pyx_t_3);
  15469. __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  15470. }
  15471. }
  15472. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  15473. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15474. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1082
  15475. * (<unsigned char *>dbl_key_v.mv_data)[ : dbl_key_v.mv_size]))
  15476. *
  15477. * try: # <<<<<<<<<<<<<<
  15478. * _check(lmdb.mdb_cursor_put(
  15479. * cur1, &key_v, &dbl_key_v, lmdb.MDB_NODUPDATA))
  15480. */
  15481. {
  15482. __Pyx_PyThreadState_declare
  15483. __Pyx_PyThreadState_assign
  15484. __Pyx_ExceptionSave(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
  15485. __Pyx_XGOTREF(__pyx_t_14);
  15486. __Pyx_XGOTREF(__pyx_t_15);
  15487. __Pyx_XGOTREF(__pyx_t_16);
  15488. /*try:*/ {
  15489. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1083
  15490. *
  15491. * try:
  15492. * _check(lmdb.mdb_cursor_put( # <<<<<<<<<<<<<<
  15493. * cur1, &key_v, &dbl_key_v, lmdb.MDB_NODUPDATA))
  15494. * except KeyExistsError:
  15495. */
  15496. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_put(__pyx_v_cur1, (&__pyx_v_key_v), (&__pyx_v_dbl_key_v), MDB_NODUPDATA), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1083, __pyx_L32_error)
  15497. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1082
  15498. * (<unsigned char *>dbl_key_v.mv_data)[ : dbl_key_v.mv_size]))
  15499. *
  15500. * try: # <<<<<<<<<<<<<<
  15501. * _check(lmdb.mdb_cursor_put(
  15502. * cur1, &key_v, &dbl_key_v, lmdb.MDB_NODUPDATA))
  15503. */
  15504. }
  15505. __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
  15506. __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
  15507. __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
  15508. goto __pyx_L39_try_end;
  15509. __pyx_L32_error:;
  15510. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  15511. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  15512. __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
  15513. __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
  15514. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  15515. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  15516. __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
  15517. __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
  15518. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  15519. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1085
  15520. * _check(lmdb.mdb_cursor_put(
  15521. * cur1, &key_v, &dbl_key_v, lmdb.MDB_NODUPDATA))
  15522. * except KeyExistsError: # <<<<<<<<<<<<<<
  15523. * logger.debug(f'Key {keys[i][: KLEN]} exists already.')
  15524. * pass
  15525. */
  15526. __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_18, &__pyx_t_21);
  15527. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyExistsError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1085, __pyx_L34_except_error)
  15528. __Pyx_GOTREF(__pyx_t_5);
  15529. __pyx_t_17 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_3, __pyx_t_5);
  15530. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  15531. __Pyx_ErrRestore(__pyx_t_3, __pyx_t_18, __pyx_t_21);
  15532. __pyx_t_3 = 0; __pyx_t_18 = 0; __pyx_t_21 = 0;
  15533. if (__pyx_t_17) {
  15534. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._index_triple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  15535. if (__Pyx_GetException(&__pyx_t_21, &__pyx_t_18, &__pyx_t_3) < 0) __PYX_ERR(0, 1085, __pyx_L34_except_error)
  15536. __Pyx_GOTREF(__pyx_t_21);
  15537. __Pyx_GOTREF(__pyx_t_18);
  15538. __Pyx_GOTREF(__pyx_t_3);
  15539. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1086
  15540. * cur1, &key_v, &dbl_key_v, lmdb.MDB_NODUPDATA))
  15541. * except KeyExistsError:
  15542. * logger.debug(f'Key {keys[i][: KLEN]} exists already.') # <<<<<<<<<<<<<<
  15543. * pass
  15544. *
  15545. */
  15546. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1086, __pyx_L34_except_error)
  15547. __Pyx_GOTREF(__pyx_t_4);
  15548. __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_debug); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1086, __pyx_L34_except_error)
  15549. __Pyx_GOTREF(__pyx_t_19);
  15550. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  15551. __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1086, __pyx_L34_except_error)
  15552. __Pyx_GOTREF(__pyx_t_4);
  15553. __pyx_t_6 = 0;
  15554. __pyx_t_7 = 127;
  15555. __Pyx_INCREF(__pyx_kp_u_Key);
  15556. __pyx_t_6 += 4;
  15557. __Pyx_GIVEREF(__pyx_kp_u_Key);
  15558. PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_Key);
  15559. __pyx_t_20 = __Pyx_PyBytes_FromStringAndSize(((const char*)(__pyx_v_keys[__pyx_v_i])) + 0, 5 - 0); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1086, __pyx_L34_except_error)
  15560. __Pyx_GOTREF(__pyx_t_20);
  15561. __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_t_20, __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1086, __pyx_L34_except_error)
  15562. __Pyx_GOTREF(__pyx_t_8);
  15563. __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  15564. __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_7;
  15565. __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
  15566. __Pyx_GIVEREF(__pyx_t_8);
  15567. PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_8);
  15568. __pyx_t_8 = 0;
  15569. __Pyx_INCREF(__pyx_kp_u_exists_already);
  15570. __pyx_t_6 += 16;
  15571. __Pyx_GIVEREF(__pyx_kp_u_exists_already);
  15572. PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_exists_already);
  15573. __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1086, __pyx_L34_except_error)
  15574. __Pyx_GOTREF(__pyx_t_8);
  15575. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  15576. __pyx_t_4 = NULL;
  15577. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) {
  15578. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_19);
  15579. if (likely(__pyx_t_4)) {
  15580. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19);
  15581. __Pyx_INCREF(__pyx_t_4);
  15582. __Pyx_INCREF(function);
  15583. __Pyx_DECREF_SET(__pyx_t_19, function);
  15584. }
  15585. }
  15586. if (!__pyx_t_4) {
  15587. __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_19, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1086, __pyx_L34_except_error)
  15588. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  15589. __Pyx_GOTREF(__pyx_t_5);
  15590. } else {
  15591. #if CYTHON_FAST_PYCALL
  15592. if (PyFunction_Check(__pyx_t_19)) {
  15593. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_8};
  15594. __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1086, __pyx_L34_except_error)
  15595. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  15596. __Pyx_GOTREF(__pyx_t_5);
  15597. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  15598. } else
  15599. #endif
  15600. #if CYTHON_FAST_PYCCALL
  15601. if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) {
  15602. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_8};
  15603. __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1086, __pyx_L34_except_error)
  15604. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  15605. __Pyx_GOTREF(__pyx_t_5);
  15606. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  15607. } else
  15608. #endif
  15609. {
  15610. __pyx_t_20 = PyTuple_New(1+1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1086, __pyx_L34_except_error)
  15611. __Pyx_GOTREF(__pyx_t_20);
  15612. __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_4); __pyx_t_4 = NULL;
  15613. __Pyx_GIVEREF(__pyx_t_8);
  15614. PyTuple_SET_ITEM(__pyx_t_20, 0+1, __pyx_t_8);
  15615. __pyx_t_8 = 0;
  15616. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_20, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1086, __pyx_L34_except_error)
  15617. __Pyx_GOTREF(__pyx_t_5);
  15618. __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  15619. }
  15620. }
  15621. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  15622. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  15623. __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  15624. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  15625. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15626. goto __pyx_L33_exception_handled;
  15627. }
  15628. goto __pyx_L34_except_error;
  15629. __pyx_L34_except_error:;
  15630. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1082
  15631. * (<unsigned char *>dbl_key_v.mv_data)[ : dbl_key_v.mv_size]))
  15632. *
  15633. * try: # <<<<<<<<<<<<<<
  15634. * _check(lmdb.mdb_cursor_put(
  15635. * cur1, &key_v, &dbl_key_v, lmdb.MDB_NODUPDATA))
  15636. */
  15637. __Pyx_XGIVEREF(__pyx_t_14);
  15638. __Pyx_XGIVEREF(__pyx_t_15);
  15639. __Pyx_XGIVEREF(__pyx_t_16);
  15640. __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
  15641. goto __pyx_L9_error;
  15642. __pyx_L33_exception_handled:;
  15643. __Pyx_XGIVEREF(__pyx_t_14);
  15644. __Pyx_XGIVEREF(__pyx_t_15);
  15645. __Pyx_XGIVEREF(__pyx_t_16);
  15646. __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
  15647. __pyx_L39_try_end:;
  15648. }
  15649. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1089
  15650. * pass
  15651. *
  15652. * logger.debug('Adding to index `{}`: {}, {}'.format( # <<<<<<<<<<<<<<
  15653. * self.lookup_indices[i + 3],
  15654. * (<unsigned char *>dbl_key_v.mv_data)[ : dbl_key_v.mv_size],
  15655. */
  15656. __pyx_t_18 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1089, __pyx_L9_error)
  15657. __Pyx_GOTREF(__pyx_t_18);
  15658. __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s_debug); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 1089, __pyx_L9_error)
  15659. __Pyx_GOTREF(__pyx_t_21);
  15660. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  15661. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Adding_to_index, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1089, __pyx_L9_error)
  15662. __Pyx_GOTREF(__pyx_t_5);
  15663. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1090
  15664. *
  15665. * logger.debug('Adding to index `{}`: {}, {}'.format(
  15666. * self.lookup_indices[i + 3], # <<<<<<<<<<<<<<
  15667. * (<unsigned char *>dbl_key_v.mv_data)[ : dbl_key_v.mv_size],
  15668. * (<unsigned char *>key_v.mv_data)[ : key_v.mv_size]))
  15669. */
  15670. __pyx_t_19 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_lookup_indices); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1090, __pyx_L9_error)
  15671. __Pyx_GOTREF(__pyx_t_19);
  15672. __pyx_t_13 = (__pyx_v_i + 3);
  15673. __pyx_t_20 = __Pyx_GetItemInt(__pyx_t_19, __pyx_t_13, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 0); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1090, __pyx_L9_error)
  15674. __Pyx_GOTREF(__pyx_t_20);
  15675. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  15676. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1091
  15677. * logger.debug('Adding to index `{}`: {}, {}'.format(
  15678. * self.lookup_indices[i + 3],
  15679. * (<unsigned char *>dbl_key_v.mv_data)[ : dbl_key_v.mv_size], # <<<<<<<<<<<<<<
  15680. * (<unsigned char *>key_v.mv_data)[ : key_v.mv_size]))
  15681. *
  15682. */
  15683. __pyx_t_19 = __Pyx_PyBytes_FromStringAndSize(((const char*)((unsigned char *)__pyx_v_dbl_key_v.mv_data)) + 0, __pyx_v_dbl_key_v.mv_size - 0); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1091, __pyx_L9_error)
  15684. __Pyx_GOTREF(__pyx_t_19);
  15685. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1092
  15686. * self.lookup_indices[i + 3],
  15687. * (<unsigned char *>dbl_key_v.mv_data)[ : dbl_key_v.mv_size],
  15688. * (<unsigned char *>key_v.mv_data)[ : key_v.mv_size])) # <<<<<<<<<<<<<<
  15689. *
  15690. * try:
  15691. */
  15692. __pyx_t_8 = __Pyx_PyBytes_FromStringAndSize(((const char*)((unsigned char *)__pyx_v_key_v.mv_data)) + 0, __pyx_v_key_v.mv_size - 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1092, __pyx_L9_error)
  15693. __Pyx_GOTREF(__pyx_t_8);
  15694. __pyx_t_4 = NULL;
  15695. __pyx_t_17 = 0;
  15696. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
  15697. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
  15698. if (likely(__pyx_t_4)) {
  15699. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
  15700. __Pyx_INCREF(__pyx_t_4);
  15701. __Pyx_INCREF(function);
  15702. __Pyx_DECREF_SET(__pyx_t_5, function);
  15703. __pyx_t_17 = 1;
  15704. }
  15705. }
  15706. #if CYTHON_FAST_PYCALL
  15707. if (PyFunction_Check(__pyx_t_5)) {
  15708. PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_20, __pyx_t_19, __pyx_t_8};
  15709. __pyx_t_18 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_17, 3+__pyx_t_17); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1089, __pyx_L9_error)
  15710. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  15711. __Pyx_GOTREF(__pyx_t_18);
  15712. __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  15713. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  15714. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  15715. } else
  15716. #endif
  15717. #if CYTHON_FAST_PYCCALL
  15718. if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
  15719. PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_20, __pyx_t_19, __pyx_t_8};
  15720. __pyx_t_18 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_17, 3+__pyx_t_17); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1089, __pyx_L9_error)
  15721. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  15722. __Pyx_GOTREF(__pyx_t_18);
  15723. __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  15724. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  15725. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  15726. } else
  15727. #endif
  15728. {
  15729. __pyx_t_9 = PyTuple_New(3+__pyx_t_17); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1089, __pyx_L9_error)
  15730. __Pyx_GOTREF(__pyx_t_9);
  15731. if (__pyx_t_4) {
  15732. __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL;
  15733. }
  15734. __Pyx_GIVEREF(__pyx_t_20);
  15735. PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_17, __pyx_t_20);
  15736. __Pyx_GIVEREF(__pyx_t_19);
  15737. PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_17, __pyx_t_19);
  15738. __Pyx_GIVEREF(__pyx_t_8);
  15739. PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_17, __pyx_t_8);
  15740. __pyx_t_20 = 0;
  15741. __pyx_t_19 = 0;
  15742. __pyx_t_8 = 0;
  15743. __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1089, __pyx_L9_error)
  15744. __Pyx_GOTREF(__pyx_t_18);
  15745. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  15746. }
  15747. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  15748. __pyx_t_5 = NULL;
  15749. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_21))) {
  15750. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_21);
  15751. if (likely(__pyx_t_5)) {
  15752. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21);
  15753. __Pyx_INCREF(__pyx_t_5);
  15754. __Pyx_INCREF(function);
  15755. __Pyx_DECREF_SET(__pyx_t_21, function);
  15756. }
  15757. }
  15758. if (!__pyx_t_5) {
  15759. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_21, __pyx_t_18); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1089, __pyx_L9_error)
  15760. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  15761. __Pyx_GOTREF(__pyx_t_3);
  15762. } else {
  15763. #if CYTHON_FAST_PYCALL
  15764. if (PyFunction_Check(__pyx_t_21)) {
  15765. PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_18};
  15766. __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_21, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1089, __pyx_L9_error)
  15767. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  15768. __Pyx_GOTREF(__pyx_t_3);
  15769. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  15770. } else
  15771. #endif
  15772. #if CYTHON_FAST_PYCCALL
  15773. if (__Pyx_PyFastCFunction_Check(__pyx_t_21)) {
  15774. PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_18};
  15775. __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_21, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1089, __pyx_L9_error)
  15776. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  15777. __Pyx_GOTREF(__pyx_t_3);
  15778. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  15779. } else
  15780. #endif
  15781. {
  15782. __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1089, __pyx_L9_error)
  15783. __Pyx_GOTREF(__pyx_t_9);
  15784. __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); __pyx_t_5 = NULL;
  15785. __Pyx_GIVEREF(__pyx_t_18);
  15786. PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_18);
  15787. __pyx_t_18 = 0;
  15788. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_21, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1089, __pyx_L9_error)
  15789. __Pyx_GOTREF(__pyx_t_3);
  15790. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  15791. }
  15792. }
  15793. __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  15794. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15795. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1094
  15796. * (<unsigned char *>key_v.mv_data)[ : key_v.mv_size]))
  15797. *
  15798. * try: # <<<<<<<<<<<<<<
  15799. * _check(lmdb.mdb_cursor_put(
  15800. * cur2, &dbl_key_v, &key_v, lmdb.MDB_NODUPDATA))
  15801. */
  15802. {
  15803. __Pyx_PyThreadState_declare
  15804. __Pyx_PyThreadState_assign
  15805. __Pyx_ExceptionSave(&__pyx_t_16, &__pyx_t_15, &__pyx_t_14);
  15806. __Pyx_XGOTREF(__pyx_t_16);
  15807. __Pyx_XGOTREF(__pyx_t_15);
  15808. __Pyx_XGOTREF(__pyx_t_14);
  15809. /*try:*/ {
  15810. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1095
  15811. *
  15812. * try:
  15813. * _check(lmdb.mdb_cursor_put( # <<<<<<<<<<<<<<
  15814. * cur2, &dbl_key_v, &key_v, lmdb.MDB_NODUPDATA))
  15815. * except KeyExistsError:
  15816. */
  15817. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_put(__pyx_v_cur2, (&__pyx_v_dbl_key_v), (&__pyx_v_key_v), MDB_NODUPDATA), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1095, __pyx_L42_error)
  15818. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1094
  15819. * (<unsigned char *>key_v.mv_data)[ : key_v.mv_size]))
  15820. *
  15821. * try: # <<<<<<<<<<<<<<
  15822. * _check(lmdb.mdb_cursor_put(
  15823. * cur2, &dbl_key_v, &key_v, lmdb.MDB_NODUPDATA))
  15824. */
  15825. }
  15826. __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
  15827. __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
  15828. __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
  15829. goto __pyx_L49_try_end;
  15830. __pyx_L42_error:;
  15831. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  15832. __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
  15833. __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
  15834. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  15835. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  15836. __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
  15837. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  15838. __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
  15839. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  15840. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1097
  15841. * _check(lmdb.mdb_cursor_put(
  15842. * cur2, &dbl_key_v, &key_v, lmdb.MDB_NODUPDATA))
  15843. * except KeyExistsError: # <<<<<<<<<<<<<<
  15844. * logger.debug(f'Double key {dbl_keys[i][: DBL_KLEN]} exists already.')
  15845. * pass
  15846. */
  15847. __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_21, &__pyx_t_9);
  15848. __pyx_t_18 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyExistsError); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1097, __pyx_L44_except_error)
  15849. __Pyx_GOTREF(__pyx_t_18);
  15850. __pyx_t_17 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_3, __pyx_t_18);
  15851. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  15852. __Pyx_ErrRestore(__pyx_t_3, __pyx_t_21, __pyx_t_9);
  15853. __pyx_t_3 = 0; __pyx_t_21 = 0; __pyx_t_9 = 0;
  15854. if (__pyx_t_17) {
  15855. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._index_triple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  15856. if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_21, &__pyx_t_3) < 0) __PYX_ERR(0, 1097, __pyx_L44_except_error)
  15857. __Pyx_GOTREF(__pyx_t_9);
  15858. __Pyx_GOTREF(__pyx_t_21);
  15859. __Pyx_GOTREF(__pyx_t_3);
  15860. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1098
  15861. * cur2, &dbl_key_v, &key_v, lmdb.MDB_NODUPDATA))
  15862. * except KeyExistsError:
  15863. * logger.debug(f'Double key {dbl_keys[i][: DBL_KLEN]} exists already.') # <<<<<<<<<<<<<<
  15864. * pass
  15865. * else:
  15866. */
  15867. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1098, __pyx_L44_except_error)
  15868. __Pyx_GOTREF(__pyx_t_5);
  15869. __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_debug); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1098, __pyx_L44_except_error)
  15870. __Pyx_GOTREF(__pyx_t_8);
  15871. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  15872. __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1098, __pyx_L44_except_error)
  15873. __Pyx_GOTREF(__pyx_t_5);
  15874. __pyx_t_6 = 0;
  15875. __pyx_t_7 = 127;
  15876. __Pyx_INCREF(__pyx_kp_u_Double_key);
  15877. __pyx_t_6 += 11;
  15878. __Pyx_GIVEREF(__pyx_kp_u_Double_key);
  15879. PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Double_key);
  15880. __pyx_t_19 = __Pyx_PyBytes_FromStringAndSize(((const char*)(__pyx_v_dbl_keys[__pyx_v_i])) + 0, 10 - 0); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1098, __pyx_L44_except_error)
  15881. __Pyx_GOTREF(__pyx_t_19);
  15882. __pyx_t_20 = __Pyx_PyObject_FormatSimple(__pyx_t_19, __pyx_empty_unicode); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1098, __pyx_L44_except_error)
  15883. __Pyx_GOTREF(__pyx_t_20);
  15884. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  15885. __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_20) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_20) : __pyx_t_7;
  15886. __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_20);
  15887. __Pyx_GIVEREF(__pyx_t_20);
  15888. PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_20);
  15889. __pyx_t_20 = 0;
  15890. __Pyx_INCREF(__pyx_kp_u_exists_already);
  15891. __pyx_t_6 += 16;
  15892. __Pyx_GIVEREF(__pyx_kp_u_exists_already);
  15893. PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u_exists_already);
  15894. __pyx_t_20 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1098, __pyx_L44_except_error)
  15895. __Pyx_GOTREF(__pyx_t_20);
  15896. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  15897. __pyx_t_5 = NULL;
  15898. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
  15899. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
  15900. if (likely(__pyx_t_5)) {
  15901. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
  15902. __Pyx_INCREF(__pyx_t_5);
  15903. __Pyx_INCREF(function);
  15904. __Pyx_DECREF_SET(__pyx_t_8, function);
  15905. }
  15906. }
  15907. if (!__pyx_t_5) {
  15908. __pyx_t_18 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_20); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1098, __pyx_L44_except_error)
  15909. __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  15910. __Pyx_GOTREF(__pyx_t_18);
  15911. } else {
  15912. #if CYTHON_FAST_PYCALL
  15913. if (PyFunction_Check(__pyx_t_8)) {
  15914. PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_20};
  15915. __pyx_t_18 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1098, __pyx_L44_except_error)
  15916. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  15917. __Pyx_GOTREF(__pyx_t_18);
  15918. __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  15919. } else
  15920. #endif
  15921. #if CYTHON_FAST_PYCCALL
  15922. if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
  15923. PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_20};
  15924. __pyx_t_18 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1098, __pyx_L44_except_error)
  15925. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  15926. __Pyx_GOTREF(__pyx_t_18);
  15927. __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  15928. } else
  15929. #endif
  15930. {
  15931. __pyx_t_19 = PyTuple_New(1+1); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1098, __pyx_L44_except_error)
  15932. __Pyx_GOTREF(__pyx_t_19);
  15933. __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_5); __pyx_t_5 = NULL;
  15934. __Pyx_GIVEREF(__pyx_t_20);
  15935. PyTuple_SET_ITEM(__pyx_t_19, 0+1, __pyx_t_20);
  15936. __pyx_t_20 = 0;
  15937. __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_19, NULL); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1098, __pyx_L44_except_error)
  15938. __Pyx_GOTREF(__pyx_t_18);
  15939. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  15940. }
  15941. }
  15942. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  15943. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  15944. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  15945. __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  15946. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15947. goto __pyx_L43_exception_handled;
  15948. }
  15949. goto __pyx_L44_except_error;
  15950. __pyx_L44_except_error:;
  15951. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1094
  15952. * (<unsigned char *>key_v.mv_data)[ : key_v.mv_size]))
  15953. *
  15954. * try: # <<<<<<<<<<<<<<
  15955. * _check(lmdb.mdb_cursor_put(
  15956. * cur2, &dbl_key_v, &key_v, lmdb.MDB_NODUPDATA))
  15957. */
  15958. __Pyx_XGIVEREF(__pyx_t_16);
  15959. __Pyx_XGIVEREF(__pyx_t_15);
  15960. __Pyx_XGIVEREF(__pyx_t_14);
  15961. __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_15, __pyx_t_14);
  15962. goto __pyx_L9_error;
  15963. __pyx_L43_exception_handled:;
  15964. __Pyx_XGIVEREF(__pyx_t_16);
  15965. __Pyx_XGIVEREF(__pyx_t_15);
  15966. __Pyx_XGIVEREF(__pyx_t_14);
  15967. __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_15, __pyx_t_14);
  15968. __pyx_L49_try_end:;
  15969. }
  15970. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1076
  15971. *
  15972. * # Addition op indexing.
  15973. * elif op == IDX_OP_ADD: # <<<<<<<<<<<<<<
  15974. * logger.debug('Adding to index `{}`: {}, {}'.format(
  15975. * self.lookup_indices[i],
  15976. */
  15977. goto __pyx_L11;
  15978. }
  15979. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1101
  15980. * pass
  15981. * else:
  15982. * raise ValueError( # <<<<<<<<<<<<<<
  15983. * 'Index operation \'{}\' is not supported.'.format(op))
  15984. * i += 1
  15985. */
  15986. /*else*/ {
  15987. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1102
  15988. * else:
  15989. * raise ValueError(
  15990. * 'Index operation \'{}\' is not supported.'.format(op)) # <<<<<<<<<<<<<<
  15991. * i += 1
  15992. * finally:
  15993. */
  15994. __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Index_operation_is_not_supported, __pyx_n_s_format); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 1102, __pyx_L9_error)
  15995. __Pyx_GOTREF(__pyx_t_21);
  15996. __pyx_t_9 = NULL;
  15997. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_21))) {
  15998. __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_21);
  15999. if (likely(__pyx_t_9)) {
  16000. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21);
  16001. __Pyx_INCREF(__pyx_t_9);
  16002. __Pyx_INCREF(function);
  16003. __Pyx_DECREF_SET(__pyx_t_21, function);
  16004. }
  16005. }
  16006. if (!__pyx_t_9) {
  16007. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_21, __pyx_v_op); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1102, __pyx_L9_error)
  16008. __Pyx_GOTREF(__pyx_t_3);
  16009. } else {
  16010. #if CYTHON_FAST_PYCALL
  16011. if (PyFunction_Check(__pyx_t_21)) {
  16012. PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_op};
  16013. __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_21, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1102, __pyx_L9_error)
  16014. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  16015. __Pyx_GOTREF(__pyx_t_3);
  16016. } else
  16017. #endif
  16018. #if CYTHON_FAST_PYCCALL
  16019. if (__Pyx_PyFastCFunction_Check(__pyx_t_21)) {
  16020. PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_op};
  16021. __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_21, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1102, __pyx_L9_error)
  16022. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  16023. __Pyx_GOTREF(__pyx_t_3);
  16024. } else
  16025. #endif
  16026. {
  16027. __pyx_t_18 = PyTuple_New(1+1); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1102, __pyx_L9_error)
  16028. __Pyx_GOTREF(__pyx_t_18);
  16029. __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_9); __pyx_t_9 = NULL;
  16030. __Pyx_INCREF(__pyx_v_op);
  16031. __Pyx_GIVEREF(__pyx_v_op);
  16032. PyTuple_SET_ITEM(__pyx_t_18, 0+1, __pyx_v_op);
  16033. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_21, __pyx_t_18, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1102, __pyx_L9_error)
  16034. __Pyx_GOTREF(__pyx_t_3);
  16035. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  16036. }
  16037. }
  16038. __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  16039. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1101
  16040. * pass
  16041. * else:
  16042. * raise ValueError( # <<<<<<<<<<<<<<
  16043. * 'Index operation \'{}\' is not supported.'.format(op))
  16044. * i += 1
  16045. */
  16046. __pyx_t_21 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 1101, __pyx_L9_error)
  16047. __Pyx_GOTREF(__pyx_t_21);
  16048. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16049. __Pyx_Raise(__pyx_t_21, 0, 0, 0);
  16050. __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  16051. __PYX_ERR(0, 1101, __pyx_L9_error)
  16052. }
  16053. __pyx_L11:;
  16054. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1103
  16055. * raise ValueError(
  16056. * 'Index operation \'{}\' is not supported.'.format(op))
  16057. * i += 1 # <<<<<<<<<<<<<<
  16058. * finally:
  16059. * #pass
  16060. */
  16061. __pyx_v_i = (__pyx_v_i + 1);
  16062. }
  16063. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1106
  16064. * finally:
  16065. * #pass
  16066. * self._cur_close(cur1) # <<<<<<<<<<<<<<
  16067. * self._cur_close(cur2)
  16068. *
  16069. */
  16070. /*finally:*/ {
  16071. /*normal exit:*/{
  16072. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_cur1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1106, __pyx_L1_error)
  16073. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1107
  16074. * #pass
  16075. * self._cur_close(cur1)
  16076. * self._cur_close(cur2) # <<<<<<<<<<<<<<
  16077. *
  16078. *
  16079. */
  16080. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_cur2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1107, __pyx_L1_error)
  16081. goto __pyx_L10;
  16082. }
  16083. __pyx_L9_error:;
  16084. /*exception exit:*/{
  16085. __Pyx_PyThreadState_declare
  16086. __Pyx_PyThreadState_assign
  16087. __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0;
  16088. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  16089. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  16090. __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
  16091. __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
  16092. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  16093. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  16094. __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
  16095. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  16096. __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
  16097. if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_24, &__pyx_t_25, &__pyx_t_26);
  16098. if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16) < 0)) __Pyx_ErrFetch(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
  16099. __Pyx_XGOTREF(__pyx_t_14);
  16100. __Pyx_XGOTREF(__pyx_t_15);
  16101. __Pyx_XGOTREF(__pyx_t_16);
  16102. __Pyx_XGOTREF(__pyx_t_24);
  16103. __Pyx_XGOTREF(__pyx_t_25);
  16104. __Pyx_XGOTREF(__pyx_t_26);
  16105. __pyx_t_17 = __pyx_lineno; __pyx_t_22 = __pyx_clineno; __pyx_t_23 = __pyx_filename;
  16106. {
  16107. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1106
  16108. * finally:
  16109. * #pass
  16110. * self._cur_close(cur1) # <<<<<<<<<<<<<<
  16111. * self._cur_close(cur2)
  16112. *
  16113. */
  16114. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_cur1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1106, __pyx_L55_error)
  16115. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1107
  16116. * #pass
  16117. * self._cur_close(cur1)
  16118. * self._cur_close(cur2) # <<<<<<<<<<<<<<
  16119. *
  16120. *
  16121. */
  16122. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_cur2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1107, __pyx_L55_error)
  16123. }
  16124. if (PY_MAJOR_VERSION >= 3) {
  16125. __Pyx_XGIVEREF(__pyx_t_24);
  16126. __Pyx_XGIVEREF(__pyx_t_25);
  16127. __Pyx_XGIVEREF(__pyx_t_26);
  16128. __Pyx_ExceptionReset(__pyx_t_24, __pyx_t_25, __pyx_t_26);
  16129. }
  16130. __Pyx_XGIVEREF(__pyx_t_14);
  16131. __Pyx_XGIVEREF(__pyx_t_15);
  16132. __Pyx_XGIVEREF(__pyx_t_16);
  16133. __Pyx_ErrRestore(__pyx_t_14, __pyx_t_15, __pyx_t_16);
  16134. __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0;
  16135. __pyx_lineno = __pyx_t_17; __pyx_clineno = __pyx_t_22; __pyx_filename = __pyx_t_23;
  16136. goto __pyx_L1_error;
  16137. __pyx_L55_error:;
  16138. if (PY_MAJOR_VERSION >= 3) {
  16139. __Pyx_XGIVEREF(__pyx_t_24);
  16140. __Pyx_XGIVEREF(__pyx_t_25);
  16141. __Pyx_XGIVEREF(__pyx_t_26);
  16142. __Pyx_ExceptionReset(__pyx_t_24, __pyx_t_25, __pyx_t_26);
  16143. }
  16144. __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
  16145. __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
  16146. __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
  16147. __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0;
  16148. goto __pyx_L1_error;
  16149. }
  16150. __pyx_L10:;
  16151. }
  16152. }
  16153. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":996
  16154. *
  16155. *
  16156. * cdef void _index_triple(self, str op, TripleKey spok) except *: # <<<<<<<<<<<<<<
  16157. * """
  16158. * Update index for a triple and context (add or remove).
  16159. */
  16160. /* function exit code */
  16161. goto __pyx_L0;
  16162. __pyx_L1_error:;
  16163. __Pyx_XDECREF(__pyx_t_3);
  16164. __Pyx_XDECREF(__pyx_t_4);
  16165. __Pyx_XDECREF(__pyx_t_5);
  16166. __Pyx_XDECREF(__pyx_t_8);
  16167. __Pyx_XDECREF(__pyx_t_9);
  16168. __Pyx_XDECREF(__pyx_t_18);
  16169. __Pyx_XDECREF(__pyx_t_19);
  16170. __Pyx_XDECREF(__pyx_t_20);
  16171. __Pyx_XDECREF(__pyx_t_21);
  16172. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._index_triple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  16173. __pyx_L0:;
  16174. __Pyx_TraceReturn(Py_None, 0);
  16175. __Pyx_RefNannyFinishContext();
  16176. }
  16177. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1110
  16178. *
  16179. *
  16180. * cpdef void _remove_graph(self, object gr_uri) except *: # <<<<<<<<<<<<<<
  16181. * """
  16182. * Delete a context.
  16183. */
  16184. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_13_remove_graph(PyObject *__pyx_v_self, PyObject *__pyx_v_gr_uri); /*proto*/
  16185. static void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__remove_graph(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_gr_uri, int __pyx_skip_dispatch) {
  16186. unsigned char __pyx_v_chash[20];
  16187. unsigned char __pyx_v_ck[5];
  16188. unsigned char *__pyx_v_pk_c;
  16189. size_t __pyx_v_c_size;
  16190. struct MDB_val __pyx_v_ck_v;
  16191. struct MDB_val __pyx_v_chash_v;
  16192. __Pyx_TraceDeclarations
  16193. __Pyx_RefNannyDeclarations
  16194. PyObject *__pyx_t_1 = NULL;
  16195. PyObject *__pyx_t_2 = NULL;
  16196. PyObject *__pyx_t_3 = NULL;
  16197. PyObject *__pyx_t_4 = NULL;
  16198. PyObject *__pyx_t_5 = NULL;
  16199. PyObject *__pyx_t_6 = NULL;
  16200. PyObject *__pyx_t_7 = NULL;
  16201. PyObject *__pyx_t_8 = NULL;
  16202. int __pyx_t_9;
  16203. struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__remove __pyx_t_10;
  16204. MDB_dbi __pyx_t_11;
  16205. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore_get_dbi __pyx_t_12;
  16206. __Pyx_RefNannySetupContext("_remove_graph", 0);
  16207. __Pyx_TraceCall("_remove_graph", __pyx_f[0], 1110, 0, __PYX_ERR(0, 1110, __pyx_L1_error));
  16208. /* Check if called by wrapper */
  16209. if (unlikely(__pyx_skip_dispatch)) ;
  16210. /* Check if overridden in Python */
  16211. else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
  16212. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_remove_graph); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1110, __pyx_L1_error)
  16213. __Pyx_GOTREF(__pyx_t_1);
  16214. if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_13_remove_graph)) {
  16215. __Pyx_INCREF(__pyx_t_1);
  16216. __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
  16217. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  16218. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
  16219. if (likely(__pyx_t_4)) {
  16220. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  16221. __Pyx_INCREF(__pyx_t_4);
  16222. __Pyx_INCREF(function);
  16223. __Pyx_DECREF_SET(__pyx_t_3, function);
  16224. }
  16225. }
  16226. if (!__pyx_t_4) {
  16227. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_gr_uri); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1110, __pyx_L1_error)
  16228. __Pyx_GOTREF(__pyx_t_2);
  16229. } else {
  16230. #if CYTHON_FAST_PYCALL
  16231. if (PyFunction_Check(__pyx_t_3)) {
  16232. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_gr_uri};
  16233. __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1110, __pyx_L1_error)
  16234. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  16235. __Pyx_GOTREF(__pyx_t_2);
  16236. } else
  16237. #endif
  16238. #if CYTHON_FAST_PYCCALL
  16239. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  16240. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_gr_uri};
  16241. __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1110, __pyx_L1_error)
  16242. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  16243. __Pyx_GOTREF(__pyx_t_2);
  16244. } else
  16245. #endif
  16246. {
  16247. __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1110, __pyx_L1_error)
  16248. __Pyx_GOTREF(__pyx_t_5);
  16249. __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
  16250. __Pyx_INCREF(__pyx_v_gr_uri);
  16251. __Pyx_GIVEREF(__pyx_v_gr_uri);
  16252. PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_gr_uri);
  16253. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1110, __pyx_L1_error)
  16254. __Pyx_GOTREF(__pyx_t_2);
  16255. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  16256. }
  16257. }
  16258. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16259. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  16260. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16261. goto __pyx_L0;
  16262. }
  16263. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16264. }
  16265. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1125
  16266. *
  16267. * # Gather information on the graph prior to deletion.
  16268. * try: # <<<<<<<<<<<<<<
  16269. * self._to_key(gr_uri, &ck)
  16270. * except KeyNotFoundError:
  16271. */
  16272. {
  16273. __Pyx_PyThreadState_declare
  16274. __Pyx_PyThreadState_assign
  16275. __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
  16276. __Pyx_XGOTREF(__pyx_t_6);
  16277. __Pyx_XGOTREF(__pyx_t_7);
  16278. __Pyx_XGOTREF(__pyx_t_8);
  16279. /*try:*/ {
  16280. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1126
  16281. * # Gather information on the graph prior to deletion.
  16282. * try:
  16283. * self._to_key(gr_uri, &ck) # <<<<<<<<<<<<<<
  16284. * except KeyNotFoundError:
  16285. * return
  16286. */
  16287. __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__to_key(__pyx_v_self, __pyx_v_gr_uri, (&__pyx_v_ck)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1126, __pyx_L3_error)
  16288. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1125
  16289. *
  16290. * # Gather information on the graph prior to deletion.
  16291. * try: # <<<<<<<<<<<<<<
  16292. * self._to_key(gr_uri, &ck)
  16293. * except KeyNotFoundError:
  16294. */
  16295. }
  16296. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  16297. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  16298. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  16299. goto __pyx_L8_try_end;
  16300. __pyx_L3_error:;
  16301. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  16302. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  16303. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  16304. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  16305. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  16306. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1127
  16307. * try:
  16308. * self._to_key(gr_uri, &ck)
  16309. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  16310. * return
  16311. *
  16312. */
  16313. __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  16314. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1127, __pyx_L5_except_error)
  16315. __Pyx_GOTREF(__pyx_t_5);
  16316. __pyx_t_9 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_5);
  16317. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  16318. __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  16319. __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0;
  16320. if (__pyx_t_9) {
  16321. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._remove_graph", __pyx_clineno, __pyx_lineno, __pyx_filename);
  16322. if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 1127, __pyx_L5_except_error)
  16323. __Pyx_GOTREF(__pyx_t_3);
  16324. __Pyx_GOTREF(__pyx_t_2);
  16325. __Pyx_GOTREF(__pyx_t_1);
  16326. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1128
  16327. * self._to_key(gr_uri, &ck)
  16328. * except KeyNotFoundError:
  16329. * return # <<<<<<<<<<<<<<
  16330. *
  16331. * # Remove all triples and indices associated with the graph.
  16332. */
  16333. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16334. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  16335. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16336. goto __pyx_L6_except_return;
  16337. }
  16338. goto __pyx_L5_except_error;
  16339. __pyx_L5_except_error:;
  16340. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1125
  16341. *
  16342. * # Gather information on the graph prior to deletion.
  16343. * try: # <<<<<<<<<<<<<<
  16344. * self._to_key(gr_uri, &ck)
  16345. * except KeyNotFoundError:
  16346. */
  16347. __Pyx_XGIVEREF(__pyx_t_6);
  16348. __Pyx_XGIVEREF(__pyx_t_7);
  16349. __Pyx_XGIVEREF(__pyx_t_8);
  16350. __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
  16351. goto __pyx_L1_error;
  16352. __pyx_L6_except_return:;
  16353. __Pyx_XGIVEREF(__pyx_t_6);
  16354. __Pyx_XGIVEREF(__pyx_t_7);
  16355. __Pyx_XGIVEREF(__pyx_t_8);
  16356. __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
  16357. goto __pyx_L0;
  16358. __pyx_L8_try_end:;
  16359. }
  16360. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1131
  16361. *
  16362. * # Remove all triples and indices associated with the graph.
  16363. * self._remove((None, None, None), gr_uri) # <<<<<<<<<<<<<<
  16364. * # Remove the graph if it is in triples.
  16365. * self._remove((gr_uri, None, None))
  16366. */
  16367. __pyx_t_10.__pyx_n = 1;
  16368. __pyx_t_10.context = __pyx_v_gr_uri;
  16369. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->_remove(__pyx_v_self, __pyx_tuple__13, 0, &__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1131, __pyx_L1_error)
  16370. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1133
  16371. * self._remove((None, None, None), gr_uri)
  16372. * # Remove the graph if it is in triples.
  16373. * self._remove((gr_uri, None, None)) # <<<<<<<<<<<<<<
  16374. * self._remove((None, None, gr_uri))
  16375. *
  16376. */
  16377. __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1133, __pyx_L1_error)
  16378. __Pyx_GOTREF(__pyx_t_1);
  16379. __Pyx_INCREF(__pyx_v_gr_uri);
  16380. __Pyx_GIVEREF(__pyx_v_gr_uri);
  16381. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_gr_uri);
  16382. __Pyx_INCREF(Py_None);
  16383. __Pyx_GIVEREF(Py_None);
  16384. PyTuple_SET_ITEM(__pyx_t_1, 1, Py_None);
  16385. __Pyx_INCREF(Py_None);
  16386. __Pyx_GIVEREF(Py_None);
  16387. PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
  16388. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->_remove(__pyx_v_self, ((PyObject*)__pyx_t_1), 0, NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1133, __pyx_L1_error)
  16389. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16390. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1134
  16391. * # Remove the graph if it is in triples.
  16392. * self._remove((gr_uri, None, None))
  16393. * self._remove((None, None, gr_uri)) # <<<<<<<<<<<<<<
  16394. *
  16395. * # Clean up all terms related to the graph.
  16396. */
  16397. __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1134, __pyx_L1_error)
  16398. __Pyx_GOTREF(__pyx_t_1);
  16399. __Pyx_INCREF(Py_None);
  16400. __Pyx_GIVEREF(Py_None);
  16401. PyTuple_SET_ITEM(__pyx_t_1, 0, Py_None);
  16402. __Pyx_INCREF(Py_None);
  16403. __Pyx_GIVEREF(Py_None);
  16404. PyTuple_SET_ITEM(__pyx_t_1, 1, Py_None);
  16405. __Pyx_INCREF(__pyx_v_gr_uri);
  16406. __Pyx_GIVEREF(__pyx_v_gr_uri);
  16407. PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_gr_uri);
  16408. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->_remove(__pyx_v_self, ((PyObject*)__pyx_t_1), 0, NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1134, __pyx_L1_error)
  16409. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16410. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1137
  16411. *
  16412. * # Clean up all terms related to the graph.
  16413. * serialize(gr_uri, &pk_c, &c_size) # <<<<<<<<<<<<<<
  16414. * _hash(pk_c, c_size, chash)
  16415. * free(pk_c)
  16416. */
  16417. __pyx_t_9 = __pyx_f_12lakesuperior_5store_6ldp_rs_4term_serialize(__pyx_v_gr_uri, (&__pyx_v_pk_c), (&__pyx_v_c_size)); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1137, __pyx_L1_error)
  16418. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1138
  16419. * # Clean up all terms related to the graph.
  16420. * serialize(gr_uri, &pk_c, &c_size)
  16421. * _hash(pk_c, c_size, chash) # <<<<<<<<<<<<<<
  16422. * free(pk_c)
  16423. *
  16424. */
  16425. __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore__hash(__pyx_v_pk_c, __pyx_v_c_size, __pyx_v_chash);
  16426. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1139
  16427. * serialize(gr_uri, &pk_c, &c_size)
  16428. * _hash(pk_c, c_size, chash)
  16429. * free(pk_c) # <<<<<<<<<<<<<<
  16430. *
  16431. * ck_v.mv_size = KLEN
  16432. */
  16433. free(__pyx_v_pk_c);
  16434. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1141
  16435. * free(pk_c)
  16436. *
  16437. * ck_v.mv_size = KLEN # <<<<<<<<<<<<<<
  16438. * chash_v.mv_size = HLEN
  16439. * try:
  16440. */
  16441. __pyx_v_ck_v.mv_size = 5;
  16442. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1142
  16443. *
  16444. * ck_v.mv_size = KLEN
  16445. * chash_v.mv_size = HLEN # <<<<<<<<<<<<<<
  16446. * try:
  16447. * ck_v.mv_data = ck
  16448. */
  16449. __pyx_v_chash_v.mv_size = 20;
  16450. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1143
  16451. * ck_v.mv_size = KLEN
  16452. * chash_v.mv_size = HLEN
  16453. * try: # <<<<<<<<<<<<<<
  16454. * ck_v.mv_data = ck
  16455. * _check(lmdb.mdb_del(self.txn, self.get_dbi(b'c:'), &ck_v, NULL))
  16456. */
  16457. {
  16458. __Pyx_PyThreadState_declare
  16459. __Pyx_PyThreadState_assign
  16460. __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
  16461. __Pyx_XGOTREF(__pyx_t_8);
  16462. __Pyx_XGOTREF(__pyx_t_7);
  16463. __Pyx_XGOTREF(__pyx_t_6);
  16464. /*try:*/ {
  16465. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1144
  16466. * chash_v.mv_size = HLEN
  16467. * try:
  16468. * ck_v.mv_data = ck # <<<<<<<<<<<<<<
  16469. * _check(lmdb.mdb_del(self.txn, self.get_dbi(b'c:'), &ck_v, NULL))
  16470. * ck_v.mv_data = ck
  16471. */
  16472. __pyx_v_ck_v.mv_data = __pyx_v_ck;
  16473. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1145
  16474. * try:
  16475. * ck_v.mv_data = ck
  16476. * _check(lmdb.mdb_del(self.txn, self.get_dbi(b'c:'), &ck_v, NULL)) # <<<<<<<<<<<<<<
  16477. * ck_v.mv_data = ck
  16478. * _check(lmdb.mdb_del(self.txn, self.get_dbi(b't:st'), &ck_v, NULL))
  16479. */
  16480. __pyx_t_12.__pyx_n = 1;
  16481. __pyx_t_12.dblabel = ((unsigned char *)((char const *)"c:"));
  16482. __pyx_t_11 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_dbi(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_12);
  16483. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_del(__pyx_v_self->__pyx_base.txn, __pyx_t_11, (&__pyx_v_ck_v), NULL), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1145, __pyx_L11_error)
  16484. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1146
  16485. * ck_v.mv_data = ck
  16486. * _check(lmdb.mdb_del(self.txn, self.get_dbi(b'c:'), &ck_v, NULL))
  16487. * ck_v.mv_data = ck # <<<<<<<<<<<<<<
  16488. * _check(lmdb.mdb_del(self.txn, self.get_dbi(b't:st'), &ck_v, NULL))
  16489. * chash_v.mv_data = chash
  16490. */
  16491. __pyx_v_ck_v.mv_data = __pyx_v_ck;
  16492. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1147
  16493. * _check(lmdb.mdb_del(self.txn, self.get_dbi(b'c:'), &ck_v, NULL))
  16494. * ck_v.mv_data = ck
  16495. * _check(lmdb.mdb_del(self.txn, self.get_dbi(b't:st'), &ck_v, NULL)) # <<<<<<<<<<<<<<
  16496. * chash_v.mv_data = chash
  16497. * _check(lmdb.mdb_del(self.txn, self.get_dbi(b'th:t'), &chash_v, NULL))
  16498. */
  16499. __pyx_t_12.__pyx_n = 1;
  16500. __pyx_t_12.dblabel = ((unsigned char *)((char const *)"t:st"));
  16501. __pyx_t_11 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_dbi(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_12);
  16502. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_del(__pyx_v_self->__pyx_base.txn, __pyx_t_11, (&__pyx_v_ck_v), NULL), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1147, __pyx_L11_error)
  16503. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1148
  16504. * ck_v.mv_data = ck
  16505. * _check(lmdb.mdb_del(self.txn, self.get_dbi(b't:st'), &ck_v, NULL))
  16506. * chash_v.mv_data = chash # <<<<<<<<<<<<<<
  16507. * _check(lmdb.mdb_del(self.txn, self.get_dbi(b'th:t'), &chash_v, NULL))
  16508. * except KeyNotFoundError:
  16509. */
  16510. __pyx_v_chash_v.mv_data = __pyx_v_chash;
  16511. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1149
  16512. * _check(lmdb.mdb_del(self.txn, self.get_dbi(b't:st'), &ck_v, NULL))
  16513. * chash_v.mv_data = chash
  16514. * _check(lmdb.mdb_del(self.txn, self.get_dbi(b'th:t'), &chash_v, NULL)) # <<<<<<<<<<<<<<
  16515. * except KeyNotFoundError:
  16516. * pass
  16517. */
  16518. __pyx_t_12.__pyx_n = 1;
  16519. __pyx_t_12.dblabel = ((unsigned char *)((char const *)"th:t"));
  16520. __pyx_t_11 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_dbi(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_12);
  16521. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_del(__pyx_v_self->__pyx_base.txn, __pyx_t_11, (&__pyx_v_chash_v), NULL), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1149, __pyx_L11_error)
  16522. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1143
  16523. * ck_v.mv_size = KLEN
  16524. * chash_v.mv_size = HLEN
  16525. * try: # <<<<<<<<<<<<<<
  16526. * ck_v.mv_data = ck
  16527. * _check(lmdb.mdb_del(self.txn, self.get_dbi(b'c:'), &ck_v, NULL))
  16528. */
  16529. }
  16530. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  16531. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  16532. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  16533. goto __pyx_L16_try_end;
  16534. __pyx_L11_error:;
  16535. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  16536. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  16537. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  16538. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  16539. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  16540. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1150
  16541. * chash_v.mv_data = chash
  16542. * _check(lmdb.mdb_del(self.txn, self.get_dbi(b'th:t'), &chash_v, NULL))
  16543. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  16544. * pass
  16545. *
  16546. */
  16547. __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  16548. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1150, __pyx_L13_except_error)
  16549. __Pyx_GOTREF(__pyx_t_5);
  16550. __pyx_t_9 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_5);
  16551. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  16552. __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  16553. __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0;
  16554. if (__pyx_t_9) {
  16555. __Pyx_ErrRestore(0,0,0);
  16556. goto __pyx_L12_exception_handled;
  16557. }
  16558. goto __pyx_L13_except_error;
  16559. __pyx_L13_except_error:;
  16560. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1143
  16561. * ck_v.mv_size = KLEN
  16562. * chash_v.mv_size = HLEN
  16563. * try: # <<<<<<<<<<<<<<
  16564. * ck_v.mv_data = ck
  16565. * _check(lmdb.mdb_del(self.txn, self.get_dbi(b'c:'), &ck_v, NULL))
  16566. */
  16567. __Pyx_XGIVEREF(__pyx_t_8);
  16568. __Pyx_XGIVEREF(__pyx_t_7);
  16569. __Pyx_XGIVEREF(__pyx_t_6);
  16570. __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6);
  16571. goto __pyx_L1_error;
  16572. __pyx_L12_exception_handled:;
  16573. __Pyx_XGIVEREF(__pyx_t_8);
  16574. __Pyx_XGIVEREF(__pyx_t_7);
  16575. __Pyx_XGIVEREF(__pyx_t_6);
  16576. __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6);
  16577. __pyx_L16_try_end:;
  16578. }
  16579. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1110
  16580. *
  16581. *
  16582. * cpdef void _remove_graph(self, object gr_uri) except *: # <<<<<<<<<<<<<<
  16583. * """
  16584. * Delete a context.
  16585. */
  16586. /* function exit code */
  16587. goto __pyx_L0;
  16588. __pyx_L1_error:;
  16589. __Pyx_XDECREF(__pyx_t_1);
  16590. __Pyx_XDECREF(__pyx_t_2);
  16591. __Pyx_XDECREF(__pyx_t_3);
  16592. __Pyx_XDECREF(__pyx_t_4);
  16593. __Pyx_XDECREF(__pyx_t_5);
  16594. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._remove_graph", __pyx_clineno, __pyx_lineno, __pyx_filename);
  16595. __pyx_L0:;
  16596. __Pyx_TraceReturn(Py_None, 0);
  16597. __Pyx_RefNannyFinishContext();
  16598. }
  16599. /* Python wrapper */
  16600. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_13_remove_graph(PyObject *__pyx_v_self, PyObject *__pyx_v_gr_uri); /*proto*/
  16601. static char __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_12_remove_graph[] = "\n Delete a context.\n ";
  16602. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_13_remove_graph(PyObject *__pyx_v_self, PyObject *__pyx_v_gr_uri) {
  16603. PyObject *__pyx_r = 0;
  16604. __Pyx_RefNannyDeclarations
  16605. __Pyx_RefNannySetupContext("_remove_graph (wrapper)", 0);
  16606. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_12_remove_graph(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self), ((PyObject *)__pyx_v_gr_uri));
  16607. /* function exit code */
  16608. __Pyx_RefNannyFinishContext();
  16609. return __pyx_r;
  16610. }
  16611. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_12_remove_graph(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_gr_uri) {
  16612. PyObject *__pyx_r = NULL;
  16613. __Pyx_TraceDeclarations
  16614. __Pyx_RefNannyDeclarations
  16615. PyObject *__pyx_t_1 = NULL;
  16616. __Pyx_RefNannySetupContext("_remove_graph", 0);
  16617. __Pyx_TraceCall("_remove_graph (wrapper)", __pyx_f[0], 1110, 0, __PYX_ERR(0, 1110, __pyx_L1_error));
  16618. __Pyx_XDECREF(__pyx_r);
  16619. __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__remove_graph(__pyx_v_self, __pyx_v_gr_uri, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1110, __pyx_L1_error)
  16620. __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1110, __pyx_L1_error)
  16621. __Pyx_GOTREF(__pyx_t_1);
  16622. __pyx_r = __pyx_t_1;
  16623. __pyx_t_1 = 0;
  16624. goto __pyx_L0;
  16625. /* function exit code */
  16626. __pyx_L1_error:;
  16627. __Pyx_XDECREF(__pyx_t_1);
  16628. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._remove_graph", __pyx_clineno, __pyx_lineno, __pyx_filename);
  16629. __pyx_r = NULL;
  16630. __pyx_L0:;
  16631. __Pyx_XGIVEREF(__pyx_r);
  16632. __Pyx_TraceReturn(__pyx_r, 0);
  16633. __Pyx_RefNannyFinishContext();
  16634. return __pyx_r;
  16635. }
  16636. static PyObject *__pyx_gb_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_16generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
  16637. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1157
  16638. *
  16639. * # TODO Deprecate RDFLib API?
  16640. * def contexts(self, triple=None): # <<<<<<<<<<<<<<
  16641. * """
  16642. * Get a list of all contexts.
  16643. */
  16644. /* Python wrapper */
  16645. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_15contexts(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  16646. static char __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_14contexts[] = "\n Get a list of all contexts.\n\n :rtype: Iterator(rdflib.Graph)\n ";
  16647. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_15contexts(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  16648. PyObject *__pyx_v_triple = 0;
  16649. PyObject *__pyx_r = 0;
  16650. __Pyx_RefNannyDeclarations
  16651. __Pyx_RefNannySetupContext("contexts (wrapper)", 0);
  16652. {
  16653. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_triple,0};
  16654. PyObject* values[1] = {0};
  16655. values[0] = ((PyObject *)Py_None);
  16656. if (unlikely(__pyx_kwds)) {
  16657. Py_ssize_t kw_args;
  16658. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  16659. switch (pos_args) {
  16660. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  16661. CYTHON_FALLTHROUGH;
  16662. case 0: break;
  16663. default: goto __pyx_L5_argtuple_error;
  16664. }
  16665. kw_args = PyDict_Size(__pyx_kwds);
  16666. switch (pos_args) {
  16667. case 0:
  16668. if (kw_args > 0) {
  16669. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_triple);
  16670. if (value) { values[0] = value; kw_args--; }
  16671. }
  16672. }
  16673. if (unlikely(kw_args > 0)) {
  16674. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "contexts") < 0)) __PYX_ERR(0, 1157, __pyx_L3_error)
  16675. }
  16676. } else {
  16677. switch (PyTuple_GET_SIZE(__pyx_args)) {
  16678. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  16679. CYTHON_FALLTHROUGH;
  16680. case 0: break;
  16681. default: goto __pyx_L5_argtuple_error;
  16682. }
  16683. }
  16684. __pyx_v_triple = values[0];
  16685. }
  16686. goto __pyx_L4_argument_unpacking_done;
  16687. __pyx_L5_argtuple_error:;
  16688. __Pyx_RaiseArgtupleInvalid("contexts", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1157, __pyx_L3_error)
  16689. __pyx_L3_error:;
  16690. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.contexts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  16691. __Pyx_RefNannyFinishContext();
  16692. return NULL;
  16693. __pyx_L4_argument_unpacking_done:;
  16694. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_14contexts(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self), __pyx_v_triple);
  16695. /* function exit code */
  16696. __Pyx_RefNannyFinishContext();
  16697. return __pyx_r;
  16698. }
  16699. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_14contexts(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_triple) {
  16700. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts *__pyx_cur_scope;
  16701. PyObject *__pyx_r = NULL;
  16702. __Pyx_RefNannyDeclarations
  16703. __Pyx_RefNannySetupContext("contexts", 0);
  16704. __pyx_cur_scope = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts *)__pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts(__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts, __pyx_empty_tuple, NULL);
  16705. if (unlikely(!__pyx_cur_scope)) {
  16706. __pyx_cur_scope = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts *)Py_None);
  16707. __Pyx_INCREF(Py_None);
  16708. __PYX_ERR(0, 1157, __pyx_L1_error)
  16709. } else {
  16710. __Pyx_GOTREF(__pyx_cur_scope);
  16711. }
  16712. __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  16713. __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  16714. __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  16715. __pyx_cur_scope->__pyx_v_triple = __pyx_v_triple;
  16716. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_triple);
  16717. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_triple);
  16718. {
  16719. __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_16generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_contexts, __pyx_n_s_LmdbTriplestore_contexts, __pyx_n_s_lakesuperior_store_ldp_rs_lmdb_t); if (unlikely(!gen)) __PYX_ERR(0, 1157, __pyx_L1_error)
  16720. __Pyx_DECREF(__pyx_cur_scope);
  16721. __Pyx_RefNannyFinishContext();
  16722. return (PyObject *) gen;
  16723. }
  16724. /* function exit code */
  16725. __pyx_L1_error:;
  16726. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.contexts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  16727. __pyx_r = NULL;
  16728. __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  16729. __Pyx_XGIVEREF(__pyx_r);
  16730. __Pyx_RefNannyFinishContext();
  16731. return __pyx_r;
  16732. }
  16733. static PyObject *__pyx_gb_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_16generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
  16734. {
  16735. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts *__pyx_cur_scope = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts *)__pyx_generator->closure);
  16736. PyObject *__pyx_r = NULL;
  16737. __Pyx_TraceDeclarations
  16738. PyObject *__pyx_t_1 = NULL;
  16739. struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_all_contexts __pyx_t_2;
  16740. PyObject *__pyx_t_3 = NULL;
  16741. Py_ssize_t __pyx_t_4;
  16742. PyObject *__pyx_t_5 = NULL;
  16743. unsigned char *__pyx_t_6;
  16744. PyObject *__pyx_t_7 = NULL;
  16745. __Pyx_RefNannyDeclarations
  16746. __Pyx_RefNannySetupContext("contexts", 0);
  16747. __Pyx_TraceCall("contexts", __pyx_f[0], 1157, 0, __PYX_ERR(0, 1157, __pyx_L1_error));
  16748. switch (__pyx_generator->resume_label) {
  16749. case 0: goto __pyx_L3_first_run;
  16750. case 1: goto __pyx_L6_resume_from_yield;
  16751. default: /* CPython raises the right error here */
  16752. __Pyx_TraceReturn(Py_None, 0);
  16753. __Pyx_RefNannyFinishContext();
  16754. return NULL;
  16755. }
  16756. __pyx_L3_first_run:;
  16757. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1157, __pyx_L1_error)
  16758. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1163
  16759. * :rtype: Iterator(rdflib.Graph)
  16760. * """
  16761. * for ctx_uri in self.all_contexts(triple): # <<<<<<<<<<<<<<
  16762. * yield Graph(identifier=self.from_key(ctx_uri), store=self)
  16763. *
  16764. */
  16765. __pyx_t_2.__pyx_n = 1;
  16766. __pyx_t_2.triple = __pyx_cur_scope->__pyx_v_triple;
  16767. __pyx_t_1 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->all_contexts(__pyx_cur_scope->__pyx_v_self, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1163, __pyx_L1_error)
  16768. __Pyx_GOTREF(__pyx_t_1);
  16769. if (unlikely(__pyx_t_1 == Py_None)) {
  16770. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  16771. __PYX_ERR(0, 1163, __pyx_L1_error)
  16772. }
  16773. __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
  16774. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16775. for (;;) {
  16776. if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
  16777. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  16778. __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1163, __pyx_L1_error)
  16779. #else
  16780. __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1163, __pyx_L1_error)
  16781. __Pyx_GOTREF(__pyx_t_1);
  16782. #endif
  16783. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_ctx_uri);
  16784. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_ctx_uri, __pyx_t_1);
  16785. __Pyx_GIVEREF(__pyx_t_1);
  16786. __pyx_t_1 = 0;
  16787. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1164
  16788. * """
  16789. * for ctx_uri in self.all_contexts(triple):
  16790. * yield Graph(identifier=self.from_key(ctx_uri), store=self) # <<<<<<<<<<<<<<
  16791. *
  16792. *
  16793. */
  16794. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Graph); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1164, __pyx_L1_error)
  16795. __Pyx_GOTREF(__pyx_t_1);
  16796. __pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1164, __pyx_L1_error)
  16797. __Pyx_GOTREF(__pyx_t_5);
  16798. __pyx_t_6 = __Pyx_PyObject_AsWritableUString(__pyx_cur_scope->__pyx_v_ctx_uri); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 1164, __pyx_L1_error)
  16799. __pyx_t_7 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->from_key(__pyx_cur_scope->__pyx_v_self, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1164, __pyx_L1_error)
  16800. __Pyx_GOTREF(__pyx_t_7);
  16801. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_identifier, __pyx_t_7) < 0) __PYX_ERR(0, 1164, __pyx_L1_error)
  16802. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  16803. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_store, ((PyObject *)__pyx_cur_scope->__pyx_v_self)) < 0) __PYX_ERR(0, 1164, __pyx_L1_error)
  16804. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1164, __pyx_L1_error)
  16805. __Pyx_GOTREF(__pyx_t_7);
  16806. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16807. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  16808. __pyx_r = __pyx_t_7;
  16809. __pyx_t_7 = 0;
  16810. __Pyx_XGIVEREF(__pyx_t_3);
  16811. __pyx_cur_scope->__pyx_t_0 = __pyx_t_3;
  16812. __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
  16813. __Pyx_XGIVEREF(__pyx_r);
  16814. __Pyx_TraceReturn(__pyx_r, 0);
  16815. __Pyx_RefNannyFinishContext();
  16816. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  16817. /* return from generator, yielding value */
  16818. __pyx_generator->resume_label = 1;
  16819. return __pyx_r;
  16820. __pyx_L6_resume_from_yield:;
  16821. __pyx_t_3 = __pyx_cur_scope->__pyx_t_0;
  16822. __pyx_cur_scope->__pyx_t_0 = 0;
  16823. __Pyx_XGOTREF(__pyx_t_3);
  16824. __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
  16825. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1164, __pyx_L1_error)
  16826. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1163
  16827. * :rtype: Iterator(rdflib.Graph)
  16828. * """
  16829. * for ctx_uri in self.all_contexts(triple): # <<<<<<<<<<<<<<
  16830. * yield Graph(identifier=self.from_key(ctx_uri), store=self)
  16831. *
  16832. */
  16833. }
  16834. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16835. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  16836. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1157
  16837. *
  16838. * # TODO Deprecate RDFLib API?
  16839. * def contexts(self, triple=None): # <<<<<<<<<<<<<<
  16840. * """
  16841. * Get a list of all contexts.
  16842. */
  16843. /* function exit code */
  16844. PyErr_SetNone(PyExc_StopIteration);
  16845. goto __pyx_L0;
  16846. __pyx_L1_error:;
  16847. __Pyx_XDECREF(__pyx_t_1);
  16848. __Pyx_XDECREF(__pyx_t_3);
  16849. __Pyx_XDECREF(__pyx_t_5);
  16850. __Pyx_XDECREF(__pyx_t_7);
  16851. __Pyx_AddTraceback("contexts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  16852. __pyx_L0:;
  16853. __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  16854. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  16855. __pyx_generator->resume_label = -1;
  16856. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  16857. __Pyx_TraceReturn(__pyx_r, 0);
  16858. __Pyx_RefNannyFinishContext();
  16859. return __pyx_r;
  16860. }
  16861. static PyObject *__pyx_gb_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_19generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
  16862. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1167
  16863. *
  16864. *
  16865. * def triples(self, triple_pattern, context=None): # <<<<<<<<<<<<<<
  16866. * """
  16867. * Generator over matching triples.
  16868. */
  16869. /* Python wrapper */
  16870. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_18triples(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  16871. static char __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_17triples[] = "\n Generator over matching triples.\n\n :param tuple triple_pattern: 3 RDFLib terms\n :param context: Context graph, if available.\n :type context: rdflib.Graph or None\n\n :rtype: Iterator\n :return: Generator over triples and contexts in which each result has\n the following format::\n\n (s, p, o), generator(contexts)\n\n Where the contexts generator lists all context that the triple appears\n in.\n ";
  16872. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_18triples(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  16873. PyObject *__pyx_v_triple_pattern = 0;
  16874. PyObject *__pyx_v_context = 0;
  16875. PyObject *__pyx_r = 0;
  16876. __Pyx_RefNannyDeclarations
  16877. __Pyx_RefNannySetupContext("triples (wrapper)", 0);
  16878. {
  16879. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_triple_pattern,&__pyx_n_s_context,0};
  16880. PyObject* values[2] = {0,0};
  16881. values[1] = ((PyObject *)Py_None);
  16882. if (unlikely(__pyx_kwds)) {
  16883. Py_ssize_t kw_args;
  16884. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  16885. switch (pos_args) {
  16886. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  16887. CYTHON_FALLTHROUGH;
  16888. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  16889. CYTHON_FALLTHROUGH;
  16890. case 0: break;
  16891. default: goto __pyx_L5_argtuple_error;
  16892. }
  16893. kw_args = PyDict_Size(__pyx_kwds);
  16894. switch (pos_args) {
  16895. case 0:
  16896. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_triple_pattern)) != 0)) kw_args--;
  16897. else goto __pyx_L5_argtuple_error;
  16898. CYTHON_FALLTHROUGH;
  16899. case 1:
  16900. if (kw_args > 0) {
  16901. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_context);
  16902. if (value) { values[1] = value; kw_args--; }
  16903. }
  16904. }
  16905. if (unlikely(kw_args > 0)) {
  16906. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "triples") < 0)) __PYX_ERR(0, 1167, __pyx_L3_error)
  16907. }
  16908. } else {
  16909. switch (PyTuple_GET_SIZE(__pyx_args)) {
  16910. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  16911. CYTHON_FALLTHROUGH;
  16912. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  16913. break;
  16914. default: goto __pyx_L5_argtuple_error;
  16915. }
  16916. }
  16917. __pyx_v_triple_pattern = values[0];
  16918. __pyx_v_context = values[1];
  16919. }
  16920. goto __pyx_L4_argument_unpacking_done;
  16921. __pyx_L5_argtuple_error:;
  16922. __Pyx_RaiseArgtupleInvalid("triples", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1167, __pyx_L3_error)
  16923. __pyx_L3_error:;
  16924. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.triples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  16925. __Pyx_RefNannyFinishContext();
  16926. return NULL;
  16927. __pyx_L4_argument_unpacking_done:;
  16928. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_17triples(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self), __pyx_v_triple_pattern, __pyx_v_context);
  16929. /* function exit code */
  16930. __Pyx_RefNannyFinishContext();
  16931. return __pyx_r;
  16932. }
  16933. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_17triples(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_triple_pattern, PyObject *__pyx_v_context) {
  16934. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples *__pyx_cur_scope;
  16935. PyObject *__pyx_r = NULL;
  16936. __Pyx_RefNannyDeclarations
  16937. __Pyx_RefNannySetupContext("triples", 0);
  16938. __pyx_cur_scope = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples *)__pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples(__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples, __pyx_empty_tuple, NULL);
  16939. if (unlikely(!__pyx_cur_scope)) {
  16940. __pyx_cur_scope = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples *)Py_None);
  16941. __Pyx_INCREF(Py_None);
  16942. __PYX_ERR(0, 1167, __pyx_L1_error)
  16943. } else {
  16944. __Pyx_GOTREF(__pyx_cur_scope);
  16945. }
  16946. __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  16947. __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  16948. __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  16949. __pyx_cur_scope->__pyx_v_triple_pattern = __pyx_v_triple_pattern;
  16950. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_triple_pattern);
  16951. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_triple_pattern);
  16952. __pyx_cur_scope->__pyx_v_context = __pyx_v_context;
  16953. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_context);
  16954. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_context);
  16955. {
  16956. __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_19generator1, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_triples, __pyx_n_s_LmdbTriplestore_triples, __pyx_n_s_lakesuperior_store_ldp_rs_lmdb_t); if (unlikely(!gen)) __PYX_ERR(0, 1167, __pyx_L1_error)
  16957. __Pyx_DECREF(__pyx_cur_scope);
  16958. __Pyx_RefNannyFinishContext();
  16959. return (PyObject *) gen;
  16960. }
  16961. /* function exit code */
  16962. __pyx_L1_error:;
  16963. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.triples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  16964. __pyx_r = NULL;
  16965. __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  16966. __Pyx_XGIVEREF(__pyx_r);
  16967. __Pyx_RefNannyFinishContext();
  16968. return __pyx_r;
  16969. }
  16970. static PyObject *__pyx_gb_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_19generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
  16971. {
  16972. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples *__pyx_cur_scope = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples *)__pyx_generator->closure);
  16973. PyObject *__pyx_r = NULL;
  16974. __Pyx_TraceDeclarations
  16975. PyObject *__pyx_t_1 = NULL;
  16976. PyObject *__pyx_t_2 = NULL;
  16977. PyObject *__pyx_t_3 = NULL;
  16978. PyObject *__pyx_t_4 = NULL;
  16979. PyObject *__pyx_t_5 = NULL;
  16980. int __pyx_t_6;
  16981. PyObject *__pyx_t_7 = NULL;
  16982. struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_triple_keys __pyx_t_8;
  16983. MDB_cursor *__pyx_t_9;
  16984. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__cur_open __pyx_t_10;
  16985. size_t __pyx_t_11;
  16986. size_t __pyx_t_12;
  16987. size_t __pyx_t_13;
  16988. int __pyx_t_14;
  16989. PyObject *__pyx_t_15 = NULL;
  16990. PyObject *__pyx_t_16 = NULL;
  16991. PyObject *__pyx_t_17 = NULL;
  16992. unsigned char *__pyx_t_18;
  16993. int __pyx_t_19;
  16994. char const *__pyx_t_20;
  16995. PyObject *__pyx_t_21 = NULL;
  16996. PyObject *__pyx_t_22 = NULL;
  16997. PyObject *__pyx_t_23 = NULL;
  16998. __Pyx_RefNannyDeclarations
  16999. __Pyx_RefNannySetupContext("triples", 0);
  17000. __Pyx_TraceCall("triples", __pyx_f[0], 1167, 0, __PYX_ERR(0, 1167, __pyx_L1_error));
  17001. switch (__pyx_generator->resume_label) {
  17002. case 0: goto __pyx_L3_first_run;
  17003. case 1: goto __pyx_L21_resume_from_yield;
  17004. default: /* CPython raises the right error here */
  17005. __Pyx_TraceReturn(Py_None, 0);
  17006. __Pyx_RefNannyFinishContext();
  17007. return NULL;
  17008. }
  17009. __pyx_L3_first_run:;
  17010. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1167, __pyx_L1_error)
  17011. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1185
  17012. * """
  17013. * cdef:
  17014. * size_t i = 0, j = 0 # <<<<<<<<<<<<<<
  17015. * unsigned char spok[TRP_KLEN]
  17016. * unsigned char ck[KLEN]
  17017. */
  17018. __pyx_cur_scope->__pyx_v_i = 0;
  17019. __pyx_cur_scope->__pyx_v_j = 0;
  17020. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1192
  17021. * # This sounds strange, RDFLib should be passing None at this point,
  17022. * # but anyway...
  17023. * context = self._normalize_context(context) # <<<<<<<<<<<<<<
  17024. *
  17025. * logger.debug(
  17026. */
  17027. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_normalize_context); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1192, __pyx_L1_error)
  17028. __Pyx_GOTREF(__pyx_t_2);
  17029. __pyx_t_3 = NULL;
  17030. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
  17031. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  17032. if (likely(__pyx_t_3)) {
  17033. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  17034. __Pyx_INCREF(__pyx_t_3);
  17035. __Pyx_INCREF(function);
  17036. __Pyx_DECREF_SET(__pyx_t_2, function);
  17037. }
  17038. }
  17039. if (!__pyx_t_3) {
  17040. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_cur_scope->__pyx_v_context); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1192, __pyx_L1_error)
  17041. __Pyx_GOTREF(__pyx_t_1);
  17042. } else {
  17043. #if CYTHON_FAST_PYCALL
  17044. if (PyFunction_Check(__pyx_t_2)) {
  17045. PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_context};
  17046. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1192, __pyx_L1_error)
  17047. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  17048. __Pyx_GOTREF(__pyx_t_1);
  17049. } else
  17050. #endif
  17051. #if CYTHON_FAST_PYCCALL
  17052. if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
  17053. PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_context};
  17054. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1192, __pyx_L1_error)
  17055. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  17056. __Pyx_GOTREF(__pyx_t_1);
  17057. } else
  17058. #endif
  17059. {
  17060. __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1192, __pyx_L1_error)
  17061. __Pyx_GOTREF(__pyx_t_4);
  17062. __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
  17063. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_context);
  17064. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_context);
  17065. PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_cur_scope->__pyx_v_context);
  17066. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1192, __pyx_L1_error)
  17067. __Pyx_GOTREF(__pyx_t_1);
  17068. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  17069. }
  17070. }
  17071. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17072. __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_context);
  17073. __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_context, __pyx_t_1);
  17074. __Pyx_GIVEREF(__pyx_t_1);
  17075. __pyx_t_1 = 0;
  17076. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1194
  17077. * context = self._normalize_context(context)
  17078. *
  17079. * logger.debug( # <<<<<<<<<<<<<<
  17080. * 'Getting triples for: {}, {}'.format(triple_pattern, context))
  17081. * rset = self.triple_keys(triple_pattern, context)
  17082. */
  17083. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1194, __pyx_L1_error)
  17084. __Pyx_GOTREF(__pyx_t_2);
  17085. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1194, __pyx_L1_error)
  17086. __Pyx_GOTREF(__pyx_t_4);
  17087. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17088. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1195
  17089. *
  17090. * logger.debug(
  17091. * 'Getting triples for: {}, {}'.format(triple_pattern, context)) # <<<<<<<<<<<<<<
  17092. * rset = self.triple_keys(triple_pattern, context)
  17093. *
  17094. */
  17095. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Getting_triples_for, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1195, __pyx_L1_error)
  17096. __Pyx_GOTREF(__pyx_t_3);
  17097. __pyx_t_5 = NULL;
  17098. __pyx_t_6 = 0;
  17099. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
  17100. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
  17101. if (likely(__pyx_t_5)) {
  17102. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  17103. __Pyx_INCREF(__pyx_t_5);
  17104. __Pyx_INCREF(function);
  17105. __Pyx_DECREF_SET(__pyx_t_3, function);
  17106. __pyx_t_6 = 1;
  17107. }
  17108. }
  17109. #if CYTHON_FAST_PYCALL
  17110. if (PyFunction_Check(__pyx_t_3)) {
  17111. PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_triple_pattern, __pyx_cur_scope->__pyx_v_context};
  17112. __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1195, __pyx_L1_error)
  17113. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  17114. __Pyx_GOTREF(__pyx_t_2);
  17115. } else
  17116. #endif
  17117. #if CYTHON_FAST_PYCCALL
  17118. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  17119. PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_triple_pattern, __pyx_cur_scope->__pyx_v_context};
  17120. __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1195, __pyx_L1_error)
  17121. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  17122. __Pyx_GOTREF(__pyx_t_2);
  17123. } else
  17124. #endif
  17125. {
  17126. __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1195, __pyx_L1_error)
  17127. __Pyx_GOTREF(__pyx_t_7);
  17128. if (__pyx_t_5) {
  17129. __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
  17130. }
  17131. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_triple_pattern);
  17132. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_triple_pattern);
  17133. PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_cur_scope->__pyx_v_triple_pattern);
  17134. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_context);
  17135. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_context);
  17136. PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_cur_scope->__pyx_v_context);
  17137. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1195, __pyx_L1_error)
  17138. __Pyx_GOTREF(__pyx_t_2);
  17139. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  17140. }
  17141. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17142. __pyx_t_3 = NULL;
  17143. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
  17144. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
  17145. if (likely(__pyx_t_3)) {
  17146. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
  17147. __Pyx_INCREF(__pyx_t_3);
  17148. __Pyx_INCREF(function);
  17149. __Pyx_DECREF_SET(__pyx_t_4, function);
  17150. }
  17151. }
  17152. if (!__pyx_t_3) {
  17153. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1194, __pyx_L1_error)
  17154. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17155. __Pyx_GOTREF(__pyx_t_1);
  17156. } else {
  17157. #if CYTHON_FAST_PYCALL
  17158. if (PyFunction_Check(__pyx_t_4)) {
  17159. PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_2};
  17160. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1194, __pyx_L1_error)
  17161. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  17162. __Pyx_GOTREF(__pyx_t_1);
  17163. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17164. } else
  17165. #endif
  17166. #if CYTHON_FAST_PYCCALL
  17167. if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
  17168. PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_2};
  17169. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1194, __pyx_L1_error)
  17170. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  17171. __Pyx_GOTREF(__pyx_t_1);
  17172. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17173. } else
  17174. #endif
  17175. {
  17176. __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1194, __pyx_L1_error)
  17177. __Pyx_GOTREF(__pyx_t_7);
  17178. __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
  17179. __Pyx_GIVEREF(__pyx_t_2);
  17180. PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_2);
  17181. __pyx_t_2 = 0;
  17182. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1194, __pyx_L1_error)
  17183. __Pyx_GOTREF(__pyx_t_1);
  17184. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  17185. }
  17186. }
  17187. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  17188. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17189. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1196
  17190. * logger.debug(
  17191. * 'Getting triples for: {}, {}'.format(triple_pattern, context))
  17192. * rset = self.triple_keys(triple_pattern, context) # <<<<<<<<<<<<<<
  17193. *
  17194. * #logger.debug('Triple keys found: {}'.format(rset.data[:rset.size]))
  17195. */
  17196. if (!(likely(PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_triple_pattern))||((__pyx_cur_scope->__pyx_v_triple_pattern) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_cur_scope->__pyx_v_triple_pattern)->tp_name), 0))) __PYX_ERR(0, 1196, __pyx_L1_error)
  17197. __pyx_t_8.__pyx_n = 1;
  17198. __pyx_t_8.context = __pyx_cur_scope->__pyx_v_context;
  17199. __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->triple_keys(__pyx_cur_scope->__pyx_v_self, ((PyObject*)__pyx_cur_scope->__pyx_v_triple_pattern), 0, &__pyx_t_8)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1196, __pyx_L1_error)
  17200. __Pyx_GOTREF(__pyx_t_1);
  17201. __Pyx_GIVEREF(__pyx_t_1);
  17202. __pyx_cur_scope->__pyx_v_rset = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_1);
  17203. __pyx_t_1 = 0;
  17204. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1200
  17205. * #logger.debug('Triple keys found: {}'.format(rset.data[:rset.size]))
  17206. *
  17207. * cur = self._cur_open('spo:c') # <<<<<<<<<<<<<<
  17208. * try:
  17209. * key_v.mv_size = TRP_KLEN
  17210. */
  17211. __pyx_t_10.__pyx_n = 1;
  17212. __pyx_t_10.dblabel = ((unsigned char *)((char const *)"spo:c"));
  17213. __pyx_t_9 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_open(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_cur_scope->__pyx_v_self), &__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1200, __pyx_L1_error)
  17214. __pyx_cur_scope->__pyx_v_cur = __pyx_t_9;
  17215. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1201
  17216. *
  17217. * cur = self._cur_open('spo:c')
  17218. * try: # <<<<<<<<<<<<<<
  17219. * key_v.mv_size = TRP_KLEN
  17220. * for i in range(rset.ct):
  17221. */
  17222. /*try:*/ {
  17223. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1202
  17224. * cur = self._cur_open('spo:c')
  17225. * try:
  17226. * key_v.mv_size = TRP_KLEN # <<<<<<<<<<<<<<
  17227. * for i in range(rset.ct):
  17228. * #logger.debug('Checking contexts for triples: {}'.format(
  17229. */
  17230. __pyx_cur_scope->__pyx_v_key_v.mv_size = 15;
  17231. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1203
  17232. * try:
  17233. * key_v.mv_size = TRP_KLEN
  17234. * for i in range(rset.ct): # <<<<<<<<<<<<<<
  17235. * #logger.debug('Checking contexts for triples: {}'.format(
  17236. * # (rset.data + i * TRP_KLEN)[:TRP_KLEN]))
  17237. */
  17238. __pyx_t_11 = __pyx_cur_scope->__pyx_v_rset->ct;
  17239. __pyx_t_12 = __pyx_t_11;
  17240. for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
  17241. __pyx_cur_scope->__pyx_v_i = __pyx_t_13;
  17242. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1206
  17243. * #logger.debug('Checking contexts for triples: {}'.format(
  17244. * # (rset.data + i * TRP_KLEN)[:TRP_KLEN]))
  17245. * key_v.mv_data = rset.data + i * TRP_KLEN # <<<<<<<<<<<<<<
  17246. * # Get contexts associated with each triple.
  17247. * contexts = []
  17248. */
  17249. __pyx_cur_scope->__pyx_v_key_v.mv_data = (__pyx_cur_scope->__pyx_v_rset->data + (__pyx_cur_scope->__pyx_v_i * 15));
  17250. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1208
  17251. * key_v.mv_data = rset.data + i * TRP_KLEN
  17252. * # Get contexts associated with each triple.
  17253. * contexts = [] # <<<<<<<<<<<<<<
  17254. * # This shall never be MDB_NOTFOUND.
  17255. * _check(lmdb.mdb_cursor_get(cur, &key_v, &data_v, lmdb.MDB_SET))
  17256. */
  17257. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1208, __pyx_L5_error)
  17258. __Pyx_GOTREF(__pyx_t_1);
  17259. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_contexts);
  17260. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_contexts, ((PyObject*)__pyx_t_1));
  17261. __Pyx_GIVEREF(__pyx_t_1);
  17262. __pyx_t_1 = 0;
  17263. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1210
  17264. * contexts = []
  17265. * # This shall never be MDB_NOTFOUND.
  17266. * _check(lmdb.mdb_cursor_get(cur, &key_v, &data_v, lmdb.MDB_SET)) # <<<<<<<<<<<<<<
  17267. * while True:
  17268. * c_uri = self.from_key(<Key>data_v.mv_data)
  17269. */
  17270. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_cur_scope->__pyx_v_cur, (&__pyx_cur_scope->__pyx_v_key_v), (&__pyx_cur_scope->__pyx_v_data_v), MDB_SET), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1210, __pyx_L5_error)
  17271. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1211
  17272. * # This shall never be MDB_NOTFOUND.
  17273. * _check(lmdb.mdb_cursor_get(cur, &key_v, &data_v, lmdb.MDB_SET))
  17274. * while True: # <<<<<<<<<<<<<<
  17275. * c_uri = self.from_key(<Key>data_v.mv_data)
  17276. * contexts.append(Graph(identifier=c_uri, store=self))
  17277. */
  17278. while (1) {
  17279. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1212
  17280. * _check(lmdb.mdb_cursor_get(cur, &key_v, &data_v, lmdb.MDB_SET))
  17281. * while True:
  17282. * c_uri = self.from_key(<Key>data_v.mv_data) # <<<<<<<<<<<<<<
  17283. * contexts.append(Graph(identifier=c_uri, store=self))
  17284. * try:
  17285. */
  17286. __pyx_t_1 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->from_key(__pyx_cur_scope->__pyx_v_self, ((unsigned char *)__pyx_cur_scope->__pyx_v_data_v.mv_data)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1212, __pyx_L5_error)
  17287. __Pyx_GOTREF(__pyx_t_1);
  17288. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_c_uri);
  17289. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c_uri, __pyx_t_1);
  17290. __Pyx_GIVEREF(__pyx_t_1);
  17291. __pyx_t_1 = 0;
  17292. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1213
  17293. * while True:
  17294. * c_uri = self.from_key(<Key>data_v.mv_data)
  17295. * contexts.append(Graph(identifier=c_uri, store=self)) # <<<<<<<<<<<<<<
  17296. * try:
  17297. * _check(lmdb.mdb_cursor_get(
  17298. */
  17299. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Graph); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1213, __pyx_L5_error)
  17300. __Pyx_GOTREF(__pyx_t_1);
  17301. __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1213, __pyx_L5_error)
  17302. __Pyx_GOTREF(__pyx_t_4);
  17303. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_identifier, __pyx_cur_scope->__pyx_v_c_uri) < 0) __PYX_ERR(0, 1213, __pyx_L5_error)
  17304. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_store, ((PyObject *)__pyx_cur_scope->__pyx_v_self)) < 0) __PYX_ERR(0, 1213, __pyx_L5_error)
  17305. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1213, __pyx_L5_error)
  17306. __Pyx_GOTREF(__pyx_t_7);
  17307. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17308. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  17309. __pyx_t_14 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_contexts, __pyx_t_7); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 1213, __pyx_L5_error)
  17310. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  17311. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1214
  17312. * c_uri = self.from_key(<Key>data_v.mv_data)
  17313. * contexts.append(Graph(identifier=c_uri, store=self))
  17314. * try: # <<<<<<<<<<<<<<
  17315. * _check(lmdb.mdb_cursor_get(
  17316. * cur, &key_v, &data_v, lmdb.MDB_NEXT_DUP))
  17317. */
  17318. {
  17319. __Pyx_ExceptionSave(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
  17320. __Pyx_XGOTREF(__pyx_t_15);
  17321. __Pyx_XGOTREF(__pyx_t_16);
  17322. __Pyx_XGOTREF(__pyx_t_17);
  17323. /*try:*/ {
  17324. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1215
  17325. * contexts.append(Graph(identifier=c_uri, store=self))
  17326. * try:
  17327. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  17328. * cur, &key_v, &data_v, lmdb.MDB_NEXT_DUP))
  17329. * except KeyNotFoundError:
  17330. */
  17331. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_cur_scope->__pyx_v_cur, (&__pyx_cur_scope->__pyx_v_key_v), (&__pyx_cur_scope->__pyx_v_data_v), MDB_NEXT_DUP), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1215, __pyx_L11_error)
  17332. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1214
  17333. * c_uri = self.from_key(<Key>data_v.mv_data)
  17334. * contexts.append(Graph(identifier=c_uri, store=self))
  17335. * try: # <<<<<<<<<<<<<<
  17336. * _check(lmdb.mdb_cursor_get(
  17337. * cur, &key_v, &data_v, lmdb.MDB_NEXT_DUP))
  17338. */
  17339. }
  17340. __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
  17341. __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
  17342. __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
  17343. goto __pyx_L18_try_end;
  17344. __pyx_L11_error:;
  17345. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  17346. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  17347. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  17348. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  17349. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  17350. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  17351. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1217
  17352. * _check(lmdb.mdb_cursor_get(
  17353. * cur, &key_v, &data_v, lmdb.MDB_NEXT_DUP))
  17354. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  17355. * break
  17356. *
  17357. */
  17358. __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_4, &__pyx_t_1);
  17359. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1217, __pyx_L13_except_error)
  17360. __Pyx_GOTREF(__pyx_t_2);
  17361. __pyx_t_6 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_7, __pyx_t_2);
  17362. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17363. __Pyx_ErrRestore(__pyx_t_7, __pyx_t_4, __pyx_t_1);
  17364. __pyx_t_7 = 0; __pyx_t_4 = 0; __pyx_t_1 = 0;
  17365. if (__pyx_t_6) {
  17366. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.triples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  17367. if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(0, 1217, __pyx_L13_except_error)
  17368. __Pyx_GOTREF(__pyx_t_1);
  17369. __Pyx_GOTREF(__pyx_t_4);
  17370. __Pyx_GOTREF(__pyx_t_7);
  17371. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1218
  17372. * cur, &key_v, &data_v, lmdb.MDB_NEXT_DUP))
  17373. * except KeyNotFoundError:
  17374. * break # <<<<<<<<<<<<<<
  17375. *
  17376. * #logger.debug('Triple keys before yield: {}: {}.'.format(
  17377. */
  17378. goto __pyx_L19_except_break;
  17379. __pyx_L19_except_break:;
  17380. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17381. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  17382. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  17383. goto __pyx_L16_try_break;
  17384. }
  17385. goto __pyx_L13_except_error;
  17386. __pyx_L13_except_error:;
  17387. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1214
  17388. * c_uri = self.from_key(<Key>data_v.mv_data)
  17389. * contexts.append(Graph(identifier=c_uri, store=self))
  17390. * try: # <<<<<<<<<<<<<<
  17391. * _check(lmdb.mdb_cursor_get(
  17392. * cur, &key_v, &data_v, lmdb.MDB_NEXT_DUP))
  17393. */
  17394. __Pyx_XGIVEREF(__pyx_t_15);
  17395. __Pyx_XGIVEREF(__pyx_t_16);
  17396. __Pyx_XGIVEREF(__pyx_t_17);
  17397. __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
  17398. goto __pyx_L5_error;
  17399. __pyx_L16_try_break:;
  17400. __Pyx_XGIVEREF(__pyx_t_15);
  17401. __Pyx_XGIVEREF(__pyx_t_16);
  17402. __Pyx_XGIVEREF(__pyx_t_17);
  17403. __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
  17404. goto __pyx_L10_break;
  17405. __pyx_L18_try_end:;
  17406. }
  17407. }
  17408. __pyx_L10_break:;
  17409. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1223
  17410. * # (<TripleKey>key_v.mv_data)[:TRP_KLEN], tuple(contexts)))
  17411. * yield self.from_trp_key(
  17412. * (<TripleKey>key_v.mv_data)[: TRP_KLEN]), tuple(contexts) # <<<<<<<<<<<<<<
  17413. * #logger.debug('After yield.')
  17414. * finally:
  17415. */
  17416. __pyx_t_7 = __Pyx_PyBytes_FromStringAndSize(((const char*)((unsigned char *)__pyx_cur_scope->__pyx_v_key_v.mv_data)) + 0, 15 - 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1223, __pyx_L5_error)
  17417. __Pyx_GOTREF(__pyx_t_7);
  17418. __pyx_t_18 = __Pyx_PyBytes_AsWritableUString(__pyx_t_7); if (unlikely((!__pyx_t_18) && PyErr_Occurred())) __PYX_ERR(0, 1223, __pyx_L5_error)
  17419. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1222
  17420. * #logger.debug('Triple keys before yield: {}: {}.'.format(
  17421. * # (<TripleKey>key_v.mv_data)[:TRP_KLEN], tuple(contexts)))
  17422. * yield self.from_trp_key( # <<<<<<<<<<<<<<
  17423. * (<TripleKey>key_v.mv_data)[: TRP_KLEN]), tuple(contexts)
  17424. * #logger.debug('After yield.')
  17425. */
  17426. __pyx_t_4 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->from_trp_key(__pyx_cur_scope->__pyx_v_self, __pyx_t_18); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1222, __pyx_L5_error)
  17427. __Pyx_GOTREF(__pyx_t_4);
  17428. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  17429. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1223
  17430. * # (<TripleKey>key_v.mv_data)[:TRP_KLEN], tuple(contexts)))
  17431. * yield self.from_trp_key(
  17432. * (<TripleKey>key_v.mv_data)[: TRP_KLEN]), tuple(contexts) # <<<<<<<<<<<<<<
  17433. * #logger.debug('After yield.')
  17434. * finally:
  17435. */
  17436. __pyx_t_7 = PyList_AsTuple(__pyx_cur_scope->__pyx_v_contexts); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1223, __pyx_L5_error)
  17437. __Pyx_GOTREF(__pyx_t_7);
  17438. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1222
  17439. * #logger.debug('Triple keys before yield: {}: {}.'.format(
  17440. * # (<TripleKey>key_v.mv_data)[:TRP_KLEN], tuple(contexts)))
  17441. * yield self.from_trp_key( # <<<<<<<<<<<<<<
  17442. * (<TripleKey>key_v.mv_data)[: TRP_KLEN]), tuple(contexts)
  17443. * #logger.debug('After yield.')
  17444. */
  17445. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1222, __pyx_L5_error)
  17446. __Pyx_GOTREF(__pyx_t_1);
  17447. __Pyx_GIVEREF(__pyx_t_4);
  17448. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
  17449. __Pyx_GIVEREF(__pyx_t_7);
  17450. PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_7);
  17451. __pyx_t_4 = 0;
  17452. __pyx_t_7 = 0;
  17453. __pyx_r = __pyx_t_1;
  17454. __pyx_t_1 = 0;
  17455. __pyx_cur_scope->__pyx_t_0 = __pyx_t_11;
  17456. __pyx_cur_scope->__pyx_t_1 = __pyx_t_12;
  17457. __pyx_cur_scope->__pyx_t_2 = __pyx_t_13;
  17458. __Pyx_XGIVEREF(__pyx_r);
  17459. __Pyx_TraceReturn(__pyx_r, 0);
  17460. __Pyx_RefNannyFinishContext();
  17461. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  17462. /* return from generator, yielding value */
  17463. __pyx_generator->resume_label = 1;
  17464. return __pyx_r;
  17465. __pyx_L21_resume_from_yield:;
  17466. __pyx_t_11 = __pyx_cur_scope->__pyx_t_0;
  17467. __pyx_t_12 = __pyx_cur_scope->__pyx_t_1;
  17468. __pyx_t_13 = __pyx_cur_scope->__pyx_t_2;
  17469. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1222, __pyx_L5_error)
  17470. }
  17471. }
  17472. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1226
  17473. * #logger.debug('After yield.')
  17474. * finally:
  17475. * self._cur_close(cur) # <<<<<<<<<<<<<<
  17476. *
  17477. *
  17478. */
  17479. /*finally:*/ {
  17480. /*normal exit:*/{
  17481. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_cur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1226, __pyx_L1_error)
  17482. goto __pyx_L6;
  17483. }
  17484. __pyx_L5_error:;
  17485. /*exception exit:*/{
  17486. __Pyx_PyThreadState_assign
  17487. __pyx_t_17 = 0; __pyx_t_16 = 0; __pyx_t_15 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
  17488. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  17489. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  17490. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  17491. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  17492. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  17493. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  17494. if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
  17495. if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_17, &__pyx_t_16, &__pyx_t_15) < 0)) __Pyx_ErrFetch(&__pyx_t_17, &__pyx_t_16, &__pyx_t_15);
  17496. __Pyx_XGOTREF(__pyx_t_17);
  17497. __Pyx_XGOTREF(__pyx_t_16);
  17498. __Pyx_XGOTREF(__pyx_t_15);
  17499. __Pyx_XGOTREF(__pyx_t_21);
  17500. __Pyx_XGOTREF(__pyx_t_22);
  17501. __Pyx_XGOTREF(__pyx_t_23);
  17502. __pyx_t_6 = __pyx_lineno; __pyx_t_19 = __pyx_clineno; __pyx_t_20 = __pyx_filename;
  17503. {
  17504. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_cur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1226, __pyx_L23_error)
  17505. }
  17506. if (PY_MAJOR_VERSION >= 3) {
  17507. __Pyx_XGIVEREF(__pyx_t_21);
  17508. __Pyx_XGIVEREF(__pyx_t_22);
  17509. __Pyx_XGIVEREF(__pyx_t_23);
  17510. __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23);
  17511. }
  17512. __Pyx_XGIVEREF(__pyx_t_17);
  17513. __Pyx_XGIVEREF(__pyx_t_16);
  17514. __Pyx_XGIVEREF(__pyx_t_15);
  17515. __Pyx_ErrRestore(__pyx_t_17, __pyx_t_16, __pyx_t_15);
  17516. __pyx_t_17 = 0; __pyx_t_16 = 0; __pyx_t_15 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
  17517. __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_19; __pyx_filename = __pyx_t_20;
  17518. goto __pyx_L1_error;
  17519. __pyx_L23_error:;
  17520. if (PY_MAJOR_VERSION >= 3) {
  17521. __Pyx_XGIVEREF(__pyx_t_21);
  17522. __Pyx_XGIVEREF(__pyx_t_22);
  17523. __Pyx_XGIVEREF(__pyx_t_23);
  17524. __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23);
  17525. }
  17526. __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
  17527. __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
  17528. __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
  17529. __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
  17530. goto __pyx_L1_error;
  17531. }
  17532. __pyx_L6:;
  17533. }
  17534. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  17535. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1167
  17536. *
  17537. *
  17538. * def triples(self, triple_pattern, context=None): # <<<<<<<<<<<<<<
  17539. * """
  17540. * Generator over matching triples.
  17541. */
  17542. /* function exit code */
  17543. PyErr_SetNone(PyExc_StopIteration);
  17544. goto __pyx_L0;
  17545. __pyx_L1_error:;
  17546. __Pyx_XDECREF(__pyx_t_1);
  17547. __Pyx_XDECREF(__pyx_t_2);
  17548. __Pyx_XDECREF(__pyx_t_3);
  17549. __Pyx_XDECREF(__pyx_t_4);
  17550. __Pyx_XDECREF(__pyx_t_5);
  17551. __Pyx_XDECREF(__pyx_t_7);
  17552. __Pyx_AddTraceback("triples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  17553. __pyx_L0:;
  17554. __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  17555. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  17556. __pyx_generator->resume_label = -1;
  17557. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  17558. __Pyx_TraceReturn(__pyx_r, 0);
  17559. __Pyx_RefNannyFinishContext();
  17560. return __pyx_r;
  17561. }
  17562. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1229
  17563. *
  17564. *
  17565. * cpdef ResultSet triple_keys(self, tuple triple_pattern, context=None): # <<<<<<<<<<<<<<
  17566. * """
  17567. * Top-level lookup method.
  17568. */
  17569. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_21triple_keys(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  17570. static struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_triple_keys(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_triple_pattern, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_triple_keys *__pyx_optional_args) {
  17571. PyObject *__pyx_v_context = ((PyObject *)Py_None);
  17572. unsigned char __pyx_v_tk[5];
  17573. unsigned char __pyx_v_ck[5];
  17574. unsigned char __pyx_v_spok[15];
  17575. size_t __pyx_v_ct;
  17576. size_t __pyx_v_flt_j;
  17577. size_t __pyx_v_i;
  17578. size_t __pyx_v_j;
  17579. size_t __pyx_v_pg_offset;
  17580. MDB_cursor *__pyx_v_icur;
  17581. struct MDB_val __pyx_v_key_v;
  17582. struct MDB_val __pyx_v_data_v;
  17583. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_flt_res = 0;
  17584. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_ret = 0;
  17585. PyObject *__pyx_v_term = NULL;
  17586. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_res = NULL;
  17587. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_r = NULL;
  17588. __Pyx_TraceDeclarations
  17589. __Pyx_RefNannyDeclarations
  17590. PyObject *__pyx_t_1 = NULL;
  17591. PyObject *__pyx_t_2 = NULL;
  17592. PyObject *__pyx_t_3 = NULL;
  17593. PyObject *__pyx_t_4 = NULL;
  17594. int __pyx_t_5;
  17595. PyObject *__pyx_t_6 = NULL;
  17596. int __pyx_t_7;
  17597. int __pyx_t_8;
  17598. PyObject *__pyx_t_9 = NULL;
  17599. PyObject *__pyx_t_10 = NULL;
  17600. PyObject *__pyx_t_11 = NULL;
  17601. MDB_cursor *__pyx_t_12;
  17602. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__cur_open __pyx_t_13;
  17603. size_t __pyx_t_14;
  17604. Py_ssize_t __pyx_t_15;
  17605. Py_UCS4 __pyx_t_16;
  17606. PyObject *__pyx_t_17 = NULL;
  17607. PyObject *__pyx_t_18 = NULL;
  17608. int __pyx_t_19;
  17609. char const *__pyx_t_20;
  17610. PyObject *__pyx_t_21 = NULL;
  17611. PyObject *__pyx_t_22 = NULL;
  17612. PyObject *__pyx_t_23 = NULL;
  17613. char const *__pyx_t_24;
  17614. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_t_25 = NULL;
  17615. __Pyx_RefNannySetupContext("triple_keys", 0);
  17616. __Pyx_TraceCall("triple_keys", __pyx_f[0], 1229, 0, __PYX_ERR(0, 1229, __pyx_L1_error));
  17617. if (__pyx_optional_args) {
  17618. if (__pyx_optional_args->__pyx_n > 0) {
  17619. __pyx_v_context = __pyx_optional_args->context;
  17620. }
  17621. }
  17622. /* Check if called by wrapper */
  17623. if (unlikely(__pyx_skip_dispatch)) ;
  17624. /* Check if overridden in Python */
  17625. else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
  17626. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_triple_keys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1229, __pyx_L1_error)
  17627. __Pyx_GOTREF(__pyx_t_1);
  17628. if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_21triple_keys)) {
  17629. __Pyx_XDECREF(((PyObject *)__pyx_r));
  17630. __Pyx_INCREF(__pyx_t_1);
  17631. __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
  17632. __pyx_t_5 = 0;
  17633. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  17634. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
  17635. if (likely(__pyx_t_4)) {
  17636. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  17637. __Pyx_INCREF(__pyx_t_4);
  17638. __Pyx_INCREF(function);
  17639. __Pyx_DECREF_SET(__pyx_t_3, function);
  17640. __pyx_t_5 = 1;
  17641. }
  17642. }
  17643. #if CYTHON_FAST_PYCALL
  17644. if (PyFunction_Check(__pyx_t_3)) {
  17645. PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_triple_pattern, __pyx_v_context};
  17646. __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1229, __pyx_L1_error)
  17647. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  17648. __Pyx_GOTREF(__pyx_t_2);
  17649. } else
  17650. #endif
  17651. #if CYTHON_FAST_PYCCALL
  17652. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  17653. PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_triple_pattern, __pyx_v_context};
  17654. __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1229, __pyx_L1_error)
  17655. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  17656. __Pyx_GOTREF(__pyx_t_2);
  17657. } else
  17658. #endif
  17659. {
  17660. __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1229, __pyx_L1_error)
  17661. __Pyx_GOTREF(__pyx_t_6);
  17662. if (__pyx_t_4) {
  17663. __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
  17664. }
  17665. __Pyx_INCREF(__pyx_v_triple_pattern);
  17666. __Pyx_GIVEREF(__pyx_v_triple_pattern);
  17667. PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_triple_pattern);
  17668. __Pyx_INCREF(__pyx_v_context);
  17669. __Pyx_GIVEREF(__pyx_v_context);
  17670. PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_context);
  17671. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1229, __pyx_L1_error)
  17672. __Pyx_GOTREF(__pyx_t_2);
  17673. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  17674. }
  17675. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17676. if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet))))) __PYX_ERR(0, 1229, __pyx_L1_error)
  17677. __pyx_r = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_2);
  17678. __pyx_t_2 = 0;
  17679. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17680. goto __pyx_L0;
  17681. }
  17682. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17683. }
  17684. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1247
  17685. * unsigned char spok[TRP_KLEN]
  17686. * #unsigned char *pk_c
  17687. * size_t ct = 0, flt_j = 0, i = 0, j = 0, pg_offset = 0, c_size # <<<<<<<<<<<<<<
  17688. * lmdb.MDB_cursor *icur
  17689. * lmdb.MDB_val key_v, data_v
  17690. */
  17691. __pyx_v_ct = 0;
  17692. __pyx_v_flt_j = 0;
  17693. __pyx_v_i = 0;
  17694. __pyx_v_j = 0;
  17695. __pyx_v_pg_offset = 0;
  17696. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1252
  17697. * ResultSet flt_res, ret
  17698. *
  17699. * if context is not None: # <<<<<<<<<<<<<<
  17700. * #serialize(context, &pk_c, &c_size)
  17701. * try:
  17702. */
  17703. __pyx_t_7 = (__pyx_v_context != Py_None);
  17704. __pyx_t_8 = (__pyx_t_7 != 0);
  17705. if (__pyx_t_8) {
  17706. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1254
  17707. * if context is not None:
  17708. * #serialize(context, &pk_c, &c_size)
  17709. * try: # <<<<<<<<<<<<<<
  17710. * self._to_key(context, &ck)
  17711. * except KeyNotFoundError:
  17712. */
  17713. {
  17714. __Pyx_PyThreadState_declare
  17715. __Pyx_PyThreadState_assign
  17716. __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
  17717. __Pyx_XGOTREF(__pyx_t_9);
  17718. __Pyx_XGOTREF(__pyx_t_10);
  17719. __Pyx_XGOTREF(__pyx_t_11);
  17720. /*try:*/ {
  17721. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1255
  17722. * #serialize(context, &pk_c, &c_size)
  17723. * try:
  17724. * self._to_key(context, &ck) # <<<<<<<<<<<<<<
  17725. * except KeyNotFoundError:
  17726. * # Context not found.
  17727. */
  17728. __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__to_key(__pyx_v_self, __pyx_v_context, (&__pyx_v_ck)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1255, __pyx_L4_error)
  17729. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1254
  17730. * if context is not None:
  17731. * #serialize(context, &pk_c, &c_size)
  17732. * try: # <<<<<<<<<<<<<<
  17733. * self._to_key(context, &ck)
  17734. * except KeyNotFoundError:
  17735. */
  17736. }
  17737. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  17738. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  17739. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  17740. goto __pyx_L9_try_end;
  17741. __pyx_L4_error:;
  17742. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  17743. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  17744. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  17745. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  17746. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  17747. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1256
  17748. * try:
  17749. * self._to_key(context, &ck)
  17750. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  17751. * # Context not found.
  17752. * return ResultSet(0, TRP_KLEN)
  17753. */
  17754. __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  17755. __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1256, __pyx_L6_except_error)
  17756. __Pyx_GOTREF(__pyx_t_6);
  17757. __pyx_t_5 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
  17758. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  17759. __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  17760. __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0;
  17761. if (__pyx_t_5) {
  17762. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.triple_keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  17763. if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 1256, __pyx_L6_except_error)
  17764. __Pyx_GOTREF(__pyx_t_3);
  17765. __Pyx_GOTREF(__pyx_t_2);
  17766. __Pyx_GOTREF(__pyx_t_1);
  17767. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1258
  17768. * except KeyNotFoundError:
  17769. * # Context not found.
  17770. * return ResultSet(0, TRP_KLEN) # <<<<<<<<<<<<<<
  17771. *
  17772. * icur = self._cur_open('c:spo')
  17773. */
  17774. __Pyx_XDECREF(((PyObject *)__pyx_r));
  17775. __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet), __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1258, __pyx_L6_except_error)
  17776. __Pyx_GOTREF(__pyx_t_6);
  17777. __pyx_r = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_6);
  17778. __pyx_t_6 = 0;
  17779. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17780. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17781. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17782. goto __pyx_L7_except_return;
  17783. }
  17784. goto __pyx_L6_except_error;
  17785. __pyx_L6_except_error:;
  17786. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1254
  17787. * if context is not None:
  17788. * #serialize(context, &pk_c, &c_size)
  17789. * try: # <<<<<<<<<<<<<<
  17790. * self._to_key(context, &ck)
  17791. * except KeyNotFoundError:
  17792. */
  17793. __Pyx_XGIVEREF(__pyx_t_9);
  17794. __Pyx_XGIVEREF(__pyx_t_10);
  17795. __Pyx_XGIVEREF(__pyx_t_11);
  17796. __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
  17797. goto __pyx_L1_error;
  17798. __pyx_L7_except_return:;
  17799. __Pyx_XGIVEREF(__pyx_t_9);
  17800. __Pyx_XGIVEREF(__pyx_t_10);
  17801. __Pyx_XGIVEREF(__pyx_t_11);
  17802. __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
  17803. goto __pyx_L0;
  17804. __pyx_L9_try_end:;
  17805. }
  17806. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1260
  17807. * return ResultSet(0, TRP_KLEN)
  17808. *
  17809. * icur = self._cur_open('c:spo') # <<<<<<<<<<<<<<
  17810. *
  17811. * try:
  17812. */
  17813. __pyx_t_13.__pyx_n = 1;
  17814. __pyx_t_13.dblabel = ((unsigned char *)((char const *)"c:spo"));
  17815. __pyx_t_12 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_open(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_13); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1260, __pyx_L1_error)
  17816. __pyx_v_icur = __pyx_t_12;
  17817. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1262
  17818. * icur = self._cur_open('c:spo')
  17819. *
  17820. * try: # <<<<<<<<<<<<<<
  17821. * key_v.mv_data = ck
  17822. * key_v.mv_size = KLEN
  17823. */
  17824. /*try:*/ {
  17825. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1263
  17826. *
  17827. * try:
  17828. * key_v.mv_data = ck # <<<<<<<<<<<<<<
  17829. * key_v.mv_size = KLEN
  17830. *
  17831. */
  17832. __pyx_v_key_v.mv_data = __pyx_v_ck;
  17833. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1264
  17834. * try:
  17835. * key_v.mv_data = ck
  17836. * key_v.mv_size = KLEN # <<<<<<<<<<<<<<
  17837. *
  17838. * # s p o c
  17839. */
  17840. __pyx_v_key_v.mv_size = 5;
  17841. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1267
  17842. *
  17843. * # s p o c
  17844. * if all(triple_pattern): # <<<<<<<<<<<<<<
  17845. * #logger.debug('Lookup: s p o c')
  17846. * for i, term in enumerate(triple_pattern):
  17847. */
  17848. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_all, __pyx_v_triple_pattern); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1267, __pyx_L13_error)
  17849. __Pyx_GOTREF(__pyx_t_1);
  17850. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1267, __pyx_L13_error)
  17851. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17852. if (__pyx_t_8) {
  17853. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1269
  17854. * if all(triple_pattern):
  17855. * #logger.debug('Lookup: s p o c')
  17856. * for i, term in enumerate(triple_pattern): # <<<<<<<<<<<<<<
  17857. * try:
  17858. * self._to_key(term, &tk)
  17859. */
  17860. __pyx_t_14 = 0;
  17861. __pyx_t_1 = __pyx_v_triple_pattern; __Pyx_INCREF(__pyx_t_1); __pyx_t_15 = 0;
  17862. for (;;) {
  17863. if (__pyx_t_15 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
  17864. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  17865. __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_15); __Pyx_INCREF(__pyx_t_2); __pyx_t_15++; if (unlikely(0 < 0)) __PYX_ERR(0, 1269, __pyx_L13_error)
  17866. #else
  17867. __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1269, __pyx_L13_error)
  17868. __Pyx_GOTREF(__pyx_t_2);
  17869. #endif
  17870. __Pyx_XDECREF_SET(__pyx_v_term, __pyx_t_2);
  17871. __pyx_t_2 = 0;
  17872. __pyx_v_i = __pyx_t_14;
  17873. __pyx_t_14 = (__pyx_t_14 + 1);
  17874. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1270
  17875. * #logger.debug('Lookup: s p o c')
  17876. * for i, term in enumerate(triple_pattern):
  17877. * try: # <<<<<<<<<<<<<<
  17878. * self._to_key(term, &tk)
  17879. * except KeyNotFoundError:
  17880. */
  17881. {
  17882. __Pyx_PyThreadState_declare
  17883. __Pyx_PyThreadState_assign
  17884. __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
  17885. __Pyx_XGOTREF(__pyx_t_11);
  17886. __Pyx_XGOTREF(__pyx_t_10);
  17887. __Pyx_XGOTREF(__pyx_t_9);
  17888. /*try:*/ {
  17889. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1271
  17890. * for i, term in enumerate(triple_pattern):
  17891. * try:
  17892. * self._to_key(term, &tk) # <<<<<<<<<<<<<<
  17893. * except KeyNotFoundError:
  17894. * # Context not found.
  17895. */
  17896. __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__to_key(__pyx_v_self, __pyx_v_term, (&__pyx_v_tk)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1271, __pyx_L18_error)
  17897. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1270
  17898. * #logger.debug('Lookup: s p o c')
  17899. * for i, term in enumerate(triple_pattern):
  17900. * try: # <<<<<<<<<<<<<<
  17901. * self._to_key(term, &tk)
  17902. * except KeyNotFoundError:
  17903. */
  17904. }
  17905. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  17906. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  17907. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  17908. goto __pyx_L25_try_end;
  17909. __pyx_L18_error:;
  17910. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  17911. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  17912. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  17913. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  17914. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1272
  17915. * try:
  17916. * self._to_key(term, &tk)
  17917. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  17918. * # Context not found.
  17919. * return ResultSet(0, TRP_KLEN)
  17920. */
  17921. __Pyx_ErrFetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_6);
  17922. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1272, __pyx_L20_except_error)
  17923. __Pyx_GOTREF(__pyx_t_4);
  17924. __pyx_t_5 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_2, __pyx_t_4);
  17925. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  17926. __Pyx_ErrRestore(__pyx_t_2, __pyx_t_3, __pyx_t_6);
  17927. __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_6 = 0;
  17928. if (__pyx_t_5) {
  17929. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.triple_keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  17930. if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_3, &__pyx_t_2) < 0) __PYX_ERR(0, 1272, __pyx_L20_except_error)
  17931. __Pyx_GOTREF(__pyx_t_6);
  17932. __Pyx_GOTREF(__pyx_t_3);
  17933. __Pyx_GOTREF(__pyx_t_2);
  17934. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1274
  17935. * except KeyNotFoundError:
  17936. * # Context not found.
  17937. * return ResultSet(0, TRP_KLEN) # <<<<<<<<<<<<<<
  17938. * memcpy(spok + (KLEN * i), tk, KLEN)
  17939. * if tk is NULL:
  17940. */
  17941. __Pyx_XDECREF(((PyObject *)__pyx_r));
  17942. __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet), __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1274, __pyx_L20_except_error)
  17943. __Pyx_GOTREF(__pyx_t_4);
  17944. __pyx_r = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_4);
  17945. __pyx_t_4 = 0;
  17946. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17947. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17948. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17949. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  17950. goto __pyx_L21_except_return;
  17951. }
  17952. goto __pyx_L20_except_error;
  17953. __pyx_L20_except_error:;
  17954. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1270
  17955. * #logger.debug('Lookup: s p o c')
  17956. * for i, term in enumerate(triple_pattern):
  17957. * try: # <<<<<<<<<<<<<<
  17958. * self._to_key(term, &tk)
  17959. * except KeyNotFoundError:
  17960. */
  17961. __Pyx_XGIVEREF(__pyx_t_11);
  17962. __Pyx_XGIVEREF(__pyx_t_10);
  17963. __Pyx_XGIVEREF(__pyx_t_9);
  17964. __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
  17965. goto __pyx_L13_error;
  17966. __pyx_L21_except_return:;
  17967. __Pyx_XGIVEREF(__pyx_t_11);
  17968. __Pyx_XGIVEREF(__pyx_t_10);
  17969. __Pyx_XGIVEREF(__pyx_t_9);
  17970. __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
  17971. goto __pyx_L12_return;
  17972. __pyx_L25_try_end:;
  17973. }
  17974. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1275
  17975. * # Context not found.
  17976. * return ResultSet(0, TRP_KLEN)
  17977. * memcpy(spok + (KLEN * i), tk, KLEN) # <<<<<<<<<<<<<<
  17978. * if tk is NULL:
  17979. * # A term in the triple is not found.
  17980. */
  17981. (void)(memcpy((__pyx_v_spok + (5 * __pyx_v_i)), __pyx_v_tk, 5));
  17982. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1276
  17983. * return ResultSet(0, TRP_KLEN)
  17984. * memcpy(spok + (KLEN * i), tk, KLEN)
  17985. * if tk is NULL: # <<<<<<<<<<<<<<
  17986. * # A term in the triple is not found.
  17987. * return ResultSet(0, TRP_KLEN)
  17988. */
  17989. __pyx_t_8 = ((__pyx_v_tk == NULL) != 0);
  17990. if (__pyx_t_8) {
  17991. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1278
  17992. * if tk is NULL:
  17993. * # A term in the triple is not found.
  17994. * return ResultSet(0, TRP_KLEN) # <<<<<<<<<<<<<<
  17995. * data_v.mv_data = spok
  17996. * data_v.mv_size = TRP_KLEN
  17997. */
  17998. __Pyx_XDECREF(((PyObject *)__pyx_r));
  17999. __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet), __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1278, __pyx_L13_error)
  18000. __Pyx_GOTREF(__pyx_t_2);
  18001. __pyx_r = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_2);
  18002. __pyx_t_2 = 0;
  18003. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18004. goto __pyx_L12_return;
  18005. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1276
  18006. * return ResultSet(0, TRP_KLEN)
  18007. * memcpy(spok + (KLEN * i), tk, KLEN)
  18008. * if tk is NULL: # <<<<<<<<<<<<<<
  18009. * # A term in the triple is not found.
  18010. * return ResultSet(0, TRP_KLEN)
  18011. */
  18012. }
  18013. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1269
  18014. * if all(triple_pattern):
  18015. * #logger.debug('Lookup: s p o c')
  18016. * for i, term in enumerate(triple_pattern): # <<<<<<<<<<<<<<
  18017. * try:
  18018. * self._to_key(term, &tk)
  18019. */
  18020. }
  18021. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18022. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1279
  18023. * # A term in the triple is not found.
  18024. * return ResultSet(0, TRP_KLEN)
  18025. * data_v.mv_data = spok # <<<<<<<<<<<<<<
  18026. * data_v.mv_size = TRP_KLEN
  18027. * #logger.debug(
  18028. */
  18029. __pyx_v_data_v.mv_data = __pyx_v_spok;
  18030. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1280
  18031. * return ResultSet(0, TRP_KLEN)
  18032. * data_v.mv_data = spok
  18033. * data_v.mv_size = TRP_KLEN # <<<<<<<<<<<<<<
  18034. * #logger.debug(
  18035. * # 'Found spok {}. Matching with context {}'.format(
  18036. */
  18037. __pyx_v_data_v.mv_size = 15;
  18038. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1285
  18039. * # (<TripleKey>data_v.mv_data)[: TRP_KLEN],
  18040. * # (<Key>key_v.mv_data)[: KLEN]))
  18041. * try: # <<<<<<<<<<<<<<
  18042. * _check(lmdb.mdb_cursor_get(
  18043. * icur, &key_v, &data_v, lmdb.MDB_GET_BOTH))
  18044. */
  18045. {
  18046. __Pyx_PyThreadState_declare
  18047. __Pyx_PyThreadState_assign
  18048. __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
  18049. __Pyx_XGOTREF(__pyx_t_9);
  18050. __Pyx_XGOTREF(__pyx_t_10);
  18051. __Pyx_XGOTREF(__pyx_t_11);
  18052. /*try:*/ {
  18053. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1286
  18054. * # (<Key>key_v.mv_data)[: KLEN]))
  18055. * try:
  18056. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  18057. * icur, &key_v, &data_v, lmdb.MDB_GET_BOTH))
  18058. * except KeyNotFoundError:
  18059. */
  18060. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_icur, (&__pyx_v_key_v), (&__pyx_v_data_v), MDB_GET_BOTH), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1286, __pyx_L29_error)
  18061. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1285
  18062. * # (<TripleKey>data_v.mv_data)[: TRP_KLEN],
  18063. * # (<Key>key_v.mv_data)[: KLEN]))
  18064. * try: # <<<<<<<<<<<<<<
  18065. * _check(lmdb.mdb_cursor_get(
  18066. * icur, &key_v, &data_v, lmdb.MDB_GET_BOTH))
  18067. */
  18068. }
  18069. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  18070. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  18071. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  18072. goto __pyx_L34_try_end;
  18073. __pyx_L29_error:;
  18074. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  18075. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  18076. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  18077. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  18078. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  18079. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1288
  18080. * _check(lmdb.mdb_cursor_get(
  18081. * icur, &key_v, &data_v, lmdb.MDB_GET_BOTH))
  18082. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  18083. * # Triple not found.
  18084. * #logger.debug('spok / ck pair not found.')
  18085. */
  18086. __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  18087. __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1288, __pyx_L31_except_error)
  18088. __Pyx_GOTREF(__pyx_t_6);
  18089. __pyx_t_5 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
  18090. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  18091. __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  18092. __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0;
  18093. if (__pyx_t_5) {
  18094. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.triple_keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  18095. if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 1288, __pyx_L31_except_error)
  18096. __Pyx_GOTREF(__pyx_t_3);
  18097. __Pyx_GOTREF(__pyx_t_2);
  18098. __Pyx_GOTREF(__pyx_t_1);
  18099. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1291
  18100. * # Triple not found.
  18101. * #logger.debug('spok / ck pair not found.')
  18102. * return ResultSet(0, TRP_KLEN) # <<<<<<<<<<<<<<
  18103. * ret = ResultSet(1, TRP_KLEN)
  18104. * memcpy(ret.data, spok, TRP_KLEN)
  18105. */
  18106. __Pyx_XDECREF(((PyObject *)__pyx_r));
  18107. __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet), __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1291, __pyx_L31_except_error)
  18108. __Pyx_GOTREF(__pyx_t_6);
  18109. __pyx_r = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_6);
  18110. __pyx_t_6 = 0;
  18111. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18112. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  18113. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18114. goto __pyx_L32_except_return;
  18115. }
  18116. goto __pyx_L31_except_error;
  18117. __pyx_L31_except_error:;
  18118. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1285
  18119. * # (<TripleKey>data_v.mv_data)[: TRP_KLEN],
  18120. * # (<Key>key_v.mv_data)[: KLEN]))
  18121. * try: # <<<<<<<<<<<<<<
  18122. * _check(lmdb.mdb_cursor_get(
  18123. * icur, &key_v, &data_v, lmdb.MDB_GET_BOTH))
  18124. */
  18125. __Pyx_XGIVEREF(__pyx_t_9);
  18126. __Pyx_XGIVEREF(__pyx_t_10);
  18127. __Pyx_XGIVEREF(__pyx_t_11);
  18128. __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
  18129. goto __pyx_L13_error;
  18130. __pyx_L32_except_return:;
  18131. __Pyx_XGIVEREF(__pyx_t_9);
  18132. __Pyx_XGIVEREF(__pyx_t_10);
  18133. __Pyx_XGIVEREF(__pyx_t_11);
  18134. __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
  18135. goto __pyx_L12_return;
  18136. __pyx_L34_try_end:;
  18137. }
  18138. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1292
  18139. * #logger.debug('spok / ck pair not found.')
  18140. * return ResultSet(0, TRP_KLEN)
  18141. * ret = ResultSet(1, TRP_KLEN) # <<<<<<<<<<<<<<
  18142. * memcpy(ret.data, spok, TRP_KLEN)
  18143. *
  18144. */
  18145. __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet), __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1292, __pyx_L13_error)
  18146. __Pyx_GOTREF(__pyx_t_1);
  18147. __pyx_v_ret = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_1);
  18148. __pyx_t_1 = 0;
  18149. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1293
  18150. * return ResultSet(0, TRP_KLEN)
  18151. * ret = ResultSet(1, TRP_KLEN)
  18152. * memcpy(ret.data, spok, TRP_KLEN) # <<<<<<<<<<<<<<
  18153. *
  18154. * return ret
  18155. */
  18156. (void)(memcpy(__pyx_v_ret->data, __pyx_v_spok, 15));
  18157. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1295
  18158. * memcpy(ret.data, spok, TRP_KLEN)
  18159. *
  18160. * return ret # <<<<<<<<<<<<<<
  18161. *
  18162. * # ? ? ? c
  18163. */
  18164. __Pyx_XDECREF(((PyObject *)__pyx_r));
  18165. __Pyx_INCREF(((PyObject *)__pyx_v_ret));
  18166. __pyx_r = __pyx_v_ret;
  18167. goto __pyx_L12_return;
  18168. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1267
  18169. *
  18170. * # s p o c
  18171. * if all(triple_pattern): # <<<<<<<<<<<<<<
  18172. * #logger.debug('Lookup: s p o c')
  18173. * for i, term in enumerate(triple_pattern):
  18174. */
  18175. }
  18176. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1298
  18177. *
  18178. * # ? ? ? c
  18179. * elif not any(triple_pattern): # <<<<<<<<<<<<<<
  18180. * # Get all triples from the context
  18181. * #logger.debug('Lookup: ? ? ? c')
  18182. */
  18183. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_any, __pyx_v_triple_pattern); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1298, __pyx_L13_error)
  18184. __Pyx_GOTREF(__pyx_t_1);
  18185. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1298, __pyx_L13_error)
  18186. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18187. __pyx_t_7 = ((!__pyx_t_8) != 0);
  18188. if (__pyx_t_7) {
  18189. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1301
  18190. * # Get all triples from the context
  18191. * #logger.debug('Lookup: ? ? ? c')
  18192. * try: # <<<<<<<<<<<<<<
  18193. * _check(lmdb.mdb_cursor_get(
  18194. * icur, &key_v, &data_v, lmdb.MDB_SET))
  18195. */
  18196. {
  18197. __Pyx_PyThreadState_declare
  18198. __Pyx_PyThreadState_assign
  18199. __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
  18200. __Pyx_XGOTREF(__pyx_t_11);
  18201. __Pyx_XGOTREF(__pyx_t_10);
  18202. __Pyx_XGOTREF(__pyx_t_9);
  18203. /*try:*/ {
  18204. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1302
  18205. * #logger.debug('Lookup: ? ? ? c')
  18206. * try:
  18207. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  18208. * icur, &key_v, &data_v, lmdb.MDB_SET))
  18209. * except KeyNotFoundError:
  18210. */
  18211. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_icur, (&__pyx_v_key_v), (&__pyx_v_data_v), MDB_SET), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1302, __pyx_L37_error)
  18212. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1301
  18213. * # Get all triples from the context
  18214. * #logger.debug('Lookup: ? ? ? c')
  18215. * try: # <<<<<<<<<<<<<<
  18216. * _check(lmdb.mdb_cursor_get(
  18217. * icur, &key_v, &data_v, lmdb.MDB_SET))
  18218. */
  18219. }
  18220. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  18221. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  18222. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  18223. goto __pyx_L42_try_end;
  18224. __pyx_L37_error:;
  18225. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  18226. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  18227. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  18228. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  18229. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  18230. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1304
  18231. * _check(lmdb.mdb_cursor_get(
  18232. * icur, &key_v, &data_v, lmdb.MDB_SET))
  18233. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  18234. * # Triple not found.
  18235. * return ResultSet(0, TRP_KLEN)
  18236. */
  18237. __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  18238. __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1304, __pyx_L39_except_error)
  18239. __Pyx_GOTREF(__pyx_t_6);
  18240. __pyx_t_5 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
  18241. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  18242. __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  18243. __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0;
  18244. if (__pyx_t_5) {
  18245. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.triple_keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  18246. if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 1304, __pyx_L39_except_error)
  18247. __Pyx_GOTREF(__pyx_t_3);
  18248. __Pyx_GOTREF(__pyx_t_2);
  18249. __Pyx_GOTREF(__pyx_t_1);
  18250. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1306
  18251. * except KeyNotFoundError:
  18252. * # Triple not found.
  18253. * return ResultSet(0, TRP_KLEN) # <<<<<<<<<<<<<<
  18254. *
  18255. * _check(lmdb.mdb_cursor_count(icur, &ct))
  18256. */
  18257. __Pyx_XDECREF(((PyObject *)__pyx_r));
  18258. __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet), __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1306, __pyx_L39_except_error)
  18259. __Pyx_GOTREF(__pyx_t_6);
  18260. __pyx_r = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_6);
  18261. __pyx_t_6 = 0;
  18262. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18263. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  18264. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18265. goto __pyx_L40_except_return;
  18266. }
  18267. goto __pyx_L39_except_error;
  18268. __pyx_L39_except_error:;
  18269. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1301
  18270. * # Get all triples from the context
  18271. * #logger.debug('Lookup: ? ? ? c')
  18272. * try: # <<<<<<<<<<<<<<
  18273. * _check(lmdb.mdb_cursor_get(
  18274. * icur, &key_v, &data_v, lmdb.MDB_SET))
  18275. */
  18276. __Pyx_XGIVEREF(__pyx_t_11);
  18277. __Pyx_XGIVEREF(__pyx_t_10);
  18278. __Pyx_XGIVEREF(__pyx_t_9);
  18279. __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
  18280. goto __pyx_L13_error;
  18281. __pyx_L40_except_return:;
  18282. __Pyx_XGIVEREF(__pyx_t_11);
  18283. __Pyx_XGIVEREF(__pyx_t_10);
  18284. __Pyx_XGIVEREF(__pyx_t_9);
  18285. __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
  18286. goto __pyx_L12_return;
  18287. __pyx_L42_try_end:;
  18288. }
  18289. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1308
  18290. * return ResultSet(0, TRP_KLEN)
  18291. *
  18292. * _check(lmdb.mdb_cursor_count(icur, &ct)) # <<<<<<<<<<<<<<
  18293. * ret = ResultSet(ct, TRP_KLEN)
  18294. * logger.debug(f'Entries in c:spo: {ct}')
  18295. */
  18296. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_count(__pyx_v_icur, (&__pyx_v_ct)), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1308, __pyx_L13_error)
  18297. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1309
  18298. *
  18299. * _check(lmdb.mdb_cursor_count(icur, &ct))
  18300. * ret = ResultSet(ct, TRP_KLEN) # <<<<<<<<<<<<<<
  18301. * logger.debug(f'Entries in c:spo: {ct}')
  18302. * logger.debug(f'Allocated {ret.size} bytes.')
  18303. */
  18304. __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_ct); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1309, __pyx_L13_error)
  18305. __Pyx_GOTREF(__pyx_t_1);
  18306. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1309, __pyx_L13_error)
  18307. __Pyx_GOTREF(__pyx_t_2);
  18308. __Pyx_GIVEREF(__pyx_t_1);
  18309. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  18310. __Pyx_INCREF(__pyx_int_15);
  18311. __Pyx_GIVEREF(__pyx_int_15);
  18312. PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_15);
  18313. __pyx_t_1 = 0;
  18314. __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1309, __pyx_L13_error)
  18315. __Pyx_GOTREF(__pyx_t_1);
  18316. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  18317. __pyx_v_ret = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_1);
  18318. __pyx_t_1 = 0;
  18319. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1310
  18320. * _check(lmdb.mdb_cursor_count(icur, &ct))
  18321. * ret = ResultSet(ct, TRP_KLEN)
  18322. * logger.debug(f'Entries in c:spo: {ct}') # <<<<<<<<<<<<<<
  18323. * logger.debug(f'Allocated {ret.size} bytes.')
  18324. *
  18325. */
  18326. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1310, __pyx_L13_error)
  18327. __Pyx_GOTREF(__pyx_t_2);
  18328. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1310, __pyx_L13_error)
  18329. __Pyx_GOTREF(__pyx_t_3);
  18330. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  18331. __pyx_t_2 = __Pyx_PyUnicode_From_size_t(__pyx_v_ct, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1310, __pyx_L13_error)
  18332. __Pyx_GOTREF(__pyx_t_2);
  18333. __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Entries_in_c_spo, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1310, __pyx_L13_error)
  18334. __Pyx_GOTREF(__pyx_t_6);
  18335. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  18336. __pyx_t_2 = NULL;
  18337. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  18338. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  18339. if (likely(__pyx_t_2)) {
  18340. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  18341. __Pyx_INCREF(__pyx_t_2);
  18342. __Pyx_INCREF(function);
  18343. __Pyx_DECREF_SET(__pyx_t_3, function);
  18344. }
  18345. }
  18346. if (!__pyx_t_2) {
  18347. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1310, __pyx_L13_error)
  18348. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  18349. __Pyx_GOTREF(__pyx_t_1);
  18350. } else {
  18351. #if CYTHON_FAST_PYCALL
  18352. if (PyFunction_Check(__pyx_t_3)) {
  18353. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_6};
  18354. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1310, __pyx_L13_error)
  18355. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  18356. __Pyx_GOTREF(__pyx_t_1);
  18357. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  18358. } else
  18359. #endif
  18360. #if CYTHON_FAST_PYCCALL
  18361. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  18362. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_6};
  18363. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1310, __pyx_L13_error)
  18364. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  18365. __Pyx_GOTREF(__pyx_t_1);
  18366. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  18367. } else
  18368. #endif
  18369. {
  18370. __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1310, __pyx_L13_error)
  18371. __Pyx_GOTREF(__pyx_t_4);
  18372. __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
  18373. __Pyx_GIVEREF(__pyx_t_6);
  18374. PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_6);
  18375. __pyx_t_6 = 0;
  18376. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1310, __pyx_L13_error)
  18377. __Pyx_GOTREF(__pyx_t_1);
  18378. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  18379. }
  18380. }
  18381. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18382. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18383. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1311
  18384. * ret = ResultSet(ct, TRP_KLEN)
  18385. * logger.debug(f'Entries in c:spo: {ct}')
  18386. * logger.debug(f'Allocated {ret.size} bytes.') # <<<<<<<<<<<<<<
  18387. *
  18388. * logger.debug('Looking in key: {}'.format(
  18389. */
  18390. __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1311, __pyx_L13_error)
  18391. __Pyx_GOTREF(__pyx_t_3);
  18392. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1311, __pyx_L13_error)
  18393. __Pyx_GOTREF(__pyx_t_4);
  18394. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18395. __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1311, __pyx_L13_error)
  18396. __Pyx_GOTREF(__pyx_t_3);
  18397. __pyx_t_15 = 0;
  18398. __pyx_t_16 = 127;
  18399. __Pyx_INCREF(__pyx_kp_u_Allocated);
  18400. __pyx_t_15 += 10;
  18401. __Pyx_GIVEREF(__pyx_kp_u_Allocated);
  18402. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Allocated);
  18403. __pyx_t_6 = __Pyx_PyUnicode_From_size_t(__pyx_v_ret->size, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1311, __pyx_L13_error)
  18404. __Pyx_GOTREF(__pyx_t_6);
  18405. __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
  18406. __Pyx_GIVEREF(__pyx_t_6);
  18407. PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6);
  18408. __pyx_t_6 = 0;
  18409. __Pyx_INCREF(__pyx_kp_u_bytes);
  18410. __pyx_t_15 += 7;
  18411. __Pyx_GIVEREF(__pyx_kp_u_bytes);
  18412. PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_bytes);
  18413. __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_15, __pyx_t_16); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1311, __pyx_L13_error)
  18414. __Pyx_GOTREF(__pyx_t_6);
  18415. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18416. __pyx_t_3 = NULL;
  18417. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
  18418. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
  18419. if (likely(__pyx_t_3)) {
  18420. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
  18421. __Pyx_INCREF(__pyx_t_3);
  18422. __Pyx_INCREF(function);
  18423. __Pyx_DECREF_SET(__pyx_t_4, function);
  18424. }
  18425. }
  18426. if (!__pyx_t_3) {
  18427. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1311, __pyx_L13_error)
  18428. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  18429. __Pyx_GOTREF(__pyx_t_1);
  18430. } else {
  18431. #if CYTHON_FAST_PYCALL
  18432. if (PyFunction_Check(__pyx_t_4)) {
  18433. PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_6};
  18434. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1311, __pyx_L13_error)
  18435. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  18436. __Pyx_GOTREF(__pyx_t_1);
  18437. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  18438. } else
  18439. #endif
  18440. #if CYTHON_FAST_PYCCALL
  18441. if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
  18442. PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_6};
  18443. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1311, __pyx_L13_error)
  18444. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  18445. __Pyx_GOTREF(__pyx_t_1);
  18446. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  18447. } else
  18448. #endif
  18449. {
  18450. __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1311, __pyx_L13_error)
  18451. __Pyx_GOTREF(__pyx_t_2);
  18452. __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
  18453. __Pyx_GIVEREF(__pyx_t_6);
  18454. PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_6);
  18455. __pyx_t_6 = 0;
  18456. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1311, __pyx_L13_error)
  18457. __Pyx_GOTREF(__pyx_t_1);
  18458. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  18459. }
  18460. }
  18461. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  18462. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18463. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1313
  18464. * logger.debug(f'Allocated {ret.size} bytes.')
  18465. *
  18466. * logger.debug('Looking in key: {}'.format( # <<<<<<<<<<<<<<
  18467. * (<unsigned char *>key_v.mv_data)[:key_v.mv_size]))
  18468. * _check(lmdb.mdb_cursor_get(
  18469. */
  18470. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1313, __pyx_L13_error)
  18471. __Pyx_GOTREF(__pyx_t_4);
  18472. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1313, __pyx_L13_error)
  18473. __Pyx_GOTREF(__pyx_t_2);
  18474. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  18475. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Looking_in_key, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1313, __pyx_L13_error)
  18476. __Pyx_GOTREF(__pyx_t_6);
  18477. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1314
  18478. *
  18479. * logger.debug('Looking in key: {}'.format(
  18480. * (<unsigned char *>key_v.mv_data)[:key_v.mv_size])) # <<<<<<<<<<<<<<
  18481. * _check(lmdb.mdb_cursor_get(
  18482. * icur, &key_v, &data_v, lmdb.MDB_GET_MULTIPLE))
  18483. */
  18484. __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((const char*)((unsigned char *)__pyx_v_key_v.mv_data)) + 0, __pyx_v_key_v.mv_size - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1314, __pyx_L13_error)
  18485. __Pyx_GOTREF(__pyx_t_3);
  18486. __pyx_t_17 = NULL;
  18487. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
  18488. __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_6);
  18489. if (likely(__pyx_t_17)) {
  18490. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
  18491. __Pyx_INCREF(__pyx_t_17);
  18492. __Pyx_INCREF(function);
  18493. __Pyx_DECREF_SET(__pyx_t_6, function);
  18494. }
  18495. }
  18496. if (!__pyx_t_17) {
  18497. __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1313, __pyx_L13_error)
  18498. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18499. __Pyx_GOTREF(__pyx_t_4);
  18500. } else {
  18501. #if CYTHON_FAST_PYCALL
  18502. if (PyFunction_Check(__pyx_t_6)) {
  18503. PyObject *__pyx_temp[2] = {__pyx_t_17, __pyx_t_3};
  18504. __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1313, __pyx_L13_error)
  18505. __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
  18506. __Pyx_GOTREF(__pyx_t_4);
  18507. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18508. } else
  18509. #endif
  18510. #if CYTHON_FAST_PYCCALL
  18511. if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
  18512. PyObject *__pyx_temp[2] = {__pyx_t_17, __pyx_t_3};
  18513. __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1313, __pyx_L13_error)
  18514. __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
  18515. __Pyx_GOTREF(__pyx_t_4);
  18516. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18517. } else
  18518. #endif
  18519. {
  18520. __pyx_t_18 = PyTuple_New(1+1); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1313, __pyx_L13_error)
  18521. __Pyx_GOTREF(__pyx_t_18);
  18522. __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_17); __pyx_t_17 = NULL;
  18523. __Pyx_GIVEREF(__pyx_t_3);
  18524. PyTuple_SET_ITEM(__pyx_t_18, 0+1, __pyx_t_3);
  18525. __pyx_t_3 = 0;
  18526. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_18, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1313, __pyx_L13_error)
  18527. __Pyx_GOTREF(__pyx_t_4);
  18528. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  18529. }
  18530. }
  18531. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  18532. __pyx_t_6 = NULL;
  18533. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
  18534. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
  18535. if (likely(__pyx_t_6)) {
  18536. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  18537. __Pyx_INCREF(__pyx_t_6);
  18538. __Pyx_INCREF(function);
  18539. __Pyx_DECREF_SET(__pyx_t_2, function);
  18540. }
  18541. }
  18542. if (!__pyx_t_6) {
  18543. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1313, __pyx_L13_error)
  18544. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  18545. __Pyx_GOTREF(__pyx_t_1);
  18546. } else {
  18547. #if CYTHON_FAST_PYCALL
  18548. if (PyFunction_Check(__pyx_t_2)) {
  18549. PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_4};
  18550. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1313, __pyx_L13_error)
  18551. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  18552. __Pyx_GOTREF(__pyx_t_1);
  18553. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  18554. } else
  18555. #endif
  18556. #if CYTHON_FAST_PYCCALL
  18557. if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
  18558. PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_4};
  18559. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1313, __pyx_L13_error)
  18560. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  18561. __Pyx_GOTREF(__pyx_t_1);
  18562. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  18563. } else
  18564. #endif
  18565. {
  18566. __pyx_t_18 = PyTuple_New(1+1); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1313, __pyx_L13_error)
  18567. __Pyx_GOTREF(__pyx_t_18);
  18568. __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_6); __pyx_t_6 = NULL;
  18569. __Pyx_GIVEREF(__pyx_t_4);
  18570. PyTuple_SET_ITEM(__pyx_t_18, 0+1, __pyx_t_4);
  18571. __pyx_t_4 = 0;
  18572. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1313, __pyx_L13_error)
  18573. __Pyx_GOTREF(__pyx_t_1);
  18574. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  18575. }
  18576. }
  18577. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  18578. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18579. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1315
  18580. * logger.debug('Looking in key: {}'.format(
  18581. * (<unsigned char *>key_v.mv_data)[:key_v.mv_size]))
  18582. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  18583. * icur, &key_v, &data_v, lmdb.MDB_GET_MULTIPLE))
  18584. * while True:
  18585. */
  18586. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_icur, (&__pyx_v_key_v), (&__pyx_v_data_v), MDB_GET_MULTIPLE), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1315, __pyx_L13_error)
  18587. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1317
  18588. * _check(lmdb.mdb_cursor_get(
  18589. * icur, &key_v, &data_v, lmdb.MDB_GET_MULTIPLE))
  18590. * while True: # <<<<<<<<<<<<<<
  18591. * #logger.debug(f'Data offset: {pg_offset} Page size: {data_v.mv_size} bytes')
  18592. * #logger.debug('Data page: {}'.format(
  18593. */
  18594. while (1) {
  18595. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1321
  18596. * #logger.debug('Data page: {}'.format(
  18597. * # (<unsigned char *>data_v.mv_data)[: data_v.mv_size]))
  18598. * memcpy(ret.data + pg_offset, data_v.mv_data, data_v.mv_size) # <<<<<<<<<<<<<<
  18599. * pg_offset += data_v.mv_size
  18600. *
  18601. */
  18602. (void)(memcpy((__pyx_v_ret->data + __pyx_v_pg_offset), __pyx_v_data_v.mv_data, __pyx_v_data_v.mv_size));
  18603. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1322
  18604. * # (<unsigned char *>data_v.mv_data)[: data_v.mv_size]))
  18605. * memcpy(ret.data + pg_offset, data_v.mv_data, data_v.mv_size)
  18606. * pg_offset += data_v.mv_size # <<<<<<<<<<<<<<
  18607. *
  18608. * try:
  18609. */
  18610. __pyx_v_pg_offset = (__pyx_v_pg_offset + __pyx_v_data_v.mv_size);
  18611. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1324
  18612. * pg_offset += data_v.mv_size
  18613. *
  18614. * try: # <<<<<<<<<<<<<<
  18615. * _check(lmdb.mdb_cursor_get(
  18616. * icur, &key_v, &data_v, lmdb.MDB_NEXT_MULTIPLE))
  18617. */
  18618. {
  18619. __Pyx_PyThreadState_declare
  18620. __Pyx_PyThreadState_assign
  18621. __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
  18622. __Pyx_XGOTREF(__pyx_t_9);
  18623. __Pyx_XGOTREF(__pyx_t_10);
  18624. __Pyx_XGOTREF(__pyx_t_11);
  18625. /*try:*/ {
  18626. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1325
  18627. *
  18628. * try:
  18629. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  18630. * icur, &key_v, &data_v, lmdb.MDB_NEXT_MULTIPLE))
  18631. * except KeyNotFoundError:
  18632. */
  18633. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_icur, (&__pyx_v_key_v), (&__pyx_v_data_v), MDB_NEXT_MULTIPLE), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1325, __pyx_L47_error)
  18634. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1324
  18635. * pg_offset += data_v.mv_size
  18636. *
  18637. * try: # <<<<<<<<<<<<<<
  18638. * _check(lmdb.mdb_cursor_get(
  18639. * icur, &key_v, &data_v, lmdb.MDB_NEXT_MULTIPLE))
  18640. */
  18641. }
  18642. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  18643. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  18644. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  18645. goto __pyx_L54_try_end;
  18646. __pyx_L47_error:;
  18647. __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
  18648. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  18649. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  18650. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  18651. __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
  18652. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  18653. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  18654. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1327
  18655. * _check(lmdb.mdb_cursor_get(
  18656. * icur, &key_v, &data_v, lmdb.MDB_NEXT_MULTIPLE))
  18657. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  18658. * return ret
  18659. *
  18660. */
  18661. __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_2, &__pyx_t_18);
  18662. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1327, __pyx_L49_except_error)
  18663. __Pyx_GOTREF(__pyx_t_4);
  18664. __pyx_t_5 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_4);
  18665. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  18666. __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_18);
  18667. __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_18 = 0;
  18668. if (__pyx_t_5) {
  18669. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.triple_keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  18670. if (__Pyx_GetException(&__pyx_t_18, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 1327, __pyx_L49_except_error)
  18671. __Pyx_GOTREF(__pyx_t_18);
  18672. __Pyx_GOTREF(__pyx_t_2);
  18673. __Pyx_GOTREF(__pyx_t_1);
  18674. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1328
  18675. * icur, &key_v, &data_v, lmdb.MDB_NEXT_MULTIPLE))
  18676. * except KeyNotFoundError:
  18677. * return ret # <<<<<<<<<<<<<<
  18678. *
  18679. * # Regular lookup. Filter _lookup() results by context.
  18680. */
  18681. __Pyx_XDECREF(((PyObject *)__pyx_r));
  18682. __Pyx_INCREF(((PyObject *)__pyx_v_ret));
  18683. __pyx_r = __pyx_v_ret;
  18684. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18685. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  18686. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  18687. goto __pyx_L50_except_return;
  18688. }
  18689. goto __pyx_L49_except_error;
  18690. __pyx_L49_except_error:;
  18691. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1324
  18692. * pg_offset += data_v.mv_size
  18693. *
  18694. * try: # <<<<<<<<<<<<<<
  18695. * _check(lmdb.mdb_cursor_get(
  18696. * icur, &key_v, &data_v, lmdb.MDB_NEXT_MULTIPLE))
  18697. */
  18698. __Pyx_XGIVEREF(__pyx_t_9);
  18699. __Pyx_XGIVEREF(__pyx_t_10);
  18700. __Pyx_XGIVEREF(__pyx_t_11);
  18701. __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
  18702. goto __pyx_L13_error;
  18703. __pyx_L50_except_return:;
  18704. __Pyx_XGIVEREF(__pyx_t_9);
  18705. __Pyx_XGIVEREF(__pyx_t_10);
  18706. __Pyx_XGIVEREF(__pyx_t_11);
  18707. __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
  18708. goto __pyx_L12_return;
  18709. __pyx_L54_try_end:;
  18710. }
  18711. }
  18712. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1298
  18713. *
  18714. * # ? ? ? c
  18715. * elif not any(triple_pattern): # <<<<<<<<<<<<<<
  18716. * # Get all triples from the context
  18717. * #logger.debug('Lookup: ? ? ? c')
  18718. */
  18719. goto __pyx_L15;
  18720. }
  18721. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1332
  18722. * # Regular lookup. Filter _lookup() results by context.
  18723. * else:
  18724. * try: # <<<<<<<<<<<<<<
  18725. * res = self._lookup(triple_pattern)
  18726. * except KeyNotFoundError:
  18727. */
  18728. /*else*/ {
  18729. {
  18730. __Pyx_PyThreadState_declare
  18731. __Pyx_PyThreadState_assign
  18732. __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
  18733. __Pyx_XGOTREF(__pyx_t_11);
  18734. __Pyx_XGOTREF(__pyx_t_10);
  18735. __Pyx_XGOTREF(__pyx_t_9);
  18736. /*try:*/ {
  18737. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1333
  18738. * else:
  18739. * try:
  18740. * res = self._lookup(triple_pattern) # <<<<<<<<<<<<<<
  18741. * except KeyNotFoundError:
  18742. * return ResultSet(0, TRP_KLEN)
  18743. */
  18744. __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->_lookup(__pyx_v_self, __pyx_v_triple_pattern)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1333, __pyx_L57_error)
  18745. __Pyx_GOTREF(__pyx_t_1);
  18746. __pyx_v_res = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_1);
  18747. __pyx_t_1 = 0;
  18748. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1332
  18749. * # Regular lookup. Filter _lookup() results by context.
  18750. * else:
  18751. * try: # <<<<<<<<<<<<<<
  18752. * res = self._lookup(triple_pattern)
  18753. * except KeyNotFoundError:
  18754. */
  18755. }
  18756. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  18757. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  18758. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  18759. goto __pyx_L62_try_end;
  18760. __pyx_L57_error:;
  18761. __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
  18762. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  18763. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  18764. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  18765. __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
  18766. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  18767. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  18768. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1334
  18769. * try:
  18770. * res = self._lookup(triple_pattern)
  18771. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  18772. * return ResultSet(0, TRP_KLEN)
  18773. *
  18774. */
  18775. __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_2, &__pyx_t_18);
  18776. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1334, __pyx_L59_except_error)
  18777. __Pyx_GOTREF(__pyx_t_4);
  18778. __pyx_t_5 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_4);
  18779. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  18780. __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_18);
  18781. __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_18 = 0;
  18782. if (__pyx_t_5) {
  18783. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.triple_keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  18784. if (__Pyx_GetException(&__pyx_t_18, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 1334, __pyx_L59_except_error)
  18785. __Pyx_GOTREF(__pyx_t_18);
  18786. __Pyx_GOTREF(__pyx_t_2);
  18787. __Pyx_GOTREF(__pyx_t_1);
  18788. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1335
  18789. * res = self._lookup(triple_pattern)
  18790. * except KeyNotFoundError:
  18791. * return ResultSet(0, TRP_KLEN) # <<<<<<<<<<<<<<
  18792. *
  18793. * #logger.debug('Allocating for context filtering.')
  18794. */
  18795. __Pyx_XDECREF(((PyObject *)__pyx_r));
  18796. __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet), __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1335, __pyx_L59_except_error)
  18797. __Pyx_GOTREF(__pyx_t_4);
  18798. __pyx_r = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_4);
  18799. __pyx_t_4 = 0;
  18800. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18801. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  18802. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  18803. goto __pyx_L60_except_return;
  18804. }
  18805. goto __pyx_L59_except_error;
  18806. __pyx_L59_except_error:;
  18807. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1332
  18808. * # Regular lookup. Filter _lookup() results by context.
  18809. * else:
  18810. * try: # <<<<<<<<<<<<<<
  18811. * res = self._lookup(triple_pattern)
  18812. * except KeyNotFoundError:
  18813. */
  18814. __Pyx_XGIVEREF(__pyx_t_11);
  18815. __Pyx_XGIVEREF(__pyx_t_10);
  18816. __Pyx_XGIVEREF(__pyx_t_9);
  18817. __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
  18818. goto __pyx_L13_error;
  18819. __pyx_L60_except_return:;
  18820. __Pyx_XGIVEREF(__pyx_t_11);
  18821. __Pyx_XGIVEREF(__pyx_t_10);
  18822. __Pyx_XGIVEREF(__pyx_t_9);
  18823. __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
  18824. goto __pyx_L12_return;
  18825. __pyx_L62_try_end:;
  18826. }
  18827. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1338
  18828. *
  18829. * #logger.debug('Allocating for context filtering.')
  18830. * key_v.mv_data = ck # <<<<<<<<<<<<<<
  18831. * key_v.mv_size = KLEN
  18832. * data_v.mv_size = TRP_KLEN
  18833. */
  18834. __pyx_v_key_v.mv_data = __pyx_v_ck;
  18835. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1339
  18836. * #logger.debug('Allocating for context filtering.')
  18837. * key_v.mv_data = ck
  18838. * key_v.mv_size = KLEN # <<<<<<<<<<<<<<
  18839. * data_v.mv_size = TRP_KLEN
  18840. *
  18841. */
  18842. __pyx_v_key_v.mv_size = 5;
  18843. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1340
  18844. * key_v.mv_data = ck
  18845. * key_v.mv_size = KLEN
  18846. * data_v.mv_size = TRP_KLEN # <<<<<<<<<<<<<<
  18847. *
  18848. * flt_res = ResultSet(res.ct, res.itemsize)
  18849. */
  18850. __pyx_v_data_v.mv_size = 15;
  18851. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1342
  18852. * data_v.mv_size = TRP_KLEN
  18853. *
  18854. * flt_res = ResultSet(res.ct, res.itemsize) # <<<<<<<<<<<<<<
  18855. * while j < res.ct:
  18856. * #logger.debug('Checking row #{}'.format(flt_j))
  18857. */
  18858. __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_res->ct); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1342, __pyx_L13_error)
  18859. __Pyx_GOTREF(__pyx_t_1);
  18860. __pyx_t_2 = __Pyx_PyInt_From_unsigned_char(__pyx_v_res->itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1342, __pyx_L13_error)
  18861. __Pyx_GOTREF(__pyx_t_2);
  18862. __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1342, __pyx_L13_error)
  18863. __Pyx_GOTREF(__pyx_t_18);
  18864. __Pyx_GIVEREF(__pyx_t_1);
  18865. PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_1);
  18866. __Pyx_GIVEREF(__pyx_t_2);
  18867. PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_2);
  18868. __pyx_t_1 = 0;
  18869. __pyx_t_2 = 0;
  18870. __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet), __pyx_t_18, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1342, __pyx_L13_error)
  18871. __Pyx_GOTREF(__pyx_t_2);
  18872. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  18873. __pyx_v_flt_res = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_2);
  18874. __pyx_t_2 = 0;
  18875. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1343
  18876. *
  18877. * flt_res = ResultSet(res.ct, res.itemsize)
  18878. * while j < res.ct: # <<<<<<<<<<<<<<
  18879. * #logger.debug('Checking row #{}'.format(flt_j))
  18880. * data_v.mv_data = res.data + j * res.itemsize
  18881. */
  18882. while (1) {
  18883. __pyx_t_7 = ((__pyx_v_j < __pyx_v_res->ct) != 0);
  18884. if (!__pyx_t_7) break;
  18885. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1345
  18886. * while j < res.ct:
  18887. * #logger.debug('Checking row #{}'.format(flt_j))
  18888. * data_v.mv_data = res.data + j * res.itemsize # <<<<<<<<<<<<<<
  18889. * #logger.debug('Checking c:spo {}, {}'.format(
  18890. * # (<unsigned char *>key_v.mv_data)[: key_v.mv_size],
  18891. */
  18892. __pyx_v_data_v.mv_data = (__pyx_v_res->data + (__pyx_v_j * __pyx_v_res->itemsize));
  18893. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1349
  18894. * # (<unsigned char *>key_v.mv_data)[: key_v.mv_size],
  18895. * # (<unsigned char *>data_v.mv_data)[: data_v.mv_size]))
  18896. * try: # <<<<<<<<<<<<<<
  18897. * # Verify that the triple is associated with the
  18898. * # context being searched.
  18899. */
  18900. /*try:*/ {
  18901. {
  18902. __Pyx_PyThreadState_declare
  18903. __Pyx_PyThreadState_assign
  18904. __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
  18905. __Pyx_XGOTREF(__pyx_t_9);
  18906. __Pyx_XGOTREF(__pyx_t_10);
  18907. __Pyx_XGOTREF(__pyx_t_11);
  18908. /*try:*/ {
  18909. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1352
  18910. * # Verify that the triple is associated with the
  18911. * # context being searched.
  18912. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  18913. * icur, &key_v, &data_v, lmdb.MDB_GET_BOTH))
  18914. * except KeyNotFoundError:
  18915. */
  18916. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_icur, (&__pyx_v_key_v), (&__pyx_v_data_v), MDB_GET_BOTH), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1352, __pyx_L72_error)
  18917. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1349
  18918. * # (<unsigned char *>key_v.mv_data)[: key_v.mv_size],
  18919. * # (<unsigned char *>data_v.mv_data)[: data_v.mv_size]))
  18920. * try: # <<<<<<<<<<<<<<
  18921. * # Verify that the triple is associated with the
  18922. * # context being searched.
  18923. */
  18924. }
  18925. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1360
  18926. * #logger.debug('Copying source[{}] to dest[{}].'.format(
  18927. * # j, flt_j))
  18928. * memcpy( # <<<<<<<<<<<<<<
  18929. * flt_res.data + res.itemsize * flt_j,
  18930. * res.data + res.itemsize * j, res.itemsize)
  18931. */
  18932. /*else:*/ {
  18933. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1362
  18934. * memcpy(
  18935. * flt_res.data + res.itemsize * flt_j,
  18936. * res.data + res.itemsize * j, res.itemsize) # <<<<<<<<<<<<<<
  18937. *
  18938. * flt_j += 1
  18939. */
  18940. (void)(memcpy((__pyx_v_flt_res->data + (__pyx_v_res->itemsize * __pyx_v_flt_j)), (__pyx_v_res->data + (__pyx_v_res->itemsize * __pyx_v_j)), __pyx_v_res->itemsize));
  18941. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1364
  18942. * res.data + res.itemsize * j, res.itemsize)
  18943. *
  18944. * flt_j += 1 # <<<<<<<<<<<<<<
  18945. * finally:
  18946. * j += 1
  18947. */
  18948. __pyx_v_flt_j = (__pyx_v_flt_j + 1);
  18949. }
  18950. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  18951. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  18952. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  18953. goto __pyx_L79_try_end;
  18954. __pyx_L72_error:;
  18955. __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
  18956. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  18957. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  18958. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  18959. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  18960. __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
  18961. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  18962. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1354
  18963. * _check(lmdb.mdb_cursor_get(
  18964. * icur, &key_v, &data_v, lmdb.MDB_GET_BOTH))
  18965. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  18966. * #logger.debug('Discarding source[{}].'.format(j))
  18967. * continue
  18968. */
  18969. __Pyx_ErrFetch(&__pyx_t_2, &__pyx_t_18, &__pyx_t_1);
  18970. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1354, __pyx_L74_except_error)
  18971. __Pyx_GOTREF(__pyx_t_4);
  18972. __pyx_t_5 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_2, __pyx_t_4);
  18973. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  18974. __Pyx_ErrRestore(__pyx_t_2, __pyx_t_18, __pyx_t_1);
  18975. __pyx_t_2 = 0; __pyx_t_18 = 0; __pyx_t_1 = 0;
  18976. if (__pyx_t_5) {
  18977. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.triple_keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  18978. if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_18, &__pyx_t_2) < 0) __PYX_ERR(0, 1354, __pyx_L74_except_error)
  18979. __Pyx_GOTREF(__pyx_t_1);
  18980. __Pyx_GOTREF(__pyx_t_18);
  18981. __Pyx_GOTREF(__pyx_t_2);
  18982. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1356
  18983. * except KeyNotFoundError:
  18984. * #logger.debug('Discarding source[{}].'.format(j))
  18985. * continue # <<<<<<<<<<<<<<
  18986. * else:
  18987. * #logger.debug('Copying source[{}] to dest[{}].'.format(
  18988. */
  18989. goto __pyx_L81_except_continue;
  18990. __pyx_L81_except_continue:;
  18991. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18992. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  18993. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  18994. goto __pyx_L78_try_continue;
  18995. }
  18996. goto __pyx_L74_except_error;
  18997. __pyx_L74_except_error:;
  18998. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1349
  18999. * # (<unsigned char *>key_v.mv_data)[: key_v.mv_size],
  19000. * # (<unsigned char *>data_v.mv_data)[: data_v.mv_size]))
  19001. * try: # <<<<<<<<<<<<<<
  19002. * # Verify that the triple is associated with the
  19003. * # context being searched.
  19004. */
  19005. __Pyx_XGIVEREF(__pyx_t_9);
  19006. __Pyx_XGIVEREF(__pyx_t_10);
  19007. __Pyx_XGIVEREF(__pyx_t_11);
  19008. __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
  19009. goto __pyx_L70_error;
  19010. __pyx_L78_try_continue:;
  19011. __Pyx_XGIVEREF(__pyx_t_9);
  19012. __Pyx_XGIVEREF(__pyx_t_10);
  19013. __Pyx_XGIVEREF(__pyx_t_11);
  19014. __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
  19015. goto __pyx_L67_continue;
  19016. __pyx_L79_try_end:;
  19017. }
  19018. }
  19019. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1366
  19020. * flt_j += 1
  19021. * finally:
  19022. * j += 1 # <<<<<<<<<<<<<<
  19023. *
  19024. * # Resize result set to the size of context matches.
  19025. */
  19026. /*finally:*/ {
  19027. /*normal exit:*/{
  19028. __pyx_v_j = (__pyx_v_j + 1);
  19029. goto __pyx_L71;
  19030. }
  19031. __pyx_L70_error:;
  19032. /*exception exit:*/{
  19033. __Pyx_PyThreadState_declare
  19034. __Pyx_PyThreadState_assign
  19035. __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
  19036. __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
  19037. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  19038. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  19039. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  19040. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  19041. __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
  19042. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  19043. if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
  19044. if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
  19045. __Pyx_XGOTREF(__pyx_t_11);
  19046. __Pyx_XGOTREF(__pyx_t_10);
  19047. __Pyx_XGOTREF(__pyx_t_9);
  19048. __Pyx_XGOTREF(__pyx_t_21);
  19049. __Pyx_XGOTREF(__pyx_t_22);
  19050. __Pyx_XGOTREF(__pyx_t_23);
  19051. __pyx_t_5 = __pyx_lineno; __pyx_t_19 = __pyx_clineno; __pyx_t_20 = __pyx_filename;
  19052. {
  19053. __pyx_v_j = (__pyx_v_j + 1);
  19054. }
  19055. if (PY_MAJOR_VERSION >= 3) {
  19056. __Pyx_XGIVEREF(__pyx_t_21);
  19057. __Pyx_XGIVEREF(__pyx_t_22);
  19058. __Pyx_XGIVEREF(__pyx_t_23);
  19059. __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23);
  19060. }
  19061. __Pyx_XGIVEREF(__pyx_t_11);
  19062. __Pyx_XGIVEREF(__pyx_t_10);
  19063. __Pyx_XGIVEREF(__pyx_t_9);
  19064. __Pyx_ErrRestore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
  19065. __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
  19066. __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_19; __pyx_filename = __pyx_t_20;
  19067. goto __pyx_L13_error;
  19068. }
  19069. __pyx_L67_continue: {
  19070. __pyx_v_j = (__pyx_v_j + 1);
  19071. goto __pyx_L65_continue;
  19072. }
  19073. __pyx_L71:;
  19074. }
  19075. __pyx_L65_continue:;
  19076. }
  19077. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1370
  19078. * # Resize result set to the size of context matches.
  19079. * # This crops the memory block without copying it.
  19080. * flt_res.resize(flt_j) # <<<<<<<<<<<<<<
  19081. * return flt_res
  19082. * finally:
  19083. */
  19084. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_v_flt_res->__pyx_vtab)->resize(__pyx_v_flt_res, __pyx_v_flt_j); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1370, __pyx_L13_error)
  19085. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1371
  19086. * # This crops the memory block without copying it.
  19087. * flt_res.resize(flt_j)
  19088. * return flt_res # <<<<<<<<<<<<<<
  19089. * finally:
  19090. * self._cur_close(icur)
  19091. */
  19092. __Pyx_XDECREF(((PyObject *)__pyx_r));
  19093. __Pyx_INCREF(((PyObject *)__pyx_v_flt_res));
  19094. __pyx_r = __pyx_v_flt_res;
  19095. goto __pyx_L12_return;
  19096. }
  19097. __pyx_L15:;
  19098. }
  19099. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1373
  19100. * return flt_res
  19101. * finally:
  19102. * self._cur_close(icur) # <<<<<<<<<<<<<<
  19103. *
  19104. * # Unfiltered lookup. No context checked.
  19105. */
  19106. /*finally:*/ {
  19107. /*normal exit:*/{
  19108. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_icur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1373, __pyx_L1_error)
  19109. goto __pyx_L14;
  19110. }
  19111. __pyx_L13_error:;
  19112. /*exception exit:*/{
  19113. __Pyx_PyThreadState_declare
  19114. __Pyx_PyThreadState_assign
  19115. __pyx_t_23 = 0; __pyx_t_22 = 0; __pyx_t_21 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
  19116. __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
  19117. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  19118. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  19119. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  19120. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  19121. __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
  19122. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  19123. if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
  19124. if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21) < 0)) __Pyx_ErrFetch(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21);
  19125. __Pyx_XGOTREF(__pyx_t_23);
  19126. __Pyx_XGOTREF(__pyx_t_22);
  19127. __Pyx_XGOTREF(__pyx_t_21);
  19128. __Pyx_XGOTREF(__pyx_t_9);
  19129. __Pyx_XGOTREF(__pyx_t_10);
  19130. __Pyx_XGOTREF(__pyx_t_11);
  19131. __pyx_t_19 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_24 = __pyx_filename;
  19132. {
  19133. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_icur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1373, __pyx_L87_error)
  19134. }
  19135. if (PY_MAJOR_VERSION >= 3) {
  19136. __Pyx_XGIVEREF(__pyx_t_9);
  19137. __Pyx_XGIVEREF(__pyx_t_10);
  19138. __Pyx_XGIVEREF(__pyx_t_11);
  19139. __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
  19140. }
  19141. __Pyx_XGIVEREF(__pyx_t_23);
  19142. __Pyx_XGIVEREF(__pyx_t_22);
  19143. __Pyx_XGIVEREF(__pyx_t_21);
  19144. __Pyx_ErrRestore(__pyx_t_23, __pyx_t_22, __pyx_t_21);
  19145. __pyx_t_23 = 0; __pyx_t_22 = 0; __pyx_t_21 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
  19146. __pyx_lineno = __pyx_t_19; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_24;
  19147. goto __pyx_L1_error;
  19148. __pyx_L87_error:;
  19149. if (PY_MAJOR_VERSION >= 3) {
  19150. __Pyx_XGIVEREF(__pyx_t_9);
  19151. __Pyx_XGIVEREF(__pyx_t_10);
  19152. __Pyx_XGIVEREF(__pyx_t_11);
  19153. __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
  19154. }
  19155. __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
  19156. __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
  19157. __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
  19158. __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
  19159. goto __pyx_L1_error;
  19160. }
  19161. __pyx_L12_return: {
  19162. __pyx_t_25 = __pyx_r;
  19163. __pyx_r = 0;
  19164. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_icur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1373, __pyx_L1_error)
  19165. __pyx_r = __pyx_t_25;
  19166. __pyx_t_25 = 0;
  19167. goto __pyx_L0;
  19168. }
  19169. __pyx_L14:;
  19170. }
  19171. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1252
  19172. * ResultSet flt_res, ret
  19173. *
  19174. * if context is not None: # <<<<<<<<<<<<<<
  19175. * #serialize(context, &pk_c, &c_size)
  19176. * try:
  19177. */
  19178. goto __pyx_L3;
  19179. }
  19180. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1378
  19181. * else:
  19182. * #logger.debug('No context in query.')
  19183. * try: # <<<<<<<<<<<<<<
  19184. * res = self._lookup(triple_pattern)
  19185. * except KeyNotFoundError:
  19186. */
  19187. /*else*/ {
  19188. {
  19189. __Pyx_PyThreadState_declare
  19190. __Pyx_PyThreadState_assign
  19191. __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
  19192. __Pyx_XGOTREF(__pyx_t_11);
  19193. __Pyx_XGOTREF(__pyx_t_10);
  19194. __Pyx_XGOTREF(__pyx_t_9);
  19195. /*try:*/ {
  19196. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1379
  19197. * #logger.debug('No context in query.')
  19198. * try:
  19199. * res = self._lookup(triple_pattern) # <<<<<<<<<<<<<<
  19200. * except KeyNotFoundError:
  19201. * return ResultSet(0, TRP_KLEN)
  19202. */
  19203. __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->_lookup(__pyx_v_self, __pyx_v_triple_pattern)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1379, __pyx_L88_error)
  19204. __Pyx_GOTREF(__pyx_t_2);
  19205. __pyx_v_res = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_2);
  19206. __pyx_t_2 = 0;
  19207. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1378
  19208. * else:
  19209. * #logger.debug('No context in query.')
  19210. * try: # <<<<<<<<<<<<<<
  19211. * res = self._lookup(triple_pattern)
  19212. * except KeyNotFoundError:
  19213. */
  19214. }
  19215. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  19216. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  19217. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  19218. goto __pyx_L93_try_end;
  19219. __pyx_L88_error:;
  19220. __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
  19221. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  19222. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  19223. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  19224. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  19225. __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
  19226. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  19227. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1380
  19228. * try:
  19229. * res = self._lookup(triple_pattern)
  19230. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  19231. * return ResultSet(0, TRP_KLEN)
  19232. * #logger.debug('Res data before triple_keys return: {}'.format(
  19233. */
  19234. __Pyx_ErrFetch(&__pyx_t_2, &__pyx_t_18, &__pyx_t_1);
  19235. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1380, __pyx_L90_except_error)
  19236. __Pyx_GOTREF(__pyx_t_4);
  19237. __pyx_t_5 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_2, __pyx_t_4);
  19238. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  19239. __Pyx_ErrRestore(__pyx_t_2, __pyx_t_18, __pyx_t_1);
  19240. __pyx_t_2 = 0; __pyx_t_18 = 0; __pyx_t_1 = 0;
  19241. if (__pyx_t_5) {
  19242. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.triple_keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  19243. if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_18, &__pyx_t_2) < 0) __PYX_ERR(0, 1380, __pyx_L90_except_error)
  19244. __Pyx_GOTREF(__pyx_t_1);
  19245. __Pyx_GOTREF(__pyx_t_18);
  19246. __Pyx_GOTREF(__pyx_t_2);
  19247. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1381
  19248. * res = self._lookup(triple_pattern)
  19249. * except KeyNotFoundError:
  19250. * return ResultSet(0, TRP_KLEN) # <<<<<<<<<<<<<<
  19251. * #logger.debug('Res data before triple_keys return: {}'.format(
  19252. * # res.data[: res.size]))
  19253. */
  19254. __Pyx_XDECREF(((PyObject *)__pyx_r));
  19255. __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet), __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1381, __pyx_L90_except_error)
  19256. __Pyx_GOTREF(__pyx_t_4);
  19257. __pyx_r = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_4);
  19258. __pyx_t_4 = 0;
  19259. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19260. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  19261. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  19262. goto __pyx_L91_except_return;
  19263. }
  19264. goto __pyx_L90_except_error;
  19265. __pyx_L90_except_error:;
  19266. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1378
  19267. * else:
  19268. * #logger.debug('No context in query.')
  19269. * try: # <<<<<<<<<<<<<<
  19270. * res = self._lookup(triple_pattern)
  19271. * except KeyNotFoundError:
  19272. */
  19273. __Pyx_XGIVEREF(__pyx_t_11);
  19274. __Pyx_XGIVEREF(__pyx_t_10);
  19275. __Pyx_XGIVEREF(__pyx_t_9);
  19276. __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
  19277. goto __pyx_L1_error;
  19278. __pyx_L91_except_return:;
  19279. __Pyx_XGIVEREF(__pyx_t_11);
  19280. __Pyx_XGIVEREF(__pyx_t_10);
  19281. __Pyx_XGIVEREF(__pyx_t_9);
  19282. __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
  19283. goto __pyx_L0;
  19284. __pyx_L93_try_end:;
  19285. }
  19286. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1384
  19287. * #logger.debug('Res data before triple_keys return: {}'.format(
  19288. * # res.data[: res.size]))
  19289. * return res # <<<<<<<<<<<<<<
  19290. *
  19291. *
  19292. */
  19293. __Pyx_XDECREF(((PyObject *)__pyx_r));
  19294. __Pyx_INCREF(((PyObject *)__pyx_v_res));
  19295. __pyx_r = __pyx_v_res;
  19296. goto __pyx_L0;
  19297. }
  19298. __pyx_L3:;
  19299. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1229
  19300. *
  19301. *
  19302. * cpdef ResultSet triple_keys(self, tuple triple_pattern, context=None): # <<<<<<<<<<<<<<
  19303. * """
  19304. * Top-level lookup method.
  19305. */
  19306. /* function exit code */
  19307. __pyx_r = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)Py_None); __Pyx_INCREF(Py_None);
  19308. goto __pyx_L0;
  19309. __pyx_L1_error:;
  19310. __Pyx_XDECREF(__pyx_t_1);
  19311. __Pyx_XDECREF(__pyx_t_2);
  19312. __Pyx_XDECREF(__pyx_t_3);
  19313. __Pyx_XDECREF(__pyx_t_4);
  19314. __Pyx_XDECREF(__pyx_t_6);
  19315. __Pyx_XDECREF(__pyx_t_17);
  19316. __Pyx_XDECREF(__pyx_t_18);
  19317. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.triple_keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  19318. __pyx_r = 0;
  19319. __pyx_L0:;
  19320. __Pyx_XDECREF((PyObject *)__pyx_v_flt_res);
  19321. __Pyx_XDECREF((PyObject *)__pyx_v_ret);
  19322. __Pyx_XDECREF(__pyx_v_term);
  19323. __Pyx_XDECREF((PyObject *)__pyx_v_res);
  19324. __Pyx_XGIVEREF((PyObject *)__pyx_r);
  19325. __Pyx_TraceReturn(__pyx_r, 0);
  19326. __Pyx_RefNannyFinishContext();
  19327. return __pyx_r;
  19328. }
  19329. /* Python wrapper */
  19330. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_21triple_keys(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  19331. static char __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_20triple_keys[] = "\n Top-level lookup method.\n\n This method is used by `triples` which returns native Python tuples,\n as well as by other methods that need to iterate and filter triple\n keys without incurring in the overhead of converting them to triples.\n\n :param tuple triple_pattern: 3 RDFLib terms\n :param context: Context graph or URI, or None.\n :type context: rdflib.term.Identifier or None\n ";
  19332. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_21triple_keys(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  19333. PyObject *__pyx_v_triple_pattern = 0;
  19334. PyObject *__pyx_v_context = 0;
  19335. PyObject *__pyx_r = 0;
  19336. __Pyx_RefNannyDeclarations
  19337. __Pyx_RefNannySetupContext("triple_keys (wrapper)", 0);
  19338. {
  19339. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_triple_pattern,&__pyx_n_s_context,0};
  19340. PyObject* values[2] = {0,0};
  19341. values[1] = ((PyObject *)Py_None);
  19342. if (unlikely(__pyx_kwds)) {
  19343. Py_ssize_t kw_args;
  19344. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  19345. switch (pos_args) {
  19346. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  19347. CYTHON_FALLTHROUGH;
  19348. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  19349. CYTHON_FALLTHROUGH;
  19350. case 0: break;
  19351. default: goto __pyx_L5_argtuple_error;
  19352. }
  19353. kw_args = PyDict_Size(__pyx_kwds);
  19354. switch (pos_args) {
  19355. case 0:
  19356. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_triple_pattern)) != 0)) kw_args--;
  19357. else goto __pyx_L5_argtuple_error;
  19358. CYTHON_FALLTHROUGH;
  19359. case 1:
  19360. if (kw_args > 0) {
  19361. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_context);
  19362. if (value) { values[1] = value; kw_args--; }
  19363. }
  19364. }
  19365. if (unlikely(kw_args > 0)) {
  19366. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "triple_keys") < 0)) __PYX_ERR(0, 1229, __pyx_L3_error)
  19367. }
  19368. } else {
  19369. switch (PyTuple_GET_SIZE(__pyx_args)) {
  19370. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  19371. CYTHON_FALLTHROUGH;
  19372. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  19373. break;
  19374. default: goto __pyx_L5_argtuple_error;
  19375. }
  19376. }
  19377. __pyx_v_triple_pattern = ((PyObject*)values[0]);
  19378. __pyx_v_context = values[1];
  19379. }
  19380. goto __pyx_L4_argument_unpacking_done;
  19381. __pyx_L5_argtuple_error:;
  19382. __Pyx_RaiseArgtupleInvalid("triple_keys", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1229, __pyx_L3_error)
  19383. __pyx_L3_error:;
  19384. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.triple_keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  19385. __Pyx_RefNannyFinishContext();
  19386. return NULL;
  19387. __pyx_L4_argument_unpacking_done:;
  19388. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_triple_pattern), (&PyTuple_Type), 1, "triple_pattern", 1))) __PYX_ERR(0, 1229, __pyx_L1_error)
  19389. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_20triple_keys(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self), __pyx_v_triple_pattern, __pyx_v_context);
  19390. /* function exit code */
  19391. goto __pyx_L0;
  19392. __pyx_L1_error:;
  19393. __pyx_r = NULL;
  19394. __pyx_L0:;
  19395. __Pyx_RefNannyFinishContext();
  19396. return __pyx_r;
  19397. }
  19398. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_20triple_keys(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_triple_pattern, PyObject *__pyx_v_context) {
  19399. PyObject *__pyx_r = NULL;
  19400. __Pyx_TraceDeclarations
  19401. __Pyx_RefNannyDeclarations
  19402. PyObject *__pyx_t_1 = NULL;
  19403. struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_triple_keys __pyx_t_2;
  19404. __Pyx_RefNannySetupContext("triple_keys", 0);
  19405. __Pyx_TraceCall("triple_keys (wrapper)", __pyx_f[0], 1229, 0, __PYX_ERR(0, 1229, __pyx_L1_error));
  19406. __Pyx_XDECREF(__pyx_r);
  19407. __pyx_t_2.__pyx_n = 1;
  19408. __pyx_t_2.context = __pyx_v_context;
  19409. __pyx_t_1 = ((PyObject *)__pyx_vtabptr_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore->triple_keys(__pyx_v_self, __pyx_v_triple_pattern, 1, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1229, __pyx_L1_error)
  19410. __Pyx_GOTREF(__pyx_t_1);
  19411. __pyx_r = __pyx_t_1;
  19412. __pyx_t_1 = 0;
  19413. goto __pyx_L0;
  19414. /* function exit code */
  19415. __pyx_L1_error:;
  19416. __Pyx_XDECREF(__pyx_t_1);
  19417. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.triple_keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  19418. __pyx_r = NULL;
  19419. __pyx_L0:;
  19420. __Pyx_XGIVEREF(__pyx_r);
  19421. __Pyx_TraceReturn(__pyx_r, 0);
  19422. __Pyx_RefNannyFinishContext();
  19423. return __pyx_r;
  19424. }
  19425. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1387
  19426. *
  19427. *
  19428. * cdef ResultSet _lookup(self, tuple triple_pattern): # <<<<<<<<<<<<<<
  19429. * """
  19430. * Look up triples in the indices based on a triple pattern.
  19431. */
  19432. static struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__lookup(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_triple_pattern) {
  19433. __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_TripleKey __pyx_v_spok;
  19434. struct MDB_stat __pyx_v_db_stat;
  19435. size_t __pyx_v_ct;
  19436. size_t __pyx_v_i;
  19437. struct MDB_val __pyx_v_spok_v;
  19438. struct MDB_val __pyx_v_ck_v;
  19439. PyObject *__pyx_v_s = NULL;
  19440. PyObject *__pyx_v_p = NULL;
  19441. PyObject *__pyx_v_o = NULL;
  19442. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_matches = NULL;
  19443. MDB_cursor *__pyx_v_dcur;
  19444. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_ret = NULL;
  19445. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_r = NULL;
  19446. __Pyx_TraceDeclarations
  19447. __Pyx_RefNannyDeclarations
  19448. PyObject *__pyx_t_1 = NULL;
  19449. PyObject *__pyx_t_2 = NULL;
  19450. PyObject *__pyx_t_3 = NULL;
  19451. int __pyx_t_4;
  19452. int __pyx_t_5;
  19453. PyObject *__pyx_t_6 = NULL;
  19454. PyObject *__pyx_t_7 = NULL;
  19455. PyObject *__pyx_t_8 = NULL;
  19456. MDB_dbi __pyx_t_9;
  19457. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore_get_dbi __pyx_t_10;
  19458. PyObject *__pyx_t_11 = NULL;
  19459. int __pyx_t_12;
  19460. MDB_cursor *__pyx_t_13;
  19461. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__cur_open __pyx_t_14;
  19462. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store__check __pyx_t_15;
  19463. size_t __pyx_t_16;
  19464. PyObject *__pyx_t_17 = NULL;
  19465. int __pyx_t_18;
  19466. char const *__pyx_t_19;
  19467. PyObject *__pyx_t_20 = NULL;
  19468. PyObject *__pyx_t_21 = NULL;
  19469. PyObject *__pyx_t_22 = NULL;
  19470. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_t_23 = NULL;
  19471. __Pyx_RefNannySetupContext("_lookup", 0);
  19472. __Pyx_TraceCall("_lookup", __pyx_f[0], 1387, 0, __PYX_ERR(0, 1387, __pyx_L1_error));
  19473. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1397
  19474. * TripleKey spok
  19475. * lmdb.MDB_stat db_stat
  19476. * size_t ct = 0, i = 0 # <<<<<<<<<<<<<<
  19477. * lmdb.MDB_val spok_v, ck_v
  19478. *
  19479. */
  19480. __pyx_v_ct = 0;
  19481. __pyx_v_i = 0;
  19482. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1400
  19483. * lmdb.MDB_val spok_v, ck_v
  19484. *
  19485. * s, p, o = triple_pattern # <<<<<<<<<<<<<<
  19486. *
  19487. * if s is not None:
  19488. */
  19489. if (likely(__pyx_v_triple_pattern != Py_None)) {
  19490. PyObject* sequence = __pyx_v_triple_pattern;
  19491. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  19492. if (unlikely(size != 3)) {
  19493. if (size > 3) __Pyx_RaiseTooManyValuesError(3);
  19494. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  19495. __PYX_ERR(0, 1400, __pyx_L1_error)
  19496. }
  19497. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  19498. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  19499. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  19500. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2);
  19501. __Pyx_INCREF(__pyx_t_1);
  19502. __Pyx_INCREF(__pyx_t_2);
  19503. __Pyx_INCREF(__pyx_t_3);
  19504. #else
  19505. __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1400, __pyx_L1_error)
  19506. __Pyx_GOTREF(__pyx_t_1);
  19507. __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1400, __pyx_L1_error)
  19508. __Pyx_GOTREF(__pyx_t_2);
  19509. __pyx_t_3 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1400, __pyx_L1_error)
  19510. __Pyx_GOTREF(__pyx_t_3);
  19511. #endif
  19512. } else {
  19513. __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1400, __pyx_L1_error)
  19514. }
  19515. __pyx_v_s = __pyx_t_1;
  19516. __pyx_t_1 = 0;
  19517. __pyx_v_p = __pyx_t_2;
  19518. __pyx_t_2 = 0;
  19519. __pyx_v_o = __pyx_t_3;
  19520. __pyx_t_3 = 0;
  19521. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1402
  19522. * s, p, o = triple_pattern
  19523. *
  19524. * if s is not None: # <<<<<<<<<<<<<<
  19525. * if p is not None:
  19526. * # s p o
  19527. */
  19528. __pyx_t_4 = (__pyx_v_s != Py_None);
  19529. __pyx_t_5 = (__pyx_t_4 != 0);
  19530. if (__pyx_t_5) {
  19531. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1403
  19532. *
  19533. * if s is not None:
  19534. * if p is not None: # <<<<<<<<<<<<<<
  19535. * # s p o
  19536. * if o is not None:
  19537. */
  19538. __pyx_t_5 = (__pyx_v_p != Py_None);
  19539. __pyx_t_4 = (__pyx_t_5 != 0);
  19540. if (__pyx_t_4) {
  19541. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1405
  19542. * if p is not None:
  19543. * # s p o
  19544. * if o is not None: # <<<<<<<<<<<<<<
  19545. * spok_v.mv_data = spok
  19546. * spok_v.mv_size = TRP_KLEN
  19547. */
  19548. __pyx_t_4 = (__pyx_v_o != Py_None);
  19549. __pyx_t_5 = (__pyx_t_4 != 0);
  19550. if (__pyx_t_5) {
  19551. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1406
  19552. * # s p o
  19553. * if o is not None:
  19554. * spok_v.mv_data = spok # <<<<<<<<<<<<<<
  19555. * spok_v.mv_size = TRP_KLEN
  19556. * try:
  19557. */
  19558. __pyx_v_spok_v.mv_data = __pyx_v_spok;
  19559. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1407
  19560. * if o is not None:
  19561. * spok_v.mv_data = spok
  19562. * spok_v.mv_size = TRP_KLEN # <<<<<<<<<<<<<<
  19563. * try:
  19564. * self._to_triple_key(triple_pattern, &spok)
  19565. */
  19566. __pyx_v_spok_v.mv_size = 15;
  19567. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1408
  19568. * spok_v.mv_data = spok
  19569. * spok_v.mv_size = TRP_KLEN
  19570. * try: # <<<<<<<<<<<<<<
  19571. * self._to_triple_key(triple_pattern, &spok)
  19572. * _check(lmdb.mdb_get(
  19573. */
  19574. {
  19575. __Pyx_PyThreadState_declare
  19576. __Pyx_PyThreadState_assign
  19577. __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
  19578. __Pyx_XGOTREF(__pyx_t_6);
  19579. __Pyx_XGOTREF(__pyx_t_7);
  19580. __Pyx_XGOTREF(__pyx_t_8);
  19581. /*try:*/ {
  19582. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1409
  19583. * spok_v.mv_size = TRP_KLEN
  19584. * try:
  19585. * self._to_triple_key(triple_pattern, &spok) # <<<<<<<<<<<<<<
  19586. * _check(lmdb.mdb_get(
  19587. * self.txn, self.get_dbi('spo:c'), &spok_v, &ck_v))
  19588. */
  19589. __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__to_triple_key(__pyx_v_self, __pyx_v_triple_pattern, (&__pyx_v_spok)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1409, __pyx_L6_error)
  19590. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1411
  19591. * self._to_triple_key(triple_pattern, &spok)
  19592. * _check(lmdb.mdb_get(
  19593. * self.txn, self.get_dbi('spo:c'), &spok_v, &ck_v)) # <<<<<<<<<<<<<<
  19594. * except KeyNotFoundError:
  19595. * return ResultSet(0, TRP_KLEN)
  19596. */
  19597. __pyx_t_10.__pyx_n = 1;
  19598. __pyx_t_10.dblabel = ((unsigned char *)((char const *)"spo:c"));
  19599. __pyx_t_9 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_dbi(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_10);
  19600. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1410
  19601. * try:
  19602. * self._to_triple_key(triple_pattern, &spok)
  19603. * _check(lmdb.mdb_get( # <<<<<<<<<<<<<<
  19604. * self.txn, self.get_dbi('spo:c'), &spok_v, &ck_v))
  19605. * except KeyNotFoundError:
  19606. */
  19607. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_get(__pyx_v_self->__pyx_base.txn, __pyx_t_9, (&__pyx_v_spok_v), (&__pyx_v_ck_v)), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1410, __pyx_L6_error)
  19608. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1408
  19609. * spok_v.mv_data = spok
  19610. * spok_v.mv_size = TRP_KLEN
  19611. * try: # <<<<<<<<<<<<<<
  19612. * self._to_triple_key(triple_pattern, &spok)
  19613. * _check(lmdb.mdb_get(
  19614. */
  19615. }
  19616. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  19617. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  19618. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  19619. goto __pyx_L11_try_end;
  19620. __pyx_L6_error:;
  19621. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  19622. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  19623. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  19624. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1412
  19625. * _check(lmdb.mdb_get(
  19626. * self.txn, self.get_dbi('spo:c'), &spok_v, &ck_v))
  19627. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  19628. * return ResultSet(0, TRP_KLEN)
  19629. *
  19630. */
  19631. __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
  19632. __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1412, __pyx_L8_except_error)
  19633. __Pyx_GOTREF(__pyx_t_11);
  19634. __pyx_t_12 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_3, __pyx_t_11);
  19635. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  19636. __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_1);
  19637. __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0;
  19638. if (__pyx_t_12) {
  19639. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  19640. if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 1412, __pyx_L8_except_error)
  19641. __Pyx_GOTREF(__pyx_t_1);
  19642. __Pyx_GOTREF(__pyx_t_2);
  19643. __Pyx_GOTREF(__pyx_t_3);
  19644. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1413
  19645. * self.txn, self.get_dbi('spo:c'), &spok_v, &ck_v))
  19646. * except KeyNotFoundError:
  19647. * return ResultSet(0, TRP_KLEN) # <<<<<<<<<<<<<<
  19648. *
  19649. * matches = ResultSet(1, TRP_KLEN)
  19650. */
  19651. __Pyx_XDECREF(((PyObject *)__pyx_r));
  19652. __pyx_t_11 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet), __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1413, __pyx_L8_except_error)
  19653. __Pyx_GOTREF(__pyx_t_11);
  19654. __pyx_r = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_11);
  19655. __pyx_t_11 = 0;
  19656. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19657. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  19658. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19659. goto __pyx_L9_except_return;
  19660. }
  19661. goto __pyx_L8_except_error;
  19662. __pyx_L8_except_error:;
  19663. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1408
  19664. * spok_v.mv_data = spok
  19665. * spok_v.mv_size = TRP_KLEN
  19666. * try: # <<<<<<<<<<<<<<
  19667. * self._to_triple_key(triple_pattern, &spok)
  19668. * _check(lmdb.mdb_get(
  19669. */
  19670. __Pyx_XGIVEREF(__pyx_t_6);
  19671. __Pyx_XGIVEREF(__pyx_t_7);
  19672. __Pyx_XGIVEREF(__pyx_t_8);
  19673. __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
  19674. goto __pyx_L1_error;
  19675. __pyx_L9_except_return:;
  19676. __Pyx_XGIVEREF(__pyx_t_6);
  19677. __Pyx_XGIVEREF(__pyx_t_7);
  19678. __Pyx_XGIVEREF(__pyx_t_8);
  19679. __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
  19680. goto __pyx_L0;
  19681. __pyx_L11_try_end:;
  19682. }
  19683. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1415
  19684. * return ResultSet(0, TRP_KLEN)
  19685. *
  19686. * matches = ResultSet(1, TRP_KLEN) # <<<<<<<<<<<<<<
  19687. * memcpy(matches.data, spok, TRP_KLEN)
  19688. * return matches
  19689. */
  19690. __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet), __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1415, __pyx_L1_error)
  19691. __Pyx_GOTREF(__pyx_t_3);
  19692. __pyx_v_matches = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_3);
  19693. __pyx_t_3 = 0;
  19694. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1416
  19695. *
  19696. * matches = ResultSet(1, TRP_KLEN)
  19697. * memcpy(matches.data, spok, TRP_KLEN) # <<<<<<<<<<<<<<
  19698. * return matches
  19699. * # s p ?
  19700. */
  19701. (void)(memcpy(__pyx_v_matches->data, __pyx_v_spok, 15));
  19702. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1417
  19703. * matches = ResultSet(1, TRP_KLEN)
  19704. * memcpy(matches.data, spok, TRP_KLEN)
  19705. * return matches # <<<<<<<<<<<<<<
  19706. * # s p ?
  19707. * else:
  19708. */
  19709. __Pyx_XDECREF(((PyObject *)__pyx_r));
  19710. __Pyx_INCREF(((PyObject *)__pyx_v_matches));
  19711. __pyx_r = __pyx_v_matches;
  19712. goto __pyx_L0;
  19713. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1405
  19714. * if p is not None:
  19715. * # s p o
  19716. * if o is not None: # <<<<<<<<<<<<<<
  19717. * spok_v.mv_data = spok
  19718. * spok_v.mv_size = TRP_KLEN
  19719. */
  19720. }
  19721. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1420
  19722. * # s p ?
  19723. * else:
  19724. * return self._lookup_2bound(0, s, 1, p) # <<<<<<<<<<<<<<
  19725. * else:
  19726. * # s ? o
  19727. */
  19728. /*else*/ {
  19729. __Pyx_XDECREF(((PyObject *)__pyx_r));
  19730. __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->_lookup_2bound(__pyx_v_self, 0, __pyx_v_s, 1, __pyx_v_p)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1420, __pyx_L1_error)
  19731. __Pyx_GOTREF(__pyx_t_3);
  19732. __pyx_r = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_3);
  19733. __pyx_t_3 = 0;
  19734. goto __pyx_L0;
  19735. }
  19736. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1403
  19737. *
  19738. * if s is not None:
  19739. * if p is not None: # <<<<<<<<<<<<<<
  19740. * # s p o
  19741. * if o is not None:
  19742. */
  19743. }
  19744. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1423
  19745. * else:
  19746. * # s ? o
  19747. * if o is not None: # <<<<<<<<<<<<<<
  19748. * return self._lookup_2bound(0, s, 2, o)
  19749. * # s ? ?
  19750. */
  19751. /*else*/ {
  19752. __pyx_t_5 = (__pyx_v_o != Py_None);
  19753. __pyx_t_4 = (__pyx_t_5 != 0);
  19754. if (__pyx_t_4) {
  19755. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1424
  19756. * # s ? o
  19757. * if o is not None:
  19758. * return self._lookup_2bound(0, s, 2, o) # <<<<<<<<<<<<<<
  19759. * # s ? ?
  19760. * else:
  19761. */
  19762. __Pyx_XDECREF(((PyObject *)__pyx_r));
  19763. __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->_lookup_2bound(__pyx_v_self, 0, __pyx_v_s, 2, __pyx_v_o)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1424, __pyx_L1_error)
  19764. __Pyx_GOTREF(__pyx_t_3);
  19765. __pyx_r = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_3);
  19766. __pyx_t_3 = 0;
  19767. goto __pyx_L0;
  19768. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1423
  19769. * else:
  19770. * # s ? o
  19771. * if o is not None: # <<<<<<<<<<<<<<
  19772. * return self._lookup_2bound(0, s, 2, o)
  19773. * # s ? ?
  19774. */
  19775. }
  19776. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1427
  19777. * # s ? ?
  19778. * else:
  19779. * return self._lookup_1bound(0, s) # <<<<<<<<<<<<<<
  19780. * else:
  19781. * if p is not None:
  19782. */
  19783. /*else*/ {
  19784. __Pyx_XDECREF(((PyObject *)__pyx_r));
  19785. __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->_lookup_1bound(__pyx_v_self, 0, __pyx_v_s)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1427, __pyx_L1_error)
  19786. __Pyx_GOTREF(__pyx_t_3);
  19787. __pyx_r = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_3);
  19788. __pyx_t_3 = 0;
  19789. goto __pyx_L0;
  19790. }
  19791. }
  19792. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1402
  19793. * s, p, o = triple_pattern
  19794. *
  19795. * if s is not None: # <<<<<<<<<<<<<<
  19796. * if p is not None:
  19797. * # s p o
  19798. */
  19799. }
  19800. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1429
  19801. * return self._lookup_1bound(0, s)
  19802. * else:
  19803. * if p is not None: # <<<<<<<<<<<<<<
  19804. * # ? p o
  19805. * if o is not None:
  19806. */
  19807. /*else*/ {
  19808. __pyx_t_4 = (__pyx_v_p != Py_None);
  19809. __pyx_t_5 = (__pyx_t_4 != 0);
  19810. if (__pyx_t_5) {
  19811. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1431
  19812. * if p is not None:
  19813. * # ? p o
  19814. * if o is not None: # <<<<<<<<<<<<<<
  19815. * return self._lookup_2bound(1, p, 2, o)
  19816. * # ? p ?
  19817. */
  19818. __pyx_t_5 = (__pyx_v_o != Py_None);
  19819. __pyx_t_4 = (__pyx_t_5 != 0);
  19820. if (__pyx_t_4) {
  19821. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1432
  19822. * # ? p o
  19823. * if o is not None:
  19824. * return self._lookup_2bound(1, p, 2, o) # <<<<<<<<<<<<<<
  19825. * # ? p ?
  19826. * else:
  19827. */
  19828. __Pyx_XDECREF(((PyObject *)__pyx_r));
  19829. __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->_lookup_2bound(__pyx_v_self, 1, __pyx_v_p, 2, __pyx_v_o)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1432, __pyx_L1_error)
  19830. __Pyx_GOTREF(__pyx_t_3);
  19831. __pyx_r = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_3);
  19832. __pyx_t_3 = 0;
  19833. goto __pyx_L0;
  19834. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1431
  19835. * if p is not None:
  19836. * # ? p o
  19837. * if o is not None: # <<<<<<<<<<<<<<
  19838. * return self._lookup_2bound(1, p, 2, o)
  19839. * # ? p ?
  19840. */
  19841. }
  19842. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1435
  19843. * # ? p ?
  19844. * else:
  19845. * return self._lookup_1bound(1, p) # <<<<<<<<<<<<<<
  19846. * else:
  19847. * # ? ? o
  19848. */
  19849. /*else*/ {
  19850. __Pyx_XDECREF(((PyObject *)__pyx_r));
  19851. __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->_lookup_1bound(__pyx_v_self, 1, __pyx_v_p)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1435, __pyx_L1_error)
  19852. __Pyx_GOTREF(__pyx_t_3);
  19853. __pyx_r = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_3);
  19854. __pyx_t_3 = 0;
  19855. goto __pyx_L0;
  19856. }
  19857. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1429
  19858. * return self._lookup_1bound(0, s)
  19859. * else:
  19860. * if p is not None: # <<<<<<<<<<<<<<
  19861. * # ? p o
  19862. * if o is not None:
  19863. */
  19864. }
  19865. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1438
  19866. * else:
  19867. * # ? ? o
  19868. * if o is not None: # <<<<<<<<<<<<<<
  19869. * return self._lookup_1bound(2, o)
  19870. * # ? ? ?
  19871. */
  19872. /*else*/ {
  19873. __pyx_t_4 = (__pyx_v_o != Py_None);
  19874. __pyx_t_5 = (__pyx_t_4 != 0);
  19875. if (__pyx_t_5) {
  19876. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1439
  19877. * # ? ? o
  19878. * if o is not None:
  19879. * return self._lookup_1bound(2, o) # <<<<<<<<<<<<<<
  19880. * # ? ? ?
  19881. * else:
  19882. */
  19883. __Pyx_XDECREF(((PyObject *)__pyx_r));
  19884. __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->_lookup_1bound(__pyx_v_self, 2, __pyx_v_o)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1439, __pyx_L1_error)
  19885. __Pyx_GOTREF(__pyx_t_3);
  19886. __pyx_r = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_3);
  19887. __pyx_t_3 = 0;
  19888. goto __pyx_L0;
  19889. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1438
  19890. * else:
  19891. * # ? ? o
  19892. * if o is not None: # <<<<<<<<<<<<<<
  19893. * return self._lookup_1bound(2, o)
  19894. * # ? ? ?
  19895. */
  19896. }
  19897. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1443
  19898. * else:
  19899. * # Get all triples in the database.
  19900. * logger.debug('Getting all DB triples.') # <<<<<<<<<<<<<<
  19901. * dcur = self._cur_open('spo:c')
  19902. *
  19903. */
  19904. /*else*/ {
  19905. __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1443, __pyx_L1_error)
  19906. __Pyx_GOTREF(__pyx_t_3);
  19907. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1443, __pyx_L1_error)
  19908. __Pyx_GOTREF(__pyx_t_2);
  19909. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19910. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1443, __pyx_L1_error)
  19911. __Pyx_GOTREF(__pyx_t_3);
  19912. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  19913. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19914. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1444
  19915. * # Get all triples in the database.
  19916. * logger.debug('Getting all DB triples.')
  19917. * dcur = self._cur_open('spo:c') # <<<<<<<<<<<<<<
  19918. *
  19919. * try:
  19920. */
  19921. __pyx_t_14.__pyx_n = 1;
  19922. __pyx_t_14.dblabel = ((unsigned char *)((char const *)"spo:c"));
  19923. __pyx_t_13 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_open(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_14); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1444, __pyx_L1_error)
  19924. __pyx_v_dcur = __pyx_t_13;
  19925. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1446
  19926. * dcur = self._cur_open('spo:c')
  19927. *
  19928. * try: # <<<<<<<<<<<<<<
  19929. * _check(lmdb.mdb_stat(
  19930. * self.txn, lmdb.mdb_cursor_dbi(dcur), &db_stat),
  19931. */
  19932. /*try:*/ {
  19933. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1447
  19934. *
  19935. * try:
  19936. * _check(lmdb.mdb_stat( # <<<<<<<<<<<<<<
  19937. * self.txn, lmdb.mdb_cursor_dbi(dcur), &db_stat),
  19938. * 'Error gathering DB stats.')
  19939. */
  19940. __pyx_t_15.__pyx_n = 1;
  19941. __pyx_t_15.message = __pyx_kp_u_Error_gathering_DB_stats;
  19942. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_stat(__pyx_v_self->__pyx_base.txn, mdb_cursor_dbi(__pyx_v_dcur), (&__pyx_v_db_stat)), &__pyx_t_15); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1447, __pyx_L19_error)
  19943. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1450
  19944. * self.txn, lmdb.mdb_cursor_dbi(dcur), &db_stat),
  19945. * 'Error gathering DB stats.')
  19946. * ct = db_stat.ms_entries # <<<<<<<<<<<<<<
  19947. * ret = ResultSet(ct, TRP_KLEN)
  19948. * logger.debug(f'Triples found: {ct}')
  19949. */
  19950. __pyx_t_16 = __pyx_v_db_stat.ms_entries;
  19951. __pyx_v_ct = __pyx_t_16;
  19952. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1451
  19953. * 'Error gathering DB stats.')
  19954. * ct = db_stat.ms_entries
  19955. * ret = ResultSet(ct, TRP_KLEN) # <<<<<<<<<<<<<<
  19956. * logger.debug(f'Triples found: {ct}')
  19957. * if ct == 0:
  19958. */
  19959. __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_ct); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1451, __pyx_L19_error)
  19960. __Pyx_GOTREF(__pyx_t_3);
  19961. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1451, __pyx_L19_error)
  19962. __Pyx_GOTREF(__pyx_t_2);
  19963. __Pyx_GIVEREF(__pyx_t_3);
  19964. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  19965. __Pyx_INCREF(__pyx_int_15);
  19966. __Pyx_GIVEREF(__pyx_int_15);
  19967. PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_15);
  19968. __pyx_t_3 = 0;
  19969. __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1451, __pyx_L19_error)
  19970. __Pyx_GOTREF(__pyx_t_3);
  19971. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  19972. __pyx_v_ret = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_3);
  19973. __pyx_t_3 = 0;
  19974. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1452
  19975. * ct = db_stat.ms_entries
  19976. * ret = ResultSet(ct, TRP_KLEN)
  19977. * logger.debug(f'Triples found: {ct}') # <<<<<<<<<<<<<<
  19978. * if ct == 0:
  19979. * return ResultSet(0, TRP_KLEN)
  19980. */
  19981. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1452, __pyx_L19_error)
  19982. __Pyx_GOTREF(__pyx_t_2);
  19983. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1452, __pyx_L19_error)
  19984. __Pyx_GOTREF(__pyx_t_1);
  19985. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  19986. __pyx_t_2 = __Pyx_PyUnicode_From_size_t(__pyx_v_ct, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1452, __pyx_L19_error)
  19987. __Pyx_GOTREF(__pyx_t_2);
  19988. __pyx_t_11 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Triples_found, __pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1452, __pyx_L19_error)
  19989. __Pyx_GOTREF(__pyx_t_11);
  19990. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  19991. __pyx_t_2 = NULL;
  19992. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
  19993. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
  19994. if (likely(__pyx_t_2)) {
  19995. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
  19996. __Pyx_INCREF(__pyx_t_2);
  19997. __Pyx_INCREF(function);
  19998. __Pyx_DECREF_SET(__pyx_t_1, function);
  19999. }
  20000. }
  20001. if (!__pyx_t_2) {
  20002. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1452, __pyx_L19_error)
  20003. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  20004. __Pyx_GOTREF(__pyx_t_3);
  20005. } else {
  20006. #if CYTHON_FAST_PYCALL
  20007. if (PyFunction_Check(__pyx_t_1)) {
  20008. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_11};
  20009. __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1452, __pyx_L19_error)
  20010. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  20011. __Pyx_GOTREF(__pyx_t_3);
  20012. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  20013. } else
  20014. #endif
  20015. #if CYTHON_FAST_PYCCALL
  20016. if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
  20017. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_11};
  20018. __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1452, __pyx_L19_error)
  20019. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  20020. __Pyx_GOTREF(__pyx_t_3);
  20021. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  20022. } else
  20023. #endif
  20024. {
  20025. __pyx_t_17 = PyTuple_New(1+1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1452, __pyx_L19_error)
  20026. __Pyx_GOTREF(__pyx_t_17);
  20027. __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_2); __pyx_t_2 = NULL;
  20028. __Pyx_GIVEREF(__pyx_t_11);
  20029. PyTuple_SET_ITEM(__pyx_t_17, 0+1, __pyx_t_11);
  20030. __pyx_t_11 = 0;
  20031. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_17, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1452, __pyx_L19_error)
  20032. __Pyx_GOTREF(__pyx_t_3);
  20033. __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  20034. }
  20035. }
  20036. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20037. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20038. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1453
  20039. * ret = ResultSet(ct, TRP_KLEN)
  20040. * logger.debug(f'Triples found: {ct}')
  20041. * if ct == 0: # <<<<<<<<<<<<<<
  20042. * return ResultSet(0, TRP_KLEN)
  20043. *
  20044. */
  20045. __pyx_t_5 = ((__pyx_v_ct == 0) != 0);
  20046. if (__pyx_t_5) {
  20047. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1454
  20048. * logger.debug(f'Triples found: {ct}')
  20049. * if ct == 0:
  20050. * return ResultSet(0, TRP_KLEN) # <<<<<<<<<<<<<<
  20051. *
  20052. * _check(lmdb.mdb_cursor_get(
  20053. */
  20054. __Pyx_XDECREF(((PyObject *)__pyx_r));
  20055. __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet), __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1454, __pyx_L19_error)
  20056. __Pyx_GOTREF(__pyx_t_3);
  20057. __pyx_r = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_3);
  20058. __pyx_t_3 = 0;
  20059. goto __pyx_L18_return;
  20060. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1453
  20061. * ret = ResultSet(ct, TRP_KLEN)
  20062. * logger.debug(f'Triples found: {ct}')
  20063. * if ct == 0: # <<<<<<<<<<<<<<
  20064. * return ResultSet(0, TRP_KLEN)
  20065. *
  20066. */
  20067. }
  20068. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1456
  20069. * return ResultSet(0, TRP_KLEN)
  20070. *
  20071. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  20072. * dcur, &key_v, &data_v, lmdb.MDB_FIRST))
  20073. * while True:
  20074. */
  20075. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_dcur, (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v), (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v), MDB_FIRST), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1456, __pyx_L19_error)
  20076. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1458
  20077. * _check(lmdb.mdb_cursor_get(
  20078. * dcur, &key_v, &data_v, lmdb.MDB_FIRST))
  20079. * while True: # <<<<<<<<<<<<<<
  20080. * logger.debug(f'i in 0bound: {i}')
  20081. * memcpy(
  20082. */
  20083. while (1) {
  20084. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1459
  20085. * dcur, &key_v, &data_v, lmdb.MDB_FIRST))
  20086. * while True:
  20087. * logger.debug(f'i in 0bound: {i}') # <<<<<<<<<<<<<<
  20088. * memcpy(
  20089. * ret.data + ret.itemsize * i,
  20090. */
  20091. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1459, __pyx_L19_error)
  20092. __Pyx_GOTREF(__pyx_t_1);
  20093. __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_debug); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1459, __pyx_L19_error)
  20094. __Pyx_GOTREF(__pyx_t_17);
  20095. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20096. __pyx_t_1 = __Pyx_PyUnicode_From_size_t(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1459, __pyx_L19_error)
  20097. __Pyx_GOTREF(__pyx_t_1);
  20098. __pyx_t_11 = __Pyx_PyUnicode_Concat(__pyx_kp_u_i_in_0bound, __pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1459, __pyx_L19_error)
  20099. __Pyx_GOTREF(__pyx_t_11);
  20100. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20101. __pyx_t_1 = NULL;
  20102. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) {
  20103. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_17);
  20104. if (likely(__pyx_t_1)) {
  20105. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
  20106. __Pyx_INCREF(__pyx_t_1);
  20107. __Pyx_INCREF(function);
  20108. __Pyx_DECREF_SET(__pyx_t_17, function);
  20109. }
  20110. }
  20111. if (!__pyx_t_1) {
  20112. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_17, __pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1459, __pyx_L19_error)
  20113. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  20114. __Pyx_GOTREF(__pyx_t_3);
  20115. } else {
  20116. #if CYTHON_FAST_PYCALL
  20117. if (PyFunction_Check(__pyx_t_17)) {
  20118. PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_11};
  20119. __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1459, __pyx_L19_error)
  20120. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  20121. __Pyx_GOTREF(__pyx_t_3);
  20122. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  20123. } else
  20124. #endif
  20125. #if CYTHON_FAST_PYCCALL
  20126. if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) {
  20127. PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_11};
  20128. __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1459, __pyx_L19_error)
  20129. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  20130. __Pyx_GOTREF(__pyx_t_3);
  20131. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  20132. } else
  20133. #endif
  20134. {
  20135. __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1459, __pyx_L19_error)
  20136. __Pyx_GOTREF(__pyx_t_2);
  20137. __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = NULL;
  20138. __Pyx_GIVEREF(__pyx_t_11);
  20139. PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_11);
  20140. __pyx_t_11 = 0;
  20141. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1459, __pyx_L19_error)
  20142. __Pyx_GOTREF(__pyx_t_3);
  20143. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  20144. }
  20145. }
  20146. __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  20147. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20148. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1460
  20149. * while True:
  20150. * logger.debug(f'i in 0bound: {i}')
  20151. * memcpy( # <<<<<<<<<<<<<<
  20152. * ret.data + ret.itemsize * i,
  20153. * key_v.mv_data, TRP_KLEN)
  20154. */
  20155. (void)(memcpy((__pyx_v_ret->data + (__pyx_v_ret->itemsize * __pyx_v_i)), __pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v.mv_data, 15));
  20156. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1464
  20157. * key_v.mv_data, TRP_KLEN)
  20158. *
  20159. * try: # <<<<<<<<<<<<<<
  20160. * _check(lmdb.mdb_cursor_get(
  20161. * dcur, &key_v, &data_v, lmdb.MDB_NEXT_NODUP))
  20162. */
  20163. {
  20164. __Pyx_PyThreadState_declare
  20165. __Pyx_PyThreadState_assign
  20166. __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
  20167. __Pyx_XGOTREF(__pyx_t_8);
  20168. __Pyx_XGOTREF(__pyx_t_7);
  20169. __Pyx_XGOTREF(__pyx_t_6);
  20170. /*try:*/ {
  20171. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1465
  20172. *
  20173. * try:
  20174. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  20175. * dcur, &key_v, &data_v, lmdb.MDB_NEXT_NODUP))
  20176. * except KeyNotFoundError:
  20177. */
  20178. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_dcur, (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v), (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v), MDB_NEXT_NODUP), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1465, __pyx_L24_error)
  20179. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1464
  20180. * key_v.mv_data, TRP_KLEN)
  20181. *
  20182. * try: # <<<<<<<<<<<<<<
  20183. * _check(lmdb.mdb_cursor_get(
  20184. * dcur, &key_v, &data_v, lmdb.MDB_NEXT_NODUP))
  20185. */
  20186. }
  20187. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  20188. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  20189. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  20190. goto __pyx_L31_try_end;
  20191. __pyx_L24_error:;
  20192. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  20193. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  20194. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  20195. __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
  20196. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  20197. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1467
  20198. * _check(lmdb.mdb_cursor_get(
  20199. * dcur, &key_v, &data_v, lmdb.MDB_NEXT_NODUP))
  20200. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  20201. * break
  20202. *
  20203. */
  20204. __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_17, &__pyx_t_2);
  20205. __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1467, __pyx_L26_except_error)
  20206. __Pyx_GOTREF(__pyx_t_11);
  20207. __pyx_t_12 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_3, __pyx_t_11);
  20208. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  20209. __Pyx_ErrRestore(__pyx_t_3, __pyx_t_17, __pyx_t_2);
  20210. __pyx_t_3 = 0; __pyx_t_17 = 0; __pyx_t_2 = 0;
  20211. if (__pyx_t_12) {
  20212. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  20213. if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_17, &__pyx_t_3) < 0) __PYX_ERR(0, 1467, __pyx_L26_except_error)
  20214. __Pyx_GOTREF(__pyx_t_2);
  20215. __Pyx_GOTREF(__pyx_t_17);
  20216. __Pyx_GOTREF(__pyx_t_3);
  20217. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1468
  20218. * dcur, &key_v, &data_v, lmdb.MDB_NEXT_NODUP))
  20219. * except KeyNotFoundError:
  20220. * break # <<<<<<<<<<<<<<
  20221. *
  20222. * i += 1
  20223. */
  20224. goto __pyx_L32_except_break;
  20225. __pyx_L32_except_break:;
  20226. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  20227. __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  20228. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20229. goto __pyx_L29_try_break;
  20230. }
  20231. goto __pyx_L26_except_error;
  20232. __pyx_L26_except_error:;
  20233. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1464
  20234. * key_v.mv_data, TRP_KLEN)
  20235. *
  20236. * try: # <<<<<<<<<<<<<<
  20237. * _check(lmdb.mdb_cursor_get(
  20238. * dcur, &key_v, &data_v, lmdb.MDB_NEXT_NODUP))
  20239. */
  20240. __Pyx_XGIVEREF(__pyx_t_8);
  20241. __Pyx_XGIVEREF(__pyx_t_7);
  20242. __Pyx_XGIVEREF(__pyx_t_6);
  20243. __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6);
  20244. goto __pyx_L19_error;
  20245. __pyx_L29_try_break:;
  20246. __Pyx_XGIVEREF(__pyx_t_8);
  20247. __Pyx_XGIVEREF(__pyx_t_7);
  20248. __Pyx_XGIVEREF(__pyx_t_6);
  20249. __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6);
  20250. goto __pyx_L23_break;
  20251. __pyx_L31_try_end:;
  20252. }
  20253. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1470
  20254. * break
  20255. *
  20256. * i += 1 # <<<<<<<<<<<<<<
  20257. * # Size is guessed from all entries. Unique keys will be
  20258. * # much less than that.
  20259. */
  20260. __pyx_v_i = (__pyx_v_i + 1);
  20261. }
  20262. __pyx_L23_break:;
  20263. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1473
  20264. * # Size is guessed from all entries. Unique keys will be
  20265. * # much less than that.
  20266. * ret.resize(i + 1) # <<<<<<<<<<<<<<
  20267. *
  20268. * #logger.debug('Assembled data: {}'.format(ret.data[:ret.size]))
  20269. */
  20270. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_v_ret->__pyx_vtab)->resize(__pyx_v_ret, (__pyx_v_i + 1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1473, __pyx_L19_error)
  20271. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1476
  20272. *
  20273. * #logger.debug('Assembled data: {}'.format(ret.data[:ret.size]))
  20274. * return ret # <<<<<<<<<<<<<<
  20275. * finally:
  20276. * self._cur_close(dcur)
  20277. */
  20278. __Pyx_XDECREF(((PyObject *)__pyx_r));
  20279. __Pyx_INCREF(((PyObject *)__pyx_v_ret));
  20280. __pyx_r = __pyx_v_ret;
  20281. goto __pyx_L18_return;
  20282. }
  20283. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1478
  20284. * return ret
  20285. * finally:
  20286. * self._cur_close(dcur) # <<<<<<<<<<<<<<
  20287. *
  20288. *
  20289. */
  20290. /*finally:*/ {
  20291. __pyx_L19_error:;
  20292. /*exception exit:*/{
  20293. __Pyx_PyThreadState_declare
  20294. __Pyx_PyThreadState_assign
  20295. __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
  20296. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  20297. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  20298. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  20299. __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
  20300. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  20301. if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
  20302. if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
  20303. __Pyx_XGOTREF(__pyx_t_6);
  20304. __Pyx_XGOTREF(__pyx_t_7);
  20305. __Pyx_XGOTREF(__pyx_t_8);
  20306. __Pyx_XGOTREF(__pyx_t_20);
  20307. __Pyx_XGOTREF(__pyx_t_21);
  20308. __Pyx_XGOTREF(__pyx_t_22);
  20309. __pyx_t_12 = __pyx_lineno; __pyx_t_18 = __pyx_clineno; __pyx_t_19 = __pyx_filename;
  20310. {
  20311. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_dcur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1478, __pyx_L35_error)
  20312. }
  20313. if (PY_MAJOR_VERSION >= 3) {
  20314. __Pyx_XGIVEREF(__pyx_t_20);
  20315. __Pyx_XGIVEREF(__pyx_t_21);
  20316. __Pyx_XGIVEREF(__pyx_t_22);
  20317. __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
  20318. }
  20319. __Pyx_XGIVEREF(__pyx_t_6);
  20320. __Pyx_XGIVEREF(__pyx_t_7);
  20321. __Pyx_XGIVEREF(__pyx_t_8);
  20322. __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
  20323. __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
  20324. __pyx_lineno = __pyx_t_12; __pyx_clineno = __pyx_t_18; __pyx_filename = __pyx_t_19;
  20325. goto __pyx_L1_error;
  20326. __pyx_L35_error:;
  20327. if (PY_MAJOR_VERSION >= 3) {
  20328. __Pyx_XGIVEREF(__pyx_t_20);
  20329. __Pyx_XGIVEREF(__pyx_t_21);
  20330. __Pyx_XGIVEREF(__pyx_t_22);
  20331. __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
  20332. }
  20333. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  20334. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  20335. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  20336. __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
  20337. goto __pyx_L1_error;
  20338. }
  20339. __pyx_L18_return: {
  20340. __pyx_t_23 = __pyx_r;
  20341. __pyx_r = 0;
  20342. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_dcur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1478, __pyx_L1_error)
  20343. __pyx_r = __pyx_t_23;
  20344. __pyx_t_23 = 0;
  20345. goto __pyx_L0;
  20346. }
  20347. }
  20348. }
  20349. }
  20350. }
  20351. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1387
  20352. *
  20353. *
  20354. * cdef ResultSet _lookup(self, tuple triple_pattern): # <<<<<<<<<<<<<<
  20355. * """
  20356. * Look up triples in the indices based on a triple pattern.
  20357. */
  20358. /* function exit code */
  20359. __pyx_L1_error:;
  20360. __Pyx_XDECREF(__pyx_t_1);
  20361. __Pyx_XDECREF(__pyx_t_2);
  20362. __Pyx_XDECREF(__pyx_t_3);
  20363. __Pyx_XDECREF(__pyx_t_11);
  20364. __Pyx_XDECREF(__pyx_t_17);
  20365. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  20366. __pyx_r = 0;
  20367. __pyx_L0:;
  20368. __Pyx_XDECREF(__pyx_v_s);
  20369. __Pyx_XDECREF(__pyx_v_p);
  20370. __Pyx_XDECREF(__pyx_v_o);
  20371. __Pyx_XDECREF((PyObject *)__pyx_v_matches);
  20372. __Pyx_XDECREF((PyObject *)__pyx_v_ret);
  20373. __Pyx_XGIVEREF((PyObject *)__pyx_r);
  20374. __Pyx_TraceReturn(__pyx_r, 0);
  20375. __Pyx_RefNannyFinishContext();
  20376. return __pyx_r;
  20377. }
  20378. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1481
  20379. *
  20380. *
  20381. * cdef ResultSet _lookup_1bound(self, unsigned char idx, term): # <<<<<<<<<<<<<<
  20382. * """
  20383. * Lookup triples for a pattern with one bound term.
  20384. */
  20385. static struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__lookup_1bound(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, unsigned char __pyx_v_idx, PyObject *__pyx_v_term) {
  20386. unsigned char __pyx_v_luk[5];
  20387. unsigned char __pyx_v_asm_rng[3];
  20388. size_t __pyx_v_ct;
  20389. size_t __pyx_v_ret_offset;
  20390. size_t __pyx_v_src_pos;
  20391. size_t __pyx_v_ret_pos;
  20392. size_t __pyx_v_j;
  20393. MDB_cursor *__pyx_v_icur;
  20394. unsigned char *__pyx_v_term_order;
  20395. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_ret = NULL;
  20396. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_r = NULL;
  20397. __Pyx_TraceDeclarations
  20398. __Pyx_RefNannyDeclarations
  20399. PyObject *__pyx_t_1 = NULL;
  20400. PyObject *__pyx_t_2 = NULL;
  20401. PyObject *__pyx_t_3 = NULL;
  20402. Py_ssize_t __pyx_t_4;
  20403. Py_UCS4 __pyx_t_5;
  20404. PyObject *__pyx_t_6 = NULL;
  20405. PyObject *__pyx_t_7 = NULL;
  20406. PyObject *__pyx_t_8 = NULL;
  20407. PyObject *__pyx_t_9 = NULL;
  20408. PyObject *__pyx_t_10 = NULL;
  20409. int __pyx_t_11;
  20410. PyObject *__pyx_t_12 = NULL;
  20411. PyObject *__pyx_t_13 = NULL;
  20412. unsigned char *__pyx_t_14;
  20413. MDB_cursor *__pyx_t_15;
  20414. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__cur_open __pyx_t_16;
  20415. unsigned char __pyx_t_17[3];
  20416. size_t __pyx_t_18;
  20417. size_t __pyx_t_19;
  20418. size_t __pyx_t_20;
  20419. int __pyx_t_21;
  20420. char const *__pyx_t_22;
  20421. PyObject *__pyx_t_23 = NULL;
  20422. PyObject *__pyx_t_24 = NULL;
  20423. PyObject *__pyx_t_25 = NULL;
  20424. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_t_26 = NULL;
  20425. __Pyx_RefNannySetupContext("_lookup_1bound", 0);
  20426. __Pyx_TraceCall("_lookup_1bound", __pyx_f[0], 1481, 0, __PYX_ERR(0, 1481, __pyx_L1_error));
  20427. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1496
  20428. * unsigned int dbflags
  20429. * unsigned char asm_rng[3]
  20430. * size_t ct, ret_offset = 0, src_pos, ret_pos # <<<<<<<<<<<<<<
  20431. * size_t j # Must be signed for older OpenMP versions
  20432. * lmdb.MDB_cursor *icur
  20433. */
  20434. __pyx_v_ret_offset = 0;
  20435. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1500
  20436. * lmdb.MDB_cursor *icur
  20437. *
  20438. * logger.debug(f'lookup 1bound: {idx}, {term}') # <<<<<<<<<<<<<<
  20439. * try:
  20440. * self._to_key(term, &luk)
  20441. */
  20442. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1500, __pyx_L1_error)
  20443. __Pyx_GOTREF(__pyx_t_2);
  20444. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1500, __pyx_L1_error)
  20445. __Pyx_GOTREF(__pyx_t_3);
  20446. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  20447. __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1500, __pyx_L1_error)
  20448. __Pyx_GOTREF(__pyx_t_2);
  20449. __pyx_t_4 = 0;
  20450. __pyx_t_5 = 127;
  20451. __Pyx_INCREF(__pyx_kp_u_lookup_1bound);
  20452. __pyx_t_4 += 15;
  20453. __Pyx_GIVEREF(__pyx_kp_u_lookup_1bound);
  20454. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_lookup_1bound);
  20455. __pyx_t_6 = __Pyx_PyUnicode_From_unsigned_char(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1500, __pyx_L1_error)
  20456. __Pyx_GOTREF(__pyx_t_6);
  20457. __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
  20458. __Pyx_GIVEREF(__pyx_t_6);
  20459. PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6);
  20460. __pyx_t_6 = 0;
  20461. __Pyx_INCREF(__pyx_kp_u__12);
  20462. __pyx_t_4 += 2;
  20463. __Pyx_GIVEREF(__pyx_kp_u__12);
  20464. PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u__12);
  20465. __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_term, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1500, __pyx_L1_error)
  20466. __Pyx_GOTREF(__pyx_t_6);
  20467. __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
  20468. __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
  20469. __Pyx_GIVEREF(__pyx_t_6);
  20470. PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_6);
  20471. __pyx_t_6 = 0;
  20472. __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_2, 4, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1500, __pyx_L1_error)
  20473. __Pyx_GOTREF(__pyx_t_6);
  20474. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  20475. __pyx_t_2 = NULL;
  20476. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  20477. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  20478. if (likely(__pyx_t_2)) {
  20479. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  20480. __Pyx_INCREF(__pyx_t_2);
  20481. __Pyx_INCREF(function);
  20482. __Pyx_DECREF_SET(__pyx_t_3, function);
  20483. }
  20484. }
  20485. if (!__pyx_t_2) {
  20486. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1500, __pyx_L1_error)
  20487. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20488. __Pyx_GOTREF(__pyx_t_1);
  20489. } else {
  20490. #if CYTHON_FAST_PYCALL
  20491. if (PyFunction_Check(__pyx_t_3)) {
  20492. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_6};
  20493. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1500, __pyx_L1_error)
  20494. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  20495. __Pyx_GOTREF(__pyx_t_1);
  20496. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20497. } else
  20498. #endif
  20499. #if CYTHON_FAST_PYCCALL
  20500. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  20501. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_6};
  20502. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1500, __pyx_L1_error)
  20503. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  20504. __Pyx_GOTREF(__pyx_t_1);
  20505. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20506. } else
  20507. #endif
  20508. {
  20509. __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1500, __pyx_L1_error)
  20510. __Pyx_GOTREF(__pyx_t_7);
  20511. __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL;
  20512. __Pyx_GIVEREF(__pyx_t_6);
  20513. PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_6);
  20514. __pyx_t_6 = 0;
  20515. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1500, __pyx_L1_error)
  20516. __Pyx_GOTREF(__pyx_t_1);
  20517. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  20518. }
  20519. }
  20520. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20521. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20522. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1501
  20523. *
  20524. * logger.debug(f'lookup 1bound: {idx}, {term}')
  20525. * try: # <<<<<<<<<<<<<<
  20526. * self._to_key(term, &luk)
  20527. * except KeyNotFoundError:
  20528. */
  20529. {
  20530. __Pyx_PyThreadState_declare
  20531. __Pyx_PyThreadState_assign
  20532. __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
  20533. __Pyx_XGOTREF(__pyx_t_8);
  20534. __Pyx_XGOTREF(__pyx_t_9);
  20535. __Pyx_XGOTREF(__pyx_t_10);
  20536. /*try:*/ {
  20537. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1502
  20538. * logger.debug(f'lookup 1bound: {idx}, {term}')
  20539. * try:
  20540. * self._to_key(term, &luk) # <<<<<<<<<<<<<<
  20541. * except KeyNotFoundError:
  20542. * return ResultSet(0, TRP_KLEN)
  20543. */
  20544. __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__to_key(__pyx_v_self, __pyx_v_term, (&__pyx_v_luk)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1502, __pyx_L3_error)
  20545. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1501
  20546. *
  20547. * logger.debug(f'lookup 1bound: {idx}, {term}')
  20548. * try: # <<<<<<<<<<<<<<
  20549. * self._to_key(term, &luk)
  20550. * except KeyNotFoundError:
  20551. */
  20552. }
  20553. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  20554. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  20555. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  20556. goto __pyx_L8_try_end;
  20557. __pyx_L3_error:;
  20558. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  20559. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  20560. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  20561. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  20562. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  20563. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1503
  20564. * try:
  20565. * self._to_key(term, &luk)
  20566. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  20567. * return ResultSet(0, TRP_KLEN)
  20568. * logging.debug('luk: {}'.format(luk))
  20569. */
  20570. __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_3, &__pyx_t_7);
  20571. __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1503, __pyx_L5_except_error)
  20572. __Pyx_GOTREF(__pyx_t_6);
  20573. __pyx_t_11 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
  20574. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20575. __Pyx_ErrRestore(__pyx_t_1, __pyx_t_3, __pyx_t_7);
  20576. __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_7 = 0;
  20577. if (__pyx_t_11) {
  20578. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._lookup_1bound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  20579. if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_3, &__pyx_t_1) < 0) __PYX_ERR(0, 1503, __pyx_L5_except_error)
  20580. __Pyx_GOTREF(__pyx_t_7);
  20581. __Pyx_GOTREF(__pyx_t_3);
  20582. __Pyx_GOTREF(__pyx_t_1);
  20583. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1504
  20584. * self._to_key(term, &luk)
  20585. * except KeyNotFoundError:
  20586. * return ResultSet(0, TRP_KLEN) # <<<<<<<<<<<<<<
  20587. * logging.debug('luk: {}'.format(luk))
  20588. *
  20589. */
  20590. __Pyx_XDECREF(((PyObject *)__pyx_r));
  20591. __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet), __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1504, __pyx_L5_except_error)
  20592. __Pyx_GOTREF(__pyx_t_6);
  20593. __pyx_r = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_6);
  20594. __pyx_t_6 = 0;
  20595. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20596. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20597. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  20598. goto __pyx_L6_except_return;
  20599. }
  20600. goto __pyx_L5_except_error;
  20601. __pyx_L5_except_error:;
  20602. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1501
  20603. *
  20604. * logger.debug(f'lookup 1bound: {idx}, {term}')
  20605. * try: # <<<<<<<<<<<<<<
  20606. * self._to_key(term, &luk)
  20607. * except KeyNotFoundError:
  20608. */
  20609. __Pyx_XGIVEREF(__pyx_t_8);
  20610. __Pyx_XGIVEREF(__pyx_t_9);
  20611. __Pyx_XGIVEREF(__pyx_t_10);
  20612. __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
  20613. goto __pyx_L1_error;
  20614. __pyx_L6_except_return:;
  20615. __Pyx_XGIVEREF(__pyx_t_8);
  20616. __Pyx_XGIVEREF(__pyx_t_9);
  20617. __Pyx_XGIVEREF(__pyx_t_10);
  20618. __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
  20619. goto __pyx_L0;
  20620. __pyx_L8_try_end:;
  20621. }
  20622. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1505
  20623. * except KeyNotFoundError:
  20624. * return ResultSet(0, TRP_KLEN)
  20625. * logging.debug('luk: {}'.format(luk)) # <<<<<<<<<<<<<<
  20626. *
  20627. * term_order = lookup_ordering[idx]
  20628. */
  20629. __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1505, __pyx_L1_error)
  20630. __Pyx_GOTREF(__pyx_t_3);
  20631. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1505, __pyx_L1_error)
  20632. __Pyx_GOTREF(__pyx_t_7);
  20633. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20634. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_luk, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1505, __pyx_L1_error)
  20635. __Pyx_GOTREF(__pyx_t_6);
  20636. __pyx_t_2 = __Pyx_PyObject_FromCString(__pyx_v_luk); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1505, __pyx_L1_error)
  20637. __Pyx_GOTREF(__pyx_t_2);
  20638. __pyx_t_12 = NULL;
  20639. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
  20640. __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_6);
  20641. if (likely(__pyx_t_12)) {
  20642. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
  20643. __Pyx_INCREF(__pyx_t_12);
  20644. __Pyx_INCREF(function);
  20645. __Pyx_DECREF_SET(__pyx_t_6, function);
  20646. }
  20647. }
  20648. if (!__pyx_t_12) {
  20649. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1505, __pyx_L1_error)
  20650. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  20651. __Pyx_GOTREF(__pyx_t_3);
  20652. } else {
  20653. #if CYTHON_FAST_PYCALL
  20654. if (PyFunction_Check(__pyx_t_6)) {
  20655. PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_t_2};
  20656. __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1505, __pyx_L1_error)
  20657. __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  20658. __Pyx_GOTREF(__pyx_t_3);
  20659. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  20660. } else
  20661. #endif
  20662. #if CYTHON_FAST_PYCCALL
  20663. if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
  20664. PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_t_2};
  20665. __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1505, __pyx_L1_error)
  20666. __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  20667. __Pyx_GOTREF(__pyx_t_3);
  20668. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  20669. } else
  20670. #endif
  20671. {
  20672. __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1505, __pyx_L1_error)
  20673. __Pyx_GOTREF(__pyx_t_13);
  20674. __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __pyx_t_12 = NULL;
  20675. __Pyx_GIVEREF(__pyx_t_2);
  20676. PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_2);
  20677. __pyx_t_2 = 0;
  20678. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1505, __pyx_L1_error)
  20679. __Pyx_GOTREF(__pyx_t_3);
  20680. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  20681. }
  20682. }
  20683. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20684. __pyx_t_6 = NULL;
  20685. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
  20686. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
  20687. if (likely(__pyx_t_6)) {
  20688. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
  20689. __Pyx_INCREF(__pyx_t_6);
  20690. __Pyx_INCREF(function);
  20691. __Pyx_DECREF_SET(__pyx_t_7, function);
  20692. }
  20693. }
  20694. if (!__pyx_t_6) {
  20695. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1505, __pyx_L1_error)
  20696. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20697. __Pyx_GOTREF(__pyx_t_1);
  20698. } else {
  20699. #if CYTHON_FAST_PYCALL
  20700. if (PyFunction_Check(__pyx_t_7)) {
  20701. PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_3};
  20702. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1505, __pyx_L1_error)
  20703. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  20704. __Pyx_GOTREF(__pyx_t_1);
  20705. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20706. } else
  20707. #endif
  20708. #if CYTHON_FAST_PYCCALL
  20709. if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
  20710. PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_3};
  20711. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1505, __pyx_L1_error)
  20712. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  20713. __Pyx_GOTREF(__pyx_t_1);
  20714. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20715. } else
  20716. #endif
  20717. {
  20718. __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1505, __pyx_L1_error)
  20719. __Pyx_GOTREF(__pyx_t_13);
  20720. __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_6); __pyx_t_6 = NULL;
  20721. __Pyx_GIVEREF(__pyx_t_3);
  20722. PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_3);
  20723. __pyx_t_3 = 0;
  20724. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1505, __pyx_L1_error)
  20725. __Pyx_GOTREF(__pyx_t_1);
  20726. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  20727. }
  20728. }
  20729. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  20730. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20731. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1507
  20732. * logging.debug('luk: {}'.format(luk))
  20733. *
  20734. * term_order = lookup_ordering[idx] # <<<<<<<<<<<<<<
  20735. * icur = self._cur_open(self.lookup_indices[idx])
  20736. * logging.debug(f'DB label: {self.lookup_indices[idx]}')
  20737. */
  20738. __pyx_v_term_order = (__pyx_v_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_lookup_ordering[__pyx_v_idx]);
  20739. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1508
  20740. *
  20741. * term_order = lookup_ordering[idx]
  20742. * icur = self._cur_open(self.lookup_indices[idx]) # <<<<<<<<<<<<<<
  20743. * logging.debug(f'DB label: {self.lookup_indices[idx]}')
  20744. * logging.debug('term order: {}'.format(term_order[: 3]))
  20745. */
  20746. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_lookup_indices); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1508, __pyx_L1_error)
  20747. __Pyx_GOTREF(__pyx_t_1);
  20748. __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_idx, unsigned char, 0, __Pyx_PyInt_From_unsigned_char, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1508, __pyx_L1_error)
  20749. __Pyx_GOTREF(__pyx_t_7);
  20750. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20751. __pyx_t_14 = __Pyx_PyObject_AsWritableUString(__pyx_t_7); if (unlikely((!__pyx_t_14) && PyErr_Occurred())) __PYX_ERR(0, 1508, __pyx_L1_error)
  20752. __pyx_t_16.__pyx_n = 1;
  20753. __pyx_t_16.dblabel = __pyx_t_14;
  20754. __pyx_t_15 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_open(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_16); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1508, __pyx_L1_error)
  20755. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  20756. __pyx_v_icur = __pyx_t_15;
  20757. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1509
  20758. * term_order = lookup_ordering[idx]
  20759. * icur = self._cur_open(self.lookup_indices[idx])
  20760. * logging.debug(f'DB label: {self.lookup_indices[idx]}') # <<<<<<<<<<<<<<
  20761. * logging.debug('term order: {}'.format(term_order[: 3]))
  20762. *
  20763. */
  20764. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1509, __pyx_L1_error)
  20765. __Pyx_GOTREF(__pyx_t_1);
  20766. __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_debug); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1509, __pyx_L1_error)
  20767. __Pyx_GOTREF(__pyx_t_13);
  20768. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20769. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_lookup_indices); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1509, __pyx_L1_error)
  20770. __Pyx_GOTREF(__pyx_t_1);
  20771. __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_idx, unsigned char, 0, __Pyx_PyInt_From_unsigned_char, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1509, __pyx_L1_error)
  20772. __Pyx_GOTREF(__pyx_t_3);
  20773. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20774. __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_t_3, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1509, __pyx_L1_error)
  20775. __Pyx_GOTREF(__pyx_t_1);
  20776. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20777. __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_DB_label, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1509, __pyx_L1_error)
  20778. __Pyx_GOTREF(__pyx_t_3);
  20779. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20780. __pyx_t_1 = NULL;
  20781. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
  20782. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_13);
  20783. if (likely(__pyx_t_1)) {
  20784. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
  20785. __Pyx_INCREF(__pyx_t_1);
  20786. __Pyx_INCREF(function);
  20787. __Pyx_DECREF_SET(__pyx_t_13, function);
  20788. }
  20789. }
  20790. if (!__pyx_t_1) {
  20791. __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1509, __pyx_L1_error)
  20792. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20793. __Pyx_GOTREF(__pyx_t_7);
  20794. } else {
  20795. #if CYTHON_FAST_PYCALL
  20796. if (PyFunction_Check(__pyx_t_13)) {
  20797. PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_3};
  20798. __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1509, __pyx_L1_error)
  20799. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  20800. __Pyx_GOTREF(__pyx_t_7);
  20801. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20802. } else
  20803. #endif
  20804. #if CYTHON_FAST_PYCCALL
  20805. if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
  20806. PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_3};
  20807. __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1509, __pyx_L1_error)
  20808. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  20809. __Pyx_GOTREF(__pyx_t_7);
  20810. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20811. } else
  20812. #endif
  20813. {
  20814. __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1509, __pyx_L1_error)
  20815. __Pyx_GOTREF(__pyx_t_6);
  20816. __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __pyx_t_1 = NULL;
  20817. __Pyx_GIVEREF(__pyx_t_3);
  20818. PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
  20819. __pyx_t_3 = 0;
  20820. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1509, __pyx_L1_error)
  20821. __Pyx_GOTREF(__pyx_t_7);
  20822. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20823. }
  20824. }
  20825. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  20826. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  20827. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1510
  20828. * icur = self._cur_open(self.lookup_indices[idx])
  20829. * logging.debug(f'DB label: {self.lookup_indices[idx]}')
  20830. * logging.debug('term order: {}'.format(term_order[: 3])) # <<<<<<<<<<<<<<
  20831. *
  20832. * try:
  20833. */
  20834. __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1510, __pyx_L1_error)
  20835. __Pyx_GOTREF(__pyx_t_13);
  20836. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_debug); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1510, __pyx_L1_error)
  20837. __Pyx_GOTREF(__pyx_t_6);
  20838. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  20839. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_term_order, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1510, __pyx_L1_error)
  20840. __Pyx_GOTREF(__pyx_t_3);
  20841. __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_term_order) + 0, 3 - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1510, __pyx_L1_error)
  20842. __Pyx_GOTREF(__pyx_t_1);
  20843. __pyx_t_2 = NULL;
  20844. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
  20845. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  20846. if (likely(__pyx_t_2)) {
  20847. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  20848. __Pyx_INCREF(__pyx_t_2);
  20849. __Pyx_INCREF(function);
  20850. __Pyx_DECREF_SET(__pyx_t_3, function);
  20851. }
  20852. }
  20853. if (!__pyx_t_2) {
  20854. __pyx_t_13 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1510, __pyx_L1_error)
  20855. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20856. __Pyx_GOTREF(__pyx_t_13);
  20857. } else {
  20858. #if CYTHON_FAST_PYCALL
  20859. if (PyFunction_Check(__pyx_t_3)) {
  20860. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_1};
  20861. __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1510, __pyx_L1_error)
  20862. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  20863. __Pyx_GOTREF(__pyx_t_13);
  20864. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20865. } else
  20866. #endif
  20867. #if CYTHON_FAST_PYCCALL
  20868. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  20869. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_1};
  20870. __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1510, __pyx_L1_error)
  20871. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  20872. __Pyx_GOTREF(__pyx_t_13);
  20873. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20874. } else
  20875. #endif
  20876. {
  20877. __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1510, __pyx_L1_error)
  20878. __Pyx_GOTREF(__pyx_t_12);
  20879. __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_2); __pyx_t_2 = NULL;
  20880. __Pyx_GIVEREF(__pyx_t_1);
  20881. PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_1);
  20882. __pyx_t_1 = 0;
  20883. __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_12, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1510, __pyx_L1_error)
  20884. __Pyx_GOTREF(__pyx_t_13);
  20885. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  20886. }
  20887. }
  20888. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20889. __pyx_t_3 = NULL;
  20890. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
  20891. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
  20892. if (likely(__pyx_t_3)) {
  20893. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
  20894. __Pyx_INCREF(__pyx_t_3);
  20895. __Pyx_INCREF(function);
  20896. __Pyx_DECREF_SET(__pyx_t_6, function);
  20897. }
  20898. }
  20899. if (!__pyx_t_3) {
  20900. __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_13); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1510, __pyx_L1_error)
  20901. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  20902. __Pyx_GOTREF(__pyx_t_7);
  20903. } else {
  20904. #if CYTHON_FAST_PYCALL
  20905. if (PyFunction_Check(__pyx_t_6)) {
  20906. PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_13};
  20907. __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1510, __pyx_L1_error)
  20908. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  20909. __Pyx_GOTREF(__pyx_t_7);
  20910. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  20911. } else
  20912. #endif
  20913. #if CYTHON_FAST_PYCCALL
  20914. if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
  20915. PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_13};
  20916. __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1510, __pyx_L1_error)
  20917. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  20918. __Pyx_GOTREF(__pyx_t_7);
  20919. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  20920. } else
  20921. #endif
  20922. {
  20923. __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1510, __pyx_L1_error)
  20924. __Pyx_GOTREF(__pyx_t_12);
  20925. __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_3); __pyx_t_3 = NULL;
  20926. __Pyx_GIVEREF(__pyx_t_13);
  20927. PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_13);
  20928. __pyx_t_13 = 0;
  20929. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_12, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1510, __pyx_L1_error)
  20930. __Pyx_GOTREF(__pyx_t_7);
  20931. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  20932. }
  20933. }
  20934. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20935. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  20936. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1512
  20937. * logging.debug('term order: {}'.format(term_order[: 3]))
  20938. *
  20939. * try: # <<<<<<<<<<<<<<
  20940. * key_v.mv_data = luk
  20941. * key_v.mv_size = KLEN
  20942. */
  20943. /*try:*/ {
  20944. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1513
  20945. *
  20946. * try:
  20947. * key_v.mv_data = luk # <<<<<<<<<<<<<<
  20948. * key_v.mv_size = KLEN
  20949. *
  20950. */
  20951. __pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v.mv_data = __pyx_v_luk;
  20952. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1514
  20953. * try:
  20954. * key_v.mv_data = luk
  20955. * key_v.mv_size = KLEN # <<<<<<<<<<<<<<
  20956. *
  20957. * _check(lmdb.mdb_cursor_get(icur, &key_v, &data_v, lmdb.MDB_SET))
  20958. */
  20959. __pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v.mv_size = 5;
  20960. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1516
  20961. * key_v.mv_size = KLEN
  20962. *
  20963. * _check(lmdb.mdb_cursor_get(icur, &key_v, &data_v, lmdb.MDB_SET)) # <<<<<<<<<<<<<<
  20964. * _check(lmdb.mdb_cursor_count(icur, &ct))
  20965. *
  20966. */
  20967. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_icur, (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v), (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v), MDB_SET), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1516, __pyx_L12_error)
  20968. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1517
  20969. *
  20970. * _check(lmdb.mdb_cursor_get(icur, &key_v, &data_v, lmdb.MDB_SET))
  20971. * _check(lmdb.mdb_cursor_count(icur, &ct)) # <<<<<<<<<<<<<<
  20972. *
  20973. * # Allocate memory for results.
  20974. */
  20975. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_count(__pyx_v_icur, (&__pyx_v_ct)), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1517, __pyx_L12_error)
  20976. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1520
  20977. *
  20978. * # Allocate memory for results.
  20979. * ret = ResultSet(ct, TRP_KLEN) # <<<<<<<<<<<<<<
  20980. * logger.debug(f'Entries for {self.lookup_indices[idx]}: {ct}')
  20981. * logger.debug(f'Allocated {ret.size} bytes of data.')
  20982. */
  20983. __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_v_ct); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1520, __pyx_L12_error)
  20984. __Pyx_GOTREF(__pyx_t_7);
  20985. __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1520, __pyx_L12_error)
  20986. __Pyx_GOTREF(__pyx_t_6);
  20987. __Pyx_GIVEREF(__pyx_t_7);
  20988. PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7);
  20989. __Pyx_INCREF(__pyx_int_15);
  20990. __Pyx_GIVEREF(__pyx_int_15);
  20991. PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_15);
  20992. __pyx_t_7 = 0;
  20993. __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet), __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1520, __pyx_L12_error)
  20994. __Pyx_GOTREF(__pyx_t_7);
  20995. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20996. __pyx_v_ret = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_7);
  20997. __pyx_t_7 = 0;
  20998. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1521
  20999. * # Allocate memory for results.
  21000. * ret = ResultSet(ct, TRP_KLEN)
  21001. * logger.debug(f'Entries for {self.lookup_indices[idx]}: {ct}') # <<<<<<<<<<<<<<
  21002. * logger.debug(f'Allocated {ret.size} bytes of data.')
  21003. * #logger.debug('First row: {}'.format(
  21004. */
  21005. __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1521, __pyx_L12_error)
  21006. __Pyx_GOTREF(__pyx_t_6);
  21007. __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_debug); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1521, __pyx_L12_error)
  21008. __Pyx_GOTREF(__pyx_t_12);
  21009. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  21010. __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1521, __pyx_L12_error)
  21011. __Pyx_GOTREF(__pyx_t_6);
  21012. __pyx_t_4 = 0;
  21013. __pyx_t_5 = 127;
  21014. __Pyx_INCREF(__pyx_kp_u_Entries_for);
  21015. __pyx_t_4 += 12;
  21016. __Pyx_GIVEREF(__pyx_kp_u_Entries_for);
  21017. PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_u_Entries_for);
  21018. __pyx_t_13 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_lookup_indices); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1521, __pyx_L12_error)
  21019. __Pyx_GOTREF(__pyx_t_13);
  21020. __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_13, __pyx_v_idx, unsigned char, 0, __Pyx_PyInt_From_unsigned_char, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1521, __pyx_L12_error)
  21021. __Pyx_GOTREF(__pyx_t_3);
  21022. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  21023. __pyx_t_13 = __Pyx_PyObject_FormatSimple(__pyx_t_3, __pyx_empty_unicode); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1521, __pyx_L12_error)
  21024. __Pyx_GOTREF(__pyx_t_13);
  21025. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21026. __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_13) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_13) : __pyx_t_5;
  21027. __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_13);
  21028. __Pyx_GIVEREF(__pyx_t_13);
  21029. PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_13);
  21030. __pyx_t_13 = 0;
  21031. __Pyx_INCREF(__pyx_kp_u__27);
  21032. __pyx_t_4 += 2;
  21033. __Pyx_GIVEREF(__pyx_kp_u__27);
  21034. PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_kp_u__27);
  21035. __pyx_t_13 = __Pyx_PyUnicode_From_size_t(__pyx_v_ct, 0, ' ', 'd'); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1521, __pyx_L12_error)
  21036. __Pyx_GOTREF(__pyx_t_13);
  21037. __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_13);
  21038. __Pyx_GIVEREF(__pyx_t_13);
  21039. PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_13);
  21040. __pyx_t_13 = 0;
  21041. __pyx_t_13 = __Pyx_PyUnicode_Join(__pyx_t_6, 4, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1521, __pyx_L12_error)
  21042. __Pyx_GOTREF(__pyx_t_13);
  21043. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  21044. __pyx_t_6 = NULL;
  21045. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
  21046. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_12);
  21047. if (likely(__pyx_t_6)) {
  21048. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
  21049. __Pyx_INCREF(__pyx_t_6);
  21050. __Pyx_INCREF(function);
  21051. __Pyx_DECREF_SET(__pyx_t_12, function);
  21052. }
  21053. }
  21054. if (!__pyx_t_6) {
  21055. __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1521, __pyx_L12_error)
  21056. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  21057. __Pyx_GOTREF(__pyx_t_7);
  21058. } else {
  21059. #if CYTHON_FAST_PYCALL
  21060. if (PyFunction_Check(__pyx_t_12)) {
  21061. PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_13};
  21062. __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1521, __pyx_L12_error)
  21063. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  21064. __Pyx_GOTREF(__pyx_t_7);
  21065. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  21066. } else
  21067. #endif
  21068. #if CYTHON_FAST_PYCCALL
  21069. if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
  21070. PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_13};
  21071. __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1521, __pyx_L12_error)
  21072. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  21073. __Pyx_GOTREF(__pyx_t_7);
  21074. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  21075. } else
  21076. #endif
  21077. {
  21078. __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1521, __pyx_L12_error)
  21079. __Pyx_GOTREF(__pyx_t_3);
  21080. __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL;
  21081. __Pyx_GIVEREF(__pyx_t_13);
  21082. PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_13);
  21083. __pyx_t_13 = 0;
  21084. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1521, __pyx_L12_error)
  21085. __Pyx_GOTREF(__pyx_t_7);
  21086. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21087. }
  21088. }
  21089. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  21090. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  21091. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1522
  21092. * ret = ResultSet(ct, TRP_KLEN)
  21093. * logger.debug(f'Entries for {self.lookup_indices[idx]}: {ct}')
  21094. * logger.debug(f'Allocated {ret.size} bytes of data.') # <<<<<<<<<<<<<<
  21095. * #logger.debug('First row: {}'.format(
  21096. * # (<unsigned char *>data_v.mv_data)[:DBL_KLEN]))
  21097. */
  21098. __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1522, __pyx_L12_error)
  21099. __Pyx_GOTREF(__pyx_t_12);
  21100. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1522, __pyx_L12_error)
  21101. __Pyx_GOTREF(__pyx_t_3);
  21102. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  21103. __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1522, __pyx_L12_error)
  21104. __Pyx_GOTREF(__pyx_t_12);
  21105. __pyx_t_4 = 0;
  21106. __pyx_t_5 = 127;
  21107. __Pyx_INCREF(__pyx_kp_u_Allocated);
  21108. __pyx_t_4 += 10;
  21109. __Pyx_GIVEREF(__pyx_kp_u_Allocated);
  21110. PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_kp_u_Allocated);
  21111. __pyx_t_13 = __Pyx_PyUnicode_From_size_t(__pyx_v_ret->size, 0, ' ', 'd'); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1522, __pyx_L12_error)
  21112. __Pyx_GOTREF(__pyx_t_13);
  21113. __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_13);
  21114. __Pyx_GIVEREF(__pyx_t_13);
  21115. PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_13);
  21116. __pyx_t_13 = 0;
  21117. __Pyx_INCREF(__pyx_kp_u_bytes_of_data);
  21118. __pyx_t_4 += 15;
  21119. __Pyx_GIVEREF(__pyx_kp_u_bytes_of_data);
  21120. PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_kp_u_bytes_of_data);
  21121. __pyx_t_13 = __Pyx_PyUnicode_Join(__pyx_t_12, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1522, __pyx_L12_error)
  21122. __Pyx_GOTREF(__pyx_t_13);
  21123. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  21124. __pyx_t_12 = NULL;
  21125. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  21126. __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3);
  21127. if (likely(__pyx_t_12)) {
  21128. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  21129. __Pyx_INCREF(__pyx_t_12);
  21130. __Pyx_INCREF(function);
  21131. __Pyx_DECREF_SET(__pyx_t_3, function);
  21132. }
  21133. }
  21134. if (!__pyx_t_12) {
  21135. __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_13); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1522, __pyx_L12_error)
  21136. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  21137. __Pyx_GOTREF(__pyx_t_7);
  21138. } else {
  21139. #if CYTHON_FAST_PYCALL
  21140. if (PyFunction_Check(__pyx_t_3)) {
  21141. PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_t_13};
  21142. __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1522, __pyx_L12_error)
  21143. __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  21144. __Pyx_GOTREF(__pyx_t_7);
  21145. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  21146. } else
  21147. #endif
  21148. #if CYTHON_FAST_PYCCALL
  21149. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  21150. PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_t_13};
  21151. __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1522, __pyx_L12_error)
  21152. __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  21153. __Pyx_GOTREF(__pyx_t_7);
  21154. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  21155. } else
  21156. #endif
  21157. {
  21158. __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1522, __pyx_L12_error)
  21159. __Pyx_GOTREF(__pyx_t_6);
  21160. __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_12); __pyx_t_12 = NULL;
  21161. __Pyx_GIVEREF(__pyx_t_13);
  21162. PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_13);
  21163. __pyx_t_13 = 0;
  21164. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1522, __pyx_L12_error)
  21165. __Pyx_GOTREF(__pyx_t_7);
  21166. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  21167. }
  21168. }
  21169. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21170. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  21171. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1527
  21172. *
  21173. * # Arrange results according to lookup order.
  21174. * asm_rng = [ # <<<<<<<<<<<<<<
  21175. * KLEN * term_order[0],
  21176. * KLEN * term_order[1],
  21177. */
  21178. __pyx_t_17[0] = (5 * (__pyx_v_term_order[0]));
  21179. __pyx_t_17[1] = (5 * (__pyx_v_term_order[1]));
  21180. __pyx_t_17[2] = (5 * (__pyx_v_term_order[2]));
  21181. memcpy(&(__pyx_v_asm_rng[0]), __pyx_t_17, sizeof(__pyx_v_asm_rng[0]) * (3));
  21182. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1532
  21183. * KLEN * term_order[2],
  21184. * ]
  21185. * logger.debug('asm_rng: {}'.format(asm_rng[:3])) # <<<<<<<<<<<<<<
  21186. * logger.debug('luk: {}'.format(luk))
  21187. *
  21188. */
  21189. __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1532, __pyx_L12_error)
  21190. __Pyx_GOTREF(__pyx_t_3);
  21191. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1532, __pyx_L12_error)
  21192. __Pyx_GOTREF(__pyx_t_6);
  21193. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21194. __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_asm_rng, __pyx_n_s_format); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1532, __pyx_L12_error)
  21195. __Pyx_GOTREF(__pyx_t_13);
  21196. __pyx_t_12 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_asm_rng) + 0, 3 - 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1532, __pyx_L12_error)
  21197. __Pyx_GOTREF(__pyx_t_12);
  21198. __pyx_t_1 = NULL;
  21199. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
  21200. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_13);
  21201. if (likely(__pyx_t_1)) {
  21202. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
  21203. __Pyx_INCREF(__pyx_t_1);
  21204. __Pyx_INCREF(function);
  21205. __Pyx_DECREF_SET(__pyx_t_13, function);
  21206. }
  21207. }
  21208. if (!__pyx_t_1) {
  21209. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_12); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1532, __pyx_L12_error)
  21210. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  21211. __Pyx_GOTREF(__pyx_t_3);
  21212. } else {
  21213. #if CYTHON_FAST_PYCALL
  21214. if (PyFunction_Check(__pyx_t_13)) {
  21215. PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_12};
  21216. __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1532, __pyx_L12_error)
  21217. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  21218. __Pyx_GOTREF(__pyx_t_3);
  21219. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  21220. } else
  21221. #endif
  21222. #if CYTHON_FAST_PYCCALL
  21223. if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
  21224. PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_12};
  21225. __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1532, __pyx_L12_error)
  21226. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  21227. __Pyx_GOTREF(__pyx_t_3);
  21228. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  21229. } else
  21230. #endif
  21231. {
  21232. __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1532, __pyx_L12_error)
  21233. __Pyx_GOTREF(__pyx_t_2);
  21234. __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = NULL;
  21235. __Pyx_GIVEREF(__pyx_t_12);
  21236. PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_12);
  21237. __pyx_t_12 = 0;
  21238. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1532, __pyx_L12_error)
  21239. __Pyx_GOTREF(__pyx_t_3);
  21240. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21241. }
  21242. }
  21243. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  21244. __pyx_t_13 = NULL;
  21245. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
  21246. __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_6);
  21247. if (likely(__pyx_t_13)) {
  21248. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
  21249. __Pyx_INCREF(__pyx_t_13);
  21250. __Pyx_INCREF(function);
  21251. __Pyx_DECREF_SET(__pyx_t_6, function);
  21252. }
  21253. }
  21254. if (!__pyx_t_13) {
  21255. __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1532, __pyx_L12_error)
  21256. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21257. __Pyx_GOTREF(__pyx_t_7);
  21258. } else {
  21259. #if CYTHON_FAST_PYCALL
  21260. if (PyFunction_Check(__pyx_t_6)) {
  21261. PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_3};
  21262. __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1532, __pyx_L12_error)
  21263. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  21264. __Pyx_GOTREF(__pyx_t_7);
  21265. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21266. } else
  21267. #endif
  21268. #if CYTHON_FAST_PYCCALL
  21269. if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
  21270. PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_3};
  21271. __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1532, __pyx_L12_error)
  21272. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  21273. __Pyx_GOTREF(__pyx_t_7);
  21274. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21275. } else
  21276. #endif
  21277. {
  21278. __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1532, __pyx_L12_error)
  21279. __Pyx_GOTREF(__pyx_t_2);
  21280. __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_13); __pyx_t_13 = NULL;
  21281. __Pyx_GIVEREF(__pyx_t_3);
  21282. PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_3);
  21283. __pyx_t_3 = 0;
  21284. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1532, __pyx_L12_error)
  21285. __Pyx_GOTREF(__pyx_t_7);
  21286. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21287. }
  21288. }
  21289. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  21290. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  21291. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1533
  21292. * ]
  21293. * logger.debug('asm_rng: {}'.format(asm_rng[:3]))
  21294. * logger.debug('luk: {}'.format(luk)) # <<<<<<<<<<<<<<
  21295. *
  21296. * _check(lmdb.mdb_cursor_get(icur, &key_v, &data_v, lmdb.MDB_SET))
  21297. */
  21298. __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1533, __pyx_L12_error)
  21299. __Pyx_GOTREF(__pyx_t_6);
  21300. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1533, __pyx_L12_error)
  21301. __Pyx_GOTREF(__pyx_t_2);
  21302. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  21303. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_luk, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1533, __pyx_L12_error)
  21304. __Pyx_GOTREF(__pyx_t_3);
  21305. __pyx_t_13 = __Pyx_PyObject_FromCString(__pyx_v_luk); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1533, __pyx_L12_error)
  21306. __Pyx_GOTREF(__pyx_t_13);
  21307. __pyx_t_12 = NULL;
  21308. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
  21309. __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3);
  21310. if (likely(__pyx_t_12)) {
  21311. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  21312. __Pyx_INCREF(__pyx_t_12);
  21313. __Pyx_INCREF(function);
  21314. __Pyx_DECREF_SET(__pyx_t_3, function);
  21315. }
  21316. }
  21317. if (!__pyx_t_12) {
  21318. __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_13); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1533, __pyx_L12_error)
  21319. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  21320. __Pyx_GOTREF(__pyx_t_6);
  21321. } else {
  21322. #if CYTHON_FAST_PYCALL
  21323. if (PyFunction_Check(__pyx_t_3)) {
  21324. PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_t_13};
  21325. __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1533, __pyx_L12_error)
  21326. __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  21327. __Pyx_GOTREF(__pyx_t_6);
  21328. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  21329. } else
  21330. #endif
  21331. #if CYTHON_FAST_PYCCALL
  21332. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  21333. PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_t_13};
  21334. __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1533, __pyx_L12_error)
  21335. __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  21336. __Pyx_GOTREF(__pyx_t_6);
  21337. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  21338. } else
  21339. #endif
  21340. {
  21341. __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1533, __pyx_L12_error)
  21342. __Pyx_GOTREF(__pyx_t_1);
  21343. __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_12); __pyx_t_12 = NULL;
  21344. __Pyx_GIVEREF(__pyx_t_13);
  21345. PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_13);
  21346. __pyx_t_13 = 0;
  21347. __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1533, __pyx_L12_error)
  21348. __Pyx_GOTREF(__pyx_t_6);
  21349. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  21350. }
  21351. }
  21352. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21353. __pyx_t_3 = NULL;
  21354. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
  21355. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  21356. if (likely(__pyx_t_3)) {
  21357. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  21358. __Pyx_INCREF(__pyx_t_3);
  21359. __Pyx_INCREF(function);
  21360. __Pyx_DECREF_SET(__pyx_t_2, function);
  21361. }
  21362. }
  21363. if (!__pyx_t_3) {
  21364. __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1533, __pyx_L12_error)
  21365. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  21366. __Pyx_GOTREF(__pyx_t_7);
  21367. } else {
  21368. #if CYTHON_FAST_PYCALL
  21369. if (PyFunction_Check(__pyx_t_2)) {
  21370. PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_6};
  21371. __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1533, __pyx_L12_error)
  21372. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  21373. __Pyx_GOTREF(__pyx_t_7);
  21374. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  21375. } else
  21376. #endif
  21377. #if CYTHON_FAST_PYCCALL
  21378. if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
  21379. PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_6};
  21380. __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1533, __pyx_L12_error)
  21381. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  21382. __Pyx_GOTREF(__pyx_t_7);
  21383. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  21384. } else
  21385. #endif
  21386. {
  21387. __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1533, __pyx_L12_error)
  21388. __Pyx_GOTREF(__pyx_t_1);
  21389. __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __pyx_t_3 = NULL;
  21390. __Pyx_GIVEREF(__pyx_t_6);
  21391. PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_6);
  21392. __pyx_t_6 = 0;
  21393. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1533, __pyx_L12_error)
  21394. __Pyx_GOTREF(__pyx_t_7);
  21395. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  21396. }
  21397. }
  21398. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21399. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  21400. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1535
  21401. * logger.debug('luk: {}'.format(luk))
  21402. *
  21403. * _check(lmdb.mdb_cursor_get(icur, &key_v, &data_v, lmdb.MDB_SET)) # <<<<<<<<<<<<<<
  21404. * _check(lmdb.mdb_cursor_get(
  21405. * icur, &key_v, &data_v, lmdb.MDB_GET_MULTIPLE))
  21406. */
  21407. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_icur, (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v), (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v), MDB_SET), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1535, __pyx_L12_error)
  21408. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1536
  21409. *
  21410. * _check(lmdb.mdb_cursor_get(icur, &key_v, &data_v, lmdb.MDB_SET))
  21411. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  21412. * icur, &key_v, &data_v, lmdb.MDB_GET_MULTIPLE))
  21413. * while True:
  21414. */
  21415. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_icur, (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v), (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v), MDB_GET_MULTIPLE), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1536, __pyx_L12_error)
  21416. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1538
  21417. * _check(lmdb.mdb_cursor_get(
  21418. * icur, &key_v, &data_v, lmdb.MDB_GET_MULTIPLE))
  21419. * while True: # <<<<<<<<<<<<<<
  21420. * logger.debug('ret_offset: {}'.format(ret_offset))
  21421. * logger.debug(f'Page size: {data_v.mv_size}')
  21422. */
  21423. while (1) {
  21424. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1539
  21425. * icur, &key_v, &data_v, lmdb.MDB_GET_MULTIPLE))
  21426. * while True:
  21427. * logger.debug('ret_offset: {}'.format(ret_offset)) # <<<<<<<<<<<<<<
  21428. * logger.debug(f'Page size: {data_v.mv_size}')
  21429. * #logger.debug(
  21430. */
  21431. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1539, __pyx_L12_error)
  21432. __Pyx_GOTREF(__pyx_t_2);
  21433. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1539, __pyx_L12_error)
  21434. __Pyx_GOTREF(__pyx_t_1);
  21435. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21436. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_ret_offset, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1539, __pyx_L12_error)
  21437. __Pyx_GOTREF(__pyx_t_6);
  21438. __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_ret_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1539, __pyx_L12_error)
  21439. __Pyx_GOTREF(__pyx_t_3);
  21440. __pyx_t_13 = NULL;
  21441. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
  21442. __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_6);
  21443. if (likely(__pyx_t_13)) {
  21444. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
  21445. __Pyx_INCREF(__pyx_t_13);
  21446. __Pyx_INCREF(function);
  21447. __Pyx_DECREF_SET(__pyx_t_6, function);
  21448. }
  21449. }
  21450. if (!__pyx_t_13) {
  21451. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1539, __pyx_L12_error)
  21452. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21453. __Pyx_GOTREF(__pyx_t_2);
  21454. } else {
  21455. #if CYTHON_FAST_PYCALL
  21456. if (PyFunction_Check(__pyx_t_6)) {
  21457. PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_3};
  21458. __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1539, __pyx_L12_error)
  21459. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  21460. __Pyx_GOTREF(__pyx_t_2);
  21461. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21462. } else
  21463. #endif
  21464. #if CYTHON_FAST_PYCCALL
  21465. if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
  21466. PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_3};
  21467. __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1539, __pyx_L12_error)
  21468. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  21469. __Pyx_GOTREF(__pyx_t_2);
  21470. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21471. } else
  21472. #endif
  21473. {
  21474. __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1539, __pyx_L12_error)
  21475. __Pyx_GOTREF(__pyx_t_12);
  21476. __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_13); __pyx_t_13 = NULL;
  21477. __Pyx_GIVEREF(__pyx_t_3);
  21478. PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_3);
  21479. __pyx_t_3 = 0;
  21480. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1539, __pyx_L12_error)
  21481. __Pyx_GOTREF(__pyx_t_2);
  21482. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  21483. }
  21484. }
  21485. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  21486. __pyx_t_6 = NULL;
  21487. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
  21488. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
  21489. if (likely(__pyx_t_6)) {
  21490. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
  21491. __Pyx_INCREF(__pyx_t_6);
  21492. __Pyx_INCREF(function);
  21493. __Pyx_DECREF_SET(__pyx_t_1, function);
  21494. }
  21495. }
  21496. if (!__pyx_t_6) {
  21497. __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1539, __pyx_L12_error)
  21498. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21499. __Pyx_GOTREF(__pyx_t_7);
  21500. } else {
  21501. #if CYTHON_FAST_PYCALL
  21502. if (PyFunction_Check(__pyx_t_1)) {
  21503. PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_2};
  21504. __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1539, __pyx_L12_error)
  21505. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  21506. __Pyx_GOTREF(__pyx_t_7);
  21507. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21508. } else
  21509. #endif
  21510. #if CYTHON_FAST_PYCCALL
  21511. if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
  21512. PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_2};
  21513. __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1539, __pyx_L12_error)
  21514. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  21515. __Pyx_GOTREF(__pyx_t_7);
  21516. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21517. } else
  21518. #endif
  21519. {
  21520. __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1539, __pyx_L12_error)
  21521. __Pyx_GOTREF(__pyx_t_12);
  21522. __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_6); __pyx_t_6 = NULL;
  21523. __Pyx_GIVEREF(__pyx_t_2);
  21524. PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_2);
  21525. __pyx_t_2 = 0;
  21526. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_12, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1539, __pyx_L12_error)
  21527. __Pyx_GOTREF(__pyx_t_7);
  21528. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  21529. }
  21530. }
  21531. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  21532. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  21533. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1540
  21534. * while True:
  21535. * logger.debug('ret_offset: {}'.format(ret_offset))
  21536. * logger.debug(f'Page size: {data_v.mv_size}') # <<<<<<<<<<<<<<
  21537. * #logger.debug(
  21538. * # 'Got data in 1bound ({}): {}'.format(
  21539. */
  21540. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1540, __pyx_L12_error)
  21541. __Pyx_GOTREF(__pyx_t_1);
  21542. __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_debug); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1540, __pyx_L12_error)
  21543. __Pyx_GOTREF(__pyx_t_12);
  21544. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  21545. __pyx_t_1 = __Pyx_PyUnicode_From_size_t(__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v.mv_size, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1540, __pyx_L12_error)
  21546. __Pyx_GOTREF(__pyx_t_1);
  21547. __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Page_size, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1540, __pyx_L12_error)
  21548. __Pyx_GOTREF(__pyx_t_2);
  21549. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  21550. __pyx_t_1 = NULL;
  21551. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
  21552. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_12);
  21553. if (likely(__pyx_t_1)) {
  21554. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
  21555. __Pyx_INCREF(__pyx_t_1);
  21556. __Pyx_INCREF(function);
  21557. __Pyx_DECREF_SET(__pyx_t_12, function);
  21558. }
  21559. }
  21560. if (!__pyx_t_1) {
  21561. __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1540, __pyx_L12_error)
  21562. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21563. __Pyx_GOTREF(__pyx_t_7);
  21564. } else {
  21565. #if CYTHON_FAST_PYCALL
  21566. if (PyFunction_Check(__pyx_t_12)) {
  21567. PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_2};
  21568. __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1540, __pyx_L12_error)
  21569. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  21570. __Pyx_GOTREF(__pyx_t_7);
  21571. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21572. } else
  21573. #endif
  21574. #if CYTHON_FAST_PYCCALL
  21575. if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
  21576. PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_2};
  21577. __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1540, __pyx_L12_error)
  21578. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  21579. __Pyx_GOTREF(__pyx_t_7);
  21580. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21581. } else
  21582. #endif
  21583. {
  21584. __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1540, __pyx_L12_error)
  21585. __Pyx_GOTREF(__pyx_t_6);
  21586. __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __pyx_t_1 = NULL;
  21587. __Pyx_GIVEREF(__pyx_t_2);
  21588. PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_2);
  21589. __pyx_t_2 = 0;
  21590. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1540, __pyx_L12_error)
  21591. __Pyx_GOTREF(__pyx_t_7);
  21592. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  21593. }
  21594. }
  21595. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  21596. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  21597. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1545
  21598. * # data_v.mv_size,
  21599. * # (<unsigned char *>data_v.mv_data)[: data_v.mv_size]))
  21600. * for j in prange(data_v.mv_size // DBL_KLEN, nogil=True): # <<<<<<<<<<<<<<
  21601. * src_pos = DBL_KLEN * j
  21602. * ret_pos = (ret_offset + ret.itemsize * j)
  21603. */
  21604. {
  21605. #ifdef WITH_THREAD
  21606. PyThreadState *_save;
  21607. Py_UNBLOCK_THREADS
  21608. __Pyx_FastGIL_Remember();
  21609. #endif
  21610. /*try:*/ {
  21611. __pyx_t_18 = (__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v.mv_size / 10);
  21612. if (1 == 0) abort();
  21613. {
  21614. #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
  21615. #undef likely
  21616. #undef unlikely
  21617. #define likely(x) (x)
  21618. #define unlikely(x) (x)
  21619. #endif
  21620. __pyx_t_20 = (__pyx_t_18 - 0 + 1 - 1/abs(1)) / 1;
  21621. if (__pyx_t_20 > 0)
  21622. {
  21623. #ifdef _OPENMP
  21624. #pragma omp parallel
  21625. #endif /* _OPENMP */
  21626. {
  21627. #ifdef _OPENMP
  21628. #pragma omp for firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_ret_pos) lastprivate(__pyx_v_src_pos)
  21629. #endif /* _OPENMP */
  21630. for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_20; __pyx_t_19++){
  21631. {
  21632. __pyx_v_j = (size_t)(0 + 1 * __pyx_t_19);
  21633. /* Initialize private variables to invalid values */
  21634. __pyx_v_ret_pos = ((size_t)0xbad0bad0);
  21635. __pyx_v_src_pos = ((size_t)0xbad0bad0);
  21636. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1546
  21637. * # (<unsigned char *>data_v.mv_data)[: data_v.mv_size]))
  21638. * for j in prange(data_v.mv_size // DBL_KLEN, nogil=True):
  21639. * src_pos = DBL_KLEN * j # <<<<<<<<<<<<<<
  21640. * ret_pos = (ret_offset + ret.itemsize * j)
  21641. * memcpy(ret.data + ret_pos + asm_rng[0], luk, KLEN)
  21642. */
  21643. __pyx_v_src_pos = (10 * __pyx_v_j);
  21644. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1547
  21645. * for j in prange(data_v.mv_size // DBL_KLEN, nogil=True):
  21646. * src_pos = DBL_KLEN * j
  21647. * ret_pos = (ret_offset + ret.itemsize * j) # <<<<<<<<<<<<<<
  21648. * memcpy(ret.data + ret_pos + asm_rng[0], luk, KLEN)
  21649. * memcpy(ret.data + ret_pos + asm_rng[1],
  21650. */
  21651. __pyx_v_ret_pos = (__pyx_v_ret_offset + (__pyx_v_ret->itemsize * __pyx_v_j));
  21652. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1548
  21653. * src_pos = DBL_KLEN * j
  21654. * ret_pos = (ret_offset + ret.itemsize * j)
  21655. * memcpy(ret.data + ret_pos + asm_rng[0], luk, KLEN) # <<<<<<<<<<<<<<
  21656. * memcpy(ret.data + ret_pos + asm_rng[1],
  21657. * data_v.mv_data + src_pos, KLEN)
  21658. */
  21659. (void)(memcpy(((__pyx_v_ret->data + __pyx_v_ret_pos) + (__pyx_v_asm_rng[0])), __pyx_v_luk, 5));
  21660. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1549
  21661. * ret_pos = (ret_offset + ret.itemsize * j)
  21662. * memcpy(ret.data + ret_pos + asm_rng[0], luk, KLEN)
  21663. * memcpy(ret.data + ret_pos + asm_rng[1], # <<<<<<<<<<<<<<
  21664. * data_v.mv_data + src_pos, KLEN)
  21665. * memcpy(ret.data + ret_pos + asm_rng[2],
  21666. */
  21667. (void)(memcpy(((__pyx_v_ret->data + __pyx_v_ret_pos) + (__pyx_v_asm_rng[1])), (__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v.mv_data + __pyx_v_src_pos), 5));
  21668. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1551
  21669. * memcpy(ret.data + ret_pos + asm_rng[1],
  21670. * data_v.mv_data + src_pos, KLEN)
  21671. * memcpy(ret.data + ret_pos + asm_rng[2], # <<<<<<<<<<<<<<
  21672. * data_v.mv_data + src_pos + KLEN, KLEN)
  21673. *
  21674. */
  21675. (void)(memcpy(((__pyx_v_ret->data + __pyx_v_ret_pos) + (__pyx_v_asm_rng[2])), ((__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v.mv_data + __pyx_v_src_pos) + 5), 5));
  21676. }
  21677. }
  21678. }
  21679. }
  21680. }
  21681. #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
  21682. #undef likely
  21683. #undef unlikely
  21684. #define likely(x) __builtin_expect(!!(x), 1)
  21685. #define unlikely(x) __builtin_expect(!!(x), 0)
  21686. #endif
  21687. }
  21688. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1545
  21689. * # data_v.mv_size,
  21690. * # (<unsigned char *>data_v.mv_data)[: data_v.mv_size]))
  21691. * for j in prange(data_v.mv_size // DBL_KLEN, nogil=True): # <<<<<<<<<<<<<<
  21692. * src_pos = DBL_KLEN * j
  21693. * ret_pos = (ret_offset + ret.itemsize * j)
  21694. */
  21695. /*finally:*/ {
  21696. /*normal exit:*/{
  21697. #ifdef WITH_THREAD
  21698. __Pyx_FastGIL_Forget();
  21699. Py_BLOCK_THREADS
  21700. #endif
  21701. goto __pyx_L20;
  21702. }
  21703. __pyx_L20:;
  21704. }
  21705. }
  21706. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1557
  21707. * # data_v.mv_size will be overwritten with the *next* page size
  21708. * # and cause corruption in the output data.
  21709. * ret_offset += data_v.mv_size // DBL_KLEN * ret.itemsize # <<<<<<<<<<<<<<
  21710. *
  21711. * try:
  21712. */
  21713. __pyx_v_ret_offset = (__pyx_v_ret_offset + ((__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v.mv_size / 10) * __pyx_v_ret->itemsize));
  21714. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1559
  21715. * ret_offset += data_v.mv_size // DBL_KLEN * ret.itemsize
  21716. *
  21717. * try: # <<<<<<<<<<<<<<
  21718. * # Get results by the page.
  21719. * _check(lmdb.mdb_cursor_get(
  21720. */
  21721. {
  21722. __Pyx_PyThreadState_declare
  21723. __Pyx_PyThreadState_assign
  21724. __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
  21725. __Pyx_XGOTREF(__pyx_t_10);
  21726. __Pyx_XGOTREF(__pyx_t_9);
  21727. __Pyx_XGOTREF(__pyx_t_8);
  21728. /*try:*/ {
  21729. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1561
  21730. * try:
  21731. * # Get results by the page.
  21732. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  21733. * icur, &key_v, &data_v, lmdb.MDB_NEXT_MULTIPLE))
  21734. * except KeyNotFoundError:
  21735. */
  21736. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_icur, (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v), (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v), MDB_NEXT_MULTIPLE), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1561, __pyx_L27_error)
  21737. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1559
  21738. * ret_offset += data_v.mv_size // DBL_KLEN * ret.itemsize
  21739. *
  21740. * try: # <<<<<<<<<<<<<<
  21741. * # Get results by the page.
  21742. * _check(lmdb.mdb_cursor_get(
  21743. */
  21744. }
  21745. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  21746. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  21747. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  21748. goto __pyx_L34_try_end;
  21749. __pyx_L27_error:;
  21750. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  21751. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  21752. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  21753. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  21754. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  21755. __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  21756. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  21757. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1563
  21758. * _check(lmdb.mdb_cursor_get(
  21759. * icur, &key_v, &data_v, lmdb.MDB_NEXT_MULTIPLE))
  21760. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  21761. * # For testing only. Errors will be caught in triples()
  21762. * # when looking for a context.
  21763. */
  21764. __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_12, &__pyx_t_6);
  21765. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1563, __pyx_L29_except_error)
  21766. __Pyx_GOTREF(__pyx_t_2);
  21767. __pyx_t_11 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_7, __pyx_t_2);
  21768. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21769. __Pyx_ErrRestore(__pyx_t_7, __pyx_t_12, __pyx_t_6);
  21770. __pyx_t_7 = 0; __pyx_t_12 = 0; __pyx_t_6 = 0;
  21771. if (__pyx_t_11) {
  21772. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._lookup_1bound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  21773. if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_12, &__pyx_t_7) < 0) __PYX_ERR(0, 1563, __pyx_L29_except_error)
  21774. __Pyx_GOTREF(__pyx_t_6);
  21775. __Pyx_GOTREF(__pyx_t_12);
  21776. __Pyx_GOTREF(__pyx_t_7);
  21777. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1570
  21778. * # 'Retrieved less values than expected: {} of {}.'
  21779. * # .format(src_offset, ret.size))
  21780. * return ret # <<<<<<<<<<<<<<
  21781. *
  21782. * #logger.debug('Assembled data in 1bound ({}): {}'.format(ret.size, ret.data[: ret.size]))
  21783. */
  21784. __Pyx_XDECREF(((PyObject *)__pyx_r));
  21785. __Pyx_INCREF(((PyObject *)__pyx_v_ret));
  21786. __pyx_r = __pyx_v_ret;
  21787. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  21788. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  21789. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  21790. goto __pyx_L30_except_return;
  21791. }
  21792. goto __pyx_L29_except_error;
  21793. __pyx_L29_except_error:;
  21794. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1559
  21795. * ret_offset += data_v.mv_size // DBL_KLEN * ret.itemsize
  21796. *
  21797. * try: # <<<<<<<<<<<<<<
  21798. * # Get results by the page.
  21799. * _check(lmdb.mdb_cursor_get(
  21800. */
  21801. __Pyx_XGIVEREF(__pyx_t_10);
  21802. __Pyx_XGIVEREF(__pyx_t_9);
  21803. __Pyx_XGIVEREF(__pyx_t_8);
  21804. __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_9, __pyx_t_8);
  21805. goto __pyx_L12_error;
  21806. __pyx_L30_except_return:;
  21807. __Pyx_XGIVEREF(__pyx_t_10);
  21808. __Pyx_XGIVEREF(__pyx_t_9);
  21809. __Pyx_XGIVEREF(__pyx_t_8);
  21810. __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_9, __pyx_t_8);
  21811. goto __pyx_L11_return;
  21812. __pyx_L34_try_end:;
  21813. }
  21814. }
  21815. }
  21816. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1574
  21817. * #logger.debug('Assembled data in 1bound ({}): {}'.format(ret.size, ret.data[: ret.size]))
  21818. * finally:
  21819. * self._cur_close(icur) # <<<<<<<<<<<<<<
  21820. *
  21821. *
  21822. */
  21823. /*finally:*/ {
  21824. /*normal exit:*/{
  21825. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_icur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1574, __pyx_L1_error)
  21826. goto __pyx_L13;
  21827. }
  21828. __pyx_L12_error:;
  21829. /*exception exit:*/{
  21830. __Pyx_PyThreadState_declare
  21831. __Pyx_PyThreadState_assign
  21832. __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0;
  21833. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  21834. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  21835. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  21836. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  21837. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  21838. __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  21839. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  21840. if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_23, &__pyx_t_24, &__pyx_t_25);
  21841. if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
  21842. __Pyx_XGOTREF(__pyx_t_8);
  21843. __Pyx_XGOTREF(__pyx_t_9);
  21844. __Pyx_XGOTREF(__pyx_t_10);
  21845. __Pyx_XGOTREF(__pyx_t_23);
  21846. __Pyx_XGOTREF(__pyx_t_24);
  21847. __Pyx_XGOTREF(__pyx_t_25);
  21848. __pyx_t_11 = __pyx_lineno; __pyx_t_21 = __pyx_clineno; __pyx_t_22 = __pyx_filename;
  21849. {
  21850. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_icur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1574, __pyx_L38_error)
  21851. }
  21852. if (PY_MAJOR_VERSION >= 3) {
  21853. __Pyx_XGIVEREF(__pyx_t_23);
  21854. __Pyx_XGIVEREF(__pyx_t_24);
  21855. __Pyx_XGIVEREF(__pyx_t_25);
  21856. __Pyx_ExceptionReset(__pyx_t_23, __pyx_t_24, __pyx_t_25);
  21857. }
  21858. __Pyx_XGIVEREF(__pyx_t_8);
  21859. __Pyx_XGIVEREF(__pyx_t_9);
  21860. __Pyx_XGIVEREF(__pyx_t_10);
  21861. __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
  21862. __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0;
  21863. __pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_21; __pyx_filename = __pyx_t_22;
  21864. goto __pyx_L1_error;
  21865. __pyx_L38_error:;
  21866. if (PY_MAJOR_VERSION >= 3) {
  21867. __Pyx_XGIVEREF(__pyx_t_23);
  21868. __Pyx_XGIVEREF(__pyx_t_24);
  21869. __Pyx_XGIVEREF(__pyx_t_25);
  21870. __Pyx_ExceptionReset(__pyx_t_23, __pyx_t_24, __pyx_t_25);
  21871. }
  21872. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  21873. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  21874. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  21875. __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0;
  21876. goto __pyx_L1_error;
  21877. }
  21878. __pyx_L11_return: {
  21879. __pyx_t_26 = __pyx_r;
  21880. __pyx_r = 0;
  21881. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_icur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1574, __pyx_L1_error)
  21882. __pyx_r = __pyx_t_26;
  21883. __pyx_t_26 = 0;
  21884. goto __pyx_L0;
  21885. }
  21886. __pyx_L13:;
  21887. }
  21888. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1481
  21889. *
  21890. *
  21891. * cdef ResultSet _lookup_1bound(self, unsigned char idx, term): # <<<<<<<<<<<<<<
  21892. * """
  21893. * Lookup triples for a pattern with one bound term.
  21894. */
  21895. /* function exit code */
  21896. __pyx_r = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)Py_None); __Pyx_INCREF(Py_None);
  21897. goto __pyx_L0;
  21898. __pyx_L1_error:;
  21899. __Pyx_XDECREF(__pyx_t_1);
  21900. __Pyx_XDECREF(__pyx_t_2);
  21901. __Pyx_XDECREF(__pyx_t_3);
  21902. __Pyx_XDECREF(__pyx_t_6);
  21903. __Pyx_XDECREF(__pyx_t_7);
  21904. __Pyx_XDECREF(__pyx_t_12);
  21905. __Pyx_XDECREF(__pyx_t_13);
  21906. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._lookup_1bound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  21907. __pyx_r = 0;
  21908. __pyx_L0:;
  21909. __Pyx_XDECREF((PyObject *)__pyx_v_ret);
  21910. __Pyx_XGIVEREF((PyObject *)__pyx_r);
  21911. __Pyx_TraceReturn(__pyx_r, 0);
  21912. __Pyx_RefNannyFinishContext();
  21913. return __pyx_r;
  21914. }
  21915. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1577
  21916. *
  21917. *
  21918. * cdef ResultSet _lookup_2bound( # <<<<<<<<<<<<<<
  21919. * self, unsigned char idx1, term1, unsigned char idx2, term2):
  21920. * """
  21921. */
  21922. static struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__lookup_2bound(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, unsigned char __pyx_v_idx1, PyObject *__pyx_v_term1, unsigned char __pyx_v_idx2, PyObject *__pyx_v_term2) {
  21923. unsigned char __pyx_v_luk1_offset;
  21924. unsigned char __pyx_v_luk2_offset;
  21925. unsigned char __pyx_v_luk1[5];
  21926. unsigned char __pyx_v_luk2[5];
  21927. unsigned char __pyx_v_luk[10];
  21928. unsigned char __pyx_v_asm_rng[3];
  21929. unsigned char __pyx_v_term_order[3];
  21930. size_t __pyx_v_ct;
  21931. size_t __pyx_v_i;
  21932. size_t __pyx_v_ret_offset;
  21933. size_t __pyx_v_ret_pos;
  21934. size_t __pyx_v_src_pos;
  21935. size_t __pyx_v_j;
  21936. MDB_cursor *__pyx_v_icur;
  21937. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_ret = 0;
  21938. PyObject *__pyx_v_dblabel = NULL;
  21939. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_r = NULL;
  21940. __Pyx_TraceDeclarations
  21941. __Pyx_RefNannyDeclarations
  21942. PyObject *__pyx_t_1 = NULL;
  21943. PyObject *__pyx_t_2 = NULL;
  21944. PyObject *__pyx_t_3 = NULL;
  21945. Py_ssize_t __pyx_t_4;
  21946. Py_UCS4 __pyx_t_5;
  21947. PyObject *__pyx_t_6 = NULL;
  21948. PyObject *__pyx_t_7 = NULL;
  21949. PyObject *__pyx_t_8 = NULL;
  21950. PyObject *__pyx_t_9 = NULL;
  21951. PyObject *__pyx_t_10 = NULL;
  21952. int __pyx_t_11;
  21953. PyObject *__pyx_t_12 = NULL;
  21954. PyObject *__pyx_t_13 = NULL;
  21955. size_t __pyx_t_14;
  21956. int __pyx_t_15;
  21957. int __pyx_t_16;
  21958. size_t __pyx_t_17;
  21959. PyObject *__pyx_t_18 = NULL;
  21960. unsigned char *__pyx_t_19;
  21961. MDB_cursor *__pyx_t_20;
  21962. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__cur_open __pyx_t_21;
  21963. unsigned char __pyx_t_22[3];
  21964. size_t __pyx_t_23;
  21965. int __pyx_t_24;
  21966. char const *__pyx_t_25;
  21967. PyObject *__pyx_t_26 = NULL;
  21968. PyObject *__pyx_t_27 = NULL;
  21969. PyObject *__pyx_t_28 = NULL;
  21970. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_t_29 = NULL;
  21971. __Pyx_RefNannySetupContext("_lookup_2bound", 0);
  21972. __Pyx_TraceCall("_lookup_2bound", __pyx_f[0], 1577, 0, __PYX_ERR(0, 1577, __pyx_L1_error));
  21973. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1597
  21974. * unsigned char asm_rng[3]
  21975. * unsigned char term_order[3] # Lookup ordering
  21976. * size_t ct, i = 0, ret_offset = 0, ret_pos, src_pos # <<<<<<<<<<<<<<
  21977. * size_t j # Must be signed for older OpenMP versions
  21978. * lmdb.MDB_cursor *icur
  21979. */
  21980. __pyx_v_i = 0;
  21981. __pyx_v_ret_offset = 0;
  21982. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1602
  21983. * ResultSet ret
  21984. *
  21985. * logging.debug( # <<<<<<<<<<<<<<
  21986. * f'2bound lookup for term {term1} at position {idx1} '
  21987. * f'and term {term2} at position {idx2}.')
  21988. */
  21989. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1602, __pyx_L1_error)
  21990. __Pyx_GOTREF(__pyx_t_2);
  21991. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1602, __pyx_L1_error)
  21992. __Pyx_GOTREF(__pyx_t_3);
  21993. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21994. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1603
  21995. *
  21996. * logging.debug(
  21997. * f'2bound lookup for term {term1} at position {idx1} ' # <<<<<<<<<<<<<<
  21998. * f'and term {term2} at position {idx2}.')
  21999. * try:
  22000. */
  22001. __pyx_t_2 = PyTuple_New(9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1603, __pyx_L1_error)
  22002. __Pyx_GOTREF(__pyx_t_2);
  22003. __pyx_t_4 = 0;
  22004. __pyx_t_5 = 127;
  22005. __Pyx_INCREF(__pyx_kp_u_2bound_lookup_for_term);
  22006. __pyx_t_4 += 23;
  22007. __Pyx_GIVEREF(__pyx_kp_u_2bound_lookup_for_term);
  22008. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_2bound_lookup_for_term);
  22009. __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_term1, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1603, __pyx_L1_error)
  22010. __Pyx_GOTREF(__pyx_t_6);
  22011. __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
  22012. __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
  22013. __Pyx_GIVEREF(__pyx_t_6);
  22014. PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6);
  22015. __pyx_t_6 = 0;
  22016. __Pyx_INCREF(__pyx_kp_u_at_position);
  22017. __pyx_t_4 += 13;
  22018. __Pyx_GIVEREF(__pyx_kp_u_at_position);
  22019. PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_at_position);
  22020. __pyx_t_6 = __Pyx_PyUnicode_From_unsigned_char(__pyx_v_idx1, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1603, __pyx_L1_error)
  22021. __Pyx_GOTREF(__pyx_t_6);
  22022. __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
  22023. __Pyx_GIVEREF(__pyx_t_6);
  22024. PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_6);
  22025. __pyx_t_6 = 0;
  22026. __Pyx_INCREF(__pyx_kp_u_and_term);
  22027. __pyx_t_4 += 10;
  22028. __Pyx_GIVEREF(__pyx_kp_u_and_term);
  22029. PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_kp_u_and_term);
  22030. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1604
  22031. * logging.debug(
  22032. * f'2bound lookup for term {term1} at position {idx1} '
  22033. * f'and term {term2} at position {idx2}.') # <<<<<<<<<<<<<<
  22034. * try:
  22035. * self._to_key(term1, &luk1)
  22036. */
  22037. __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_term2, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1604, __pyx_L1_error)
  22038. __Pyx_GOTREF(__pyx_t_6);
  22039. __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
  22040. __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
  22041. __Pyx_GIVEREF(__pyx_t_6);
  22042. PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_t_6);
  22043. __pyx_t_6 = 0;
  22044. __Pyx_INCREF(__pyx_kp_u_at_position);
  22045. __pyx_t_4 += 13;
  22046. __Pyx_GIVEREF(__pyx_kp_u_at_position);
  22047. PyTuple_SET_ITEM(__pyx_t_2, 6, __pyx_kp_u_at_position);
  22048. __pyx_t_6 = __Pyx_PyUnicode_From_unsigned_char(__pyx_v_idx2, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1604, __pyx_L1_error)
  22049. __Pyx_GOTREF(__pyx_t_6);
  22050. __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
  22051. __Pyx_GIVEREF(__pyx_t_6);
  22052. PyTuple_SET_ITEM(__pyx_t_2, 7, __pyx_t_6);
  22053. __pyx_t_6 = 0;
  22054. __Pyx_INCREF(__pyx_kp_u__11);
  22055. __pyx_t_4 += 1;
  22056. __Pyx_GIVEREF(__pyx_kp_u__11);
  22057. PyTuple_SET_ITEM(__pyx_t_2, 8, __pyx_kp_u__11);
  22058. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1603
  22059. *
  22060. * logging.debug(
  22061. * f'2bound lookup for term {term1} at position {idx1} ' # <<<<<<<<<<<<<<
  22062. * f'and term {term2} at position {idx2}.')
  22063. * try:
  22064. */
  22065. __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_2, 9, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1603, __pyx_L1_error)
  22066. __Pyx_GOTREF(__pyx_t_6);
  22067. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  22068. __pyx_t_2 = NULL;
  22069. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  22070. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  22071. if (likely(__pyx_t_2)) {
  22072. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  22073. __Pyx_INCREF(__pyx_t_2);
  22074. __Pyx_INCREF(function);
  22075. __Pyx_DECREF_SET(__pyx_t_3, function);
  22076. }
  22077. }
  22078. if (!__pyx_t_2) {
  22079. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1602, __pyx_L1_error)
  22080. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  22081. __Pyx_GOTREF(__pyx_t_1);
  22082. } else {
  22083. #if CYTHON_FAST_PYCALL
  22084. if (PyFunction_Check(__pyx_t_3)) {
  22085. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_6};
  22086. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1602, __pyx_L1_error)
  22087. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  22088. __Pyx_GOTREF(__pyx_t_1);
  22089. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  22090. } else
  22091. #endif
  22092. #if CYTHON_FAST_PYCCALL
  22093. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  22094. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_6};
  22095. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1602, __pyx_L1_error)
  22096. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  22097. __Pyx_GOTREF(__pyx_t_1);
  22098. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  22099. } else
  22100. #endif
  22101. {
  22102. __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1602, __pyx_L1_error)
  22103. __Pyx_GOTREF(__pyx_t_7);
  22104. __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL;
  22105. __Pyx_GIVEREF(__pyx_t_6);
  22106. PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_6);
  22107. __pyx_t_6 = 0;
  22108. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1602, __pyx_L1_error)
  22109. __Pyx_GOTREF(__pyx_t_1);
  22110. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  22111. }
  22112. }
  22113. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22114. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  22115. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1605
  22116. * f'2bound lookup for term {term1} at position {idx1} '
  22117. * f'and term {term2} at position {idx2}.')
  22118. * try: # <<<<<<<<<<<<<<
  22119. * self._to_key(term1, &luk1)
  22120. * self._to_key(term2, &luk2)
  22121. */
  22122. {
  22123. __Pyx_PyThreadState_declare
  22124. __Pyx_PyThreadState_assign
  22125. __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
  22126. __Pyx_XGOTREF(__pyx_t_8);
  22127. __Pyx_XGOTREF(__pyx_t_9);
  22128. __Pyx_XGOTREF(__pyx_t_10);
  22129. /*try:*/ {
  22130. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1606
  22131. * f'and term {term2} at position {idx2}.')
  22132. * try:
  22133. * self._to_key(term1, &luk1) # <<<<<<<<<<<<<<
  22134. * self._to_key(term2, &luk2)
  22135. * except KeyNotFoundError:
  22136. */
  22137. __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__to_key(__pyx_v_self, __pyx_v_term1, (&__pyx_v_luk1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1606, __pyx_L3_error)
  22138. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1607
  22139. * try:
  22140. * self._to_key(term1, &luk1)
  22141. * self._to_key(term2, &luk2) # <<<<<<<<<<<<<<
  22142. * except KeyNotFoundError:
  22143. * return ResultSet(0, TRP_KLEN)
  22144. */
  22145. __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__to_key(__pyx_v_self, __pyx_v_term2, (&__pyx_v_luk2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1607, __pyx_L3_error)
  22146. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1605
  22147. * f'2bound lookup for term {term1} at position {idx1} '
  22148. * f'and term {term2} at position {idx2}.')
  22149. * try: # <<<<<<<<<<<<<<
  22150. * self._to_key(term1, &luk1)
  22151. * self._to_key(term2, &luk2)
  22152. */
  22153. }
  22154. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  22155. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  22156. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  22157. goto __pyx_L8_try_end;
  22158. __pyx_L3_error:;
  22159. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  22160. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  22161. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  22162. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  22163. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  22164. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1608
  22165. * self._to_key(term1, &luk1)
  22166. * self._to_key(term2, &luk2)
  22167. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  22168. * return ResultSet(0, TRP_KLEN)
  22169. * logging.debug('luk1: {}'.format(luk1[: KLEN]))
  22170. */
  22171. __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_3, &__pyx_t_7);
  22172. __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1608, __pyx_L5_except_error)
  22173. __Pyx_GOTREF(__pyx_t_6);
  22174. __pyx_t_11 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
  22175. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  22176. __Pyx_ErrRestore(__pyx_t_1, __pyx_t_3, __pyx_t_7);
  22177. __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_7 = 0;
  22178. if (__pyx_t_11) {
  22179. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._lookup_2bound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  22180. if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_3, &__pyx_t_1) < 0) __PYX_ERR(0, 1608, __pyx_L5_except_error)
  22181. __Pyx_GOTREF(__pyx_t_7);
  22182. __Pyx_GOTREF(__pyx_t_3);
  22183. __Pyx_GOTREF(__pyx_t_1);
  22184. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1609
  22185. * self._to_key(term2, &luk2)
  22186. * except KeyNotFoundError:
  22187. * return ResultSet(0, TRP_KLEN) # <<<<<<<<<<<<<<
  22188. * logging.debug('luk1: {}'.format(luk1[: KLEN]))
  22189. * logging.debug('luk2: {}'.format(luk2[: KLEN]))
  22190. */
  22191. __Pyx_XDECREF(((PyObject *)__pyx_r));
  22192. __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet), __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1609, __pyx_L5_except_error)
  22193. __Pyx_GOTREF(__pyx_t_6);
  22194. __pyx_r = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_6);
  22195. __pyx_t_6 = 0;
  22196. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  22197. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22198. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  22199. goto __pyx_L6_except_return;
  22200. }
  22201. goto __pyx_L5_except_error;
  22202. __pyx_L5_except_error:;
  22203. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1605
  22204. * f'2bound lookup for term {term1} at position {idx1} '
  22205. * f'and term {term2} at position {idx2}.')
  22206. * try: # <<<<<<<<<<<<<<
  22207. * self._to_key(term1, &luk1)
  22208. * self._to_key(term2, &luk2)
  22209. */
  22210. __Pyx_XGIVEREF(__pyx_t_8);
  22211. __Pyx_XGIVEREF(__pyx_t_9);
  22212. __Pyx_XGIVEREF(__pyx_t_10);
  22213. __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
  22214. goto __pyx_L1_error;
  22215. __pyx_L6_except_return:;
  22216. __Pyx_XGIVEREF(__pyx_t_8);
  22217. __Pyx_XGIVEREF(__pyx_t_9);
  22218. __Pyx_XGIVEREF(__pyx_t_10);
  22219. __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
  22220. goto __pyx_L0;
  22221. __pyx_L8_try_end:;
  22222. }
  22223. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1610
  22224. * except KeyNotFoundError:
  22225. * return ResultSet(0, TRP_KLEN)
  22226. * logging.debug('luk1: {}'.format(luk1[: KLEN])) # <<<<<<<<<<<<<<
  22227. * logging.debug('luk2: {}'.format(luk2[: KLEN]))
  22228. *
  22229. */
  22230. __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1610, __pyx_L1_error)
  22231. __Pyx_GOTREF(__pyx_t_3);
  22232. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1610, __pyx_L1_error)
  22233. __Pyx_GOTREF(__pyx_t_7);
  22234. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22235. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_luk1, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1610, __pyx_L1_error)
  22236. __Pyx_GOTREF(__pyx_t_6);
  22237. __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_luk1) + 0, 5 - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1610, __pyx_L1_error)
  22238. __Pyx_GOTREF(__pyx_t_2);
  22239. __pyx_t_12 = NULL;
  22240. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
  22241. __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_6);
  22242. if (likely(__pyx_t_12)) {
  22243. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
  22244. __Pyx_INCREF(__pyx_t_12);
  22245. __Pyx_INCREF(function);
  22246. __Pyx_DECREF_SET(__pyx_t_6, function);
  22247. }
  22248. }
  22249. if (!__pyx_t_12) {
  22250. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1610, __pyx_L1_error)
  22251. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  22252. __Pyx_GOTREF(__pyx_t_3);
  22253. } else {
  22254. #if CYTHON_FAST_PYCALL
  22255. if (PyFunction_Check(__pyx_t_6)) {
  22256. PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_t_2};
  22257. __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1610, __pyx_L1_error)
  22258. __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  22259. __Pyx_GOTREF(__pyx_t_3);
  22260. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  22261. } else
  22262. #endif
  22263. #if CYTHON_FAST_PYCCALL
  22264. if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
  22265. PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_t_2};
  22266. __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1610, __pyx_L1_error)
  22267. __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  22268. __Pyx_GOTREF(__pyx_t_3);
  22269. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  22270. } else
  22271. #endif
  22272. {
  22273. __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1610, __pyx_L1_error)
  22274. __Pyx_GOTREF(__pyx_t_13);
  22275. __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __pyx_t_12 = NULL;
  22276. __Pyx_GIVEREF(__pyx_t_2);
  22277. PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_2);
  22278. __pyx_t_2 = 0;
  22279. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1610, __pyx_L1_error)
  22280. __Pyx_GOTREF(__pyx_t_3);
  22281. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  22282. }
  22283. }
  22284. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  22285. __pyx_t_6 = NULL;
  22286. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
  22287. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
  22288. if (likely(__pyx_t_6)) {
  22289. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
  22290. __Pyx_INCREF(__pyx_t_6);
  22291. __Pyx_INCREF(function);
  22292. __Pyx_DECREF_SET(__pyx_t_7, function);
  22293. }
  22294. }
  22295. if (!__pyx_t_6) {
  22296. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1610, __pyx_L1_error)
  22297. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22298. __Pyx_GOTREF(__pyx_t_1);
  22299. } else {
  22300. #if CYTHON_FAST_PYCALL
  22301. if (PyFunction_Check(__pyx_t_7)) {
  22302. PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_3};
  22303. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1610, __pyx_L1_error)
  22304. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  22305. __Pyx_GOTREF(__pyx_t_1);
  22306. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22307. } else
  22308. #endif
  22309. #if CYTHON_FAST_PYCCALL
  22310. if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
  22311. PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_3};
  22312. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1610, __pyx_L1_error)
  22313. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  22314. __Pyx_GOTREF(__pyx_t_1);
  22315. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22316. } else
  22317. #endif
  22318. {
  22319. __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1610, __pyx_L1_error)
  22320. __Pyx_GOTREF(__pyx_t_13);
  22321. __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_6); __pyx_t_6 = NULL;
  22322. __Pyx_GIVEREF(__pyx_t_3);
  22323. PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_3);
  22324. __pyx_t_3 = 0;
  22325. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1610, __pyx_L1_error)
  22326. __Pyx_GOTREF(__pyx_t_1);
  22327. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  22328. }
  22329. }
  22330. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  22331. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  22332. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1611
  22333. * return ResultSet(0, TRP_KLEN)
  22334. * logging.debug('luk1: {}'.format(luk1[: KLEN]))
  22335. * logging.debug('luk2: {}'.format(luk2[: KLEN])) # <<<<<<<<<<<<<<
  22336. *
  22337. * for i in range(3):
  22338. */
  22339. __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1611, __pyx_L1_error)
  22340. __Pyx_GOTREF(__pyx_t_7);
  22341. __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_debug); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1611, __pyx_L1_error)
  22342. __Pyx_GOTREF(__pyx_t_13);
  22343. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  22344. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_luk2, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1611, __pyx_L1_error)
  22345. __Pyx_GOTREF(__pyx_t_3);
  22346. __pyx_t_6 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_luk2) + 0, 5 - 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1611, __pyx_L1_error)
  22347. __Pyx_GOTREF(__pyx_t_6);
  22348. __pyx_t_2 = NULL;
  22349. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
  22350. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  22351. if (likely(__pyx_t_2)) {
  22352. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  22353. __Pyx_INCREF(__pyx_t_2);
  22354. __Pyx_INCREF(function);
  22355. __Pyx_DECREF_SET(__pyx_t_3, function);
  22356. }
  22357. }
  22358. if (!__pyx_t_2) {
  22359. __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1611, __pyx_L1_error)
  22360. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  22361. __Pyx_GOTREF(__pyx_t_7);
  22362. } else {
  22363. #if CYTHON_FAST_PYCALL
  22364. if (PyFunction_Check(__pyx_t_3)) {
  22365. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_6};
  22366. __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1611, __pyx_L1_error)
  22367. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  22368. __Pyx_GOTREF(__pyx_t_7);
  22369. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  22370. } else
  22371. #endif
  22372. #if CYTHON_FAST_PYCCALL
  22373. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  22374. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_6};
  22375. __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1611, __pyx_L1_error)
  22376. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  22377. __Pyx_GOTREF(__pyx_t_7);
  22378. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  22379. } else
  22380. #endif
  22381. {
  22382. __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1611, __pyx_L1_error)
  22383. __Pyx_GOTREF(__pyx_t_12);
  22384. __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_2); __pyx_t_2 = NULL;
  22385. __Pyx_GIVEREF(__pyx_t_6);
  22386. PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_6);
  22387. __pyx_t_6 = 0;
  22388. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_12, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1611, __pyx_L1_error)
  22389. __Pyx_GOTREF(__pyx_t_7);
  22390. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  22391. }
  22392. }
  22393. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22394. __pyx_t_3 = NULL;
  22395. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
  22396. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_13);
  22397. if (likely(__pyx_t_3)) {
  22398. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
  22399. __Pyx_INCREF(__pyx_t_3);
  22400. __Pyx_INCREF(function);
  22401. __Pyx_DECREF_SET(__pyx_t_13, function);
  22402. }
  22403. }
  22404. if (!__pyx_t_3) {
  22405. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1611, __pyx_L1_error)
  22406. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  22407. __Pyx_GOTREF(__pyx_t_1);
  22408. } else {
  22409. #if CYTHON_FAST_PYCALL
  22410. if (PyFunction_Check(__pyx_t_13)) {
  22411. PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_7};
  22412. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1611, __pyx_L1_error)
  22413. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  22414. __Pyx_GOTREF(__pyx_t_1);
  22415. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  22416. } else
  22417. #endif
  22418. #if CYTHON_FAST_PYCCALL
  22419. if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
  22420. PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_7};
  22421. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1611, __pyx_L1_error)
  22422. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  22423. __Pyx_GOTREF(__pyx_t_1);
  22424. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  22425. } else
  22426. #endif
  22427. {
  22428. __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1611, __pyx_L1_error)
  22429. __Pyx_GOTREF(__pyx_t_12);
  22430. __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_3); __pyx_t_3 = NULL;
  22431. __Pyx_GIVEREF(__pyx_t_7);
  22432. PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_7);
  22433. __pyx_t_7 = 0;
  22434. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1611, __pyx_L1_error)
  22435. __Pyx_GOTREF(__pyx_t_1);
  22436. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  22437. }
  22438. }
  22439. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  22440. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  22441. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1613
  22442. * logging.debug('luk2: {}'.format(luk2[: KLEN]))
  22443. *
  22444. * for i in range(3): # <<<<<<<<<<<<<<
  22445. * if (
  22446. * idx1 in lookup_ordering_2bound[i][: 2]
  22447. */
  22448. for (__pyx_t_14 = 0; __pyx_t_14 < 3; __pyx_t_14+=1) {
  22449. __pyx_v_i = __pyx_t_14;
  22450. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1615
  22451. * for i in range(3):
  22452. * if (
  22453. * idx1 in lookup_ordering_2bound[i][: 2] # <<<<<<<<<<<<<<
  22454. * and idx2 in lookup_ordering_2bound[i][: 2]):
  22455. * term_order = lookup_ordering_2bound[i]
  22456. */
  22457. __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(((const char*)(__pyx_v_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_lookup_ordering_2bound[__pyx_v_i])) + 0, 2 - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1615, __pyx_L1_error)
  22458. __Pyx_GOTREF(__pyx_t_1);
  22459. __pyx_t_16 = ((__Pyx_BytesContains(__pyx_t_1, __pyx_v_idx1)) != 0);
  22460. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  22461. if (__pyx_t_16) {
  22462. } else {
  22463. __pyx_t_15 = __pyx_t_16;
  22464. goto __pyx_L14_bool_binop_done;
  22465. }
  22466. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1616
  22467. * if (
  22468. * idx1 in lookup_ordering_2bound[i][: 2]
  22469. * and idx2 in lookup_ordering_2bound[i][: 2]): # <<<<<<<<<<<<<<
  22470. * term_order = lookup_ordering_2bound[i]
  22471. * if term_order[0] == idx1:
  22472. */
  22473. __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(((const char*)(__pyx_v_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_lookup_ordering_2bound[__pyx_v_i])) + 0, 2 - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1616, __pyx_L1_error)
  22474. __Pyx_GOTREF(__pyx_t_1);
  22475. __pyx_t_16 = ((__Pyx_BytesContains(__pyx_t_1, __pyx_v_idx2)) != 0);
  22476. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  22477. __pyx_t_15 = __pyx_t_16;
  22478. __pyx_L14_bool_binop_done:;
  22479. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1614
  22480. *
  22481. * for i in range(3):
  22482. * if ( # <<<<<<<<<<<<<<
  22483. * idx1 in lookup_ordering_2bound[i][: 2]
  22484. * and idx2 in lookup_ordering_2bound[i][: 2]):
  22485. */
  22486. if (__pyx_t_15) {
  22487. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1617
  22488. * idx1 in lookup_ordering_2bound[i][: 2]
  22489. * and idx2 in lookup_ordering_2bound[i][: 2]):
  22490. * term_order = lookup_ordering_2bound[i] # <<<<<<<<<<<<<<
  22491. * if term_order[0] == idx1:
  22492. * luk1_offset = 0
  22493. */
  22494. memcpy(&(__pyx_v_term_order[0]), (__pyx_v_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_lookup_ordering_2bound[__pyx_v_i]), sizeof(__pyx_v_term_order[0]) * (3));
  22495. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1618
  22496. * and idx2 in lookup_ordering_2bound[i][: 2]):
  22497. * term_order = lookup_ordering_2bound[i]
  22498. * if term_order[0] == idx1: # <<<<<<<<<<<<<<
  22499. * luk1_offset = 0
  22500. * luk2_offset = KLEN
  22501. */
  22502. __pyx_t_15 = (((__pyx_v_term_order[0]) == __pyx_v_idx1) != 0);
  22503. if (__pyx_t_15) {
  22504. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1619
  22505. * term_order = lookup_ordering_2bound[i]
  22506. * if term_order[0] == idx1:
  22507. * luk1_offset = 0 # <<<<<<<<<<<<<<
  22508. * luk2_offset = KLEN
  22509. * else:
  22510. */
  22511. __pyx_v_luk1_offset = 0;
  22512. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1620
  22513. * if term_order[0] == idx1:
  22514. * luk1_offset = 0
  22515. * luk2_offset = KLEN # <<<<<<<<<<<<<<
  22516. * else:
  22517. * luk1_offset = KLEN
  22518. */
  22519. __pyx_v_luk2_offset = 5;
  22520. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1618
  22521. * and idx2 in lookup_ordering_2bound[i][: 2]):
  22522. * term_order = lookup_ordering_2bound[i]
  22523. * if term_order[0] == idx1: # <<<<<<<<<<<<<<
  22524. * luk1_offset = 0
  22525. * luk2_offset = KLEN
  22526. */
  22527. goto __pyx_L16;
  22528. }
  22529. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1622
  22530. * luk2_offset = KLEN
  22531. * else:
  22532. * luk1_offset = KLEN # <<<<<<<<<<<<<<
  22533. * luk2_offset = 0
  22534. * dblabel = self.lookup_indices[i + 3] # skip 1bound index labels
  22535. */
  22536. /*else*/ {
  22537. __pyx_v_luk1_offset = 5;
  22538. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1623
  22539. * else:
  22540. * luk1_offset = KLEN
  22541. * luk2_offset = 0 # <<<<<<<<<<<<<<
  22542. * dblabel = self.lookup_indices[i + 3] # skip 1bound index labels
  22543. * break
  22544. */
  22545. __pyx_v_luk2_offset = 0;
  22546. }
  22547. __pyx_L16:;
  22548. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1624
  22549. * luk1_offset = KLEN
  22550. * luk2_offset = 0
  22551. * dblabel = self.lookup_indices[i + 3] # skip 1bound index labels # <<<<<<<<<<<<<<
  22552. * break
  22553. *
  22554. */
  22555. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_lookup_indices); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1624, __pyx_L1_error)
  22556. __Pyx_GOTREF(__pyx_t_1);
  22557. __pyx_t_17 = (__pyx_v_i + 3);
  22558. __pyx_t_13 = __Pyx_GetItemInt(__pyx_t_1, __pyx_t_17, size_t, 0, __Pyx_PyInt_FromSize_t, 0, 0, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1624, __pyx_L1_error)
  22559. __Pyx_GOTREF(__pyx_t_13);
  22560. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  22561. __pyx_v_dblabel = __pyx_t_13;
  22562. __pyx_t_13 = 0;
  22563. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1625
  22564. * luk2_offset = 0
  22565. * dblabel = self.lookup_indices[i + 3] # skip 1bound index labels
  22566. * break # <<<<<<<<<<<<<<
  22567. *
  22568. * if i == 2:
  22569. */
  22570. goto __pyx_L12_break;
  22571. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1614
  22572. *
  22573. * for i in range(3):
  22574. * if ( # <<<<<<<<<<<<<<
  22575. * idx1 in lookup_ordering_2bound[i][: 2]
  22576. * and idx2 in lookup_ordering_2bound[i][: 2]):
  22577. */
  22578. }
  22579. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1627
  22580. * break
  22581. *
  22582. * if i == 2: # <<<<<<<<<<<<<<
  22583. * raise ValueError(
  22584. * 'Indices {} and {} not found in LU keys.'.format(
  22585. */
  22586. __pyx_t_15 = ((__pyx_v_i == 2) != 0);
  22587. if (unlikely(__pyx_t_15)) {
  22588. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1629
  22589. * if i == 2:
  22590. * raise ValueError(
  22591. * 'Indices {} and {} not found in LU keys.'.format( # <<<<<<<<<<<<<<
  22592. * idx1, idx2))
  22593. *
  22594. */
  22595. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Indices_and_not_found_in_LU_keys, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1629, __pyx_L1_error)
  22596. __Pyx_GOTREF(__pyx_t_1);
  22597. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1630
  22598. * raise ValueError(
  22599. * 'Indices {} and {} not found in LU keys.'.format(
  22600. * idx1, idx2)) # <<<<<<<<<<<<<<
  22601. *
  22602. * logger.debug('Term order: {}'.format(term_order[:3]))
  22603. */
  22604. __pyx_t_12 = __Pyx_PyInt_From_unsigned_char(__pyx_v_idx1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1630, __pyx_L1_error)
  22605. __Pyx_GOTREF(__pyx_t_12);
  22606. __pyx_t_7 = __Pyx_PyInt_From_unsigned_char(__pyx_v_idx2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1630, __pyx_L1_error)
  22607. __Pyx_GOTREF(__pyx_t_7);
  22608. __pyx_t_3 = NULL;
  22609. __pyx_t_11 = 0;
  22610. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
  22611. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
  22612. if (likely(__pyx_t_3)) {
  22613. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
  22614. __Pyx_INCREF(__pyx_t_3);
  22615. __Pyx_INCREF(function);
  22616. __Pyx_DECREF_SET(__pyx_t_1, function);
  22617. __pyx_t_11 = 1;
  22618. }
  22619. }
  22620. #if CYTHON_FAST_PYCALL
  22621. if (PyFunction_Check(__pyx_t_1)) {
  22622. PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_12, __pyx_t_7};
  22623. __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1629, __pyx_L1_error)
  22624. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  22625. __Pyx_GOTREF(__pyx_t_13);
  22626. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  22627. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  22628. } else
  22629. #endif
  22630. #if CYTHON_FAST_PYCCALL
  22631. if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
  22632. PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_12, __pyx_t_7};
  22633. __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1629, __pyx_L1_error)
  22634. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  22635. __Pyx_GOTREF(__pyx_t_13);
  22636. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  22637. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  22638. } else
  22639. #endif
  22640. {
  22641. __pyx_t_6 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1629, __pyx_L1_error)
  22642. __Pyx_GOTREF(__pyx_t_6);
  22643. if (__pyx_t_3) {
  22644. __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
  22645. }
  22646. __Pyx_GIVEREF(__pyx_t_12);
  22647. PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_11, __pyx_t_12);
  22648. __Pyx_GIVEREF(__pyx_t_7);
  22649. PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_11, __pyx_t_7);
  22650. __pyx_t_12 = 0;
  22651. __pyx_t_7 = 0;
  22652. __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1629, __pyx_L1_error)
  22653. __Pyx_GOTREF(__pyx_t_13);
  22654. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  22655. }
  22656. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  22657. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1628
  22658. *
  22659. * if i == 2:
  22660. * raise ValueError( # <<<<<<<<<<<<<<
  22661. * 'Indices {} and {} not found in LU keys.'.format(
  22662. * idx1, idx2))
  22663. */
  22664. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1628, __pyx_L1_error)
  22665. __Pyx_GOTREF(__pyx_t_1);
  22666. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  22667. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  22668. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  22669. __PYX_ERR(0, 1628, __pyx_L1_error)
  22670. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1627
  22671. * break
  22672. *
  22673. * if i == 2: # <<<<<<<<<<<<<<
  22674. * raise ValueError(
  22675. * 'Indices {} and {} not found in LU keys.'.format(
  22676. */
  22677. }
  22678. }
  22679. __pyx_L12_break:;
  22680. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1632
  22681. * idx1, idx2))
  22682. *
  22683. * logger.debug('Term order: {}'.format(term_order[:3])) # <<<<<<<<<<<<<<
  22684. * logger.debug('LUK offsets: {}, {}'.format(luk1_offset, luk2_offset))
  22685. * # Compose terms in lookup key.
  22686. */
  22687. __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1632, __pyx_L1_error)
  22688. __Pyx_GOTREF(__pyx_t_13);
  22689. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_debug); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1632, __pyx_L1_error)
  22690. __Pyx_GOTREF(__pyx_t_6);
  22691. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  22692. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Term_order, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1632, __pyx_L1_error)
  22693. __Pyx_GOTREF(__pyx_t_7);
  22694. __pyx_t_12 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_term_order) + 0, 3 - 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1632, __pyx_L1_error)
  22695. __Pyx_GOTREF(__pyx_t_12);
  22696. __pyx_t_3 = NULL;
  22697. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
  22698. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
  22699. if (likely(__pyx_t_3)) {
  22700. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
  22701. __Pyx_INCREF(__pyx_t_3);
  22702. __Pyx_INCREF(function);
  22703. __Pyx_DECREF_SET(__pyx_t_7, function);
  22704. }
  22705. }
  22706. if (!__pyx_t_3) {
  22707. __pyx_t_13 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1632, __pyx_L1_error)
  22708. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  22709. __Pyx_GOTREF(__pyx_t_13);
  22710. } else {
  22711. #if CYTHON_FAST_PYCALL
  22712. if (PyFunction_Check(__pyx_t_7)) {
  22713. PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_12};
  22714. __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1632, __pyx_L1_error)
  22715. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  22716. __Pyx_GOTREF(__pyx_t_13);
  22717. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  22718. } else
  22719. #endif
  22720. #if CYTHON_FAST_PYCCALL
  22721. if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
  22722. PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_12};
  22723. __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1632, __pyx_L1_error)
  22724. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  22725. __Pyx_GOTREF(__pyx_t_13);
  22726. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  22727. } else
  22728. #endif
  22729. {
  22730. __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1632, __pyx_L1_error)
  22731. __Pyx_GOTREF(__pyx_t_2);
  22732. __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
  22733. __Pyx_GIVEREF(__pyx_t_12);
  22734. PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_12);
  22735. __pyx_t_12 = 0;
  22736. __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1632, __pyx_L1_error)
  22737. __Pyx_GOTREF(__pyx_t_13);
  22738. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  22739. }
  22740. }
  22741. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  22742. __pyx_t_7 = NULL;
  22743. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
  22744. __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
  22745. if (likely(__pyx_t_7)) {
  22746. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
  22747. __Pyx_INCREF(__pyx_t_7);
  22748. __Pyx_INCREF(function);
  22749. __Pyx_DECREF_SET(__pyx_t_6, function);
  22750. }
  22751. }
  22752. if (!__pyx_t_7) {
  22753. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1632, __pyx_L1_error)
  22754. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  22755. __Pyx_GOTREF(__pyx_t_1);
  22756. } else {
  22757. #if CYTHON_FAST_PYCALL
  22758. if (PyFunction_Check(__pyx_t_6)) {
  22759. PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_13};
  22760. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1632, __pyx_L1_error)
  22761. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  22762. __Pyx_GOTREF(__pyx_t_1);
  22763. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  22764. } else
  22765. #endif
  22766. #if CYTHON_FAST_PYCCALL
  22767. if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
  22768. PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_13};
  22769. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1632, __pyx_L1_error)
  22770. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  22771. __Pyx_GOTREF(__pyx_t_1);
  22772. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  22773. } else
  22774. #endif
  22775. {
  22776. __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1632, __pyx_L1_error)
  22777. __Pyx_GOTREF(__pyx_t_2);
  22778. __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7); __pyx_t_7 = NULL;
  22779. __Pyx_GIVEREF(__pyx_t_13);
  22780. PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_13);
  22781. __pyx_t_13 = 0;
  22782. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1632, __pyx_L1_error)
  22783. __Pyx_GOTREF(__pyx_t_1);
  22784. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  22785. }
  22786. }
  22787. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  22788. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  22789. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1633
  22790. *
  22791. * logger.debug('Term order: {}'.format(term_order[:3]))
  22792. * logger.debug('LUK offsets: {}, {}'.format(luk1_offset, luk2_offset)) # <<<<<<<<<<<<<<
  22793. * # Compose terms in lookup key.
  22794. * memcpy(luk + luk1_offset, luk1, KLEN)
  22795. */
  22796. __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1633, __pyx_L1_error)
  22797. __Pyx_GOTREF(__pyx_t_6);
  22798. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1633, __pyx_L1_error)
  22799. __Pyx_GOTREF(__pyx_t_2);
  22800. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  22801. __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_LUK_offsets, __pyx_n_s_format); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1633, __pyx_L1_error)
  22802. __Pyx_GOTREF(__pyx_t_13);
  22803. __pyx_t_7 = __Pyx_PyInt_From_unsigned_char(__pyx_v_luk1_offset); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1633, __pyx_L1_error)
  22804. __Pyx_GOTREF(__pyx_t_7);
  22805. __pyx_t_12 = __Pyx_PyInt_From_unsigned_char(__pyx_v_luk2_offset); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1633, __pyx_L1_error)
  22806. __Pyx_GOTREF(__pyx_t_12);
  22807. __pyx_t_3 = NULL;
  22808. __pyx_t_11 = 0;
  22809. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
  22810. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_13);
  22811. if (likely(__pyx_t_3)) {
  22812. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
  22813. __Pyx_INCREF(__pyx_t_3);
  22814. __Pyx_INCREF(function);
  22815. __Pyx_DECREF_SET(__pyx_t_13, function);
  22816. __pyx_t_11 = 1;
  22817. }
  22818. }
  22819. #if CYTHON_FAST_PYCALL
  22820. if (PyFunction_Check(__pyx_t_13)) {
  22821. PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_7, __pyx_t_12};
  22822. __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1633, __pyx_L1_error)
  22823. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  22824. __Pyx_GOTREF(__pyx_t_6);
  22825. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  22826. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  22827. } else
  22828. #endif
  22829. #if CYTHON_FAST_PYCCALL
  22830. if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
  22831. PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_7, __pyx_t_12};
  22832. __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1633, __pyx_L1_error)
  22833. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  22834. __Pyx_GOTREF(__pyx_t_6);
  22835. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  22836. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  22837. } else
  22838. #endif
  22839. {
  22840. __pyx_t_18 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1633, __pyx_L1_error)
  22841. __Pyx_GOTREF(__pyx_t_18);
  22842. if (__pyx_t_3) {
  22843. __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_3); __pyx_t_3 = NULL;
  22844. }
  22845. __Pyx_GIVEREF(__pyx_t_7);
  22846. PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_11, __pyx_t_7);
  22847. __Pyx_GIVEREF(__pyx_t_12);
  22848. PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_11, __pyx_t_12);
  22849. __pyx_t_7 = 0;
  22850. __pyx_t_12 = 0;
  22851. __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_18, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1633, __pyx_L1_error)
  22852. __Pyx_GOTREF(__pyx_t_6);
  22853. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  22854. }
  22855. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  22856. __pyx_t_13 = NULL;
  22857. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
  22858. __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_2);
  22859. if (likely(__pyx_t_13)) {
  22860. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  22861. __Pyx_INCREF(__pyx_t_13);
  22862. __Pyx_INCREF(function);
  22863. __Pyx_DECREF_SET(__pyx_t_2, function);
  22864. }
  22865. }
  22866. if (!__pyx_t_13) {
  22867. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1633, __pyx_L1_error)
  22868. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  22869. __Pyx_GOTREF(__pyx_t_1);
  22870. } else {
  22871. #if CYTHON_FAST_PYCALL
  22872. if (PyFunction_Check(__pyx_t_2)) {
  22873. PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_6};
  22874. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1633, __pyx_L1_error)
  22875. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  22876. __Pyx_GOTREF(__pyx_t_1);
  22877. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  22878. } else
  22879. #endif
  22880. #if CYTHON_FAST_PYCCALL
  22881. if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
  22882. PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_6};
  22883. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1633, __pyx_L1_error)
  22884. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  22885. __Pyx_GOTREF(__pyx_t_1);
  22886. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  22887. } else
  22888. #endif
  22889. {
  22890. __pyx_t_18 = PyTuple_New(1+1); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1633, __pyx_L1_error)
  22891. __Pyx_GOTREF(__pyx_t_18);
  22892. __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_13); __pyx_t_13 = NULL;
  22893. __Pyx_GIVEREF(__pyx_t_6);
  22894. PyTuple_SET_ITEM(__pyx_t_18, 0+1, __pyx_t_6);
  22895. __pyx_t_6 = 0;
  22896. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1633, __pyx_L1_error)
  22897. __Pyx_GOTREF(__pyx_t_1);
  22898. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  22899. }
  22900. }
  22901. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  22902. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  22903. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1635
  22904. * logger.debug('LUK offsets: {}, {}'.format(luk1_offset, luk2_offset))
  22905. * # Compose terms in lookup key.
  22906. * memcpy(luk + luk1_offset, luk1, KLEN) # <<<<<<<<<<<<<<
  22907. * memcpy(luk + luk2_offset, luk2, KLEN)
  22908. *
  22909. */
  22910. (void)(memcpy((__pyx_v_luk + __pyx_v_luk1_offset), __pyx_v_luk1, 5));
  22911. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1636
  22912. * # Compose terms in lookup key.
  22913. * memcpy(luk + luk1_offset, luk1, KLEN)
  22914. * memcpy(luk + luk2_offset, luk2, KLEN) # <<<<<<<<<<<<<<
  22915. *
  22916. * logger.debug('Lookup key: {}'.format(luk))
  22917. */
  22918. (void)(memcpy((__pyx_v_luk + __pyx_v_luk2_offset), __pyx_v_luk2, 5));
  22919. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1638
  22920. * memcpy(luk + luk2_offset, luk2, KLEN)
  22921. *
  22922. * logger.debug('Lookup key: {}'.format(luk)) # <<<<<<<<<<<<<<
  22923. *
  22924. * icur = self._cur_open(dblabel)
  22925. */
  22926. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1638, __pyx_L1_error)
  22927. __Pyx_GOTREF(__pyx_t_2);
  22928. __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1638, __pyx_L1_error)
  22929. __Pyx_GOTREF(__pyx_t_18);
  22930. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  22931. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Lookup_key, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1638, __pyx_L1_error)
  22932. __Pyx_GOTREF(__pyx_t_6);
  22933. __pyx_t_13 = __Pyx_PyObject_FromCString(__pyx_v_luk); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1638, __pyx_L1_error)
  22934. __Pyx_GOTREF(__pyx_t_13);
  22935. __pyx_t_12 = NULL;
  22936. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
  22937. __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_6);
  22938. if (likely(__pyx_t_12)) {
  22939. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
  22940. __Pyx_INCREF(__pyx_t_12);
  22941. __Pyx_INCREF(function);
  22942. __Pyx_DECREF_SET(__pyx_t_6, function);
  22943. }
  22944. }
  22945. if (!__pyx_t_12) {
  22946. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1638, __pyx_L1_error)
  22947. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  22948. __Pyx_GOTREF(__pyx_t_2);
  22949. } else {
  22950. #if CYTHON_FAST_PYCALL
  22951. if (PyFunction_Check(__pyx_t_6)) {
  22952. PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_t_13};
  22953. __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1638, __pyx_L1_error)
  22954. __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  22955. __Pyx_GOTREF(__pyx_t_2);
  22956. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  22957. } else
  22958. #endif
  22959. #if CYTHON_FAST_PYCCALL
  22960. if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
  22961. PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_t_13};
  22962. __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1638, __pyx_L1_error)
  22963. __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  22964. __Pyx_GOTREF(__pyx_t_2);
  22965. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  22966. } else
  22967. #endif
  22968. {
  22969. __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1638, __pyx_L1_error)
  22970. __Pyx_GOTREF(__pyx_t_7);
  22971. __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_12); __pyx_t_12 = NULL;
  22972. __Pyx_GIVEREF(__pyx_t_13);
  22973. PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_13);
  22974. __pyx_t_13 = 0;
  22975. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1638, __pyx_L1_error)
  22976. __Pyx_GOTREF(__pyx_t_2);
  22977. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  22978. }
  22979. }
  22980. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  22981. __pyx_t_6 = NULL;
  22982. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_18))) {
  22983. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_18);
  22984. if (likely(__pyx_t_6)) {
  22985. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
  22986. __Pyx_INCREF(__pyx_t_6);
  22987. __Pyx_INCREF(function);
  22988. __Pyx_DECREF_SET(__pyx_t_18, function);
  22989. }
  22990. }
  22991. if (!__pyx_t_6) {
  22992. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_18, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1638, __pyx_L1_error)
  22993. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  22994. __Pyx_GOTREF(__pyx_t_1);
  22995. } else {
  22996. #if CYTHON_FAST_PYCALL
  22997. if (PyFunction_Check(__pyx_t_18)) {
  22998. PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_2};
  22999. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_18, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1638, __pyx_L1_error)
  23000. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  23001. __Pyx_GOTREF(__pyx_t_1);
  23002. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  23003. } else
  23004. #endif
  23005. #if CYTHON_FAST_PYCCALL
  23006. if (__Pyx_PyFastCFunction_Check(__pyx_t_18)) {
  23007. PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_2};
  23008. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_18, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1638, __pyx_L1_error)
  23009. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  23010. __Pyx_GOTREF(__pyx_t_1);
  23011. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  23012. } else
  23013. #endif
  23014. {
  23015. __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1638, __pyx_L1_error)
  23016. __Pyx_GOTREF(__pyx_t_7);
  23017. __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
  23018. __Pyx_GIVEREF(__pyx_t_2);
  23019. PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_2);
  23020. __pyx_t_2 = 0;
  23021. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1638, __pyx_L1_error)
  23022. __Pyx_GOTREF(__pyx_t_1);
  23023. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  23024. }
  23025. }
  23026. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  23027. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  23028. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1640
  23029. * logger.debug('Lookup key: {}'.format(luk))
  23030. *
  23031. * icur = self._cur_open(dblabel) # <<<<<<<<<<<<<<
  23032. * logger.debug('Database label: {}'.format(dblabel))
  23033. *
  23034. */
  23035. if (unlikely(!__pyx_v_dblabel)) { __Pyx_RaiseUnboundLocalError("dblabel"); __PYX_ERR(0, 1640, __pyx_L1_error) }
  23036. __pyx_t_19 = __Pyx_PyObject_AsWritableUString(__pyx_v_dblabel); if (unlikely((!__pyx_t_19) && PyErr_Occurred())) __PYX_ERR(0, 1640, __pyx_L1_error)
  23037. __pyx_t_21.__pyx_n = 1;
  23038. __pyx_t_21.dblabel = __pyx_t_19;
  23039. __pyx_t_20 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_open(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_21); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1640, __pyx_L1_error)
  23040. __pyx_v_icur = __pyx_t_20;
  23041. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1641
  23042. *
  23043. * icur = self._cur_open(dblabel)
  23044. * logger.debug('Database label: {}'.format(dblabel)) # <<<<<<<<<<<<<<
  23045. *
  23046. * try:
  23047. */
  23048. __pyx_t_18 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1641, __pyx_L1_error)
  23049. __Pyx_GOTREF(__pyx_t_18);
  23050. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s_debug); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1641, __pyx_L1_error)
  23051. __Pyx_GOTREF(__pyx_t_7);
  23052. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  23053. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Database_label, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1641, __pyx_L1_error)
  23054. __Pyx_GOTREF(__pyx_t_2);
  23055. if (unlikely(!__pyx_v_dblabel)) { __Pyx_RaiseUnboundLocalError("dblabel"); __PYX_ERR(0, 1641, __pyx_L1_error) }
  23056. __pyx_t_6 = NULL;
  23057. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
  23058. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
  23059. if (likely(__pyx_t_6)) {
  23060. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  23061. __Pyx_INCREF(__pyx_t_6);
  23062. __Pyx_INCREF(function);
  23063. __Pyx_DECREF_SET(__pyx_t_2, function);
  23064. }
  23065. }
  23066. if (!__pyx_t_6) {
  23067. __pyx_t_18 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_dblabel); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1641, __pyx_L1_error)
  23068. __Pyx_GOTREF(__pyx_t_18);
  23069. } else {
  23070. #if CYTHON_FAST_PYCALL
  23071. if (PyFunction_Check(__pyx_t_2)) {
  23072. PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_dblabel};
  23073. __pyx_t_18 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1641, __pyx_L1_error)
  23074. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  23075. __Pyx_GOTREF(__pyx_t_18);
  23076. } else
  23077. #endif
  23078. #if CYTHON_FAST_PYCCALL
  23079. if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
  23080. PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_dblabel};
  23081. __pyx_t_18 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1641, __pyx_L1_error)
  23082. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  23083. __Pyx_GOTREF(__pyx_t_18);
  23084. } else
  23085. #endif
  23086. {
  23087. __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1641, __pyx_L1_error)
  23088. __Pyx_GOTREF(__pyx_t_13);
  23089. __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_6); __pyx_t_6 = NULL;
  23090. __Pyx_INCREF(__pyx_v_dblabel);
  23091. __Pyx_GIVEREF(__pyx_v_dblabel);
  23092. PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_v_dblabel);
  23093. __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_13, NULL); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1641, __pyx_L1_error)
  23094. __Pyx_GOTREF(__pyx_t_18);
  23095. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  23096. }
  23097. }
  23098. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  23099. __pyx_t_2 = NULL;
  23100. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
  23101. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
  23102. if (likely(__pyx_t_2)) {
  23103. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
  23104. __Pyx_INCREF(__pyx_t_2);
  23105. __Pyx_INCREF(function);
  23106. __Pyx_DECREF_SET(__pyx_t_7, function);
  23107. }
  23108. }
  23109. if (!__pyx_t_2) {
  23110. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_18); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1641, __pyx_L1_error)
  23111. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  23112. __Pyx_GOTREF(__pyx_t_1);
  23113. } else {
  23114. #if CYTHON_FAST_PYCALL
  23115. if (PyFunction_Check(__pyx_t_7)) {
  23116. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_18};
  23117. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1641, __pyx_L1_error)
  23118. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  23119. __Pyx_GOTREF(__pyx_t_1);
  23120. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  23121. } else
  23122. #endif
  23123. #if CYTHON_FAST_PYCCALL
  23124. if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
  23125. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_18};
  23126. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1641, __pyx_L1_error)
  23127. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  23128. __Pyx_GOTREF(__pyx_t_1);
  23129. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  23130. } else
  23131. #endif
  23132. {
  23133. __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1641, __pyx_L1_error)
  23134. __Pyx_GOTREF(__pyx_t_13);
  23135. __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_2); __pyx_t_2 = NULL;
  23136. __Pyx_GIVEREF(__pyx_t_18);
  23137. PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_18);
  23138. __pyx_t_18 = 0;
  23139. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1641, __pyx_L1_error)
  23140. __Pyx_GOTREF(__pyx_t_1);
  23141. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  23142. }
  23143. }
  23144. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  23145. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  23146. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1643
  23147. * logger.debug('Database label: {}'.format(dblabel))
  23148. *
  23149. * try: # <<<<<<<<<<<<<<
  23150. * key_v.mv_data = luk
  23151. * key_v.mv_size = DBL_KLEN
  23152. */
  23153. /*try:*/ {
  23154. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1644
  23155. *
  23156. * try:
  23157. * key_v.mv_data = luk # <<<<<<<<<<<<<<
  23158. * key_v.mv_size = DBL_KLEN
  23159. *
  23160. */
  23161. __pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v.mv_data = __pyx_v_luk;
  23162. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1645
  23163. * try:
  23164. * key_v.mv_data = luk
  23165. * key_v.mv_size = DBL_KLEN # <<<<<<<<<<<<<<
  23166. *
  23167. * # Count duplicates for key and allocate memory for result set.
  23168. */
  23169. __pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v.mv_size = 10;
  23170. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1648
  23171. *
  23172. * # Count duplicates for key and allocate memory for result set.
  23173. * _check(lmdb.mdb_cursor_get(icur, &key_v, &data_v, lmdb.MDB_SET)) # <<<<<<<<<<<<<<
  23174. * _check(lmdb.mdb_cursor_count(icur, &ct))
  23175. * ret = ResultSet(ct, TRP_KLEN)
  23176. */
  23177. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_icur, (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v), (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v), MDB_SET), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1648, __pyx_L19_error)
  23178. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1649
  23179. * # Count duplicates for key and allocate memory for result set.
  23180. * _check(lmdb.mdb_cursor_get(icur, &key_v, &data_v, lmdb.MDB_SET))
  23181. * _check(lmdb.mdb_cursor_count(icur, &ct)) # <<<<<<<<<<<<<<
  23182. * ret = ResultSet(ct, TRP_KLEN)
  23183. * #logger.debug('Entries for {}: {}'.format(self.lookup_indices[idx], ct))
  23184. */
  23185. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_count(__pyx_v_icur, (&__pyx_v_ct)), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1649, __pyx_L19_error)
  23186. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1650
  23187. * _check(lmdb.mdb_cursor_get(icur, &key_v, &data_v, lmdb.MDB_SET))
  23188. * _check(lmdb.mdb_cursor_count(icur, &ct))
  23189. * ret = ResultSet(ct, TRP_KLEN) # <<<<<<<<<<<<<<
  23190. * #logger.debug('Entries for {}: {}'.format(self.lookup_indices[idx], ct))
  23191. * #logger.debug('First row: {}'.format(
  23192. */
  23193. __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_ct); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1650, __pyx_L19_error)
  23194. __Pyx_GOTREF(__pyx_t_1);
  23195. __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1650, __pyx_L19_error)
  23196. __Pyx_GOTREF(__pyx_t_7);
  23197. __Pyx_GIVEREF(__pyx_t_1);
  23198. PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
  23199. __Pyx_INCREF(__pyx_int_15);
  23200. __Pyx_GIVEREF(__pyx_int_15);
  23201. PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_15);
  23202. __pyx_t_1 = 0;
  23203. __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet), __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1650, __pyx_L19_error)
  23204. __Pyx_GOTREF(__pyx_t_1);
  23205. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  23206. __pyx_v_ret = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_1);
  23207. __pyx_t_1 = 0;
  23208. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1656
  23209. *
  23210. * # Arrange results according to lookup order.
  23211. * asm_rng = [ # <<<<<<<<<<<<<<
  23212. * KLEN * term_order[0],
  23213. * KLEN * term_order[1],
  23214. */
  23215. __pyx_t_22[0] = (5 * (__pyx_v_term_order[0]));
  23216. __pyx_t_22[1] = (5 * (__pyx_v_term_order[1]));
  23217. __pyx_t_22[2] = (5 * (__pyx_v_term_order[2]));
  23218. memcpy(&(__pyx_v_asm_rng[0]), __pyx_t_22, sizeof(__pyx_v_asm_rng[0]) * (3));
  23219. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1661
  23220. * KLEN * term_order[2],
  23221. * ]
  23222. * logger.debug('asm_rng: {}'.format(asm_rng[:3])) # <<<<<<<<<<<<<<
  23223. * logger.debug('luk: {}'.format(luk))
  23224. *
  23225. */
  23226. __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1661, __pyx_L19_error)
  23227. __Pyx_GOTREF(__pyx_t_7);
  23228. __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_debug); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1661, __pyx_L19_error)
  23229. __Pyx_GOTREF(__pyx_t_13);
  23230. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  23231. __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_asm_rng, __pyx_n_s_format); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1661, __pyx_L19_error)
  23232. __Pyx_GOTREF(__pyx_t_18);
  23233. __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_asm_rng) + 0, 3 - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1661, __pyx_L19_error)
  23234. __Pyx_GOTREF(__pyx_t_2);
  23235. __pyx_t_6 = NULL;
  23236. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_18))) {
  23237. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_18);
  23238. if (likely(__pyx_t_6)) {
  23239. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
  23240. __Pyx_INCREF(__pyx_t_6);
  23241. __Pyx_INCREF(function);
  23242. __Pyx_DECREF_SET(__pyx_t_18, function);
  23243. }
  23244. }
  23245. if (!__pyx_t_6) {
  23246. __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_18, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1661, __pyx_L19_error)
  23247. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  23248. __Pyx_GOTREF(__pyx_t_7);
  23249. } else {
  23250. #if CYTHON_FAST_PYCALL
  23251. if (PyFunction_Check(__pyx_t_18)) {
  23252. PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_2};
  23253. __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_18, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1661, __pyx_L19_error)
  23254. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  23255. __Pyx_GOTREF(__pyx_t_7);
  23256. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  23257. } else
  23258. #endif
  23259. #if CYTHON_FAST_PYCCALL
  23260. if (__Pyx_PyFastCFunction_Check(__pyx_t_18)) {
  23261. PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_2};
  23262. __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_18, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1661, __pyx_L19_error)
  23263. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  23264. __Pyx_GOTREF(__pyx_t_7);
  23265. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  23266. } else
  23267. #endif
  23268. {
  23269. __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1661, __pyx_L19_error)
  23270. __Pyx_GOTREF(__pyx_t_12);
  23271. __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_6); __pyx_t_6 = NULL;
  23272. __Pyx_GIVEREF(__pyx_t_2);
  23273. PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_2);
  23274. __pyx_t_2 = 0;
  23275. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_t_12, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1661, __pyx_L19_error)
  23276. __Pyx_GOTREF(__pyx_t_7);
  23277. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  23278. }
  23279. }
  23280. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  23281. __pyx_t_18 = NULL;
  23282. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
  23283. __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_13);
  23284. if (likely(__pyx_t_18)) {
  23285. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
  23286. __Pyx_INCREF(__pyx_t_18);
  23287. __Pyx_INCREF(function);
  23288. __Pyx_DECREF_SET(__pyx_t_13, function);
  23289. }
  23290. }
  23291. if (!__pyx_t_18) {
  23292. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1661, __pyx_L19_error)
  23293. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  23294. __Pyx_GOTREF(__pyx_t_1);
  23295. } else {
  23296. #if CYTHON_FAST_PYCALL
  23297. if (PyFunction_Check(__pyx_t_13)) {
  23298. PyObject *__pyx_temp[2] = {__pyx_t_18, __pyx_t_7};
  23299. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1661, __pyx_L19_error)
  23300. __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
  23301. __Pyx_GOTREF(__pyx_t_1);
  23302. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  23303. } else
  23304. #endif
  23305. #if CYTHON_FAST_PYCCALL
  23306. if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
  23307. PyObject *__pyx_temp[2] = {__pyx_t_18, __pyx_t_7};
  23308. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1661, __pyx_L19_error)
  23309. __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
  23310. __Pyx_GOTREF(__pyx_t_1);
  23311. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  23312. } else
  23313. #endif
  23314. {
  23315. __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1661, __pyx_L19_error)
  23316. __Pyx_GOTREF(__pyx_t_12);
  23317. __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_18); __pyx_t_18 = NULL;
  23318. __Pyx_GIVEREF(__pyx_t_7);
  23319. PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_7);
  23320. __pyx_t_7 = 0;
  23321. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1661, __pyx_L19_error)
  23322. __Pyx_GOTREF(__pyx_t_1);
  23323. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  23324. }
  23325. }
  23326. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  23327. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  23328. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1662
  23329. * ]
  23330. * logger.debug('asm_rng: {}'.format(asm_rng[:3]))
  23331. * logger.debug('luk: {}'.format(luk)) # <<<<<<<<<<<<<<
  23332. *
  23333. * _check(lmdb.mdb_cursor_get(icur, &key_v, &data_v, lmdb.MDB_SET))
  23334. */
  23335. __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1662, __pyx_L19_error)
  23336. __Pyx_GOTREF(__pyx_t_13);
  23337. __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_debug); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1662, __pyx_L19_error)
  23338. __Pyx_GOTREF(__pyx_t_12);
  23339. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  23340. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_luk, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1662, __pyx_L19_error)
  23341. __Pyx_GOTREF(__pyx_t_7);
  23342. __pyx_t_18 = __Pyx_PyObject_FromCString(__pyx_v_luk); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1662, __pyx_L19_error)
  23343. __Pyx_GOTREF(__pyx_t_18);
  23344. __pyx_t_2 = NULL;
  23345. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
  23346. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
  23347. if (likely(__pyx_t_2)) {
  23348. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
  23349. __Pyx_INCREF(__pyx_t_2);
  23350. __Pyx_INCREF(function);
  23351. __Pyx_DECREF_SET(__pyx_t_7, function);
  23352. }
  23353. }
  23354. if (!__pyx_t_2) {
  23355. __pyx_t_13 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_18); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1662, __pyx_L19_error)
  23356. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  23357. __Pyx_GOTREF(__pyx_t_13);
  23358. } else {
  23359. #if CYTHON_FAST_PYCALL
  23360. if (PyFunction_Check(__pyx_t_7)) {
  23361. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_18};
  23362. __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1662, __pyx_L19_error)
  23363. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  23364. __Pyx_GOTREF(__pyx_t_13);
  23365. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  23366. } else
  23367. #endif
  23368. #if CYTHON_FAST_PYCCALL
  23369. if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
  23370. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_18};
  23371. __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1662, __pyx_L19_error)
  23372. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  23373. __Pyx_GOTREF(__pyx_t_13);
  23374. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  23375. } else
  23376. #endif
  23377. {
  23378. __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1662, __pyx_L19_error)
  23379. __Pyx_GOTREF(__pyx_t_6);
  23380. __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL;
  23381. __Pyx_GIVEREF(__pyx_t_18);
  23382. PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_18);
  23383. __pyx_t_18 = 0;
  23384. __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1662, __pyx_L19_error)
  23385. __Pyx_GOTREF(__pyx_t_13);
  23386. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  23387. }
  23388. }
  23389. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  23390. __pyx_t_7 = NULL;
  23391. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
  23392. __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_12);
  23393. if (likely(__pyx_t_7)) {
  23394. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
  23395. __Pyx_INCREF(__pyx_t_7);
  23396. __Pyx_INCREF(function);
  23397. __Pyx_DECREF_SET(__pyx_t_12, function);
  23398. }
  23399. }
  23400. if (!__pyx_t_7) {
  23401. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1662, __pyx_L19_error)
  23402. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  23403. __Pyx_GOTREF(__pyx_t_1);
  23404. } else {
  23405. #if CYTHON_FAST_PYCALL
  23406. if (PyFunction_Check(__pyx_t_12)) {
  23407. PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_13};
  23408. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1662, __pyx_L19_error)
  23409. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  23410. __Pyx_GOTREF(__pyx_t_1);
  23411. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  23412. } else
  23413. #endif
  23414. #if CYTHON_FAST_PYCCALL
  23415. if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
  23416. PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_13};
  23417. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1662, __pyx_L19_error)
  23418. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  23419. __Pyx_GOTREF(__pyx_t_1);
  23420. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  23421. } else
  23422. #endif
  23423. {
  23424. __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1662, __pyx_L19_error)
  23425. __Pyx_GOTREF(__pyx_t_6);
  23426. __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __pyx_t_7 = NULL;
  23427. __Pyx_GIVEREF(__pyx_t_13);
  23428. PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_13);
  23429. __pyx_t_13 = 0;
  23430. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1662, __pyx_L19_error)
  23431. __Pyx_GOTREF(__pyx_t_1);
  23432. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  23433. }
  23434. }
  23435. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  23436. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  23437. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1664
  23438. * logger.debug('luk: {}'.format(luk))
  23439. *
  23440. * _check(lmdb.mdb_cursor_get(icur, &key_v, &data_v, lmdb.MDB_SET)) # <<<<<<<<<<<<<<
  23441. * _check(lmdb.mdb_cursor_get(
  23442. * icur, &key_v, &data_v, lmdb.MDB_GET_MULTIPLE))
  23443. */
  23444. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_icur, (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v), (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v), MDB_SET), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1664, __pyx_L19_error)
  23445. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1665
  23446. *
  23447. * _check(lmdb.mdb_cursor_get(icur, &key_v, &data_v, lmdb.MDB_SET))
  23448. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  23449. * icur, &key_v, &data_v, lmdb.MDB_GET_MULTIPLE))
  23450. * while True:
  23451. */
  23452. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_icur, (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v), (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v), MDB_GET_MULTIPLE), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1665, __pyx_L19_error)
  23453. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1667
  23454. * _check(lmdb.mdb_cursor_get(
  23455. * icur, &key_v, &data_v, lmdb.MDB_GET_MULTIPLE))
  23456. * while True: # <<<<<<<<<<<<<<
  23457. * logger.debug('Got data in 2bound ({}): {}'.format(
  23458. * data_v.mv_size,
  23459. */
  23460. while (1) {
  23461. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1668
  23462. * icur, &key_v, &data_v, lmdb.MDB_GET_MULTIPLE))
  23463. * while True:
  23464. * logger.debug('Got data in 2bound ({}): {}'.format( # <<<<<<<<<<<<<<
  23465. * data_v.mv_size,
  23466. * (<unsigned char *>data_v.mv_data)[: data_v.mv_size]))
  23467. */
  23468. __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1668, __pyx_L19_error)
  23469. __Pyx_GOTREF(__pyx_t_12);
  23470. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_debug); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1668, __pyx_L19_error)
  23471. __Pyx_GOTREF(__pyx_t_6);
  23472. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  23473. __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Got_data_in_2bound, __pyx_n_s_format); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1668, __pyx_L19_error)
  23474. __Pyx_GOTREF(__pyx_t_13);
  23475. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1669
  23476. * while True:
  23477. * logger.debug('Got data in 2bound ({}): {}'.format(
  23478. * data_v.mv_size, # <<<<<<<<<<<<<<
  23479. * (<unsigned char *>data_v.mv_data)[: data_v.mv_size]))
  23480. * for j in prange(data_v.mv_size // KLEN, nogil=True):
  23481. */
  23482. __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v.mv_size); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1669, __pyx_L19_error)
  23483. __Pyx_GOTREF(__pyx_t_7);
  23484. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1670
  23485. * logger.debug('Got data in 2bound ({}): {}'.format(
  23486. * data_v.mv_size,
  23487. * (<unsigned char *>data_v.mv_data)[: data_v.mv_size])) # <<<<<<<<<<<<<<
  23488. * for j in prange(data_v.mv_size // KLEN, nogil=True):
  23489. * src_pos = KLEN * j
  23490. */
  23491. __pyx_t_18 = __Pyx_PyBytes_FromStringAndSize(((const char*)((unsigned char *)__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v.mv_data)) + 0, __pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v.mv_size - 0); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1670, __pyx_L19_error)
  23492. __Pyx_GOTREF(__pyx_t_18);
  23493. __pyx_t_2 = NULL;
  23494. __pyx_t_11 = 0;
  23495. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
  23496. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_13);
  23497. if (likely(__pyx_t_2)) {
  23498. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
  23499. __Pyx_INCREF(__pyx_t_2);
  23500. __Pyx_INCREF(function);
  23501. __Pyx_DECREF_SET(__pyx_t_13, function);
  23502. __pyx_t_11 = 1;
  23503. }
  23504. }
  23505. #if CYTHON_FAST_PYCALL
  23506. if (PyFunction_Check(__pyx_t_13)) {
  23507. PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_7, __pyx_t_18};
  23508. __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1668, __pyx_L19_error)
  23509. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  23510. __Pyx_GOTREF(__pyx_t_12);
  23511. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  23512. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  23513. } else
  23514. #endif
  23515. #if CYTHON_FAST_PYCCALL
  23516. if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
  23517. PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_7, __pyx_t_18};
  23518. __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1668, __pyx_L19_error)
  23519. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  23520. __Pyx_GOTREF(__pyx_t_12);
  23521. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  23522. __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  23523. } else
  23524. #endif
  23525. {
  23526. __pyx_t_3 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1668, __pyx_L19_error)
  23527. __Pyx_GOTREF(__pyx_t_3);
  23528. if (__pyx_t_2) {
  23529. __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
  23530. }
  23531. __Pyx_GIVEREF(__pyx_t_7);
  23532. PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_11, __pyx_t_7);
  23533. __Pyx_GIVEREF(__pyx_t_18);
  23534. PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_11, __pyx_t_18);
  23535. __pyx_t_7 = 0;
  23536. __pyx_t_18 = 0;
  23537. __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_3, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1668, __pyx_L19_error)
  23538. __Pyx_GOTREF(__pyx_t_12);
  23539. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  23540. }
  23541. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  23542. __pyx_t_13 = NULL;
  23543. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
  23544. __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_6);
  23545. if (likely(__pyx_t_13)) {
  23546. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
  23547. __Pyx_INCREF(__pyx_t_13);
  23548. __Pyx_INCREF(function);
  23549. __Pyx_DECREF_SET(__pyx_t_6, function);
  23550. }
  23551. }
  23552. if (!__pyx_t_13) {
  23553. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1668, __pyx_L19_error)
  23554. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  23555. __Pyx_GOTREF(__pyx_t_1);
  23556. } else {
  23557. #if CYTHON_FAST_PYCALL
  23558. if (PyFunction_Check(__pyx_t_6)) {
  23559. PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_12};
  23560. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1668, __pyx_L19_error)
  23561. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  23562. __Pyx_GOTREF(__pyx_t_1);
  23563. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  23564. } else
  23565. #endif
  23566. #if CYTHON_FAST_PYCCALL
  23567. if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
  23568. PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_12};
  23569. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1668, __pyx_L19_error)
  23570. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  23571. __Pyx_GOTREF(__pyx_t_1);
  23572. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  23573. } else
  23574. #endif
  23575. {
  23576. __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1668, __pyx_L19_error)
  23577. __Pyx_GOTREF(__pyx_t_3);
  23578. __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_13); __pyx_t_13 = NULL;
  23579. __Pyx_GIVEREF(__pyx_t_12);
  23580. PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_12);
  23581. __pyx_t_12 = 0;
  23582. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1668, __pyx_L19_error)
  23583. __Pyx_GOTREF(__pyx_t_1);
  23584. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  23585. }
  23586. }
  23587. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  23588. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  23589. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1671
  23590. * data_v.mv_size,
  23591. * (<unsigned char *>data_v.mv_data)[: data_v.mv_size]))
  23592. * for j in prange(data_v.mv_size // KLEN, nogil=True): # <<<<<<<<<<<<<<
  23593. * src_pos = KLEN * j
  23594. * ret_pos = (ret_offset + ret.itemsize * j)
  23595. */
  23596. {
  23597. #ifdef WITH_THREAD
  23598. PyThreadState *_save;
  23599. Py_UNBLOCK_THREADS
  23600. __Pyx_FastGIL_Remember();
  23601. #endif
  23602. /*try:*/ {
  23603. __pyx_t_14 = (__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v.mv_size / 5);
  23604. if (1 == 0) abort();
  23605. {
  23606. #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
  23607. #undef likely
  23608. #undef unlikely
  23609. #define likely(x) (x)
  23610. #define unlikely(x) (x)
  23611. #endif
  23612. __pyx_t_23 = (__pyx_t_14 - 0 + 1 - 1/abs(1)) / 1;
  23613. if (__pyx_t_23 > 0)
  23614. {
  23615. #ifdef _OPENMP
  23616. #pragma omp parallel
  23617. #endif /* _OPENMP */
  23618. {
  23619. #ifdef _OPENMP
  23620. #pragma omp for firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_ret_pos) lastprivate(__pyx_v_src_pos)
  23621. #endif /* _OPENMP */
  23622. for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_23; __pyx_t_17++){
  23623. {
  23624. __pyx_v_j = (size_t)(0 + 1 * __pyx_t_17);
  23625. /* Initialize private variables to invalid values */
  23626. __pyx_v_ret_pos = ((size_t)0xbad0bad0);
  23627. __pyx_v_src_pos = ((size_t)0xbad0bad0);
  23628. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1672
  23629. * (<unsigned char *>data_v.mv_data)[: data_v.mv_size]))
  23630. * for j in prange(data_v.mv_size // KLEN, nogil=True):
  23631. * src_pos = KLEN * j # <<<<<<<<<<<<<<
  23632. * ret_pos = (ret_offset + ret.itemsize * j)
  23633. * #logger.debug('Page offset: {}'.format(pg_offset))
  23634. */
  23635. __pyx_v_src_pos = (5 * __pyx_v_j);
  23636. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1673
  23637. * for j in prange(data_v.mv_size // KLEN, nogil=True):
  23638. * src_pos = KLEN * j
  23639. * ret_pos = (ret_offset + ret.itemsize * j) # <<<<<<<<<<<<<<
  23640. * #logger.debug('Page offset: {}'.format(pg_offset))
  23641. * #logger.debug('Ret offset: {}'.format(ret_offset))
  23642. */
  23643. __pyx_v_ret_pos = (__pyx_v_ret_offset + (__pyx_v_ret->itemsize * __pyx_v_j));
  23644. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1676
  23645. * #logger.debug('Page offset: {}'.format(pg_offset))
  23646. * #logger.debug('Ret offset: {}'.format(ret_offset))
  23647. * memcpy(ret.data + ret_pos + asm_rng[0], luk, KLEN) # <<<<<<<<<<<<<<
  23648. * memcpy(ret.data + ret_pos + asm_rng[1], luk + KLEN, KLEN)
  23649. * memcpy(ret.data + ret_pos + asm_rng[2],
  23650. */
  23651. (void)(memcpy(((__pyx_v_ret->data + __pyx_v_ret_pos) + (__pyx_v_asm_rng[0])), __pyx_v_luk, 5));
  23652. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1677
  23653. * #logger.debug('Ret offset: {}'.format(ret_offset))
  23654. * memcpy(ret.data + ret_pos + asm_rng[0], luk, KLEN)
  23655. * memcpy(ret.data + ret_pos + asm_rng[1], luk + KLEN, KLEN) # <<<<<<<<<<<<<<
  23656. * memcpy(ret.data + ret_pos + asm_rng[2],
  23657. * data_v.mv_data + src_pos, KLEN)
  23658. */
  23659. (void)(memcpy(((__pyx_v_ret->data + __pyx_v_ret_pos) + (__pyx_v_asm_rng[1])), (__pyx_v_luk + 5), 5));
  23660. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1678
  23661. * memcpy(ret.data + ret_pos + asm_rng[0], luk, KLEN)
  23662. * memcpy(ret.data + ret_pos + asm_rng[1], luk + KLEN, KLEN)
  23663. * memcpy(ret.data + ret_pos + asm_rng[2], # <<<<<<<<<<<<<<
  23664. * data_v.mv_data + src_pos, KLEN)
  23665. * #logger.debug('Assembled triple: {}'.format((ret.data + ret_offset)[: TRP_KLEN]))
  23666. */
  23667. (void)(memcpy(((__pyx_v_ret->data + __pyx_v_ret_pos) + (__pyx_v_asm_rng[2])), (__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v.mv_data + __pyx_v_src_pos), 5));
  23668. }
  23669. }
  23670. }
  23671. }
  23672. }
  23673. #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
  23674. #undef likely
  23675. #undef unlikely
  23676. #define likely(x) __builtin_expect(!!(x), 1)
  23677. #define unlikely(x) __builtin_expect(!!(x), 0)
  23678. #endif
  23679. }
  23680. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1671
  23681. * data_v.mv_size,
  23682. * (<unsigned char *>data_v.mv_data)[: data_v.mv_size]))
  23683. * for j in prange(data_v.mv_size // KLEN, nogil=True): # <<<<<<<<<<<<<<
  23684. * src_pos = KLEN * j
  23685. * ret_pos = (ret_offset + ret.itemsize * j)
  23686. */
  23687. /*finally:*/ {
  23688. /*normal exit:*/{
  23689. #ifdef WITH_THREAD
  23690. __Pyx_FastGIL_Forget();
  23691. Py_BLOCK_THREADS
  23692. #endif
  23693. goto __pyx_L27;
  23694. }
  23695. __pyx_L27:;
  23696. }
  23697. }
  23698. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1682
  23699. * #logger.debug('Assembled triple: {}'.format((ret.data + ret_offset)[: TRP_KLEN]))
  23700. *
  23701. * ret_offset += data_v.mv_size // KLEN * ret.itemsize # <<<<<<<<<<<<<<
  23702. *
  23703. * try:
  23704. */
  23705. __pyx_v_ret_offset = (__pyx_v_ret_offset + ((__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v.mv_size / 5) * __pyx_v_ret->itemsize));
  23706. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1684
  23707. * ret_offset += data_v.mv_size // KLEN * ret.itemsize
  23708. *
  23709. * try: # <<<<<<<<<<<<<<
  23710. * # Get results by the page.
  23711. * _check(lmdb.mdb_cursor_get(
  23712. */
  23713. {
  23714. __Pyx_PyThreadState_declare
  23715. __Pyx_PyThreadState_assign
  23716. __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
  23717. __Pyx_XGOTREF(__pyx_t_10);
  23718. __Pyx_XGOTREF(__pyx_t_9);
  23719. __Pyx_XGOTREF(__pyx_t_8);
  23720. /*try:*/ {
  23721. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1686
  23722. * try:
  23723. * # Get results by the page.
  23724. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  23725. * icur, &key_v, &data_v, lmdb.MDB_NEXT_MULTIPLE))
  23726. * except KeyNotFoundError:
  23727. */
  23728. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_icur, (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v), (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v), MDB_NEXT_MULTIPLE), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1686, __pyx_L34_error)
  23729. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1684
  23730. * ret_offset += data_v.mv_size // KLEN * ret.itemsize
  23731. *
  23732. * try: # <<<<<<<<<<<<<<
  23733. * # Get results by the page.
  23734. * _check(lmdb.mdb_cursor_get(
  23735. */
  23736. }
  23737. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  23738. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  23739. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  23740. goto __pyx_L41_try_end;
  23741. __pyx_L34_error:;
  23742. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  23743. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  23744. __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
  23745. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  23746. __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  23747. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  23748. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  23749. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  23750. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1688
  23751. * _check(lmdb.mdb_cursor_get(
  23752. * icur, &key_v, &data_v, lmdb.MDB_NEXT_MULTIPLE))
  23753. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  23754. * # For testing only. Errors will be caught in triples()
  23755. * # when looking for a context.
  23756. */
  23757. __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_6, &__pyx_t_3);
  23758. __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1688, __pyx_L36_except_error)
  23759. __Pyx_GOTREF(__pyx_t_12);
  23760. __pyx_t_11 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_12);
  23761. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  23762. __Pyx_ErrRestore(__pyx_t_1, __pyx_t_6, __pyx_t_3);
  23763. __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_3 = 0;
  23764. if (__pyx_t_11) {
  23765. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._lookup_2bound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  23766. if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(0, 1688, __pyx_L36_except_error)
  23767. __Pyx_GOTREF(__pyx_t_3);
  23768. __Pyx_GOTREF(__pyx_t_6);
  23769. __Pyx_GOTREF(__pyx_t_1);
  23770. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1696
  23771. * # .format(pg_offset, ret.size))
  23772. * #logger.debug('Assembled data in 2bound ({}): {}'.format(ret.size, ret.data[: ret.size]))
  23773. * return ret # <<<<<<<<<<<<<<
  23774. * finally:
  23775. * self._cur_close(icur)
  23776. */
  23777. __Pyx_XDECREF(((PyObject *)__pyx_r));
  23778. __Pyx_INCREF(((PyObject *)__pyx_v_ret));
  23779. __pyx_r = __pyx_v_ret;
  23780. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  23781. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  23782. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  23783. goto __pyx_L37_except_return;
  23784. }
  23785. goto __pyx_L36_except_error;
  23786. __pyx_L36_except_error:;
  23787. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1684
  23788. * ret_offset += data_v.mv_size // KLEN * ret.itemsize
  23789. *
  23790. * try: # <<<<<<<<<<<<<<
  23791. * # Get results by the page.
  23792. * _check(lmdb.mdb_cursor_get(
  23793. */
  23794. __Pyx_XGIVEREF(__pyx_t_10);
  23795. __Pyx_XGIVEREF(__pyx_t_9);
  23796. __Pyx_XGIVEREF(__pyx_t_8);
  23797. __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_9, __pyx_t_8);
  23798. goto __pyx_L19_error;
  23799. __pyx_L37_except_return:;
  23800. __Pyx_XGIVEREF(__pyx_t_10);
  23801. __Pyx_XGIVEREF(__pyx_t_9);
  23802. __Pyx_XGIVEREF(__pyx_t_8);
  23803. __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_9, __pyx_t_8);
  23804. goto __pyx_L18_return;
  23805. __pyx_L41_try_end:;
  23806. }
  23807. }
  23808. }
  23809. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1698
  23810. * return ret
  23811. * finally:
  23812. * self._cur_close(icur) # <<<<<<<<<<<<<<
  23813. *
  23814. *
  23815. */
  23816. /*finally:*/ {
  23817. /*normal exit:*/{
  23818. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_icur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1698, __pyx_L1_error)
  23819. goto __pyx_L20;
  23820. }
  23821. __pyx_L19_error:;
  23822. /*exception exit:*/{
  23823. __Pyx_PyThreadState_declare
  23824. __Pyx_PyThreadState_assign
  23825. __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0; __pyx_t_28 = 0;
  23826. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  23827. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  23828. __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
  23829. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  23830. __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  23831. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  23832. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  23833. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  23834. if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_26, &__pyx_t_27, &__pyx_t_28);
  23835. if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
  23836. __Pyx_XGOTREF(__pyx_t_8);
  23837. __Pyx_XGOTREF(__pyx_t_9);
  23838. __Pyx_XGOTREF(__pyx_t_10);
  23839. __Pyx_XGOTREF(__pyx_t_26);
  23840. __Pyx_XGOTREF(__pyx_t_27);
  23841. __Pyx_XGOTREF(__pyx_t_28);
  23842. __pyx_t_11 = __pyx_lineno; __pyx_t_24 = __pyx_clineno; __pyx_t_25 = __pyx_filename;
  23843. {
  23844. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_icur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1698, __pyx_L45_error)
  23845. }
  23846. if (PY_MAJOR_VERSION >= 3) {
  23847. __Pyx_XGIVEREF(__pyx_t_26);
  23848. __Pyx_XGIVEREF(__pyx_t_27);
  23849. __Pyx_XGIVEREF(__pyx_t_28);
  23850. __Pyx_ExceptionReset(__pyx_t_26, __pyx_t_27, __pyx_t_28);
  23851. }
  23852. __Pyx_XGIVEREF(__pyx_t_8);
  23853. __Pyx_XGIVEREF(__pyx_t_9);
  23854. __Pyx_XGIVEREF(__pyx_t_10);
  23855. __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
  23856. __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0; __pyx_t_28 = 0;
  23857. __pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_24; __pyx_filename = __pyx_t_25;
  23858. goto __pyx_L1_error;
  23859. __pyx_L45_error:;
  23860. if (PY_MAJOR_VERSION >= 3) {
  23861. __Pyx_XGIVEREF(__pyx_t_26);
  23862. __Pyx_XGIVEREF(__pyx_t_27);
  23863. __Pyx_XGIVEREF(__pyx_t_28);
  23864. __Pyx_ExceptionReset(__pyx_t_26, __pyx_t_27, __pyx_t_28);
  23865. }
  23866. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  23867. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  23868. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  23869. __pyx_t_26 = 0; __pyx_t_27 = 0; __pyx_t_28 = 0;
  23870. goto __pyx_L1_error;
  23871. }
  23872. __pyx_L18_return: {
  23873. __pyx_t_29 = __pyx_r;
  23874. __pyx_r = 0;
  23875. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_icur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1698, __pyx_L1_error)
  23876. __pyx_r = __pyx_t_29;
  23877. __pyx_t_29 = 0;
  23878. goto __pyx_L0;
  23879. }
  23880. __pyx_L20:;
  23881. }
  23882. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1577
  23883. *
  23884. *
  23885. * cdef ResultSet _lookup_2bound( # <<<<<<<<<<<<<<
  23886. * self, unsigned char idx1, term1, unsigned char idx2, term2):
  23887. * """
  23888. */
  23889. /* function exit code */
  23890. __pyx_r = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)Py_None); __Pyx_INCREF(Py_None);
  23891. goto __pyx_L0;
  23892. __pyx_L1_error:;
  23893. __Pyx_XDECREF(__pyx_t_1);
  23894. __Pyx_XDECREF(__pyx_t_2);
  23895. __Pyx_XDECREF(__pyx_t_3);
  23896. __Pyx_XDECREF(__pyx_t_6);
  23897. __Pyx_XDECREF(__pyx_t_7);
  23898. __Pyx_XDECREF(__pyx_t_12);
  23899. __Pyx_XDECREF(__pyx_t_13);
  23900. __Pyx_XDECREF(__pyx_t_18);
  23901. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._lookup_2bound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  23902. __pyx_r = 0;
  23903. __pyx_L0:;
  23904. __Pyx_XDECREF((PyObject *)__pyx_v_ret);
  23905. __Pyx_XDECREF(__pyx_v_dblabel);
  23906. __Pyx_XGIVEREF((PyObject *)__pyx_r);
  23907. __Pyx_TraceReturn(__pyx_r, 0);
  23908. __Pyx_RefNannyFinishContext();
  23909. return __pyx_r;
  23910. }
  23911. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1701
  23912. *
  23913. *
  23914. * cpdef ResultSet _all_term_keys(self, term_type): # <<<<<<<<<<<<<<
  23915. * """
  23916. * Return all keys of a (``s:po``, ``p:so``, ``o:sp``) index.
  23917. */
  23918. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_23_all_term_keys(PyObject *__pyx_v_self, PyObject *__pyx_v_term_type); /*proto*/
  23919. static struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__all_term_keys(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_term_type, int __pyx_skip_dispatch) {
  23920. size_t __pyx_v_i;
  23921. struct MDB_stat __pyx_v_stat;
  23922. PyObject *__pyx_v_idx_label = NULL;
  23923. MDB_cursor *__pyx_v_icur;
  23924. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_ret = NULL;
  23925. int __pyx_v_rc;
  23926. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_r = NULL;
  23927. __Pyx_TraceDeclarations
  23928. __Pyx_RefNannyDeclarations
  23929. PyObject *__pyx_t_1 = NULL;
  23930. PyObject *__pyx_t_2 = NULL;
  23931. PyObject *__pyx_t_3 = NULL;
  23932. PyObject *__pyx_t_4 = NULL;
  23933. PyObject *__pyx_t_5 = NULL;
  23934. unsigned char *__pyx_t_6;
  23935. MDB_cursor *__pyx_t_7;
  23936. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__cur_open __pyx_t_8;
  23937. PyObject *__pyx_t_9 = NULL;
  23938. PyObject *__pyx_t_10 = NULL;
  23939. PyObject *__pyx_t_11 = NULL;
  23940. int __pyx_t_12;
  23941. int __pyx_t_13;
  23942. char const *__pyx_t_14;
  23943. PyObject *__pyx_t_15 = NULL;
  23944. PyObject *__pyx_t_16 = NULL;
  23945. PyObject *__pyx_t_17 = NULL;
  23946. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_t_18 = NULL;
  23947. __Pyx_RefNannySetupContext("_all_term_keys", 0);
  23948. __Pyx_TraceCall("_all_term_keys", __pyx_f[0], 1701, 0, __PYX_ERR(0, 1701, __pyx_L1_error));
  23949. /* Check if called by wrapper */
  23950. if (unlikely(__pyx_skip_dispatch)) ;
  23951. /* Check if overridden in Python */
  23952. else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
  23953. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_all_term_keys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1701, __pyx_L1_error)
  23954. __Pyx_GOTREF(__pyx_t_1);
  23955. if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_23_all_term_keys)) {
  23956. __Pyx_XDECREF(((PyObject *)__pyx_r));
  23957. __Pyx_INCREF(__pyx_t_1);
  23958. __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
  23959. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  23960. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
  23961. if (likely(__pyx_t_4)) {
  23962. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  23963. __Pyx_INCREF(__pyx_t_4);
  23964. __Pyx_INCREF(function);
  23965. __Pyx_DECREF_SET(__pyx_t_3, function);
  23966. }
  23967. }
  23968. if (!__pyx_t_4) {
  23969. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_term_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1701, __pyx_L1_error)
  23970. __Pyx_GOTREF(__pyx_t_2);
  23971. } else {
  23972. #if CYTHON_FAST_PYCALL
  23973. if (PyFunction_Check(__pyx_t_3)) {
  23974. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_term_type};
  23975. __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1701, __pyx_L1_error)
  23976. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  23977. __Pyx_GOTREF(__pyx_t_2);
  23978. } else
  23979. #endif
  23980. #if CYTHON_FAST_PYCCALL
  23981. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  23982. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_term_type};
  23983. __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1701, __pyx_L1_error)
  23984. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  23985. __Pyx_GOTREF(__pyx_t_2);
  23986. } else
  23987. #endif
  23988. {
  23989. __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1701, __pyx_L1_error)
  23990. __Pyx_GOTREF(__pyx_t_5);
  23991. __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
  23992. __Pyx_INCREF(__pyx_v_term_type);
  23993. __Pyx_GIVEREF(__pyx_v_term_type);
  23994. PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_term_type);
  23995. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1701, __pyx_L1_error)
  23996. __Pyx_GOTREF(__pyx_t_2);
  23997. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  23998. }
  23999. }
  24000. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24001. if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet))))) __PYX_ERR(0, 1701, __pyx_L1_error)
  24002. __pyx_r = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_2);
  24003. __pyx_t_2 = 0;
  24004. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  24005. goto __pyx_L0;
  24006. }
  24007. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  24008. }
  24009. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1706
  24010. * """
  24011. * cdef:
  24012. * size_t i = 0 # <<<<<<<<<<<<<<
  24013. * lmdb.MDB_stat stat
  24014. *
  24015. */
  24016. __pyx_v_i = 0;
  24017. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1709
  24018. * lmdb.MDB_stat stat
  24019. *
  24020. * idx_label = self.lookup_indices['spo'.index(term_type)] # <<<<<<<<<<<<<<
  24021. * #logger.debug('Looking for all terms in index: {}'.format(idx_label))
  24022. * icur = self._cur_open(idx_label)
  24023. */
  24024. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_lookup_indices); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1709, __pyx_L1_error)
  24025. __Pyx_GOTREF(__pyx_t_1);
  24026. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_n_u_spo, __pyx_n_s_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1709, __pyx_L1_error)
  24027. __Pyx_GOTREF(__pyx_t_3);
  24028. __pyx_t_5 = NULL;
  24029. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
  24030. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
  24031. if (likely(__pyx_t_5)) {
  24032. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  24033. __Pyx_INCREF(__pyx_t_5);
  24034. __Pyx_INCREF(function);
  24035. __Pyx_DECREF_SET(__pyx_t_3, function);
  24036. }
  24037. }
  24038. if (!__pyx_t_5) {
  24039. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_term_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1709, __pyx_L1_error)
  24040. __Pyx_GOTREF(__pyx_t_2);
  24041. } else {
  24042. #if CYTHON_FAST_PYCALL
  24043. if (PyFunction_Check(__pyx_t_3)) {
  24044. PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_term_type};
  24045. __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1709, __pyx_L1_error)
  24046. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  24047. __Pyx_GOTREF(__pyx_t_2);
  24048. } else
  24049. #endif
  24050. #if CYTHON_FAST_PYCCALL
  24051. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  24052. PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_term_type};
  24053. __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1709, __pyx_L1_error)
  24054. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  24055. __Pyx_GOTREF(__pyx_t_2);
  24056. } else
  24057. #endif
  24058. {
  24059. __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1709, __pyx_L1_error)
  24060. __Pyx_GOTREF(__pyx_t_4);
  24061. __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
  24062. __Pyx_INCREF(__pyx_v_term_type);
  24063. __Pyx_GIVEREF(__pyx_v_term_type);
  24064. PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_term_type);
  24065. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1709, __pyx_L1_error)
  24066. __Pyx_GOTREF(__pyx_t_2);
  24067. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  24068. }
  24069. }
  24070. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24071. __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1709, __pyx_L1_error)
  24072. __Pyx_GOTREF(__pyx_t_3);
  24073. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  24074. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  24075. __pyx_v_idx_label = __pyx_t_3;
  24076. __pyx_t_3 = 0;
  24077. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1711
  24078. * idx_label = self.lookup_indices['spo'.index(term_type)]
  24079. * #logger.debug('Looking for all terms in index: {}'.format(idx_label))
  24080. * icur = self._cur_open(idx_label) # <<<<<<<<<<<<<<
  24081. * try:
  24082. * _check(lmdb.mdb_stat(self.txn, lmdb.mdb_cursor_dbi(icur), &stat))
  24083. */
  24084. __pyx_t_6 = __Pyx_PyObject_AsWritableUString(__pyx_v_idx_label); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 1711, __pyx_L1_error)
  24085. __pyx_t_8.__pyx_n = 1;
  24086. __pyx_t_8.dblabel = __pyx_t_6;
  24087. __pyx_t_7 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_open(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_8); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1711, __pyx_L1_error)
  24088. __pyx_v_icur = __pyx_t_7;
  24089. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1712
  24090. * #logger.debug('Looking for all terms in index: {}'.format(idx_label))
  24091. * icur = self._cur_open(idx_label)
  24092. * try: # <<<<<<<<<<<<<<
  24093. * _check(lmdb.mdb_stat(self.txn, lmdb.mdb_cursor_dbi(icur), &stat))
  24094. * # TODO: This may allocate memory for several times the amount
  24095. */
  24096. /*try:*/ {
  24097. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1713
  24098. * icur = self._cur_open(idx_label)
  24099. * try:
  24100. * _check(lmdb.mdb_stat(self.txn, lmdb.mdb_cursor_dbi(icur), &stat)) # <<<<<<<<<<<<<<
  24101. * # TODO: This may allocate memory for several times the amount
  24102. * # needed. Even though it is resized later, we need to know how
  24103. */
  24104. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_stat(__pyx_v_self->__pyx_base.txn, mdb_cursor_dbi(__pyx_v_icur), (&__pyx_v_stat)), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1713, __pyx_L4_error)
  24105. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1717
  24106. * # needed. Even though it is resized later, we need to know how
  24107. * # performance is affected by this.
  24108. * ret = ResultSet(stat.ms_entries, KLEN) # <<<<<<<<<<<<<<
  24109. *
  24110. * try:
  24111. */
  24112. __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_stat.ms_entries); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1717, __pyx_L4_error)
  24113. __Pyx_GOTREF(__pyx_t_3);
  24114. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1717, __pyx_L4_error)
  24115. __Pyx_GOTREF(__pyx_t_2);
  24116. __Pyx_GIVEREF(__pyx_t_3);
  24117. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  24118. __Pyx_INCREF(__pyx_int_5);
  24119. __Pyx_GIVEREF(__pyx_int_5);
  24120. PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_5);
  24121. __pyx_t_3 = 0;
  24122. __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1717, __pyx_L4_error)
  24123. __Pyx_GOTREF(__pyx_t_3);
  24124. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  24125. __pyx_v_ret = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_3);
  24126. __pyx_t_3 = 0;
  24127. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1719
  24128. * ret = ResultSet(stat.ms_entries, KLEN)
  24129. *
  24130. * try: # <<<<<<<<<<<<<<
  24131. * _check(lmdb.mdb_cursor_get(
  24132. * icur, &key_v, NULL, lmdb.MDB_FIRST))
  24133. */
  24134. {
  24135. __Pyx_PyThreadState_declare
  24136. __Pyx_PyThreadState_assign
  24137. __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
  24138. __Pyx_XGOTREF(__pyx_t_9);
  24139. __Pyx_XGOTREF(__pyx_t_10);
  24140. __Pyx_XGOTREF(__pyx_t_11);
  24141. /*try:*/ {
  24142. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1720
  24143. *
  24144. * try:
  24145. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  24146. * icur, &key_v, NULL, lmdb.MDB_FIRST))
  24147. * except KeyNotFoundError:
  24148. */
  24149. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_icur, (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v), NULL, MDB_FIRST), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1720, __pyx_L6_error)
  24150. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1719
  24151. * ret = ResultSet(stat.ms_entries, KLEN)
  24152. *
  24153. * try: # <<<<<<<<<<<<<<
  24154. * _check(lmdb.mdb_cursor_get(
  24155. * icur, &key_v, NULL, lmdb.MDB_FIRST))
  24156. */
  24157. }
  24158. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  24159. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  24160. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  24161. goto __pyx_L11_try_end;
  24162. __pyx_L6_error:;
  24163. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  24164. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  24165. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  24166. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  24167. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  24168. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1722
  24169. * _check(lmdb.mdb_cursor_get(
  24170. * icur, &key_v, NULL, lmdb.MDB_FIRST))
  24171. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  24172. * return ResultSet(0, DBL_KLEN)
  24173. *
  24174. */
  24175. __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
  24176. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1722, __pyx_L8_except_error)
  24177. __Pyx_GOTREF(__pyx_t_4);
  24178. __pyx_t_12 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_3, __pyx_t_4);
  24179. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  24180. __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_1);
  24181. __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0;
  24182. if (__pyx_t_12) {
  24183. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._all_term_keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  24184. if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 1722, __pyx_L8_except_error)
  24185. __Pyx_GOTREF(__pyx_t_1);
  24186. __Pyx_GOTREF(__pyx_t_2);
  24187. __Pyx_GOTREF(__pyx_t_3);
  24188. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1723
  24189. * icur, &key_v, NULL, lmdb.MDB_FIRST))
  24190. * except KeyNotFoundError:
  24191. * return ResultSet(0, DBL_KLEN) # <<<<<<<<<<<<<<
  24192. *
  24193. * while True:
  24194. */
  24195. __Pyx_XDECREF(((PyObject *)__pyx_r));
  24196. __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet), __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1723, __pyx_L8_except_error)
  24197. __Pyx_GOTREF(__pyx_t_4);
  24198. __pyx_r = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_4);
  24199. __pyx_t_4 = 0;
  24200. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  24201. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  24202. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24203. goto __pyx_L9_except_return;
  24204. }
  24205. goto __pyx_L8_except_error;
  24206. __pyx_L8_except_error:;
  24207. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1719
  24208. * ret = ResultSet(stat.ms_entries, KLEN)
  24209. *
  24210. * try: # <<<<<<<<<<<<<<
  24211. * _check(lmdb.mdb_cursor_get(
  24212. * icur, &key_v, NULL, lmdb.MDB_FIRST))
  24213. */
  24214. __Pyx_XGIVEREF(__pyx_t_9);
  24215. __Pyx_XGIVEREF(__pyx_t_10);
  24216. __Pyx_XGIVEREF(__pyx_t_11);
  24217. __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
  24218. goto __pyx_L4_error;
  24219. __pyx_L9_except_return:;
  24220. __Pyx_XGIVEREF(__pyx_t_9);
  24221. __Pyx_XGIVEREF(__pyx_t_10);
  24222. __Pyx_XGIVEREF(__pyx_t_11);
  24223. __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
  24224. goto __pyx_L3_return;
  24225. __pyx_L11_try_end:;
  24226. }
  24227. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1725
  24228. * return ResultSet(0, DBL_KLEN)
  24229. *
  24230. * while True: # <<<<<<<<<<<<<<
  24231. * memcpy(ret.data + ret.itemsize * i, key_v.mv_data, KLEN)
  24232. *
  24233. */
  24234. while (1) {
  24235. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1726
  24236. *
  24237. * while True:
  24238. * memcpy(ret.data + ret.itemsize * i, key_v.mv_data, KLEN) # <<<<<<<<<<<<<<
  24239. *
  24240. * rc = lmdb.mdb_cursor_get(
  24241. */
  24242. (void)(memcpy((__pyx_v_ret->data + (__pyx_v_ret->itemsize * __pyx_v_i)), __pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v.mv_data, 5));
  24243. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1728
  24244. * memcpy(ret.data + ret.itemsize * i, key_v.mv_data, KLEN)
  24245. *
  24246. * rc = lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  24247. * icur, &key_v, NULL, lmdb.MDB_NEXT_NODUP)
  24248. * try:
  24249. */
  24250. __pyx_v_rc = mdb_cursor_get(__pyx_v_icur, (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v), NULL, MDB_NEXT_NODUP);
  24251. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1730
  24252. * rc = lmdb.mdb_cursor_get(
  24253. * icur, &key_v, NULL, lmdb.MDB_NEXT_NODUP)
  24254. * try: # <<<<<<<<<<<<<<
  24255. * _check(rc)
  24256. * except KeyNotFoundError:
  24257. */
  24258. {
  24259. __Pyx_PyThreadState_declare
  24260. __Pyx_PyThreadState_assign
  24261. __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
  24262. __Pyx_XGOTREF(__pyx_t_11);
  24263. __Pyx_XGOTREF(__pyx_t_10);
  24264. __Pyx_XGOTREF(__pyx_t_9);
  24265. /*try:*/ {
  24266. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1731
  24267. * icur, &key_v, NULL, lmdb.MDB_NEXT_NODUP)
  24268. * try:
  24269. * _check(rc) # <<<<<<<<<<<<<<
  24270. * except KeyNotFoundError:
  24271. * ret.resize(i + 1)
  24272. */
  24273. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(__pyx_v_rc, NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1731, __pyx_L16_error)
  24274. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1730
  24275. * rc = lmdb.mdb_cursor_get(
  24276. * icur, &key_v, NULL, lmdb.MDB_NEXT_NODUP)
  24277. * try: # <<<<<<<<<<<<<<
  24278. * _check(rc)
  24279. * except KeyNotFoundError:
  24280. */
  24281. }
  24282. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  24283. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  24284. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  24285. goto __pyx_L23_try_end;
  24286. __pyx_L16_error:;
  24287. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  24288. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  24289. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  24290. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  24291. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  24292. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1732
  24293. * try:
  24294. * _check(rc)
  24295. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  24296. * ret.resize(i + 1)
  24297. * return ret
  24298. */
  24299. __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
  24300. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1732, __pyx_L18_except_error)
  24301. __Pyx_GOTREF(__pyx_t_4);
  24302. __pyx_t_12 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_3, __pyx_t_4);
  24303. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  24304. __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_1);
  24305. __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0;
  24306. if (__pyx_t_12) {
  24307. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._all_term_keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  24308. if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 1732, __pyx_L18_except_error)
  24309. __Pyx_GOTREF(__pyx_t_1);
  24310. __Pyx_GOTREF(__pyx_t_2);
  24311. __Pyx_GOTREF(__pyx_t_3);
  24312. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1733
  24313. * _check(rc)
  24314. * except KeyNotFoundError:
  24315. * ret.resize(i + 1) # <<<<<<<<<<<<<<
  24316. * return ret
  24317. * i += 1
  24318. */
  24319. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_v_ret->__pyx_vtab)->resize(__pyx_v_ret, (__pyx_v_i + 1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1733, __pyx_L18_except_error)
  24320. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1734
  24321. * except KeyNotFoundError:
  24322. * ret.resize(i + 1)
  24323. * return ret # <<<<<<<<<<<<<<
  24324. * i += 1
  24325. * finally:
  24326. */
  24327. __Pyx_XDECREF(((PyObject *)__pyx_r));
  24328. __Pyx_INCREF(((PyObject *)__pyx_v_ret));
  24329. __pyx_r = __pyx_v_ret;
  24330. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  24331. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  24332. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24333. goto __pyx_L19_except_return;
  24334. }
  24335. goto __pyx_L18_except_error;
  24336. __pyx_L18_except_error:;
  24337. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1730
  24338. * rc = lmdb.mdb_cursor_get(
  24339. * icur, &key_v, NULL, lmdb.MDB_NEXT_NODUP)
  24340. * try: # <<<<<<<<<<<<<<
  24341. * _check(rc)
  24342. * except KeyNotFoundError:
  24343. */
  24344. __Pyx_XGIVEREF(__pyx_t_11);
  24345. __Pyx_XGIVEREF(__pyx_t_10);
  24346. __Pyx_XGIVEREF(__pyx_t_9);
  24347. __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
  24348. goto __pyx_L4_error;
  24349. __pyx_L19_except_return:;
  24350. __Pyx_XGIVEREF(__pyx_t_11);
  24351. __Pyx_XGIVEREF(__pyx_t_10);
  24352. __Pyx_XGIVEREF(__pyx_t_9);
  24353. __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
  24354. goto __pyx_L3_return;
  24355. __pyx_L23_try_end:;
  24356. }
  24357. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1735
  24358. * ret.resize(i + 1)
  24359. * return ret
  24360. * i += 1 # <<<<<<<<<<<<<<
  24361. * finally:
  24362. * #pass
  24363. */
  24364. __pyx_v_i = (__pyx_v_i + 1);
  24365. }
  24366. }
  24367. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1738
  24368. * finally:
  24369. * #pass
  24370. * self._cur_close(icur) # <<<<<<<<<<<<<<
  24371. *
  24372. *
  24373. */
  24374. /*finally:*/ {
  24375. /*normal exit:*/{
  24376. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_icur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1738, __pyx_L1_error)
  24377. goto __pyx_L5;
  24378. }
  24379. __pyx_L4_error:;
  24380. /*exception exit:*/{
  24381. __Pyx_PyThreadState_declare
  24382. __Pyx_PyThreadState_assign
  24383. __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
  24384. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  24385. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  24386. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  24387. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  24388. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  24389. if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
  24390. if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
  24391. __Pyx_XGOTREF(__pyx_t_9);
  24392. __Pyx_XGOTREF(__pyx_t_10);
  24393. __Pyx_XGOTREF(__pyx_t_11);
  24394. __Pyx_XGOTREF(__pyx_t_15);
  24395. __Pyx_XGOTREF(__pyx_t_16);
  24396. __Pyx_XGOTREF(__pyx_t_17);
  24397. __pyx_t_12 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_14 = __pyx_filename;
  24398. {
  24399. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_icur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1738, __pyx_L27_error)
  24400. }
  24401. if (PY_MAJOR_VERSION >= 3) {
  24402. __Pyx_XGIVEREF(__pyx_t_15);
  24403. __Pyx_XGIVEREF(__pyx_t_16);
  24404. __Pyx_XGIVEREF(__pyx_t_17);
  24405. __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
  24406. }
  24407. __Pyx_XGIVEREF(__pyx_t_9);
  24408. __Pyx_XGIVEREF(__pyx_t_10);
  24409. __Pyx_XGIVEREF(__pyx_t_11);
  24410. __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
  24411. __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
  24412. __pyx_lineno = __pyx_t_12; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_14;
  24413. goto __pyx_L1_error;
  24414. __pyx_L27_error:;
  24415. if (PY_MAJOR_VERSION >= 3) {
  24416. __Pyx_XGIVEREF(__pyx_t_15);
  24417. __Pyx_XGIVEREF(__pyx_t_16);
  24418. __Pyx_XGIVEREF(__pyx_t_17);
  24419. __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
  24420. }
  24421. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  24422. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  24423. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  24424. __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
  24425. goto __pyx_L1_error;
  24426. }
  24427. __pyx_L3_return: {
  24428. __pyx_t_18 = __pyx_r;
  24429. __pyx_r = 0;
  24430. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_icur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1738, __pyx_L1_error)
  24431. __pyx_r = __pyx_t_18;
  24432. __pyx_t_18 = 0;
  24433. goto __pyx_L0;
  24434. }
  24435. __pyx_L5:;
  24436. }
  24437. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1701
  24438. *
  24439. *
  24440. * cpdef ResultSet _all_term_keys(self, term_type): # <<<<<<<<<<<<<<
  24441. * """
  24442. * Return all keys of a (``s:po``, ``p:so``, ``o:sp``) index.
  24443. */
  24444. /* function exit code */
  24445. __pyx_r = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)Py_None); __Pyx_INCREF(Py_None);
  24446. goto __pyx_L0;
  24447. __pyx_L1_error:;
  24448. __Pyx_XDECREF(__pyx_t_1);
  24449. __Pyx_XDECREF(__pyx_t_2);
  24450. __Pyx_XDECREF(__pyx_t_3);
  24451. __Pyx_XDECREF(__pyx_t_4);
  24452. __Pyx_XDECREF(__pyx_t_5);
  24453. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._all_term_keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  24454. __pyx_r = 0;
  24455. __pyx_L0:;
  24456. __Pyx_XDECREF(__pyx_v_idx_label);
  24457. __Pyx_XDECREF((PyObject *)__pyx_v_ret);
  24458. __Pyx_XGIVEREF((PyObject *)__pyx_r);
  24459. __Pyx_TraceReturn(__pyx_r, 0);
  24460. __Pyx_RefNannyFinishContext();
  24461. return __pyx_r;
  24462. }
  24463. /* Python wrapper */
  24464. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_23_all_term_keys(PyObject *__pyx_v_self, PyObject *__pyx_v_term_type); /*proto*/
  24465. static char __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_22_all_term_keys[] = "\n Return all keys of a (``s:po``, ``p:so``, ``o:sp``) index.\n ";
  24466. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_23_all_term_keys(PyObject *__pyx_v_self, PyObject *__pyx_v_term_type) {
  24467. PyObject *__pyx_r = 0;
  24468. __Pyx_RefNannyDeclarations
  24469. __Pyx_RefNannySetupContext("_all_term_keys (wrapper)", 0);
  24470. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_22_all_term_keys(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self), ((PyObject *)__pyx_v_term_type));
  24471. /* function exit code */
  24472. __Pyx_RefNannyFinishContext();
  24473. return __pyx_r;
  24474. }
  24475. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_22_all_term_keys(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_term_type) {
  24476. PyObject *__pyx_r = NULL;
  24477. __Pyx_TraceDeclarations
  24478. __Pyx_RefNannyDeclarations
  24479. PyObject *__pyx_t_1 = NULL;
  24480. __Pyx_RefNannySetupContext("_all_term_keys", 0);
  24481. __Pyx_TraceCall("_all_term_keys (wrapper)", __pyx_f[0], 1701, 0, __PYX_ERR(0, 1701, __pyx_L1_error));
  24482. __Pyx_XDECREF(__pyx_r);
  24483. __pyx_t_1 = ((PyObject *)__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__all_term_keys(__pyx_v_self, __pyx_v_term_type, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1701, __pyx_L1_error)
  24484. __Pyx_GOTREF(__pyx_t_1);
  24485. __pyx_r = __pyx_t_1;
  24486. __pyx_t_1 = 0;
  24487. goto __pyx_L0;
  24488. /* function exit code */
  24489. __pyx_L1_error:;
  24490. __Pyx_XDECREF(__pyx_t_1);
  24491. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._all_term_keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  24492. __pyx_r = NULL;
  24493. __pyx_L0:;
  24494. __Pyx_XGIVEREF(__pyx_r);
  24495. __Pyx_TraceReturn(__pyx_r, 0);
  24496. __Pyx_RefNannyFinishContext();
  24497. return __pyx_r;
  24498. }
  24499. static PyObject *__pyx_gb_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_26generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
  24500. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1741
  24501. *
  24502. *
  24503. * def all_terms(self, term_type): # <<<<<<<<<<<<<<
  24504. * """
  24505. * Return all terms of a type (``s``, ``p``, or ``o``) in the store.
  24506. */
  24507. /* Python wrapper */
  24508. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_25all_terms(PyObject *__pyx_v_self, PyObject *__pyx_v_term_type); /*proto*/
  24509. static char __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_24all_terms[] = "\n Return all terms of a type (``s``, ``p``, or ``o``) in the store.\n ";
  24510. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_25all_terms(PyObject *__pyx_v_self, PyObject *__pyx_v_term_type) {
  24511. PyObject *__pyx_r = 0;
  24512. __Pyx_RefNannyDeclarations
  24513. __Pyx_RefNannySetupContext("all_terms (wrapper)", 0);
  24514. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_24all_terms(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self), ((PyObject *)__pyx_v_term_type));
  24515. /* function exit code */
  24516. __Pyx_RefNannyFinishContext();
  24517. return __pyx_r;
  24518. }
  24519. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_24all_terms(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_term_type) {
  24520. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms *__pyx_cur_scope;
  24521. PyObject *__pyx_r = NULL;
  24522. __Pyx_RefNannyDeclarations
  24523. __Pyx_RefNannySetupContext("all_terms", 0);
  24524. __pyx_cur_scope = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms *)__pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms(__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms, __pyx_empty_tuple, NULL);
  24525. if (unlikely(!__pyx_cur_scope)) {
  24526. __pyx_cur_scope = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms *)Py_None);
  24527. __Pyx_INCREF(Py_None);
  24528. __PYX_ERR(0, 1741, __pyx_L1_error)
  24529. } else {
  24530. __Pyx_GOTREF(__pyx_cur_scope);
  24531. }
  24532. __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  24533. __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  24534. __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  24535. __pyx_cur_scope->__pyx_v_term_type = __pyx_v_term_type;
  24536. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_term_type);
  24537. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_term_type);
  24538. {
  24539. __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_26generator2, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_all_terms, __pyx_n_s_LmdbTriplestore_all_terms, __pyx_n_s_lakesuperior_store_ldp_rs_lmdb_t); if (unlikely(!gen)) __PYX_ERR(0, 1741, __pyx_L1_error)
  24540. __Pyx_DECREF(__pyx_cur_scope);
  24541. __Pyx_RefNannyFinishContext();
  24542. return (PyObject *) gen;
  24543. }
  24544. /* function exit code */
  24545. __pyx_L1_error:;
  24546. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.all_terms", __pyx_clineno, __pyx_lineno, __pyx_filename);
  24547. __pyx_r = NULL;
  24548. __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  24549. __Pyx_XGIVEREF(__pyx_r);
  24550. __Pyx_RefNannyFinishContext();
  24551. return __pyx_r;
  24552. }
  24553. static PyObject *__pyx_gb_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_26generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
  24554. {
  24555. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms *__pyx_cur_scope = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms *)__pyx_generator->closure);
  24556. PyObject *__pyx_r = NULL;
  24557. __Pyx_TraceDeclarations
  24558. PyObject *__pyx_t_1 = NULL;
  24559. PyObject *__pyx_t_2 = NULL;
  24560. PyObject *__pyx_t_3 = NULL;
  24561. Py_ssize_t __pyx_t_4;
  24562. PyObject *(*__pyx_t_5)(PyObject *);
  24563. unsigned char *__pyx_t_6;
  24564. __Pyx_RefNannyDeclarations
  24565. __Pyx_RefNannySetupContext("all_terms", 0);
  24566. __Pyx_TraceCall("all_terms", __pyx_f[0], 1741, 0, __PYX_ERR(0, 1741, __pyx_L1_error));
  24567. switch (__pyx_generator->resume_label) {
  24568. case 0: goto __pyx_L3_first_run;
  24569. case 1: goto __pyx_L6_resume_from_yield;
  24570. default: /* CPython raises the right error here */
  24571. __Pyx_TraceReturn(Py_None, 0);
  24572. __Pyx_RefNannyFinishContext();
  24573. return NULL;
  24574. }
  24575. __pyx_L3_first_run:;
  24576. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1741, __pyx_L1_error)
  24577. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1745
  24578. * Return all terms of a type (``s``, ``p``, or ``o``) in the store.
  24579. * """
  24580. * for key in self._all_term_keys(term_type).to_tuple(): # <<<<<<<<<<<<<<
  24581. * #logger.debug('Yielding: {}'.format(key))
  24582. * yield self.from_key(key)
  24583. */
  24584. __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->_all_term_keys(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_term_type, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1745, __pyx_L1_error)
  24585. __Pyx_GOTREF(__pyx_t_2);
  24586. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_to_tuple); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1745, __pyx_L1_error)
  24587. __Pyx_GOTREF(__pyx_t_3);
  24588. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  24589. __pyx_t_2 = NULL;
  24590. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
  24591. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  24592. if (likely(__pyx_t_2)) {
  24593. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  24594. __Pyx_INCREF(__pyx_t_2);
  24595. __Pyx_INCREF(function);
  24596. __Pyx_DECREF_SET(__pyx_t_3, function);
  24597. }
  24598. }
  24599. if (__pyx_t_2) {
  24600. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1745, __pyx_L1_error)
  24601. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  24602. } else {
  24603. __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1745, __pyx_L1_error)
  24604. }
  24605. __Pyx_GOTREF(__pyx_t_1);
  24606. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24607. if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
  24608. __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
  24609. __pyx_t_5 = NULL;
  24610. } else {
  24611. __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1745, __pyx_L1_error)
  24612. __Pyx_GOTREF(__pyx_t_3);
  24613. __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1745, __pyx_L1_error)
  24614. }
  24615. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  24616. for (;;) {
  24617. if (likely(!__pyx_t_5)) {
  24618. if (likely(PyList_CheckExact(__pyx_t_3))) {
  24619. if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
  24620. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  24621. __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1745, __pyx_L1_error)
  24622. #else
  24623. __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1745, __pyx_L1_error)
  24624. __Pyx_GOTREF(__pyx_t_1);
  24625. #endif
  24626. } else {
  24627. if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
  24628. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  24629. __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1745, __pyx_L1_error)
  24630. #else
  24631. __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1745, __pyx_L1_error)
  24632. __Pyx_GOTREF(__pyx_t_1);
  24633. #endif
  24634. }
  24635. } else {
  24636. __pyx_t_1 = __pyx_t_5(__pyx_t_3);
  24637. if (unlikely(!__pyx_t_1)) {
  24638. PyObject* exc_type = PyErr_Occurred();
  24639. if (exc_type) {
  24640. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  24641. else __PYX_ERR(0, 1745, __pyx_L1_error)
  24642. }
  24643. break;
  24644. }
  24645. __Pyx_GOTREF(__pyx_t_1);
  24646. }
  24647. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_key);
  24648. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_key, __pyx_t_1);
  24649. __Pyx_GIVEREF(__pyx_t_1);
  24650. __pyx_t_1 = 0;
  24651. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1747
  24652. * for key in self._all_term_keys(term_type).to_tuple():
  24653. * #logger.debug('Yielding: {}'.format(key))
  24654. * yield self.from_key(key) # <<<<<<<<<<<<<<
  24655. *
  24656. *
  24657. */
  24658. __pyx_t_6 = __Pyx_PyObject_AsWritableUString(__pyx_cur_scope->__pyx_v_key); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 1747, __pyx_L1_error)
  24659. __pyx_t_1 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_cur_scope->__pyx_v_self->__pyx_base.__pyx_vtab)->from_key(__pyx_cur_scope->__pyx_v_self, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1747, __pyx_L1_error)
  24660. __Pyx_GOTREF(__pyx_t_1);
  24661. __pyx_r = __pyx_t_1;
  24662. __pyx_t_1 = 0;
  24663. __Pyx_XGIVEREF(__pyx_t_3);
  24664. __pyx_cur_scope->__pyx_t_0 = __pyx_t_3;
  24665. __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
  24666. __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
  24667. __Pyx_XGIVEREF(__pyx_r);
  24668. __Pyx_TraceReturn(__pyx_r, 0);
  24669. __Pyx_RefNannyFinishContext();
  24670. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  24671. /* return from generator, yielding value */
  24672. __pyx_generator->resume_label = 1;
  24673. return __pyx_r;
  24674. __pyx_L6_resume_from_yield:;
  24675. __pyx_t_3 = __pyx_cur_scope->__pyx_t_0;
  24676. __pyx_cur_scope->__pyx_t_0 = 0;
  24677. __Pyx_XGOTREF(__pyx_t_3);
  24678. __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
  24679. __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
  24680. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1747, __pyx_L1_error)
  24681. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1745
  24682. * Return all terms of a type (``s``, ``p``, or ``o``) in the store.
  24683. * """
  24684. * for key in self._all_term_keys(term_type).to_tuple(): # <<<<<<<<<<<<<<
  24685. * #logger.debug('Yielding: {}'.format(key))
  24686. * yield self.from_key(key)
  24687. */
  24688. }
  24689. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24690. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  24691. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1741
  24692. *
  24693. *
  24694. * def all_terms(self, term_type): # <<<<<<<<<<<<<<
  24695. * """
  24696. * Return all terms of a type (``s``, ``p``, or ``o``) in the store.
  24697. */
  24698. /* function exit code */
  24699. PyErr_SetNone(PyExc_StopIteration);
  24700. goto __pyx_L0;
  24701. __pyx_L1_error:;
  24702. __Pyx_XDECREF(__pyx_t_1);
  24703. __Pyx_XDECREF(__pyx_t_2);
  24704. __Pyx_XDECREF(__pyx_t_3);
  24705. __Pyx_AddTraceback("all_terms", __pyx_clineno, __pyx_lineno, __pyx_filename);
  24706. __pyx_L0:;
  24707. __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  24708. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  24709. __pyx_generator->resume_label = -1;
  24710. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  24711. __Pyx_TraceReturn(__pyx_r, 0);
  24712. __Pyx_RefNannyFinishContext();
  24713. return __pyx_r;
  24714. }
  24715. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1750
  24716. *
  24717. *
  24718. * cpdef tuple all_namespaces(self): # <<<<<<<<<<<<<<
  24719. * """
  24720. * Return all registered namespaces.
  24721. */
  24722. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_28all_namespaces(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  24723. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_all_namespaces(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, int __pyx_skip_dispatch) {
  24724. size_t __pyx_v_i;
  24725. PyObject *__pyx_v_ret = NULL;
  24726. MDB_cursor *__pyx_v_dcur;
  24727. PyObject *__pyx_r = NULL;
  24728. __Pyx_TraceDeclarations
  24729. __Pyx_RefNannyDeclarations
  24730. PyObject *__pyx_t_1 = NULL;
  24731. PyObject *__pyx_t_2 = NULL;
  24732. PyObject *__pyx_t_3 = NULL;
  24733. PyObject *__pyx_t_4 = NULL;
  24734. MDB_cursor *__pyx_t_5;
  24735. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__cur_open __pyx_t_6;
  24736. PyObject *__pyx_t_7 = NULL;
  24737. PyObject *__pyx_t_8 = NULL;
  24738. PyObject *__pyx_t_9 = NULL;
  24739. int __pyx_t_10;
  24740. int __pyx_t_11;
  24741. int __pyx_t_12;
  24742. char const *__pyx_t_13;
  24743. PyObject *__pyx_t_14 = NULL;
  24744. PyObject *__pyx_t_15 = NULL;
  24745. PyObject *__pyx_t_16 = NULL;
  24746. PyObject *__pyx_t_17 = NULL;
  24747. __Pyx_RefNannySetupContext("all_namespaces", 0);
  24748. __Pyx_TraceCall("all_namespaces", __pyx_f[0], 1750, 0, __PYX_ERR(0, 1750, __pyx_L1_error));
  24749. /* Check if called by wrapper */
  24750. if (unlikely(__pyx_skip_dispatch)) ;
  24751. /* Check if overridden in Python */
  24752. else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
  24753. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_all_namespaces); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1750, __pyx_L1_error)
  24754. __Pyx_GOTREF(__pyx_t_1);
  24755. if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_28all_namespaces)) {
  24756. __Pyx_XDECREF(__pyx_r);
  24757. __Pyx_INCREF(__pyx_t_1);
  24758. __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
  24759. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  24760. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
  24761. if (likely(__pyx_t_4)) {
  24762. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  24763. __Pyx_INCREF(__pyx_t_4);
  24764. __Pyx_INCREF(function);
  24765. __Pyx_DECREF_SET(__pyx_t_3, function);
  24766. }
  24767. }
  24768. if (__pyx_t_4) {
  24769. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1750, __pyx_L1_error)
  24770. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  24771. } else {
  24772. __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1750, __pyx_L1_error)
  24773. }
  24774. __Pyx_GOTREF(__pyx_t_2);
  24775. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24776. if (!(likely(PyTuple_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 1750, __pyx_L1_error)
  24777. __pyx_r = ((PyObject*)__pyx_t_2);
  24778. __pyx_t_2 = 0;
  24779. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  24780. goto __pyx_L0;
  24781. }
  24782. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  24783. }
  24784. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1755
  24785. * """
  24786. * cdef:
  24787. * size_t i = 0 # <<<<<<<<<<<<<<
  24788. * lmdb.MDB_stat stat
  24789. *
  24790. */
  24791. __pyx_v_i = 0;
  24792. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1758
  24793. * lmdb.MDB_stat stat
  24794. *
  24795. * ret = [] # <<<<<<<<<<<<<<
  24796. * dcur = self._cur_open('pfx:ns')
  24797. * try:
  24798. */
  24799. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1758, __pyx_L1_error)
  24800. __Pyx_GOTREF(__pyx_t_1);
  24801. __pyx_v_ret = ((PyObject*)__pyx_t_1);
  24802. __pyx_t_1 = 0;
  24803. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1759
  24804. *
  24805. * ret = []
  24806. * dcur = self._cur_open('pfx:ns') # <<<<<<<<<<<<<<
  24807. * try:
  24808. * try:
  24809. */
  24810. __pyx_t_6.__pyx_n = 1;
  24811. __pyx_t_6.dblabel = ((unsigned char *)((char const *)"pfx:ns"));
  24812. __pyx_t_5 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_open(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_6); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1759, __pyx_L1_error)
  24813. __pyx_v_dcur = __pyx_t_5;
  24814. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1760
  24815. * ret = []
  24816. * dcur = self._cur_open('pfx:ns')
  24817. * try: # <<<<<<<<<<<<<<
  24818. * try:
  24819. * _check(lmdb.mdb_cursor_get(
  24820. */
  24821. /*try:*/ {
  24822. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1761
  24823. * dcur = self._cur_open('pfx:ns')
  24824. * try:
  24825. * try: # <<<<<<<<<<<<<<
  24826. * _check(lmdb.mdb_cursor_get(
  24827. * dcur, &key_v, &data_v, lmdb.MDB_FIRST))
  24828. */
  24829. {
  24830. __Pyx_PyThreadState_declare
  24831. __Pyx_PyThreadState_assign
  24832. __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
  24833. __Pyx_XGOTREF(__pyx_t_7);
  24834. __Pyx_XGOTREF(__pyx_t_8);
  24835. __Pyx_XGOTREF(__pyx_t_9);
  24836. /*try:*/ {
  24837. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1762
  24838. * try:
  24839. * try:
  24840. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  24841. * dcur, &key_v, &data_v, lmdb.MDB_FIRST))
  24842. * except KeyNotFoundError:
  24843. */
  24844. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_dcur, (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v), (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v), MDB_FIRST), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1762, __pyx_L6_error)
  24845. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1761
  24846. * dcur = self._cur_open('pfx:ns')
  24847. * try:
  24848. * try: # <<<<<<<<<<<<<<
  24849. * _check(lmdb.mdb_cursor_get(
  24850. * dcur, &key_v, &data_v, lmdb.MDB_FIRST))
  24851. */
  24852. }
  24853. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  24854. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  24855. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  24856. goto __pyx_L11_try_end;
  24857. __pyx_L6_error:;
  24858. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  24859. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  24860. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  24861. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  24862. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1764
  24863. * _check(lmdb.mdb_cursor_get(
  24864. * dcur, &key_v, &data_v, lmdb.MDB_FIRST))
  24865. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  24866. * return tuple()
  24867. *
  24868. */
  24869. __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  24870. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1764, __pyx_L8_except_error)
  24871. __Pyx_GOTREF(__pyx_t_4);
  24872. __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_4);
  24873. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  24874. __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  24875. __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0;
  24876. if (__pyx_t_10) {
  24877. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.all_namespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  24878. if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 1764, __pyx_L8_except_error)
  24879. __Pyx_GOTREF(__pyx_t_3);
  24880. __Pyx_GOTREF(__pyx_t_2);
  24881. __Pyx_GOTREF(__pyx_t_1);
  24882. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1765
  24883. * dcur, &key_v, &data_v, lmdb.MDB_FIRST))
  24884. * except KeyNotFoundError:
  24885. * return tuple() # <<<<<<<<<<<<<<
  24886. *
  24887. * while True:
  24888. */
  24889. __Pyx_XDECREF(__pyx_r);
  24890. __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)(&PyTuple_Type))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1765, __pyx_L8_except_error)
  24891. __Pyx_GOTREF(__pyx_t_4);
  24892. __pyx_r = ((PyObject*)__pyx_t_4);
  24893. __pyx_t_4 = 0;
  24894. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  24895. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  24896. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24897. goto __pyx_L9_except_return;
  24898. }
  24899. goto __pyx_L8_except_error;
  24900. __pyx_L8_except_error:;
  24901. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1761
  24902. * dcur = self._cur_open('pfx:ns')
  24903. * try:
  24904. * try: # <<<<<<<<<<<<<<
  24905. * _check(lmdb.mdb_cursor_get(
  24906. * dcur, &key_v, &data_v, lmdb.MDB_FIRST))
  24907. */
  24908. __Pyx_XGIVEREF(__pyx_t_7);
  24909. __Pyx_XGIVEREF(__pyx_t_8);
  24910. __Pyx_XGIVEREF(__pyx_t_9);
  24911. __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
  24912. goto __pyx_L4_error;
  24913. __pyx_L9_except_return:;
  24914. __Pyx_XGIVEREF(__pyx_t_7);
  24915. __Pyx_XGIVEREF(__pyx_t_8);
  24916. __Pyx_XGIVEREF(__pyx_t_9);
  24917. __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
  24918. goto __pyx_L3_return;
  24919. __pyx_L11_try_end:;
  24920. }
  24921. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1767
  24922. * return tuple()
  24923. *
  24924. * while True: # <<<<<<<<<<<<<<
  24925. * ret.append((
  24926. * (<unsigned char *>key_v.mv_data)[: key_v.mv_size].decode(),
  24927. */
  24928. while (1) {
  24929. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1769
  24930. * while True:
  24931. * ret.append((
  24932. * (<unsigned char *>key_v.mv_data)[: key_v.mv_size].decode(), # <<<<<<<<<<<<<<
  24933. * (<unsigned char *>data_v.mv_data)[: data_v.mv_size].decode()))
  24934. * #logger.debug('Found namespace: {}:{}'.format(<unsigned char *>key_v.mv_data, <unsigned char *>data_v.mv_data))
  24935. */
  24936. __pyx_t_1 = __Pyx_decode_c_string(((char const *)((unsigned char *)__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v.mv_data)), 0, __pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v.mv_size, NULL, NULL, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1769, __pyx_L4_error)
  24937. __Pyx_GOTREF(__pyx_t_1);
  24938. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1770
  24939. * ret.append((
  24940. * (<unsigned char *>key_v.mv_data)[: key_v.mv_size].decode(),
  24941. * (<unsigned char *>data_v.mv_data)[: data_v.mv_size].decode())) # <<<<<<<<<<<<<<
  24942. * #logger.debug('Found namespace: {}:{}'.format(<unsigned char *>key_v.mv_data, <unsigned char *>data_v.mv_data))
  24943. * try:
  24944. */
  24945. __pyx_t_2 = __Pyx_decode_c_string(((char const *)((unsigned char *)__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v.mv_data)), 0, __pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v.mv_size, NULL, NULL, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1770, __pyx_L4_error)
  24946. __Pyx_GOTREF(__pyx_t_2);
  24947. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1769
  24948. * while True:
  24949. * ret.append((
  24950. * (<unsigned char *>key_v.mv_data)[: key_v.mv_size].decode(), # <<<<<<<<<<<<<<
  24951. * (<unsigned char *>data_v.mv_data)[: data_v.mv_size].decode()))
  24952. * #logger.debug('Found namespace: {}:{}'.format(<unsigned char *>key_v.mv_data, <unsigned char *>data_v.mv_data))
  24953. */
  24954. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1769, __pyx_L4_error)
  24955. __Pyx_GOTREF(__pyx_t_3);
  24956. __Pyx_GIVEREF(__pyx_t_1);
  24957. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  24958. __Pyx_GIVEREF(__pyx_t_2);
  24959. PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  24960. __pyx_t_1 = 0;
  24961. __pyx_t_2 = 0;
  24962. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1768
  24963. *
  24964. * while True:
  24965. * ret.append(( # <<<<<<<<<<<<<<
  24966. * (<unsigned char *>key_v.mv_data)[: key_v.mv_size].decode(),
  24967. * (<unsigned char *>data_v.mv_data)[: data_v.mv_size].decode()))
  24968. */
  24969. __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_t_3); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 1768, __pyx_L4_error)
  24970. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24971. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1772
  24972. * (<unsigned char *>data_v.mv_data)[: data_v.mv_size].decode()))
  24973. * #logger.debug('Found namespace: {}:{}'.format(<unsigned char *>key_v.mv_data, <unsigned char *>data_v.mv_data))
  24974. * try: # <<<<<<<<<<<<<<
  24975. * _check(lmdb.mdb_cursor_get(
  24976. * dcur, &key_v, &data_v, lmdb.MDB_NEXT))
  24977. */
  24978. {
  24979. __Pyx_PyThreadState_declare
  24980. __Pyx_PyThreadState_assign
  24981. __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
  24982. __Pyx_XGOTREF(__pyx_t_9);
  24983. __Pyx_XGOTREF(__pyx_t_8);
  24984. __Pyx_XGOTREF(__pyx_t_7);
  24985. /*try:*/ {
  24986. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1773
  24987. * #logger.debug('Found namespace: {}:{}'.format(<unsigned char *>key_v.mv_data, <unsigned char *>data_v.mv_data))
  24988. * try:
  24989. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  24990. * dcur, &key_v, &data_v, lmdb.MDB_NEXT))
  24991. * except KeyNotFoundError:
  24992. */
  24993. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_dcur, (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v), (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v), MDB_NEXT), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1773, __pyx_L16_error)
  24994. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1772
  24995. * (<unsigned char *>data_v.mv_data)[: data_v.mv_size].decode()))
  24996. * #logger.debug('Found namespace: {}:{}'.format(<unsigned char *>key_v.mv_data, <unsigned char *>data_v.mv_data))
  24997. * try: # <<<<<<<<<<<<<<
  24998. * _check(lmdb.mdb_cursor_get(
  24999. * dcur, &key_v, &data_v, lmdb.MDB_NEXT))
  25000. */
  25001. }
  25002. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  25003. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  25004. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  25005. goto __pyx_L23_try_end;
  25006. __pyx_L16_error:;
  25007. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  25008. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  25009. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  25010. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  25011. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1775
  25012. * _check(lmdb.mdb_cursor_get(
  25013. * dcur, &key_v, &data_v, lmdb.MDB_NEXT))
  25014. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  25015. * return tuple(ret)
  25016. *
  25017. */
  25018. __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
  25019. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1775, __pyx_L18_except_error)
  25020. __Pyx_GOTREF(__pyx_t_4);
  25021. __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_3, __pyx_t_4);
  25022. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  25023. __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_1);
  25024. __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0;
  25025. if (__pyx_t_10) {
  25026. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.all_namespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  25027. if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 1775, __pyx_L18_except_error)
  25028. __Pyx_GOTREF(__pyx_t_1);
  25029. __Pyx_GOTREF(__pyx_t_2);
  25030. __Pyx_GOTREF(__pyx_t_3);
  25031. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1776
  25032. * dcur, &key_v, &data_v, lmdb.MDB_NEXT))
  25033. * except KeyNotFoundError:
  25034. * return tuple(ret) # <<<<<<<<<<<<<<
  25035. *
  25036. * i += 1
  25037. */
  25038. __Pyx_XDECREF(__pyx_r);
  25039. __pyx_t_4 = PyList_AsTuple(__pyx_v_ret); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1776, __pyx_L18_except_error)
  25040. __Pyx_GOTREF(__pyx_t_4);
  25041. __pyx_r = ((PyObject*)__pyx_t_4);
  25042. __pyx_t_4 = 0;
  25043. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  25044. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  25045. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  25046. goto __pyx_L19_except_return;
  25047. }
  25048. goto __pyx_L18_except_error;
  25049. __pyx_L18_except_error:;
  25050. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1772
  25051. * (<unsigned char *>data_v.mv_data)[: data_v.mv_size].decode()))
  25052. * #logger.debug('Found namespace: {}:{}'.format(<unsigned char *>key_v.mv_data, <unsigned char *>data_v.mv_data))
  25053. * try: # <<<<<<<<<<<<<<
  25054. * _check(lmdb.mdb_cursor_get(
  25055. * dcur, &key_v, &data_v, lmdb.MDB_NEXT))
  25056. */
  25057. __Pyx_XGIVEREF(__pyx_t_9);
  25058. __Pyx_XGIVEREF(__pyx_t_8);
  25059. __Pyx_XGIVEREF(__pyx_t_7);
  25060. __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
  25061. goto __pyx_L4_error;
  25062. __pyx_L19_except_return:;
  25063. __Pyx_XGIVEREF(__pyx_t_9);
  25064. __Pyx_XGIVEREF(__pyx_t_8);
  25065. __Pyx_XGIVEREF(__pyx_t_7);
  25066. __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
  25067. goto __pyx_L3_return;
  25068. __pyx_L23_try_end:;
  25069. }
  25070. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1778
  25071. * return tuple(ret)
  25072. *
  25073. * i += 1 # <<<<<<<<<<<<<<
  25074. * finally:
  25075. * #pass
  25076. */
  25077. __pyx_v_i = (__pyx_v_i + 1);
  25078. }
  25079. }
  25080. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1781
  25081. * finally:
  25082. * #pass
  25083. * self._cur_close(dcur) # <<<<<<<<<<<<<<
  25084. *
  25085. *
  25086. */
  25087. /*finally:*/ {
  25088. /*normal exit:*/{
  25089. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_dcur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1781, __pyx_L1_error)
  25090. goto __pyx_L5;
  25091. }
  25092. __pyx_L4_error:;
  25093. /*exception exit:*/{
  25094. __Pyx_PyThreadState_declare
  25095. __Pyx_PyThreadState_assign
  25096. __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
  25097. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  25098. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  25099. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  25100. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  25101. if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
  25102. if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
  25103. __Pyx_XGOTREF(__pyx_t_7);
  25104. __Pyx_XGOTREF(__pyx_t_8);
  25105. __Pyx_XGOTREF(__pyx_t_9);
  25106. __Pyx_XGOTREF(__pyx_t_14);
  25107. __Pyx_XGOTREF(__pyx_t_15);
  25108. __Pyx_XGOTREF(__pyx_t_16);
  25109. __pyx_t_10 = __pyx_lineno; __pyx_t_12 = __pyx_clineno; __pyx_t_13 = __pyx_filename;
  25110. {
  25111. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_dcur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1781, __pyx_L27_error)
  25112. }
  25113. if (PY_MAJOR_VERSION >= 3) {
  25114. __Pyx_XGIVEREF(__pyx_t_14);
  25115. __Pyx_XGIVEREF(__pyx_t_15);
  25116. __Pyx_XGIVEREF(__pyx_t_16);
  25117. __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
  25118. }
  25119. __Pyx_XGIVEREF(__pyx_t_7);
  25120. __Pyx_XGIVEREF(__pyx_t_8);
  25121. __Pyx_XGIVEREF(__pyx_t_9);
  25122. __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
  25123. __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
  25124. __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_12; __pyx_filename = __pyx_t_13;
  25125. goto __pyx_L1_error;
  25126. __pyx_L27_error:;
  25127. if (PY_MAJOR_VERSION >= 3) {
  25128. __Pyx_XGIVEREF(__pyx_t_14);
  25129. __Pyx_XGIVEREF(__pyx_t_15);
  25130. __Pyx_XGIVEREF(__pyx_t_16);
  25131. __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
  25132. }
  25133. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  25134. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  25135. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  25136. __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
  25137. goto __pyx_L1_error;
  25138. }
  25139. __pyx_L3_return: {
  25140. __pyx_t_17 = __pyx_r;
  25141. __pyx_r = 0;
  25142. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_dcur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1781, __pyx_L1_error)
  25143. __pyx_r = __pyx_t_17;
  25144. __pyx_t_17 = 0;
  25145. goto __pyx_L0;
  25146. }
  25147. __pyx_L5:;
  25148. }
  25149. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1750
  25150. *
  25151. *
  25152. * cpdef tuple all_namespaces(self): # <<<<<<<<<<<<<<
  25153. * """
  25154. * Return all registered namespaces.
  25155. */
  25156. /* function exit code */
  25157. __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  25158. goto __pyx_L0;
  25159. __pyx_L1_error:;
  25160. __Pyx_XDECREF(__pyx_t_1);
  25161. __Pyx_XDECREF(__pyx_t_2);
  25162. __Pyx_XDECREF(__pyx_t_3);
  25163. __Pyx_XDECREF(__pyx_t_4);
  25164. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.all_namespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  25165. __pyx_r = 0;
  25166. __pyx_L0:;
  25167. __Pyx_XDECREF(__pyx_v_ret);
  25168. __Pyx_XGIVEREF(__pyx_r);
  25169. __Pyx_TraceReturn(__pyx_r, 0);
  25170. __Pyx_RefNannyFinishContext();
  25171. return __pyx_r;
  25172. }
  25173. /* Python wrapper */
  25174. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_28all_namespaces(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  25175. static char __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_27all_namespaces[] = "\n Return all registered namespaces.\n ";
  25176. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_28all_namespaces(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  25177. PyObject *__pyx_r = 0;
  25178. __Pyx_RefNannyDeclarations
  25179. __Pyx_RefNannySetupContext("all_namespaces (wrapper)", 0);
  25180. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_27all_namespaces(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self));
  25181. /* function exit code */
  25182. __Pyx_RefNannyFinishContext();
  25183. return __pyx_r;
  25184. }
  25185. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_27all_namespaces(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self) {
  25186. PyObject *__pyx_r = NULL;
  25187. __Pyx_TraceDeclarations
  25188. __Pyx_RefNannyDeclarations
  25189. PyObject *__pyx_t_1 = NULL;
  25190. __Pyx_RefNannySetupContext("all_namespaces", 0);
  25191. __Pyx_TraceCall("all_namespaces (wrapper)", __pyx_f[0], 1750, 0, __PYX_ERR(0, 1750, __pyx_L1_error));
  25192. __Pyx_XDECREF(__pyx_r);
  25193. __pyx_t_1 = __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_all_namespaces(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1750, __pyx_L1_error)
  25194. __Pyx_GOTREF(__pyx_t_1);
  25195. __pyx_r = __pyx_t_1;
  25196. __pyx_t_1 = 0;
  25197. goto __pyx_L0;
  25198. /* function exit code */
  25199. __pyx_L1_error:;
  25200. __Pyx_XDECREF(__pyx_t_1);
  25201. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.all_namespaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  25202. __pyx_r = NULL;
  25203. __pyx_L0:;
  25204. __Pyx_XGIVEREF(__pyx_r);
  25205. __Pyx_TraceReturn(__pyx_r, 0);
  25206. __Pyx_RefNannyFinishContext();
  25207. return __pyx_r;
  25208. }
  25209. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1784
  25210. *
  25211. *
  25212. * cpdef tuple all_contexts(self, triple=None): # <<<<<<<<<<<<<<
  25213. * """
  25214. * Get a list of all contexts.
  25215. */
  25216. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_30all_contexts(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  25217. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_all_contexts(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_all_contexts *__pyx_optional_args) {
  25218. PyObject *__pyx_v_triple = ((PyObject *)Py_None);
  25219. struct MDB_stat __pyx_v_stat;
  25220. size_t __pyx_v_i;
  25221. unsigned char __pyx_v_spok[15];
  25222. MDB_cursor *__pyx_v_cur;
  25223. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *__pyx_v_ret = NULL;
  25224. PyObject *__pyx_r = NULL;
  25225. __Pyx_TraceDeclarations
  25226. __Pyx_RefNannyDeclarations
  25227. PyObject *__pyx_t_1 = NULL;
  25228. PyObject *__pyx_t_2 = NULL;
  25229. PyObject *__pyx_t_3 = NULL;
  25230. PyObject *__pyx_t_4 = NULL;
  25231. PyObject *__pyx_t_5 = NULL;
  25232. MDB_cursor *__pyx_t_6;
  25233. int __pyx_t_7;
  25234. int __pyx_t_8;
  25235. MDB_cursor *__pyx_t_9;
  25236. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__cur_open __pyx_t_10;
  25237. PyObject *__pyx_t_11 = NULL;
  25238. PyObject *__pyx_t_12 = NULL;
  25239. PyObject *__pyx_t_13 = NULL;
  25240. int __pyx_t_14;
  25241. int __pyx_t_15;
  25242. char const *__pyx_t_16;
  25243. PyObject *__pyx_t_17 = NULL;
  25244. PyObject *__pyx_t_18 = NULL;
  25245. PyObject *__pyx_t_19 = NULL;
  25246. PyObject *__pyx_t_20 = NULL;
  25247. __Pyx_RefNannySetupContext("all_contexts", 0);
  25248. __Pyx_TraceCall("all_contexts", __pyx_f[0], 1784, 0, __PYX_ERR(0, 1784, __pyx_L1_error));
  25249. if (__pyx_optional_args) {
  25250. if (__pyx_optional_args->__pyx_n > 0) {
  25251. __pyx_v_triple = __pyx_optional_args->triple;
  25252. }
  25253. }
  25254. /* Check if called by wrapper */
  25255. if (unlikely(__pyx_skip_dispatch)) ;
  25256. /* Check if overridden in Python */
  25257. else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
  25258. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_all_contexts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1784, __pyx_L1_error)
  25259. __Pyx_GOTREF(__pyx_t_1);
  25260. if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_30all_contexts)) {
  25261. __Pyx_XDECREF(__pyx_r);
  25262. __Pyx_INCREF(__pyx_t_1);
  25263. __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
  25264. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  25265. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
  25266. if (likely(__pyx_t_4)) {
  25267. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  25268. __Pyx_INCREF(__pyx_t_4);
  25269. __Pyx_INCREF(function);
  25270. __Pyx_DECREF_SET(__pyx_t_3, function);
  25271. }
  25272. }
  25273. if (!__pyx_t_4) {
  25274. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_triple); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1784, __pyx_L1_error)
  25275. __Pyx_GOTREF(__pyx_t_2);
  25276. } else {
  25277. #if CYTHON_FAST_PYCALL
  25278. if (PyFunction_Check(__pyx_t_3)) {
  25279. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_triple};
  25280. __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1784, __pyx_L1_error)
  25281. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  25282. __Pyx_GOTREF(__pyx_t_2);
  25283. } else
  25284. #endif
  25285. #if CYTHON_FAST_PYCCALL
  25286. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  25287. PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_triple};
  25288. __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1784, __pyx_L1_error)
  25289. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  25290. __Pyx_GOTREF(__pyx_t_2);
  25291. } else
  25292. #endif
  25293. {
  25294. __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1784, __pyx_L1_error)
  25295. __Pyx_GOTREF(__pyx_t_5);
  25296. __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
  25297. __Pyx_INCREF(__pyx_v_triple);
  25298. __Pyx_GIVEREF(__pyx_v_triple);
  25299. PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_triple);
  25300. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1784, __pyx_L1_error)
  25301. __Pyx_GOTREF(__pyx_t_2);
  25302. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  25303. }
  25304. }
  25305. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  25306. if (!(likely(PyTuple_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 1784, __pyx_L1_error)
  25307. __pyx_r = ((PyObject*)__pyx_t_2);
  25308. __pyx_t_2 = 0;
  25309. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  25310. goto __pyx_L0;
  25311. }
  25312. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  25313. }
  25314. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1792
  25315. * cdef:
  25316. * lmdb.MDB_stat stat
  25317. * size_t i = 0 # <<<<<<<<<<<<<<
  25318. * unsigned char spok[TRP_KLEN]
  25319. * unsigned char ck[KLEN]
  25320. */
  25321. __pyx_v_i = 0;
  25322. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1798
  25323. *
  25324. * cur = (
  25325. * self._cur_open('spo:c') if triple and all(triple) # <<<<<<<<<<<<<<
  25326. * else self._cur_open('c:'))
  25327. * try:
  25328. */
  25329. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_triple); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1798, __pyx_L1_error)
  25330. if (__pyx_t_8) {
  25331. } else {
  25332. __pyx_t_7 = __pyx_t_8;
  25333. goto __pyx_L3_bool_binop_done;
  25334. }
  25335. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_all, __pyx_v_triple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1798, __pyx_L1_error)
  25336. __Pyx_GOTREF(__pyx_t_1);
  25337. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1798, __pyx_L1_error)
  25338. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  25339. __pyx_t_7 = __pyx_t_8;
  25340. __pyx_L3_bool_binop_done:;
  25341. if (__pyx_t_7) {
  25342. __pyx_t_10.__pyx_n = 1;
  25343. __pyx_t_10.dblabel = ((unsigned char *)((char const *)"spo:c"));
  25344. __pyx_t_9 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_open(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1798, __pyx_L1_error)
  25345. __pyx_t_6 = __pyx_t_9;
  25346. } else {
  25347. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1799
  25348. * cur = (
  25349. * self._cur_open('spo:c') if triple and all(triple)
  25350. * else self._cur_open('c:')) # <<<<<<<<<<<<<<
  25351. * try:
  25352. * if triple and all(triple):
  25353. */
  25354. __pyx_t_10.__pyx_n = 1;
  25355. __pyx_t_10.dblabel = ((unsigned char *)((char const *)"c:"));
  25356. __pyx_t_9 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_open(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1799, __pyx_L1_error)
  25357. __pyx_t_6 = __pyx_t_9;
  25358. }
  25359. __pyx_v_cur = __pyx_t_6;
  25360. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1800
  25361. * self._cur_open('spo:c') if triple and all(triple)
  25362. * else self._cur_open('c:'))
  25363. * try: # <<<<<<<<<<<<<<
  25364. * if triple and all(triple):
  25365. * _check(lmdb.mdb_stat(
  25366. */
  25367. /*try:*/ {
  25368. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1801
  25369. * else self._cur_open('c:'))
  25370. * try:
  25371. * if triple and all(triple): # <<<<<<<<<<<<<<
  25372. * _check(lmdb.mdb_stat(
  25373. * self.txn, lmdb.mdb_cursor_dbi(cur), &stat))
  25374. */
  25375. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_triple); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1801, __pyx_L6_error)
  25376. if (__pyx_t_8) {
  25377. } else {
  25378. __pyx_t_7 = __pyx_t_8;
  25379. goto __pyx_L9_bool_binop_done;
  25380. }
  25381. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_all, __pyx_v_triple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1801, __pyx_L6_error)
  25382. __Pyx_GOTREF(__pyx_t_1);
  25383. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1801, __pyx_L6_error)
  25384. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  25385. __pyx_t_7 = __pyx_t_8;
  25386. __pyx_L9_bool_binop_done:;
  25387. if (__pyx_t_7) {
  25388. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1802
  25389. * try:
  25390. * if triple and all(triple):
  25391. * _check(lmdb.mdb_stat( # <<<<<<<<<<<<<<
  25392. * self.txn, lmdb.mdb_cursor_dbi(cur), &stat))
  25393. * ret = ResultSet(stat.ms_entries, KLEN)
  25394. */
  25395. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_stat(__pyx_v_self->__pyx_base.txn, mdb_cursor_dbi(__pyx_v_cur), (&__pyx_v_stat)), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1802, __pyx_L6_error)
  25396. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1804
  25397. * _check(lmdb.mdb_stat(
  25398. * self.txn, lmdb.mdb_cursor_dbi(cur), &stat))
  25399. * ret = ResultSet(stat.ms_entries, KLEN) # <<<<<<<<<<<<<<
  25400. *
  25401. * self._to_triple_key(triple, &spok)
  25402. */
  25403. __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_stat.ms_entries); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1804, __pyx_L6_error)
  25404. __Pyx_GOTREF(__pyx_t_1);
  25405. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1804, __pyx_L6_error)
  25406. __Pyx_GOTREF(__pyx_t_2);
  25407. __Pyx_GIVEREF(__pyx_t_1);
  25408. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  25409. __Pyx_INCREF(__pyx_int_5);
  25410. __Pyx_GIVEREF(__pyx_int_5);
  25411. PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_5);
  25412. __pyx_t_1 = 0;
  25413. __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1804, __pyx_L6_error)
  25414. __Pyx_GOTREF(__pyx_t_1);
  25415. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  25416. __pyx_v_ret = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_1);
  25417. __pyx_t_1 = 0;
  25418. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1806
  25419. * ret = ResultSet(stat.ms_entries, KLEN)
  25420. *
  25421. * self._to_triple_key(triple, &spok) # <<<<<<<<<<<<<<
  25422. * key_v.mv_data = spok
  25423. * key_v.mv_size = TRP_KLEN
  25424. */
  25425. if (!(likely(PyTuple_CheckExact(__pyx_v_triple))||((__pyx_v_triple) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v_triple)->tp_name), 0))) __PYX_ERR(0, 1806, __pyx_L6_error)
  25426. __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__to_triple_key(__pyx_v_self, ((PyObject*)__pyx_v_triple), (&__pyx_v_spok)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1806, __pyx_L6_error)
  25427. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1807
  25428. *
  25429. * self._to_triple_key(triple, &spok)
  25430. * key_v.mv_data = spok # <<<<<<<<<<<<<<
  25431. * key_v.mv_size = TRP_KLEN
  25432. * try:
  25433. */
  25434. __pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v.mv_data = __pyx_v_spok;
  25435. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1808
  25436. * self._to_triple_key(triple, &spok)
  25437. * key_v.mv_data = spok
  25438. * key_v.mv_size = TRP_KLEN # <<<<<<<<<<<<<<
  25439. * try:
  25440. * _check(lmdb.mdb_cursor_get(
  25441. */
  25442. __pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v.mv_size = 15;
  25443. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1809
  25444. * key_v.mv_data = spok
  25445. * key_v.mv_size = TRP_KLEN
  25446. * try: # <<<<<<<<<<<<<<
  25447. * _check(lmdb.mdb_cursor_get(
  25448. * cur, &key_v, &data_v, lmdb.MDB_SET_KEY))
  25449. */
  25450. {
  25451. __Pyx_PyThreadState_declare
  25452. __Pyx_PyThreadState_assign
  25453. __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
  25454. __Pyx_XGOTREF(__pyx_t_11);
  25455. __Pyx_XGOTREF(__pyx_t_12);
  25456. __Pyx_XGOTREF(__pyx_t_13);
  25457. /*try:*/ {
  25458. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1810
  25459. * key_v.mv_size = TRP_KLEN
  25460. * try:
  25461. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  25462. * cur, &key_v, &data_v, lmdb.MDB_SET_KEY))
  25463. * except KeyNotFoundError:
  25464. */
  25465. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_cur, (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v), (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v), MDB_SET_KEY), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1810, __pyx_L11_error)
  25466. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1809
  25467. * key_v.mv_data = spok
  25468. * key_v.mv_size = TRP_KLEN
  25469. * try: # <<<<<<<<<<<<<<
  25470. * _check(lmdb.mdb_cursor_get(
  25471. * cur, &key_v, &data_v, lmdb.MDB_SET_KEY))
  25472. */
  25473. }
  25474. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  25475. __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  25476. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  25477. goto __pyx_L16_try_end;
  25478. __pyx_L11_error:;
  25479. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  25480. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  25481. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  25482. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  25483. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  25484. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1812
  25485. * _check(lmdb.mdb_cursor_get(
  25486. * cur, &key_v, &data_v, lmdb.MDB_SET_KEY))
  25487. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  25488. * return tuple()
  25489. *
  25490. */
  25491. __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  25492. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1812, __pyx_L13_except_error)
  25493. __Pyx_GOTREF(__pyx_t_5);
  25494. __pyx_t_14 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_5);
  25495. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  25496. __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  25497. __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0;
  25498. if (__pyx_t_14) {
  25499. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.all_contexts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  25500. if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 1812, __pyx_L13_except_error)
  25501. __Pyx_GOTREF(__pyx_t_3);
  25502. __Pyx_GOTREF(__pyx_t_2);
  25503. __Pyx_GOTREF(__pyx_t_1);
  25504. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1813
  25505. * cur, &key_v, &data_v, lmdb.MDB_SET_KEY))
  25506. * except KeyNotFoundError:
  25507. * return tuple() # <<<<<<<<<<<<<<
  25508. *
  25509. * while True:
  25510. */
  25511. __Pyx_XDECREF(__pyx_r);
  25512. __pyx_t_5 = __Pyx_PyObject_CallNoArg(((PyObject *)(&PyTuple_Type))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1813, __pyx_L13_except_error)
  25513. __Pyx_GOTREF(__pyx_t_5);
  25514. __pyx_r = ((PyObject*)__pyx_t_5);
  25515. __pyx_t_5 = 0;
  25516. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  25517. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  25518. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  25519. goto __pyx_L14_except_return;
  25520. }
  25521. goto __pyx_L13_except_error;
  25522. __pyx_L13_except_error:;
  25523. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1809
  25524. * key_v.mv_data = spok
  25525. * key_v.mv_size = TRP_KLEN
  25526. * try: # <<<<<<<<<<<<<<
  25527. * _check(lmdb.mdb_cursor_get(
  25528. * cur, &key_v, &data_v, lmdb.MDB_SET_KEY))
  25529. */
  25530. __Pyx_XGIVEREF(__pyx_t_11);
  25531. __Pyx_XGIVEREF(__pyx_t_12);
  25532. __Pyx_XGIVEREF(__pyx_t_13);
  25533. __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
  25534. goto __pyx_L6_error;
  25535. __pyx_L14_except_return:;
  25536. __Pyx_XGIVEREF(__pyx_t_11);
  25537. __Pyx_XGIVEREF(__pyx_t_12);
  25538. __Pyx_XGIVEREF(__pyx_t_13);
  25539. __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
  25540. goto __pyx_L5_return;
  25541. __pyx_L16_try_end:;
  25542. }
  25543. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1815
  25544. * return tuple()
  25545. *
  25546. * while True: # <<<<<<<<<<<<<<
  25547. * memcpy(ret.data + ret.itemsize * i, data_v.mv_data, KLEN)
  25548. * try:
  25549. */
  25550. while (1) {
  25551. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1816
  25552. *
  25553. * while True:
  25554. * memcpy(ret.data + ret.itemsize * i, data_v.mv_data, KLEN) # <<<<<<<<<<<<<<
  25555. * try:
  25556. * _check(lmdb.mdb_cursor_get(
  25557. */
  25558. (void)(memcpy((__pyx_v_ret->data + (__pyx_v_ret->itemsize * __pyx_v_i)), __pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v.mv_data, 5));
  25559. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1817
  25560. * while True:
  25561. * memcpy(ret.data + ret.itemsize * i, data_v.mv_data, KLEN)
  25562. * try: # <<<<<<<<<<<<<<
  25563. * _check(lmdb.mdb_cursor_get(
  25564. * cur, &key_v, &data_v, lmdb.MDB_NEXT_DUP))
  25565. */
  25566. {
  25567. __Pyx_PyThreadState_declare
  25568. __Pyx_PyThreadState_assign
  25569. __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
  25570. __Pyx_XGOTREF(__pyx_t_13);
  25571. __Pyx_XGOTREF(__pyx_t_12);
  25572. __Pyx_XGOTREF(__pyx_t_11);
  25573. /*try:*/ {
  25574. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1818
  25575. * memcpy(ret.data + ret.itemsize * i, data_v.mv_data, KLEN)
  25576. * try:
  25577. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  25578. * cur, &key_v, &data_v, lmdb.MDB_NEXT_DUP))
  25579. * except KeyNotFoundError:
  25580. */
  25581. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_cur, (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v), (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v), MDB_NEXT_DUP), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1818, __pyx_L21_error)
  25582. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1817
  25583. * while True:
  25584. * memcpy(ret.data + ret.itemsize * i, data_v.mv_data, KLEN)
  25585. * try: # <<<<<<<<<<<<<<
  25586. * _check(lmdb.mdb_cursor_get(
  25587. * cur, &key_v, &data_v, lmdb.MDB_NEXT_DUP))
  25588. */
  25589. }
  25590. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  25591. __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  25592. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  25593. goto __pyx_L28_try_end;
  25594. __pyx_L21_error:;
  25595. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  25596. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  25597. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  25598. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  25599. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  25600. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1820
  25601. * _check(lmdb.mdb_cursor_get(
  25602. * cur, &key_v, &data_v, lmdb.MDB_NEXT_DUP))
  25603. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  25604. * break
  25605. *
  25606. */
  25607. __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  25608. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1820, __pyx_L23_except_error)
  25609. __Pyx_GOTREF(__pyx_t_5);
  25610. __pyx_t_14 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_5);
  25611. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  25612. __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  25613. __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0;
  25614. if (__pyx_t_14) {
  25615. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.all_contexts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  25616. if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 1820, __pyx_L23_except_error)
  25617. __Pyx_GOTREF(__pyx_t_3);
  25618. __Pyx_GOTREF(__pyx_t_2);
  25619. __Pyx_GOTREF(__pyx_t_1);
  25620. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1821
  25621. * cur, &key_v, &data_v, lmdb.MDB_NEXT_DUP))
  25622. * except KeyNotFoundError:
  25623. * break # <<<<<<<<<<<<<<
  25624. *
  25625. * i += 1
  25626. */
  25627. goto __pyx_L29_except_break;
  25628. __pyx_L29_except_break:;
  25629. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  25630. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  25631. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  25632. goto __pyx_L26_try_break;
  25633. }
  25634. goto __pyx_L23_except_error;
  25635. __pyx_L23_except_error:;
  25636. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1817
  25637. * while True:
  25638. * memcpy(ret.data + ret.itemsize * i, data_v.mv_data, KLEN)
  25639. * try: # <<<<<<<<<<<<<<
  25640. * _check(lmdb.mdb_cursor_get(
  25641. * cur, &key_v, &data_v, lmdb.MDB_NEXT_DUP))
  25642. */
  25643. __Pyx_XGIVEREF(__pyx_t_13);
  25644. __Pyx_XGIVEREF(__pyx_t_12);
  25645. __Pyx_XGIVEREF(__pyx_t_11);
  25646. __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_12, __pyx_t_11);
  25647. goto __pyx_L6_error;
  25648. __pyx_L26_try_break:;
  25649. __Pyx_XGIVEREF(__pyx_t_13);
  25650. __Pyx_XGIVEREF(__pyx_t_12);
  25651. __Pyx_XGIVEREF(__pyx_t_11);
  25652. __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_12, __pyx_t_11);
  25653. goto __pyx_L20_break;
  25654. __pyx_L28_try_end:;
  25655. }
  25656. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1823
  25657. * break
  25658. *
  25659. * i += 1 # <<<<<<<<<<<<<<
  25660. * else:
  25661. * _check(lmdb.mdb_stat(
  25662. */
  25663. __pyx_v_i = (__pyx_v_i + 1);
  25664. }
  25665. __pyx_L20_break:;
  25666. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1801
  25667. * else self._cur_open('c:'))
  25668. * try:
  25669. * if triple and all(triple): # <<<<<<<<<<<<<<
  25670. * _check(lmdb.mdb_stat(
  25671. * self.txn, lmdb.mdb_cursor_dbi(cur), &stat))
  25672. */
  25673. goto __pyx_L8;
  25674. }
  25675. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1825
  25676. * i += 1
  25677. * else:
  25678. * _check(lmdb.mdb_stat( # <<<<<<<<<<<<<<
  25679. * self.txn, lmdb.mdb_cursor_dbi(cur), &stat))
  25680. * ret = ResultSet(stat.ms_entries, KLEN)
  25681. */
  25682. /*else*/ {
  25683. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1826
  25684. * else:
  25685. * _check(lmdb.mdb_stat(
  25686. * self.txn, lmdb.mdb_cursor_dbi(cur), &stat)) # <<<<<<<<<<<<<<
  25687. * ret = ResultSet(stat.ms_entries, KLEN)
  25688. *
  25689. */
  25690. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_stat(__pyx_v_self->__pyx_base.txn, mdb_cursor_dbi(__pyx_v_cur), (&__pyx_v_stat)), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1825, __pyx_L6_error)
  25691. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1827
  25692. * _check(lmdb.mdb_stat(
  25693. * self.txn, lmdb.mdb_cursor_dbi(cur), &stat))
  25694. * ret = ResultSet(stat.ms_entries, KLEN) # <<<<<<<<<<<<<<
  25695. *
  25696. * try:
  25697. */
  25698. __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_stat.ms_entries); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1827, __pyx_L6_error)
  25699. __Pyx_GOTREF(__pyx_t_1);
  25700. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1827, __pyx_L6_error)
  25701. __Pyx_GOTREF(__pyx_t_2);
  25702. __Pyx_GIVEREF(__pyx_t_1);
  25703. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  25704. __Pyx_INCREF(__pyx_int_5);
  25705. __Pyx_GIVEREF(__pyx_int_5);
  25706. PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_5);
  25707. __pyx_t_1 = 0;
  25708. __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1827, __pyx_L6_error)
  25709. __Pyx_GOTREF(__pyx_t_1);
  25710. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  25711. __pyx_v_ret = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)__pyx_t_1);
  25712. __pyx_t_1 = 0;
  25713. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1829
  25714. * ret = ResultSet(stat.ms_entries, KLEN)
  25715. *
  25716. * try: # <<<<<<<<<<<<<<
  25717. * _check(lmdb.mdb_cursor_get(
  25718. * cur, &key_v, &data_v, lmdb.MDB_FIRST))
  25719. */
  25720. {
  25721. __Pyx_PyThreadState_declare
  25722. __Pyx_PyThreadState_assign
  25723. __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
  25724. __Pyx_XGOTREF(__pyx_t_11);
  25725. __Pyx_XGOTREF(__pyx_t_12);
  25726. __Pyx_XGOTREF(__pyx_t_13);
  25727. /*try:*/ {
  25728. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1830
  25729. *
  25730. * try:
  25731. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  25732. * cur, &key_v, &data_v, lmdb.MDB_FIRST))
  25733. * except KeyNotFoundError:
  25734. */
  25735. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_cur, (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v), (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v), MDB_FIRST), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1830, __pyx_L31_error)
  25736. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1829
  25737. * ret = ResultSet(stat.ms_entries, KLEN)
  25738. *
  25739. * try: # <<<<<<<<<<<<<<
  25740. * _check(lmdb.mdb_cursor_get(
  25741. * cur, &key_v, &data_v, lmdb.MDB_FIRST))
  25742. */
  25743. }
  25744. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  25745. __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  25746. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  25747. goto __pyx_L36_try_end;
  25748. __pyx_L31_error:;
  25749. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  25750. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  25751. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  25752. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  25753. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  25754. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1832
  25755. * _check(lmdb.mdb_cursor_get(
  25756. * cur, &key_v, &data_v, lmdb.MDB_FIRST))
  25757. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  25758. * return tuple()
  25759. *
  25760. */
  25761. __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  25762. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1832, __pyx_L33_except_error)
  25763. __Pyx_GOTREF(__pyx_t_5);
  25764. __pyx_t_14 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_5);
  25765. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  25766. __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  25767. __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0;
  25768. if (__pyx_t_14) {
  25769. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.all_contexts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  25770. if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 1832, __pyx_L33_except_error)
  25771. __Pyx_GOTREF(__pyx_t_3);
  25772. __Pyx_GOTREF(__pyx_t_2);
  25773. __Pyx_GOTREF(__pyx_t_1);
  25774. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1833
  25775. * cur, &key_v, &data_v, lmdb.MDB_FIRST))
  25776. * except KeyNotFoundError:
  25777. * return tuple() # <<<<<<<<<<<<<<
  25778. *
  25779. * while True:
  25780. */
  25781. __Pyx_XDECREF(__pyx_r);
  25782. __pyx_t_5 = __Pyx_PyObject_CallNoArg(((PyObject *)(&PyTuple_Type))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1833, __pyx_L33_except_error)
  25783. __Pyx_GOTREF(__pyx_t_5);
  25784. __pyx_r = ((PyObject*)__pyx_t_5);
  25785. __pyx_t_5 = 0;
  25786. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  25787. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  25788. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  25789. goto __pyx_L34_except_return;
  25790. }
  25791. goto __pyx_L33_except_error;
  25792. __pyx_L33_except_error:;
  25793. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1829
  25794. * ret = ResultSet(stat.ms_entries, KLEN)
  25795. *
  25796. * try: # <<<<<<<<<<<<<<
  25797. * _check(lmdb.mdb_cursor_get(
  25798. * cur, &key_v, &data_v, lmdb.MDB_FIRST))
  25799. */
  25800. __Pyx_XGIVEREF(__pyx_t_11);
  25801. __Pyx_XGIVEREF(__pyx_t_12);
  25802. __Pyx_XGIVEREF(__pyx_t_13);
  25803. __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
  25804. goto __pyx_L6_error;
  25805. __pyx_L34_except_return:;
  25806. __Pyx_XGIVEREF(__pyx_t_11);
  25807. __Pyx_XGIVEREF(__pyx_t_12);
  25808. __Pyx_XGIVEREF(__pyx_t_13);
  25809. __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
  25810. goto __pyx_L5_return;
  25811. __pyx_L36_try_end:;
  25812. }
  25813. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1835
  25814. * return tuple()
  25815. *
  25816. * while True: # <<<<<<<<<<<<<<
  25817. * memcpy(
  25818. * ret.data + ret.itemsize * i, key_v.mv_data, KLEN)
  25819. */
  25820. while (1) {
  25821. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1836
  25822. *
  25823. * while True:
  25824. * memcpy( # <<<<<<<<<<<<<<
  25825. * ret.data + ret.itemsize * i, key_v.mv_data, KLEN)
  25826. * try:
  25827. */
  25828. (void)(memcpy((__pyx_v_ret->data + (__pyx_v_ret->itemsize * __pyx_v_i)), __pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v.mv_data, 5));
  25829. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1838
  25830. * memcpy(
  25831. * ret.data + ret.itemsize * i, key_v.mv_data, KLEN)
  25832. * try: # <<<<<<<<<<<<<<
  25833. * _check(lmdb.mdb_cursor_get(
  25834. * cur, &key_v, NULL, lmdb.MDB_NEXT))
  25835. */
  25836. {
  25837. __Pyx_PyThreadState_declare
  25838. __Pyx_PyThreadState_assign
  25839. __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
  25840. __Pyx_XGOTREF(__pyx_t_13);
  25841. __Pyx_XGOTREF(__pyx_t_12);
  25842. __Pyx_XGOTREF(__pyx_t_11);
  25843. /*try:*/ {
  25844. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1839
  25845. * ret.data + ret.itemsize * i, key_v.mv_data, KLEN)
  25846. * try:
  25847. * _check(lmdb.mdb_cursor_get( # <<<<<<<<<<<<<<
  25848. * cur, &key_v, NULL, lmdb.MDB_NEXT))
  25849. * except KeyNotFoundError:
  25850. */
  25851. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_cur, (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v), NULL, MDB_NEXT), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1839, __pyx_L41_error)
  25852. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1838
  25853. * memcpy(
  25854. * ret.data + ret.itemsize * i, key_v.mv_data, KLEN)
  25855. * try: # <<<<<<<<<<<<<<
  25856. * _check(lmdb.mdb_cursor_get(
  25857. * cur, &key_v, NULL, lmdb.MDB_NEXT))
  25858. */
  25859. }
  25860. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  25861. __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  25862. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  25863. goto __pyx_L48_try_end;
  25864. __pyx_L41_error:;
  25865. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  25866. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  25867. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  25868. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  25869. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  25870. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1841
  25871. * _check(lmdb.mdb_cursor_get(
  25872. * cur, &key_v, NULL, lmdb.MDB_NEXT))
  25873. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  25874. * break
  25875. *
  25876. */
  25877. __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  25878. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1841, __pyx_L43_except_error)
  25879. __Pyx_GOTREF(__pyx_t_5);
  25880. __pyx_t_14 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_5);
  25881. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  25882. __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  25883. __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0;
  25884. if (__pyx_t_14) {
  25885. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.all_contexts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  25886. if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 1841, __pyx_L43_except_error)
  25887. __Pyx_GOTREF(__pyx_t_3);
  25888. __Pyx_GOTREF(__pyx_t_2);
  25889. __Pyx_GOTREF(__pyx_t_1);
  25890. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1842
  25891. * cur, &key_v, NULL, lmdb.MDB_NEXT))
  25892. * except KeyNotFoundError:
  25893. * break # <<<<<<<<<<<<<<
  25894. *
  25895. * i += 1
  25896. */
  25897. goto __pyx_L49_except_break;
  25898. __pyx_L49_except_break:;
  25899. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  25900. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  25901. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  25902. goto __pyx_L46_try_break;
  25903. }
  25904. goto __pyx_L43_except_error;
  25905. __pyx_L43_except_error:;
  25906. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1838
  25907. * memcpy(
  25908. * ret.data + ret.itemsize * i, key_v.mv_data, KLEN)
  25909. * try: # <<<<<<<<<<<<<<
  25910. * _check(lmdb.mdb_cursor_get(
  25911. * cur, &key_v, NULL, lmdb.MDB_NEXT))
  25912. */
  25913. __Pyx_XGIVEREF(__pyx_t_13);
  25914. __Pyx_XGIVEREF(__pyx_t_12);
  25915. __Pyx_XGIVEREF(__pyx_t_11);
  25916. __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_12, __pyx_t_11);
  25917. goto __pyx_L6_error;
  25918. __pyx_L46_try_break:;
  25919. __Pyx_XGIVEREF(__pyx_t_13);
  25920. __Pyx_XGIVEREF(__pyx_t_12);
  25921. __Pyx_XGIVEREF(__pyx_t_11);
  25922. __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_12, __pyx_t_11);
  25923. goto __pyx_L40_break;
  25924. __pyx_L48_try_end:;
  25925. }
  25926. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1844
  25927. * break
  25928. *
  25929. * i += 1 # <<<<<<<<<<<<<<
  25930. *
  25931. * return ret.to_tuple()
  25932. */
  25933. __pyx_v_i = (__pyx_v_i + 1);
  25934. }
  25935. __pyx_L40_break:;
  25936. }
  25937. __pyx_L8:;
  25938. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1846
  25939. * i += 1
  25940. *
  25941. * return ret.to_tuple() # <<<<<<<<<<<<<<
  25942. *
  25943. * finally:
  25944. */
  25945. __Pyx_XDECREF(__pyx_r);
  25946. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_ret), __pyx_n_s_to_tuple); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1846, __pyx_L6_error)
  25947. __Pyx_GOTREF(__pyx_t_2);
  25948. __pyx_t_3 = NULL;
  25949. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
  25950. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  25951. if (likely(__pyx_t_3)) {
  25952. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  25953. __Pyx_INCREF(__pyx_t_3);
  25954. __Pyx_INCREF(function);
  25955. __Pyx_DECREF_SET(__pyx_t_2, function);
  25956. }
  25957. }
  25958. if (__pyx_t_3) {
  25959. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1846, __pyx_L6_error)
  25960. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  25961. } else {
  25962. __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1846, __pyx_L6_error)
  25963. }
  25964. __Pyx_GOTREF(__pyx_t_1);
  25965. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  25966. if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 1846, __pyx_L6_error)
  25967. __pyx_r = ((PyObject*)__pyx_t_1);
  25968. __pyx_t_1 = 0;
  25969. goto __pyx_L5_return;
  25970. }
  25971. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1850
  25972. * finally:
  25973. * #pass
  25974. * self._cur_close(cur) # <<<<<<<<<<<<<<
  25975. *
  25976. *
  25977. */
  25978. /*finally:*/ {
  25979. __pyx_L6_error:;
  25980. /*exception exit:*/{
  25981. __Pyx_PyThreadState_declare
  25982. __Pyx_PyThreadState_assign
  25983. __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
  25984. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  25985. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  25986. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  25987. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  25988. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  25989. if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
  25990. if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
  25991. __Pyx_XGOTREF(__pyx_t_11);
  25992. __Pyx_XGOTREF(__pyx_t_12);
  25993. __Pyx_XGOTREF(__pyx_t_13);
  25994. __Pyx_XGOTREF(__pyx_t_17);
  25995. __Pyx_XGOTREF(__pyx_t_18);
  25996. __Pyx_XGOTREF(__pyx_t_19);
  25997. __pyx_t_14 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename;
  25998. {
  25999. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_cur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1850, __pyx_L52_error)
  26000. }
  26001. if (PY_MAJOR_VERSION >= 3) {
  26002. __Pyx_XGIVEREF(__pyx_t_17);
  26003. __Pyx_XGIVEREF(__pyx_t_18);
  26004. __Pyx_XGIVEREF(__pyx_t_19);
  26005. __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
  26006. }
  26007. __Pyx_XGIVEREF(__pyx_t_11);
  26008. __Pyx_XGIVEREF(__pyx_t_12);
  26009. __Pyx_XGIVEREF(__pyx_t_13);
  26010. __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
  26011. __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
  26012. __pyx_lineno = __pyx_t_14; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16;
  26013. goto __pyx_L1_error;
  26014. __pyx_L52_error:;
  26015. if (PY_MAJOR_VERSION >= 3) {
  26016. __Pyx_XGIVEREF(__pyx_t_17);
  26017. __Pyx_XGIVEREF(__pyx_t_18);
  26018. __Pyx_XGIVEREF(__pyx_t_19);
  26019. __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
  26020. }
  26021. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  26022. __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  26023. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  26024. __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
  26025. goto __pyx_L1_error;
  26026. }
  26027. __pyx_L5_return: {
  26028. __pyx_t_20 = __pyx_r;
  26029. __pyx_r = 0;
  26030. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_cur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1850, __pyx_L1_error)
  26031. __pyx_r = __pyx_t_20;
  26032. __pyx_t_20 = 0;
  26033. goto __pyx_L0;
  26034. }
  26035. }
  26036. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1784
  26037. *
  26038. *
  26039. * cpdef tuple all_contexts(self, triple=None): # <<<<<<<<<<<<<<
  26040. * """
  26041. * Get a list of all contexts.
  26042. */
  26043. /* function exit code */
  26044. __pyx_L1_error:;
  26045. __Pyx_XDECREF(__pyx_t_1);
  26046. __Pyx_XDECREF(__pyx_t_2);
  26047. __Pyx_XDECREF(__pyx_t_3);
  26048. __Pyx_XDECREF(__pyx_t_4);
  26049. __Pyx_XDECREF(__pyx_t_5);
  26050. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.all_contexts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  26051. __pyx_r = 0;
  26052. __pyx_L0:;
  26053. __Pyx_XDECREF((PyObject *)__pyx_v_ret);
  26054. __Pyx_XGIVEREF(__pyx_r);
  26055. __Pyx_TraceReturn(__pyx_r, 0);
  26056. __Pyx_RefNannyFinishContext();
  26057. return __pyx_r;
  26058. }
  26059. /* Python wrapper */
  26060. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_30all_contexts(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  26061. static char __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_29all_contexts[] = "\n Get a list of all contexts.\n\n :rtype: Iterator(rdflib.Graph)\n ";
  26062. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_30all_contexts(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  26063. PyObject *__pyx_v_triple = 0;
  26064. PyObject *__pyx_r = 0;
  26065. __Pyx_RefNannyDeclarations
  26066. __Pyx_RefNannySetupContext("all_contexts (wrapper)", 0);
  26067. {
  26068. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_triple,0};
  26069. PyObject* values[1] = {0};
  26070. values[0] = ((PyObject *)Py_None);
  26071. if (unlikely(__pyx_kwds)) {
  26072. Py_ssize_t kw_args;
  26073. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  26074. switch (pos_args) {
  26075. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  26076. CYTHON_FALLTHROUGH;
  26077. case 0: break;
  26078. default: goto __pyx_L5_argtuple_error;
  26079. }
  26080. kw_args = PyDict_Size(__pyx_kwds);
  26081. switch (pos_args) {
  26082. case 0:
  26083. if (kw_args > 0) {
  26084. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_triple);
  26085. if (value) { values[0] = value; kw_args--; }
  26086. }
  26087. }
  26088. if (unlikely(kw_args > 0)) {
  26089. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "all_contexts") < 0)) __PYX_ERR(0, 1784, __pyx_L3_error)
  26090. }
  26091. } else {
  26092. switch (PyTuple_GET_SIZE(__pyx_args)) {
  26093. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  26094. CYTHON_FALLTHROUGH;
  26095. case 0: break;
  26096. default: goto __pyx_L5_argtuple_error;
  26097. }
  26098. }
  26099. __pyx_v_triple = values[0];
  26100. }
  26101. goto __pyx_L4_argument_unpacking_done;
  26102. __pyx_L5_argtuple_error:;
  26103. __Pyx_RaiseArgtupleInvalid("all_contexts", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1784, __pyx_L3_error)
  26104. __pyx_L3_error:;
  26105. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.all_contexts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  26106. __Pyx_RefNannyFinishContext();
  26107. return NULL;
  26108. __pyx_L4_argument_unpacking_done:;
  26109. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_29all_contexts(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self), __pyx_v_triple);
  26110. /* function exit code */
  26111. __Pyx_RefNannyFinishContext();
  26112. return __pyx_r;
  26113. }
  26114. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_29all_contexts(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_triple) {
  26115. PyObject *__pyx_r = NULL;
  26116. __Pyx_TraceDeclarations
  26117. __Pyx_RefNannyDeclarations
  26118. PyObject *__pyx_t_1 = NULL;
  26119. struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_all_contexts __pyx_t_2;
  26120. __Pyx_RefNannySetupContext("all_contexts", 0);
  26121. __Pyx_TraceCall("all_contexts (wrapper)", __pyx_f[0], 1784, 0, __PYX_ERR(0, 1784, __pyx_L1_error));
  26122. __Pyx_XDECREF(__pyx_r);
  26123. __pyx_t_2.__pyx_n = 1;
  26124. __pyx_t_2.triple = __pyx_v_triple;
  26125. __pyx_t_1 = __pyx_vtabptr_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore->all_contexts(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1784, __pyx_L1_error)
  26126. __Pyx_GOTREF(__pyx_t_1);
  26127. __pyx_r = __pyx_t_1;
  26128. __pyx_t_1 = 0;
  26129. goto __pyx_L0;
  26130. /* function exit code */
  26131. __pyx_L1_error:;
  26132. __Pyx_XDECREF(__pyx_t_1);
  26133. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.all_contexts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  26134. __pyx_r = NULL;
  26135. __pyx_L0:;
  26136. __Pyx_XGIVEREF(__pyx_r);
  26137. __Pyx_TraceReturn(__pyx_r, 0);
  26138. __Pyx_RefNannyFinishContext();
  26139. return __pyx_r;
  26140. }
  26141. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1855
  26142. * # Key conversion methods.
  26143. *
  26144. * cdef object from_key(self, Key key): # <<<<<<<<<<<<<<
  26145. * """
  26146. * Convert a single or multiple key into one or more terms.
  26147. */
  26148. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_from_key(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, unsigned char *__pyx_v_key) {
  26149. PyObject *__pyx_r = NULL;
  26150. __Pyx_TraceDeclarations
  26151. __Pyx_RefNannyDeclarations
  26152. MDB_dbi __pyx_t_1;
  26153. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore_get_dbi __pyx_t_2;
  26154. PyObject *__pyx_t_3 = NULL;
  26155. PyObject *__pyx_t_4 = NULL;
  26156. PyObject *__pyx_t_5 = NULL;
  26157. PyObject *__pyx_t_6 = NULL;
  26158. PyObject *__pyx_t_7 = NULL;
  26159. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store__check __pyx_t_8;
  26160. __Pyx_RefNannySetupContext("from_key", 0);
  26161. __Pyx_TraceCall("from_key", __pyx_f[0], 1855, 0, __PYX_ERR(0, 1855, __pyx_L1_error));
  26162. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1864
  26163. * unsigned char *pk
  26164. *
  26165. * key_v.mv_data = key # <<<<<<<<<<<<<<
  26166. * key_v.mv_size = KLEN
  26167. *
  26168. */
  26169. __pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v.mv_data = __pyx_v_key;
  26170. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1865
  26171. *
  26172. * key_v.mv_data = key
  26173. * key_v.mv_size = KLEN # <<<<<<<<<<<<<<
  26174. *
  26175. * _check(
  26176. */
  26177. __pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v.mv_size = 5;
  26178. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1868
  26179. *
  26180. * _check(
  26181. * lmdb.mdb_get(self.txn, self.get_dbi('t:st'), &key_v, &data_v), # <<<<<<<<<<<<<<
  26182. * 'Error getting data for key \'{}\'.'.format(key))
  26183. *
  26184. */
  26185. __pyx_t_2.__pyx_n = 1;
  26186. __pyx_t_2.dblabel = ((unsigned char *)((char const *)"t:st"));
  26187. __pyx_t_1 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_dbi(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_2);
  26188. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1869
  26189. * _check(
  26190. * lmdb.mdb_get(self.txn, self.get_dbi('t:st'), &key_v, &data_v),
  26191. * 'Error getting data for key \'{}\'.'.format(key)) # <<<<<<<<<<<<<<
  26192. *
  26193. * return deserialize(
  26194. */
  26195. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Error_getting_data_for_key, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1869, __pyx_L1_error)
  26196. __Pyx_GOTREF(__pyx_t_4);
  26197. __pyx_t_5 = __Pyx_PyBytes_FromCString(__pyx_v_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1869, __pyx_L1_error)
  26198. __Pyx_GOTREF(__pyx_t_5);
  26199. __pyx_t_6 = NULL;
  26200. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
  26201. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
  26202. if (likely(__pyx_t_6)) {
  26203. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
  26204. __Pyx_INCREF(__pyx_t_6);
  26205. __Pyx_INCREF(function);
  26206. __Pyx_DECREF_SET(__pyx_t_4, function);
  26207. }
  26208. }
  26209. if (!__pyx_t_6) {
  26210. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1869, __pyx_L1_error)
  26211. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  26212. __Pyx_GOTREF(__pyx_t_3);
  26213. } else {
  26214. #if CYTHON_FAST_PYCALL
  26215. if (PyFunction_Check(__pyx_t_4)) {
  26216. PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
  26217. __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1869, __pyx_L1_error)
  26218. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  26219. __Pyx_GOTREF(__pyx_t_3);
  26220. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  26221. } else
  26222. #endif
  26223. #if CYTHON_FAST_PYCCALL
  26224. if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
  26225. PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
  26226. __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1869, __pyx_L1_error)
  26227. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  26228. __Pyx_GOTREF(__pyx_t_3);
  26229. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  26230. } else
  26231. #endif
  26232. {
  26233. __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1869, __pyx_L1_error)
  26234. __Pyx_GOTREF(__pyx_t_7);
  26235. __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
  26236. __Pyx_GIVEREF(__pyx_t_5);
  26237. PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5);
  26238. __pyx_t_5 = 0;
  26239. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1869, __pyx_L1_error)
  26240. __Pyx_GOTREF(__pyx_t_3);
  26241. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  26242. }
  26243. }
  26244. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  26245. if (!(likely(PyUnicode_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 1869, __pyx_L1_error)
  26246. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1867
  26247. * key_v.mv_size = KLEN
  26248. *
  26249. * _check( # <<<<<<<<<<<<<<
  26250. * lmdb.mdb_get(self.txn, self.get_dbi('t:st'), &key_v, &data_v),
  26251. * 'Error getting data for key \'{}\'.'.format(key))
  26252. */
  26253. __pyx_t_8.__pyx_n = 1;
  26254. __pyx_t_8.message = ((PyObject*)__pyx_t_3);
  26255. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_get(__pyx_v_self->__pyx_base.txn, __pyx_t_1, (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v), (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v)), &__pyx_t_8); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1867, __pyx_L1_error)
  26256. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  26257. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1871
  26258. * 'Error getting data for key \'{}\'.'.format(key))
  26259. *
  26260. * return deserialize( # <<<<<<<<<<<<<<
  26261. * <unsigned char *>data_v.mv_data, data_v.mv_size)
  26262. *
  26263. */
  26264. __Pyx_XDECREF(__pyx_r);
  26265. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1872
  26266. *
  26267. * return deserialize(
  26268. * <unsigned char *>data_v.mv_data, data_v.mv_size) # <<<<<<<<<<<<<<
  26269. *
  26270. *
  26271. */
  26272. __pyx_t_3 = __pyx_f_12lakesuperior_5store_6ldp_rs_4term_deserialize(((unsigned char *)__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v.mv_data), __pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v.mv_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1871, __pyx_L1_error)
  26273. __Pyx_GOTREF(__pyx_t_3);
  26274. __pyx_r = __pyx_t_3;
  26275. __pyx_t_3 = 0;
  26276. goto __pyx_L0;
  26277. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1855
  26278. * # Key conversion methods.
  26279. *
  26280. * cdef object from_key(self, Key key): # <<<<<<<<<<<<<<
  26281. * """
  26282. * Convert a single or multiple key into one or more terms.
  26283. */
  26284. /* function exit code */
  26285. __pyx_L1_error:;
  26286. __Pyx_XDECREF(__pyx_t_3);
  26287. __Pyx_XDECREF(__pyx_t_4);
  26288. __Pyx_XDECREF(__pyx_t_5);
  26289. __Pyx_XDECREF(__pyx_t_6);
  26290. __Pyx_XDECREF(__pyx_t_7);
  26291. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.from_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  26292. __pyx_r = 0;
  26293. __pyx_L0:;
  26294. __Pyx_XGIVEREF(__pyx_r);
  26295. __Pyx_TraceReturn(__pyx_r, 0);
  26296. __Pyx_RefNannyFinishContext();
  26297. return __pyx_r;
  26298. }
  26299. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1875
  26300. *
  26301. *
  26302. * cdef tuple from_trp_key(self, TripleKey key): # <<<<<<<<<<<<<<
  26303. * """
  26304. * Convert a single or multiple key into one or more terms.
  26305. */
  26306. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_from_trp_key(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, unsigned char *__pyx_v_key) {
  26307. PyObject *__pyx_r = NULL;
  26308. __Pyx_TraceDeclarations
  26309. __Pyx_RefNannyDeclarations
  26310. PyObject *__pyx_t_1 = NULL;
  26311. PyObject *__pyx_t_2 = NULL;
  26312. PyObject *__pyx_t_3 = NULL;
  26313. PyObject *__pyx_t_4 = NULL;
  26314. __Pyx_RefNannySetupContext("from_trp_key", 0);
  26315. __Pyx_TraceCall("from_trp_key", __pyx_f[0], 1875, 0, __PYX_ERR(0, 1875, __pyx_L1_error));
  26316. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1882
  26317. * """
  26318. * #logger.debug(f'From triple key: {key[: TRP_KLEN]}')
  26319. * return ( # <<<<<<<<<<<<<<
  26320. * self.from_key(key),
  26321. * self.from_key(key + KLEN),
  26322. */
  26323. __Pyx_XDECREF(__pyx_r);
  26324. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1883
  26325. * #logger.debug(f'From triple key: {key[: TRP_KLEN]}')
  26326. * return (
  26327. * self.from_key(key), # <<<<<<<<<<<<<<
  26328. * self.from_key(key + KLEN),
  26329. * self.from_key(key + DBL_KLEN))
  26330. */
  26331. __pyx_t_1 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->from_key(__pyx_v_self, __pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1883, __pyx_L1_error)
  26332. __Pyx_GOTREF(__pyx_t_1);
  26333. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1884
  26334. * return (
  26335. * self.from_key(key),
  26336. * self.from_key(key + KLEN), # <<<<<<<<<<<<<<
  26337. * self.from_key(key + DBL_KLEN))
  26338. *
  26339. */
  26340. __pyx_t_2 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->from_key(__pyx_v_self, (__pyx_v_key + 5)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1884, __pyx_L1_error)
  26341. __Pyx_GOTREF(__pyx_t_2);
  26342. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1885
  26343. * self.from_key(key),
  26344. * self.from_key(key + KLEN),
  26345. * self.from_key(key + DBL_KLEN)) # <<<<<<<<<<<<<<
  26346. *
  26347. *
  26348. */
  26349. __pyx_t_3 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->from_key(__pyx_v_self, (__pyx_v_key + 10)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1885, __pyx_L1_error)
  26350. __Pyx_GOTREF(__pyx_t_3);
  26351. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1883
  26352. * #logger.debug(f'From triple key: {key[: TRP_KLEN]}')
  26353. * return (
  26354. * self.from_key(key), # <<<<<<<<<<<<<<
  26355. * self.from_key(key + KLEN),
  26356. * self.from_key(key + DBL_KLEN))
  26357. */
  26358. __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1883, __pyx_L1_error)
  26359. __Pyx_GOTREF(__pyx_t_4);
  26360. __Pyx_GIVEREF(__pyx_t_1);
  26361. PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  26362. __Pyx_GIVEREF(__pyx_t_2);
  26363. PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  26364. __Pyx_GIVEREF(__pyx_t_3);
  26365. PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  26366. __pyx_t_1 = 0;
  26367. __pyx_t_2 = 0;
  26368. __pyx_t_3 = 0;
  26369. __pyx_r = ((PyObject*)__pyx_t_4);
  26370. __pyx_t_4 = 0;
  26371. goto __pyx_L0;
  26372. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1875
  26373. *
  26374. *
  26375. * cdef tuple from_trp_key(self, TripleKey key): # <<<<<<<<<<<<<<
  26376. * """
  26377. * Convert a single or multiple key into one or more terms.
  26378. */
  26379. /* function exit code */
  26380. __pyx_L1_error:;
  26381. __Pyx_XDECREF(__pyx_t_1);
  26382. __Pyx_XDECREF(__pyx_t_2);
  26383. __Pyx_XDECREF(__pyx_t_3);
  26384. __Pyx_XDECREF(__pyx_t_4);
  26385. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.from_trp_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  26386. __pyx_r = 0;
  26387. __pyx_L0:;
  26388. __Pyx_XGIVEREF(__pyx_r);
  26389. __Pyx_TraceReturn(__pyx_r, 0);
  26390. __Pyx_RefNannyFinishContext();
  26391. return __pyx_r;
  26392. }
  26393. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1888
  26394. *
  26395. *
  26396. * cdef inline void _to_key(self, term, Key *key) except *: # <<<<<<<<<<<<<<
  26397. * """
  26398. * Convert a triple, quad or term into a key.
  26399. */
  26400. static CYTHON_INLINE void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__to_key(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_term, __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Key *__pyx_v_key) {
  26401. unsigned char *__pyx_v_pk_t;
  26402. size_t __pyx_v_term_size;
  26403. __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Hash __pyx_v_thash;
  26404. MDB_dbi __pyx_v_dbi;
  26405. __Pyx_TraceDeclarations
  26406. __Pyx_RefNannyDeclarations
  26407. int __pyx_t_1;
  26408. MDB_dbi __pyx_t_2;
  26409. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore_get_dbi __pyx_t_3;
  26410. PyObject *__pyx_t_4 = NULL;
  26411. PyObject *__pyx_t_5 = NULL;
  26412. PyObject *__pyx_t_6 = NULL;
  26413. PyObject *__pyx_t_7 = NULL;
  26414. PyObject *__pyx_t_8 = NULL;
  26415. __Pyx_RefNannySetupContext("_to_key", 0);
  26416. __Pyx_TraceCall("_to_key", __pyx_f[0], 1888, 0, __PYX_ERR(0, 1888, __pyx_L1_error));
  26417. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1905
  26418. * Hash thash
  26419. *
  26420. * serialize(term, &pk_t, &term_size) # <<<<<<<<<<<<<<
  26421. * #logger.debug('Hashing pickle: {} with lentgh: {}'.format(pk_t, term_size))
  26422. * _hash(pk_t, term_size, thash)
  26423. */
  26424. __pyx_t_1 = __pyx_f_12lakesuperior_5store_6ldp_rs_4term_serialize(__pyx_v_term, (&__pyx_v_pk_t), (&__pyx_v_term_size)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1905, __pyx_L1_error)
  26425. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1907
  26426. * serialize(term, &pk_t, &term_size)
  26427. * #logger.debug('Hashing pickle: {} with lentgh: {}'.format(pk_t, term_size))
  26428. * _hash(pk_t, term_size, thash) # <<<<<<<<<<<<<<
  26429. * free(pk_t)
  26430. * #logger.debug('Hash to search for: {}'.format(thash[: HLEN]))
  26431. */
  26432. __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore__hash(__pyx_v_pk_t, __pyx_v_term_size, __pyx_v_thash);
  26433. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1908
  26434. * #logger.debug('Hashing pickle: {} with lentgh: {}'.format(pk_t, term_size))
  26435. * _hash(pk_t, term_size, thash)
  26436. * free(pk_t) # <<<<<<<<<<<<<<
  26437. * #logger.debug('Hash to search for: {}'.format(thash[: HLEN]))
  26438. * key_v.mv_data = &thash
  26439. */
  26440. free(__pyx_v_pk_t);
  26441. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1910
  26442. * free(pk_t)
  26443. * #logger.debug('Hash to search for: {}'.format(thash[: HLEN]))
  26444. * key_v.mv_data = &thash # <<<<<<<<<<<<<<
  26445. * key_v.mv_size = HLEN
  26446. *
  26447. */
  26448. __pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v.mv_data = (&__pyx_v_thash);
  26449. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1911
  26450. * #logger.debug('Hash to search for: {}'.format(thash[: HLEN]))
  26451. * key_v.mv_data = &thash
  26452. * key_v.mv_size = HLEN # <<<<<<<<<<<<<<
  26453. *
  26454. * dbi = self.get_dbi('th:t')
  26455. */
  26456. __pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v.mv_size = 20;
  26457. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1913
  26458. * key_v.mv_size = HLEN
  26459. *
  26460. * dbi = self.get_dbi('th:t') # <<<<<<<<<<<<<<
  26461. * logger.debug(f'DBI: {dbi}')
  26462. * _check(lmdb.mdb_get(self.txn, dbi, &key_v, &data_v))
  26463. */
  26464. __pyx_t_3.__pyx_n = 1;
  26465. __pyx_t_3.dblabel = ((unsigned char *)((char const *)"th:t"));
  26466. __pyx_t_2 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_dbi(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_3);
  26467. __pyx_v_dbi = __pyx_t_2;
  26468. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1914
  26469. *
  26470. * dbi = self.get_dbi('th:t')
  26471. * logger.debug(f'DBI: {dbi}') # <<<<<<<<<<<<<<
  26472. * _check(lmdb.mdb_get(self.txn, dbi, &key_v, &data_v))
  26473. * #logger.debug('Found key: {}'.format((<Key>data_v.mv_data)[: KLEN]))
  26474. */
  26475. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1914, __pyx_L1_error)
  26476. __Pyx_GOTREF(__pyx_t_5);
  26477. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_debug); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1914, __pyx_L1_error)
  26478. __Pyx_GOTREF(__pyx_t_6);
  26479. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  26480. __pyx_t_5 = __Pyx_PyInt_From_MDB_dbi(__pyx_v_dbi); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1914, __pyx_L1_error)
  26481. __Pyx_GOTREF(__pyx_t_5);
  26482. __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1914, __pyx_L1_error)
  26483. __Pyx_GOTREF(__pyx_t_7);
  26484. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  26485. __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_DBI, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1914, __pyx_L1_error)
  26486. __Pyx_GOTREF(__pyx_t_5);
  26487. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  26488. __pyx_t_7 = NULL;
  26489. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
  26490. __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
  26491. if (likely(__pyx_t_7)) {
  26492. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
  26493. __Pyx_INCREF(__pyx_t_7);
  26494. __Pyx_INCREF(function);
  26495. __Pyx_DECREF_SET(__pyx_t_6, function);
  26496. }
  26497. }
  26498. if (!__pyx_t_7) {
  26499. __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1914, __pyx_L1_error)
  26500. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  26501. __Pyx_GOTREF(__pyx_t_4);
  26502. } else {
  26503. #if CYTHON_FAST_PYCALL
  26504. if (PyFunction_Check(__pyx_t_6)) {
  26505. PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5};
  26506. __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1914, __pyx_L1_error)
  26507. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  26508. __Pyx_GOTREF(__pyx_t_4);
  26509. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  26510. } else
  26511. #endif
  26512. #if CYTHON_FAST_PYCCALL
  26513. if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
  26514. PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5};
  26515. __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1914, __pyx_L1_error)
  26516. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  26517. __Pyx_GOTREF(__pyx_t_4);
  26518. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  26519. } else
  26520. #endif
  26521. {
  26522. __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1914, __pyx_L1_error)
  26523. __Pyx_GOTREF(__pyx_t_8);
  26524. __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
  26525. __Pyx_GIVEREF(__pyx_t_5);
  26526. PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_5);
  26527. __pyx_t_5 = 0;
  26528. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1914, __pyx_L1_error)
  26529. __Pyx_GOTREF(__pyx_t_4);
  26530. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  26531. }
  26532. }
  26533. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  26534. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  26535. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1915
  26536. * dbi = self.get_dbi('th:t')
  26537. * logger.debug(f'DBI: {dbi}')
  26538. * _check(lmdb.mdb_get(self.txn, dbi, &key_v, &data_v)) # <<<<<<<<<<<<<<
  26539. * #logger.debug('Found key: {}'.format((<Key>data_v.mv_data)[: KLEN]))
  26540. *
  26541. */
  26542. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_get(__pyx_v_self->__pyx_base.txn, __pyx_v_dbi, (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v), (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v)), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1915, __pyx_L1_error)
  26543. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1918
  26544. * #logger.debug('Found key: {}'.format((<Key>data_v.mv_data)[: KLEN]))
  26545. *
  26546. * key[0] = <Key>data_v.mv_data # <<<<<<<<<<<<<<
  26547. *
  26548. *
  26549. */
  26550. memcpy(&((__pyx_v_key[0])[0]), ((unsigned char *)__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v.mv_data), sizeof((__pyx_v_key[0])[0]) * (5));
  26551. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1888
  26552. *
  26553. *
  26554. * cdef inline void _to_key(self, term, Key *key) except *: # <<<<<<<<<<<<<<
  26555. * """
  26556. * Convert a triple, quad or term into a key.
  26557. */
  26558. /* function exit code */
  26559. goto __pyx_L0;
  26560. __pyx_L1_error:;
  26561. __Pyx_XDECREF(__pyx_t_4);
  26562. __Pyx_XDECREF(__pyx_t_5);
  26563. __Pyx_XDECREF(__pyx_t_6);
  26564. __Pyx_XDECREF(__pyx_t_7);
  26565. __Pyx_XDECREF(__pyx_t_8);
  26566. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._to_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  26567. __pyx_L0:;
  26568. __Pyx_TraceReturn(Py_None, 0);
  26569. __Pyx_RefNannyFinishContext();
  26570. }
  26571. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1921
  26572. *
  26573. *
  26574. * cdef inline void _to_triple_key(self, tuple terms, TripleKey *tkey) except *: # <<<<<<<<<<<<<<
  26575. * """
  26576. * Convert a tuple of 3 terms into a triple key.
  26577. */
  26578. static CYTHON_INLINE void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__to_triple_key(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, PyObject *__pyx_v_terms, __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_TripleKey *__pyx_v_tkey) {
  26579. char __pyx_v_i;
  26580. __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Key __pyx_v_key;
  26581. __Pyx_TraceDeclarations
  26582. __Pyx_RefNannyDeclarations
  26583. int __pyx_t_1;
  26584. PyObject *__pyx_t_2 = NULL;
  26585. __Pyx_RefNannySetupContext("_to_triple_key", 0);
  26586. __Pyx_TraceCall("_to_triple_key", __pyx_f[0], 1921, 0, __PYX_ERR(0, 1921, __pyx_L1_error));
  26587. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1926
  26588. * """
  26589. * cdef:
  26590. * char i = 0 # <<<<<<<<<<<<<<
  26591. * Key key
  26592. *
  26593. */
  26594. __pyx_v_i = 0;
  26595. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1929
  26596. * Key key
  26597. *
  26598. * while i < 3: # <<<<<<<<<<<<<<
  26599. * self._to_key(terms[i], &key)
  26600. * memcpy(tkey[0] + (KLEN * i), key, KLEN)
  26601. */
  26602. while (1) {
  26603. __pyx_t_1 = ((__pyx_v_i < 3) != 0);
  26604. if (!__pyx_t_1) break;
  26605. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1930
  26606. *
  26607. * while i < 3:
  26608. * self._to_key(terms[i], &key) # <<<<<<<<<<<<<<
  26609. * memcpy(tkey[0] + (KLEN * i), key, KLEN)
  26610. * if key is NULL:
  26611. */
  26612. if (unlikely(__pyx_v_terms == Py_None)) {
  26613. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
  26614. __PYX_ERR(0, 1930, __pyx_L1_error)
  26615. }
  26616. __pyx_t_2 = PyTuple_GET_ITEM(__pyx_v_terms, __pyx_v_i);
  26617. __Pyx_INCREF(__pyx_t_2);
  26618. __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__to_key(__pyx_v_self, __pyx_t_2, (&__pyx_v_key)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1930, __pyx_L1_error)
  26619. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  26620. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1931
  26621. * while i < 3:
  26622. * self._to_key(terms[i], &key)
  26623. * memcpy(tkey[0] + (KLEN * i), key, KLEN) # <<<<<<<<<<<<<<
  26624. * if key is NULL:
  26625. * # A term in the triple is not found.
  26626. */
  26627. (void)(memcpy(((__pyx_v_tkey[0]) + (5 * __pyx_v_i)), __pyx_v_key, 5));
  26628. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1932
  26629. * self._to_key(terms[i], &key)
  26630. * memcpy(tkey[0] + (KLEN * i), key, KLEN)
  26631. * if key is NULL: # <<<<<<<<<<<<<<
  26632. * # A term in the triple is not found.
  26633. * tkey = NULL
  26634. */
  26635. __pyx_t_1 = ((__pyx_v_key == NULL) != 0);
  26636. if (__pyx_t_1) {
  26637. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1934
  26638. * if key is NULL:
  26639. * # A term in the triple is not found.
  26640. * tkey = NULL # <<<<<<<<<<<<<<
  26641. * return
  26642. * i += 1
  26643. */
  26644. __pyx_v_tkey = NULL;
  26645. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1935
  26646. * # A term in the triple is not found.
  26647. * tkey = NULL
  26648. * return # <<<<<<<<<<<<<<
  26649. * i += 1
  26650. *
  26651. */
  26652. goto __pyx_L0;
  26653. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1932
  26654. * self._to_key(terms[i], &key)
  26655. * memcpy(tkey[0] + (KLEN * i), key, KLEN)
  26656. * if key is NULL: # <<<<<<<<<<<<<<
  26657. * # A term in the triple is not found.
  26658. * tkey = NULL
  26659. */
  26660. }
  26661. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1936
  26662. * tkey = NULL
  26663. * return
  26664. * i += 1 # <<<<<<<<<<<<<<
  26665. *
  26666. *
  26667. */
  26668. __pyx_v_i = (__pyx_v_i + 1);
  26669. }
  26670. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1921
  26671. *
  26672. *
  26673. * cdef inline void _to_triple_key(self, tuple terms, TripleKey *tkey) except *: # <<<<<<<<<<<<<<
  26674. * """
  26675. * Convert a tuple of 3 terms into a triple key.
  26676. */
  26677. /* function exit code */
  26678. goto __pyx_L0;
  26679. __pyx_L1_error:;
  26680. __Pyx_XDECREF(__pyx_t_2);
  26681. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._to_triple_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  26682. __pyx_L0:;
  26683. __Pyx_TraceReturn(Py_None, 0);
  26684. __Pyx_RefNannyFinishContext();
  26685. }
  26686. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1939
  26687. *
  26688. *
  26689. * cdef void _append( # <<<<<<<<<<<<<<
  26690. * self, unsigned char *value, size_t vlen, Key *nkey,
  26691. * unsigned char *dblabel=b'', lmdb.MDB_txn *txn=NULL,
  26692. */
  26693. static void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__append(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, unsigned char *__pyx_v_value, size_t __pyx_v_vlen, __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Key *__pyx_v_nkey, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__append *__pyx_optional_args) {
  26694. unsigned char *__pyx_v_dblabel = __pyx_k__30;
  26695. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1941
  26696. * cdef void _append(
  26697. * self, unsigned char *value, size_t vlen, Key *nkey,
  26698. * unsigned char *dblabel=b'', lmdb.MDB_txn *txn=NULL, # <<<<<<<<<<<<<<
  26699. * unsigned int flags=0) except *:
  26700. * """
  26701. */
  26702. MDB_txn *__pyx_v_txn = ((MDB_txn *)NULL);
  26703. unsigned int __pyx_v_flags = ((unsigned int)0);
  26704. unsigned char __pyx_v_key[5];
  26705. MDB_cursor *__pyx_v_cur;
  26706. __Pyx_TraceDeclarations
  26707. __Pyx_RefNannyDeclarations
  26708. int __pyx_t_1;
  26709. MDB_txn *__pyx_t_2;
  26710. MDB_cursor *__pyx_t_3;
  26711. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore__cur_open __pyx_t_4;
  26712. PyObject *__pyx_t_5 = NULL;
  26713. PyObject *__pyx_t_6 = NULL;
  26714. PyObject *__pyx_t_7 = NULL;
  26715. PyObject *__pyx_t_8 = NULL;
  26716. PyObject *__pyx_t_9 = NULL;
  26717. PyObject *__pyx_t_10 = NULL;
  26718. PyObject *__pyx_t_11 = NULL;
  26719. int __pyx_t_12;
  26720. int __pyx_t_13;
  26721. char const *__pyx_t_14;
  26722. PyObject *__pyx_t_15 = NULL;
  26723. PyObject *__pyx_t_16 = NULL;
  26724. PyObject *__pyx_t_17 = NULL;
  26725. MDB_dbi __pyx_t_18;
  26726. struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore_get_dbi __pyx_t_19;
  26727. __Pyx_RefNannySetupContext("_append", 0);
  26728. __Pyx_TraceCall("_append", __pyx_f[0], 1939, 0, __PYX_ERR(0, 1939, __pyx_L1_error));
  26729. if (__pyx_optional_args) {
  26730. if (__pyx_optional_args->__pyx_n > 0) {
  26731. __pyx_v_dblabel = __pyx_optional_args->dblabel;
  26732. if (__pyx_optional_args->__pyx_n > 1) {
  26733. __pyx_v_txn = __pyx_optional_args->txn;
  26734. if (__pyx_optional_args->__pyx_n > 2) {
  26735. __pyx_v_flags = __pyx_optional_args->flags;
  26736. }
  26737. }
  26738. }
  26739. }
  26740. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1956
  26741. * lmdb.MDB_cursor *cur
  26742. *
  26743. * if txn is NULL: # <<<<<<<<<<<<<<
  26744. * txn = self.txn
  26745. *
  26746. */
  26747. __pyx_t_1 = ((__pyx_v_txn == NULL) != 0);
  26748. if (__pyx_t_1) {
  26749. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1957
  26750. *
  26751. * if txn is NULL:
  26752. * txn = self.txn # <<<<<<<<<<<<<<
  26753. *
  26754. * cur = self._cur_open(dblabel, txn=txn)
  26755. */
  26756. __pyx_t_2 = __pyx_v_self->__pyx_base.txn;
  26757. __pyx_v_txn = __pyx_t_2;
  26758. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1956
  26759. * lmdb.MDB_cursor *cur
  26760. *
  26761. * if txn is NULL: # <<<<<<<<<<<<<<
  26762. * txn = self.txn
  26763. *
  26764. */
  26765. }
  26766. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1959
  26767. * txn = self.txn
  26768. *
  26769. * cur = self._cur_open(dblabel, txn=txn) # <<<<<<<<<<<<<<
  26770. *
  26771. * try:
  26772. */
  26773. __pyx_t_4.__pyx_n = 2;
  26774. __pyx_t_4.dblabel = __pyx_v_dblabel;
  26775. __pyx_t_4.txn = __pyx_v_txn;
  26776. __pyx_t_3 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_open(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1959, __pyx_L1_error)
  26777. __pyx_v_cur = __pyx_t_3;
  26778. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1961
  26779. * cur = self._cur_open(dblabel, txn=txn)
  26780. *
  26781. * try: # <<<<<<<<<<<<<<
  26782. * _check(lmdb.mdb_cursor_get(cur, &key_v, NULL, lmdb.MDB_LAST))
  26783. * except KeyNotFoundError:
  26784. */
  26785. /*try:*/ {
  26786. {
  26787. __Pyx_PyThreadState_declare
  26788. __Pyx_PyThreadState_assign
  26789. __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
  26790. __Pyx_XGOTREF(__pyx_t_5);
  26791. __Pyx_XGOTREF(__pyx_t_6);
  26792. __Pyx_XGOTREF(__pyx_t_7);
  26793. /*try:*/ {
  26794. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1962
  26795. *
  26796. * try:
  26797. * _check(lmdb.mdb_cursor_get(cur, &key_v, NULL, lmdb.MDB_LAST)) # <<<<<<<<<<<<<<
  26798. * except KeyNotFoundError:
  26799. * memcpy(nkey[0], first_key, KLEN)
  26800. */
  26801. __pyx_f_12lakesuperior_5store_15base_lmdb_store__check(mdb_cursor_get(__pyx_v_cur, (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v), NULL, MDB_LAST), NULL); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1962, __pyx_L7_error)
  26802. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1961
  26803. * cur = self._cur_open(dblabel, txn=txn)
  26804. *
  26805. * try: # <<<<<<<<<<<<<<
  26806. * _check(lmdb.mdb_cursor_get(cur, &key_v, NULL, lmdb.MDB_LAST))
  26807. * except KeyNotFoundError:
  26808. */
  26809. }
  26810. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1966
  26811. * memcpy(nkey[0], first_key, KLEN)
  26812. * else:
  26813. * memcpy(key, key_v.mv_data, KLEN) # <<<<<<<<<<<<<<
  26814. * self._next_key(key, nkey)
  26815. * finally:
  26816. */
  26817. /*else:*/ {
  26818. (void)(memcpy(__pyx_v_key, __pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v.mv_data, 5));
  26819. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1967
  26820. * else:
  26821. * memcpy(key, key_v.mv_data, KLEN)
  26822. * self._next_key(key, nkey) # <<<<<<<<<<<<<<
  26823. * finally:
  26824. * #pass
  26825. */
  26826. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->_next_key(__pyx_v_self, __pyx_v_key, __pyx_v_nkey); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1967, __pyx_L9_except_error)
  26827. }
  26828. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  26829. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  26830. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  26831. goto __pyx_L12_try_end;
  26832. __pyx_L7_error:;
  26833. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1963
  26834. * try:
  26835. * _check(lmdb.mdb_cursor_get(cur, &key_v, NULL, lmdb.MDB_LAST))
  26836. * except KeyNotFoundError: # <<<<<<<<<<<<<<
  26837. * memcpy(nkey[0], first_key, KLEN)
  26838. * else:
  26839. */
  26840. __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
  26841. __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1963, __pyx_L9_except_error)
  26842. __Pyx_GOTREF(__pyx_t_11);
  26843. __pyx_t_12 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_8, __pyx_t_11);
  26844. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  26845. __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
  26846. __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0;
  26847. if (__pyx_t_12) {
  26848. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  26849. if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8) < 0) __PYX_ERR(0, 1963, __pyx_L9_except_error)
  26850. __Pyx_GOTREF(__pyx_t_10);
  26851. __Pyx_GOTREF(__pyx_t_9);
  26852. __Pyx_GOTREF(__pyx_t_8);
  26853. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1964
  26854. * _check(lmdb.mdb_cursor_get(cur, &key_v, NULL, lmdb.MDB_LAST))
  26855. * except KeyNotFoundError:
  26856. * memcpy(nkey[0], first_key, KLEN) # <<<<<<<<<<<<<<
  26857. * else:
  26858. * memcpy(key, key_v.mv_data, KLEN)
  26859. */
  26860. (void)(memcpy((__pyx_v_nkey[0]), __pyx_v_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_first_key, 5));
  26861. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  26862. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  26863. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  26864. goto __pyx_L8_exception_handled;
  26865. }
  26866. goto __pyx_L9_except_error;
  26867. __pyx_L9_except_error:;
  26868. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1961
  26869. * cur = self._cur_open(dblabel, txn=txn)
  26870. *
  26871. * try: # <<<<<<<<<<<<<<
  26872. * _check(lmdb.mdb_cursor_get(cur, &key_v, NULL, lmdb.MDB_LAST))
  26873. * except KeyNotFoundError:
  26874. */
  26875. __Pyx_XGIVEREF(__pyx_t_5);
  26876. __Pyx_XGIVEREF(__pyx_t_6);
  26877. __Pyx_XGIVEREF(__pyx_t_7);
  26878. __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
  26879. goto __pyx_L5_error;
  26880. __pyx_L8_exception_handled:;
  26881. __Pyx_XGIVEREF(__pyx_t_5);
  26882. __Pyx_XGIVEREF(__pyx_t_6);
  26883. __Pyx_XGIVEREF(__pyx_t_7);
  26884. __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
  26885. __pyx_L12_try_end:;
  26886. }
  26887. }
  26888. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1970
  26889. * finally:
  26890. * #pass
  26891. * self._cur_close(cur) # <<<<<<<<<<<<<<
  26892. *
  26893. * key_v.mv_data = nkey
  26894. */
  26895. /*finally:*/ {
  26896. /*normal exit:*/{
  26897. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_cur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1970, __pyx_L1_error)
  26898. goto __pyx_L6;
  26899. }
  26900. __pyx_L5_error:;
  26901. /*exception exit:*/{
  26902. __Pyx_PyThreadState_declare
  26903. __Pyx_PyThreadState_assign
  26904. __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
  26905. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  26906. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  26907. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  26908. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  26909. if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
  26910. if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5);
  26911. __Pyx_XGOTREF(__pyx_t_7);
  26912. __Pyx_XGOTREF(__pyx_t_6);
  26913. __Pyx_XGOTREF(__pyx_t_5);
  26914. __Pyx_XGOTREF(__pyx_t_15);
  26915. __Pyx_XGOTREF(__pyx_t_16);
  26916. __Pyx_XGOTREF(__pyx_t_17);
  26917. __pyx_t_12 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_14 = __pyx_filename;
  26918. {
  26919. ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._cur_close(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), __pyx_v_cur); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1970, __pyx_L16_error)
  26920. }
  26921. if (PY_MAJOR_VERSION >= 3) {
  26922. __Pyx_XGIVEREF(__pyx_t_15);
  26923. __Pyx_XGIVEREF(__pyx_t_16);
  26924. __Pyx_XGIVEREF(__pyx_t_17);
  26925. __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
  26926. }
  26927. __Pyx_XGIVEREF(__pyx_t_7);
  26928. __Pyx_XGIVEREF(__pyx_t_6);
  26929. __Pyx_XGIVEREF(__pyx_t_5);
  26930. __Pyx_ErrRestore(__pyx_t_7, __pyx_t_6, __pyx_t_5);
  26931. __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
  26932. __pyx_lineno = __pyx_t_12; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_14;
  26933. goto __pyx_L1_error;
  26934. __pyx_L16_error:;
  26935. if (PY_MAJOR_VERSION >= 3) {
  26936. __Pyx_XGIVEREF(__pyx_t_15);
  26937. __Pyx_XGIVEREF(__pyx_t_16);
  26938. __Pyx_XGIVEREF(__pyx_t_17);
  26939. __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
  26940. }
  26941. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  26942. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  26943. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  26944. __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
  26945. goto __pyx_L1_error;
  26946. }
  26947. __pyx_L6:;
  26948. }
  26949. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1972
  26950. * self._cur_close(cur)
  26951. *
  26952. * key_v.mv_data = nkey # <<<<<<<<<<<<<<
  26953. * key_v.mv_size = KLEN
  26954. * data_v.mv_data = value
  26955. */
  26956. __pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v.mv_data = __pyx_v_nkey;
  26957. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1973
  26958. *
  26959. * key_v.mv_data = nkey
  26960. * key_v.mv_size = KLEN # <<<<<<<<<<<<<<
  26961. * data_v.mv_data = value
  26962. * data_v.mv_size = vlen
  26963. */
  26964. __pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v.mv_size = 5;
  26965. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1974
  26966. * key_v.mv_data = nkey
  26967. * key_v.mv_size = KLEN
  26968. * data_v.mv_data = value # <<<<<<<<<<<<<<
  26969. * data_v.mv_size = vlen
  26970. * #logger.debug('Appending value {} to db {} with key: {}'.format(
  26971. */
  26972. __pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v.mv_data = __pyx_v_value;
  26973. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1975
  26974. * key_v.mv_size = KLEN
  26975. * data_v.mv_data = value
  26976. * data_v.mv_size = vlen # <<<<<<<<<<<<<<
  26977. * #logger.debug('Appending value {} to db {} with key: {}'.format(
  26978. * # value[: vlen], dblabel.decode(), nkey[0][:KLEN]))
  26979. */
  26980. __pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v.mv_size = __pyx_v_vlen;
  26981. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1980
  26982. * #logger.debug('data size: {}'.format(data_v.mv_size))
  26983. * lmdb.mdb_put(
  26984. * txn, self.get_dbi(dblabel), &key_v, &data_v, # <<<<<<<<<<<<<<
  26985. * flags | lmdb.MDB_APPEND)
  26986. *
  26987. */
  26988. __pyx_t_19.__pyx_n = 1;
  26989. __pyx_t_19.dblabel = __pyx_v_dblabel;
  26990. __pyx_t_18 = ((struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_dbi(((struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *)__pyx_v_self), &__pyx_t_19);
  26991. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1979
  26992. * # value[: vlen], dblabel.decode(), nkey[0][:KLEN]))
  26993. * #logger.debug('data size: {}'.format(data_v.mv_size))
  26994. * lmdb.mdb_put( # <<<<<<<<<<<<<<
  26995. * txn, self.get_dbi(dblabel), &key_v, &data_v,
  26996. * flags | lmdb.MDB_APPEND)
  26997. */
  26998. (void)(mdb_put(__pyx_v_txn, __pyx_t_18, (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_key_v), (&__pyx_v_12lakesuperior_5store_15base_lmdb_store_data_v), (__pyx_v_flags | MDB_APPEND)));
  26999. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1939
  27000. *
  27001. *
  27002. * cdef void _append( # <<<<<<<<<<<<<<
  27003. * self, unsigned char *value, size_t vlen, Key *nkey,
  27004. * unsigned char *dblabel=b'', lmdb.MDB_txn *txn=NULL,
  27005. */
  27006. /* function exit code */
  27007. goto __pyx_L0;
  27008. __pyx_L1_error:;
  27009. __Pyx_XDECREF(__pyx_t_8);
  27010. __Pyx_XDECREF(__pyx_t_9);
  27011. __Pyx_XDECREF(__pyx_t_10);
  27012. __Pyx_XDECREF(__pyx_t_11);
  27013. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  27014. __pyx_L0:;
  27015. __Pyx_TraceReturn(Py_None, 0);
  27016. __Pyx_RefNannyFinishContext();
  27017. }
  27018. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1984
  27019. *
  27020. *
  27021. * cdef void _next_key(self, const Key key, Key *nkey) except *: # <<<<<<<<<<<<<<
  27022. * """
  27023. * Calculate the next closest byte sequence in lexicographical order.
  27024. */
  27025. static void __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__next_key(CYTHON_UNUSED struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, unsigned char *__pyx_v_key, __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Key *__pyx_v_nkey) {
  27026. size_t __pyx_v_i;
  27027. __Pyx_TraceDeclarations
  27028. __Pyx_RefNannyDeclarations
  27029. int __pyx_t_1;
  27030. long __pyx_t_2;
  27031. size_t __pyx_t_3;
  27032. PyObject *__pyx_t_4 = NULL;
  27033. __Pyx_RefNannySetupContext("_next_key", 0);
  27034. __Pyx_TraceCall("_next_key", __pyx_f[0], 1984, 0, __PYX_ERR(0, 1984, __pyx_L1_error));
  27035. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1999
  27036. * """
  27037. * cdef:
  27038. * size_t i = KLEN # <<<<<<<<<<<<<<
  27039. *
  27040. * memcpy(nkey[0], key, KLEN)
  27041. */
  27042. __pyx_v_i = 5;
  27043. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":2001
  27044. * size_t i = KLEN
  27045. *
  27046. * memcpy(nkey[0], key, KLEN) # <<<<<<<<<<<<<<
  27047. *
  27048. * #logger.debug('Last key in _next_key: {}'.format(key[0]))
  27049. */
  27050. (void)(memcpy((__pyx_v_nkey[0]), __pyx_v_key, 5));
  27051. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":2004
  27052. *
  27053. * #logger.debug('Last key in _next_key: {}'.format(key[0]))
  27054. * while i > 0: # <<<<<<<<<<<<<<
  27055. * i -= 1
  27056. * if nkey[0][i] < 255:
  27057. */
  27058. while (1) {
  27059. __pyx_t_1 = ((__pyx_v_i > 0) != 0);
  27060. if (!__pyx_t_1) break;
  27061. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":2005
  27062. * #logger.debug('Last key in _next_key: {}'.format(key[0]))
  27063. * while i > 0:
  27064. * i -= 1 # <<<<<<<<<<<<<<
  27065. * if nkey[0][i] < 255:
  27066. * nkey[0][i] += 1
  27067. */
  27068. __pyx_v_i = (__pyx_v_i - 1);
  27069. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":2006
  27070. * while i > 0:
  27071. * i -= 1
  27072. * if nkey[0][i] < 255: # <<<<<<<<<<<<<<
  27073. * nkey[0][i] += 1
  27074. * break
  27075. */
  27076. __pyx_t_1 = ((((__pyx_v_nkey[0])[__pyx_v_i]) < 0xFF) != 0);
  27077. if (__pyx_t_1) {
  27078. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":2007
  27079. * i -= 1
  27080. * if nkey[0][i] < 255:
  27081. * nkey[0][i] += 1 # <<<<<<<<<<<<<<
  27082. * break
  27083. * # If the value exceeds 255, i.e. the current value is the last one
  27084. */
  27085. __pyx_t_2 = 0;
  27086. __pyx_t_3 = __pyx_v_i;
  27087. ((__pyx_v_nkey[__pyx_t_2])[__pyx_t_3]) = (((__pyx_v_nkey[__pyx_t_2])[__pyx_t_3]) + 1);
  27088. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":2008
  27089. * if nkey[0][i] < 255:
  27090. * nkey[0][i] += 1
  27091. * break # <<<<<<<<<<<<<<
  27092. * # If the value exceeds 255, i.e. the current value is the last one
  27093. * else:
  27094. */
  27095. goto __pyx_L4_break;
  27096. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":2006
  27097. * while i > 0:
  27098. * i -= 1
  27099. * if nkey[0][i] < 255: # <<<<<<<<<<<<<<
  27100. * nkey[0][i] += 1
  27101. * break
  27102. */
  27103. }
  27104. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":2013
  27105. * # If we are already at the leftmost byte, and this is already
  27106. * # at 255, the sequence is exhausted.
  27107. * if i == 0: # <<<<<<<<<<<<<<
  27108. * raise RuntimeError(
  27109. * 'BAD DAY: Sequence exhausted. No more '
  27110. */
  27111. /*else*/ {
  27112. __pyx_t_1 = ((__pyx_v_i == 0) != 0);
  27113. if (unlikely(__pyx_t_1)) {
  27114. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":2014
  27115. * # at 255, the sequence is exhausted.
  27116. * if i == 0:
  27117. * raise RuntimeError( # <<<<<<<<<<<<<<
  27118. * 'BAD DAY: Sequence exhausted. No more '
  27119. * 'combinations are possible.')
  27120. */
  27121. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2014, __pyx_L1_error)
  27122. __Pyx_GOTREF(__pyx_t_4);
  27123. __Pyx_Raise(__pyx_t_4, 0, 0, 0);
  27124. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  27125. __PYX_ERR(0, 2014, __pyx_L1_error)
  27126. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":2013
  27127. * # If we are already at the leftmost byte, and this is already
  27128. * # at 255, the sequence is exhausted.
  27129. * if i == 0: # <<<<<<<<<<<<<<
  27130. * raise RuntimeError(
  27131. * 'BAD DAY: Sequence exhausted. No more '
  27132. */
  27133. }
  27134. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":2019
  27135. * # Move one position up and try to increment that.
  27136. * else:
  27137. * nkey[0][i] = KEY_START # <<<<<<<<<<<<<<
  27138. * #logger.debug('New key: {}'.format(nkey[0][:KLEN]))
  27139. */
  27140. /*else*/ {
  27141. ((__pyx_v_nkey[0])[__pyx_v_i]) = '\x01';
  27142. }
  27143. }
  27144. }
  27145. __pyx_L4_break:;
  27146. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1984
  27147. *
  27148. *
  27149. * cdef void _next_key(self, const Key key, Key *nkey) except *: # <<<<<<<<<<<<<<
  27150. * """
  27151. * Calculate the next closest byte sequence in lexicographical order.
  27152. */
  27153. /* function exit code */
  27154. goto __pyx_L0;
  27155. __pyx_L1_error:;
  27156. __Pyx_XDECREF(__pyx_t_4);
  27157. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore._next_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  27158. __pyx_L0:;
  27159. __Pyx_TraceReturn(Py_None, 0);
  27160. __Pyx_RefNannyFinishContext();
  27161. }
  27162. /* "(tree fragment)":1
  27163. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  27164. * raise TypeError("self.curs,self.dbenv,self.dbis,self.txn cannot be converted to a Python object for pickling")
  27165. * def __setstate_cython__(self, __pyx_state):
  27166. */
  27167. /* Python wrapper */
  27168. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_32__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  27169. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_32__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  27170. PyObject *__pyx_r = 0;
  27171. __Pyx_RefNannyDeclarations
  27172. __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  27173. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_31__reduce_cython__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self));
  27174. /* function exit code */
  27175. __Pyx_RefNannyFinishContext();
  27176. return __pyx_r;
  27177. }
  27178. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_31__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self) {
  27179. PyObject *__pyx_r = NULL;
  27180. __Pyx_TraceDeclarations
  27181. __Pyx_RefNannyDeclarations
  27182. PyObject *__pyx_t_1 = NULL;
  27183. __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  27184. __Pyx_TraceCall("__reduce_cython__", __pyx_f[1], 1, 0, __PYX_ERR(1, 1, __pyx_L1_error));
  27185. /* "(tree fragment)":2
  27186. * def __reduce_cython__(self):
  27187. * raise TypeError("self.curs,self.dbenv,self.dbis,self.txn cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<<
  27188. * def __setstate_cython__(self, __pyx_state):
  27189. * raise TypeError("self.curs,self.dbenv,self.dbis,self.txn cannot be converted to a Python object for pickling")
  27190. */
  27191. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  27192. __Pyx_GOTREF(__pyx_t_1);
  27193. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  27194. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  27195. __PYX_ERR(1, 2, __pyx_L1_error)
  27196. /* "(tree fragment)":1
  27197. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  27198. * raise TypeError("self.curs,self.dbenv,self.dbis,self.txn cannot be converted to a Python object for pickling")
  27199. * def __setstate_cython__(self, __pyx_state):
  27200. */
  27201. /* function exit code */
  27202. __pyx_L1_error:;
  27203. __Pyx_XDECREF(__pyx_t_1);
  27204. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  27205. __pyx_r = NULL;
  27206. __Pyx_XGIVEREF(__pyx_r);
  27207. __Pyx_TraceReturn(__pyx_r, 0);
  27208. __Pyx_RefNannyFinishContext();
  27209. return __pyx_r;
  27210. }
  27211. /* "(tree fragment)":3
  27212. * def __reduce_cython__(self):
  27213. * raise TypeError("self.curs,self.dbenv,self.dbis,self.txn cannot be converted to a Python object for pickling")
  27214. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  27215. * raise TypeError("self.curs,self.dbenv,self.dbis,self.txn cannot be converted to a Python object for pickling")
  27216. */
  27217. /* Python wrapper */
  27218. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_34__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
  27219. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_34__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  27220. PyObject *__pyx_r = 0;
  27221. __Pyx_RefNannyDeclarations
  27222. __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  27223. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_33__setstate_cython__(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
  27224. /* function exit code */
  27225. __Pyx_RefNannyFinishContext();
  27226. return __pyx_r;
  27227. }
  27228. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_33__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  27229. PyObject *__pyx_r = NULL;
  27230. __Pyx_TraceDeclarations
  27231. __Pyx_RefNannyDeclarations
  27232. PyObject *__pyx_t_1 = NULL;
  27233. __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  27234. __Pyx_TraceCall("__setstate_cython__", __pyx_f[1], 3, 0, __PYX_ERR(1, 3, __pyx_L1_error));
  27235. /* "(tree fragment)":4
  27236. * raise TypeError("self.curs,self.dbenv,self.dbis,self.txn cannot be converted to a Python object for pickling")
  27237. * def __setstate_cython__(self, __pyx_state):
  27238. * raise TypeError("self.curs,self.dbenv,self.dbis,self.txn cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<<
  27239. */
  27240. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  27241. __Pyx_GOTREF(__pyx_t_1);
  27242. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  27243. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  27244. __PYX_ERR(1, 4, __pyx_L1_error)
  27245. /* "(tree fragment)":3
  27246. * def __reduce_cython__(self):
  27247. * raise TypeError("self.curs,self.dbenv,self.dbis,self.txn cannot be converted to a Python object for pickling")
  27248. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  27249. * raise TypeError("self.curs,self.dbenv,self.dbis,self.txn cannot be converted to a Python object for pickling")
  27250. */
  27251. /* function exit code */
  27252. __pyx_L1_error:;
  27253. __Pyx_XDECREF(__pyx_t_1);
  27254. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  27255. __pyx_r = NULL;
  27256. __Pyx_XGIVEREF(__pyx_r);
  27257. __Pyx_TraceReturn(__pyx_r, 0);
  27258. __Pyx_RefNannyFinishContext();
  27259. return __pyx_r;
  27260. }
  27261. /* "(tree fragment)":1
  27262. * def __pyx_unpickle_SimpleGraph(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
  27263. * if __pyx_checksum != 0x8d777f3:
  27264. * from pickle import PickleError as __pyx_PickleError
  27265. */
  27266. /* Python wrapper */
  27267. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3__pyx_unpickle_SimpleGraph(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  27268. static PyMethodDef __pyx_mdef_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3__pyx_unpickle_SimpleGraph = {"__pyx_unpickle_SimpleGraph", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3__pyx_unpickle_SimpleGraph, METH_VARARGS|METH_KEYWORDS, 0};
  27269. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3__pyx_unpickle_SimpleGraph(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  27270. PyObject *__pyx_v___pyx_type = 0;
  27271. long __pyx_v___pyx_checksum;
  27272. PyObject *__pyx_v___pyx_state = 0;
  27273. PyObject *__pyx_r = 0;
  27274. __Pyx_RefNannyDeclarations
  27275. __Pyx_RefNannySetupContext("__pyx_unpickle_SimpleGraph (wrapper)", 0);
  27276. {
  27277. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
  27278. PyObject* values[3] = {0,0,0};
  27279. if (unlikely(__pyx_kwds)) {
  27280. Py_ssize_t kw_args;
  27281. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  27282. switch (pos_args) {
  27283. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  27284. CYTHON_FALLTHROUGH;
  27285. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  27286. CYTHON_FALLTHROUGH;
  27287. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  27288. CYTHON_FALLTHROUGH;
  27289. case 0: break;
  27290. default: goto __pyx_L5_argtuple_error;
  27291. }
  27292. kw_args = PyDict_Size(__pyx_kwds);
  27293. switch (pos_args) {
  27294. case 0:
  27295. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
  27296. else goto __pyx_L5_argtuple_error;
  27297. CYTHON_FALLTHROUGH;
  27298. case 1:
  27299. if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
  27300. else {
  27301. __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SimpleGraph", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
  27302. }
  27303. CYTHON_FALLTHROUGH;
  27304. case 2:
  27305. if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
  27306. else {
  27307. __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SimpleGraph", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
  27308. }
  27309. }
  27310. if (unlikely(kw_args > 0)) {
  27311. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_SimpleGraph") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
  27312. }
  27313. } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
  27314. goto __pyx_L5_argtuple_error;
  27315. } else {
  27316. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  27317. values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  27318. values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  27319. }
  27320. __pyx_v___pyx_type = values[0];
  27321. __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
  27322. __pyx_v___pyx_state = values[2];
  27323. }
  27324. goto __pyx_L4_argument_unpacking_done;
  27325. __pyx_L5_argtuple_error:;
  27326. __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_SimpleGraph", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  27327. __pyx_L3_error:;
  27328. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.__pyx_unpickle_SimpleGraph", __pyx_clineno, __pyx_lineno, __pyx_filename);
  27329. __Pyx_RefNannyFinishContext();
  27330. return NULL;
  27331. __pyx_L4_argument_unpacking_done:;
  27332. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_2__pyx_unpickle_SimpleGraph(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
  27333. /* function exit code */
  27334. __Pyx_RefNannyFinishContext();
  27335. return __pyx_r;
  27336. }
  27337. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_2__pyx_unpickle_SimpleGraph(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  27338. PyObject *__pyx_v___pyx_PickleError = NULL;
  27339. PyObject *__pyx_v___pyx_result = NULL;
  27340. PyObject *__pyx_r = NULL;
  27341. __Pyx_TraceDeclarations
  27342. __Pyx_RefNannyDeclarations
  27343. int __pyx_t_1;
  27344. PyObject *__pyx_t_2 = NULL;
  27345. PyObject *__pyx_t_3 = NULL;
  27346. PyObject *__pyx_t_4 = NULL;
  27347. PyObject *__pyx_t_5 = NULL;
  27348. PyObject *__pyx_t_6 = NULL;
  27349. int __pyx_t_7;
  27350. __Pyx_TraceFrameInit(__pyx_codeobj__34)
  27351. __Pyx_RefNannySetupContext("__pyx_unpickle_SimpleGraph", 0);
  27352. __Pyx_TraceCall("__pyx_unpickle_SimpleGraph", __pyx_f[1], 1, 0, __PYX_ERR(1, 1, __pyx_L1_error));
  27353. /* "(tree fragment)":2
  27354. * def __pyx_unpickle_SimpleGraph(__pyx_type, long __pyx_checksum, __pyx_state):
  27355. * if __pyx_checksum != 0x8d777f3: # <<<<<<<<<<<<<<
  27356. * from pickle import PickleError as __pyx_PickleError
  27357. * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8d777f3 = (data))" % __pyx_checksum)
  27358. */
  27359. __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x8d777f3) != 0);
  27360. if (__pyx_t_1) {
  27361. /* "(tree fragment)":3
  27362. * def __pyx_unpickle_SimpleGraph(__pyx_type, long __pyx_checksum, __pyx_state):
  27363. * if __pyx_checksum != 0x8d777f3:
  27364. * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<<
  27365. * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8d777f3 = (data))" % __pyx_checksum)
  27366. * __pyx_result = SimpleGraph.__new__(__pyx_type)
  27367. */
  27368. __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error)
  27369. __Pyx_GOTREF(__pyx_t_2);
  27370. __Pyx_INCREF(__pyx_n_s_PickleError);
  27371. __Pyx_GIVEREF(__pyx_n_s_PickleError);
  27372. PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
  27373. __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3, __pyx_L1_error)
  27374. __Pyx_GOTREF(__pyx_t_3);
  27375. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  27376. __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error)
  27377. __Pyx_GOTREF(__pyx_t_2);
  27378. __Pyx_INCREF(__pyx_t_2);
  27379. __pyx_v___pyx_PickleError = __pyx_t_2;
  27380. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  27381. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  27382. /* "(tree fragment)":4
  27383. * if __pyx_checksum != 0x8d777f3:
  27384. * from pickle import PickleError as __pyx_PickleError
  27385. * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8d777f3 = (data))" % __pyx_checksum) # <<<<<<<<<<<<<<
  27386. * __pyx_result = SimpleGraph.__new__(__pyx_type)
  27387. * if __pyx_state is not None:
  27388. */
  27389. __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4, __pyx_L1_error)
  27390. __Pyx_GOTREF(__pyx_t_2);
  27391. __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x8d, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4, __pyx_L1_error)
  27392. __Pyx_GOTREF(__pyx_t_4);
  27393. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  27394. __Pyx_INCREF(__pyx_v___pyx_PickleError);
  27395. __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
  27396. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
  27397. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
  27398. if (likely(__pyx_t_5)) {
  27399. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  27400. __Pyx_INCREF(__pyx_t_5);
  27401. __Pyx_INCREF(function);
  27402. __Pyx_DECREF_SET(__pyx_t_2, function);
  27403. }
  27404. }
  27405. if (!__pyx_t_5) {
  27406. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
  27407. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  27408. __Pyx_GOTREF(__pyx_t_3);
  27409. } else {
  27410. #if CYTHON_FAST_PYCALL
  27411. if (PyFunction_Check(__pyx_t_2)) {
  27412. PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
  27413. __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
  27414. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  27415. __Pyx_GOTREF(__pyx_t_3);
  27416. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  27417. } else
  27418. #endif
  27419. #if CYTHON_FAST_PYCCALL
  27420. if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
  27421. PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
  27422. __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
  27423. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  27424. __Pyx_GOTREF(__pyx_t_3);
  27425. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  27426. } else
  27427. #endif
  27428. {
  27429. __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4, __pyx_L1_error)
  27430. __Pyx_GOTREF(__pyx_t_6);
  27431. __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
  27432. __Pyx_GIVEREF(__pyx_t_4);
  27433. PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
  27434. __pyx_t_4 = 0;
  27435. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
  27436. __Pyx_GOTREF(__pyx_t_3);
  27437. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  27438. }
  27439. }
  27440. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  27441. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  27442. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  27443. __PYX_ERR(1, 4, __pyx_L1_error)
  27444. /* "(tree fragment)":2
  27445. * def __pyx_unpickle_SimpleGraph(__pyx_type, long __pyx_checksum, __pyx_state):
  27446. * if __pyx_checksum != 0x8d777f3: # <<<<<<<<<<<<<<
  27447. * from pickle import PickleError as __pyx_PickleError
  27448. * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8d777f3 = (data))" % __pyx_checksum)
  27449. */
  27450. }
  27451. /* "(tree fragment)":5
  27452. * from pickle import PickleError as __pyx_PickleError
  27453. * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8d777f3 = (data))" % __pyx_checksum)
  27454. * __pyx_result = SimpleGraph.__new__(__pyx_type) # <<<<<<<<<<<<<<
  27455. * if __pyx_state is not None:
  27456. * __pyx_unpickle_SimpleGraph__set_state(<SimpleGraph> __pyx_result, __pyx_state)
  27457. */
  27458. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  27459. __Pyx_GOTREF(__pyx_t_2);
  27460. __pyx_t_6 = NULL;
  27461. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
  27462. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
  27463. if (likely(__pyx_t_6)) {
  27464. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  27465. __Pyx_INCREF(__pyx_t_6);
  27466. __Pyx_INCREF(function);
  27467. __Pyx_DECREF_SET(__pyx_t_2, function);
  27468. }
  27469. }
  27470. if (!__pyx_t_6) {
  27471. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  27472. __Pyx_GOTREF(__pyx_t_3);
  27473. } else {
  27474. #if CYTHON_FAST_PYCALL
  27475. if (PyFunction_Check(__pyx_t_2)) {
  27476. PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type};
  27477. __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  27478. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  27479. __Pyx_GOTREF(__pyx_t_3);
  27480. } else
  27481. #endif
  27482. #if CYTHON_FAST_PYCCALL
  27483. if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
  27484. PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type};
  27485. __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  27486. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  27487. __Pyx_GOTREF(__pyx_t_3);
  27488. } else
  27489. #endif
  27490. {
  27491. __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
  27492. __Pyx_GOTREF(__pyx_t_4);
  27493. __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
  27494. __Pyx_INCREF(__pyx_v___pyx_type);
  27495. __Pyx_GIVEREF(__pyx_v___pyx_type);
  27496. PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v___pyx_type);
  27497. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  27498. __Pyx_GOTREF(__pyx_t_3);
  27499. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  27500. }
  27501. }
  27502. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  27503. __pyx_v___pyx_result = __pyx_t_3;
  27504. __pyx_t_3 = 0;
  27505. /* "(tree fragment)":6
  27506. * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8d777f3 = (data))" % __pyx_checksum)
  27507. * __pyx_result = SimpleGraph.__new__(__pyx_type)
  27508. * if __pyx_state is not None: # <<<<<<<<<<<<<<
  27509. * __pyx_unpickle_SimpleGraph__set_state(<SimpleGraph> __pyx_result, __pyx_state)
  27510. * return __pyx_result
  27511. */
  27512. __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  27513. __pyx_t_7 = (__pyx_t_1 != 0);
  27514. if (__pyx_t_7) {
  27515. /* "(tree fragment)":7
  27516. * __pyx_result = SimpleGraph.__new__(__pyx_type)
  27517. * if __pyx_state is not None:
  27518. * __pyx_unpickle_SimpleGraph__set_state(<SimpleGraph> __pyx_result, __pyx_state) # <<<<<<<<<<<<<<
  27519. * return __pyx_result
  27520. * cdef __pyx_unpickle_SimpleGraph__set_state(SimpleGraph __pyx_result, tuple __pyx_state):
  27521. */
  27522. if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 7, __pyx_L1_error)
  27523. __pyx_t_3 = __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_unpickle_SimpleGraph__set_state(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  27524. __Pyx_GOTREF(__pyx_t_3);
  27525. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  27526. /* "(tree fragment)":6
  27527. * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8d777f3 = (data))" % __pyx_checksum)
  27528. * __pyx_result = SimpleGraph.__new__(__pyx_type)
  27529. * if __pyx_state is not None: # <<<<<<<<<<<<<<
  27530. * __pyx_unpickle_SimpleGraph__set_state(<SimpleGraph> __pyx_result, __pyx_state)
  27531. * return __pyx_result
  27532. */
  27533. }
  27534. /* "(tree fragment)":8
  27535. * if __pyx_state is not None:
  27536. * __pyx_unpickle_SimpleGraph__set_state(<SimpleGraph> __pyx_result, __pyx_state)
  27537. * return __pyx_result # <<<<<<<<<<<<<<
  27538. * cdef __pyx_unpickle_SimpleGraph__set_state(SimpleGraph __pyx_result, tuple __pyx_state):
  27539. * __pyx_result.data = __pyx_state[0]
  27540. */
  27541. __Pyx_XDECREF(__pyx_r);
  27542. __Pyx_INCREF(__pyx_v___pyx_result);
  27543. __pyx_r = __pyx_v___pyx_result;
  27544. goto __pyx_L0;
  27545. /* "(tree fragment)":1
  27546. * def __pyx_unpickle_SimpleGraph(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
  27547. * if __pyx_checksum != 0x8d777f3:
  27548. * from pickle import PickleError as __pyx_PickleError
  27549. */
  27550. /* function exit code */
  27551. __pyx_L1_error:;
  27552. __Pyx_XDECREF(__pyx_t_2);
  27553. __Pyx_XDECREF(__pyx_t_3);
  27554. __Pyx_XDECREF(__pyx_t_4);
  27555. __Pyx_XDECREF(__pyx_t_5);
  27556. __Pyx_XDECREF(__pyx_t_6);
  27557. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.__pyx_unpickle_SimpleGraph", __pyx_clineno, __pyx_lineno, __pyx_filename);
  27558. __pyx_r = NULL;
  27559. __pyx_L0:;
  27560. __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  27561. __Pyx_XDECREF(__pyx_v___pyx_result);
  27562. __Pyx_XGIVEREF(__pyx_r);
  27563. __Pyx_TraceReturn(__pyx_r, 0);
  27564. __Pyx_RefNannyFinishContext();
  27565. return __pyx_r;
  27566. }
  27567. /* "(tree fragment)":9
  27568. * __pyx_unpickle_SimpleGraph__set_state(<SimpleGraph> __pyx_result, __pyx_state)
  27569. * return __pyx_result
  27570. * cdef __pyx_unpickle_SimpleGraph__set_state(SimpleGraph __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
  27571. * __pyx_result.data = __pyx_state[0]
  27572. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
  27573. */
  27574. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_unpickle_SimpleGraph__set_state(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  27575. PyObject *__pyx_r = NULL;
  27576. __Pyx_TraceDeclarations
  27577. __Pyx_RefNannyDeclarations
  27578. PyObject *__pyx_t_1 = NULL;
  27579. int __pyx_t_2;
  27580. Py_ssize_t __pyx_t_3;
  27581. int __pyx_t_4;
  27582. int __pyx_t_5;
  27583. PyObject *__pyx_t_6 = NULL;
  27584. PyObject *__pyx_t_7 = NULL;
  27585. PyObject *__pyx_t_8 = NULL;
  27586. __Pyx_RefNannySetupContext("__pyx_unpickle_SimpleGraph__set_state", 0);
  27587. __Pyx_TraceCall("__pyx_unpickle_SimpleGraph__set_state", __pyx_f[1], 9, 0, __PYX_ERR(1, 9, __pyx_L1_error));
  27588. /* "(tree fragment)":10
  27589. * return __pyx_result
  27590. * cdef __pyx_unpickle_SimpleGraph__set_state(SimpleGraph __pyx_result, tuple __pyx_state):
  27591. * __pyx_result.data = __pyx_state[0] # <<<<<<<<<<<<<<
  27592. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
  27593. * __pyx_result.__dict__.update(__pyx_state[1])
  27594. */
  27595. if (unlikely(__pyx_v___pyx_state == Py_None)) {
  27596. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
  27597. __PYX_ERR(1, 10, __pyx_L1_error)
  27598. }
  27599. if (!(likely(PySet_CheckExact(PyTuple_GET_ITEM(__pyx_v___pyx_state, 0)))||((PyTuple_GET_ITEM(__pyx_v___pyx_state, 0)) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "set", Py_TYPE(PyTuple_GET_ITEM(__pyx_v___pyx_state, 0))->tp_name), 0))) __PYX_ERR(1, 10, __pyx_L1_error)
  27600. __pyx_t_1 = PyTuple_GET_ITEM(__pyx_v___pyx_state, 0);
  27601. __Pyx_INCREF(__pyx_t_1);
  27602. __Pyx_GIVEREF(__pyx_t_1);
  27603. __Pyx_GOTREF(__pyx_v___pyx_result->data);
  27604. __Pyx_DECREF(__pyx_v___pyx_result->data);
  27605. __pyx_v___pyx_result->data = ((PyObject*)__pyx_t_1);
  27606. __pyx_t_1 = 0;
  27607. /* "(tree fragment)":11
  27608. * cdef __pyx_unpickle_SimpleGraph__set_state(SimpleGraph __pyx_result, tuple __pyx_state):
  27609. * __pyx_result.data = __pyx_state[0]
  27610. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
  27611. * __pyx_result.__dict__.update(__pyx_state[1])
  27612. */
  27613. if (unlikely(__pyx_v___pyx_state == Py_None)) {
  27614. PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
  27615. __PYX_ERR(1, 11, __pyx_L1_error)
  27616. }
  27617. __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 11, __pyx_L1_error)
  27618. __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
  27619. if (__pyx_t_4) {
  27620. } else {
  27621. __pyx_t_2 = __pyx_t_4;
  27622. goto __pyx_L4_bool_binop_done;
  27623. }
  27624. __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 11, __pyx_L1_error)
  27625. __pyx_t_5 = (__pyx_t_4 != 0);
  27626. __pyx_t_2 = __pyx_t_5;
  27627. __pyx_L4_bool_binop_done:;
  27628. if (__pyx_t_2) {
  27629. /* "(tree fragment)":12
  27630. * __pyx_result.data = __pyx_state[0]
  27631. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
  27632. * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<<
  27633. */
  27634. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 12, __pyx_L1_error)
  27635. __Pyx_GOTREF(__pyx_t_6);
  27636. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 12, __pyx_L1_error)
  27637. __Pyx_GOTREF(__pyx_t_7);
  27638. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  27639. if (unlikely(__pyx_v___pyx_state == Py_None)) {
  27640. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
  27641. __PYX_ERR(1, 12, __pyx_L1_error)
  27642. }
  27643. __pyx_t_6 = NULL;
  27644. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
  27645. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
  27646. if (likely(__pyx_t_6)) {
  27647. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
  27648. __Pyx_INCREF(__pyx_t_6);
  27649. __Pyx_INCREF(function);
  27650. __Pyx_DECREF_SET(__pyx_t_7, function);
  27651. }
  27652. }
  27653. if (!__pyx_t_6) {
  27654. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, PyTuple_GET_ITEM(__pyx_v___pyx_state, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  27655. __Pyx_GOTREF(__pyx_t_1);
  27656. } else {
  27657. #if CYTHON_FAST_PYCALL
  27658. if (PyFunction_Check(__pyx_t_7)) {
  27659. PyObject *__pyx_temp[2] = {__pyx_t_6, PyTuple_GET_ITEM(__pyx_v___pyx_state, 1)};
  27660. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  27661. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  27662. __Pyx_GOTREF(__pyx_t_1);
  27663. } else
  27664. #endif
  27665. #if CYTHON_FAST_PYCCALL
  27666. if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
  27667. PyObject *__pyx_temp[2] = {__pyx_t_6, PyTuple_GET_ITEM(__pyx_v___pyx_state, 1)};
  27668. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  27669. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  27670. __Pyx_GOTREF(__pyx_t_1);
  27671. } else
  27672. #endif
  27673. {
  27674. __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 12, __pyx_L1_error)
  27675. __Pyx_GOTREF(__pyx_t_8);
  27676. __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
  27677. __Pyx_INCREF(PyTuple_GET_ITEM(__pyx_v___pyx_state, 1));
  27678. __Pyx_GIVEREF(PyTuple_GET_ITEM(__pyx_v___pyx_state, 1));
  27679. PyTuple_SET_ITEM(__pyx_t_8, 0+1, PyTuple_GET_ITEM(__pyx_v___pyx_state, 1));
  27680. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  27681. __Pyx_GOTREF(__pyx_t_1);
  27682. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  27683. }
  27684. }
  27685. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  27686. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  27687. /* "(tree fragment)":11
  27688. * cdef __pyx_unpickle_SimpleGraph__set_state(SimpleGraph __pyx_result, tuple __pyx_state):
  27689. * __pyx_result.data = __pyx_state[0]
  27690. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
  27691. * __pyx_result.__dict__.update(__pyx_state[1])
  27692. */
  27693. }
  27694. /* "(tree fragment)":9
  27695. * __pyx_unpickle_SimpleGraph__set_state(<SimpleGraph> __pyx_result, __pyx_state)
  27696. * return __pyx_result
  27697. * cdef __pyx_unpickle_SimpleGraph__set_state(SimpleGraph __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
  27698. * __pyx_result.data = __pyx_state[0]
  27699. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
  27700. */
  27701. /* function exit code */
  27702. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  27703. goto __pyx_L0;
  27704. __pyx_L1_error:;
  27705. __Pyx_XDECREF(__pyx_t_1);
  27706. __Pyx_XDECREF(__pyx_t_6);
  27707. __Pyx_XDECREF(__pyx_t_7);
  27708. __Pyx_XDECREF(__pyx_t_8);
  27709. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.__pyx_unpickle_SimpleGraph__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  27710. __pyx_r = 0;
  27711. __pyx_L0:;
  27712. __Pyx_XGIVEREF(__pyx_r);
  27713. __Pyx_TraceReturn(__pyx_r, 0);
  27714. __Pyx_RefNannyFinishContext();
  27715. return __pyx_r;
  27716. }
  27717. /* "(tree fragment)":1
  27718. * def __pyx_unpickle_Imr(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
  27719. * if __pyx_checksum != 0xbf84141:
  27720. * from pickle import PickleError as __pyx_PickleError
  27721. */
  27722. /* Python wrapper */
  27723. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_5__pyx_unpickle_Imr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  27724. static PyMethodDef __pyx_mdef_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_5__pyx_unpickle_Imr = {"__pyx_unpickle_Imr", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_5__pyx_unpickle_Imr, METH_VARARGS|METH_KEYWORDS, 0};
  27725. static PyObject *__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_5__pyx_unpickle_Imr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  27726. PyObject *__pyx_v___pyx_type = 0;
  27727. long __pyx_v___pyx_checksum;
  27728. PyObject *__pyx_v___pyx_state = 0;
  27729. PyObject *__pyx_r = 0;
  27730. __Pyx_RefNannyDeclarations
  27731. __Pyx_RefNannySetupContext("__pyx_unpickle_Imr (wrapper)", 0);
  27732. {
  27733. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
  27734. PyObject* values[3] = {0,0,0};
  27735. if (unlikely(__pyx_kwds)) {
  27736. Py_ssize_t kw_args;
  27737. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  27738. switch (pos_args) {
  27739. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  27740. CYTHON_FALLTHROUGH;
  27741. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  27742. CYTHON_FALLTHROUGH;
  27743. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  27744. CYTHON_FALLTHROUGH;
  27745. case 0: break;
  27746. default: goto __pyx_L5_argtuple_error;
  27747. }
  27748. kw_args = PyDict_Size(__pyx_kwds);
  27749. switch (pos_args) {
  27750. case 0:
  27751. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
  27752. else goto __pyx_L5_argtuple_error;
  27753. CYTHON_FALLTHROUGH;
  27754. case 1:
  27755. if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
  27756. else {
  27757. __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Imr", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
  27758. }
  27759. CYTHON_FALLTHROUGH;
  27760. case 2:
  27761. if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
  27762. else {
  27763. __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Imr", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
  27764. }
  27765. }
  27766. if (unlikely(kw_args > 0)) {
  27767. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Imr") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
  27768. }
  27769. } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
  27770. goto __pyx_L5_argtuple_error;
  27771. } else {
  27772. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  27773. values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  27774. values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  27775. }
  27776. __pyx_v___pyx_type = values[0];
  27777. __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
  27778. __pyx_v___pyx_state = values[2];
  27779. }
  27780. goto __pyx_L4_argument_unpacking_done;
  27781. __pyx_L5_argtuple_error:;
  27782. __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Imr", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  27783. __pyx_L3_error:;
  27784. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.__pyx_unpickle_Imr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  27785. __Pyx_RefNannyFinishContext();
  27786. return NULL;
  27787. __pyx_L4_argument_unpacking_done:;
  27788. __pyx_r = __pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_4__pyx_unpickle_Imr(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
  27789. /* function exit code */
  27790. __Pyx_RefNannyFinishContext();
  27791. return __pyx_r;
  27792. }
  27793. static PyObject *__pyx_pf_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_4__pyx_unpickle_Imr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  27794. PyObject *__pyx_v___pyx_PickleError = NULL;
  27795. PyObject *__pyx_v___pyx_result = NULL;
  27796. PyObject *__pyx_r = NULL;
  27797. __Pyx_TraceDeclarations
  27798. __Pyx_RefNannyDeclarations
  27799. int __pyx_t_1;
  27800. PyObject *__pyx_t_2 = NULL;
  27801. PyObject *__pyx_t_3 = NULL;
  27802. PyObject *__pyx_t_4 = NULL;
  27803. PyObject *__pyx_t_5 = NULL;
  27804. PyObject *__pyx_t_6 = NULL;
  27805. int __pyx_t_7;
  27806. __Pyx_TraceFrameInit(__pyx_codeobj__35)
  27807. __Pyx_RefNannySetupContext("__pyx_unpickle_Imr", 0);
  27808. __Pyx_TraceCall("__pyx_unpickle_Imr", __pyx_f[1], 1, 0, __PYX_ERR(1, 1, __pyx_L1_error));
  27809. /* "(tree fragment)":2
  27810. * def __pyx_unpickle_Imr(__pyx_type, long __pyx_checksum, __pyx_state):
  27811. * if __pyx_checksum != 0xbf84141: # <<<<<<<<<<<<<<
  27812. * from pickle import PickleError as __pyx_PickleError
  27813. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xbf84141 = (data, uri))" % __pyx_checksum)
  27814. */
  27815. __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xbf84141) != 0);
  27816. if (__pyx_t_1) {
  27817. /* "(tree fragment)":3
  27818. * def __pyx_unpickle_Imr(__pyx_type, long __pyx_checksum, __pyx_state):
  27819. * if __pyx_checksum != 0xbf84141:
  27820. * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<<
  27821. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xbf84141 = (data, uri))" % __pyx_checksum)
  27822. * __pyx_result = Imr.__new__(__pyx_type)
  27823. */
  27824. __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error)
  27825. __Pyx_GOTREF(__pyx_t_2);
  27826. __Pyx_INCREF(__pyx_n_s_PickleError);
  27827. __Pyx_GIVEREF(__pyx_n_s_PickleError);
  27828. PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
  27829. __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3, __pyx_L1_error)
  27830. __Pyx_GOTREF(__pyx_t_3);
  27831. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  27832. __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error)
  27833. __Pyx_GOTREF(__pyx_t_2);
  27834. __Pyx_INCREF(__pyx_t_2);
  27835. __pyx_v___pyx_PickleError = __pyx_t_2;
  27836. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  27837. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  27838. /* "(tree fragment)":4
  27839. * if __pyx_checksum != 0xbf84141:
  27840. * from pickle import PickleError as __pyx_PickleError
  27841. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xbf84141 = (data, uri))" % __pyx_checksum) # <<<<<<<<<<<<<<
  27842. * __pyx_result = Imr.__new__(__pyx_type)
  27843. * if __pyx_state is not None:
  27844. */
  27845. __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4, __pyx_L1_error)
  27846. __Pyx_GOTREF(__pyx_t_2);
  27847. __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xbf, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4, __pyx_L1_error)
  27848. __Pyx_GOTREF(__pyx_t_4);
  27849. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  27850. __Pyx_INCREF(__pyx_v___pyx_PickleError);
  27851. __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
  27852. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
  27853. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
  27854. if (likely(__pyx_t_5)) {
  27855. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  27856. __Pyx_INCREF(__pyx_t_5);
  27857. __Pyx_INCREF(function);
  27858. __Pyx_DECREF_SET(__pyx_t_2, function);
  27859. }
  27860. }
  27861. if (!__pyx_t_5) {
  27862. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
  27863. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  27864. __Pyx_GOTREF(__pyx_t_3);
  27865. } else {
  27866. #if CYTHON_FAST_PYCALL
  27867. if (PyFunction_Check(__pyx_t_2)) {
  27868. PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
  27869. __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
  27870. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  27871. __Pyx_GOTREF(__pyx_t_3);
  27872. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  27873. } else
  27874. #endif
  27875. #if CYTHON_FAST_PYCCALL
  27876. if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
  27877. PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
  27878. __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
  27879. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  27880. __Pyx_GOTREF(__pyx_t_3);
  27881. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  27882. } else
  27883. #endif
  27884. {
  27885. __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4, __pyx_L1_error)
  27886. __Pyx_GOTREF(__pyx_t_6);
  27887. __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
  27888. __Pyx_GIVEREF(__pyx_t_4);
  27889. PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
  27890. __pyx_t_4 = 0;
  27891. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4, __pyx_L1_error)
  27892. __Pyx_GOTREF(__pyx_t_3);
  27893. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  27894. }
  27895. }
  27896. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  27897. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  27898. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  27899. __PYX_ERR(1, 4, __pyx_L1_error)
  27900. /* "(tree fragment)":2
  27901. * def __pyx_unpickle_Imr(__pyx_type, long __pyx_checksum, __pyx_state):
  27902. * if __pyx_checksum != 0xbf84141: # <<<<<<<<<<<<<<
  27903. * from pickle import PickleError as __pyx_PickleError
  27904. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xbf84141 = (data, uri))" % __pyx_checksum)
  27905. */
  27906. }
  27907. /* "(tree fragment)":5
  27908. * from pickle import PickleError as __pyx_PickleError
  27909. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xbf84141 = (data, uri))" % __pyx_checksum)
  27910. * __pyx_result = Imr.__new__(__pyx_type) # <<<<<<<<<<<<<<
  27911. * if __pyx_state is not None:
  27912. * __pyx_unpickle_Imr__set_state(<Imr> __pyx_result, __pyx_state)
  27913. */
  27914. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  27915. __Pyx_GOTREF(__pyx_t_2);
  27916. __pyx_t_6 = NULL;
  27917. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
  27918. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
  27919. if (likely(__pyx_t_6)) {
  27920. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  27921. __Pyx_INCREF(__pyx_t_6);
  27922. __Pyx_INCREF(function);
  27923. __Pyx_DECREF_SET(__pyx_t_2, function);
  27924. }
  27925. }
  27926. if (!__pyx_t_6) {
  27927. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  27928. __Pyx_GOTREF(__pyx_t_3);
  27929. } else {
  27930. #if CYTHON_FAST_PYCALL
  27931. if (PyFunction_Check(__pyx_t_2)) {
  27932. PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type};
  27933. __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  27934. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  27935. __Pyx_GOTREF(__pyx_t_3);
  27936. } else
  27937. #endif
  27938. #if CYTHON_FAST_PYCCALL
  27939. if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
  27940. PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type};
  27941. __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  27942. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  27943. __Pyx_GOTREF(__pyx_t_3);
  27944. } else
  27945. #endif
  27946. {
  27947. __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
  27948. __Pyx_GOTREF(__pyx_t_4);
  27949. __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
  27950. __Pyx_INCREF(__pyx_v___pyx_type);
  27951. __Pyx_GIVEREF(__pyx_v___pyx_type);
  27952. PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v___pyx_type);
  27953. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  27954. __Pyx_GOTREF(__pyx_t_3);
  27955. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  27956. }
  27957. }
  27958. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  27959. __pyx_v___pyx_result = __pyx_t_3;
  27960. __pyx_t_3 = 0;
  27961. /* "(tree fragment)":6
  27962. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xbf84141 = (data, uri))" % __pyx_checksum)
  27963. * __pyx_result = Imr.__new__(__pyx_type)
  27964. * if __pyx_state is not None: # <<<<<<<<<<<<<<
  27965. * __pyx_unpickle_Imr__set_state(<Imr> __pyx_result, __pyx_state)
  27966. * return __pyx_result
  27967. */
  27968. __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  27969. __pyx_t_7 = (__pyx_t_1 != 0);
  27970. if (__pyx_t_7) {
  27971. /* "(tree fragment)":7
  27972. * __pyx_result = Imr.__new__(__pyx_type)
  27973. * if __pyx_state is not None:
  27974. * __pyx_unpickle_Imr__set_state(<Imr> __pyx_result, __pyx_state) # <<<<<<<<<<<<<<
  27975. * return __pyx_result
  27976. * cdef __pyx_unpickle_Imr__set_state(Imr __pyx_result, tuple __pyx_state):
  27977. */
  27978. if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 7, __pyx_L1_error)
  27979. __pyx_t_3 = __pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_unpickle_Imr__set_state(((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  27980. __Pyx_GOTREF(__pyx_t_3);
  27981. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  27982. /* "(tree fragment)":6
  27983. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xbf84141 = (data, uri))" % __pyx_checksum)
  27984. * __pyx_result = Imr.__new__(__pyx_type)
  27985. * if __pyx_state is not None: # <<<<<<<<<<<<<<
  27986. * __pyx_unpickle_Imr__set_state(<Imr> __pyx_result, __pyx_state)
  27987. * return __pyx_result
  27988. */
  27989. }
  27990. /* "(tree fragment)":8
  27991. * if __pyx_state is not None:
  27992. * __pyx_unpickle_Imr__set_state(<Imr> __pyx_result, __pyx_state)
  27993. * return __pyx_result # <<<<<<<<<<<<<<
  27994. * cdef __pyx_unpickle_Imr__set_state(Imr __pyx_result, tuple __pyx_state):
  27995. * __pyx_result.data = __pyx_state[0]; __pyx_result.uri = __pyx_state[1]
  27996. */
  27997. __Pyx_XDECREF(__pyx_r);
  27998. __Pyx_INCREF(__pyx_v___pyx_result);
  27999. __pyx_r = __pyx_v___pyx_result;
  28000. goto __pyx_L0;
  28001. /* "(tree fragment)":1
  28002. * def __pyx_unpickle_Imr(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
  28003. * if __pyx_checksum != 0xbf84141:
  28004. * from pickle import PickleError as __pyx_PickleError
  28005. */
  28006. /* function exit code */
  28007. __pyx_L1_error:;
  28008. __Pyx_XDECREF(__pyx_t_2);
  28009. __Pyx_XDECREF(__pyx_t_3);
  28010. __Pyx_XDECREF(__pyx_t_4);
  28011. __Pyx_XDECREF(__pyx_t_5);
  28012. __Pyx_XDECREF(__pyx_t_6);
  28013. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.__pyx_unpickle_Imr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  28014. __pyx_r = NULL;
  28015. __pyx_L0:;
  28016. __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  28017. __Pyx_XDECREF(__pyx_v___pyx_result);
  28018. __Pyx_XGIVEREF(__pyx_r);
  28019. __Pyx_TraceReturn(__pyx_r, 0);
  28020. __Pyx_RefNannyFinishContext();
  28021. return __pyx_r;
  28022. }
  28023. /* "(tree fragment)":9
  28024. * __pyx_unpickle_Imr__set_state(<Imr> __pyx_result, __pyx_state)
  28025. * return __pyx_result
  28026. * cdef __pyx_unpickle_Imr__set_state(Imr __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
  28027. * __pyx_result.data = __pyx_state[0]; __pyx_result.uri = __pyx_state[1]
  28028. * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
  28029. */
  28030. static PyObject *__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_unpickle_Imr__set_state(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  28031. PyObject *__pyx_r = NULL;
  28032. __Pyx_TraceDeclarations
  28033. __Pyx_RefNannyDeclarations
  28034. PyObject *__pyx_t_1 = NULL;
  28035. int __pyx_t_2;
  28036. Py_ssize_t __pyx_t_3;
  28037. int __pyx_t_4;
  28038. int __pyx_t_5;
  28039. PyObject *__pyx_t_6 = NULL;
  28040. PyObject *__pyx_t_7 = NULL;
  28041. PyObject *__pyx_t_8 = NULL;
  28042. __Pyx_RefNannySetupContext("__pyx_unpickle_Imr__set_state", 0);
  28043. __Pyx_TraceCall("__pyx_unpickle_Imr__set_state", __pyx_f[1], 9, 0, __PYX_ERR(1, 9, __pyx_L1_error));
  28044. /* "(tree fragment)":10
  28045. * return __pyx_result
  28046. * cdef __pyx_unpickle_Imr__set_state(Imr __pyx_result, tuple __pyx_state):
  28047. * __pyx_result.data = __pyx_state[0]; __pyx_result.uri = __pyx_state[1] # <<<<<<<<<<<<<<
  28048. * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
  28049. * __pyx_result.__dict__.update(__pyx_state[2])
  28050. */
  28051. if (unlikely(__pyx_v___pyx_state == Py_None)) {
  28052. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
  28053. __PYX_ERR(1, 10, __pyx_L1_error)
  28054. }
  28055. if (!(likely(PySet_CheckExact(PyTuple_GET_ITEM(__pyx_v___pyx_state, 0)))||((PyTuple_GET_ITEM(__pyx_v___pyx_state, 0)) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "set", Py_TYPE(PyTuple_GET_ITEM(__pyx_v___pyx_state, 0))->tp_name), 0))) __PYX_ERR(1, 10, __pyx_L1_error)
  28056. __pyx_t_1 = PyTuple_GET_ITEM(__pyx_v___pyx_state, 0);
  28057. __Pyx_INCREF(__pyx_t_1);
  28058. __Pyx_GIVEREF(__pyx_t_1);
  28059. __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.data);
  28060. __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.data);
  28061. __pyx_v___pyx_result->__pyx_base.data = ((PyObject*)__pyx_t_1);
  28062. __pyx_t_1 = 0;
  28063. if (unlikely(__pyx_v___pyx_state == Py_None)) {
  28064. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
  28065. __PYX_ERR(1, 10, __pyx_L1_error)
  28066. }
  28067. __pyx_t_1 = PyTuple_GET_ITEM(__pyx_v___pyx_state, 1);
  28068. __Pyx_INCREF(__pyx_t_1);
  28069. __Pyx_GIVEREF(__pyx_t_1);
  28070. __Pyx_GOTREF(__pyx_v___pyx_result->uri);
  28071. __Pyx_DECREF(__pyx_v___pyx_result->uri);
  28072. __pyx_v___pyx_result->uri = __pyx_t_1;
  28073. __pyx_t_1 = 0;
  28074. /* "(tree fragment)":11
  28075. * cdef __pyx_unpickle_Imr__set_state(Imr __pyx_result, tuple __pyx_state):
  28076. * __pyx_result.data = __pyx_state[0]; __pyx_result.uri = __pyx_state[1]
  28077. * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
  28078. * __pyx_result.__dict__.update(__pyx_state[2])
  28079. */
  28080. if (unlikely(__pyx_v___pyx_state == Py_None)) {
  28081. PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
  28082. __PYX_ERR(1, 11, __pyx_L1_error)
  28083. }
  28084. __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 11, __pyx_L1_error)
  28085. __pyx_t_4 = ((__pyx_t_3 > 2) != 0);
  28086. if (__pyx_t_4) {
  28087. } else {
  28088. __pyx_t_2 = __pyx_t_4;
  28089. goto __pyx_L4_bool_binop_done;
  28090. }
  28091. __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 11, __pyx_L1_error)
  28092. __pyx_t_5 = (__pyx_t_4 != 0);
  28093. __pyx_t_2 = __pyx_t_5;
  28094. __pyx_L4_bool_binop_done:;
  28095. if (__pyx_t_2) {
  28096. /* "(tree fragment)":12
  28097. * __pyx_result.data = __pyx_state[0]; __pyx_result.uri = __pyx_state[1]
  28098. * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
  28099. * __pyx_result.__dict__.update(__pyx_state[2]) # <<<<<<<<<<<<<<
  28100. */
  28101. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 12, __pyx_L1_error)
  28102. __Pyx_GOTREF(__pyx_t_6);
  28103. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 12, __pyx_L1_error)
  28104. __Pyx_GOTREF(__pyx_t_7);
  28105. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  28106. if (unlikely(__pyx_v___pyx_state == Py_None)) {
  28107. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
  28108. __PYX_ERR(1, 12, __pyx_L1_error)
  28109. }
  28110. __pyx_t_6 = NULL;
  28111. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
  28112. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
  28113. if (likely(__pyx_t_6)) {
  28114. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
  28115. __Pyx_INCREF(__pyx_t_6);
  28116. __Pyx_INCREF(function);
  28117. __Pyx_DECREF_SET(__pyx_t_7, function);
  28118. }
  28119. }
  28120. if (!__pyx_t_6) {
  28121. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, PyTuple_GET_ITEM(__pyx_v___pyx_state, 2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  28122. __Pyx_GOTREF(__pyx_t_1);
  28123. } else {
  28124. #if CYTHON_FAST_PYCALL
  28125. if (PyFunction_Check(__pyx_t_7)) {
  28126. PyObject *__pyx_temp[2] = {__pyx_t_6, PyTuple_GET_ITEM(__pyx_v___pyx_state, 2)};
  28127. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  28128. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  28129. __Pyx_GOTREF(__pyx_t_1);
  28130. } else
  28131. #endif
  28132. #if CYTHON_FAST_PYCCALL
  28133. if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
  28134. PyObject *__pyx_temp[2] = {__pyx_t_6, PyTuple_GET_ITEM(__pyx_v___pyx_state, 2)};
  28135. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  28136. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  28137. __Pyx_GOTREF(__pyx_t_1);
  28138. } else
  28139. #endif
  28140. {
  28141. __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 12, __pyx_L1_error)
  28142. __Pyx_GOTREF(__pyx_t_8);
  28143. __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
  28144. __Pyx_INCREF(PyTuple_GET_ITEM(__pyx_v___pyx_state, 2));
  28145. __Pyx_GIVEREF(PyTuple_GET_ITEM(__pyx_v___pyx_state, 2));
  28146. PyTuple_SET_ITEM(__pyx_t_8, 0+1, PyTuple_GET_ITEM(__pyx_v___pyx_state, 2));
  28147. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  28148. __Pyx_GOTREF(__pyx_t_1);
  28149. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  28150. }
  28151. }
  28152. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  28153. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  28154. /* "(tree fragment)":11
  28155. * cdef __pyx_unpickle_Imr__set_state(Imr __pyx_result, tuple __pyx_state):
  28156. * __pyx_result.data = __pyx_state[0]; __pyx_result.uri = __pyx_state[1]
  28157. * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
  28158. * __pyx_result.__dict__.update(__pyx_state[2])
  28159. */
  28160. }
  28161. /* "(tree fragment)":9
  28162. * __pyx_unpickle_Imr__set_state(<Imr> __pyx_result, __pyx_state)
  28163. * return __pyx_result
  28164. * cdef __pyx_unpickle_Imr__set_state(Imr __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
  28165. * __pyx_result.data = __pyx_state[0]; __pyx_result.uri = __pyx_state[1]
  28166. * if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
  28167. */
  28168. /* function exit code */
  28169. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  28170. goto __pyx_L0;
  28171. __pyx_L1_error:;
  28172. __Pyx_XDECREF(__pyx_t_1);
  28173. __Pyx_XDECREF(__pyx_t_6);
  28174. __Pyx_XDECREF(__pyx_t_7);
  28175. __Pyx_XDECREF(__pyx_t_8);
  28176. __Pyx_AddTraceback("lakesuperior.store.ldp_rs.lmdb_triplestore.__pyx_unpickle_Imr__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  28177. __pyx_r = 0;
  28178. __pyx_L0:;
  28179. __Pyx_XGIVEREF(__pyx_r);
  28180. __Pyx_TraceReturn(__pyx_r, 0);
  28181. __Pyx_RefNannyFinishContext();
  28182. return __pyx_r;
  28183. }
  28184. static struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet;
  28185. static PyObject *__pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet(PyTypeObject *t, PyObject *a, PyObject *k) {
  28186. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *p;
  28187. PyObject *o;
  28188. if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
  28189. o = (*t->tp_alloc)(t, 0);
  28190. } else {
  28191. o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  28192. }
  28193. if (unlikely(!o)) return 0;
  28194. p = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)o);
  28195. p->__pyx_vtab = __pyx_vtabptr_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet;
  28196. if (unlikely(__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_1__cinit__(o, a, k) < 0)) goto bad;
  28197. return o;
  28198. bad:
  28199. Py_DECREF(o); o = 0;
  28200. return NULL;
  28201. }
  28202. static void __pyx_tp_dealloc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet(PyObject *o) {
  28203. #if CYTHON_USE_TP_FINALIZE
  28204. if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
  28205. if (PyObject_CallFinalizerFromDealloc(o)) return;
  28206. }
  28207. #endif
  28208. {
  28209. PyObject *etype, *eval, *etb;
  28210. PyErr_Fetch(&etype, &eval, &etb);
  28211. ++Py_REFCNT(o);
  28212. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_3__dealloc__(o);
  28213. --Py_REFCNT(o);
  28214. PyErr_Restore(etype, eval, etb);
  28215. }
  28216. (*Py_TYPE(o)->tp_free)(o);
  28217. }
  28218. static PyObject *__pyx_getprop_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_data(PyObject *o, CYTHON_UNUSED void *x) {
  28219. return __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_4data_1__get__(o);
  28220. }
  28221. static PyObject *__pyx_getprop_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
  28222. return __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_8itemsize_1__get__(o);
  28223. }
  28224. static PyObject *__pyx_getprop_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_ct(PyObject *o, CYTHON_UNUSED void *x) {
  28225. return __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_2ct_1__get__(o);
  28226. }
  28227. static PyObject *__pyx_getprop_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_size(PyObject *o, CYTHON_UNUSED void *x) {
  28228. return __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_4size_1__get__(o);
  28229. }
  28230. static PyMethodDef __pyx_methods_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet[] = {
  28231. {"to_tuple", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_5to_tuple, METH_NOARGS, __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_4to_tuple},
  28232. {"get_item_obj", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_7get_item_obj, METH_O, 0},
  28233. {"__reduce_cython__", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_9__reduce_cython__, METH_NOARGS, 0},
  28234. {"__setstate_cython__", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_11__setstate_cython__, METH_O, 0},
  28235. {0, 0, 0, 0}
  28236. };
  28237. static struct PyGetSetDef __pyx_getsets_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet[] = {
  28238. {(char *)"data", __pyx_getprop_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_data, 0, (char *)0, 0},
  28239. {(char *)"itemsize", __pyx_getprop_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_itemsize, 0, (char *)0, 0},
  28240. {(char *)"ct", __pyx_getprop_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_ct, 0, (char *)0, 0},
  28241. {(char *)"size", __pyx_getprop_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_size, 0, (char *)0, 0},
  28242. {0, 0, 0, 0, 0}
  28243. };
  28244. static PyTypeObject __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet = {
  28245. PyVarObject_HEAD_INIT(0, 0)
  28246. "lakesuperior.store.ldp_rs.lmdb_triplestore.ResultSet", /*tp_name*/
  28247. sizeof(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet), /*tp_basicsize*/
  28248. 0, /*tp_itemsize*/
  28249. __pyx_tp_dealloc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet, /*tp_dealloc*/
  28250. 0, /*tp_print*/
  28251. 0, /*tp_getattr*/
  28252. 0, /*tp_setattr*/
  28253. #if PY_MAJOR_VERSION < 3
  28254. 0, /*tp_compare*/
  28255. #endif
  28256. #if PY_MAJOR_VERSION >= 3
  28257. 0, /*tp_as_async*/
  28258. #endif
  28259. 0, /*tp_repr*/
  28260. 0, /*tp_as_number*/
  28261. 0, /*tp_as_sequence*/
  28262. 0, /*tp_as_mapping*/
  28263. 0, /*tp_hash*/
  28264. 0, /*tp_call*/
  28265. 0, /*tp_str*/
  28266. 0, /*tp_getattro*/
  28267. 0, /*tp_setattro*/
  28268. 0, /*tp_as_buffer*/
  28269. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  28270. "\n Pre-allocated result set.\n\n Data in the set are stored as a 1D contiguous array of characters.\n Access to elements at an arbitrary index position is achieved by using the\n ``itemsize`` property multiplied by the index number.\n\n Key properties:\n\n ``ct``: number of elements in the set.\n ``itemsize``: size of each element, in bytes. All elements have the same\n size.\n ``size``: Total size, in bytes, of the data set. This is the product of\n ``itemsize`` and ``ct``.\n ", /*tp_doc*/
  28271. 0, /*tp_traverse*/
  28272. 0, /*tp_clear*/
  28273. 0, /*tp_richcompare*/
  28274. 0, /*tp_weaklistoffset*/
  28275. 0, /*tp_iter*/
  28276. 0, /*tp_iternext*/
  28277. __pyx_methods_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet, /*tp_methods*/
  28278. 0, /*tp_members*/
  28279. __pyx_getsets_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet, /*tp_getset*/
  28280. 0, /*tp_base*/
  28281. 0, /*tp_dict*/
  28282. 0, /*tp_descr_get*/
  28283. 0, /*tp_descr_set*/
  28284. 0, /*tp_dictoffset*/
  28285. 0, /*tp_init*/
  28286. 0, /*tp_alloc*/
  28287. __pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet, /*tp_new*/
  28288. 0, /*tp_free*/
  28289. 0, /*tp_is_gc*/
  28290. 0, /*tp_bases*/
  28291. 0, /*tp_mro*/
  28292. 0, /*tp_cache*/
  28293. 0, /*tp_subclasses*/
  28294. 0, /*tp_weaklist*/
  28295. 0, /*tp_del*/
  28296. 0, /*tp_version_tag*/
  28297. #if PY_VERSION_HEX >= 0x030400a1
  28298. 0, /*tp_finalize*/
  28299. #endif
  28300. };
  28301. static struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph;
  28302. static PyObject *__pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  28303. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *p;
  28304. PyObject *o;
  28305. if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
  28306. o = (*t->tp_alloc)(t, 0);
  28307. } else {
  28308. o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  28309. }
  28310. if (unlikely(!o)) return 0;
  28311. p = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)o);
  28312. p->__pyx_vtab = __pyx_vtabptr_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph;
  28313. p->data = ((PyObject*)Py_None); Py_INCREF(Py_None);
  28314. return o;
  28315. }
  28316. static void __pyx_tp_dealloc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph(PyObject *o) {
  28317. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *p = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)o;
  28318. #if CYTHON_USE_TP_FINALIZE
  28319. if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
  28320. if (PyObject_CallFinalizerFromDealloc(o)) return;
  28321. }
  28322. #endif
  28323. PyObject_GC_UnTrack(o);
  28324. Py_CLEAR(p->data);
  28325. (*Py_TYPE(o)->tp_free)(o);
  28326. }
  28327. static int __pyx_tp_traverse_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph(PyObject *o, visitproc v, void *a) {
  28328. int e;
  28329. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *p = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)o;
  28330. if (p->data) {
  28331. e = (*v)(p->data, a); if (e) return e;
  28332. }
  28333. return 0;
  28334. }
  28335. static int __pyx_tp_clear_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph(PyObject *o) {
  28336. PyObject* tmp;
  28337. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *p = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *)o;
  28338. tmp = ((PyObject*)p->data);
  28339. p->data = ((PyObject*)Py_None); Py_INCREF(Py_None);
  28340. Py_XDECREF(tmp);
  28341. return 0;
  28342. }
  28343. static PyObject *__pyx_sq_item_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph(PyObject *o, Py_ssize_t i) {
  28344. PyObject *r;
  28345. PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  28346. r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  28347. Py_DECREF(x);
  28348. return r;
  28349. }
  28350. static PyObject *__pyx_tp_richcompare_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph(PyObject *o1, PyObject *o2, int op) {
  28351. switch (op) {
  28352. case Py_EQ: {
  28353. return __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_9__eq__(o1, o2);
  28354. }
  28355. case Py_NE: {
  28356. PyObject *ret;
  28357. ret = __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_9__eq__(o1, o2);
  28358. if (likely(ret && ret != Py_NotImplemented)) {
  28359. int b = __Pyx_PyObject_IsTrue(ret); Py_DECREF(ret);
  28360. if (unlikely(b < 0)) return NULL;
  28361. ret = (b) ? Py_False : Py_True;
  28362. Py_INCREF(ret);
  28363. }
  28364. return ret;
  28365. }
  28366. default: {
  28367. return __Pyx_NewRef(Py_NotImplemented);
  28368. }
  28369. }
  28370. }
  28371. static PyObject *__pyx_getprop_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_data(PyObject *o, CYTHON_UNUSED void *x) {
  28372. return __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_4data_1__get__(o);
  28373. }
  28374. static PyMethodDef __pyx_methods_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph[] = {
  28375. {"add", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_3add, METH_O, 0},
  28376. {"remove", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_5remove, METH_O, 0},
  28377. {"set", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_37set, METH_O, __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_36set},
  28378. {"remove_triples", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_39remove_triples, METH_O, __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_38remove_triples},
  28379. {"as_rdflib", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_41as_rdflib, METH_NOARGS, __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_40as_rdflib},
  28380. {"lookup", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_43lookup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_42lookup},
  28381. {"terms", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_45terms, METH_O, __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_44terms},
  28382. {"__reduce_cython__", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_47__reduce_cython__, METH_NOARGS, 0},
  28383. {"__setstate_cython__", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_49__setstate_cython__, METH_O, 0},
  28384. {0, 0, 0, 0}
  28385. };
  28386. static struct PyGetSetDef __pyx_getsets_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph[] = {
  28387. {(char *)"data", __pyx_getprop_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_data, 0, (char *)0, 0},
  28388. {0, 0, 0, 0, 0}
  28389. };
  28390. static PyNumberMethods __pyx_tp_as_number_SimpleGraph = {
  28391. 0, /*nb_add*/
  28392. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_15__sub__, /*nb_subtract*/
  28393. 0, /*nb_multiply*/
  28394. #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  28395. 0, /*nb_divide*/
  28396. #endif
  28397. 0, /*nb_remainder*/
  28398. 0, /*nb_divmod*/
  28399. 0, /*nb_power*/
  28400. 0, /*nb_negative*/
  28401. 0, /*nb_positive*/
  28402. 0, /*nb_absolute*/
  28403. 0, /*nb_nonzero*/
  28404. 0, /*nb_invert*/
  28405. 0, /*nb_lshift*/
  28406. 0, /*nb_rshift*/
  28407. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_19__and__, /*nb_and*/
  28408. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_27__xor__, /*nb_xor*/
  28409. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_23__or__, /*nb_or*/
  28410. #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  28411. 0, /*nb_coerce*/
  28412. #endif
  28413. 0, /*nb_int*/
  28414. #if PY_MAJOR_VERSION < 3
  28415. 0, /*nb_long*/
  28416. #else
  28417. 0, /*reserved*/
  28418. #endif
  28419. 0, /*nb_float*/
  28420. #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  28421. 0, /*nb_oct*/
  28422. #endif
  28423. #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  28424. 0, /*nb_hex*/
  28425. #endif
  28426. 0, /*nb_inplace_add*/
  28427. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_17__isub__, /*nb_inplace_subtract*/
  28428. 0, /*nb_inplace_multiply*/
  28429. #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  28430. 0, /*nb_inplace_divide*/
  28431. #endif
  28432. 0, /*nb_inplace_remainder*/
  28433. 0, /*nb_inplace_power*/
  28434. 0, /*nb_inplace_lshift*/
  28435. 0, /*nb_inplace_rshift*/
  28436. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_21__iand__, /*nb_inplace_and*/
  28437. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_29__ixor__, /*nb_inplace_xor*/
  28438. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_25__ior__, /*nb_inplace_or*/
  28439. 0, /*nb_floor_divide*/
  28440. 0, /*nb_true_divide*/
  28441. 0, /*nb_inplace_floor_divide*/
  28442. 0, /*nb_inplace_true_divide*/
  28443. 0, /*nb_index*/
  28444. #if PY_VERSION_HEX >= 0x03050000
  28445. 0, /*nb_matrix_multiply*/
  28446. #endif
  28447. #if PY_VERSION_HEX >= 0x03050000
  28448. 0, /*nb_inplace_matrix_multiply*/
  28449. #endif
  28450. };
  28451. static PySequenceMethods __pyx_tp_as_sequence_SimpleGraph = {
  28452. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_7__len__, /*sq_length*/
  28453. 0, /*sq_concat*/
  28454. 0, /*sq_repeat*/
  28455. __pyx_sq_item_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph, /*sq_item*/
  28456. 0, /*sq_slice*/
  28457. 0, /*sq_ass_item*/
  28458. 0, /*sq_ass_slice*/
  28459. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_31__contains__, /*sq_contains*/
  28460. 0, /*sq_inplace_concat*/
  28461. 0, /*sq_inplace_repeat*/
  28462. };
  28463. static PyMappingMethods __pyx_tp_as_mapping_SimpleGraph = {
  28464. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_7__len__, /*mp_length*/
  28465. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_35__getitem__, /*mp_subscript*/
  28466. 0, /*mp_ass_subscript*/
  28467. };
  28468. static PyTypeObject __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph = {
  28469. PyVarObject_HEAD_INIT(0, 0)
  28470. "lakesuperior.store.ldp_rs.lmdb_triplestore.SimpleGraph", /*tp_name*/
  28471. sizeof(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph), /*tp_basicsize*/
  28472. 0, /*tp_itemsize*/
  28473. __pyx_tp_dealloc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph, /*tp_dealloc*/
  28474. 0, /*tp_print*/
  28475. 0, /*tp_getattr*/
  28476. 0, /*tp_setattr*/
  28477. #if PY_MAJOR_VERSION < 3
  28478. 0, /*tp_compare*/
  28479. #endif
  28480. #if PY_MAJOR_VERSION >= 3
  28481. 0, /*tp_as_async*/
  28482. #endif
  28483. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_11__repr__, /*tp_repr*/
  28484. &__pyx_tp_as_number_SimpleGraph, /*tp_as_number*/
  28485. &__pyx_tp_as_sequence_SimpleGraph, /*tp_as_sequence*/
  28486. &__pyx_tp_as_mapping_SimpleGraph, /*tp_as_mapping*/
  28487. 0, /*tp_hash*/
  28488. 0, /*tp_call*/
  28489. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_13__str__, /*tp_str*/
  28490. 0, /*tp_getattro*/
  28491. 0, /*tp_setattro*/
  28492. 0, /*tp_as_buffer*/
  28493. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  28494. "\n Fast and simple implementation of a graph.\n\n Most functions should mimic RDFLib's graph with less overhead. It uses\n the same funny but functional slicing notation.\n ", /*tp_doc*/
  28495. __pyx_tp_traverse_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph, /*tp_traverse*/
  28496. __pyx_tp_clear_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph, /*tp_clear*/
  28497. __pyx_tp_richcompare_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph, /*tp_richcompare*/
  28498. 0, /*tp_weaklistoffset*/
  28499. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_33__iter__, /*tp_iter*/
  28500. 0, /*tp_iternext*/
  28501. __pyx_methods_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph, /*tp_methods*/
  28502. 0, /*tp_members*/
  28503. __pyx_getsets_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph, /*tp_getset*/
  28504. 0, /*tp_base*/
  28505. 0, /*tp_dict*/
  28506. 0, /*tp_descr_get*/
  28507. 0, /*tp_descr_set*/
  28508. 0, /*tp_dictoffset*/
  28509. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_1__init__, /*tp_init*/
  28510. 0, /*tp_alloc*/
  28511. __pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph, /*tp_new*/
  28512. 0, /*tp_free*/
  28513. 0, /*tp_is_gc*/
  28514. 0, /*tp_bases*/
  28515. 0, /*tp_mro*/
  28516. 0, /*tp_cache*/
  28517. 0, /*tp_subclasses*/
  28518. 0, /*tp_weaklist*/
  28519. 0, /*tp_del*/
  28520. 0, /*tp_version_tag*/
  28521. #if PY_VERSION_HEX >= 0x030400a1
  28522. 0, /*tp_finalize*/
  28523. #endif
  28524. };
  28525. static struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr;
  28526. static PyObject *__pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr(PyTypeObject *t, PyObject *a, PyObject *k) {
  28527. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *p;
  28528. PyObject *o = __pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph(t, a, k);
  28529. if (unlikely(!o)) return 0;
  28530. p = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *)o);
  28531. p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph*)__pyx_vtabptr_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr;
  28532. p->uri = Py_None; Py_INCREF(Py_None);
  28533. return o;
  28534. }
  28535. static void __pyx_tp_dealloc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr(PyObject *o) {
  28536. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *p = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *)o;
  28537. #if CYTHON_USE_TP_FINALIZE
  28538. if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
  28539. if (PyObject_CallFinalizerFromDealloc(o)) return;
  28540. }
  28541. #endif
  28542. PyObject_GC_UnTrack(o);
  28543. Py_CLEAR(p->uri);
  28544. PyObject_GC_Track(o);
  28545. __pyx_tp_dealloc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph(o);
  28546. }
  28547. static int __pyx_tp_traverse_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr(PyObject *o, visitproc v, void *a) {
  28548. int e;
  28549. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *p = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *)o;
  28550. e = __pyx_tp_traverse_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph(o, v, a); if (e) return e;
  28551. if (p->uri) {
  28552. e = (*v)(p->uri, a); if (e) return e;
  28553. }
  28554. return 0;
  28555. }
  28556. static int __pyx_tp_clear_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr(PyObject *o) {
  28557. PyObject* tmp;
  28558. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *p = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr *)o;
  28559. __pyx_tp_clear_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph(o);
  28560. tmp = ((PyObject*)p->uri);
  28561. p->uri = Py_None; Py_INCREF(Py_None);
  28562. Py_XDECREF(tmp);
  28563. return 0;
  28564. }
  28565. static PyObject *__pyx_sq_item_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr(PyObject *o, Py_ssize_t i) {
  28566. PyObject *r;
  28567. PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  28568. r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  28569. Py_DECREF(x);
  28570. return r;
  28571. }
  28572. static PyObject *__pyx_getprop_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_identifier(PyObject *o, CYTHON_UNUSED void *x) {
  28573. return __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_10identifier_1__get__(o);
  28574. }
  28575. static PyObject *__pyx_getprop_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_graph(PyObject *o, CYTHON_UNUSED void *x) {
  28576. return __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_5graph_1__get__(o);
  28577. }
  28578. static PyObject *__pyx_getprop_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_uri(PyObject *o, CYTHON_UNUSED void *x) {
  28579. return __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_3uri_1__get__(o);
  28580. }
  28581. static PyMethodDef __pyx_methods_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr[] = {
  28582. {"value", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_15value, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_14value},
  28583. {"as_rdflib", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_17as_rdflib, METH_NOARGS, __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_16as_rdflib},
  28584. {"__reduce_cython__", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_19__reduce_cython__, METH_NOARGS, 0},
  28585. {"__setstate_cython__", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_21__setstate_cython__, METH_O, 0},
  28586. {0, 0, 0, 0}
  28587. };
  28588. static struct PyGetSetDef __pyx_getsets_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr[] = {
  28589. {(char *)"identifier", __pyx_getprop_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_identifier, 0, (char *)"\n IMR URI. For compatibility with RDFLib Resource.\n\n :rtype: string\n ", 0},
  28590. {(char *)"graph", __pyx_getprop_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_graph, 0, (char *)"\n Return a SimpleGraph with the same data.\n\n :rtype: SimpleGraph\n ", 0},
  28591. {(char *)"uri", __pyx_getprop_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_uri, 0, (char *)0, 0},
  28592. {0, 0, 0, 0, 0}
  28593. };
  28594. static PyNumberMethods __pyx_tp_as_number_Imr = {
  28595. 0, /*nb_add*/
  28596. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_5__sub__, /*nb_subtract*/
  28597. 0, /*nb_multiply*/
  28598. #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  28599. 0, /*nb_divide*/
  28600. #endif
  28601. 0, /*nb_remainder*/
  28602. 0, /*nb_divmod*/
  28603. 0, /*nb_power*/
  28604. 0, /*nb_negative*/
  28605. 0, /*nb_positive*/
  28606. 0, /*nb_absolute*/
  28607. 0, /*nb_nonzero*/
  28608. 0, /*nb_invert*/
  28609. 0, /*nb_lshift*/
  28610. 0, /*nb_rshift*/
  28611. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_7__and__, /*nb_and*/
  28612. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_11__xor__, /*nb_xor*/
  28613. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_9__or__, /*nb_or*/
  28614. #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  28615. 0, /*nb_coerce*/
  28616. #endif
  28617. 0, /*nb_int*/
  28618. #if PY_MAJOR_VERSION < 3
  28619. 0, /*nb_long*/
  28620. #else
  28621. 0, /*reserved*/
  28622. #endif
  28623. 0, /*nb_float*/
  28624. #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  28625. 0, /*nb_oct*/
  28626. #endif
  28627. #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  28628. 0, /*nb_hex*/
  28629. #endif
  28630. 0, /*nb_inplace_add*/
  28631. #if CYTHON_COMPILING_IN_PYPY
  28632. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_17__isub__, /*nb_inplace_subtract*/
  28633. #else
  28634. 0, /*nb_inplace_subtract*/
  28635. #endif
  28636. 0, /*nb_inplace_multiply*/
  28637. #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  28638. 0, /*nb_inplace_divide*/
  28639. #endif
  28640. 0, /*nb_inplace_remainder*/
  28641. 0, /*nb_inplace_power*/
  28642. 0, /*nb_inplace_lshift*/
  28643. 0, /*nb_inplace_rshift*/
  28644. #if CYTHON_COMPILING_IN_PYPY
  28645. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_21__iand__, /*nb_inplace_and*/
  28646. #else
  28647. 0, /*nb_inplace_and*/
  28648. #endif
  28649. #if CYTHON_COMPILING_IN_PYPY
  28650. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_29__ixor__, /*nb_inplace_xor*/
  28651. #else
  28652. 0, /*nb_inplace_xor*/
  28653. #endif
  28654. #if CYTHON_COMPILING_IN_PYPY
  28655. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_25__ior__, /*nb_inplace_or*/
  28656. #else
  28657. 0, /*nb_inplace_or*/
  28658. #endif
  28659. 0, /*nb_floor_divide*/
  28660. 0, /*nb_true_divide*/
  28661. 0, /*nb_inplace_floor_divide*/
  28662. 0, /*nb_inplace_true_divide*/
  28663. 0, /*nb_index*/
  28664. #if PY_VERSION_HEX >= 0x03050000
  28665. 0, /*nb_matrix_multiply*/
  28666. #endif
  28667. #if PY_VERSION_HEX >= 0x03050000
  28668. 0, /*nb_inplace_matrix_multiply*/
  28669. #endif
  28670. };
  28671. static PySequenceMethods __pyx_tp_as_sequence_Imr = {
  28672. #if CYTHON_COMPILING_IN_PYPY
  28673. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_7__len__, /*sq_length*/
  28674. #else
  28675. 0, /*sq_length*/
  28676. #endif
  28677. 0, /*sq_concat*/
  28678. 0, /*sq_repeat*/
  28679. __pyx_sq_item_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr, /*sq_item*/
  28680. 0, /*sq_slice*/
  28681. 0, /*sq_ass_item*/
  28682. 0, /*sq_ass_slice*/
  28683. #if CYTHON_COMPILING_IN_PYPY
  28684. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_31__contains__, /*sq_contains*/
  28685. #else
  28686. 0, /*sq_contains*/
  28687. #endif
  28688. 0, /*sq_inplace_concat*/
  28689. 0, /*sq_inplace_repeat*/
  28690. };
  28691. static PyMappingMethods __pyx_tp_as_mapping_Imr = {
  28692. #if CYTHON_COMPILING_IN_PYPY
  28693. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_7__len__, /*mp_length*/
  28694. #else
  28695. 0, /*mp_length*/
  28696. #endif
  28697. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_13__getitem__, /*mp_subscript*/
  28698. 0, /*mp_ass_subscript*/
  28699. };
  28700. static PyTypeObject __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr = {
  28701. PyVarObject_HEAD_INIT(0, 0)
  28702. "lakesuperior.store.ldp_rs.lmdb_triplestore.Imr", /*tp_name*/
  28703. sizeof(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr), /*tp_basicsize*/
  28704. 0, /*tp_itemsize*/
  28705. __pyx_tp_dealloc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr, /*tp_dealloc*/
  28706. 0, /*tp_print*/
  28707. 0, /*tp_getattr*/
  28708. 0, /*tp_setattr*/
  28709. #if PY_MAJOR_VERSION < 3
  28710. 0, /*tp_compare*/
  28711. #endif
  28712. #if PY_MAJOR_VERSION >= 3
  28713. 0, /*tp_as_async*/
  28714. #endif
  28715. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_3__repr__, /*tp_repr*/
  28716. &__pyx_tp_as_number_Imr, /*tp_as_number*/
  28717. &__pyx_tp_as_sequence_Imr, /*tp_as_sequence*/
  28718. &__pyx_tp_as_mapping_Imr, /*tp_as_mapping*/
  28719. 0, /*tp_hash*/
  28720. 0, /*tp_call*/
  28721. #if CYTHON_COMPILING_IN_PYPY
  28722. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_13__str__, /*tp_str*/
  28723. #else
  28724. 0, /*tp_str*/
  28725. #endif
  28726. 0, /*tp_getattro*/
  28727. 0, /*tp_setattro*/
  28728. 0, /*tp_as_buffer*/
  28729. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  28730. "\n In-memory resource data container.\n\n This is an extension of :py:class:`~SimpleGraph` that adds a subject URI to\n the data set and some convenience methods.\n\n Some set operations that produce a new object (``-``, ``|``, ``&``, ``^``)\n will create a new ``Imr`` instance with the same subject URI.\n ", /*tp_doc*/
  28731. __pyx_tp_traverse_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr, /*tp_traverse*/
  28732. __pyx_tp_clear_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr, /*tp_clear*/
  28733. 0, /*tp_richcompare*/
  28734. 0, /*tp_weaklistoffset*/
  28735. #if CYTHON_COMPILING_IN_PYPY
  28736. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_33__iter__, /*tp_iter*/
  28737. #else
  28738. 0, /*tp_iter*/
  28739. #endif
  28740. 0, /*tp_iternext*/
  28741. __pyx_methods_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr, /*tp_methods*/
  28742. 0, /*tp_members*/
  28743. __pyx_getsets_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr, /*tp_getset*/
  28744. 0, /*tp_base*/
  28745. 0, /*tp_dict*/
  28746. 0, /*tp_descr_get*/
  28747. 0, /*tp_descr_set*/
  28748. 0, /*tp_dictoffset*/
  28749. __pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_1__init__, /*tp_init*/
  28750. 0, /*tp_alloc*/
  28751. __pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr, /*tp_new*/
  28752. 0, /*tp_free*/
  28753. 0, /*tp_is_gc*/
  28754. 0, /*tp_bases*/
  28755. 0, /*tp_mro*/
  28756. 0, /*tp_cache*/
  28757. 0, /*tp_subclasses*/
  28758. 0, /*tp_weaklist*/
  28759. 0, /*tp_del*/
  28760. 0, /*tp_version_tag*/
  28761. #if PY_VERSION_HEX >= 0x030400a1
  28762. 0, /*tp_finalize*/
  28763. #endif
  28764. };
  28765. static struct __pyx_vtabstruct_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore;
  28766. static PyObject *__pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore(PyTypeObject *t, PyObject *a, PyObject *k) {
  28767. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *p;
  28768. PyObject *o = __pyx_ptype_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore->tp_new(t, a, k);
  28769. if (unlikely(!o)) return 0;
  28770. p = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *)o);
  28771. p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore*)__pyx_vtabptr_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore;
  28772. return o;
  28773. }
  28774. static void __pyx_tp_dealloc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore(PyObject *o) {
  28775. #if CYTHON_USE_TP_FINALIZE
  28776. if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
  28777. if (PyObject_CallFinalizerFromDealloc(o)) return;
  28778. }
  28779. #endif
  28780. if (likely(__pyx_ptype_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore)) __pyx_ptype_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore->tp_dealloc(o); else __Pyx_call_next_tp_dealloc(o, __pyx_tp_dealloc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore);
  28781. }
  28782. static PyMethodDef __pyx_methods_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore[] = {
  28783. {"stats", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_1stats, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_stats},
  28784. {"_len", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_3_len, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_2_len},
  28785. {"add", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_5add, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_4add},
  28786. {"add_graph", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_7add_graph, METH_O, __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_6add_graph},
  28787. {"_add_graph", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_9_add_graph, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_8_add_graph},
  28788. {"_remove", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_11_remove, METH_VARARGS|METH_KEYWORDS, 0},
  28789. {"_remove_graph", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_13_remove_graph, METH_O, __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_12_remove_graph},
  28790. {"contexts", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_15contexts, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_14contexts},
  28791. {"triples", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_18triples, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_17triples},
  28792. {"triple_keys", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_21triple_keys, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_20triple_keys},
  28793. {"_all_term_keys", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_23_all_term_keys, METH_O, __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_22_all_term_keys},
  28794. {"all_terms", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_25all_terms, METH_O, __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_24all_terms},
  28795. {"all_namespaces", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_28all_namespaces, METH_NOARGS, __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_27all_namespaces},
  28796. {"all_contexts", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_30all_contexts, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_29all_contexts},
  28797. {"__reduce_cython__", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_32__reduce_cython__, METH_NOARGS, 0},
  28798. {"__setstate_cython__", (PyCFunction)__pyx_pw_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_34__setstate_cython__, METH_O, 0},
  28799. {0, 0, 0, 0}
  28800. };
  28801. static PyTypeObject __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore = {
  28802. PyVarObject_HEAD_INIT(0, 0)
  28803. "lakesuperior.store.ldp_rs.lmdb_triplestore.LmdbTriplestore", /*tp_name*/
  28804. sizeof(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore), /*tp_basicsize*/
  28805. 0, /*tp_itemsize*/
  28806. __pyx_tp_dealloc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore, /*tp_dealloc*/
  28807. 0, /*tp_print*/
  28808. 0, /*tp_getattr*/
  28809. 0, /*tp_setattr*/
  28810. #if PY_MAJOR_VERSION < 3
  28811. 0, /*tp_compare*/
  28812. #endif
  28813. #if PY_MAJOR_VERSION >= 3
  28814. 0, /*tp_as_async*/
  28815. #endif
  28816. 0, /*tp_repr*/
  28817. 0, /*tp_as_number*/
  28818. 0, /*tp_as_sequence*/
  28819. 0, /*tp_as_mapping*/
  28820. 0, /*tp_hash*/
  28821. 0, /*tp_call*/
  28822. 0, /*tp_str*/
  28823. 0, /*tp_getattro*/
  28824. 0, /*tp_setattro*/
  28825. 0, /*tp_as_buffer*/
  28826. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  28827. "\n Low-level storage layer.\n\n This class extends the RDFLib-compatible :py:class:`BaseLmdbStore` and maps\n triples and contexts to key-value records in LMDB.\n\n This class uses the original LMDB C API rather than the Python bindings,\n because several data manipulations happen after retrieval from the store,\n which are more efficiently performed at the C level.\n ", /*tp_doc*/
  28828. 0, /*tp_traverse*/
  28829. 0, /*tp_clear*/
  28830. 0, /*tp_richcompare*/
  28831. 0, /*tp_weaklistoffset*/
  28832. 0, /*tp_iter*/
  28833. 0, /*tp_iternext*/
  28834. __pyx_methods_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore, /*tp_methods*/
  28835. 0, /*tp_members*/
  28836. 0, /*tp_getset*/
  28837. 0, /*tp_base*/
  28838. 0, /*tp_dict*/
  28839. 0, /*tp_descr_get*/
  28840. 0, /*tp_descr_set*/
  28841. 0, /*tp_dictoffset*/
  28842. 0, /*tp_init*/
  28843. 0, /*tp_alloc*/
  28844. __pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore, /*tp_new*/
  28845. 0, /*tp_free*/
  28846. 0, /*tp_is_gc*/
  28847. 0, /*tp_bases*/
  28848. 0, /*tp_mro*/
  28849. 0, /*tp_cache*/
  28850. 0, /*tp_subclasses*/
  28851. 0, /*tp_weaklist*/
  28852. 0, /*tp_del*/
  28853. 0, /*tp_version_tag*/
  28854. #if PY_VERSION_HEX >= 0x030400a1
  28855. 0, /*tp_finalize*/
  28856. #endif
  28857. };
  28858. static struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple *__pyx_freelist_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple[8];
  28859. static int __pyx_freecount_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple = 0;
  28860. static PyObject *__pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  28861. PyObject *o;
  28862. if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple)))) {
  28863. o = (PyObject*)__pyx_freelist_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple[--__pyx_freecount_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple];
  28864. memset(o, 0, sizeof(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple));
  28865. (void) PyObject_INIT(o, t);
  28866. PyObject_GC_Track(o);
  28867. } else {
  28868. o = (*t->tp_alloc)(t, 0);
  28869. if (unlikely(!o)) return 0;
  28870. }
  28871. return o;
  28872. }
  28873. static void __pyx_tp_dealloc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple(PyObject *o) {
  28874. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple *p = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple *)o;
  28875. PyObject_GC_UnTrack(o);
  28876. Py_CLEAR(p->__pyx_v_self);
  28877. if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple)))) {
  28878. __pyx_freelist_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple[__pyx_freecount_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple++] = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple *)o);
  28879. } else {
  28880. (*Py_TYPE(o)->tp_free)(o);
  28881. }
  28882. }
  28883. static int __pyx_tp_traverse_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple(PyObject *o, visitproc v, void *a) {
  28884. int e;
  28885. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple *p = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple *)o;
  28886. if (p->__pyx_v_self) {
  28887. e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  28888. }
  28889. return 0;
  28890. }
  28891. static int __pyx_tp_clear_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple(PyObject *o) {
  28892. PyObject* tmp;
  28893. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple *p = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple *)o;
  28894. tmp = ((PyObject*)p->__pyx_v_self);
  28895. p->__pyx_v_self = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *)Py_None); Py_INCREF(Py_None);
  28896. Py_XDECREF(tmp);
  28897. return 0;
  28898. }
  28899. static PyTypeObject __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple = {
  28900. PyVarObject_HEAD_INIT(0, 0)
  28901. "lakesuperior.store.ldp_rs.lmdb_triplestore.__pyx_scope_struct__to_tuple", /*tp_name*/
  28902. sizeof(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple), /*tp_basicsize*/
  28903. 0, /*tp_itemsize*/
  28904. __pyx_tp_dealloc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple, /*tp_dealloc*/
  28905. 0, /*tp_print*/
  28906. 0, /*tp_getattr*/
  28907. 0, /*tp_setattr*/
  28908. #if PY_MAJOR_VERSION < 3
  28909. 0, /*tp_compare*/
  28910. #endif
  28911. #if PY_MAJOR_VERSION >= 3
  28912. 0, /*tp_as_async*/
  28913. #endif
  28914. 0, /*tp_repr*/
  28915. 0, /*tp_as_number*/
  28916. 0, /*tp_as_sequence*/
  28917. 0, /*tp_as_mapping*/
  28918. 0, /*tp_hash*/
  28919. 0, /*tp_call*/
  28920. 0, /*tp_str*/
  28921. 0, /*tp_getattro*/
  28922. 0, /*tp_setattro*/
  28923. 0, /*tp_as_buffer*/
  28924. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  28925. 0, /*tp_doc*/
  28926. __pyx_tp_traverse_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple, /*tp_traverse*/
  28927. __pyx_tp_clear_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple, /*tp_clear*/
  28928. 0, /*tp_richcompare*/
  28929. 0, /*tp_weaklistoffset*/
  28930. 0, /*tp_iter*/
  28931. 0, /*tp_iternext*/
  28932. 0, /*tp_methods*/
  28933. 0, /*tp_members*/
  28934. 0, /*tp_getset*/
  28935. 0, /*tp_base*/
  28936. 0, /*tp_dict*/
  28937. 0, /*tp_descr_get*/
  28938. 0, /*tp_descr_set*/
  28939. 0, /*tp_dictoffset*/
  28940. 0, /*tp_init*/
  28941. 0, /*tp_alloc*/
  28942. __pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple, /*tp_new*/
  28943. 0, /*tp_free*/
  28944. 0, /*tp_is_gc*/
  28945. 0, /*tp_bases*/
  28946. 0, /*tp_mro*/
  28947. 0, /*tp_cache*/
  28948. 0, /*tp_subclasses*/
  28949. 0, /*tp_weaklist*/
  28950. 0, /*tp_del*/
  28951. 0, /*tp_version_tag*/
  28952. #if PY_VERSION_HEX >= 0x030400a1
  28953. 0, /*tp_finalize*/
  28954. #endif
  28955. };
  28956. static struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr *__pyx_freelist_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr[8];
  28957. static int __pyx_freecount_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr = 0;
  28958. static PyObject *__pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  28959. PyObject *o;
  28960. if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr)))) {
  28961. o = (PyObject*)__pyx_freelist_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr[--__pyx_freecount_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr];
  28962. memset(o, 0, sizeof(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr));
  28963. (void) PyObject_INIT(o, t);
  28964. PyObject_GC_Track(o);
  28965. } else {
  28966. o = (*t->tp_alloc)(t, 0);
  28967. if (unlikely(!o)) return 0;
  28968. }
  28969. return o;
  28970. }
  28971. static void __pyx_tp_dealloc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr(PyObject *o) {
  28972. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr *)o;
  28973. PyObject_GC_UnTrack(o);
  28974. Py_CLEAR(p->__pyx_outer_scope);
  28975. Py_CLEAR(p->__pyx_v_i);
  28976. Py_CLEAR(p->__pyx_t_0);
  28977. if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr)))) {
  28978. __pyx_freelist_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr[__pyx_freecount_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr *)o);
  28979. } else {
  28980. (*Py_TYPE(o)->tp_free)(o);
  28981. }
  28982. }
  28983. static int __pyx_tp_traverse_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
  28984. int e;
  28985. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr *)o;
  28986. if (p->__pyx_outer_scope) {
  28987. e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  28988. }
  28989. if (p->__pyx_v_i) {
  28990. e = (*v)(p->__pyx_v_i, a); if (e) return e;
  28991. }
  28992. if (p->__pyx_t_0) {
  28993. e = (*v)(p->__pyx_t_0, a); if (e) return e;
  28994. }
  28995. return 0;
  28996. }
  28997. static PyTypeObject __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr = {
  28998. PyVarObject_HEAD_INIT(0, 0)
  28999. "lakesuperior.store.ldp_rs.lmdb_triplestore.__pyx_scope_struct_1_genexpr", /*tp_name*/
  29000. sizeof(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
  29001. 0, /*tp_itemsize*/
  29002. __pyx_tp_dealloc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
  29003. 0, /*tp_print*/
  29004. 0, /*tp_getattr*/
  29005. 0, /*tp_setattr*/
  29006. #if PY_MAJOR_VERSION < 3
  29007. 0, /*tp_compare*/
  29008. #endif
  29009. #if PY_MAJOR_VERSION >= 3
  29010. 0, /*tp_as_async*/
  29011. #endif
  29012. 0, /*tp_repr*/
  29013. 0, /*tp_as_number*/
  29014. 0, /*tp_as_sequence*/
  29015. 0, /*tp_as_mapping*/
  29016. 0, /*tp_hash*/
  29017. 0, /*tp_call*/
  29018. 0, /*tp_str*/
  29019. 0, /*tp_getattro*/
  29020. 0, /*tp_setattro*/
  29021. 0, /*tp_as_buffer*/
  29022. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  29023. 0, /*tp_doc*/
  29024. __pyx_tp_traverse_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr, /*tp_traverse*/
  29025. 0, /*tp_clear*/
  29026. 0, /*tp_richcompare*/
  29027. 0, /*tp_weaklistoffset*/
  29028. 0, /*tp_iter*/
  29029. 0, /*tp_iternext*/
  29030. 0, /*tp_methods*/
  29031. 0, /*tp_members*/
  29032. 0, /*tp_getset*/
  29033. 0, /*tp_base*/
  29034. 0, /*tp_dict*/
  29035. 0, /*tp_descr_get*/
  29036. 0, /*tp_descr_set*/
  29037. 0, /*tp_dictoffset*/
  29038. 0, /*tp_init*/
  29039. 0, /*tp_alloc*/
  29040. __pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr, /*tp_new*/
  29041. 0, /*tp_free*/
  29042. 0, /*tp_is_gc*/
  29043. 0, /*tp_bases*/
  29044. 0, /*tp_mro*/
  29045. 0, /*tp_cache*/
  29046. 0, /*tp_subclasses*/
  29047. 0, /*tp_weaklist*/
  29048. 0, /*tp_del*/
  29049. 0, /*tp_version_tag*/
  29050. #if PY_VERSION_HEX >= 0x030400a1
  29051. 0, /*tp_finalize*/
  29052. #endif
  29053. };
  29054. static struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts *__pyx_freelist_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts[8];
  29055. static int __pyx_freecount_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts = 0;
  29056. static PyObject *__pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  29057. PyObject *o;
  29058. if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts)))) {
  29059. o = (PyObject*)__pyx_freelist_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts[--__pyx_freecount_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts];
  29060. memset(o, 0, sizeof(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts));
  29061. (void) PyObject_INIT(o, t);
  29062. PyObject_GC_Track(o);
  29063. } else {
  29064. o = (*t->tp_alloc)(t, 0);
  29065. if (unlikely(!o)) return 0;
  29066. }
  29067. return o;
  29068. }
  29069. static void __pyx_tp_dealloc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts(PyObject *o) {
  29070. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts *p = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts *)o;
  29071. PyObject_GC_UnTrack(o);
  29072. Py_CLEAR(p->__pyx_v_ctx_uri);
  29073. Py_CLEAR(p->__pyx_v_self);
  29074. Py_CLEAR(p->__pyx_v_triple);
  29075. Py_CLEAR(p->__pyx_t_0);
  29076. if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts)))) {
  29077. __pyx_freelist_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts[__pyx_freecount_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts++] = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts *)o);
  29078. } else {
  29079. (*Py_TYPE(o)->tp_free)(o);
  29080. }
  29081. }
  29082. static int __pyx_tp_traverse_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts(PyObject *o, visitproc v, void *a) {
  29083. int e;
  29084. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts *p = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts *)o;
  29085. if (p->__pyx_v_ctx_uri) {
  29086. e = (*v)(p->__pyx_v_ctx_uri, a); if (e) return e;
  29087. }
  29088. if (p->__pyx_v_self) {
  29089. e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  29090. }
  29091. if (p->__pyx_v_triple) {
  29092. e = (*v)(p->__pyx_v_triple, a); if (e) return e;
  29093. }
  29094. if (p->__pyx_t_0) {
  29095. e = (*v)(p->__pyx_t_0, a); if (e) return e;
  29096. }
  29097. return 0;
  29098. }
  29099. static PyTypeObject __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts = {
  29100. PyVarObject_HEAD_INIT(0, 0)
  29101. "lakesuperior.store.ldp_rs.lmdb_triplestore.__pyx_scope_struct_2_contexts", /*tp_name*/
  29102. sizeof(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts), /*tp_basicsize*/
  29103. 0, /*tp_itemsize*/
  29104. __pyx_tp_dealloc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts, /*tp_dealloc*/
  29105. 0, /*tp_print*/
  29106. 0, /*tp_getattr*/
  29107. 0, /*tp_setattr*/
  29108. #if PY_MAJOR_VERSION < 3
  29109. 0, /*tp_compare*/
  29110. #endif
  29111. #if PY_MAJOR_VERSION >= 3
  29112. 0, /*tp_as_async*/
  29113. #endif
  29114. 0, /*tp_repr*/
  29115. 0, /*tp_as_number*/
  29116. 0, /*tp_as_sequence*/
  29117. 0, /*tp_as_mapping*/
  29118. 0, /*tp_hash*/
  29119. 0, /*tp_call*/
  29120. 0, /*tp_str*/
  29121. 0, /*tp_getattro*/
  29122. 0, /*tp_setattro*/
  29123. 0, /*tp_as_buffer*/
  29124. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  29125. 0, /*tp_doc*/
  29126. __pyx_tp_traverse_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts, /*tp_traverse*/
  29127. 0, /*tp_clear*/
  29128. 0, /*tp_richcompare*/
  29129. 0, /*tp_weaklistoffset*/
  29130. 0, /*tp_iter*/
  29131. 0, /*tp_iternext*/
  29132. 0, /*tp_methods*/
  29133. 0, /*tp_members*/
  29134. 0, /*tp_getset*/
  29135. 0, /*tp_base*/
  29136. 0, /*tp_dict*/
  29137. 0, /*tp_descr_get*/
  29138. 0, /*tp_descr_set*/
  29139. 0, /*tp_dictoffset*/
  29140. 0, /*tp_init*/
  29141. 0, /*tp_alloc*/
  29142. __pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts, /*tp_new*/
  29143. 0, /*tp_free*/
  29144. 0, /*tp_is_gc*/
  29145. 0, /*tp_bases*/
  29146. 0, /*tp_mro*/
  29147. 0, /*tp_cache*/
  29148. 0, /*tp_subclasses*/
  29149. 0, /*tp_weaklist*/
  29150. 0, /*tp_del*/
  29151. 0, /*tp_version_tag*/
  29152. #if PY_VERSION_HEX >= 0x030400a1
  29153. 0, /*tp_finalize*/
  29154. #endif
  29155. };
  29156. static struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples *__pyx_freelist_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples[8];
  29157. static int __pyx_freecount_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples = 0;
  29158. static PyObject *__pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  29159. PyObject *o;
  29160. if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples)))) {
  29161. o = (PyObject*)__pyx_freelist_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples[--__pyx_freecount_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples];
  29162. memset(o, 0, sizeof(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples));
  29163. (void) PyObject_INIT(o, t);
  29164. PyObject_GC_Track(o);
  29165. } else {
  29166. o = (*t->tp_alloc)(t, 0);
  29167. if (unlikely(!o)) return 0;
  29168. }
  29169. return o;
  29170. }
  29171. static void __pyx_tp_dealloc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples(PyObject *o) {
  29172. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples *p = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples *)o;
  29173. PyObject_GC_UnTrack(o);
  29174. Py_CLEAR(p->__pyx_v_c_uri);
  29175. Py_CLEAR(p->__pyx_v_context);
  29176. Py_CLEAR(p->__pyx_v_contexts);
  29177. Py_CLEAR(p->__pyx_v_rset);
  29178. Py_CLEAR(p->__pyx_v_self);
  29179. Py_CLEAR(p->__pyx_v_triple_pattern);
  29180. if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples)))) {
  29181. __pyx_freelist_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples[__pyx_freecount_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples++] = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples *)o);
  29182. } else {
  29183. (*Py_TYPE(o)->tp_free)(o);
  29184. }
  29185. }
  29186. static int __pyx_tp_traverse_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples(PyObject *o, visitproc v, void *a) {
  29187. int e;
  29188. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples *p = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples *)o;
  29189. if (p->__pyx_v_c_uri) {
  29190. e = (*v)(p->__pyx_v_c_uri, a); if (e) return e;
  29191. }
  29192. if (p->__pyx_v_context) {
  29193. e = (*v)(p->__pyx_v_context, a); if (e) return e;
  29194. }
  29195. if (p->__pyx_v_contexts) {
  29196. e = (*v)(p->__pyx_v_contexts, a); if (e) return e;
  29197. }
  29198. if (p->__pyx_v_rset) {
  29199. e = (*v)(((PyObject *)p->__pyx_v_rset), a); if (e) return e;
  29200. }
  29201. if (p->__pyx_v_self) {
  29202. e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  29203. }
  29204. if (p->__pyx_v_triple_pattern) {
  29205. e = (*v)(p->__pyx_v_triple_pattern, a); if (e) return e;
  29206. }
  29207. return 0;
  29208. }
  29209. static PyTypeObject __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples = {
  29210. PyVarObject_HEAD_INIT(0, 0)
  29211. "lakesuperior.store.ldp_rs.lmdb_triplestore.__pyx_scope_struct_3_triples", /*tp_name*/
  29212. sizeof(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples), /*tp_basicsize*/
  29213. 0, /*tp_itemsize*/
  29214. __pyx_tp_dealloc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples, /*tp_dealloc*/
  29215. 0, /*tp_print*/
  29216. 0, /*tp_getattr*/
  29217. 0, /*tp_setattr*/
  29218. #if PY_MAJOR_VERSION < 3
  29219. 0, /*tp_compare*/
  29220. #endif
  29221. #if PY_MAJOR_VERSION >= 3
  29222. 0, /*tp_as_async*/
  29223. #endif
  29224. 0, /*tp_repr*/
  29225. 0, /*tp_as_number*/
  29226. 0, /*tp_as_sequence*/
  29227. 0, /*tp_as_mapping*/
  29228. 0, /*tp_hash*/
  29229. 0, /*tp_call*/
  29230. 0, /*tp_str*/
  29231. 0, /*tp_getattro*/
  29232. 0, /*tp_setattro*/
  29233. 0, /*tp_as_buffer*/
  29234. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  29235. 0, /*tp_doc*/
  29236. __pyx_tp_traverse_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples, /*tp_traverse*/
  29237. 0, /*tp_clear*/
  29238. 0, /*tp_richcompare*/
  29239. 0, /*tp_weaklistoffset*/
  29240. 0, /*tp_iter*/
  29241. 0, /*tp_iternext*/
  29242. 0, /*tp_methods*/
  29243. 0, /*tp_members*/
  29244. 0, /*tp_getset*/
  29245. 0, /*tp_base*/
  29246. 0, /*tp_dict*/
  29247. 0, /*tp_descr_get*/
  29248. 0, /*tp_descr_set*/
  29249. 0, /*tp_dictoffset*/
  29250. 0, /*tp_init*/
  29251. 0, /*tp_alloc*/
  29252. __pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples, /*tp_new*/
  29253. 0, /*tp_free*/
  29254. 0, /*tp_is_gc*/
  29255. 0, /*tp_bases*/
  29256. 0, /*tp_mro*/
  29257. 0, /*tp_cache*/
  29258. 0, /*tp_subclasses*/
  29259. 0, /*tp_weaklist*/
  29260. 0, /*tp_del*/
  29261. 0, /*tp_version_tag*/
  29262. #if PY_VERSION_HEX >= 0x030400a1
  29263. 0, /*tp_finalize*/
  29264. #endif
  29265. };
  29266. static struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms *__pyx_freelist_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms[8];
  29267. static int __pyx_freecount_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms = 0;
  29268. static PyObject *__pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  29269. PyObject *o;
  29270. if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms)))) {
  29271. o = (PyObject*)__pyx_freelist_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms[--__pyx_freecount_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms];
  29272. memset(o, 0, sizeof(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms));
  29273. (void) PyObject_INIT(o, t);
  29274. PyObject_GC_Track(o);
  29275. } else {
  29276. o = (*t->tp_alloc)(t, 0);
  29277. if (unlikely(!o)) return 0;
  29278. }
  29279. return o;
  29280. }
  29281. static void __pyx_tp_dealloc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms(PyObject *o) {
  29282. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms *p = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms *)o;
  29283. PyObject_GC_UnTrack(o);
  29284. Py_CLEAR(p->__pyx_v_key);
  29285. Py_CLEAR(p->__pyx_v_self);
  29286. Py_CLEAR(p->__pyx_v_term_type);
  29287. Py_CLEAR(p->__pyx_t_0);
  29288. if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms)))) {
  29289. __pyx_freelist_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms[__pyx_freecount_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms++] = ((struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms *)o);
  29290. } else {
  29291. (*Py_TYPE(o)->tp_free)(o);
  29292. }
  29293. }
  29294. static int __pyx_tp_traverse_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms(PyObject *o, visitproc v, void *a) {
  29295. int e;
  29296. struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms *p = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms *)o;
  29297. if (p->__pyx_v_key) {
  29298. e = (*v)(p->__pyx_v_key, a); if (e) return e;
  29299. }
  29300. if (p->__pyx_v_self) {
  29301. e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  29302. }
  29303. if (p->__pyx_v_term_type) {
  29304. e = (*v)(p->__pyx_v_term_type, a); if (e) return e;
  29305. }
  29306. if (p->__pyx_t_0) {
  29307. e = (*v)(p->__pyx_t_0, a); if (e) return e;
  29308. }
  29309. return 0;
  29310. }
  29311. static PyTypeObject __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms = {
  29312. PyVarObject_HEAD_INIT(0, 0)
  29313. "lakesuperior.store.ldp_rs.lmdb_triplestore.__pyx_scope_struct_4_all_terms", /*tp_name*/
  29314. sizeof(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms), /*tp_basicsize*/
  29315. 0, /*tp_itemsize*/
  29316. __pyx_tp_dealloc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms, /*tp_dealloc*/
  29317. 0, /*tp_print*/
  29318. 0, /*tp_getattr*/
  29319. 0, /*tp_setattr*/
  29320. #if PY_MAJOR_VERSION < 3
  29321. 0, /*tp_compare*/
  29322. #endif
  29323. #if PY_MAJOR_VERSION >= 3
  29324. 0, /*tp_as_async*/
  29325. #endif
  29326. 0, /*tp_repr*/
  29327. 0, /*tp_as_number*/
  29328. 0, /*tp_as_sequence*/
  29329. 0, /*tp_as_mapping*/
  29330. 0, /*tp_hash*/
  29331. 0, /*tp_call*/
  29332. 0, /*tp_str*/
  29333. 0, /*tp_getattro*/
  29334. 0, /*tp_setattro*/
  29335. 0, /*tp_as_buffer*/
  29336. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  29337. 0, /*tp_doc*/
  29338. __pyx_tp_traverse_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms, /*tp_traverse*/
  29339. 0, /*tp_clear*/
  29340. 0, /*tp_richcompare*/
  29341. 0, /*tp_weaklistoffset*/
  29342. 0, /*tp_iter*/
  29343. 0, /*tp_iternext*/
  29344. 0, /*tp_methods*/
  29345. 0, /*tp_members*/
  29346. 0, /*tp_getset*/
  29347. 0, /*tp_base*/
  29348. 0, /*tp_dict*/
  29349. 0, /*tp_descr_get*/
  29350. 0, /*tp_descr_set*/
  29351. 0, /*tp_dictoffset*/
  29352. 0, /*tp_init*/
  29353. 0, /*tp_alloc*/
  29354. __pyx_tp_new_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms, /*tp_new*/
  29355. 0, /*tp_free*/
  29356. 0, /*tp_is_gc*/
  29357. 0, /*tp_bases*/
  29358. 0, /*tp_mro*/
  29359. 0, /*tp_cache*/
  29360. 0, /*tp_subclasses*/
  29361. 0, /*tp_weaklist*/
  29362. 0, /*tp_del*/
  29363. 0, /*tp_version_tag*/
  29364. #if PY_VERSION_HEX >= 0x030400a1
  29365. 0, /*tp_finalize*/
  29366. #endif
  29367. };
  29368. static PyMethodDef __pyx_methods[] = {
  29369. {0, 0, 0, 0}
  29370. };
  29371. #if PY_MAJOR_VERSION >= 3
  29372. #if CYTHON_PEP489_MULTI_PHASE_INIT
  29373. static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
  29374. static int __pyx_pymod_exec_lmdb_triplestore(PyObject* module); /*proto*/
  29375. static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  29376. {Py_mod_create, (void*)__pyx_pymod_create},
  29377. {Py_mod_exec, (void*)__pyx_pymod_exec_lmdb_triplestore},
  29378. {0, NULL}
  29379. };
  29380. #endif
  29381. static struct PyModuleDef __pyx_moduledef = {
  29382. PyModuleDef_HEAD_INIT,
  29383. "lmdb_triplestore",
  29384. 0, /* m_doc */
  29385. #if CYTHON_PEP489_MULTI_PHASE_INIT
  29386. 0, /* m_size */
  29387. #else
  29388. -1, /* m_size */
  29389. #endif
  29390. __pyx_methods /* m_methods */,
  29391. #if CYTHON_PEP489_MULTI_PHASE_INIT
  29392. __pyx_moduledef_slots, /* m_slots */
  29393. #else
  29394. NULL, /* m_reload */
  29395. #endif
  29396. NULL, /* m_traverse */
  29397. NULL, /* m_clear */
  29398. NULL /* m_free */
  29399. };
  29400. #endif
  29401. static __Pyx_StringTabEntry __pyx_string_tab[] = {
  29402. {&__pyx_kp_u_2bound_lookup_for_term, __pyx_k_2bound_lookup_for_term, sizeof(__pyx_k_2bound_lookup_for_term), 0, 1, 0, 0},
  29403. {&__pyx_kp_u_Add, __pyx_k_Add, sizeof(__pyx_k_Add), 0, 1, 0, 0},
  29404. {&__pyx_kp_u_Adding_to_index, __pyx_k_Adding_to_index, sizeof(__pyx_k_Adding_to_index), 0, 1, 0, 0},
  29405. {&__pyx_kp_u_Allocated, __pyx_k_Allocated, sizeof(__pyx_k_Allocated), 0, 1, 0, 0},
  29406. {&__pyx_kp_u_BAD_DAY_Sequence_exhausted_No_mo, __pyx_k_BAD_DAY_Sequence_exhausted_No_mo, sizeof(__pyx_k_BAD_DAY_Sequence_exhausted_No_mo), 0, 1, 0, 0},
  29407. {&__pyx_n_s_DATASET_DEFAULT_GRAPH_ID, __pyx_k_DATASET_DEFAULT_GRAPH_ID, sizeof(__pyx_k_DATASET_DEFAULT_GRAPH_ID), 0, 0, 1, 1},
  29408. {&__pyx_kp_u_DBI, __pyx_k_DBI, sizeof(__pyx_k_DBI), 0, 1, 0, 0},
  29409. {&__pyx_kp_u_DB_label, __pyx_k_DB_label, sizeof(__pyx_k_DB_label), 0, 1, 0, 0},
  29410. {&__pyx_kp_u_Database_label, __pyx_k_Database_label, sizeof(__pyx_k_Database_label), 0, 1, 0, 0},
  29411. {&__pyx_kp_u_Double_key, __pyx_k_Double_key, sizeof(__pyx_k_Double_key), 0, 1, 0, 0},
  29412. {&__pyx_kp_u_Entries_for, __pyx_k_Entries_for, sizeof(__pyx_k_Entries_for), 0, 1, 0, 0},
  29413. {&__pyx_kp_u_Entries_in_c_spo, __pyx_k_Entries_in_c_spo, sizeof(__pyx_k_Entries_in_c_spo), 0, 1, 0, 0},
  29414. {&__pyx_kp_u_Error_gathering_DB_stats, __pyx_k_Error_gathering_DB_stats, sizeof(__pyx_k_Error_gathering_DB_stats), 0, 1, 0, 0},
  29415. {&__pyx_kp_u_Error_getting_data_for_key, __pyx_k_Error_getting_data_for_key, sizeof(__pyx_k_Error_getting_data_for_key), 0, 1, 0, 0},
  29416. {&__pyx_kp_u_Error_setting_key, __pyx_k_Error_setting_key, sizeof(__pyx_k_Error_setting_key), 0, 1, 0, 0},
  29417. {&__pyx_kp_u_Getting_all_DB_triples, __pyx_k_Getting_all_DB_triples, sizeof(__pyx_k_Getting_all_DB_triples), 0, 1, 0, 0},
  29418. {&__pyx_kp_u_Getting_triples_for, __pyx_k_Getting_triples_for, sizeof(__pyx_k_Getting_triples_for), 0, 1, 0, 0},
  29419. {&__pyx_kp_u_Got_data_in_2bound, __pyx_k_Got_data_in_2bound, sizeof(__pyx_k_Got_data_in_2bound), 0, 1, 0, 0},
  29420. {&__pyx_n_s_Graph, __pyx_k_Graph, sizeof(__pyx_k_Graph), 0, 0, 1, 1},
  29421. {&__pyx_kp_s_Incompatible_checksums_s_vs_0x8d, __pyx_k_Incompatible_checksums_s_vs_0x8d, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x8d), 0, 0, 1, 0},
  29422. {&__pyx_kp_s_Incompatible_checksums_s_vs_0xbf, __pyx_k_Incompatible_checksums_s_vs_0xbf, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xbf), 0, 0, 1, 0},
  29423. {&__pyx_kp_u_Index_operation_is_not_supported, __pyx_k_Index_operation_is_not_supported, sizeof(__pyx_k_Index_operation_is_not_supported), 0, 1, 0, 0},
  29424. {&__pyx_kp_u_Indices_and_not_found_in_LU_keys, __pyx_k_Indices_and_not_found_in_LU_keys, sizeof(__pyx_k_Indices_and_not_found_in_LU_keys), 0, 1, 0, 0},
  29425. {&__pyx_kp_u_Invalid_triple, __pyx_k_Invalid_triple, sizeof(__pyx_k_Invalid_triple), 0, 1, 0, 0},
  29426. {&__pyx_kp_u_Key, __pyx_k_Key, sizeof(__pyx_k_Key), 0, 1, 0, 0},
  29427. {&__pyx_n_s_KeyExistsError, __pyx_k_KeyExistsError, sizeof(__pyx_k_KeyExistsError), 0, 0, 1, 1},
  29428. {&__pyx_n_s_KeyNotFoundError, __pyx_k_KeyNotFoundError, sizeof(__pyx_k_KeyNotFoundError), 0, 0, 1, 1},
  29429. {&__pyx_kp_u_LUK_offsets, __pyx_k_LUK_offsets, sizeof(__pyx_k_LUK_offsets), 0, 1, 0, 0},
  29430. {&__pyx_n_s_LmdbError, __pyx_k_LmdbError, sizeof(__pyx_k_LmdbError), 0, 0, 1, 1},
  29431. {&__pyx_n_s_LmdbTriplestore_all_terms, __pyx_k_LmdbTriplestore_all_terms, sizeof(__pyx_k_LmdbTriplestore_all_terms), 0, 0, 1, 1},
  29432. {&__pyx_n_s_LmdbTriplestore_contexts, __pyx_k_LmdbTriplestore_contexts, sizeof(__pyx_k_LmdbTriplestore_contexts), 0, 0, 1, 1},
  29433. {&__pyx_n_s_LmdbTriplestore_triples, __pyx_k_LmdbTriplestore_triples, sizeof(__pyx_k_LmdbTriplestore_triples), 0, 0, 1, 1},
  29434. {&__pyx_kp_u_Looking_in_key, __pyx_k_Looking_in_key, sizeof(__pyx_k_Looking_in_key), 0, 1, 0, 0},
  29435. {&__pyx_kp_u_Looking_up_in_graph, __pyx_k_Looking_up_in_graph, sizeof(__pyx_k_Looking_up_in_graph), 0, 1, 0, 0},
  29436. {&__pyx_kp_u_Lookup_key, __pyx_k_Lookup_key, sizeof(__pyx_k_Lookup_key), 0, 1, 0, 0},
  29437. {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
  29438. {&__pyx_kp_u_More_than_one_value_found_for, __pyx_k_More_than_one_value_found_for, sizeof(__pyx_k_More_than_one_value_found_for), 0, 1, 0, 0},
  29439. {&__pyx_n_s_Node, __pyx_k_Node, sizeof(__pyx_k_Node), 0, 0, 1, 1},
  29440. {&__pyx_kp_u_Not_found_in_index, __pyx_k_Not_found_in_index, sizeof(__pyx_k_Not_found_in_index), 0, 1, 0, 0},
  29441. {&__pyx_kp_u_Page_size, __pyx_k_Page_size, sizeof(__pyx_k_Page_size), 0, 1, 0, 0},
  29442. {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
  29443. {&__pyx_n_s_RDFLIB_DEFAULT_GRAPH_URI, __pyx_k_RDFLIB_DEFAULT_GRAPH_URI, sizeof(__pyx_k_RDFLIB_DEFAULT_GRAPH_URI), 0, 0, 1, 1},
  29444. {&__pyx_kp_u_Remove, __pyx_k_Remove, sizeof(__pyx_k_Remove), 0, 1, 0, 0},
  29445. {&__pyx_kp_u_Removed, __pyx_k_Removed, sizeof(__pyx_k_Removed), 0, 1, 0, 0},
  29446. {&__pyx_kp_u_Removing, __pyx_k_Removing, sizeof(__pyx_k_Removing), 0, 1, 0, 0},
  29447. {&__pyx_kp_u_Removing_from_graph, __pyx_k_Removing_from_graph, sizeof(__pyx_k_Removing_from_graph), 0, 1, 0, 0},
  29448. {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
  29449. {&__pyx_n_s_Sequence, __pyx_k_Sequence, sizeof(__pyx_k_Sequence), 0, 0, 1, 1},
  29450. {&__pyx_kp_u_Store_not_specified_for_triple_l, __pyx_k_Store_not_specified_for_triple_l, sizeof(__pyx_k_Store_not_specified_for_triple_l), 0, 1, 0, 0},
  29451. {&__pyx_kp_u_Term_order, __pyx_k_Term_order, sizeof(__pyx_k_Term_order), 0, 1, 0, 0},
  29452. {&__pyx_kp_u_Triples_found, __pyx_k_Triples_found, sizeof(__pyx_k_Triples_found), 0, 1, 0, 0},
  29453. {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  29454. {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  29455. {&__pyx_kp_u_Wrong_slice_format, __pyx_k_Wrong_slice_format, sizeof(__pyx_k_Wrong_slice_format), 0, 1, 0, 0},
  29456. {&__pyx_kp_u__10, __pyx_k__10, sizeof(__pyx_k__10), 0, 1, 0, 0},
  29457. {&__pyx_kp_u__11, __pyx_k__11, sizeof(__pyx_k__11), 0, 1, 0, 0},
  29458. {&__pyx_kp_u__12, __pyx_k__12, sizeof(__pyx_k__12), 0, 1, 0, 0},
  29459. {&__pyx_kp_u__27, __pyx_k__27, sizeof(__pyx_k__27), 0, 1, 0, 0},
  29460. {&__pyx_kp_u__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 1, 0, 0},
  29461. {&__pyx_kp_u__9, __pyx_k__9, sizeof(__pyx_k__9), 0, 1, 0, 0},
  29462. {&__pyx_n_s_add, __pyx_k_add, sizeof(__pyx_k_add), 0, 0, 1, 1},
  29463. {&__pyx_n_s_add_graph, __pyx_k_add_graph, sizeof(__pyx_k_add_graph), 0, 0, 1, 1},
  29464. {&__pyx_n_s_add_graph_2, __pyx_k_add_graph_2, sizeof(__pyx_k_add_graph_2), 0, 0, 1, 1},
  29465. {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
  29466. {&__pyx_n_s_all_contexts, __pyx_k_all_contexts, sizeof(__pyx_k_all_contexts), 0, 0, 1, 1},
  29467. {&__pyx_n_s_all_namespaces, __pyx_k_all_namespaces, sizeof(__pyx_k_all_namespaces), 0, 0, 1, 1},
  29468. {&__pyx_n_s_all_term_keys, __pyx_k_all_term_keys, sizeof(__pyx_k_all_term_keys), 0, 0, 1, 1},
  29469. {&__pyx_n_s_all_terms, __pyx_k_all_terms, sizeof(__pyx_k_all_terms), 0, 0, 1, 1},
  29470. {&__pyx_n_s_and, __pyx_k_and, sizeof(__pyx_k_and), 0, 0, 1, 1},
  29471. {&__pyx_kp_u_and_term, __pyx_k_and_term, sizeof(__pyx_k_and_term), 0, 1, 0, 0},
  29472. {&__pyx_n_s_any, __pyx_k_any, sizeof(__pyx_k_any), 0, 0, 1, 1},
  29473. {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  29474. {&__pyx_n_s_as_rdflib, __pyx_k_as_rdflib, sizeof(__pyx_k_as_rdflib), 0, 0, 1, 1},
  29475. {&__pyx_kp_u_asm_rng, __pyx_k_asm_rng, sizeof(__pyx_k_asm_rng), 0, 1, 0, 0},
  29476. {&__pyx_kp_u_at_position, __pyx_k_at_position, sizeof(__pyx_k_at_position), 0, 1, 0, 0},
  29477. {&__pyx_kp_u_bytes, __pyx_k_bytes, sizeof(__pyx_k_bytes), 0, 1, 0, 0},
  29478. {&__pyx_kp_u_bytes_of_data, __pyx_k_bytes_of_data, sizeof(__pyx_k_bytes_of_data), 0, 1, 0, 0},
  29479. {&__pyx_kp_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 0},
  29480. {&__pyx_kp_u_c_spo, __pyx_k_c_spo, sizeof(__pyx_k_c_spo), 0, 1, 0, 0},
  29481. {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
  29482. {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  29483. {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  29484. {&__pyx_n_s_collections_abc, __pyx_k_collections_abc, sizeof(__pyx_k_collections_abc), 0, 0, 1, 1},
  29485. {&__pyx_n_s_context, __pyx_k_context, sizeof(__pyx_k_context), 0, 0, 1, 1},
  29486. {&__pyx_n_s_contexts, __pyx_k_contexts, sizeof(__pyx_k_contexts), 0, 0, 1, 1},
  29487. {&__pyx_n_s_ct, __pyx_k_ct, sizeof(__pyx_k_ct), 0, 0, 1, 1},
  29488. {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
  29489. {&__pyx_n_u_db_stats, __pyx_k_db_stats, sizeof(__pyx_k_db_stats), 0, 1, 0, 1},
  29490. {&__pyx_n_s_dbi_flags, __pyx_k_dbi_flags, sizeof(__pyx_k_dbi_flags), 0, 0, 1, 1},
  29491. {&__pyx_n_s_dbi_labels, __pyx_k_dbi_labels, sizeof(__pyx_k_dbi_labels), 0, 0, 1, 1},
  29492. {&__pyx_n_s_debug, __pyx_k_debug, sizeof(__pyx_k_debug), 0, 0, 1, 1},
  29493. {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
  29494. {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  29495. {&__pyx_n_s_eq, __pyx_k_eq, sizeof(__pyx_k_eq), 0, 0, 1, 1},
  29496. {&__pyx_kp_u_exists_already, __pyx_k_exists_already, sizeof(__pyx_k_exists_already), 0, 1, 0, 0},
  29497. {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
  29498. {&__pyx_n_s_fn, __pyx_k_fn, sizeof(__pyx_k_fn), 0, 0, 1, 1},
  29499. {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  29500. {&__pyx_kp_u_from_indices, __pyx_k_from_indices, sizeof(__pyx_k_from_indices), 0, 1, 0, 0},
  29501. {&__pyx_kp_u_from_main, __pyx_k_from_main, sizeof(__pyx_k_from_main), 0, 1, 0, 0},
  29502. {&__pyx_n_s_functools, __pyx_k_functools, sizeof(__pyx_k_functools), 0, 0, 1, 1},
  29503. {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
  29504. {&__pyx_n_s_getLogger, __pyx_k_getLogger, sizeof(__pyx_k_getLogger), 0, 0, 1, 1},
  29505. {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
  29506. {&__pyx_n_s_hashlib, __pyx_k_hashlib, sizeof(__pyx_k_hashlib), 0, 0, 1, 1},
  29507. {&__pyx_n_s_hex, __pyx_k_hex, sizeof(__pyx_k_hex), 0, 0, 1, 1},
  29508. {&__pyx_kp_u_i_in_0bound, __pyx_k_i_in_0bound, sizeof(__pyx_k_i_in_0bound), 0, 1, 0, 0},
  29509. {&__pyx_n_s_iand, __pyx_k_iand, sizeof(__pyx_k_iand), 0, 0, 1, 1},
  29510. {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
  29511. {&__pyx_n_s_identifier, __pyx_k_identifier, sizeof(__pyx_k_identifier), 0, 0, 1, 1},
  29512. {&__pyx_n_u_idx_add, __pyx_k_idx_add, sizeof(__pyx_k_idx_add), 0, 1, 0, 1},
  29513. {&__pyx_n_u_idx_remove, __pyx_k_idx_remove, sizeof(__pyx_k_idx_remove), 0, 1, 0, 1},
  29514. {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  29515. {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
  29516. {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  29517. {&__pyx_n_s_ior, __pyx_k_ior, sizeof(__pyx_k_ior), 0, 0, 1, 1},
  29518. {&__pyx_n_s_is_txn_rw, __pyx_k_is_txn_rw, sizeof(__pyx_k_is_txn_rw), 0, 0, 1, 1},
  29519. {&__pyx_n_s_isub, __pyx_k_isub, sizeof(__pyx_k_isub), 0, 0, 1, 1},
  29520. {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
  29521. {&__pyx_n_s_iter, __pyx_k_iter, sizeof(__pyx_k_iter), 0, 0, 1, 1},
  29522. {&__pyx_n_s_ixor, __pyx_k_ixor, sizeof(__pyx_k_ixor), 0, 0, 1, 1},
  29523. {&__pyx_n_s_lakesuperior_store_base_lmdb_sto, __pyx_k_lakesuperior_store_base_lmdb_sto, sizeof(__pyx_k_lakesuperior_store_base_lmdb_sto), 0, 0, 1, 1},
  29524. {&__pyx_n_s_lakesuperior_store_ldp_rs_lmdb_t, __pyx_k_lakesuperior_store_ldp_rs_lmdb_t, sizeof(__pyx_k_lakesuperior_store_ldp_rs_lmdb_t), 0, 0, 1, 1},
  29525. {&__pyx_kp_s_lakesuperior_store_ldp_rs_lmdb_t_2, __pyx_k_lakesuperior_store_ldp_rs_lmdb_t_2, sizeof(__pyx_k_lakesuperior_store_ldp_rs_lmdb_t_2), 0, 0, 1, 0},
  29526. {&__pyx_n_s_len, __pyx_k_len, sizeof(__pyx_k_len), 0, 0, 1, 1},
  29527. {&__pyx_kp_u_length, __pyx_k_length, sizeof(__pyx_k_length), 0, 1, 0, 0},
  29528. {&__pyx_kp_u_length_2, __pyx_k_length_2, sizeof(__pyx_k_length_2), 0, 1, 0, 0},
  29529. {&__pyx_n_s_logger, __pyx_k_logger, sizeof(__pyx_k_logger), 0, 0, 1, 1},
  29530. {&__pyx_n_s_logging, __pyx_k_logging, sizeof(__pyx_k_logging), 0, 0, 1, 1},
  29531. {&__pyx_n_s_lookup, __pyx_k_lookup, sizeof(__pyx_k_lookup), 0, 0, 1, 1},
  29532. {&__pyx_kp_u_lookup_1bound, __pyx_k_lookup_1bound, sizeof(__pyx_k_lookup_1bound), 0, 1, 0, 0},
  29533. {&__pyx_n_s_lookup_indices, __pyx_k_lookup_indices, sizeof(__pyx_k_lookup_indices), 0, 0, 1, 1},
  29534. {&__pyx_kp_u_luk, __pyx_k_luk, sizeof(__pyx_k_luk), 0, 1, 0, 0},
  29535. {&__pyx_kp_u_luk1, __pyx_k_luk1, sizeof(__pyx_k_luk1), 0, 1, 0, 0},
  29536. {&__pyx_kp_u_luk2, __pyx_k_luk2, sizeof(__pyx_k_luk2), 0, 1, 0, 0},
  29537. {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  29538. {&__pyx_n_u_map_size, __pyx_k_map_size, sizeof(__pyx_k_map_size), 0, 1, 0, 1},
  29539. {&__pyx_n_u_ms_entries, __pyx_k_ms_entries, sizeof(__pyx_k_ms_entries), 0, 1, 0, 1},
  29540. {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  29541. {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
  29542. {&__pyx_n_s_new_txn, __pyx_k_new_txn, sizeof(__pyx_k_new_txn), 0, 0, 1, 1},
  29543. {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
  29544. {&__pyx_n_s_normalize_context, __pyx_k_normalize_context, sizeof(__pyx_k_normalize_context), 0, 0, 1, 1},
  29545. {&__pyx_kp_u_ns_pfx, __pyx_k_ns_pfx, sizeof(__pyx_k_ns_pfx), 0, 1, 0, 0},
  29546. {&__pyx_n_u_num_triples, __pyx_k_num_triples, sizeof(__pyx_k_num_triples), 0, 1, 0, 1},
  29547. {&__pyx_n_s_o, __pyx_k_o, sizeof(__pyx_k_o), 0, 0, 1, 1},
  29548. {&__pyx_kp_b_o_sp, __pyx_k_o_sp, sizeof(__pyx_k_o_sp), 0, 0, 0, 0},
  29549. {&__pyx_kp_u_o_sp, __pyx_k_o_sp, sizeof(__pyx_k_o_sp), 0, 1, 0, 0},
  29550. {&__pyx_n_s_options, __pyx_k_options, sizeof(__pyx_k_options), 0, 0, 1, 1},
  29551. {&__pyx_n_s_or, __pyx_k_or, sizeof(__pyx_k_or), 0, 0, 1, 1},
  29552. {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1},
  29553. {&__pyx_n_s_other, __pyx_k_other, sizeof(__pyx_k_other), 0, 0, 1, 1},
  29554. {&__pyx_n_s_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 1, 1},
  29555. {&__pyx_kp_b_p_so, __pyx_k_p_so, sizeof(__pyx_k_p_so), 0, 0, 0, 0},
  29556. {&__pyx_kp_u_p_so, __pyx_k_p_so, sizeof(__pyx_k_p_so), 0, 1, 0, 0},
  29557. {&__pyx_kp_u_pfx_ns, __pyx_k_pfx_ns, sizeof(__pyx_k_pfx_ns), 0, 1, 0, 0},
  29558. {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
  29559. {&__pyx_n_s_pk_c, __pyx_k_pk_c, sizeof(__pyx_k_pk_c), 0, 0, 1, 1},
  29560. {&__pyx_n_s_pk_size, __pyx_k_pk_size, sizeof(__pyx_k_pk_size), 0, 0, 1, 1},
  29561. {&__pyx_kp_b_po_s, __pyx_k_po_s, sizeof(__pyx_k_po_s), 0, 0, 0, 0},
  29562. {&__pyx_kp_u_po_s, __pyx_k_po_s, sizeof(__pyx_k_po_s), 0, 1, 0, 0},
  29563. {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
  29564. {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
  29565. {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
  29566. {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
  29567. {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
  29568. {&__pyx_n_s_pyx_unpickle_Imr, __pyx_k_pyx_unpickle_Imr, sizeof(__pyx_k_pyx_unpickle_Imr), 0, 0, 1, 1},
  29569. {&__pyx_n_s_pyx_unpickle_SimpleGraph, __pyx_k_pyx_unpickle_SimpleGraph, sizeof(__pyx_k_pyx_unpickle_SimpleGraph), 0, 0, 1, 1},
  29570. {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  29571. {&__pyx_n_s_quoted, __pyx_k_quoted, sizeof(__pyx_k_quoted), 0, 0, 1, 1},
  29572. {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  29573. {&__pyx_n_s_rdflib, __pyx_k_rdflib, sizeof(__pyx_k_rdflib), 0, 0, 1, 1},
  29574. {&__pyx_n_s_rdflib_graph, __pyx_k_rdflib_graph, sizeof(__pyx_k_rdflib_graph), 0, 0, 1, 1},
  29575. {&__pyx_n_s_rdflib_term, __pyx_k_rdflib_term, sizeof(__pyx_k_rdflib_term), 0, 0, 1, 1},
  29576. {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
  29577. {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
  29578. {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
  29579. {&__pyx_n_s_remove, __pyx_k_remove, sizeof(__pyx_k_remove), 0, 0, 1, 1},
  29580. {&__pyx_n_s_remove_graph, __pyx_k_remove_graph, sizeof(__pyx_k_remove_graph), 0, 0, 1, 1},
  29581. {&__pyx_n_s_remove_triples, __pyx_k_remove_triples, sizeof(__pyx_k_remove_triples), 0, 0, 1, 1},
  29582. {&__pyx_n_s_resource, __pyx_k_resource, sizeof(__pyx_k_resource), 0, 0, 1, 1},
  29583. {&__pyx_kp_u_ret_offset, __pyx_k_ret_offset, sizeof(__pyx_k_ret_offset), 0, 1, 0, 0},
  29584. {&__pyx_n_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 1},
  29585. {&__pyx_kp_b_s_po, __pyx_k_s_po, sizeof(__pyx_k_s_po), 0, 0, 0, 0},
  29586. {&__pyx_kp_u_s_po, __pyx_k_s_po, sizeof(__pyx_k_s_po), 0, 1, 0, 0},
  29587. {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  29588. {&__pyx_kp_s_self_curs_self_dbenv_self_dbis_s, __pyx_k_self_curs_self_dbenv_self_dbis_s, sizeof(__pyx_k_self_curs_self_dbenv_self_dbis_s), 0, 0, 1, 0},
  29589. {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
  29590. {&__pyx_n_s_set, __pyx_k_set, sizeof(__pyx_k_set), 0, 0, 1, 1},
  29591. {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
  29592. {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
  29593. {&__pyx_kp_b_so_p, __pyx_k_so_p, sizeof(__pyx_k_so_p), 0, 0, 0, 0},
  29594. {&__pyx_kp_u_so_p, __pyx_k_so_p, sizeof(__pyx_k_so_p), 0, 1, 0, 0},
  29595. {&__pyx_kp_b_sp_o, __pyx_k_sp_o, sizeof(__pyx_k_sp_o), 0, 0, 0, 0},
  29596. {&__pyx_kp_u_sp_o, __pyx_k_sp_o, sizeof(__pyx_k_sp_o), 0, 1, 0, 0},
  29597. {&__pyx_n_u_spo, __pyx_k_spo, sizeof(__pyx_k_spo), 0, 1, 0, 1},
  29598. {&__pyx_kp_u_spo_c, __pyx_k_spo_c, sizeof(__pyx_k_spo_c), 0, 1, 0, 0},
  29599. {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
  29600. {&__pyx_n_s_stats, __pyx_k_stats, sizeof(__pyx_k_stats), 0, 0, 1, 1},
  29601. {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
  29602. {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
  29603. {&__pyx_n_s_store, __pyx_k_store, sizeof(__pyx_k_store), 0, 0, 1, 1},
  29604. {&__pyx_n_s_strict, __pyx_k_strict, sizeof(__pyx_k_strict), 0, 0, 1, 1},
  29605. {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
  29606. {&__pyx_n_s_sub, __pyx_k_sub, sizeof(__pyx_k_sub), 0, 0, 1, 1},
  29607. {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1},
  29608. {&__pyx_kp_u_t_st, __pyx_k_t_st, sizeof(__pyx_k_t_st), 0, 1, 0, 0},
  29609. {&__pyx_kp_u_term_order, __pyx_k_term_order, sizeof(__pyx_k_term_order), 0, 1, 0, 0},
  29610. {&__pyx_n_s_terms, __pyx_k_terms, sizeof(__pyx_k_terms), 0, 0, 1, 1},
  29611. {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  29612. {&__pyx_kp_u_th_t, __pyx_k_th_t, sizeof(__pyx_k_th_t), 0, 1, 0, 0},
  29613. {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
  29614. {&__pyx_kp_u_to_indices, __pyx_k_to_indices, sizeof(__pyx_k_to_indices), 0, 1, 0, 0},
  29615. {&__pyx_n_s_to_tuple, __pyx_k_to_tuple, sizeof(__pyx_k_to_tuple), 0, 0, 1, 1},
  29616. {&__pyx_n_s_to_tuple_locals_genexpr, __pyx_k_to_tuple_locals_genexpr, sizeof(__pyx_k_to_tuple_locals_genexpr), 0, 0, 1, 1},
  29617. {&__pyx_n_s_triple, __pyx_k_triple, sizeof(__pyx_k_triple), 0, 0, 1, 1},
  29618. {&__pyx_n_s_triple_keys, __pyx_k_triple_keys, sizeof(__pyx_k_triple_keys), 0, 0, 1, 1},
  29619. {&__pyx_n_s_triple_pattern, __pyx_k_triple_pattern, sizeof(__pyx_k_triple_pattern), 0, 0, 1, 1},
  29620. {&__pyx_n_s_triples, __pyx_k_triples, sizeof(__pyx_k_triples), 0, 0, 1, 1},
  29621. {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
  29622. {&__pyx_n_s_uri, __pyx_k_uri, sizeof(__pyx_k_uri), 0, 0, 1, 1},
  29623. {&__pyx_kp_u_uri_2, __pyx_k_uri_2, sizeof(__pyx_k_uri_2), 0, 1, 0, 0},
  29624. {&__pyx_n_s_use_data, __pyx_k_use_data, sizeof(__pyx_k_use_data), 0, 0, 1, 1},
  29625. {&__pyx_n_s_use_data_locals__wrapper, __pyx_k_use_data_locals__wrapper, sizeof(__pyx_k_use_data_locals__wrapper), 0, 0, 1, 1},
  29626. {&__pyx_n_s_wrapper, __pyx_k_wrapper, sizeof(__pyx_k_wrapper), 0, 0, 1, 1},
  29627. {&__pyx_n_s_wraps, __pyx_k_wraps, sizeof(__pyx_k_wraps), 0, 0, 1, 1},
  29628. {&__pyx_n_s_xor, __pyx_k_xor, sizeof(__pyx_k_xor), 0, 0, 1, 1},
  29629. {0, 0, 0, 0, 0, 0, 0}
  29630. };
  29631. static int __Pyx_InitCachedBuiltins(void) {
  29632. __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 173, __pyx_L1_error)
  29633. __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 212, __pyx_L1_error)
  29634. __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
  29635. __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 272, __pyx_L1_error)
  29636. __pyx_builtin_hex = __Pyx_GetBuiltinName(__pyx_n_s_hex); if (!__pyx_builtin_hex) __PYX_ERR(0, 305, __pyx_L1_error)
  29637. __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(0, 305, __pyx_L1_error)
  29638. __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 489, __pyx_L1_error)
  29639. __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 562, __pyx_L1_error)
  29640. __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 730, __pyx_L1_error)
  29641. __pyx_builtin_all = __Pyx_GetBuiltinName(__pyx_n_s_all); if (!__pyx_builtin_all) __PYX_ERR(0, 1267, __pyx_L1_error)
  29642. __pyx_builtin_any = __Pyx_GetBuiltinName(__pyx_n_s_any); if (!__pyx_builtin_any) __PYX_ERR(0, 1298, __pyx_L1_error)
  29643. return 0;
  29644. __pyx_L1_error:;
  29645. return -1;
  29646. }
  29647. static int __Pyx_InitCachedConstants(void) {
  29648. __Pyx_RefNannyDeclarations
  29649. __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
  29650. /* "(tree fragment)":2
  29651. * def __reduce_cython__(self):
  29652. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  29653. * def __setstate_cython__(self, __pyx_state):
  29654. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  29655. */
  29656. __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 2, __pyx_L1_error)
  29657. __Pyx_GOTREF(__pyx_tuple_);
  29658. __Pyx_GIVEREF(__pyx_tuple_);
  29659. /* "(tree fragment)":4
  29660. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  29661. * def __setstate_cython__(self, __pyx_state):
  29662. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  29663. */
  29664. __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 4, __pyx_L1_error)
  29665. __Pyx_GOTREF(__pyx_tuple__2);
  29666. __Pyx_GIVEREF(__pyx_tuple__2);
  29667. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":231
  29668. * def use_data(fn):
  29669. * @wraps(fn)
  29670. * def _wrapper(self, other): # <<<<<<<<<<<<<<
  29671. * if isinstance(other, SimpleGraph):
  29672. * other = other.data
  29673. */
  29674. __pyx_tuple__4 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 231, __pyx_L1_error)
  29675. __Pyx_GOTREF(__pyx_tuple__4);
  29676. __Pyx_GIVEREF(__pyx_tuple__4);
  29677. __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lakesuperior_store_ldp_rs_lmdb_t_2, __pyx_n_s_wrapper, 231, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 231, __pyx_L1_error)
  29678. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":272
  29679. * else:
  29680. * if store is None:
  29681. * raise ValueError('Store not specified for triple lookup.') # <<<<<<<<<<<<<<
  29682. * self._data_from_lookup(lookup, store)
  29683. *
  29684. */
  29685. __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Store_not_specified_for_triple_l); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 272, __pyx_L1_error)
  29686. __Pyx_GOTREF(__pyx_tuple__7);
  29687. __Pyx_GIVEREF(__pyx_tuple__7);
  29688. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1131
  29689. *
  29690. * # Remove all triples and indices associated with the graph.
  29691. * self._remove((None, None, None), gr_uri) # <<<<<<<<<<<<<<
  29692. * # Remove the graph if it is in triples.
  29693. * self._remove((gr_uri, None, None))
  29694. */
  29695. __pyx_tuple__13 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 1131, __pyx_L1_error)
  29696. __Pyx_GOTREF(__pyx_tuple__13);
  29697. __Pyx_GIVEREF(__pyx_tuple__13);
  29698. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1258
  29699. * except KeyNotFoundError:
  29700. * # Context not found.
  29701. * return ResultSet(0, TRP_KLEN) # <<<<<<<<<<<<<<
  29702. *
  29703. * icur = self._cur_open('c:spo')
  29704. */
  29705. __pyx_tuple__14 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_15); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 1258, __pyx_L1_error)
  29706. __Pyx_GOTREF(__pyx_tuple__14);
  29707. __Pyx_GIVEREF(__pyx_tuple__14);
  29708. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1274
  29709. * except KeyNotFoundError:
  29710. * # Context not found.
  29711. * return ResultSet(0, TRP_KLEN) # <<<<<<<<<<<<<<
  29712. * memcpy(spok + (KLEN * i), tk, KLEN)
  29713. * if tk is NULL:
  29714. */
  29715. __pyx_tuple__15 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_15); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 1274, __pyx_L1_error)
  29716. __Pyx_GOTREF(__pyx_tuple__15);
  29717. __Pyx_GIVEREF(__pyx_tuple__15);
  29718. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1278
  29719. * if tk is NULL:
  29720. * # A term in the triple is not found.
  29721. * return ResultSet(0, TRP_KLEN) # <<<<<<<<<<<<<<
  29722. * data_v.mv_data = spok
  29723. * data_v.mv_size = TRP_KLEN
  29724. */
  29725. __pyx_tuple__16 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_15); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 1278, __pyx_L1_error)
  29726. __Pyx_GOTREF(__pyx_tuple__16);
  29727. __Pyx_GIVEREF(__pyx_tuple__16);
  29728. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1291
  29729. * # Triple not found.
  29730. * #logger.debug('spok / ck pair not found.')
  29731. * return ResultSet(0, TRP_KLEN) # <<<<<<<<<<<<<<
  29732. * ret = ResultSet(1, TRP_KLEN)
  29733. * memcpy(ret.data, spok, TRP_KLEN)
  29734. */
  29735. __pyx_tuple__17 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_15); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 1291, __pyx_L1_error)
  29736. __Pyx_GOTREF(__pyx_tuple__17);
  29737. __Pyx_GIVEREF(__pyx_tuple__17);
  29738. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1292
  29739. * #logger.debug('spok / ck pair not found.')
  29740. * return ResultSet(0, TRP_KLEN)
  29741. * ret = ResultSet(1, TRP_KLEN) # <<<<<<<<<<<<<<
  29742. * memcpy(ret.data, spok, TRP_KLEN)
  29743. *
  29744. */
  29745. __pyx_tuple__18 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_15); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 1292, __pyx_L1_error)
  29746. __Pyx_GOTREF(__pyx_tuple__18);
  29747. __Pyx_GIVEREF(__pyx_tuple__18);
  29748. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1306
  29749. * except KeyNotFoundError:
  29750. * # Triple not found.
  29751. * return ResultSet(0, TRP_KLEN) # <<<<<<<<<<<<<<
  29752. *
  29753. * _check(lmdb.mdb_cursor_count(icur, &ct))
  29754. */
  29755. __pyx_tuple__19 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_15); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 1306, __pyx_L1_error)
  29756. __Pyx_GOTREF(__pyx_tuple__19);
  29757. __Pyx_GIVEREF(__pyx_tuple__19);
  29758. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1335
  29759. * res = self._lookup(triple_pattern)
  29760. * except KeyNotFoundError:
  29761. * return ResultSet(0, TRP_KLEN) # <<<<<<<<<<<<<<
  29762. *
  29763. * #logger.debug('Allocating for context filtering.')
  29764. */
  29765. __pyx_tuple__20 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_15); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 1335, __pyx_L1_error)
  29766. __Pyx_GOTREF(__pyx_tuple__20);
  29767. __Pyx_GIVEREF(__pyx_tuple__20);
  29768. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1381
  29769. * res = self._lookup(triple_pattern)
  29770. * except KeyNotFoundError:
  29771. * return ResultSet(0, TRP_KLEN) # <<<<<<<<<<<<<<
  29772. * #logger.debug('Res data before triple_keys return: {}'.format(
  29773. * # res.data[: res.size]))
  29774. */
  29775. __pyx_tuple__21 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_15); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 1381, __pyx_L1_error)
  29776. __Pyx_GOTREF(__pyx_tuple__21);
  29777. __Pyx_GIVEREF(__pyx_tuple__21);
  29778. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1413
  29779. * self.txn, self.get_dbi('spo:c'), &spok_v, &ck_v))
  29780. * except KeyNotFoundError:
  29781. * return ResultSet(0, TRP_KLEN) # <<<<<<<<<<<<<<
  29782. *
  29783. * matches = ResultSet(1, TRP_KLEN)
  29784. */
  29785. __pyx_tuple__22 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_15); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 1413, __pyx_L1_error)
  29786. __Pyx_GOTREF(__pyx_tuple__22);
  29787. __Pyx_GIVEREF(__pyx_tuple__22);
  29788. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1415
  29789. * return ResultSet(0, TRP_KLEN)
  29790. *
  29791. * matches = ResultSet(1, TRP_KLEN) # <<<<<<<<<<<<<<
  29792. * memcpy(matches.data, spok, TRP_KLEN)
  29793. * return matches
  29794. */
  29795. __pyx_tuple__23 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_15); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 1415, __pyx_L1_error)
  29796. __Pyx_GOTREF(__pyx_tuple__23);
  29797. __Pyx_GIVEREF(__pyx_tuple__23);
  29798. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1443
  29799. * else:
  29800. * # Get all triples in the database.
  29801. * logger.debug('Getting all DB triples.') # <<<<<<<<<<<<<<
  29802. * dcur = self._cur_open('spo:c')
  29803. *
  29804. */
  29805. __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_u_Getting_all_DB_triples); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 1443, __pyx_L1_error)
  29806. __Pyx_GOTREF(__pyx_tuple__24);
  29807. __Pyx_GIVEREF(__pyx_tuple__24);
  29808. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1454
  29809. * logger.debug(f'Triples found: {ct}')
  29810. * if ct == 0:
  29811. * return ResultSet(0, TRP_KLEN) # <<<<<<<<<<<<<<
  29812. *
  29813. * _check(lmdb.mdb_cursor_get(
  29814. */
  29815. __pyx_tuple__25 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_15); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 1454, __pyx_L1_error)
  29816. __Pyx_GOTREF(__pyx_tuple__25);
  29817. __Pyx_GIVEREF(__pyx_tuple__25);
  29818. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1504
  29819. * self._to_key(term, &luk)
  29820. * except KeyNotFoundError:
  29821. * return ResultSet(0, TRP_KLEN) # <<<<<<<<<<<<<<
  29822. * logging.debug('luk: {}'.format(luk))
  29823. *
  29824. */
  29825. __pyx_tuple__26 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_15); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 1504, __pyx_L1_error)
  29826. __Pyx_GOTREF(__pyx_tuple__26);
  29827. __Pyx_GIVEREF(__pyx_tuple__26);
  29828. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1609
  29829. * self._to_key(term2, &luk2)
  29830. * except KeyNotFoundError:
  29831. * return ResultSet(0, TRP_KLEN) # <<<<<<<<<<<<<<
  29832. * logging.debug('luk1: {}'.format(luk1[: KLEN]))
  29833. * logging.debug('luk2: {}'.format(luk2[: KLEN]))
  29834. */
  29835. __pyx_tuple__28 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_15); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 1609, __pyx_L1_error)
  29836. __Pyx_GOTREF(__pyx_tuple__28);
  29837. __Pyx_GIVEREF(__pyx_tuple__28);
  29838. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1723
  29839. * icur, &key_v, NULL, lmdb.MDB_FIRST))
  29840. * except KeyNotFoundError:
  29841. * return ResultSet(0, DBL_KLEN) # <<<<<<<<<<<<<<
  29842. *
  29843. * while True:
  29844. */
  29845. __pyx_tuple__29 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_10); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 1723, __pyx_L1_error)
  29846. __Pyx_GOTREF(__pyx_tuple__29);
  29847. __Pyx_GIVEREF(__pyx_tuple__29);
  29848. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":2014
  29849. * # at 255, the sequence is exhausted.
  29850. * if i == 0:
  29851. * raise RuntimeError( # <<<<<<<<<<<<<<
  29852. * 'BAD DAY: Sequence exhausted. No more '
  29853. * 'combinations are possible.')
  29854. */
  29855. __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_u_BAD_DAY_Sequence_exhausted_No_mo); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 2014, __pyx_L1_error)
  29856. __Pyx_GOTREF(__pyx_tuple__31);
  29857. __Pyx_GIVEREF(__pyx_tuple__31);
  29858. /* "(tree fragment)":2
  29859. * def __reduce_cython__(self):
  29860. * raise TypeError("self.curs,self.dbenv,self.dbis,self.txn cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<<
  29861. * def __setstate_cython__(self, __pyx_state):
  29862. * raise TypeError("self.curs,self.dbenv,self.dbis,self.txn cannot be converted to a Python object for pickling")
  29863. */
  29864. __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_self_curs_self_dbenv_self_dbis_s); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(1, 2, __pyx_L1_error)
  29865. __Pyx_GOTREF(__pyx_tuple__32);
  29866. __Pyx_GIVEREF(__pyx_tuple__32);
  29867. /* "(tree fragment)":4
  29868. * raise TypeError("self.curs,self.dbenv,self.dbis,self.txn cannot be converted to a Python object for pickling")
  29869. * def __setstate_cython__(self, __pyx_state):
  29870. * raise TypeError("self.curs,self.dbenv,self.dbis,self.txn cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<<
  29871. */
  29872. __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_self_curs_self_dbenv_self_dbis_s); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(1, 4, __pyx_L1_error)
  29873. __Pyx_GOTREF(__pyx_tuple__33);
  29874. __Pyx_GIVEREF(__pyx_tuple__33);
  29875. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":229
  29876. *
  29877. *
  29878. * def use_data(fn): # <<<<<<<<<<<<<<
  29879. * @wraps(fn)
  29880. * def _wrapper(self, other):
  29881. */
  29882. __pyx_tuple__36 = PyTuple_Pack(3, __pyx_n_s_fn, __pyx_n_s_wrapper, __pyx_n_s_wrapper); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 229, __pyx_L1_error)
  29883. __Pyx_GOTREF(__pyx_tuple__36);
  29884. __Pyx_GIVEREF(__pyx_tuple__36);
  29885. __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lakesuperior_store_ldp_rs_lmdb_t_2, __pyx_n_s_use_data, 229, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 229, __pyx_L1_error)
  29886. /* "(tree fragment)":1
  29887. * def __pyx_unpickle_SimpleGraph(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
  29888. * if __pyx_checksum != 0x8d777f3:
  29889. * from pickle import PickleError as __pyx_PickleError
  29890. */
  29891. __pyx_tuple__37 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(1, 1, __pyx_L1_error)
  29892. __Pyx_GOTREF(__pyx_tuple__37);
  29893. __Pyx_GIVEREF(__pyx_tuple__37);
  29894. __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_SimpleGraph, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(1, 1, __pyx_L1_error)
  29895. __pyx_tuple__38 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(1, 1, __pyx_L1_error)
  29896. __Pyx_GOTREF(__pyx_tuple__38);
  29897. __Pyx_GIVEREF(__pyx_tuple__38);
  29898. __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Imr, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(1, 1, __pyx_L1_error)
  29899. __Pyx_RefNannyFinishContext();
  29900. return 0;
  29901. __pyx_L1_error:;
  29902. __Pyx_RefNannyFinishContext();
  29903. return -1;
  29904. }
  29905. static int __Pyx_InitGlobals(void) {
  29906. /* InitThreads.init */
  29907. #ifdef WITH_THREAD
  29908. PyEval_InitThreads();
  29909. #endif
  29910. if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
  29911. if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  29912. __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  29913. __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  29914. __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error)
  29915. __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) __PYX_ERR(0, 1, __pyx_L1_error)
  29916. __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) __PYX_ERR(0, 1, __pyx_L1_error)
  29917. __pyx_int_148338675 = PyInt_FromLong(148338675L); if (unlikely(!__pyx_int_148338675)) __PYX_ERR(0, 1, __pyx_L1_error)
  29918. __pyx_int_200819009 = PyInt_FromLong(200819009L); if (unlikely(!__pyx_int_200819009)) __PYX_ERR(0, 1, __pyx_L1_error)
  29919. __pyx_int_1099511627776 = PyInt_FromString((char *)"1099511627776", 0, 0); if (unlikely(!__pyx_int_1099511627776)) __PYX_ERR(0, 1, __pyx_L1_error)
  29920. return 0;
  29921. __pyx_L1_error:;
  29922. return -1;
  29923. }
  29924. static int __Pyx_modinit_global_init_code(void); /*proto*/
  29925. static int __Pyx_modinit_variable_export_code(void); /*proto*/
  29926. static int __Pyx_modinit_function_export_code(void); /*proto*/
  29927. static int __Pyx_modinit_type_init_code(void); /*proto*/
  29928. static int __Pyx_modinit_type_import_code(void); /*proto*/
  29929. static int __Pyx_modinit_variable_import_code(void); /*proto*/
  29930. static int __Pyx_modinit_function_import_code(void); /*proto*/
  29931. static int __Pyx_modinit_global_init_code(void) {
  29932. __Pyx_RefNannyDeclarations
  29933. __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  29934. /*--- Global init code ---*/
  29935. __Pyx_RefNannyFinishContext();
  29936. return 0;
  29937. }
  29938. static int __Pyx_modinit_variable_export_code(void) {
  29939. __Pyx_RefNannyDeclarations
  29940. __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  29941. /*--- Variable export code ---*/
  29942. __Pyx_RefNannyFinishContext();
  29943. return 0;
  29944. }
  29945. static int __Pyx_modinit_function_export_code(void) {
  29946. __Pyx_RefNannyDeclarations
  29947. __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  29948. /*--- Function export code ---*/
  29949. __Pyx_RefNannyFinishContext();
  29950. return 0;
  29951. }
  29952. static int __Pyx_modinit_type_init_code(void) {
  29953. __Pyx_RefNannyDeclarations
  29954. __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  29955. /*--- Type init code ---*/
  29956. __pyx_vtabptr_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet = &__pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet;
  29957. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet.resize = (void (*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *, size_t))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_resize;
  29958. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet.get_item = (unsigned char *(*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *, PyObject *))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_9ResultSet_get_item;
  29959. if (PyType_Ready(&__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet) < 0) __PYX_ERR(0, 131, __pyx_L1_error)
  29960. __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet.tp_print = 0;
  29961. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet.tp_dictoffset && __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet.tp_getattro == PyObject_GenericGetAttr)) {
  29962. __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  29963. }
  29964. if (__Pyx_SetVtable(__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet.tp_dict, __pyx_vtabptr_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet) < 0) __PYX_ERR(0, 131, __pyx_L1_error)
  29965. if (PyObject_SetAttrString(__pyx_m, "ResultSet", (PyObject *)&__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet) < 0) __PYX_ERR(0, 131, __pyx_L1_error)
  29966. if (__Pyx_setup_reduce((PyObject*)&__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet) < 0) __PYX_ERR(0, 131, __pyx_L1_error)
  29967. __pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet = &__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet;
  29968. __pyx_vtabptr_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph = &__pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph;
  29969. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph._data_from_lookup = (void (*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *, PyObject *, struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph__data_from_lookup;
  29970. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph.set = (void (*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *, PyObject *, int __pyx_skip_dispatch))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_set;
  29971. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph.remove_triples = (void (*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *, PyObject *, int __pyx_skip_dispatch))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_remove_triples;
  29972. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph.as_rdflib = (PyObject *(*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *, int __pyx_skip_dispatch))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_as_rdflib;
  29973. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph._slice = (PyObject *(*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *, PyObject *, PyObject *, PyObject *))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph__slice;
  29974. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph.lookup = (PyObject *(*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_lookup;
  29975. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph.terms = (PyObject *(*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *, PyObject *, int __pyx_skip_dispatch))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph_terms;
  29976. if (PyType_Ready(&__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph) < 0) __PYX_ERR(0, 237, __pyx_L1_error)
  29977. __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph.tp_print = 0;
  29978. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph.tp_dictoffset && __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph.tp_getattro == PyObject_GenericGetAttr)) {
  29979. __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  29980. }
  29981. #if CYTHON_COMPILING_IN_CPYTHON
  29982. {
  29983. PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 237, __pyx_L1_error)
  29984. if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
  29985. __pyx_wrapperbase_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
  29986. __pyx_wrapperbase_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph___init__.doc = __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph___init__;
  29987. ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_11SimpleGraph___init__;
  29988. }
  29989. }
  29990. #endif
  29991. if (__Pyx_SetVtable(__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph.tp_dict, __pyx_vtabptr_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph) < 0) __PYX_ERR(0, 237, __pyx_L1_error)
  29992. if (PyObject_SetAttrString(__pyx_m, "SimpleGraph", (PyObject *)&__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph) < 0) __PYX_ERR(0, 237, __pyx_L1_error)
  29993. if (__Pyx_setup_reduce((PyObject*)&__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph) < 0) __PYX_ERR(0, 237, __pyx_L1_error)
  29994. __pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph = &__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph;
  29995. __pyx_vtabptr_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr = &__pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr;
  29996. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr.__pyx_base = *__pyx_vtabptr_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph;
  29997. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr.__pyx_base.as_rdflib = (PyObject *(*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph *, int __pyx_skip_dispatch))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr_as_rdflib;
  29998. __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr.tp_base = __pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph;
  29999. if (PyType_Ready(&__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr) < 0) __PYX_ERR(0, 460, __pyx_L1_error)
  30000. __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr.tp_print = 0;
  30001. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr.tp_dictoffset && __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr.tp_getattro == PyObject_GenericGetAttr)) {
  30002. __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  30003. }
  30004. #if CYTHON_COMPILING_IN_CPYTHON
  30005. {
  30006. PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 460, __pyx_L1_error)
  30007. if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
  30008. __pyx_wrapperbase_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
  30009. __pyx_wrapperbase_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr___init__.doc = __pyx_doc_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr___init__;
  30010. ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3Imr___init__;
  30011. }
  30012. }
  30013. #endif
  30014. if (__Pyx_SetVtable(__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr.tp_dict, __pyx_vtabptr_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr) < 0) __PYX_ERR(0, 460, __pyx_L1_error)
  30015. if (PyObject_SetAttrString(__pyx_m, "Imr", (PyObject *)&__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr) < 0) __PYX_ERR(0, 460, __pyx_L1_error)
  30016. if (__Pyx_setup_reduce((PyObject*)&__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr) < 0) __PYX_ERR(0, 460, __pyx_L1_error)
  30017. __pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr = &__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr;
  30018. __pyx_ptype_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore = __Pyx_ImportType("lakesuperior.store.base_lmdb_store", "BaseLmdbStore", sizeof(struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore), 1); if (unlikely(!__pyx_ptype_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore)) __PYX_ERR(0, 1, __pyx_L1_error)
  30019. __pyx_vtabptr_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore = (struct __pyx_vtabstruct_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore*)__Pyx_GetVtable(__pyx_ptype_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore->tp_dict); if (unlikely(!__pyx_vtabptr_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore)) __PYX_ERR(0, 1, __pyx_L1_error)
  30020. __pyx_vtabptr_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore = &__pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore;
  30021. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore.__pyx_base = *__pyx_vtabptr_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore;
  30022. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore.__pyx_base.stats = (PyObject *(*)(struct __pyx_obj_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore *, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store_13BaseLmdbStore_stats *__pyx_optional_args))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_stats;
  30023. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore._len = (size_t (*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__len *__pyx_optional_args))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__len;
  30024. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore.add = (PyObject *(*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_add *__pyx_optional_args))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_add;
  30025. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore.add_graph = (PyObject *(*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, PyObject *, int __pyx_skip_dispatch))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_add_graph;
  30026. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore._add_graph = (void (*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, unsigned char *, size_t, int __pyx_skip_dispatch))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__add_graph;
  30027. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore._remove = (void (*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__remove *__pyx_optional_args))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__remove;
  30028. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore._index_triple = (void (*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, PyObject *, unsigned char *))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__index_triple;
  30029. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore._remove_graph = (void (*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, PyObject *, int __pyx_skip_dispatch))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__remove_graph;
  30030. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore.triple_keys = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *(*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_triple_keys *__pyx_optional_args))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_triple_keys;
  30031. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore._lookup = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *(*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, PyObject *))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__lookup;
  30032. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore._lookup_1bound = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *(*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, unsigned char, PyObject *))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__lookup_1bound;
  30033. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore._lookup_2bound = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *(*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, unsigned char, PyObject *, unsigned char, PyObject *))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__lookup_2bound;
  30034. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore._all_term_keys = (struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_ResultSet *(*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, PyObject *, int __pyx_skip_dispatch))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__all_term_keys;
  30035. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore.all_namespaces = (PyObject *(*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, int __pyx_skip_dispatch))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_all_namespaces;
  30036. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore.all_contexts = (PyObject *(*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, int __pyx_skip_dispatch, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_all_contexts *__pyx_optional_args))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_all_contexts;
  30037. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore.from_key = (PyObject *(*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, unsigned char *))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_from_key;
  30038. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore.from_trp_key = (PyObject *(*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, unsigned char *))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore_from_trp_key;
  30039. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore._to_key = (void (*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, PyObject *, __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Key *))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__to_key;
  30040. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore._to_triple_key = (void (*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, PyObject *, __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_TripleKey *))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__to_triple_key;
  30041. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore._append = (void (*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, unsigned char *, size_t, __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Key *, struct __pyx_opt_args_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__append *__pyx_optional_args))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__append;
  30042. __pyx_vtable_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore._next_key = (void (*)(struct __pyx_obj_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore *, unsigned char *, __pyx_t_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Key *))__pyx_f_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_15LmdbTriplestore__next_key;
  30043. __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore.tp_base = __pyx_ptype_12lakesuperior_5store_15base_lmdb_store_BaseLmdbStore;
  30044. if (PyType_Ready(&__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore) < 0) __PYX_ERR(0, 585, __pyx_L1_error)
  30045. __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore.tp_print = 0;
  30046. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore.tp_dictoffset && __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore.tp_getattro == PyObject_GenericGetAttr)) {
  30047. __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  30048. }
  30049. if (__Pyx_SetVtable(__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore.tp_dict, __pyx_vtabptr_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore) < 0) __PYX_ERR(0, 585, __pyx_L1_error)
  30050. if (PyObject_SetAttrString(__pyx_m, "LmdbTriplestore", (PyObject *)&__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore) < 0) __PYX_ERR(0, 585, __pyx_L1_error)
  30051. if (__Pyx_setup_reduce((PyObject*)&__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore) < 0) __PYX_ERR(0, 585, __pyx_L1_error)
  30052. __pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore = &__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore;
  30053. if (PyType_Ready(&__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple) < 0) __PYX_ERR(0, 206, __pyx_L1_error)
  30054. __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple.tp_print = 0;
  30055. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple.tp_dictoffset && __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple.tp_getattro == PyObject_GenericGetAttr)) {
  30056. __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  30057. }
  30058. __pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple = &__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct__to_tuple;
  30059. if (PyType_Ready(&__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 211, __pyx_L1_error)
  30060. __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr.tp_print = 0;
  30061. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr.tp_dictoffset && __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
  30062. __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  30063. }
  30064. __pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr = &__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_1_genexpr;
  30065. if (PyType_Ready(&__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts) < 0) __PYX_ERR(0, 1157, __pyx_L1_error)
  30066. __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts.tp_print = 0;
  30067. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts.tp_dictoffset && __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts.tp_getattro == PyObject_GenericGetAttr)) {
  30068. __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  30069. }
  30070. __pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts = &__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_2_contexts;
  30071. if (PyType_Ready(&__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples) < 0) __PYX_ERR(0, 1167, __pyx_L1_error)
  30072. __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples.tp_print = 0;
  30073. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples.tp_dictoffset && __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples.tp_getattro == PyObject_GenericGetAttr)) {
  30074. __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  30075. }
  30076. __pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples = &__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_3_triples;
  30077. if (PyType_Ready(&__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms) < 0) __PYX_ERR(0, 1741, __pyx_L1_error)
  30078. __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms.tp_print = 0;
  30079. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms.tp_dictoffset && __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms.tp_getattro == PyObject_GenericGetAttr)) {
  30080. __pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  30081. }
  30082. __pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms = &__pyx_type_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore___pyx_scope_struct_4_all_terms;
  30083. __Pyx_RefNannyFinishContext();
  30084. return 0;
  30085. __pyx_L1_error:;
  30086. __Pyx_RefNannyFinishContext();
  30087. return -1;
  30088. }
  30089. static int __Pyx_modinit_type_import_code(void) {
  30090. __Pyx_RefNannyDeclarations
  30091. __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  30092. /*--- Type import code ---*/
  30093. __Pyx_RefNannyFinishContext();
  30094. return 0;
  30095. }
  30096. static int __Pyx_modinit_variable_import_code(void) {
  30097. __Pyx_RefNannyDeclarations
  30098. PyObject *__pyx_t_1 = NULL;
  30099. PyObject *__pyx_t_2 = NULL;
  30100. __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  30101. /*--- Variable import code ---*/
  30102. __pyx_t_1 = __Pyx_ImportModule("lakesuperior.store.base_lmdb_store"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
  30103. if (__Pyx_ImportVoidPtr(__pyx_t_1, "rc", (void **)&__pyx_vp_12lakesuperior_5store_15base_lmdb_store_rc, "int") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30104. if (__Pyx_ImportVoidPtr(__pyx_t_1, "i", (void **)&__pyx_vp_12lakesuperior_5store_15base_lmdb_store_i, "size_t") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30105. if (__Pyx_ImportVoidPtr(__pyx_t_1, "key_v", (void **)&__pyx_vp_12lakesuperior_5store_15base_lmdb_store_key_v, "struct MDB_val") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30106. if (__Pyx_ImportVoidPtr(__pyx_t_1, "data_v", (void **)&__pyx_vp_12lakesuperior_5store_15base_lmdb_store_data_v, "struct MDB_val") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30107. if (__Pyx_ImportVoidPtr(__pyx_t_1, "dbi", (void **)&__pyx_vp_12lakesuperior_5store_15base_lmdb_store_dbi, "MDB_dbi") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30108. Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  30109. __pyx_t_2 = __Pyx_ImportModule("lakesuperior.store.ldp_rs.term"); if (!__pyx_t_2) __PYX_ERR(0, 1, __pyx_L1_error)
  30110. if (__Pyx_ImportVoidPtr(__pyx_t_2, "term_type", (void **)&__pyx_vp_12lakesuperior_5store_6ldp_rs_4term_term_type, "unsigned char") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30111. if (__Pyx_ImportVoidPtr(__pyx_t_2, "pack_fmt", (void **)&__pyx_vp_12lakesuperior_5store_6ldp_rs_4term_pack_fmt, "unsigned char *") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30112. if (__Pyx_ImportVoidPtr(__pyx_t_2, "term_data", (void **)&__pyx_vp_12lakesuperior_5store_6ldp_rs_4term_term_data, "unsigned char *") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30113. if (__Pyx_ImportVoidPtr(__pyx_t_2, "term_datatype", (void **)&__pyx_vp_12lakesuperior_5store_6ldp_rs_4term_term_datatype, "unsigned char *") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30114. if (__Pyx_ImportVoidPtr(__pyx_t_2, "term_lang", (void **)&__pyx_vp_12lakesuperior_5store_6ldp_rs_4term_term_lang, "unsigned char *") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30115. Py_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  30116. __Pyx_RefNannyFinishContext();
  30117. return 0;
  30118. __pyx_L1_error:;
  30119. __Pyx_XDECREF(__pyx_t_1);
  30120. __Pyx_XDECREF(__pyx_t_2);
  30121. __Pyx_RefNannyFinishContext();
  30122. return -1;
  30123. }
  30124. static int __Pyx_modinit_function_import_code(void) {
  30125. __Pyx_RefNannyDeclarations
  30126. PyObject *__pyx_t_1 = NULL;
  30127. PyObject *__pyx_t_2 = NULL;
  30128. __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  30129. /*--- Function import code ---*/
  30130. __pyx_t_1 = __Pyx_ImportModule("lakesuperior.store.base_lmdb_store"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
  30131. if (__Pyx_ImportFunction(__pyx_t_1, "_check", (void (**)(void))&__pyx_f_12lakesuperior_5store_15base_lmdb_store__check, "void (int, struct __pyx_opt_args_12lakesuperior_5store_15base_lmdb_store__check *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30132. Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  30133. __pyx_t_2 = __Pyx_ImportModule("lakesuperior.store.ldp_rs.term"); if (!__pyx_t_2) __PYX_ERR(0, 1, __pyx_L1_error)
  30134. if (__Pyx_ImportFunction(__pyx_t_2, "serialize", (void (**)(void))&__pyx_f_12lakesuperior_5store_6ldp_rs_4term_serialize, "int (PyObject *, unsigned char **, size_t *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30135. if (__Pyx_ImportFunction(__pyx_t_2, "deserialize", (void (**)(void))&__pyx_f_12lakesuperior_5store_6ldp_rs_4term_deserialize, "PyObject *(unsigned char *, size_t)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30136. Py_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  30137. __Pyx_RefNannyFinishContext();
  30138. return 0;
  30139. __pyx_L1_error:;
  30140. __Pyx_XDECREF(__pyx_t_1);
  30141. __Pyx_XDECREF(__pyx_t_2);
  30142. __Pyx_RefNannyFinishContext();
  30143. return -1;
  30144. }
  30145. #if PY_MAJOR_VERSION < 3
  30146. #ifdef CYTHON_NO_PYINIT_EXPORT
  30147. #define __Pyx_PyMODINIT_FUNC void
  30148. #else
  30149. #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
  30150. #endif
  30151. #else
  30152. #ifdef CYTHON_NO_PYINIT_EXPORT
  30153. #define __Pyx_PyMODINIT_FUNC PyObject *
  30154. #else
  30155. #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
  30156. #endif
  30157. #endif
  30158. #ifndef CYTHON_SMALL_CODE
  30159. #if defined(__clang__)
  30160. #define CYTHON_SMALL_CODE
  30161. #elif defined(__GNUC__) && (!(defined(__cplusplus)) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 4)))
  30162. #define CYTHON_SMALL_CODE __attribute__((optimize("Os")))
  30163. #else
  30164. #define CYTHON_SMALL_CODE
  30165. #endif
  30166. #endif
  30167. #if PY_MAJOR_VERSION < 3
  30168. __Pyx_PyMODINIT_FUNC initlmdb_triplestore(void) CYTHON_SMALL_CODE; /*proto*/
  30169. __Pyx_PyMODINIT_FUNC initlmdb_triplestore(void)
  30170. #else
  30171. __Pyx_PyMODINIT_FUNC PyInit_lmdb_triplestore(void) CYTHON_SMALL_CODE; /*proto*/
  30172. __Pyx_PyMODINIT_FUNC PyInit_lmdb_triplestore(void)
  30173. #if CYTHON_PEP489_MULTI_PHASE_INIT
  30174. {
  30175. return PyModuleDef_Init(&__pyx_moduledef);
  30176. }
  30177. static int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name) {
  30178. PyObject *value = PyObject_GetAttrString(spec, from_name);
  30179. int result = 0;
  30180. if (likely(value)) {
  30181. result = PyDict_SetItemString(moddict, to_name, value);
  30182. Py_DECREF(value);
  30183. } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
  30184. PyErr_Clear();
  30185. } else {
  30186. result = -1;
  30187. }
  30188. return result;
  30189. }
  30190. static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
  30191. PyObject *module = NULL, *moddict, *modname;
  30192. if (__pyx_m)
  30193. return __Pyx_NewRef(__pyx_m);
  30194. modname = PyObject_GetAttrString(spec, "name");
  30195. if (unlikely(!modname)) goto bad;
  30196. module = PyModule_NewObject(modname);
  30197. Py_DECREF(modname);
  30198. if (unlikely(!module)) goto bad;
  30199. moddict = PyModule_GetDict(module);
  30200. if (unlikely(!moddict)) goto bad;
  30201. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__") < 0)) goto bad;
  30202. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__") < 0)) goto bad;
  30203. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__") < 0)) goto bad;
  30204. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__") < 0)) goto bad;
  30205. return module;
  30206. bad:
  30207. Py_XDECREF(module);
  30208. return NULL;
  30209. }
  30210. static int __pyx_pymod_exec_lmdb_triplestore(PyObject *__pyx_pyinit_module)
  30211. #endif
  30212. #endif
  30213. {
  30214. __Pyx_TraceDeclarations
  30215. PyObject *__pyx_t_1 = NULL;
  30216. PyObject *__pyx_t_2 = NULL;
  30217. static unsigned char __pyx_t_3[3];
  30218. static unsigned char __pyx_t_4[3];
  30219. static unsigned char __pyx_t_5[3];
  30220. static unsigned char __pyx_t_6[3];
  30221. static unsigned char __pyx_t_7[3][3];
  30222. static unsigned char __pyx_t_8[3];
  30223. static unsigned char __pyx_t_9[3];
  30224. static unsigned char __pyx_t_10[3];
  30225. static unsigned char __pyx_t_11[3][3];
  30226. PyObject *__pyx_t_12 = NULL;
  30227. PyObject *__pyx_t_13 = NULL;
  30228. PyObject *__pyx_t_14 = NULL;
  30229. __Pyx_RefNannyDeclarations
  30230. #if CYTHON_PEP489_MULTI_PHASE_INIT
  30231. if (__pyx_m && __pyx_m == __pyx_pyinit_module) return 0;
  30232. #elif PY_MAJOR_VERSION >= 3
  30233. if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  30234. #endif
  30235. #if CYTHON_REFNANNY
  30236. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  30237. if (!__Pyx_RefNanny) {
  30238. PyErr_Clear();
  30239. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  30240. if (!__Pyx_RefNanny)
  30241. Py_FatalError("failed to import 'refnanny' module");
  30242. }
  30243. #endif
  30244. __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_lmdb_triplestore(void)", 0);
  30245. if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30246. __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  30247. __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  30248. __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  30249. #ifdef __Pyx_CyFunction_USED
  30250. if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30251. #endif
  30252. #ifdef __Pyx_FusedFunction_USED
  30253. if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30254. #endif
  30255. #ifdef __Pyx_Coroutine_USED
  30256. if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30257. #endif
  30258. #ifdef __Pyx_Generator_USED
  30259. if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30260. #endif
  30261. #ifdef __Pyx_AsyncGen_USED
  30262. if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30263. #endif
  30264. #ifdef __Pyx_StopAsyncIteration_USED
  30265. if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30266. #endif
  30267. /*--- Library function declarations ---*/
  30268. /*--- Threads initialization code ---*/
  30269. #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  30270. #ifdef WITH_THREAD /* Python build with threading support? */
  30271. PyEval_InitThreads();
  30272. #endif
  30273. #endif
  30274. /*--- Module creation code ---*/
  30275. #if CYTHON_PEP489_MULTI_PHASE_INIT
  30276. __pyx_m = __pyx_pyinit_module;
  30277. Py_INCREF(__pyx_m);
  30278. #else
  30279. #if PY_MAJOR_VERSION < 3
  30280. __pyx_m = Py_InitModule4("lmdb_triplestore", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  30281. #else
  30282. __pyx_m = PyModule_Create(&__pyx_moduledef);
  30283. #endif
  30284. if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  30285. #endif
  30286. __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  30287. Py_INCREF(__pyx_d);
  30288. __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  30289. __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  30290. #if CYTHON_COMPILING_IN_PYPY
  30291. Py_INCREF(__pyx_b);
  30292. #endif
  30293. if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  30294. /*--- Initialize various global constants etc. ---*/
  30295. if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30296. #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  30297. if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30298. #endif
  30299. if (__pyx_module_is_main_lakesuperior__store__ldp_rs__lmdb_triplestore) {
  30300. if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30301. }
  30302. #if PY_MAJOR_VERSION >= 3
  30303. {
  30304. PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
  30305. if (!PyDict_GetItemString(modules, "lakesuperior.store.ldp_rs.lmdb_triplestore")) {
  30306. if (unlikely(PyDict_SetItemString(modules, "lakesuperior.store.ldp_rs.lmdb_triplestore", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  30307. }
  30308. }
  30309. #endif
  30310. /*--- Builtin init code ---*/
  30311. if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30312. /*--- Constants init code ---*/
  30313. if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30314. /*--- Global type/function init code ---*/
  30315. (void)__Pyx_modinit_global_init_code();
  30316. (void)__Pyx_modinit_variable_export_code();
  30317. (void)__Pyx_modinit_function_export_code();
  30318. if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error;
  30319. (void)__Pyx_modinit_type_import_code();
  30320. if (unlikely(__Pyx_modinit_variable_import_code() != 0)) goto __pyx_L1_error;
  30321. if (unlikely(__Pyx_modinit_function_import_code() != 0)) goto __pyx_L1_error;
  30322. /*--- Execution code ---*/
  30323. #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  30324. if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30325. #endif
  30326. __Pyx_TraceCall("__Pyx_PyMODINIT_FUNC PyInit_lmdb_triplestore(void)", __pyx_f[0], 1, 0, __PYX_ERR(0, 1, __pyx_L1_error));
  30327. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1
  30328. * import hashlib # <<<<<<<<<<<<<<
  30329. * import logging
  30330. * import os
  30331. */
  30332. __pyx_t_1 = __Pyx_Import(__pyx_n_s_hashlib, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  30333. __Pyx_GOTREF(__pyx_t_1);
  30334. if (PyDict_SetItem(__pyx_d, __pyx_n_s_hashlib, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  30335. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  30336. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":2
  30337. * import hashlib
  30338. * import logging # <<<<<<<<<<<<<<
  30339. * import os
  30340. * import pickle
  30341. */
  30342. __pyx_t_1 = __Pyx_Import(__pyx_n_s_logging, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
  30343. __Pyx_GOTREF(__pyx_t_1);
  30344. if (PyDict_SetItem(__pyx_d, __pyx_n_s_logging, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
  30345. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  30346. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":3
  30347. * import hashlib
  30348. * import logging
  30349. * import os # <<<<<<<<<<<<<<
  30350. * import pickle
  30351. *
  30352. */
  30353. __pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error)
  30354. __Pyx_GOTREF(__pyx_t_1);
  30355. if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
  30356. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  30357. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":4
  30358. * import logging
  30359. * import os
  30360. * import pickle # <<<<<<<<<<<<<<
  30361. *
  30362. * from collections.abc import Sequence
  30363. */
  30364. __pyx_t_1 = __Pyx_Import(__pyx_n_s_pickle, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
  30365. __Pyx_GOTREF(__pyx_t_1);
  30366. if (PyDict_SetItem(__pyx_d, __pyx_n_s_pickle, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
  30367. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  30368. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":6
  30369. * import pickle
  30370. *
  30371. * from collections.abc import Sequence # <<<<<<<<<<<<<<
  30372. * from functools import wraps
  30373. *
  30374. */
  30375. __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
  30376. __Pyx_GOTREF(__pyx_t_1);
  30377. __Pyx_INCREF(__pyx_n_s_Sequence);
  30378. __Pyx_GIVEREF(__pyx_n_s_Sequence);
  30379. PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Sequence);
  30380. __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections_abc, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
  30381. __Pyx_GOTREF(__pyx_t_2);
  30382. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  30383. __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Sequence); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
  30384. __Pyx_GOTREF(__pyx_t_1);
  30385. if (PyDict_SetItem(__pyx_d, __pyx_n_s_Sequence, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
  30386. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  30387. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  30388. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":7
  30389. *
  30390. * from collections.abc import Sequence
  30391. * from functools import wraps # <<<<<<<<<<<<<<
  30392. *
  30393. * from rdflib import Graph
  30394. */
  30395. __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error)
  30396. __Pyx_GOTREF(__pyx_t_2);
  30397. __Pyx_INCREF(__pyx_n_s_wraps);
  30398. __Pyx_GIVEREF(__pyx_n_s_wraps);
  30399. PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_wraps);
  30400. __pyx_t_1 = __Pyx_Import(__pyx_n_s_functools, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
  30401. __Pyx_GOTREF(__pyx_t_1);
  30402. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  30403. __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_wraps); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error)
  30404. __Pyx_GOTREF(__pyx_t_2);
  30405. if (PyDict_SetItem(__pyx_d, __pyx_n_s_wraps, __pyx_t_2) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
  30406. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  30407. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  30408. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":9
  30409. * from functools import wraps
  30410. *
  30411. * from rdflib import Graph # <<<<<<<<<<<<<<
  30412. * from rdflib.graph import DATASET_DEFAULT_GRAPH_ID as RDFLIB_DEFAULT_GRAPH_URI
  30413. * from rdflib.term import Node
  30414. */
  30415. __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
  30416. __Pyx_GOTREF(__pyx_t_1);
  30417. __Pyx_INCREF(__pyx_n_s_Graph);
  30418. __Pyx_GIVEREF(__pyx_n_s_Graph);
  30419. PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Graph);
  30420. __pyx_t_2 = __Pyx_Import(__pyx_n_s_rdflib, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
  30421. __Pyx_GOTREF(__pyx_t_2);
  30422. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  30423. __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Graph); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
  30424. __Pyx_GOTREF(__pyx_t_1);
  30425. if (PyDict_SetItem(__pyx_d, __pyx_n_s_Graph, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
  30426. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  30427. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  30428. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":10
  30429. *
  30430. * from rdflib import Graph
  30431. * from rdflib.graph import DATASET_DEFAULT_GRAPH_ID as RDFLIB_DEFAULT_GRAPH_URI # <<<<<<<<<<<<<<
  30432. * from rdflib.term import Node
  30433. *
  30434. */
  30435. __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error)
  30436. __Pyx_GOTREF(__pyx_t_2);
  30437. __Pyx_INCREF(__pyx_n_s_DATASET_DEFAULT_GRAPH_ID);
  30438. __Pyx_GIVEREF(__pyx_n_s_DATASET_DEFAULT_GRAPH_ID);
  30439. PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_DATASET_DEFAULT_GRAPH_ID);
  30440. __pyx_t_1 = __Pyx_Import(__pyx_n_s_rdflib_graph, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error)
  30441. __Pyx_GOTREF(__pyx_t_1);
  30442. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  30443. __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_DATASET_DEFAULT_GRAPH_ID); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error)
  30444. __Pyx_GOTREF(__pyx_t_2);
  30445. if (PyDict_SetItem(__pyx_d, __pyx_n_s_RDFLIB_DEFAULT_GRAPH_URI, __pyx_t_2) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
  30446. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  30447. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  30448. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":11
  30449. * from rdflib import Graph
  30450. * from rdflib.graph import DATASET_DEFAULT_GRAPH_ID as RDFLIB_DEFAULT_GRAPH_URI
  30451. * from rdflib.term import Node # <<<<<<<<<<<<<<
  30452. *
  30453. * from lakesuperior.store.base_lmdb_store import (
  30454. */
  30455. __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
  30456. __Pyx_GOTREF(__pyx_t_1);
  30457. __Pyx_INCREF(__pyx_n_s_Node);
  30458. __Pyx_GIVEREF(__pyx_n_s_Node);
  30459. PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Node);
  30460. __pyx_t_2 = __Pyx_Import(__pyx_n_s_rdflib_term, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error)
  30461. __Pyx_GOTREF(__pyx_t_2);
  30462. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  30463. __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Node); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
  30464. __Pyx_GOTREF(__pyx_t_1);
  30465. if (PyDict_SetItem(__pyx_d, __pyx_n_s_Node, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
  30466. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  30467. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  30468. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":14
  30469. *
  30470. * from lakesuperior.store.base_lmdb_store import (
  30471. * KeyExistsError, KeyNotFoundError, LmdbError) # <<<<<<<<<<<<<<
  30472. * from lakesuperior.store.base_lmdb_store cimport _check
  30473. *
  30474. */
  30475. __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error)
  30476. __Pyx_GOTREF(__pyx_t_2);
  30477. __Pyx_INCREF(__pyx_n_s_KeyExistsError);
  30478. __Pyx_GIVEREF(__pyx_n_s_KeyExistsError);
  30479. PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_KeyExistsError);
  30480. __Pyx_INCREF(__pyx_n_s_KeyNotFoundError);
  30481. __Pyx_GIVEREF(__pyx_n_s_KeyNotFoundError);
  30482. PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_KeyNotFoundError);
  30483. __Pyx_INCREF(__pyx_n_s_LmdbError);
  30484. __Pyx_GIVEREF(__pyx_n_s_LmdbError);
  30485. PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_LmdbError);
  30486. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":13
  30487. * from rdflib.term import Node
  30488. *
  30489. * from lakesuperior.store.base_lmdb_store import ( # <<<<<<<<<<<<<<
  30490. * KeyExistsError, KeyNotFoundError, LmdbError)
  30491. * from lakesuperior.store.base_lmdb_store cimport _check
  30492. */
  30493. __pyx_t_1 = __Pyx_Import(__pyx_n_s_lakesuperior_store_base_lmdb_sto, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
  30494. __Pyx_GOTREF(__pyx_t_1);
  30495. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  30496. __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_KeyExistsError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
  30497. __Pyx_GOTREF(__pyx_t_2);
  30498. if (PyDict_SetItem(__pyx_d, __pyx_n_s_KeyExistsError, __pyx_t_2) < 0) __PYX_ERR(0, 14, __pyx_L1_error)
  30499. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  30500. __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_KeyNotFoundError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
  30501. __Pyx_GOTREF(__pyx_t_2);
  30502. if (PyDict_SetItem(__pyx_d, __pyx_n_s_KeyNotFoundError, __pyx_t_2) < 0) __PYX_ERR(0, 14, __pyx_L1_error)
  30503. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  30504. __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_LmdbError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
  30505. __Pyx_GOTREF(__pyx_t_2);
  30506. if (PyDict_SetItem(__pyx_d, __pyx_n_s_LmdbError, __pyx_t_2) < 0) __PYX_ERR(0, 14, __pyx_L1_error)
  30507. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  30508. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  30509. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":89
  30510. *
  30511. * cdef unsigned char first_key[KLEN]
  30512. * memcpy(first_key, FIRST_KEY, KLEN) # <<<<<<<<<<<<<<
  30513. *
  30514. * cdef unsigned char lookup_rank[3]
  30515. */
  30516. (void)(memcpy(__pyx_v_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_first_key, ((char *)"\001\001\001\001\001"), 5));
  30517. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":92
  30518. *
  30519. * cdef unsigned char lookup_rank[3]
  30520. * lookup_rank = [0, 2, 1] # <<<<<<<<<<<<<<
  30521. * """
  30522. * Order in which keys are looked up if two terms are bound.
  30523. */
  30524. __pyx_t_3[0] = 0;
  30525. __pyx_t_3[1] = 2;
  30526. __pyx_t_3[2] = 1;
  30527. memcpy(&(__pyx_v_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_lookup_rank[0]), __pyx_t_3, sizeof(__pyx_v_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_lookup_rank[0]) * (3));
  30528. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":108
  30529. * cdef unsigned char lookup_ordering[3][3]
  30530. * lookup_ordering = [
  30531. * [0, 1, 2], # spo # <<<<<<<<<<<<<<
  30532. * [1, 0, 2], # pso
  30533. * [2, 0, 1], # osp
  30534. */
  30535. __pyx_t_4[0] = 0;
  30536. __pyx_t_4[1] = 1;
  30537. __pyx_t_4[2] = 2;
  30538. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":109
  30539. * lookup_ordering = [
  30540. * [0, 1, 2], # spo
  30541. * [1, 0, 2], # pso # <<<<<<<<<<<<<<
  30542. * [2, 0, 1], # osp
  30543. * ]
  30544. */
  30545. __pyx_t_5[0] = 1;
  30546. __pyx_t_5[1] = 0;
  30547. __pyx_t_5[2] = 2;
  30548. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":110
  30549. * [0, 1, 2], # spo
  30550. * [1, 0, 2], # pso
  30551. * [2, 0, 1], # osp # <<<<<<<<<<<<<<
  30552. * ]
  30553. *
  30554. */
  30555. __pyx_t_6[0] = 2;
  30556. __pyx_t_6[1] = 0;
  30557. __pyx_t_6[2] = 1;
  30558. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":107
  30559. *
  30560. * cdef unsigned char lookup_ordering[3][3]
  30561. * lookup_ordering = [ # <<<<<<<<<<<<<<
  30562. * [0, 1, 2], # spo
  30563. * [1, 0, 2], # pso
  30564. */
  30565. memcpy(&(__pyx_t_7[0]), __pyx_t_4, sizeof(__pyx_t_7[0]));
  30566. memcpy(&(__pyx_t_7[1]), __pyx_t_5, sizeof(__pyx_t_7[0]));
  30567. memcpy(&(__pyx_t_7[2]), __pyx_t_6, sizeof(__pyx_t_7[0]));
  30568. memcpy(&(__pyx_v_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_lookup_ordering[0]), __pyx_t_7, sizeof(__pyx_v_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_lookup_ordering[0]) * (3));
  30569. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":116
  30570. * cdef unsigned char lookup_ordering_2bound[3][3]
  30571. * lookup_ordering_2bound = [
  30572. * [1, 2, 0], # po:s # <<<<<<<<<<<<<<
  30573. * [0, 2, 1], # so:p
  30574. * [0, 1, 2], # sp:o
  30575. */
  30576. __pyx_t_8[0] = 1;
  30577. __pyx_t_8[1] = 2;
  30578. __pyx_t_8[2] = 0;
  30579. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":117
  30580. * lookup_ordering_2bound = [
  30581. * [1, 2, 0], # po:s
  30582. * [0, 2, 1], # so:p # <<<<<<<<<<<<<<
  30583. * [0, 1, 2], # sp:o
  30584. * ]
  30585. */
  30586. __pyx_t_9[0] = 0;
  30587. __pyx_t_9[1] = 2;
  30588. __pyx_t_9[2] = 1;
  30589. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":118
  30590. * [1, 2, 0], # po:s
  30591. * [0, 2, 1], # so:p
  30592. * [0, 1, 2], # sp:o # <<<<<<<<<<<<<<
  30593. * ]
  30594. *
  30595. */
  30596. __pyx_t_10[0] = 0;
  30597. __pyx_t_10[1] = 1;
  30598. __pyx_t_10[2] = 2;
  30599. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":115
  30600. *
  30601. * cdef unsigned char lookup_ordering_2bound[3][3]
  30602. * lookup_ordering_2bound = [ # <<<<<<<<<<<<<<
  30603. * [1, 2, 0], # po:s
  30604. * [0, 2, 1], # so:p
  30605. */
  30606. memcpy(&(__pyx_t_11[0]), __pyx_t_8, sizeof(__pyx_t_11[0]));
  30607. memcpy(&(__pyx_t_11[1]), __pyx_t_9, sizeof(__pyx_t_11[0]));
  30608. memcpy(&(__pyx_t_11[2]), __pyx_t_10, sizeof(__pyx_t_11[0]));
  30609. memcpy(&(__pyx_v_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_lookup_ordering_2bound[0]), __pyx_t_11, sizeof(__pyx_v_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_lookup_ordering_2bound[0]) * (3));
  30610. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":128
  30611. *
  30612. *
  30613. * logger = logging.getLogger(__name__) # <<<<<<<<<<<<<<
  30614. *
  30615. *
  30616. */
  30617. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error)
  30618. __Pyx_GOTREF(__pyx_t_1);
  30619. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_getLogger); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __pyx_L1_error)
  30620. __Pyx_GOTREF(__pyx_t_2);
  30621. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  30622. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error)
  30623. __Pyx_GOTREF(__pyx_t_1);
  30624. __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 128, __pyx_L1_error)
  30625. __Pyx_GOTREF(__pyx_t_12);
  30626. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  30627. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  30628. if (PyDict_SetItem(__pyx_d, __pyx_n_s_logger, __pyx_t_12) < 0) __PYX_ERR(0, 128, __pyx_L1_error)
  30629. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  30630. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":229
  30631. *
  30632. *
  30633. * def use_data(fn): # <<<<<<<<<<<<<<
  30634. * @wraps(fn)
  30635. * def _wrapper(self, other):
  30636. */
  30637. __pyx_t_12 = PyCFunction_NewEx(&__pyx_mdef_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_1use_data, NULL, __pyx_n_s_lakesuperior_store_ldp_rs_lmdb_t); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 229, __pyx_L1_error)
  30638. __Pyx_GOTREF(__pyx_t_12);
  30639. if (PyDict_SetItem(__pyx_d, __pyx_n_s_use_data, __pyx_t_12) < 0) __PYX_ERR(0, 229, __pyx_L1_error)
  30640. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  30641. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":248
  30642. * readonly set data
  30643. *
  30644. * def __init__( # <<<<<<<<<<<<<<
  30645. * self, set data=set(), tuple lookup=(), store=None):
  30646. * """
  30647. */
  30648. __pyx_t_12 = PySet_New(0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 249, __pyx_L1_error)
  30649. __Pyx_GOTREF(__pyx_t_12);
  30650. __pyx_k__6 = ((PyObject*)__pyx_t_12);
  30651. __Pyx_GIVEREF(__pyx_t_12);
  30652. __pyx_t_12 = 0;
  30653. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":300
  30654. * return len(self.data)
  30655. *
  30656. * @use_data # <<<<<<<<<<<<<<
  30657. * def __eq__(self, other):
  30658. * return self.data == other
  30659. */
  30660. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_use_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error)
  30661. __Pyx_GOTREF(__pyx_t_1);
  30662. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":301
  30663. *
  30664. * @use_data
  30665. * def __eq__(self, other): # <<<<<<<<<<<<<<
  30666. * return self.data == other
  30667. *
  30668. */
  30669. __pyx_t_2 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph, __pyx_n_s_eq); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 301, __pyx_L1_error)
  30670. __Pyx_GOTREF(__pyx_t_2);
  30671. __pyx_t_13 = NULL;
  30672. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
  30673. __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_1);
  30674. if (likely(__pyx_t_13)) {
  30675. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
  30676. __Pyx_INCREF(__pyx_t_13);
  30677. __Pyx_INCREF(function);
  30678. __Pyx_DECREF_SET(__pyx_t_1, function);
  30679. }
  30680. }
  30681. if (!__pyx_t_13) {
  30682. __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 300, __pyx_L1_error)
  30683. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  30684. __Pyx_GOTREF(__pyx_t_12);
  30685. } else {
  30686. #if CYTHON_FAST_PYCALL
  30687. if (PyFunction_Check(__pyx_t_1)) {
  30688. PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_2};
  30689. __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 300, __pyx_L1_error)
  30690. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  30691. __Pyx_GOTREF(__pyx_t_12);
  30692. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  30693. } else
  30694. #endif
  30695. #if CYTHON_FAST_PYCCALL
  30696. if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
  30697. PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_2};
  30698. __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 300, __pyx_L1_error)
  30699. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  30700. __Pyx_GOTREF(__pyx_t_12);
  30701. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  30702. } else
  30703. #endif
  30704. {
  30705. __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 300, __pyx_L1_error)
  30706. __Pyx_GOTREF(__pyx_t_14);
  30707. __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL;
  30708. __Pyx_GIVEREF(__pyx_t_2);
  30709. PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_t_2);
  30710. __pyx_t_2 = 0;
  30711. __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_14, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 300, __pyx_L1_error)
  30712. __Pyx_GOTREF(__pyx_t_12);
  30713. __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  30714. }
  30715. }
  30716. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  30717. if (PyDict_SetItem((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph->tp_dict, __pyx_n_s_eq, __pyx_t_12) < 0) __PYX_ERR(0, 301, __pyx_L1_error)
  30718. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  30719. PyType_Modified(__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph);
  30720. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":311
  30721. * return str(self.data)
  30722. *
  30723. * @use_data # <<<<<<<<<<<<<<
  30724. * def __sub__(self, other):
  30725. * return self.data - other
  30726. */
  30727. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_use_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 311, __pyx_L1_error)
  30728. __Pyx_GOTREF(__pyx_t_1);
  30729. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":312
  30730. *
  30731. * @use_data
  30732. * def __sub__(self, other): # <<<<<<<<<<<<<<
  30733. * return self.data - other
  30734. *
  30735. */
  30736. __pyx_t_14 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph, __pyx_n_s_sub); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 312, __pyx_L1_error)
  30737. __Pyx_GOTREF(__pyx_t_14);
  30738. __pyx_t_2 = NULL;
  30739. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
  30740. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
  30741. if (likely(__pyx_t_2)) {
  30742. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
  30743. __Pyx_INCREF(__pyx_t_2);
  30744. __Pyx_INCREF(function);
  30745. __Pyx_DECREF_SET(__pyx_t_1, function);
  30746. }
  30747. }
  30748. if (!__pyx_t_2) {
  30749. __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 311, __pyx_L1_error)
  30750. __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  30751. __Pyx_GOTREF(__pyx_t_12);
  30752. } else {
  30753. #if CYTHON_FAST_PYCALL
  30754. if (PyFunction_Check(__pyx_t_1)) {
  30755. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_14};
  30756. __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 311, __pyx_L1_error)
  30757. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  30758. __Pyx_GOTREF(__pyx_t_12);
  30759. __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  30760. } else
  30761. #endif
  30762. #if CYTHON_FAST_PYCCALL
  30763. if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
  30764. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_14};
  30765. __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 311, __pyx_L1_error)
  30766. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  30767. __Pyx_GOTREF(__pyx_t_12);
  30768. __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  30769. } else
  30770. #endif
  30771. {
  30772. __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 311, __pyx_L1_error)
  30773. __Pyx_GOTREF(__pyx_t_13);
  30774. __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_2); __pyx_t_2 = NULL;
  30775. __Pyx_GIVEREF(__pyx_t_14);
  30776. PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_14);
  30777. __pyx_t_14 = 0;
  30778. __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_13, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 311, __pyx_L1_error)
  30779. __Pyx_GOTREF(__pyx_t_12);
  30780. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  30781. }
  30782. }
  30783. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  30784. if (PyDict_SetItem((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph->tp_dict, __pyx_n_s_sub, __pyx_t_12) < 0) __PYX_ERR(0, 312, __pyx_L1_error)
  30785. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  30786. PyType_Modified(__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph);
  30787. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":315
  30788. * return self.data - other
  30789. *
  30790. * @use_data # <<<<<<<<<<<<<<
  30791. * def __isub__(self, other):
  30792. * self.data -= other
  30793. */
  30794. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_use_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L1_error)
  30795. __Pyx_GOTREF(__pyx_t_1);
  30796. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":316
  30797. *
  30798. * @use_data
  30799. * def __isub__(self, other): # <<<<<<<<<<<<<<
  30800. * self.data -= other
  30801. * return self
  30802. */
  30803. __pyx_t_13 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph, __pyx_n_s_isub); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 316, __pyx_L1_error)
  30804. __Pyx_GOTREF(__pyx_t_13);
  30805. __pyx_t_14 = NULL;
  30806. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
  30807. __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_1);
  30808. if (likely(__pyx_t_14)) {
  30809. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
  30810. __Pyx_INCREF(__pyx_t_14);
  30811. __Pyx_INCREF(function);
  30812. __Pyx_DECREF_SET(__pyx_t_1, function);
  30813. }
  30814. }
  30815. if (!__pyx_t_14) {
  30816. __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 315, __pyx_L1_error)
  30817. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  30818. __Pyx_GOTREF(__pyx_t_12);
  30819. } else {
  30820. #if CYTHON_FAST_PYCALL
  30821. if (PyFunction_Check(__pyx_t_1)) {
  30822. PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_t_13};
  30823. __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 315, __pyx_L1_error)
  30824. __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
  30825. __Pyx_GOTREF(__pyx_t_12);
  30826. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  30827. } else
  30828. #endif
  30829. #if CYTHON_FAST_PYCCALL
  30830. if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
  30831. PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_t_13};
  30832. __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 315, __pyx_L1_error)
  30833. __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
  30834. __Pyx_GOTREF(__pyx_t_12);
  30835. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  30836. } else
  30837. #endif
  30838. {
  30839. __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 315, __pyx_L1_error)
  30840. __Pyx_GOTREF(__pyx_t_2);
  30841. __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_14); __pyx_t_14 = NULL;
  30842. __Pyx_GIVEREF(__pyx_t_13);
  30843. PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_13);
  30844. __pyx_t_13 = 0;
  30845. __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 315, __pyx_L1_error)
  30846. __Pyx_GOTREF(__pyx_t_12);
  30847. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  30848. }
  30849. }
  30850. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  30851. if (PyDict_SetItem((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph->tp_dict, __pyx_n_s_isub, __pyx_t_12) < 0) __PYX_ERR(0, 316, __pyx_L1_error)
  30852. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  30853. PyType_Modified(__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph);
  30854. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":320
  30855. * return self
  30856. *
  30857. * @use_data # <<<<<<<<<<<<<<
  30858. * def __and__(self, other):
  30859. * return self.data & other
  30860. */
  30861. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_use_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 320, __pyx_L1_error)
  30862. __Pyx_GOTREF(__pyx_t_1);
  30863. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":321
  30864. *
  30865. * @use_data
  30866. * def __and__(self, other): # <<<<<<<<<<<<<<
  30867. * return self.data & other
  30868. *
  30869. */
  30870. __pyx_t_2 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph, __pyx_n_s_and); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 321, __pyx_L1_error)
  30871. __Pyx_GOTREF(__pyx_t_2);
  30872. __pyx_t_13 = NULL;
  30873. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
  30874. __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_1);
  30875. if (likely(__pyx_t_13)) {
  30876. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
  30877. __Pyx_INCREF(__pyx_t_13);
  30878. __Pyx_INCREF(function);
  30879. __Pyx_DECREF_SET(__pyx_t_1, function);
  30880. }
  30881. }
  30882. if (!__pyx_t_13) {
  30883. __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 320, __pyx_L1_error)
  30884. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  30885. __Pyx_GOTREF(__pyx_t_12);
  30886. } else {
  30887. #if CYTHON_FAST_PYCALL
  30888. if (PyFunction_Check(__pyx_t_1)) {
  30889. PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_2};
  30890. __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 320, __pyx_L1_error)
  30891. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  30892. __Pyx_GOTREF(__pyx_t_12);
  30893. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  30894. } else
  30895. #endif
  30896. #if CYTHON_FAST_PYCCALL
  30897. if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
  30898. PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_2};
  30899. __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 320, __pyx_L1_error)
  30900. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  30901. __Pyx_GOTREF(__pyx_t_12);
  30902. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  30903. } else
  30904. #endif
  30905. {
  30906. __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 320, __pyx_L1_error)
  30907. __Pyx_GOTREF(__pyx_t_14);
  30908. __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL;
  30909. __Pyx_GIVEREF(__pyx_t_2);
  30910. PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_t_2);
  30911. __pyx_t_2 = 0;
  30912. __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_14, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 320, __pyx_L1_error)
  30913. __Pyx_GOTREF(__pyx_t_12);
  30914. __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  30915. }
  30916. }
  30917. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  30918. if (PyDict_SetItem((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph->tp_dict, __pyx_n_s_and, __pyx_t_12) < 0) __PYX_ERR(0, 321, __pyx_L1_error)
  30919. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  30920. PyType_Modified(__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph);
  30921. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":324
  30922. * return self.data & other
  30923. *
  30924. * @use_data # <<<<<<<<<<<<<<
  30925. * def __iand__(self, other):
  30926. * self.data &= other
  30927. */
  30928. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_use_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 324, __pyx_L1_error)
  30929. __Pyx_GOTREF(__pyx_t_1);
  30930. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":325
  30931. *
  30932. * @use_data
  30933. * def __iand__(self, other): # <<<<<<<<<<<<<<
  30934. * self.data &= other
  30935. * return self
  30936. */
  30937. __pyx_t_14 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph, __pyx_n_s_iand); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 325, __pyx_L1_error)
  30938. __Pyx_GOTREF(__pyx_t_14);
  30939. __pyx_t_2 = NULL;
  30940. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
  30941. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
  30942. if (likely(__pyx_t_2)) {
  30943. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
  30944. __Pyx_INCREF(__pyx_t_2);
  30945. __Pyx_INCREF(function);
  30946. __Pyx_DECREF_SET(__pyx_t_1, function);
  30947. }
  30948. }
  30949. if (!__pyx_t_2) {
  30950. __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 324, __pyx_L1_error)
  30951. __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  30952. __Pyx_GOTREF(__pyx_t_12);
  30953. } else {
  30954. #if CYTHON_FAST_PYCALL
  30955. if (PyFunction_Check(__pyx_t_1)) {
  30956. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_14};
  30957. __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 324, __pyx_L1_error)
  30958. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  30959. __Pyx_GOTREF(__pyx_t_12);
  30960. __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  30961. } else
  30962. #endif
  30963. #if CYTHON_FAST_PYCCALL
  30964. if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
  30965. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_14};
  30966. __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 324, __pyx_L1_error)
  30967. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  30968. __Pyx_GOTREF(__pyx_t_12);
  30969. __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  30970. } else
  30971. #endif
  30972. {
  30973. __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 324, __pyx_L1_error)
  30974. __Pyx_GOTREF(__pyx_t_13);
  30975. __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_2); __pyx_t_2 = NULL;
  30976. __Pyx_GIVEREF(__pyx_t_14);
  30977. PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_14);
  30978. __pyx_t_14 = 0;
  30979. __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_13, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 324, __pyx_L1_error)
  30980. __Pyx_GOTREF(__pyx_t_12);
  30981. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  30982. }
  30983. }
  30984. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  30985. if (PyDict_SetItem((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph->tp_dict, __pyx_n_s_iand, __pyx_t_12) < 0) __PYX_ERR(0, 325, __pyx_L1_error)
  30986. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  30987. PyType_Modified(__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph);
  30988. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":329
  30989. * return self
  30990. *
  30991. * @use_data # <<<<<<<<<<<<<<
  30992. * def __or__(self, other):
  30993. * return self.data | other
  30994. */
  30995. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_use_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L1_error)
  30996. __Pyx_GOTREF(__pyx_t_1);
  30997. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":330
  30998. *
  30999. * @use_data
  31000. * def __or__(self, other): # <<<<<<<<<<<<<<
  31001. * return self.data | other
  31002. *
  31003. */
  31004. __pyx_t_13 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph, __pyx_n_s_or); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 330, __pyx_L1_error)
  31005. __Pyx_GOTREF(__pyx_t_13);
  31006. __pyx_t_14 = NULL;
  31007. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
  31008. __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_1);
  31009. if (likely(__pyx_t_14)) {
  31010. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
  31011. __Pyx_INCREF(__pyx_t_14);
  31012. __Pyx_INCREF(function);
  31013. __Pyx_DECREF_SET(__pyx_t_1, function);
  31014. }
  31015. }
  31016. if (!__pyx_t_14) {
  31017. __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 329, __pyx_L1_error)
  31018. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  31019. __Pyx_GOTREF(__pyx_t_12);
  31020. } else {
  31021. #if CYTHON_FAST_PYCALL
  31022. if (PyFunction_Check(__pyx_t_1)) {
  31023. PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_t_13};
  31024. __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 329, __pyx_L1_error)
  31025. __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
  31026. __Pyx_GOTREF(__pyx_t_12);
  31027. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  31028. } else
  31029. #endif
  31030. #if CYTHON_FAST_PYCCALL
  31031. if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
  31032. PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_t_13};
  31033. __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 329, __pyx_L1_error)
  31034. __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
  31035. __Pyx_GOTREF(__pyx_t_12);
  31036. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  31037. } else
  31038. #endif
  31039. {
  31040. __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 329, __pyx_L1_error)
  31041. __Pyx_GOTREF(__pyx_t_2);
  31042. __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_14); __pyx_t_14 = NULL;
  31043. __Pyx_GIVEREF(__pyx_t_13);
  31044. PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_13);
  31045. __pyx_t_13 = 0;
  31046. __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 329, __pyx_L1_error)
  31047. __Pyx_GOTREF(__pyx_t_12);
  31048. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  31049. }
  31050. }
  31051. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  31052. if (PyDict_SetItem((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph->tp_dict, __pyx_n_s_or, __pyx_t_12) < 0) __PYX_ERR(0, 330, __pyx_L1_error)
  31053. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  31054. PyType_Modified(__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph);
  31055. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":333
  31056. * return self.data | other
  31057. *
  31058. * @use_data # <<<<<<<<<<<<<<
  31059. * def __ior__(self, other):
  31060. * self.data |= other
  31061. */
  31062. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_use_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 333, __pyx_L1_error)
  31063. __Pyx_GOTREF(__pyx_t_1);
  31064. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":334
  31065. *
  31066. * @use_data
  31067. * def __ior__(self, other): # <<<<<<<<<<<<<<
  31068. * self.data |= other
  31069. * return self
  31070. */
  31071. __pyx_t_2 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph, __pyx_n_s_ior); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 334, __pyx_L1_error)
  31072. __Pyx_GOTREF(__pyx_t_2);
  31073. __pyx_t_13 = NULL;
  31074. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
  31075. __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_1);
  31076. if (likely(__pyx_t_13)) {
  31077. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
  31078. __Pyx_INCREF(__pyx_t_13);
  31079. __Pyx_INCREF(function);
  31080. __Pyx_DECREF_SET(__pyx_t_1, function);
  31081. }
  31082. }
  31083. if (!__pyx_t_13) {
  31084. __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 333, __pyx_L1_error)
  31085. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  31086. __Pyx_GOTREF(__pyx_t_12);
  31087. } else {
  31088. #if CYTHON_FAST_PYCALL
  31089. if (PyFunction_Check(__pyx_t_1)) {
  31090. PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_2};
  31091. __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 333, __pyx_L1_error)
  31092. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  31093. __Pyx_GOTREF(__pyx_t_12);
  31094. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  31095. } else
  31096. #endif
  31097. #if CYTHON_FAST_PYCCALL
  31098. if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
  31099. PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_2};
  31100. __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 333, __pyx_L1_error)
  31101. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  31102. __Pyx_GOTREF(__pyx_t_12);
  31103. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  31104. } else
  31105. #endif
  31106. {
  31107. __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 333, __pyx_L1_error)
  31108. __Pyx_GOTREF(__pyx_t_14);
  31109. __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL;
  31110. __Pyx_GIVEREF(__pyx_t_2);
  31111. PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_t_2);
  31112. __pyx_t_2 = 0;
  31113. __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_14, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 333, __pyx_L1_error)
  31114. __Pyx_GOTREF(__pyx_t_12);
  31115. __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  31116. }
  31117. }
  31118. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  31119. if (PyDict_SetItem((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph->tp_dict, __pyx_n_s_ior, __pyx_t_12) < 0) __PYX_ERR(0, 334, __pyx_L1_error)
  31120. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  31121. PyType_Modified(__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph);
  31122. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":338
  31123. * return self
  31124. *
  31125. * @use_data # <<<<<<<<<<<<<<
  31126. * def __xor__(self, other):
  31127. * return self.data ^ other
  31128. */
  31129. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_use_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 338, __pyx_L1_error)
  31130. __Pyx_GOTREF(__pyx_t_1);
  31131. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":339
  31132. *
  31133. * @use_data
  31134. * def __xor__(self, other): # <<<<<<<<<<<<<<
  31135. * return self.data ^ other
  31136. *
  31137. */
  31138. __pyx_t_14 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph, __pyx_n_s_xor); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 339, __pyx_L1_error)
  31139. __Pyx_GOTREF(__pyx_t_14);
  31140. __pyx_t_2 = NULL;
  31141. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
  31142. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
  31143. if (likely(__pyx_t_2)) {
  31144. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
  31145. __Pyx_INCREF(__pyx_t_2);
  31146. __Pyx_INCREF(function);
  31147. __Pyx_DECREF_SET(__pyx_t_1, function);
  31148. }
  31149. }
  31150. if (!__pyx_t_2) {
  31151. __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 338, __pyx_L1_error)
  31152. __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  31153. __Pyx_GOTREF(__pyx_t_12);
  31154. } else {
  31155. #if CYTHON_FAST_PYCALL
  31156. if (PyFunction_Check(__pyx_t_1)) {
  31157. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_14};
  31158. __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 338, __pyx_L1_error)
  31159. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  31160. __Pyx_GOTREF(__pyx_t_12);
  31161. __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  31162. } else
  31163. #endif
  31164. #if CYTHON_FAST_PYCCALL
  31165. if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
  31166. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_14};
  31167. __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 338, __pyx_L1_error)
  31168. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  31169. __Pyx_GOTREF(__pyx_t_12);
  31170. __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  31171. } else
  31172. #endif
  31173. {
  31174. __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 338, __pyx_L1_error)
  31175. __Pyx_GOTREF(__pyx_t_13);
  31176. __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_2); __pyx_t_2 = NULL;
  31177. __Pyx_GIVEREF(__pyx_t_14);
  31178. PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_14);
  31179. __pyx_t_14 = 0;
  31180. __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_13, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 338, __pyx_L1_error)
  31181. __Pyx_GOTREF(__pyx_t_12);
  31182. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  31183. }
  31184. }
  31185. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  31186. if (PyDict_SetItem((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph->tp_dict, __pyx_n_s_xor, __pyx_t_12) < 0) __PYX_ERR(0, 339, __pyx_L1_error)
  31187. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  31188. PyType_Modified(__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph);
  31189. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":342
  31190. * return self.data ^ other
  31191. *
  31192. * @use_data # <<<<<<<<<<<<<<
  31193. * def __ixor__(self, other):
  31194. * self.data ^= other
  31195. */
  31196. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_use_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L1_error)
  31197. __Pyx_GOTREF(__pyx_t_1);
  31198. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":343
  31199. *
  31200. * @use_data
  31201. * def __ixor__(self, other): # <<<<<<<<<<<<<<
  31202. * self.data ^= other
  31203. * return self
  31204. */
  31205. __pyx_t_13 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph, __pyx_n_s_ixor); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 343, __pyx_L1_error)
  31206. __Pyx_GOTREF(__pyx_t_13);
  31207. __pyx_t_14 = NULL;
  31208. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
  31209. __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_1);
  31210. if (likely(__pyx_t_14)) {
  31211. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
  31212. __Pyx_INCREF(__pyx_t_14);
  31213. __Pyx_INCREF(function);
  31214. __Pyx_DECREF_SET(__pyx_t_1, function);
  31215. }
  31216. }
  31217. if (!__pyx_t_14) {
  31218. __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 342, __pyx_L1_error)
  31219. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  31220. __Pyx_GOTREF(__pyx_t_12);
  31221. } else {
  31222. #if CYTHON_FAST_PYCALL
  31223. if (PyFunction_Check(__pyx_t_1)) {
  31224. PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_t_13};
  31225. __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 342, __pyx_L1_error)
  31226. __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
  31227. __Pyx_GOTREF(__pyx_t_12);
  31228. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  31229. } else
  31230. #endif
  31231. #if CYTHON_FAST_PYCCALL
  31232. if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
  31233. PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_t_13};
  31234. __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 342, __pyx_L1_error)
  31235. __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
  31236. __Pyx_GOTREF(__pyx_t_12);
  31237. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  31238. } else
  31239. #endif
  31240. {
  31241. __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 342, __pyx_L1_error)
  31242. __Pyx_GOTREF(__pyx_t_2);
  31243. __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_14); __pyx_t_14 = NULL;
  31244. __Pyx_GIVEREF(__pyx_t_13);
  31245. PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_13);
  31246. __pyx_t_13 = 0;
  31247. __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 342, __pyx_L1_error)
  31248. __Pyx_GOTREF(__pyx_t_12);
  31249. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  31250. }
  31251. }
  31252. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  31253. if (PyDict_SetItem((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph->tp_dict, __pyx_n_s_ixor, __pyx_t_12) < 0) __PYX_ERR(0, 343, __pyx_L1_error)
  31254. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  31255. PyType_Modified(__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_SimpleGraph);
  31256. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":518
  31257. * f'length={len(self.data)}>')
  31258. *
  31259. * @use_data # <<<<<<<<<<<<<<
  31260. * def __sub__(self, other):
  31261. * return self.__class__(uri=self.uri, data=self.data - other)
  31262. */
  31263. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_use_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 518, __pyx_L1_error)
  31264. __Pyx_GOTREF(__pyx_t_1);
  31265. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":519
  31266. *
  31267. * @use_data
  31268. * def __sub__(self, other): # <<<<<<<<<<<<<<
  31269. * return self.__class__(uri=self.uri, data=self.data - other)
  31270. *
  31271. */
  31272. __pyx_t_2 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr, __pyx_n_s_sub); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 519, __pyx_L1_error)
  31273. __Pyx_GOTREF(__pyx_t_2);
  31274. __pyx_t_13 = NULL;
  31275. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
  31276. __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_1);
  31277. if (likely(__pyx_t_13)) {
  31278. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
  31279. __Pyx_INCREF(__pyx_t_13);
  31280. __Pyx_INCREF(function);
  31281. __Pyx_DECREF_SET(__pyx_t_1, function);
  31282. }
  31283. }
  31284. if (!__pyx_t_13) {
  31285. __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 518, __pyx_L1_error)
  31286. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  31287. __Pyx_GOTREF(__pyx_t_12);
  31288. } else {
  31289. #if CYTHON_FAST_PYCALL
  31290. if (PyFunction_Check(__pyx_t_1)) {
  31291. PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_2};
  31292. __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 518, __pyx_L1_error)
  31293. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  31294. __Pyx_GOTREF(__pyx_t_12);
  31295. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  31296. } else
  31297. #endif
  31298. #if CYTHON_FAST_PYCCALL
  31299. if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
  31300. PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_2};
  31301. __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 518, __pyx_L1_error)
  31302. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  31303. __Pyx_GOTREF(__pyx_t_12);
  31304. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  31305. } else
  31306. #endif
  31307. {
  31308. __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 518, __pyx_L1_error)
  31309. __Pyx_GOTREF(__pyx_t_14);
  31310. __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL;
  31311. __Pyx_GIVEREF(__pyx_t_2);
  31312. PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_t_2);
  31313. __pyx_t_2 = 0;
  31314. __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_14, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 518, __pyx_L1_error)
  31315. __Pyx_GOTREF(__pyx_t_12);
  31316. __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  31317. }
  31318. }
  31319. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  31320. if (PyDict_SetItem((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr->tp_dict, __pyx_n_s_sub, __pyx_t_12) < 0) __PYX_ERR(0, 519, __pyx_L1_error)
  31321. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  31322. PyType_Modified(__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr);
  31323. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":522
  31324. * return self.__class__(uri=self.uri, data=self.data - other)
  31325. *
  31326. * @use_data # <<<<<<<<<<<<<<
  31327. * def __and__(self, other):
  31328. * return self.__class__(uri=self.uri, data=self.data & other)
  31329. */
  31330. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_use_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 522, __pyx_L1_error)
  31331. __Pyx_GOTREF(__pyx_t_1);
  31332. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":523
  31333. *
  31334. * @use_data
  31335. * def __and__(self, other): # <<<<<<<<<<<<<<
  31336. * return self.__class__(uri=self.uri, data=self.data & other)
  31337. *
  31338. */
  31339. __pyx_t_14 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr, __pyx_n_s_and); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 523, __pyx_L1_error)
  31340. __Pyx_GOTREF(__pyx_t_14);
  31341. __pyx_t_2 = NULL;
  31342. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
  31343. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
  31344. if (likely(__pyx_t_2)) {
  31345. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
  31346. __Pyx_INCREF(__pyx_t_2);
  31347. __Pyx_INCREF(function);
  31348. __Pyx_DECREF_SET(__pyx_t_1, function);
  31349. }
  31350. }
  31351. if (!__pyx_t_2) {
  31352. __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 522, __pyx_L1_error)
  31353. __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  31354. __Pyx_GOTREF(__pyx_t_12);
  31355. } else {
  31356. #if CYTHON_FAST_PYCALL
  31357. if (PyFunction_Check(__pyx_t_1)) {
  31358. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_14};
  31359. __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 522, __pyx_L1_error)
  31360. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  31361. __Pyx_GOTREF(__pyx_t_12);
  31362. __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  31363. } else
  31364. #endif
  31365. #if CYTHON_FAST_PYCCALL
  31366. if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
  31367. PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_14};
  31368. __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 522, __pyx_L1_error)
  31369. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  31370. __Pyx_GOTREF(__pyx_t_12);
  31371. __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  31372. } else
  31373. #endif
  31374. {
  31375. __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 522, __pyx_L1_error)
  31376. __Pyx_GOTREF(__pyx_t_13);
  31377. __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_2); __pyx_t_2 = NULL;
  31378. __Pyx_GIVEREF(__pyx_t_14);
  31379. PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_14);
  31380. __pyx_t_14 = 0;
  31381. __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_13, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 522, __pyx_L1_error)
  31382. __Pyx_GOTREF(__pyx_t_12);
  31383. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  31384. }
  31385. }
  31386. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  31387. if (PyDict_SetItem((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr->tp_dict, __pyx_n_s_and, __pyx_t_12) < 0) __PYX_ERR(0, 523, __pyx_L1_error)
  31388. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  31389. PyType_Modified(__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr);
  31390. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":526
  31391. * return self.__class__(uri=self.uri, data=self.data & other)
  31392. *
  31393. * @use_data # <<<<<<<<<<<<<<
  31394. * def __or__(self, other):
  31395. * return self.__class__(uri=self.uri, data=self.data | other)
  31396. */
  31397. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_use_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L1_error)
  31398. __Pyx_GOTREF(__pyx_t_1);
  31399. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":527
  31400. *
  31401. * @use_data
  31402. * def __or__(self, other): # <<<<<<<<<<<<<<
  31403. * return self.__class__(uri=self.uri, data=self.data | other)
  31404. *
  31405. */
  31406. __pyx_t_13 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr, __pyx_n_s_or); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 527, __pyx_L1_error)
  31407. __Pyx_GOTREF(__pyx_t_13);
  31408. __pyx_t_14 = NULL;
  31409. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
  31410. __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_1);
  31411. if (likely(__pyx_t_14)) {
  31412. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
  31413. __Pyx_INCREF(__pyx_t_14);
  31414. __Pyx_INCREF(function);
  31415. __Pyx_DECREF_SET(__pyx_t_1, function);
  31416. }
  31417. }
  31418. if (!__pyx_t_14) {
  31419. __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 526, __pyx_L1_error)
  31420. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  31421. __Pyx_GOTREF(__pyx_t_12);
  31422. } else {
  31423. #if CYTHON_FAST_PYCALL
  31424. if (PyFunction_Check(__pyx_t_1)) {
  31425. PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_t_13};
  31426. __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 526, __pyx_L1_error)
  31427. __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
  31428. __Pyx_GOTREF(__pyx_t_12);
  31429. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  31430. } else
  31431. #endif
  31432. #if CYTHON_FAST_PYCCALL
  31433. if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
  31434. PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_t_13};
  31435. __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 526, __pyx_L1_error)
  31436. __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
  31437. __Pyx_GOTREF(__pyx_t_12);
  31438. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  31439. } else
  31440. #endif
  31441. {
  31442. __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 526, __pyx_L1_error)
  31443. __Pyx_GOTREF(__pyx_t_2);
  31444. __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_14); __pyx_t_14 = NULL;
  31445. __Pyx_GIVEREF(__pyx_t_13);
  31446. PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_13);
  31447. __pyx_t_13 = 0;
  31448. __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 526, __pyx_L1_error)
  31449. __Pyx_GOTREF(__pyx_t_12);
  31450. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  31451. }
  31452. }
  31453. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  31454. if (PyDict_SetItem((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr->tp_dict, __pyx_n_s_or, __pyx_t_12) < 0) __PYX_ERR(0, 527, __pyx_L1_error)
  31455. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  31456. PyType_Modified(__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr);
  31457. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":530
  31458. * return self.__class__(uri=self.uri, data=self.data | other)
  31459. *
  31460. * @use_data # <<<<<<<<<<<<<<
  31461. * def __xor__(self, other):
  31462. * return self.__class__(uri=self.uri, data=self.data ^ other)
  31463. */
  31464. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_use_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error)
  31465. __Pyx_GOTREF(__pyx_t_1);
  31466. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":531
  31467. *
  31468. * @use_data
  31469. * def __xor__(self, other): # <<<<<<<<<<<<<<
  31470. * return self.__class__(uri=self.uri, data=self.data ^ other)
  31471. *
  31472. */
  31473. __pyx_t_2 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr, __pyx_n_s_xor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 531, __pyx_L1_error)
  31474. __Pyx_GOTREF(__pyx_t_2);
  31475. __pyx_t_13 = NULL;
  31476. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
  31477. __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_1);
  31478. if (likely(__pyx_t_13)) {
  31479. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
  31480. __Pyx_INCREF(__pyx_t_13);
  31481. __Pyx_INCREF(function);
  31482. __Pyx_DECREF_SET(__pyx_t_1, function);
  31483. }
  31484. }
  31485. if (!__pyx_t_13) {
  31486. __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 530, __pyx_L1_error)
  31487. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  31488. __Pyx_GOTREF(__pyx_t_12);
  31489. } else {
  31490. #if CYTHON_FAST_PYCALL
  31491. if (PyFunction_Check(__pyx_t_1)) {
  31492. PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_2};
  31493. __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 530, __pyx_L1_error)
  31494. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  31495. __Pyx_GOTREF(__pyx_t_12);
  31496. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  31497. } else
  31498. #endif
  31499. #if CYTHON_FAST_PYCCALL
  31500. if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
  31501. PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_2};
  31502. __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 530, __pyx_L1_error)
  31503. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  31504. __Pyx_GOTREF(__pyx_t_12);
  31505. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  31506. } else
  31507. #endif
  31508. {
  31509. __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 530, __pyx_L1_error)
  31510. __Pyx_GOTREF(__pyx_t_14);
  31511. __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL;
  31512. __Pyx_GIVEREF(__pyx_t_2);
  31513. PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_t_2);
  31514. __pyx_t_2 = 0;
  31515. __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_14, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 530, __pyx_L1_error)
  31516. __Pyx_GOTREF(__pyx_t_12);
  31517. __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  31518. }
  31519. }
  31520. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  31521. if (PyDict_SetItem((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr->tp_dict, __pyx_n_s_xor, __pyx_t_12) < 0) __PYX_ERR(0, 531, __pyx_L1_error)
  31522. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  31523. PyType_Modified(__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_Imr);
  31524. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":598
  31525. * """
  31526. *
  31527. * dbi_labels = [ # <<<<<<<<<<<<<<
  31528. * # Main data
  31529. * # Term key to serialized term content
  31530. */
  31531. __pyx_t_12 = PyList_New(13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 598, __pyx_L1_error)
  31532. __Pyx_GOTREF(__pyx_t_12);
  31533. __Pyx_INCREF(__pyx_kp_u_t_st);
  31534. __Pyx_GIVEREF(__pyx_kp_u_t_st);
  31535. PyList_SET_ITEM(__pyx_t_12, 0, __pyx_kp_u_t_st);
  31536. __Pyx_INCREF(__pyx_kp_u_spo_c);
  31537. __Pyx_GIVEREF(__pyx_kp_u_spo_c);
  31538. PyList_SET_ITEM(__pyx_t_12, 1, __pyx_kp_u_spo_c);
  31539. __Pyx_INCREF(__pyx_kp_u_c);
  31540. __Pyx_GIVEREF(__pyx_kp_u_c);
  31541. PyList_SET_ITEM(__pyx_t_12, 2, __pyx_kp_u_c);
  31542. __Pyx_INCREF(__pyx_kp_u_pfx_ns);
  31543. __Pyx_GIVEREF(__pyx_kp_u_pfx_ns);
  31544. PyList_SET_ITEM(__pyx_t_12, 3, __pyx_kp_u_pfx_ns);
  31545. __Pyx_INCREF(__pyx_kp_u_ns_pfx);
  31546. __Pyx_GIVEREF(__pyx_kp_u_ns_pfx);
  31547. PyList_SET_ITEM(__pyx_t_12, 4, __pyx_kp_u_ns_pfx);
  31548. __Pyx_INCREF(__pyx_kp_u_th_t);
  31549. __Pyx_GIVEREF(__pyx_kp_u_th_t);
  31550. PyList_SET_ITEM(__pyx_t_12, 5, __pyx_kp_u_th_t);
  31551. __Pyx_INCREF(__pyx_kp_u_s_po);
  31552. __Pyx_GIVEREF(__pyx_kp_u_s_po);
  31553. PyList_SET_ITEM(__pyx_t_12, 6, __pyx_kp_u_s_po);
  31554. __Pyx_INCREF(__pyx_kp_u_p_so);
  31555. __Pyx_GIVEREF(__pyx_kp_u_p_so);
  31556. PyList_SET_ITEM(__pyx_t_12, 7, __pyx_kp_u_p_so);
  31557. __Pyx_INCREF(__pyx_kp_u_o_sp);
  31558. __Pyx_GIVEREF(__pyx_kp_u_o_sp);
  31559. PyList_SET_ITEM(__pyx_t_12, 8, __pyx_kp_u_o_sp);
  31560. __Pyx_INCREF(__pyx_kp_u_po_s);
  31561. __Pyx_GIVEREF(__pyx_kp_u_po_s);
  31562. PyList_SET_ITEM(__pyx_t_12, 9, __pyx_kp_u_po_s);
  31563. __Pyx_INCREF(__pyx_kp_u_so_p);
  31564. __Pyx_GIVEREF(__pyx_kp_u_so_p);
  31565. PyList_SET_ITEM(__pyx_t_12, 10, __pyx_kp_u_so_p);
  31566. __Pyx_INCREF(__pyx_kp_u_sp_o);
  31567. __Pyx_GIVEREF(__pyx_kp_u_sp_o);
  31568. PyList_SET_ITEM(__pyx_t_12, 11, __pyx_kp_u_sp_o);
  31569. __Pyx_INCREF(__pyx_kp_u_c_spo);
  31570. __Pyx_GIVEREF(__pyx_kp_u_c_spo);
  31571. PyList_SET_ITEM(__pyx_t_12, 12, __pyx_kp_u_c_spo);
  31572. if (PyDict_SetItem((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore->tp_dict, __pyx_n_s_dbi_labels, __pyx_t_12) < 0) __PYX_ERR(0, 598, __pyx_L1_error)
  31573. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  31574. PyType_Modified(__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore);
  31575. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":624
  31576. * ]
  31577. *
  31578. * lookup_indices = [ # <<<<<<<<<<<<<<
  31579. * b's:po',
  31580. * b'p:so',
  31581. */
  31582. __pyx_t_12 = PyList_New(6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 624, __pyx_L1_error)
  31583. __Pyx_GOTREF(__pyx_t_12);
  31584. __Pyx_INCREF(__pyx_kp_b_s_po);
  31585. __Pyx_GIVEREF(__pyx_kp_b_s_po);
  31586. PyList_SET_ITEM(__pyx_t_12, 0, __pyx_kp_b_s_po);
  31587. __Pyx_INCREF(__pyx_kp_b_p_so);
  31588. __Pyx_GIVEREF(__pyx_kp_b_p_so);
  31589. PyList_SET_ITEM(__pyx_t_12, 1, __pyx_kp_b_p_so);
  31590. __Pyx_INCREF(__pyx_kp_b_o_sp);
  31591. __Pyx_GIVEREF(__pyx_kp_b_o_sp);
  31592. PyList_SET_ITEM(__pyx_t_12, 2, __pyx_kp_b_o_sp);
  31593. __Pyx_INCREF(__pyx_kp_b_po_s);
  31594. __Pyx_GIVEREF(__pyx_kp_b_po_s);
  31595. PyList_SET_ITEM(__pyx_t_12, 3, __pyx_kp_b_po_s);
  31596. __Pyx_INCREF(__pyx_kp_b_so_p);
  31597. __Pyx_GIVEREF(__pyx_kp_b_so_p);
  31598. PyList_SET_ITEM(__pyx_t_12, 4, __pyx_kp_b_so_p);
  31599. __Pyx_INCREF(__pyx_kp_b_sp_o);
  31600. __Pyx_GIVEREF(__pyx_kp_b_sp_o);
  31601. PyList_SET_ITEM(__pyx_t_12, 5, __pyx_kp_b_sp_o);
  31602. if (PyDict_SetItem((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore->tp_dict, __pyx_n_s_lookup_indices, __pyx_t_12) < 0) __PYX_ERR(0, 624, __pyx_L1_error)
  31603. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  31604. PyType_Modified(__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore);
  31605. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":634
  31606. *
  31607. * dbi_flags = {
  31608. * 's:po': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED, # <<<<<<<<<<<<<<
  31609. * 'p:so': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31610. * 'o:sp': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31611. */
  31612. __pyx_t_12 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 634, __pyx_L1_error)
  31613. __Pyx_GOTREF(__pyx_t_12);
  31614. __pyx_t_1 = __Pyx_PyInt_From_int((MDB_DUPSORT | MDB_DUPFIXED)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error)
  31615. __Pyx_GOTREF(__pyx_t_1);
  31616. if (PyDict_SetItem(__pyx_t_12, __pyx_kp_u_s_po, __pyx_t_1) < 0) __PYX_ERR(0, 634, __pyx_L1_error)
  31617. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  31618. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":635
  31619. * dbi_flags = {
  31620. * 's:po': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31621. * 'p:so': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED, # <<<<<<<<<<<<<<
  31622. * 'o:sp': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31623. * 'po:s': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31624. */
  31625. __pyx_t_1 = __Pyx_PyInt_From_int((MDB_DUPSORT | MDB_DUPFIXED)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 635, __pyx_L1_error)
  31626. __Pyx_GOTREF(__pyx_t_1);
  31627. if (PyDict_SetItem(__pyx_t_12, __pyx_kp_u_p_so, __pyx_t_1) < 0) __PYX_ERR(0, 634, __pyx_L1_error)
  31628. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  31629. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":636
  31630. * 's:po': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31631. * 'p:so': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31632. * 'o:sp': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED, # <<<<<<<<<<<<<<
  31633. * 'po:s': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31634. * 'so:p': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31635. */
  31636. __pyx_t_1 = __Pyx_PyInt_From_int((MDB_DUPSORT | MDB_DUPFIXED)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 636, __pyx_L1_error)
  31637. __Pyx_GOTREF(__pyx_t_1);
  31638. if (PyDict_SetItem(__pyx_t_12, __pyx_kp_u_o_sp, __pyx_t_1) < 0) __PYX_ERR(0, 634, __pyx_L1_error)
  31639. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  31640. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":637
  31641. * 'p:so': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31642. * 'o:sp': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31643. * 'po:s': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED, # <<<<<<<<<<<<<<
  31644. * 'so:p': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31645. * 'sp:o': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31646. */
  31647. __pyx_t_1 = __Pyx_PyInt_From_int((MDB_DUPSORT | MDB_DUPFIXED)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 637, __pyx_L1_error)
  31648. __Pyx_GOTREF(__pyx_t_1);
  31649. if (PyDict_SetItem(__pyx_t_12, __pyx_kp_u_po_s, __pyx_t_1) < 0) __PYX_ERR(0, 634, __pyx_L1_error)
  31650. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  31651. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":638
  31652. * 'o:sp': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31653. * 'po:s': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31654. * 'so:p': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED, # <<<<<<<<<<<<<<
  31655. * 'sp:o': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31656. * 'c:spo': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31657. */
  31658. __pyx_t_1 = __Pyx_PyInt_From_int((MDB_DUPSORT | MDB_DUPFIXED)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 638, __pyx_L1_error)
  31659. __Pyx_GOTREF(__pyx_t_1);
  31660. if (PyDict_SetItem(__pyx_t_12, __pyx_kp_u_so_p, __pyx_t_1) < 0) __PYX_ERR(0, 634, __pyx_L1_error)
  31661. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  31662. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":639
  31663. * 'po:s': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31664. * 'so:p': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31665. * 'sp:o': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED, # <<<<<<<<<<<<<<
  31666. * 'c:spo': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31667. * 'spo:c': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31668. */
  31669. __pyx_t_1 = __Pyx_PyInt_From_int((MDB_DUPSORT | MDB_DUPFIXED)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 639, __pyx_L1_error)
  31670. __Pyx_GOTREF(__pyx_t_1);
  31671. if (PyDict_SetItem(__pyx_t_12, __pyx_kp_u_sp_o, __pyx_t_1) < 0) __PYX_ERR(0, 634, __pyx_L1_error)
  31672. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  31673. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":640
  31674. * 'so:p': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31675. * 'sp:o': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31676. * 'c:spo': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED, # <<<<<<<<<<<<<<
  31677. * 'spo:c': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31678. * }
  31679. */
  31680. __pyx_t_1 = __Pyx_PyInt_From_int((MDB_DUPSORT | MDB_DUPFIXED)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 640, __pyx_L1_error)
  31681. __Pyx_GOTREF(__pyx_t_1);
  31682. if (PyDict_SetItem(__pyx_t_12, __pyx_kp_u_c_spo, __pyx_t_1) < 0) __PYX_ERR(0, 634, __pyx_L1_error)
  31683. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  31684. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":641
  31685. * 'sp:o': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31686. * 'c:spo': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED,
  31687. * 'spo:c': lmdb.MDB_DUPSORT | lmdb.MDB_DUPFIXED, # <<<<<<<<<<<<<<
  31688. * }
  31689. *
  31690. */
  31691. __pyx_t_1 = __Pyx_PyInt_From_int((MDB_DUPSORT | MDB_DUPFIXED)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 641, __pyx_L1_error)
  31692. __Pyx_GOTREF(__pyx_t_1);
  31693. if (PyDict_SetItem(__pyx_t_12, __pyx_kp_u_spo_c, __pyx_t_1) < 0) __PYX_ERR(0, 634, __pyx_L1_error)
  31694. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  31695. if (PyDict_SetItem((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore->tp_dict, __pyx_n_s_dbi_flags, __pyx_t_12) < 0) __PYX_ERR(0, 633, __pyx_L1_error)
  31696. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  31697. PyType_Modified(__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore);
  31698. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":644
  31699. * }
  31700. *
  31701. * flags = 0 # <<<<<<<<<<<<<<
  31702. *
  31703. * options = {
  31704. */
  31705. if (PyDict_SetItem((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore->tp_dict, __pyx_n_s_flags, __pyx_int_0) < 0) __PYX_ERR(0, 644, __pyx_L1_error)
  31706. PyType_Modified(__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore);
  31707. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":647
  31708. *
  31709. * options = {
  31710. * 'map_size': 1024 ** 4 # 1Tb. # <<<<<<<<<<<<<<
  31711. * }
  31712. *
  31713. */
  31714. __pyx_t_12 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 647, __pyx_L1_error)
  31715. __Pyx_GOTREF(__pyx_t_12);
  31716. if (PyDict_SetItem(__pyx_t_12, __pyx_n_u_map_size, __pyx_int_1099511627776) < 0) __PYX_ERR(0, 647, __pyx_L1_error)
  31717. if (PyDict_SetItem((PyObject *)__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore->tp_dict, __pyx_n_s_options, __pyx_t_12) < 0) __PYX_ERR(0, 646, __pyx_L1_error)
  31718. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  31719. PyType_Modified(__pyx_ptype_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_LmdbTriplestore);
  31720. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1941
  31721. * cdef void _append(
  31722. * self, unsigned char *value, size_t vlen, Key *nkey,
  31723. * unsigned char *dblabel=b'', lmdb.MDB_txn *txn=NULL, # <<<<<<<<<<<<<<
  31724. * unsigned int flags=0) except *:
  31725. * """
  31726. */
  31727. __pyx_k__30 = ((unsigned char *)((char const *)""));
  31728. /* "(tree fragment)":1
  31729. * def __pyx_unpickle_SimpleGraph(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
  31730. * if __pyx_checksum != 0x8d777f3:
  31731. * from pickle import PickleError as __pyx_PickleError
  31732. */
  31733. __pyx_t_12 = PyCFunction_NewEx(&__pyx_mdef_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_3__pyx_unpickle_SimpleGraph, NULL, __pyx_n_s_lakesuperior_store_ldp_rs_lmdb_t); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1, __pyx_L1_error)
  31734. __Pyx_GOTREF(__pyx_t_12);
  31735. if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_SimpleGraph, __pyx_t_12) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  31736. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  31737. /* "(tree fragment)":9
  31738. * __pyx_unpickle_SimpleGraph__set_state(<SimpleGraph> __pyx_result, __pyx_state)
  31739. * return __pyx_result
  31740. * cdef __pyx_unpickle_SimpleGraph__set_state(SimpleGraph __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
  31741. * __pyx_result.data = __pyx_state[0]
  31742. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
  31743. */
  31744. __pyx_t_12 = PyCFunction_NewEx(&__pyx_mdef_12lakesuperior_5store_6ldp_rs_16lmdb_triplestore_5__pyx_unpickle_Imr, NULL, __pyx_n_s_lakesuperior_store_ldp_rs_lmdb_t); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1, __pyx_L1_error)
  31745. __Pyx_GOTREF(__pyx_t_12);
  31746. if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Imr, __pyx_t_12) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  31747. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  31748. /* "lakesuperior/store/ldp_rs/lmdb_triplestore.pyx":1
  31749. * import hashlib # <<<<<<<<<<<<<<
  31750. * import logging
  31751. * import os
  31752. */
  31753. __pyx_t_12 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1, __pyx_L1_error)
  31754. __Pyx_GOTREF(__pyx_t_12);
  31755. if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_12) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  31756. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  31757. __Pyx_TraceReturn(Py_None, 0);
  31758. /*--- Wrapped vars code ---*/
  31759. goto __pyx_L0;
  31760. __pyx_L1_error:;
  31761. __Pyx_XDECREF(__pyx_t_1);
  31762. __Pyx_XDECREF(__pyx_t_2);
  31763. __Pyx_XDECREF(__pyx_t_12);
  31764. __Pyx_XDECREF(__pyx_t_13);
  31765. __Pyx_XDECREF(__pyx_t_14);
  31766. if (__pyx_m) {
  31767. if (__pyx_d) {
  31768. __Pyx_AddTraceback("init lakesuperior.store.ldp_rs.lmdb_triplestore", 0, __pyx_lineno, __pyx_filename);
  31769. }
  31770. Py_DECREF(__pyx_m); __pyx_m = 0;
  31771. } else if (!PyErr_Occurred()) {
  31772. PyErr_SetString(PyExc_ImportError, "init lakesuperior.store.ldp_rs.lmdb_triplestore");
  31773. }
  31774. __pyx_L0:;
  31775. __Pyx_RefNannyFinishContext();
  31776. #if CYTHON_PEP489_MULTI_PHASE_INIT
  31777. return (__pyx_m != NULL) ? 0 : -1;
  31778. #elif PY_MAJOR_VERSION >= 3
  31779. return __pyx_m;
  31780. #else
  31781. return;
  31782. #endif
  31783. }
  31784. /* --- Runtime support code --- */
  31785. /* Refnanny */
  31786. #if CYTHON_REFNANNY
  31787. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
  31788. PyObject *m = NULL, *p = NULL;
  31789. void *r = NULL;
  31790. m = PyImport_ImportModule((char *)modname);
  31791. if (!m) goto end;
  31792. p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
  31793. if (!p) goto end;
  31794. r = PyLong_AsVoidPtr(p);
  31795. end:
  31796. Py_XDECREF(p);
  31797. Py_XDECREF(m);
  31798. return (__Pyx_RefNannyAPIStruct *)r;
  31799. }
  31800. #endif
  31801. /* PyObjectGetAttrStr */
  31802. #if CYTHON_USE_TYPE_SLOTS
  31803. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
  31804. PyTypeObject* tp = Py_TYPE(obj);
  31805. if (likely(tp->tp_getattro))
  31806. return tp->tp_getattro(obj, attr_name);
  31807. #if PY_MAJOR_VERSION < 3
  31808. if (likely(tp->tp_getattr))
  31809. return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
  31810. #endif
  31811. return PyObject_GetAttr(obj, attr_name);
  31812. }
  31813. #endif
  31814. /* GetBuiltinName */
  31815. static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
  31816. PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
  31817. if (unlikely(!result)) {
  31818. PyErr_Format(PyExc_NameError,
  31819. #if PY_MAJOR_VERSION >= 3
  31820. "name '%U' is not defined", name);
  31821. #else
  31822. "name '%.200s' is not defined", PyString_AS_STRING(name));
  31823. #endif
  31824. }
  31825. return result;
  31826. }
  31827. /* PyErrFetchRestore */
  31828. #if CYTHON_FAST_THREAD_STATE
  31829. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  31830. PyObject *tmp_type, *tmp_value, *tmp_tb;
  31831. tmp_type = tstate->curexc_type;
  31832. tmp_value = tstate->curexc_value;
  31833. tmp_tb = tstate->curexc_traceback;
  31834. tstate->curexc_type = type;
  31835. tstate->curexc_value = value;
  31836. tstate->curexc_traceback = tb;
  31837. Py_XDECREF(tmp_type);
  31838. Py_XDECREF(tmp_value);
  31839. Py_XDECREF(tmp_tb);
  31840. }
  31841. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  31842. *type = tstate->curexc_type;
  31843. *value = tstate->curexc_value;
  31844. *tb = tstate->curexc_traceback;
  31845. tstate->curexc_type = 0;
  31846. tstate->curexc_value = 0;
  31847. tstate->curexc_traceback = 0;
  31848. }
  31849. #endif
  31850. /* Profile */
  31851. #if CYTHON_PROFILE
  31852. static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
  31853. PyFrameObject** frame,
  31854. PyThreadState* tstate,
  31855. const char *funcname,
  31856. const char *srcfile,
  31857. int firstlineno) {
  31858. PyObject *type, *value, *traceback;
  31859. int retval;
  31860. if (*frame == NULL || !CYTHON_PROFILE_REUSE_FRAME) {
  31861. if (*code == NULL) {
  31862. *code = __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);
  31863. if (*code == NULL) return 0;
  31864. }
  31865. *frame = PyFrame_New(
  31866. tstate, /*PyThreadState *tstate*/
  31867. *code, /*PyCodeObject *code*/
  31868. __pyx_d, /*PyObject *globals*/
  31869. 0 /*PyObject *locals*/
  31870. );
  31871. if (*frame == NULL) return 0;
  31872. if (CYTHON_TRACE && (*frame)->f_trace == NULL) {
  31873. Py_INCREF(Py_None);
  31874. (*frame)->f_trace = Py_None;
  31875. }
  31876. #if PY_VERSION_HEX < 0x030400B1
  31877. } else {
  31878. (*frame)->f_tstate = tstate;
  31879. #endif
  31880. }
  31881. __Pyx_PyFrame_SetLineNumber(*frame, firstlineno);
  31882. retval = 1;
  31883. tstate->tracing++;
  31884. tstate->use_tracing = 0;
  31885. __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
  31886. #if CYTHON_TRACE
  31887. if (tstate->c_tracefunc)
  31888. retval = tstate->c_tracefunc(tstate->c_traceobj, *frame, PyTrace_CALL, NULL) == 0;
  31889. if (retval && tstate->c_profilefunc)
  31890. #endif
  31891. retval = tstate->c_profilefunc(tstate->c_profileobj, *frame, PyTrace_CALL, NULL) == 0;
  31892. tstate->use_tracing = (tstate->c_profilefunc ||
  31893. (CYTHON_TRACE && tstate->c_tracefunc));
  31894. tstate->tracing--;
  31895. if (retval) {
  31896. __Pyx_ErrRestoreInState(tstate, type, value, traceback);
  31897. return tstate->use_tracing && retval;
  31898. } else {
  31899. Py_XDECREF(type);
  31900. Py_XDECREF(value);
  31901. Py_XDECREF(traceback);
  31902. return -1;
  31903. }
  31904. }
  31905. static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno) {
  31906. PyObject *py_srcfile = 0;
  31907. PyObject *py_funcname = 0;
  31908. PyCodeObject *py_code = 0;
  31909. #if PY_MAJOR_VERSION < 3
  31910. py_funcname = PyString_FromString(funcname);
  31911. py_srcfile = PyString_FromString(srcfile);
  31912. #else
  31913. py_funcname = PyUnicode_FromString(funcname);
  31914. py_srcfile = PyUnicode_FromString(srcfile);
  31915. #endif
  31916. if (!py_funcname | !py_srcfile) goto bad;
  31917. py_code = PyCode_New(
  31918. 0,
  31919. #if PY_MAJOR_VERSION >= 3
  31920. 0,
  31921. #endif
  31922. 0,
  31923. 0,
  31924. CO_OPTIMIZED | CO_NEWLOCALS,
  31925. __pyx_empty_bytes, /*PyObject *code,*/
  31926. __pyx_empty_tuple, /*PyObject *consts,*/
  31927. __pyx_empty_tuple, /*PyObject *names,*/
  31928. __pyx_empty_tuple, /*PyObject *varnames,*/
  31929. __pyx_empty_tuple, /*PyObject *freevars,*/
  31930. __pyx_empty_tuple, /*PyObject *cellvars,*/
  31931. py_srcfile, /*PyObject *filename,*/
  31932. py_funcname, /*PyObject *name,*/
  31933. firstlineno,
  31934. __pyx_empty_bytes /*PyObject *lnotab*/
  31935. );
  31936. bad:
  31937. Py_XDECREF(py_srcfile);
  31938. Py_XDECREF(py_funcname);
  31939. return py_code;
  31940. }
  31941. #endif
  31942. /* WriteUnraisableException */
  31943. static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
  31944. CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
  31945. int full_traceback, CYTHON_UNUSED int nogil) {
  31946. PyObject *old_exc, *old_val, *old_tb;
  31947. PyObject *ctx;
  31948. __Pyx_PyThreadState_declare
  31949. #ifdef WITH_THREAD
  31950. PyGILState_STATE state;
  31951. if (nogil)
  31952. state = PyGILState_Ensure();
  31953. #ifdef _MSC_VER
  31954. else state = (PyGILState_STATE)-1;
  31955. #endif
  31956. #endif
  31957. __Pyx_PyThreadState_assign
  31958. __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
  31959. if (full_traceback) {
  31960. Py_XINCREF(old_exc);
  31961. Py_XINCREF(old_val);
  31962. Py_XINCREF(old_tb);
  31963. __Pyx_ErrRestore(old_exc, old_val, old_tb);
  31964. PyErr_PrintEx(1);
  31965. }
  31966. #if PY_MAJOR_VERSION < 3
  31967. ctx = PyString_FromString(name);
  31968. #else
  31969. ctx = PyUnicode_FromString(name);
  31970. #endif
  31971. __Pyx_ErrRestore(old_exc, old_val, old_tb);
  31972. if (!ctx) {
  31973. PyErr_WriteUnraisable(Py_None);
  31974. } else {
  31975. PyErr_WriteUnraisable(ctx);
  31976. Py_DECREF(ctx);
  31977. }
  31978. #ifdef WITH_THREAD
  31979. if (nogil)
  31980. PyGILState_Release(state);
  31981. #endif
  31982. }
  31983. /* RaiseArgTupleInvalid */
  31984. static void __Pyx_RaiseArgtupleInvalid(
  31985. const char* func_name,
  31986. int exact,
  31987. Py_ssize_t num_min,
  31988. Py_ssize_t num_max,
  31989. Py_ssize_t num_found)
  31990. {
  31991. Py_ssize_t num_expected;
  31992. const char *more_or_less;
  31993. if (num_found < num_min) {
  31994. num_expected = num_min;
  31995. more_or_less = "at least";
  31996. } else {
  31997. num_expected = num_max;
  31998. more_or_less = "at most";
  31999. }
  32000. if (exact) {
  32001. more_or_less = "exactly";
  32002. }
  32003. PyErr_Format(PyExc_TypeError,
  32004. "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
  32005. func_name, more_or_less, num_expected,
  32006. (num_expected == 1) ? "" : "s", num_found);
  32007. }
  32008. /* RaiseDoubleKeywords */
  32009. static void __Pyx_RaiseDoubleKeywordsError(
  32010. const char* func_name,
  32011. PyObject* kw_name)
  32012. {
  32013. PyErr_Format(PyExc_TypeError,
  32014. #if PY_MAJOR_VERSION >= 3
  32015. "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
  32016. #else
  32017. "%s() got multiple values for keyword argument '%s'", func_name,
  32018. PyString_AsString(kw_name));
  32019. #endif
  32020. }
  32021. /* ParseKeywords */
  32022. static int __Pyx_ParseOptionalKeywords(
  32023. PyObject *kwds,
  32024. PyObject **argnames[],
  32025. PyObject *kwds2,
  32026. PyObject *values[],
  32027. Py_ssize_t num_pos_args,
  32028. const char* function_name)
  32029. {
  32030. PyObject *key = 0, *value = 0;
  32031. Py_ssize_t pos = 0;
  32032. PyObject*** name;
  32033. PyObject*** first_kw_arg = argnames + num_pos_args;
  32034. while (PyDict_Next(kwds, &pos, &key, &value)) {
  32035. name = first_kw_arg;
  32036. while (*name && (**name != key)) name++;
  32037. if (*name) {
  32038. values[name-argnames] = value;
  32039. continue;
  32040. }
  32041. name = first_kw_arg;
  32042. #if PY_MAJOR_VERSION < 3
  32043. if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
  32044. while (*name) {
  32045. if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
  32046. && _PyString_Eq(**name, key)) {
  32047. values[name-argnames] = value;
  32048. break;
  32049. }
  32050. name++;
  32051. }
  32052. if (*name) continue;
  32053. else {
  32054. PyObject*** argname = argnames;
  32055. while (argname != first_kw_arg) {
  32056. if ((**argname == key) || (
  32057. (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
  32058. && _PyString_Eq(**argname, key))) {
  32059. goto arg_passed_twice;
  32060. }
  32061. argname++;
  32062. }
  32063. }
  32064. } else
  32065. #endif
  32066. if (likely(PyUnicode_Check(key))) {
  32067. while (*name) {
  32068. int cmp = (**name == key) ? 0 :
  32069. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  32070. (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
  32071. #endif
  32072. PyUnicode_Compare(**name, key);
  32073. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  32074. if (cmp == 0) {
  32075. values[name-argnames] = value;
  32076. break;
  32077. }
  32078. name++;
  32079. }
  32080. if (*name) continue;
  32081. else {
  32082. PyObject*** argname = argnames;
  32083. while (argname != first_kw_arg) {
  32084. int cmp = (**argname == key) ? 0 :
  32085. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  32086. (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
  32087. #endif
  32088. PyUnicode_Compare(**argname, key);
  32089. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  32090. if (cmp == 0) goto arg_passed_twice;
  32091. argname++;
  32092. }
  32093. }
  32094. } else
  32095. goto invalid_keyword_type;
  32096. if (kwds2) {
  32097. if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
  32098. } else {
  32099. goto invalid_keyword;
  32100. }
  32101. }
  32102. return 0;
  32103. arg_passed_twice:
  32104. __Pyx_RaiseDoubleKeywordsError(function_name, key);
  32105. goto bad;
  32106. invalid_keyword_type:
  32107. PyErr_Format(PyExc_TypeError,
  32108. "%.200s() keywords must be strings", function_name);
  32109. goto bad;
  32110. invalid_keyword:
  32111. PyErr_Format(PyExc_TypeError,
  32112. #if PY_MAJOR_VERSION < 3
  32113. "%.200s() got an unexpected keyword argument '%.200s'",
  32114. function_name, PyString_AsString(key));
  32115. #else
  32116. "%s() got an unexpected keyword argument '%U'",
  32117. function_name, key);
  32118. #endif
  32119. bad:
  32120. return -1;
  32121. }
  32122. /* None */
  32123. static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
  32124. PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
  32125. }
  32126. /* PyObjectCall */
  32127. #if CYTHON_COMPILING_IN_CPYTHON
  32128. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  32129. PyObject *result;
  32130. ternaryfunc call = func->ob_type->tp_call;
  32131. if (unlikely(!call))
  32132. return PyObject_Call(func, arg, kw);
  32133. if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
  32134. return NULL;
  32135. result = (*call)(func, arg, kw);
  32136. Py_LeaveRecursiveCall();
  32137. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  32138. PyErr_SetString(
  32139. PyExc_SystemError,
  32140. "NULL result without error in PyObject_Call");
  32141. }
  32142. return result;
  32143. }
  32144. #endif
  32145. /* RaiseException */
  32146. #if PY_MAJOR_VERSION < 3
  32147. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
  32148. CYTHON_UNUSED PyObject *cause) {
  32149. __Pyx_PyThreadState_declare
  32150. Py_XINCREF(type);
  32151. if (!value || value == Py_None)
  32152. value = NULL;
  32153. else
  32154. Py_INCREF(value);
  32155. if (!tb || tb == Py_None)
  32156. tb = NULL;
  32157. else {
  32158. Py_INCREF(tb);
  32159. if (!PyTraceBack_Check(tb)) {
  32160. PyErr_SetString(PyExc_TypeError,
  32161. "raise: arg 3 must be a traceback or None");
  32162. goto raise_error;
  32163. }
  32164. }
  32165. if (PyType_Check(type)) {
  32166. #if CYTHON_COMPILING_IN_PYPY
  32167. if (!value) {
  32168. Py_INCREF(Py_None);
  32169. value = Py_None;
  32170. }
  32171. #endif
  32172. PyErr_NormalizeException(&type, &value, &tb);
  32173. } else {
  32174. if (value) {
  32175. PyErr_SetString(PyExc_TypeError,
  32176. "instance exception may not have a separate value");
  32177. goto raise_error;
  32178. }
  32179. value = type;
  32180. type = (PyObject*) Py_TYPE(type);
  32181. Py_INCREF(type);
  32182. if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
  32183. PyErr_SetString(PyExc_TypeError,
  32184. "raise: exception class must be a subclass of BaseException");
  32185. goto raise_error;
  32186. }
  32187. }
  32188. __Pyx_PyThreadState_assign
  32189. __Pyx_ErrRestore(type, value, tb);
  32190. return;
  32191. raise_error:
  32192. Py_XDECREF(value);
  32193. Py_XDECREF(type);
  32194. Py_XDECREF(tb);
  32195. return;
  32196. }
  32197. #else
  32198. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
  32199. PyObject* owned_instance = NULL;
  32200. if (tb == Py_None) {
  32201. tb = 0;
  32202. } else if (tb && !PyTraceBack_Check(tb)) {
  32203. PyErr_SetString(PyExc_TypeError,
  32204. "raise: arg 3 must be a traceback or None");
  32205. goto bad;
  32206. }
  32207. if (value == Py_None)
  32208. value = 0;
  32209. if (PyExceptionInstance_Check(type)) {
  32210. if (value) {
  32211. PyErr_SetString(PyExc_TypeError,
  32212. "instance exception may not have a separate value");
  32213. goto bad;
  32214. }
  32215. value = type;
  32216. type = (PyObject*) Py_TYPE(value);
  32217. } else if (PyExceptionClass_Check(type)) {
  32218. PyObject *instance_class = NULL;
  32219. if (value && PyExceptionInstance_Check(value)) {
  32220. instance_class = (PyObject*) Py_TYPE(value);
  32221. if (instance_class != type) {
  32222. int is_subclass = PyObject_IsSubclass(instance_class, type);
  32223. if (!is_subclass) {
  32224. instance_class = NULL;
  32225. } else if (unlikely(is_subclass == -1)) {
  32226. goto bad;
  32227. } else {
  32228. type = instance_class;
  32229. }
  32230. }
  32231. }
  32232. if (!instance_class) {
  32233. PyObject *args;
  32234. if (!value)
  32235. args = PyTuple_New(0);
  32236. else if (PyTuple_Check(value)) {
  32237. Py_INCREF(value);
  32238. args = value;
  32239. } else
  32240. args = PyTuple_Pack(1, value);
  32241. if (!args)
  32242. goto bad;
  32243. owned_instance = PyObject_Call(type, args, NULL);
  32244. Py_DECREF(args);
  32245. if (!owned_instance)
  32246. goto bad;
  32247. value = owned_instance;
  32248. if (!PyExceptionInstance_Check(value)) {
  32249. PyErr_Format(PyExc_TypeError,
  32250. "calling %R should have returned an instance of "
  32251. "BaseException, not %R",
  32252. type, Py_TYPE(value));
  32253. goto bad;
  32254. }
  32255. }
  32256. } else {
  32257. PyErr_SetString(PyExc_TypeError,
  32258. "raise: exception class must be a subclass of BaseException");
  32259. goto bad;
  32260. }
  32261. if (cause) {
  32262. PyObject *fixed_cause;
  32263. if (cause == Py_None) {
  32264. fixed_cause = NULL;
  32265. } else if (PyExceptionClass_Check(cause)) {
  32266. fixed_cause = PyObject_CallObject(cause, NULL);
  32267. if (fixed_cause == NULL)
  32268. goto bad;
  32269. } else if (PyExceptionInstance_Check(cause)) {
  32270. fixed_cause = cause;
  32271. Py_INCREF(fixed_cause);
  32272. } else {
  32273. PyErr_SetString(PyExc_TypeError,
  32274. "exception causes must derive from "
  32275. "BaseException");
  32276. goto bad;
  32277. }
  32278. PyException_SetCause(value, fixed_cause);
  32279. }
  32280. PyErr_SetObject(type, value);
  32281. if (tb) {
  32282. #if CYTHON_COMPILING_IN_PYPY
  32283. PyObject *tmp_type, *tmp_value, *tmp_tb;
  32284. PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
  32285. Py_INCREF(tb);
  32286. PyErr_Restore(tmp_type, tmp_value, tb);
  32287. Py_XDECREF(tmp_tb);
  32288. #else
  32289. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  32290. PyObject* tmp_tb = tstate->curexc_traceback;
  32291. if (tb != tmp_tb) {
  32292. Py_INCREF(tb);
  32293. tstate->curexc_traceback = tb;
  32294. Py_XDECREF(tmp_tb);
  32295. }
  32296. #endif
  32297. }
  32298. bad:
  32299. Py_XDECREF(owned_instance);
  32300. return;
  32301. }
  32302. #endif
  32303. /* GetModuleGlobalName */
  32304. static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
  32305. PyObject *result;
  32306. #if !CYTHON_AVOID_BORROWED_REFS
  32307. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
  32308. result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
  32309. if (likely(result)) {
  32310. Py_INCREF(result);
  32311. } else if (unlikely(PyErr_Occurred())) {
  32312. result = NULL;
  32313. } else {
  32314. #else
  32315. result = PyDict_GetItem(__pyx_d, name);
  32316. if (likely(result)) {
  32317. Py_INCREF(result);
  32318. } else {
  32319. #endif
  32320. #else
  32321. result = PyObject_GetItem(__pyx_d, name);
  32322. if (!result) {
  32323. PyErr_Clear();
  32324. #endif
  32325. result = __Pyx_GetBuiltinName(name);
  32326. }
  32327. return result;
  32328. }
  32329. /* PyCFunctionFastCall */
  32330. #if CYTHON_FAST_PYCCALL
  32331. static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
  32332. PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
  32333. PyCFunction meth = PyCFunction_GET_FUNCTION(func);
  32334. PyObject *self = PyCFunction_GET_SELF(func);
  32335. int flags = PyCFunction_GET_FLAGS(func);
  32336. assert(PyCFunction_Check(func));
  32337. assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS)));
  32338. assert(nargs >= 0);
  32339. assert(nargs == 0 || args != NULL);
  32340. /* _PyCFunction_FastCallDict() must not be called with an exception set,
  32341. because it may clear it (directly or indirectly) and so the
  32342. caller loses its exception */
  32343. assert(!PyErr_Occurred());
  32344. if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
  32345. return (*((__Pyx_PyCFunctionFastWithKeywords)meth)) (self, args, nargs, NULL);
  32346. } else {
  32347. return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs);
  32348. }
  32349. }
  32350. #endif
  32351. /* PyFunctionFastCall */
  32352. #if CYTHON_FAST_PYCALL
  32353. #include "frameobject.h"
  32354. static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
  32355. PyObject *globals) {
  32356. PyFrameObject *f;
  32357. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  32358. PyObject **fastlocals;
  32359. Py_ssize_t i;
  32360. PyObject *result;
  32361. assert(globals != NULL);
  32362. /* XXX Perhaps we should create a specialized
  32363. PyFrame_New() that doesn't take locals, but does
  32364. take builtins without sanity checking them.
  32365. */
  32366. assert(tstate != NULL);
  32367. f = PyFrame_New(tstate, co, globals, NULL);
  32368. if (f == NULL) {
  32369. return NULL;
  32370. }
  32371. fastlocals = f->f_localsplus;
  32372. for (i = 0; i < na; i++) {
  32373. Py_INCREF(*args);
  32374. fastlocals[i] = *args++;
  32375. }
  32376. result = PyEval_EvalFrameEx(f,0);
  32377. ++tstate->recursion_depth;
  32378. Py_DECREF(f);
  32379. --tstate->recursion_depth;
  32380. return result;
  32381. }
  32382. #if 1 || PY_VERSION_HEX < 0x030600B1
  32383. static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
  32384. PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
  32385. PyObject *globals = PyFunction_GET_GLOBALS(func);
  32386. PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
  32387. PyObject *closure;
  32388. #if PY_MAJOR_VERSION >= 3
  32389. PyObject *kwdefs;
  32390. #endif
  32391. PyObject *kwtuple, **k;
  32392. PyObject **d;
  32393. Py_ssize_t nd;
  32394. Py_ssize_t nk;
  32395. PyObject *result;
  32396. assert(kwargs == NULL || PyDict_Check(kwargs));
  32397. nk = kwargs ? PyDict_Size(kwargs) : 0;
  32398. if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
  32399. return NULL;
  32400. }
  32401. if (
  32402. #if PY_MAJOR_VERSION >= 3
  32403. co->co_kwonlyargcount == 0 &&
  32404. #endif
  32405. likely(kwargs == NULL || nk == 0) &&
  32406. co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
  32407. if (argdefs == NULL && co->co_argcount == nargs) {
  32408. result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
  32409. goto done;
  32410. }
  32411. else if (nargs == 0 && argdefs != NULL
  32412. && co->co_argcount == Py_SIZE(argdefs)) {
  32413. /* function called with no arguments, but all parameters have
  32414. a default value: use default values as arguments .*/
  32415. args = &PyTuple_GET_ITEM(argdefs, 0);
  32416. result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
  32417. goto done;
  32418. }
  32419. }
  32420. if (kwargs != NULL) {
  32421. Py_ssize_t pos, i;
  32422. kwtuple = PyTuple_New(2 * nk);
  32423. if (kwtuple == NULL) {
  32424. result = NULL;
  32425. goto done;
  32426. }
  32427. k = &PyTuple_GET_ITEM(kwtuple, 0);
  32428. pos = i = 0;
  32429. while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
  32430. Py_INCREF(k[i]);
  32431. Py_INCREF(k[i+1]);
  32432. i += 2;
  32433. }
  32434. nk = i / 2;
  32435. }
  32436. else {
  32437. kwtuple = NULL;
  32438. k = NULL;
  32439. }
  32440. closure = PyFunction_GET_CLOSURE(func);
  32441. #if PY_MAJOR_VERSION >= 3
  32442. kwdefs = PyFunction_GET_KW_DEFAULTS(func);
  32443. #endif
  32444. if (argdefs != NULL) {
  32445. d = &PyTuple_GET_ITEM(argdefs, 0);
  32446. nd = Py_SIZE(argdefs);
  32447. }
  32448. else {
  32449. d = NULL;
  32450. nd = 0;
  32451. }
  32452. #if PY_MAJOR_VERSION >= 3
  32453. result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
  32454. args, nargs,
  32455. k, (int)nk,
  32456. d, (int)nd, kwdefs, closure);
  32457. #else
  32458. result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
  32459. args, nargs,
  32460. k, (int)nk,
  32461. d, (int)nd, closure);
  32462. #endif
  32463. Py_XDECREF(kwtuple);
  32464. done:
  32465. Py_LeaveRecursiveCall();
  32466. return result;
  32467. }
  32468. #endif
  32469. #endif
  32470. /* PyObjectCallMethO */
  32471. #if CYTHON_COMPILING_IN_CPYTHON
  32472. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
  32473. PyObject *self, *result;
  32474. PyCFunction cfunc;
  32475. cfunc = PyCFunction_GET_FUNCTION(func);
  32476. self = PyCFunction_GET_SELF(func);
  32477. if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
  32478. return NULL;
  32479. result = cfunc(self, arg);
  32480. Py_LeaveRecursiveCall();
  32481. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  32482. PyErr_SetString(
  32483. PyExc_SystemError,
  32484. "NULL result without error in PyObject_Call");
  32485. }
  32486. return result;
  32487. }
  32488. #endif
  32489. /* PyObjectCallOneArg */
  32490. #if CYTHON_COMPILING_IN_CPYTHON
  32491. static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  32492. PyObject *result;
  32493. PyObject *args = PyTuple_New(1);
  32494. if (unlikely(!args)) return NULL;
  32495. Py_INCREF(arg);
  32496. PyTuple_SET_ITEM(args, 0, arg);
  32497. result = __Pyx_PyObject_Call(func, args, NULL);
  32498. Py_DECREF(args);
  32499. return result;
  32500. }
  32501. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  32502. #if CYTHON_FAST_PYCALL
  32503. if (PyFunction_Check(func)) {
  32504. return __Pyx_PyFunction_FastCall(func, &arg, 1);
  32505. }
  32506. #endif
  32507. if (likely(PyCFunction_Check(func))) {
  32508. if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
  32509. return __Pyx_PyObject_CallMethO(func, arg);
  32510. #if CYTHON_FAST_PYCCALL
  32511. } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
  32512. return __Pyx_PyCFunction_FastCall(func, &arg, 1);
  32513. #endif
  32514. }
  32515. }
  32516. return __Pyx__PyObject_CallOneArg(func, arg);
  32517. }
  32518. #else
  32519. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  32520. PyObject *result;
  32521. PyObject *args = PyTuple_Pack(1, arg);
  32522. if (unlikely(!args)) return NULL;
  32523. result = __Pyx_PyObject_Call(func, args, NULL);
  32524. Py_DECREF(args);
  32525. return result;
  32526. }
  32527. #endif
  32528. /* FetchCommonType */
  32529. static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
  32530. PyObject* fake_module;
  32531. PyTypeObject* cached_type = NULL;
  32532. fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
  32533. if (!fake_module) return NULL;
  32534. Py_INCREF(fake_module);
  32535. cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
  32536. if (cached_type) {
  32537. if (!PyType_Check((PyObject*)cached_type)) {
  32538. PyErr_Format(PyExc_TypeError,
  32539. "Shared Cython type %.200s is not a type object",
  32540. type->tp_name);
  32541. goto bad;
  32542. }
  32543. if (cached_type->tp_basicsize != type->tp_basicsize) {
  32544. PyErr_Format(PyExc_TypeError,
  32545. "Shared Cython type %.200s has the wrong size, try recompiling",
  32546. type->tp_name);
  32547. goto bad;
  32548. }
  32549. } else {
  32550. if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
  32551. PyErr_Clear();
  32552. if (PyType_Ready(type) < 0) goto bad;
  32553. if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
  32554. goto bad;
  32555. Py_INCREF(type);
  32556. cached_type = type;
  32557. }
  32558. done:
  32559. Py_DECREF(fake_module);
  32560. return cached_type;
  32561. bad:
  32562. Py_XDECREF(cached_type);
  32563. cached_type = NULL;
  32564. goto done;
  32565. }
  32566. /* CythonFunction */
  32567. #include <structmember.h>
  32568. static PyObject *
  32569. __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
  32570. {
  32571. if (unlikely(op->func_doc == NULL)) {
  32572. if (op->func.m_ml->ml_doc) {
  32573. #if PY_MAJOR_VERSION >= 3
  32574. op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
  32575. #else
  32576. op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
  32577. #endif
  32578. if (unlikely(op->func_doc == NULL))
  32579. return NULL;
  32580. } else {
  32581. Py_INCREF(Py_None);
  32582. return Py_None;
  32583. }
  32584. }
  32585. Py_INCREF(op->func_doc);
  32586. return op->func_doc;
  32587. }
  32588. static int
  32589. __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
  32590. {
  32591. PyObject *tmp = op->func_doc;
  32592. if (value == NULL) {
  32593. value = Py_None;
  32594. }
  32595. Py_INCREF(value);
  32596. op->func_doc = value;
  32597. Py_XDECREF(tmp);
  32598. return 0;
  32599. }
  32600. static PyObject *
  32601. __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
  32602. {
  32603. if (unlikely(op->func_name == NULL)) {
  32604. #if PY_MAJOR_VERSION >= 3
  32605. op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
  32606. #else
  32607. op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
  32608. #endif
  32609. if (unlikely(op->func_name == NULL))
  32610. return NULL;
  32611. }
  32612. Py_INCREF(op->func_name);
  32613. return op->func_name;
  32614. }
  32615. static int
  32616. __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
  32617. {
  32618. PyObject *tmp;
  32619. #if PY_MAJOR_VERSION >= 3
  32620. if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  32621. #else
  32622. if (unlikely(value == NULL || !PyString_Check(value))) {
  32623. #endif
  32624. PyErr_SetString(PyExc_TypeError,
  32625. "__name__ must be set to a string object");
  32626. return -1;
  32627. }
  32628. tmp = op->func_name;
  32629. Py_INCREF(value);
  32630. op->func_name = value;
  32631. Py_XDECREF(tmp);
  32632. return 0;
  32633. }
  32634. static PyObject *
  32635. __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op)
  32636. {
  32637. Py_INCREF(op->func_qualname);
  32638. return op->func_qualname;
  32639. }
  32640. static int
  32641. __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value)
  32642. {
  32643. PyObject *tmp;
  32644. #if PY_MAJOR_VERSION >= 3
  32645. if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  32646. #else
  32647. if (unlikely(value == NULL || !PyString_Check(value))) {
  32648. #endif
  32649. PyErr_SetString(PyExc_TypeError,
  32650. "__qualname__ must be set to a string object");
  32651. return -1;
  32652. }
  32653. tmp = op->func_qualname;
  32654. Py_INCREF(value);
  32655. op->func_qualname = value;
  32656. Py_XDECREF(tmp);
  32657. return 0;
  32658. }
  32659. static PyObject *
  32660. __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
  32661. {
  32662. PyObject *self;
  32663. self = m->func_closure;
  32664. if (self == NULL)
  32665. self = Py_None;
  32666. Py_INCREF(self);
  32667. return self;
  32668. }
  32669. static PyObject *
  32670. __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
  32671. {
  32672. if (unlikely(op->func_dict == NULL)) {
  32673. op->func_dict = PyDict_New();
  32674. if (unlikely(op->func_dict == NULL))
  32675. return NULL;
  32676. }
  32677. Py_INCREF(op->func_dict);
  32678. return op->func_dict;
  32679. }
  32680. static int
  32681. __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
  32682. {
  32683. PyObject *tmp;
  32684. if (unlikely(value == NULL)) {
  32685. PyErr_SetString(PyExc_TypeError,
  32686. "function's dictionary may not be deleted");
  32687. return -1;
  32688. }
  32689. if (unlikely(!PyDict_Check(value))) {
  32690. PyErr_SetString(PyExc_TypeError,
  32691. "setting function's dictionary to a non-dict");
  32692. return -1;
  32693. }
  32694. tmp = op->func_dict;
  32695. Py_INCREF(value);
  32696. op->func_dict = value;
  32697. Py_XDECREF(tmp);
  32698. return 0;
  32699. }
  32700. static PyObject *
  32701. __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op)
  32702. {
  32703. Py_INCREF(op->func_globals);
  32704. return op->func_globals;
  32705. }
  32706. static PyObject *
  32707. __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
  32708. {
  32709. Py_INCREF(Py_None);
  32710. return Py_None;
  32711. }
  32712. static PyObject *
  32713. __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
  32714. {
  32715. PyObject* result = (op->func_code) ? op->func_code : Py_None;
  32716. Py_INCREF(result);
  32717. return result;
  32718. }
  32719. static int
  32720. __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
  32721. int result = 0;
  32722. PyObject *res = op->defaults_getter((PyObject *) op);
  32723. if (unlikely(!res))
  32724. return -1;
  32725. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  32726. op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
  32727. Py_INCREF(op->defaults_tuple);
  32728. op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
  32729. Py_INCREF(op->defaults_kwdict);
  32730. #else
  32731. op->defaults_tuple = PySequence_ITEM(res, 0);
  32732. if (unlikely(!op->defaults_tuple)) result = -1;
  32733. else {
  32734. op->defaults_kwdict = PySequence_ITEM(res, 1);
  32735. if (unlikely(!op->defaults_kwdict)) result = -1;
  32736. }
  32737. #endif
  32738. Py_DECREF(res);
  32739. return result;
  32740. }
  32741. static int
  32742. __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
  32743. PyObject* tmp;
  32744. if (!value) {
  32745. value = Py_None;
  32746. } else if (value != Py_None && !PyTuple_Check(value)) {
  32747. PyErr_SetString(PyExc_TypeError,
  32748. "__defaults__ must be set to a tuple object");
  32749. return -1;
  32750. }
  32751. Py_INCREF(value);
  32752. tmp = op->defaults_tuple;
  32753. op->defaults_tuple = value;
  32754. Py_XDECREF(tmp);
  32755. return 0;
  32756. }
  32757. static PyObject *
  32758. __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
  32759. PyObject* result = op->defaults_tuple;
  32760. if (unlikely(!result)) {
  32761. if (op->defaults_getter) {
  32762. if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
  32763. result = op->defaults_tuple;
  32764. } else {
  32765. result = Py_None;
  32766. }
  32767. }
  32768. Py_INCREF(result);
  32769. return result;
  32770. }
  32771. static int
  32772. __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
  32773. PyObject* tmp;
  32774. if (!value) {
  32775. value = Py_None;
  32776. } else if (value != Py_None && !PyDict_Check(value)) {
  32777. PyErr_SetString(PyExc_TypeError,
  32778. "__kwdefaults__ must be set to a dict object");
  32779. return -1;
  32780. }
  32781. Py_INCREF(value);
  32782. tmp = op->defaults_kwdict;
  32783. op->defaults_kwdict = value;
  32784. Py_XDECREF(tmp);
  32785. return 0;
  32786. }
  32787. static PyObject *
  32788. __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
  32789. PyObject* result = op->defaults_kwdict;
  32790. if (unlikely(!result)) {
  32791. if (op->defaults_getter) {
  32792. if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
  32793. result = op->defaults_kwdict;
  32794. } else {
  32795. result = Py_None;
  32796. }
  32797. }
  32798. Py_INCREF(result);
  32799. return result;
  32800. }
  32801. static int
  32802. __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
  32803. PyObject* tmp;
  32804. if (!value || value == Py_None) {
  32805. value = NULL;
  32806. } else if (!PyDict_Check(value)) {
  32807. PyErr_SetString(PyExc_TypeError,
  32808. "__annotations__ must be set to a dict object");
  32809. return -1;
  32810. }
  32811. Py_XINCREF(value);
  32812. tmp = op->func_annotations;
  32813. op->func_annotations = value;
  32814. Py_XDECREF(tmp);
  32815. return 0;
  32816. }
  32817. static PyObject *
  32818. __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
  32819. PyObject* result = op->func_annotations;
  32820. if (unlikely(!result)) {
  32821. result = PyDict_New();
  32822. if (unlikely(!result)) return NULL;
  32823. op->func_annotations = result;
  32824. }
  32825. Py_INCREF(result);
  32826. return result;
  32827. }
  32828. static PyGetSetDef __pyx_CyFunction_getsets[] = {
  32829. {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
  32830. {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
  32831. {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
  32832. {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
  32833. {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
  32834. {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
  32835. {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
  32836. {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
  32837. {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
  32838. {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
  32839. {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
  32840. {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
  32841. {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
  32842. {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
  32843. {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
  32844. {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
  32845. {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
  32846. {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
  32847. {0, 0, 0, 0, 0}
  32848. };
  32849. static PyMemberDef __pyx_CyFunction_members[] = {
  32850. {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
  32851. {0, 0, 0, 0, 0}
  32852. };
  32853. static PyObject *
  32854. __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
  32855. {
  32856. #if PY_MAJOR_VERSION >= 3
  32857. return PyUnicode_FromString(m->func.m_ml->ml_name);
  32858. #else
  32859. return PyString_FromString(m->func.m_ml->ml_name);
  32860. #endif
  32861. }
  32862. static PyMethodDef __pyx_CyFunction_methods[] = {
  32863. {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
  32864. {0, 0, 0, 0}
  32865. };
  32866. #if PY_VERSION_HEX < 0x030500A0
  32867. #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
  32868. #else
  32869. #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
  32870. #endif
  32871. static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
  32872. PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
  32873. __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
  32874. if (op == NULL)
  32875. return NULL;
  32876. op->flags = flags;
  32877. __Pyx_CyFunction_weakreflist(op) = NULL;
  32878. op->func.m_ml = ml;
  32879. op->func.m_self = (PyObject *) op;
  32880. Py_XINCREF(closure);
  32881. op->func_closure = closure;
  32882. Py_XINCREF(module);
  32883. op->func.m_module = module;
  32884. op->func_dict = NULL;
  32885. op->func_name = NULL;
  32886. Py_INCREF(qualname);
  32887. op->func_qualname = qualname;
  32888. op->func_doc = NULL;
  32889. op->func_classobj = NULL;
  32890. op->func_globals = globals;
  32891. Py_INCREF(op->func_globals);
  32892. Py_XINCREF(code);
  32893. op->func_code = code;
  32894. op->defaults_pyobjects = 0;
  32895. op->defaults = NULL;
  32896. op->defaults_tuple = NULL;
  32897. op->defaults_kwdict = NULL;
  32898. op->defaults_getter = NULL;
  32899. op->func_annotations = NULL;
  32900. PyObject_GC_Track(op);
  32901. return (PyObject *) op;
  32902. }
  32903. static int
  32904. __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
  32905. {
  32906. Py_CLEAR(m->func_closure);
  32907. Py_CLEAR(m->func.m_module);
  32908. Py_CLEAR(m->func_dict);
  32909. Py_CLEAR(m->func_name);
  32910. Py_CLEAR(m->func_qualname);
  32911. Py_CLEAR(m->func_doc);
  32912. Py_CLEAR(m->func_globals);
  32913. Py_CLEAR(m->func_code);
  32914. Py_CLEAR(m->func_classobj);
  32915. Py_CLEAR(m->defaults_tuple);
  32916. Py_CLEAR(m->defaults_kwdict);
  32917. Py_CLEAR(m->func_annotations);
  32918. if (m->defaults) {
  32919. PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
  32920. int i;
  32921. for (i = 0; i < m->defaults_pyobjects; i++)
  32922. Py_XDECREF(pydefaults[i]);
  32923. PyObject_Free(m->defaults);
  32924. m->defaults = NULL;
  32925. }
  32926. return 0;
  32927. }
  32928. static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
  32929. {
  32930. if (__Pyx_CyFunction_weakreflist(m) != NULL)
  32931. PyObject_ClearWeakRefs((PyObject *) m);
  32932. __Pyx_CyFunction_clear(m);
  32933. PyObject_GC_Del(m);
  32934. }
  32935. static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
  32936. {
  32937. PyObject_GC_UnTrack(m);
  32938. __Pyx__CyFunction_dealloc(m);
  32939. }
  32940. static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
  32941. {
  32942. Py_VISIT(m->func_closure);
  32943. Py_VISIT(m->func.m_module);
  32944. Py_VISIT(m->func_dict);
  32945. Py_VISIT(m->func_name);
  32946. Py_VISIT(m->func_qualname);
  32947. Py_VISIT(m->func_doc);
  32948. Py_VISIT(m->func_globals);
  32949. Py_VISIT(m->func_code);
  32950. Py_VISIT(m->func_classobj);
  32951. Py_VISIT(m->defaults_tuple);
  32952. Py_VISIT(m->defaults_kwdict);
  32953. if (m->defaults) {
  32954. PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
  32955. int i;
  32956. for (i = 0; i < m->defaults_pyobjects; i++)
  32957. Py_VISIT(pydefaults[i]);
  32958. }
  32959. return 0;
  32960. }
  32961. static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
  32962. {
  32963. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  32964. if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
  32965. Py_INCREF(func);
  32966. return func;
  32967. }
  32968. if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
  32969. if (type == NULL)
  32970. type = (PyObject *)(Py_TYPE(obj));
  32971. return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
  32972. }
  32973. if (obj == Py_None)
  32974. obj = NULL;
  32975. return __Pyx_PyMethod_New(func, obj, type);
  32976. }
  32977. static PyObject*
  32978. __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
  32979. {
  32980. #if PY_MAJOR_VERSION >= 3
  32981. return PyUnicode_FromFormat("<cyfunction %U at %p>",
  32982. op->func_qualname, (void *)op);
  32983. #else
  32984. return PyString_FromFormat("<cyfunction %s at %p>",
  32985. PyString_AsString(op->func_qualname), (void *)op);
  32986. #endif
  32987. }
  32988. static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
  32989. PyCFunctionObject* f = (PyCFunctionObject*)func;
  32990. PyCFunction meth = f->m_ml->ml_meth;
  32991. Py_ssize_t size;
  32992. switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
  32993. case METH_VARARGS:
  32994. if (likely(kw == NULL || PyDict_Size(kw) == 0))
  32995. return (*meth)(self, arg);
  32996. break;
  32997. case METH_VARARGS | METH_KEYWORDS:
  32998. return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
  32999. case METH_NOARGS:
  33000. if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
  33001. size = PyTuple_GET_SIZE(arg);
  33002. if (likely(size == 0))
  33003. return (*meth)(self, NULL);
  33004. PyErr_Format(PyExc_TypeError,
  33005. "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
  33006. f->m_ml->ml_name, size);
  33007. return NULL;
  33008. }
  33009. break;
  33010. case METH_O:
  33011. if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
  33012. size = PyTuple_GET_SIZE(arg);
  33013. if (likely(size == 1)) {
  33014. PyObject *result, *arg0;
  33015. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  33016. arg0 = PyTuple_GET_ITEM(arg, 0);
  33017. #else
  33018. arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
  33019. #endif
  33020. result = (*meth)(self, arg0);
  33021. #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
  33022. Py_DECREF(arg0);
  33023. #endif
  33024. return result;
  33025. }
  33026. PyErr_Format(PyExc_TypeError,
  33027. "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
  33028. f->m_ml->ml_name, size);
  33029. return NULL;
  33030. }
  33031. break;
  33032. default:
  33033. PyErr_SetString(PyExc_SystemError, "Bad call flags in "
  33034. "__Pyx_CyFunction_Call. METH_OLDARGS is no "
  33035. "longer supported!");
  33036. return NULL;
  33037. }
  33038. PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
  33039. f->m_ml->ml_name);
  33040. return NULL;
  33041. }
  33042. static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  33043. return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
  33044. }
  33045. static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
  33046. PyObject *result;
  33047. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
  33048. if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
  33049. Py_ssize_t argc;
  33050. PyObject *new_args;
  33051. PyObject *self;
  33052. argc = PyTuple_GET_SIZE(args);
  33053. new_args = PyTuple_GetSlice(args, 1, argc);
  33054. if (unlikely(!new_args))
  33055. return NULL;
  33056. self = PyTuple_GetItem(args, 0);
  33057. if (unlikely(!self)) {
  33058. Py_DECREF(new_args);
  33059. return NULL;
  33060. }
  33061. result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
  33062. Py_DECREF(new_args);
  33063. } else {
  33064. result = __Pyx_CyFunction_Call(func, args, kw);
  33065. }
  33066. return result;
  33067. }
  33068. static PyTypeObject __pyx_CyFunctionType_type = {
  33069. PyVarObject_HEAD_INIT(0, 0)
  33070. "cython_function_or_method",
  33071. sizeof(__pyx_CyFunctionObject),
  33072. 0,
  33073. (destructor) __Pyx_CyFunction_dealloc,
  33074. 0,
  33075. 0,
  33076. 0,
  33077. #if PY_MAJOR_VERSION < 3
  33078. 0,
  33079. #else
  33080. 0,
  33081. #endif
  33082. (reprfunc) __Pyx_CyFunction_repr,
  33083. 0,
  33084. 0,
  33085. 0,
  33086. 0,
  33087. __Pyx_CyFunction_CallAsMethod,
  33088. 0,
  33089. 0,
  33090. 0,
  33091. 0,
  33092. Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
  33093. 0,
  33094. (traverseproc) __Pyx_CyFunction_traverse,
  33095. (inquiry) __Pyx_CyFunction_clear,
  33096. 0,
  33097. #if PY_VERSION_HEX < 0x030500A0
  33098. offsetof(__pyx_CyFunctionObject, func_weakreflist),
  33099. #else
  33100. offsetof(PyCFunctionObject, m_weakreflist),
  33101. #endif
  33102. 0,
  33103. 0,
  33104. __pyx_CyFunction_methods,
  33105. __pyx_CyFunction_members,
  33106. __pyx_CyFunction_getsets,
  33107. 0,
  33108. 0,
  33109. __Pyx_CyFunction_descr_get,
  33110. 0,
  33111. offsetof(__pyx_CyFunctionObject, func_dict),
  33112. 0,
  33113. 0,
  33114. 0,
  33115. 0,
  33116. 0,
  33117. 0,
  33118. 0,
  33119. 0,
  33120. 0,
  33121. 0,
  33122. 0,
  33123. 0,
  33124. #if PY_VERSION_HEX >= 0x030400a1
  33125. 0,
  33126. #endif
  33127. };
  33128. static int __pyx_CyFunction_init(void) {
  33129. __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
  33130. if (unlikely(__pyx_CyFunctionType == NULL)) {
  33131. return -1;
  33132. }
  33133. return 0;
  33134. }
  33135. static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
  33136. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  33137. m->defaults = PyObject_Malloc(size);
  33138. if (unlikely(!m->defaults))
  33139. return PyErr_NoMemory();
  33140. memset(m->defaults, 0, size);
  33141. m->defaults_pyobjects = pyobjects;
  33142. return m->defaults;
  33143. }
  33144. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
  33145. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  33146. m->defaults_tuple = tuple;
  33147. Py_INCREF(tuple);
  33148. }
  33149. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
  33150. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  33151. m->defaults_kwdict = dict;
  33152. Py_INCREF(dict);
  33153. }
  33154. static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
  33155. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  33156. m->func_annotations = dict;
  33157. Py_INCREF(dict);
  33158. }
  33159. /* ArgTypeTest */
  33160. static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
  33161. {
  33162. if (unlikely(!type)) {
  33163. PyErr_SetString(PyExc_SystemError, "Missing type object");
  33164. return 0;
  33165. }
  33166. else if (exact) {
  33167. #if PY_MAJOR_VERSION == 2
  33168. if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
  33169. #endif
  33170. }
  33171. else {
  33172. if (likely(__Pyx_TypeCheck(obj, type))) return 1;
  33173. }
  33174. PyErr_Format(PyExc_TypeError,
  33175. "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
  33176. name, type->tp_name, Py_TYPE(obj)->tp_name);
  33177. return 0;
  33178. }
  33179. /* ExtTypeTest */
  33180. static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
  33181. if (unlikely(!type)) {
  33182. PyErr_SetString(PyExc_SystemError, "Missing type object");
  33183. return 0;
  33184. }
  33185. if (likely(__Pyx_TypeCheck(obj, type)))
  33186. return 1;
  33187. PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
  33188. Py_TYPE(obj)->tp_name, type->tp_name);
  33189. return 0;
  33190. }
  33191. /* pyfrozenset_new */
  33192. static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) {
  33193. if (it) {
  33194. PyObject* result;
  33195. #if CYTHON_COMPILING_IN_PYPY
  33196. PyObject* args;
  33197. args = PyTuple_Pack(1, it);
  33198. if (unlikely(!args))
  33199. return NULL;
  33200. result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL);
  33201. Py_DECREF(args);
  33202. return result;
  33203. #else
  33204. if (PyFrozenSet_CheckExact(it)) {
  33205. Py_INCREF(it);
  33206. return it;
  33207. }
  33208. result = PyFrozenSet_New(it);
  33209. if (unlikely(!result))
  33210. return NULL;
  33211. if (likely(PySet_GET_SIZE(result)))
  33212. return result;
  33213. Py_DECREF(result);
  33214. #endif
  33215. }
  33216. #if CYTHON_USE_TYPE_SLOTS
  33217. return PyFrozenSet_Type.tp_new(&PyFrozenSet_Type, __pyx_empty_tuple, NULL);
  33218. #else
  33219. return PyObject_Call((PyObject*)&PyFrozenSet_Type, __pyx_empty_tuple, NULL);
  33220. #endif
  33221. }
  33222. /* py_set_discard_unhashable */
  33223. static int __Pyx_PySet_DiscardUnhashable(PyObject *set, PyObject *key) {
  33224. PyObject *tmpkey;
  33225. int rv;
  33226. if (likely(!PySet_Check(key) || !PyErr_ExceptionMatches(PyExc_TypeError)))
  33227. return -1;
  33228. PyErr_Clear();
  33229. tmpkey = __Pyx_PyFrozenSet_New(key);
  33230. if (tmpkey == NULL)
  33231. return -1;
  33232. rv = PySet_Discard(set, tmpkey);
  33233. Py_DECREF(tmpkey);
  33234. return rv;
  33235. }
  33236. /* py_set_remove */
  33237. static int __Pyx_PySet_RemoveNotFound(PyObject *set, PyObject *key, int found) {
  33238. if (unlikely(found < 0)) {
  33239. found = __Pyx_PySet_DiscardUnhashable(set, key);
  33240. }
  33241. if (likely(found == 0)) {
  33242. PyObject *tup;
  33243. tup = PyTuple_Pack(1, key);
  33244. if (!tup)
  33245. return -1;
  33246. PyErr_SetObject(PyExc_KeyError, tup);
  33247. Py_DECREF(tup);
  33248. return -1;
  33249. }
  33250. return found;
  33251. }
  33252. static CYTHON_INLINE int __Pyx_PySet_Remove(PyObject *set, PyObject *key) {
  33253. int found = PySet_Discard(set, key);
  33254. if (unlikely(found != 1)) {
  33255. return __Pyx_PySet_RemoveNotFound(set, key, found);
  33256. }
  33257. return 0;
  33258. }
  33259. /* CIntToDigits */
  33260. static const char DIGIT_PAIRS_10[2*10*10+1] = {
  33261. "00010203040506070809"
  33262. "10111213141516171819"
  33263. "20212223242526272829"
  33264. "30313233343536373839"
  33265. "40414243444546474849"
  33266. "50515253545556575859"
  33267. "60616263646566676869"
  33268. "70717273747576777879"
  33269. "80818283848586878889"
  33270. "90919293949596979899"
  33271. };
  33272. static const char DIGIT_PAIRS_8[2*8*8+1] = {
  33273. "0001020304050607"
  33274. "1011121314151617"
  33275. "2021222324252627"
  33276. "3031323334353637"
  33277. "4041424344454647"
  33278. "5051525354555657"
  33279. "6061626364656667"
  33280. "7071727374757677"
  33281. };
  33282. static const char DIGITS_HEX[2*16+1] = {
  33283. "0123456789abcdef"
  33284. "0123456789ABCDEF"
  33285. };
  33286. /* BuildPyUnicode */
  33287. static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength,
  33288. int prepend_sign, char padding_char) {
  33289. PyObject *uval;
  33290. Py_ssize_t uoffset = ulength - clength;
  33291. #if CYTHON_USE_UNICODE_INTERNALS
  33292. Py_ssize_t i;
  33293. #if CYTHON_PEP393_ENABLED
  33294. void *udata;
  33295. uval = PyUnicode_New(ulength, 127);
  33296. if (unlikely(!uval)) return NULL;
  33297. udata = PyUnicode_DATA(uval);
  33298. #else
  33299. Py_UNICODE *udata;
  33300. uval = PyUnicode_FromUnicode(NULL, ulength);
  33301. if (unlikely(!uval)) return NULL;
  33302. udata = PyUnicode_AS_UNICODE(uval);
  33303. #endif
  33304. if (uoffset > 0) {
  33305. i = 0;
  33306. if (prepend_sign) {
  33307. __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-');
  33308. i++;
  33309. }
  33310. for (; i < uoffset; i++) {
  33311. __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char);
  33312. }
  33313. }
  33314. for (i=0; i < clength; i++) {
  33315. __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]);
  33316. }
  33317. #else
  33318. {
  33319. uval = NULL;
  33320. PyObject *sign = NULL, *padding = NULL;
  33321. if (uoffset > 0) {
  33322. prepend_sign = !!prepend_sign;
  33323. if (uoffset > prepend_sign) {
  33324. padding = PyUnicode_FromOrdinal(padding_char);
  33325. if (likely(padding) && uoffset > prepend_sign + 1) {
  33326. PyObject *tmp;
  33327. PyObject *repeat = PyInt_FromSize_t(uoffset - prepend_sign);
  33328. if (unlikely(!repeat)) goto done_or_error;
  33329. tmp = PyNumber_Multiply(padding, repeat);
  33330. Py_DECREF(repeat);
  33331. Py_DECREF(padding);
  33332. padding = tmp;
  33333. }
  33334. if (unlikely(!padding)) goto done_or_error;
  33335. }
  33336. if (prepend_sign) {
  33337. sign = PyUnicode_FromOrdinal('-');
  33338. if (unlikely(!sign)) goto done_or_error;
  33339. }
  33340. }
  33341. uval = PyUnicode_DecodeASCII(chars, clength, NULL);
  33342. if (likely(uval) && padding) {
  33343. PyObject *tmp = PyNumber_Add(padding, uval);
  33344. Py_DECREF(uval);
  33345. uval = tmp;
  33346. }
  33347. if (likely(uval) && sign) {
  33348. PyObject *tmp = PyNumber_Add(sign, uval);
  33349. Py_DECREF(uval);
  33350. uval = tmp;
  33351. }
  33352. done_or_error:
  33353. Py_XDECREF(padding);
  33354. Py_XDECREF(sign);
  33355. }
  33356. #endif
  33357. return uval;
  33358. }
  33359. /* CIntToPyUnicode */
  33360. #ifdef _MSC_VER
  33361. #ifndef _MSC_STDINT_H_
  33362. #if _MSC_VER < 1300
  33363. typedef unsigned short uint16_t;
  33364. #else
  33365. typedef unsigned __int16 uint16_t;
  33366. #endif
  33367. #endif
  33368. #else
  33369. #include <stdint.h>
  33370. #endif
  33371. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) {
  33372. char digits[sizeof(Py_ssize_t)*3+2];
  33373. char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2;
  33374. const char *hex_digits = DIGITS_HEX;
  33375. Py_ssize_t length, ulength;
  33376. int prepend_sign, last_one_off;
  33377. Py_ssize_t remaining;
  33378. const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0;
  33379. const int is_unsigned = neg_one > const_zero;
  33380. if (format_char == 'X') {
  33381. hex_digits += 16;
  33382. format_char = 'x';
  33383. }
  33384. remaining = value;
  33385. last_one_off = 0;
  33386. dpos = end;
  33387. do {
  33388. int digit_pos;
  33389. switch (format_char) {
  33390. case 'o':
  33391. digit_pos = abs((int)(remaining % (8*8)));
  33392. remaining = (Py_ssize_t) (remaining / (8*8));
  33393. dpos -= 2;
  33394. *(uint16_t*)dpos = ((uint16_t*)DIGIT_PAIRS_8)[digit_pos];
  33395. last_one_off = (digit_pos < 8);
  33396. break;
  33397. case 'd':
  33398. digit_pos = abs((int)(remaining % (10*10)));
  33399. remaining = (Py_ssize_t) (remaining / (10*10));
  33400. dpos -= 2;
  33401. *(uint16_t*)dpos = ((uint16_t*)DIGIT_PAIRS_10)[digit_pos];
  33402. last_one_off = (digit_pos < 10);
  33403. break;
  33404. case 'x':
  33405. *(--dpos) = hex_digits[abs((int)(remaining % 16))];
  33406. remaining = (Py_ssize_t) (remaining / 16);
  33407. break;
  33408. default:
  33409. assert(0);
  33410. break;
  33411. }
  33412. } while (unlikely(remaining != 0));
  33413. if (last_one_off) {
  33414. assert(*dpos == '0');
  33415. dpos++;
  33416. }
  33417. length = end - dpos;
  33418. ulength = length;
  33419. prepend_sign = 0;
  33420. if (!is_unsigned && value <= neg_one) {
  33421. if (padding_char == ' ' || width <= length + 1) {
  33422. *(--dpos) = '-';
  33423. ++length;
  33424. } else {
  33425. prepend_sign = 1;
  33426. }
  33427. ++ulength;
  33428. }
  33429. if (width > ulength) {
  33430. ulength = width;
  33431. }
  33432. if (ulength == 1) {
  33433. return PyUnicode_FromOrdinal(*dpos);
  33434. }
  33435. return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
  33436. }
  33437. /* JoinPyUnicode */
  33438. static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
  33439. CYTHON_UNUSED Py_UCS4 max_char) {
  33440. #if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  33441. PyObject *result_uval;
  33442. int result_ukind;
  33443. Py_ssize_t i, char_pos;
  33444. void *result_udata;
  33445. #if CYTHON_PEP393_ENABLED
  33446. result_uval = PyUnicode_New(result_ulength, max_char);
  33447. if (unlikely(!result_uval)) return NULL;
  33448. result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND;
  33449. result_udata = PyUnicode_DATA(result_uval);
  33450. #else
  33451. result_uval = PyUnicode_FromUnicode(NULL, result_ulength);
  33452. if (unlikely(!result_uval)) return NULL;
  33453. result_ukind = sizeof(Py_UNICODE);
  33454. result_udata = PyUnicode_AS_UNICODE(result_uval);
  33455. #endif
  33456. char_pos = 0;
  33457. for (i=0; i < value_count; i++) {
  33458. int ukind;
  33459. Py_ssize_t ulength;
  33460. void *udata;
  33461. PyObject *uval = PyTuple_GET_ITEM(value_tuple, i);
  33462. if (unlikely(__Pyx_PyUnicode_READY(uval)))
  33463. goto bad;
  33464. ulength = __Pyx_PyUnicode_GET_LENGTH(uval);
  33465. if (unlikely(!ulength))
  33466. continue;
  33467. if (unlikely(char_pos + ulength < 0))
  33468. goto overflow;
  33469. ukind = __Pyx_PyUnicode_KIND(uval);
  33470. udata = __Pyx_PyUnicode_DATA(uval);
  33471. if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) {
  33472. memcpy((char *)result_udata + char_pos * result_ukind, udata, (size_t) (ulength * result_ukind));
  33473. } else {
  33474. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters)
  33475. _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength);
  33476. #else
  33477. Py_ssize_t j;
  33478. for (j=0; j < ulength; j++) {
  33479. Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j);
  33480. __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar);
  33481. }
  33482. #endif
  33483. }
  33484. char_pos += ulength;
  33485. }
  33486. return result_uval;
  33487. overflow:
  33488. PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string");
  33489. bad:
  33490. Py_DECREF(result_uval);
  33491. return NULL;
  33492. #else
  33493. result_ulength++;
  33494. value_count++;
  33495. return PyUnicode_Join(__pyx_empty_unicode, value_tuple);
  33496. #endif
  33497. }
  33498. /* PySetContains */
  33499. static int __Pyx_PySet_ContainsUnhashable(PyObject *set, PyObject *key) {
  33500. int result = -1;
  33501. if (PySet_Check(key) && PyErr_ExceptionMatches(PyExc_TypeError)) {
  33502. PyObject *tmpkey;
  33503. PyErr_Clear();
  33504. tmpkey = __Pyx_PyFrozenSet_New(key);
  33505. if (tmpkey != NULL) {
  33506. result = PySet_Contains(set, tmpkey);
  33507. Py_DECREF(tmpkey);
  33508. }
  33509. }
  33510. return result;
  33511. }
  33512. static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq) {
  33513. int result = PySet_Contains(set, key);
  33514. if (unlikely(result < 0)) {
  33515. result = __Pyx_PySet_ContainsUnhashable(set, key);
  33516. }
  33517. return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
  33518. }
  33519. /* PyObjectCallNoArg */
  33520. #if CYTHON_COMPILING_IN_CPYTHON
  33521. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
  33522. #if CYTHON_FAST_PYCALL
  33523. if (PyFunction_Check(func)) {
  33524. return __Pyx_PyFunction_FastCall(func, NULL, 0);
  33525. }
  33526. #endif
  33527. #ifdef __Pyx_CyFunction_USED
  33528. if (likely(PyCFunction_Check(func) || __Pyx_TypeCheck(func, __pyx_CyFunctionType))) {
  33529. #else
  33530. if (likely(PyCFunction_Check(func))) {
  33531. #endif
  33532. if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
  33533. return __Pyx_PyObject_CallMethO(func, NULL);
  33534. }
  33535. }
  33536. return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
  33537. }
  33538. #endif
  33539. /* RaiseTooManyValuesToUnpack */
  33540. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
  33541. PyErr_Format(PyExc_ValueError,
  33542. "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
  33543. }
  33544. /* RaiseNeedMoreValuesToUnpack */
  33545. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
  33546. PyErr_Format(PyExc_ValueError,
  33547. "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
  33548. index, (index == 1) ? "" : "s");
  33549. }
  33550. /* IterFinish */
  33551. static CYTHON_INLINE int __Pyx_IterFinish(void) {
  33552. #if CYTHON_FAST_THREAD_STATE
  33553. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  33554. PyObject* exc_type = tstate->curexc_type;
  33555. if (unlikely(exc_type)) {
  33556. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
  33557. PyObject *exc_value, *exc_tb;
  33558. exc_value = tstate->curexc_value;
  33559. exc_tb = tstate->curexc_traceback;
  33560. tstate->curexc_type = 0;
  33561. tstate->curexc_value = 0;
  33562. tstate->curexc_traceback = 0;
  33563. Py_DECREF(exc_type);
  33564. Py_XDECREF(exc_value);
  33565. Py_XDECREF(exc_tb);
  33566. return 0;
  33567. } else {
  33568. return -1;
  33569. }
  33570. }
  33571. return 0;
  33572. #else
  33573. if (unlikely(PyErr_Occurred())) {
  33574. if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
  33575. PyErr_Clear();
  33576. return 0;
  33577. } else {
  33578. return -1;
  33579. }
  33580. }
  33581. return 0;
  33582. #endif
  33583. }
  33584. /* UnpackItemEndCheck */
  33585. static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
  33586. if (unlikely(retval)) {
  33587. Py_DECREF(retval);
  33588. __Pyx_RaiseTooManyValuesError(expected);
  33589. return -1;
  33590. } else {
  33591. return __Pyx_IterFinish();
  33592. }
  33593. return 0;
  33594. }
  33595. /* set_iter */
  33596. static CYTHON_INLINE PyObject* __Pyx_set_iterator(PyObject* iterable, int is_set,
  33597. Py_ssize_t* p_orig_length, int* p_source_is_set) {
  33598. #if CYTHON_COMPILING_IN_CPYTHON
  33599. is_set = is_set || likely(PySet_CheckExact(iterable) || PyFrozenSet_CheckExact(iterable));
  33600. *p_source_is_set = is_set;
  33601. if (likely(is_set)) {
  33602. *p_orig_length = PySet_Size(iterable);
  33603. Py_INCREF(iterable);
  33604. return iterable;
  33605. }
  33606. #else
  33607. (void)is_set;
  33608. *p_source_is_set = 0;
  33609. #endif
  33610. *p_orig_length = 0;
  33611. return PyObject_GetIter(iterable);
  33612. }
  33613. static CYTHON_INLINE int __Pyx_set_iter_next(
  33614. PyObject* iter_obj, Py_ssize_t orig_length,
  33615. Py_ssize_t* ppos, PyObject **value,
  33616. int source_is_set) {
  33617. if (!CYTHON_COMPILING_IN_CPYTHON || unlikely(!source_is_set)) {
  33618. *value = PyIter_Next(iter_obj);
  33619. if (unlikely(!*value)) {
  33620. return __Pyx_IterFinish();
  33621. }
  33622. (void)orig_length;
  33623. (void)ppos;
  33624. return 1;
  33625. }
  33626. #if CYTHON_COMPILING_IN_CPYTHON
  33627. if (unlikely(PySet_GET_SIZE(iter_obj) != orig_length)) {
  33628. PyErr_SetString(
  33629. PyExc_RuntimeError,
  33630. "set changed size during iteration");
  33631. return -1;
  33632. }
  33633. {
  33634. Py_hash_t hash;
  33635. int ret = _PySet_NextEntry(iter_obj, ppos, value, &hash);
  33636. assert (ret != -1);
  33637. if (likely(ret)) {
  33638. Py_INCREF(*value);
  33639. return 1;
  33640. }
  33641. }
  33642. #endif
  33643. return 0;
  33644. }
  33645. /* GetItemInt */
  33646. static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
  33647. PyObject *r;
  33648. if (!j) return NULL;
  33649. r = PyObject_GetItem(o, j);
  33650. Py_DECREF(j);
  33651. return r;
  33652. }
  33653. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  33654. CYTHON_NCP_UNUSED int wraparound,
  33655. CYTHON_NCP_UNUSED int boundscheck) {
  33656. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  33657. Py_ssize_t wrapped_i = i;
  33658. if (wraparound & unlikely(i < 0)) {
  33659. wrapped_i += PyList_GET_SIZE(o);
  33660. }
  33661. if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyList_GET_SIZE(o)))) {
  33662. PyObject *r = PyList_GET_ITEM(o, wrapped_i);
  33663. Py_INCREF(r);
  33664. return r;
  33665. }
  33666. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  33667. #else
  33668. return PySequence_GetItem(o, i);
  33669. #endif
  33670. }
  33671. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  33672. CYTHON_NCP_UNUSED int wraparound,
  33673. CYTHON_NCP_UNUSED int boundscheck) {
  33674. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  33675. Py_ssize_t wrapped_i = i;
  33676. if (wraparound & unlikely(i < 0)) {
  33677. wrapped_i += PyTuple_GET_SIZE(o);
  33678. }
  33679. if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyTuple_GET_SIZE(o)))) {
  33680. PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
  33681. Py_INCREF(r);
  33682. return r;
  33683. }
  33684. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  33685. #else
  33686. return PySequence_GetItem(o, i);
  33687. #endif
  33688. }
  33689. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
  33690. CYTHON_NCP_UNUSED int wraparound,
  33691. CYTHON_NCP_UNUSED int boundscheck) {
  33692. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
  33693. if (is_list || PyList_CheckExact(o)) {
  33694. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
  33695. if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
  33696. PyObject *r = PyList_GET_ITEM(o, n);
  33697. Py_INCREF(r);
  33698. return r;
  33699. }
  33700. }
  33701. else if (PyTuple_CheckExact(o)) {
  33702. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
  33703. if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
  33704. PyObject *r = PyTuple_GET_ITEM(o, n);
  33705. Py_INCREF(r);
  33706. return r;
  33707. }
  33708. } else {
  33709. PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
  33710. if (likely(m && m->sq_item)) {
  33711. if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
  33712. Py_ssize_t l = m->sq_length(o);
  33713. if (likely(l >= 0)) {
  33714. i += l;
  33715. } else {
  33716. if (!PyErr_ExceptionMatches(PyExc_OverflowError))
  33717. return NULL;
  33718. PyErr_Clear();
  33719. }
  33720. }
  33721. return m->sq_item(o, i);
  33722. }
  33723. }
  33724. #else
  33725. if (is_list || PySequence_Check(o)) {
  33726. return PySequence_GetItem(o, i);
  33727. }
  33728. #endif
  33729. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  33730. }
  33731. /* ObjectGetItem */
  33732. #if CYTHON_USE_TYPE_SLOTS
  33733. static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
  33734. PyObject *runerr;
  33735. Py_ssize_t key_value;
  33736. PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
  33737. if (unlikely(!(m && m->sq_item))) {
  33738. PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
  33739. return NULL;
  33740. }
  33741. key_value = __Pyx_PyIndex_AsSsize_t(index);
  33742. if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
  33743. return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
  33744. }
  33745. if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
  33746. PyErr_Clear();
  33747. PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
  33748. }
  33749. return NULL;
  33750. }
  33751. static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
  33752. PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
  33753. if (likely(m && m->mp_subscript)) {
  33754. return m->mp_subscript(obj, key);
  33755. }
  33756. return __Pyx_PyObject_GetIndex(obj, key);
  33757. }
  33758. #endif
  33759. /* PyErrExceptionMatches */
  33760. #if CYTHON_FAST_THREAD_STATE
  33761. static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  33762. Py_ssize_t i, n;
  33763. n = PyTuple_GET_SIZE(tuple);
  33764. #if PY_MAJOR_VERSION >= 3
  33765. for (i=0; i<n; i++) {
  33766. if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  33767. }
  33768. #endif
  33769. for (i=0; i<n; i++) {
  33770. if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
  33771. }
  33772. return 0;
  33773. }
  33774. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
  33775. PyObject *exc_type = tstate->curexc_type;
  33776. if (exc_type == err) return 1;
  33777. if (unlikely(!exc_type)) return 0;
  33778. if (unlikely(PyTuple_Check(err)))
  33779. return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
  33780. return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
  33781. }
  33782. #endif
  33783. /* GetAttr */
  33784. static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
  33785. #if CYTHON_USE_TYPE_SLOTS
  33786. #if PY_MAJOR_VERSION >= 3
  33787. if (likely(PyUnicode_Check(n)))
  33788. #else
  33789. if (likely(PyString_Check(n)))
  33790. #endif
  33791. return __Pyx_PyObject_GetAttrStr(o, n);
  33792. #endif
  33793. return PyObject_GetAttr(o, n);
  33794. }
  33795. /* GetAttr3 */
  33796. static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
  33797. __Pyx_PyThreadState_declare
  33798. __Pyx_PyThreadState_assign
  33799. if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
  33800. return NULL;
  33801. __Pyx_PyErr_Clear();
  33802. Py_INCREF(d);
  33803. return d;
  33804. }
  33805. static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
  33806. PyObject *r = __Pyx_GetAttr(o, n);
  33807. return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
  33808. }
  33809. /* DictGetItem */
  33810. #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
  33811. static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
  33812. PyObject *value;
  33813. value = PyDict_GetItemWithError(d, key);
  33814. if (unlikely(!value)) {
  33815. if (!PyErr_Occurred()) {
  33816. PyObject* args = PyTuple_Pack(1, key);
  33817. if (likely(args))
  33818. PyErr_SetObject(PyExc_KeyError, args);
  33819. Py_XDECREF(args);
  33820. }
  33821. return NULL;
  33822. }
  33823. Py_INCREF(value);
  33824. return value;
  33825. }
  33826. #endif
  33827. /* SaveResetException */
  33828. #if CYTHON_FAST_THREAD_STATE
  33829. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  33830. #if PY_VERSION_HEX >= 0x030700A3
  33831. *type = tstate->exc_state.exc_type;
  33832. *value = tstate->exc_state.exc_value;
  33833. *tb = tstate->exc_state.exc_traceback;
  33834. #else
  33835. *type = tstate->exc_type;
  33836. *value = tstate->exc_value;
  33837. *tb = tstate->exc_traceback;
  33838. #endif
  33839. Py_XINCREF(*type);
  33840. Py_XINCREF(*value);
  33841. Py_XINCREF(*tb);
  33842. }
  33843. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  33844. PyObject *tmp_type, *tmp_value, *tmp_tb;
  33845. #if PY_VERSION_HEX >= 0x030700A3
  33846. tmp_type = tstate->exc_state.exc_type;
  33847. tmp_value = tstate->exc_state.exc_value;
  33848. tmp_tb = tstate->exc_state.exc_traceback;
  33849. tstate->exc_state.exc_type = type;
  33850. tstate->exc_state.exc_value = value;
  33851. tstate->exc_state.exc_traceback = tb;
  33852. #else
  33853. tmp_type = tstate->exc_type;
  33854. tmp_value = tstate->exc_value;
  33855. tmp_tb = tstate->exc_traceback;
  33856. tstate->exc_type = type;
  33857. tstate->exc_value = value;
  33858. tstate->exc_traceback = tb;
  33859. #endif
  33860. Py_XDECREF(tmp_type);
  33861. Py_XDECREF(tmp_value);
  33862. Py_XDECREF(tmp_tb);
  33863. }
  33864. #endif
  33865. /* FastTypeChecks */
  33866. #if CYTHON_COMPILING_IN_CPYTHON
  33867. static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
  33868. while (a) {
  33869. a = a->tp_base;
  33870. if (a == b)
  33871. return 1;
  33872. }
  33873. return b == &PyBaseObject_Type;
  33874. }
  33875. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
  33876. PyObject *mro;
  33877. if (a == b) return 1;
  33878. mro = a->tp_mro;
  33879. if (likely(mro)) {
  33880. Py_ssize_t i, n;
  33881. n = PyTuple_GET_SIZE(mro);
  33882. for (i = 0; i < n; i++) {
  33883. if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
  33884. return 1;
  33885. }
  33886. return 0;
  33887. }
  33888. return __Pyx_InBases(a, b);
  33889. }
  33890. #if PY_MAJOR_VERSION == 2
  33891. static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
  33892. PyObject *exception, *value, *tb;
  33893. int res;
  33894. __Pyx_PyThreadState_declare
  33895. __Pyx_PyThreadState_assign
  33896. __Pyx_ErrFetch(&exception, &value, &tb);
  33897. res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
  33898. if (unlikely(res == -1)) {
  33899. PyErr_WriteUnraisable(err);
  33900. res = 0;
  33901. }
  33902. if (!res) {
  33903. res = PyObject_IsSubclass(err, exc_type2);
  33904. if (unlikely(res == -1)) {
  33905. PyErr_WriteUnraisable(err);
  33906. res = 0;
  33907. }
  33908. }
  33909. __Pyx_ErrRestore(exception, value, tb);
  33910. return res;
  33911. }
  33912. #else
  33913. static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
  33914. int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
  33915. if (!res) {
  33916. res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
  33917. }
  33918. return res;
  33919. }
  33920. #endif
  33921. static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  33922. Py_ssize_t i, n;
  33923. assert(PyExceptionClass_Check(exc_type));
  33924. n = PyTuple_GET_SIZE(tuple);
  33925. #if PY_MAJOR_VERSION >= 3
  33926. for (i=0; i<n; i++) {
  33927. if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  33928. }
  33929. #endif
  33930. for (i=0; i<n; i++) {
  33931. PyObject *t = PyTuple_GET_ITEM(tuple, i);
  33932. #if PY_MAJOR_VERSION < 3
  33933. if (likely(exc_type == t)) return 1;
  33934. #endif
  33935. if (likely(PyExceptionClass_Check(t))) {
  33936. if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
  33937. } else {
  33938. }
  33939. }
  33940. return 0;
  33941. }
  33942. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
  33943. if (likely(err == exc_type)) return 1;
  33944. if (likely(PyExceptionClass_Check(err))) {
  33945. if (likely(PyExceptionClass_Check(exc_type))) {
  33946. return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
  33947. } else if (likely(PyTuple_Check(exc_type))) {
  33948. return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
  33949. } else {
  33950. }
  33951. }
  33952. return PyErr_GivenExceptionMatches(err, exc_type);
  33953. }
  33954. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
  33955. assert(PyExceptionClass_Check(exc_type1));
  33956. assert(PyExceptionClass_Check(exc_type2));
  33957. if (likely(err == exc_type1 || err == exc_type2)) return 1;
  33958. if (likely(PyExceptionClass_Check(err))) {
  33959. return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
  33960. }
  33961. return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
  33962. }
  33963. #endif
  33964. /* GetException */
  33965. #if CYTHON_FAST_THREAD_STATE
  33966. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  33967. #else
  33968. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
  33969. #endif
  33970. PyObject *local_type, *local_value, *local_tb;
  33971. #if CYTHON_FAST_THREAD_STATE
  33972. PyObject *tmp_type, *tmp_value, *tmp_tb;
  33973. local_type = tstate->curexc_type;
  33974. local_value = tstate->curexc_value;
  33975. local_tb = tstate->curexc_traceback;
  33976. tstate->curexc_type = 0;
  33977. tstate->curexc_value = 0;
  33978. tstate->curexc_traceback = 0;
  33979. #else
  33980. PyErr_Fetch(&local_type, &local_value, &local_tb);
  33981. #endif
  33982. PyErr_NormalizeException(&local_type, &local_value, &local_tb);
  33983. #if CYTHON_FAST_THREAD_STATE
  33984. if (unlikely(tstate->curexc_type))
  33985. #else
  33986. if (unlikely(PyErr_Occurred()))
  33987. #endif
  33988. goto bad;
  33989. #if PY_MAJOR_VERSION >= 3
  33990. if (local_tb) {
  33991. if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
  33992. goto bad;
  33993. }
  33994. #endif
  33995. Py_XINCREF(local_tb);
  33996. Py_XINCREF(local_type);
  33997. Py_XINCREF(local_value);
  33998. *type = local_type;
  33999. *value = local_value;
  34000. *tb = local_tb;
  34001. #if CYTHON_FAST_THREAD_STATE
  34002. #if PY_VERSION_HEX >= 0x030700A3
  34003. tmp_type = tstate->exc_state.exc_type;
  34004. tmp_value = tstate->exc_state.exc_value;
  34005. tmp_tb = tstate->exc_state.exc_traceback;
  34006. tstate->exc_state.exc_type = local_type;
  34007. tstate->exc_state.exc_value = local_value;
  34008. tstate->exc_state.exc_traceback = local_tb;
  34009. #else
  34010. tmp_type = tstate->exc_type;
  34011. tmp_value = tstate->exc_value;
  34012. tmp_tb = tstate->exc_traceback;
  34013. tstate->exc_type = local_type;
  34014. tstate->exc_value = local_value;
  34015. tstate->exc_traceback = local_tb;
  34016. #endif
  34017. Py_XDECREF(tmp_type);
  34018. Py_XDECREF(tmp_value);
  34019. Py_XDECREF(tmp_tb);
  34020. #else
  34021. PyErr_SetExcInfo(local_type, local_value, local_tb);
  34022. #endif
  34023. return 0;
  34024. bad:
  34025. *type = 0;
  34026. *value = 0;
  34027. *tb = 0;
  34028. Py_XDECREF(local_type);
  34029. Py_XDECREF(local_value);
  34030. Py_XDECREF(local_tb);
  34031. return -1;
  34032. }
  34033. /* SwapException */
  34034. #if CYTHON_FAST_THREAD_STATE
  34035. static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  34036. PyObject *tmp_type, *tmp_value, *tmp_tb;
  34037. #if PY_VERSION_HEX >= 0x030700A3
  34038. tmp_type = tstate->exc_state.exc_type;
  34039. tmp_value = tstate->exc_state.exc_value;
  34040. tmp_tb = tstate->exc_state.exc_traceback;
  34041. tstate->exc_state.exc_type = *type;
  34042. tstate->exc_state.exc_value = *value;
  34043. tstate->exc_state.exc_traceback = *tb;
  34044. #else
  34045. tmp_type = tstate->exc_type;
  34046. tmp_value = tstate->exc_value;
  34047. tmp_tb = tstate->exc_traceback;
  34048. tstate->exc_type = *type;
  34049. tstate->exc_value = *value;
  34050. tstate->exc_traceback = *tb;
  34051. #endif
  34052. *type = tmp_type;
  34053. *value = tmp_value;
  34054. *tb = tmp_tb;
  34055. }
  34056. #else
  34057. static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
  34058. PyObject *tmp_type, *tmp_value, *tmp_tb;
  34059. PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
  34060. PyErr_SetExcInfo(*type, *value, *tb);
  34061. *type = tmp_type;
  34062. *value = tmp_value;
  34063. *tb = tmp_tb;
  34064. }
  34065. #endif
  34066. /* BytesEquals */
  34067. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
  34068. #if CYTHON_COMPILING_IN_PYPY
  34069. return PyObject_RichCompareBool(s1, s2, equals);
  34070. #else
  34071. if (s1 == s2) {
  34072. return (equals == Py_EQ);
  34073. } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
  34074. const char *ps1, *ps2;
  34075. Py_ssize_t length = PyBytes_GET_SIZE(s1);
  34076. if (length != PyBytes_GET_SIZE(s2))
  34077. return (equals == Py_NE);
  34078. ps1 = PyBytes_AS_STRING(s1);
  34079. ps2 = PyBytes_AS_STRING(s2);
  34080. if (ps1[0] != ps2[0]) {
  34081. return (equals == Py_NE);
  34082. } else if (length == 1) {
  34083. return (equals == Py_EQ);
  34084. } else {
  34085. int result;
  34086. #if CYTHON_USE_UNICODE_INTERNALS
  34087. Py_hash_t hash1, hash2;
  34088. hash1 = ((PyBytesObject*)s1)->ob_shash;
  34089. hash2 = ((PyBytesObject*)s2)->ob_shash;
  34090. if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
  34091. return (equals == Py_NE);
  34092. }
  34093. #endif
  34094. result = memcmp(ps1, ps2, (size_t)length);
  34095. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  34096. }
  34097. } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
  34098. return (equals == Py_NE);
  34099. } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
  34100. return (equals == Py_NE);
  34101. } else {
  34102. int result;
  34103. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  34104. if (!py_result)
  34105. return -1;
  34106. result = __Pyx_PyObject_IsTrue(py_result);
  34107. Py_DECREF(py_result);
  34108. return result;
  34109. }
  34110. #endif
  34111. }
  34112. /* UnicodeEquals */
  34113. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
  34114. #if CYTHON_COMPILING_IN_PYPY
  34115. return PyObject_RichCompareBool(s1, s2, equals);
  34116. #else
  34117. #if PY_MAJOR_VERSION < 3
  34118. PyObject* owned_ref = NULL;
  34119. #endif
  34120. int s1_is_unicode, s2_is_unicode;
  34121. if (s1 == s2) {
  34122. goto return_eq;
  34123. }
  34124. s1_is_unicode = PyUnicode_CheckExact(s1);
  34125. s2_is_unicode = PyUnicode_CheckExact(s2);
  34126. #if PY_MAJOR_VERSION < 3
  34127. if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
  34128. owned_ref = PyUnicode_FromObject(s2);
  34129. if (unlikely(!owned_ref))
  34130. return -1;
  34131. s2 = owned_ref;
  34132. s2_is_unicode = 1;
  34133. } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
  34134. owned_ref = PyUnicode_FromObject(s1);
  34135. if (unlikely(!owned_ref))
  34136. return -1;
  34137. s1 = owned_ref;
  34138. s1_is_unicode = 1;
  34139. } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
  34140. return __Pyx_PyBytes_Equals(s1, s2, equals);
  34141. }
  34142. #endif
  34143. if (s1_is_unicode & s2_is_unicode) {
  34144. Py_ssize_t length;
  34145. int kind;
  34146. void *data1, *data2;
  34147. if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
  34148. return -1;
  34149. length = __Pyx_PyUnicode_GET_LENGTH(s1);
  34150. if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
  34151. goto return_ne;
  34152. }
  34153. #if CYTHON_USE_UNICODE_INTERNALS
  34154. {
  34155. Py_hash_t hash1, hash2;
  34156. #if CYTHON_PEP393_ENABLED
  34157. hash1 = ((PyASCIIObject*)s1)->hash;
  34158. hash2 = ((PyASCIIObject*)s2)->hash;
  34159. #else
  34160. hash1 = ((PyUnicodeObject*)s1)->hash;
  34161. hash2 = ((PyUnicodeObject*)s2)->hash;
  34162. #endif
  34163. if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
  34164. goto return_ne;
  34165. }
  34166. }
  34167. #endif
  34168. kind = __Pyx_PyUnicode_KIND(s1);
  34169. if (kind != __Pyx_PyUnicode_KIND(s2)) {
  34170. goto return_ne;
  34171. }
  34172. data1 = __Pyx_PyUnicode_DATA(s1);
  34173. data2 = __Pyx_PyUnicode_DATA(s2);
  34174. if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
  34175. goto return_ne;
  34176. } else if (length == 1) {
  34177. goto return_eq;
  34178. } else {
  34179. int result = memcmp(data1, data2, (size_t)(length * kind));
  34180. #if PY_MAJOR_VERSION < 3
  34181. Py_XDECREF(owned_ref);
  34182. #endif
  34183. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  34184. }
  34185. } else if ((s1 == Py_None) & s2_is_unicode) {
  34186. goto return_ne;
  34187. } else if ((s2 == Py_None) & s1_is_unicode) {
  34188. goto return_ne;
  34189. } else {
  34190. int result;
  34191. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  34192. if (!py_result)
  34193. return -1;
  34194. result = __Pyx_PyObject_IsTrue(py_result);
  34195. Py_DECREF(py_result);
  34196. return result;
  34197. }
  34198. return_eq:
  34199. #if PY_MAJOR_VERSION < 3
  34200. Py_XDECREF(owned_ref);
  34201. #endif
  34202. return (equals == Py_EQ);
  34203. return_ne:
  34204. #if PY_MAJOR_VERSION < 3
  34205. Py_XDECREF(owned_ref);
  34206. #endif
  34207. return (equals == Py_NE);
  34208. #endif
  34209. }
  34210. /* CIntToPyUnicode */
  34211. #ifdef _MSC_VER
  34212. #ifndef _MSC_STDINT_H_
  34213. #if _MSC_VER < 1300
  34214. typedef unsigned short uint16_t;
  34215. #else
  34216. typedef unsigned __int16 uint16_t;
  34217. #endif
  34218. #endif
  34219. #else
  34220. #include <stdint.h>
  34221. #endif
  34222. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_size_t(size_t value, Py_ssize_t width, char padding_char, char format_char) {
  34223. char digits[sizeof(size_t)*3+2];
  34224. char *dpos, *end = digits + sizeof(size_t)*3+2;
  34225. const char *hex_digits = DIGITS_HEX;
  34226. Py_ssize_t length, ulength;
  34227. int prepend_sign, last_one_off;
  34228. size_t remaining;
  34229. const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
  34230. const int is_unsigned = neg_one > const_zero;
  34231. if (format_char == 'X') {
  34232. hex_digits += 16;
  34233. format_char = 'x';
  34234. }
  34235. remaining = value;
  34236. last_one_off = 0;
  34237. dpos = end;
  34238. do {
  34239. int digit_pos;
  34240. switch (format_char) {
  34241. case 'o':
  34242. digit_pos = abs((int)(remaining % (8*8)));
  34243. remaining = (size_t) (remaining / (8*8));
  34244. dpos -= 2;
  34245. *(uint16_t*)dpos = ((uint16_t*)DIGIT_PAIRS_8)[digit_pos];
  34246. last_one_off = (digit_pos < 8);
  34247. break;
  34248. case 'd':
  34249. digit_pos = abs((int)(remaining % (10*10)));
  34250. remaining = (size_t) (remaining / (10*10));
  34251. dpos -= 2;
  34252. *(uint16_t*)dpos = ((uint16_t*)DIGIT_PAIRS_10)[digit_pos];
  34253. last_one_off = (digit_pos < 10);
  34254. break;
  34255. case 'x':
  34256. *(--dpos) = hex_digits[abs((int)(remaining % 16))];
  34257. remaining = (size_t) (remaining / 16);
  34258. break;
  34259. default:
  34260. assert(0);
  34261. break;
  34262. }
  34263. } while (unlikely(remaining != 0));
  34264. if (last_one_off) {
  34265. assert(*dpos == '0');
  34266. dpos++;
  34267. }
  34268. length = end - dpos;
  34269. ulength = length;
  34270. prepend_sign = 0;
  34271. if (!is_unsigned && value <= neg_one) {
  34272. if (padding_char == ' ' || width <= length + 1) {
  34273. *(--dpos) = '-';
  34274. ++length;
  34275. } else {
  34276. prepend_sign = 1;
  34277. }
  34278. ++ulength;
  34279. }
  34280. if (width > ulength) {
  34281. ulength = width;
  34282. }
  34283. if (ulength == 1) {
  34284. return PyUnicode_FromOrdinal(*dpos);
  34285. }
  34286. return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
  34287. }
  34288. /* RaiseNoneIterError */
  34289. static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
  34290. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  34291. }
  34292. /* CIntToPyUnicode */
  34293. #ifdef _MSC_VER
  34294. #ifndef _MSC_STDINT_H_
  34295. #if _MSC_VER < 1300
  34296. typedef unsigned short uint16_t;
  34297. #else
  34298. typedef unsigned __int16 uint16_t;
  34299. #endif
  34300. #endif
  34301. #else
  34302. #include <stdint.h>
  34303. #endif
  34304. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_unsigned_char(unsigned char value, Py_ssize_t width, char padding_char, char format_char) {
  34305. char digits[sizeof(unsigned char)*3+2];
  34306. char *dpos, *end = digits + sizeof(unsigned char)*3+2;
  34307. const char *hex_digits = DIGITS_HEX;
  34308. Py_ssize_t length, ulength;
  34309. int prepend_sign, last_one_off;
  34310. unsigned char remaining;
  34311. const unsigned char neg_one = (unsigned char) -1, const_zero = (unsigned char) 0;
  34312. const int is_unsigned = neg_one > const_zero;
  34313. if (format_char == 'X') {
  34314. hex_digits += 16;
  34315. format_char = 'x';
  34316. }
  34317. remaining = value;
  34318. last_one_off = 0;
  34319. dpos = end;
  34320. do {
  34321. int digit_pos;
  34322. switch (format_char) {
  34323. case 'o':
  34324. digit_pos = abs((int)(remaining % (8*8)));
  34325. remaining = (unsigned char) (remaining / (8*8));
  34326. dpos -= 2;
  34327. *(uint16_t*)dpos = ((uint16_t*)DIGIT_PAIRS_8)[digit_pos];
  34328. last_one_off = (digit_pos < 8);
  34329. break;
  34330. case 'd':
  34331. digit_pos = abs((int)(remaining % (10*10)));
  34332. remaining = (unsigned char) (remaining / (10*10));
  34333. dpos -= 2;
  34334. *(uint16_t*)dpos = ((uint16_t*)DIGIT_PAIRS_10)[digit_pos];
  34335. last_one_off = (digit_pos < 10);
  34336. break;
  34337. case 'x':
  34338. *(--dpos) = hex_digits[abs((int)(remaining % 16))];
  34339. remaining = (unsigned char) (remaining / 16);
  34340. break;
  34341. default:
  34342. assert(0);
  34343. break;
  34344. }
  34345. } while (unlikely(remaining != 0));
  34346. if (last_one_off) {
  34347. assert(*dpos == '0');
  34348. dpos++;
  34349. }
  34350. length = end - dpos;
  34351. ulength = length;
  34352. prepend_sign = 0;
  34353. if (!is_unsigned && value <= neg_one) {
  34354. if (padding_char == ' ' || width <= length + 1) {
  34355. *(--dpos) = '-';
  34356. ++length;
  34357. } else {
  34358. prepend_sign = 1;
  34359. }
  34360. ++ulength;
  34361. }
  34362. if (width > ulength) {
  34363. ulength = width;
  34364. }
  34365. if (ulength == 1) {
  34366. return PyUnicode_FromOrdinal(*dpos);
  34367. }
  34368. return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
  34369. }
  34370. /* None */
  34371. static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
  34372. PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
  34373. }
  34374. /* decode_c_string */
  34375. static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
  34376. const char* cstring, Py_ssize_t start, Py_ssize_t stop,
  34377. const char* encoding, const char* errors,
  34378. PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
  34379. Py_ssize_t length;
  34380. if (unlikely((start < 0) | (stop < 0))) {
  34381. size_t slen = strlen(cstring);
  34382. if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
  34383. PyErr_SetString(PyExc_OverflowError,
  34384. "c-string too long to convert to Python");
  34385. return NULL;
  34386. }
  34387. length = (Py_ssize_t) slen;
  34388. if (start < 0) {
  34389. start += length;
  34390. if (start < 0)
  34391. start = 0;
  34392. }
  34393. if (stop < 0)
  34394. stop += length;
  34395. }
  34396. length = stop - start;
  34397. if (unlikely(length <= 0))
  34398. return PyUnicode_FromUnicode(NULL, 0);
  34399. cstring += start;
  34400. if (decode_func) {
  34401. return decode_func(cstring, length, errors);
  34402. } else {
  34403. return PyUnicode_Decode(cstring, length, encoding, errors);
  34404. }
  34405. }
  34406. /* Import */
  34407. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
  34408. PyObject *empty_list = 0;
  34409. PyObject *module = 0;
  34410. PyObject *global_dict = 0;
  34411. PyObject *empty_dict = 0;
  34412. PyObject *list;
  34413. #if PY_MAJOR_VERSION < 3
  34414. PyObject *py_import;
  34415. py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
  34416. if (!py_import)
  34417. goto bad;
  34418. #endif
  34419. if (from_list)
  34420. list = from_list;
  34421. else {
  34422. empty_list = PyList_New(0);
  34423. if (!empty_list)
  34424. goto bad;
  34425. list = empty_list;
  34426. }
  34427. global_dict = PyModule_GetDict(__pyx_m);
  34428. if (!global_dict)
  34429. goto bad;
  34430. empty_dict = PyDict_New();
  34431. if (!empty_dict)
  34432. goto bad;
  34433. {
  34434. #if PY_MAJOR_VERSION >= 3
  34435. if (level == -1) {
  34436. if (strchr(__Pyx_MODULE_NAME, '.')) {
  34437. module = PyImport_ImportModuleLevelObject(
  34438. name, global_dict, empty_dict, list, 1);
  34439. if (!module) {
  34440. if (!PyErr_ExceptionMatches(PyExc_ImportError))
  34441. goto bad;
  34442. PyErr_Clear();
  34443. }
  34444. }
  34445. level = 0;
  34446. }
  34447. #endif
  34448. if (!module) {
  34449. #if PY_MAJOR_VERSION < 3
  34450. PyObject *py_level = PyInt_FromLong(level);
  34451. if (!py_level)
  34452. goto bad;
  34453. module = PyObject_CallFunctionObjArgs(py_import,
  34454. name, global_dict, empty_dict, list, py_level, NULL);
  34455. Py_DECREF(py_level);
  34456. #else
  34457. module = PyImport_ImportModuleLevelObject(
  34458. name, global_dict, empty_dict, list, level);
  34459. #endif
  34460. }
  34461. }
  34462. bad:
  34463. #if PY_MAJOR_VERSION < 3
  34464. Py_XDECREF(py_import);
  34465. #endif
  34466. Py_XDECREF(empty_list);
  34467. Py_XDECREF(empty_dict);
  34468. return module;
  34469. }
  34470. /* ImportFrom */
  34471. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
  34472. PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
  34473. if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
  34474. PyErr_Format(PyExc_ImportError,
  34475. #if PY_MAJOR_VERSION < 3
  34476. "cannot import name %.230s", PyString_AS_STRING(name));
  34477. #else
  34478. "cannot import name %S", name);
  34479. #endif
  34480. }
  34481. return value;
  34482. }
  34483. /* HasAttr */
  34484. static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
  34485. PyObject *r;
  34486. if (unlikely(!__Pyx_PyBaseString_Check(n))) {
  34487. PyErr_SetString(PyExc_TypeError,
  34488. "hasattr(): attribute name must be string");
  34489. return -1;
  34490. }
  34491. r = __Pyx_GetAttr(o, n);
  34492. if (unlikely(!r)) {
  34493. PyErr_Clear();
  34494. return 0;
  34495. } else {
  34496. Py_DECREF(r);
  34497. return 1;
  34498. }
  34499. }
  34500. /* CallNextTpDealloc */
  34501. static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc) {
  34502. PyTypeObject* type = Py_TYPE(obj);
  34503. while (type && type->tp_dealloc != current_tp_dealloc)
  34504. type = type->tp_base;
  34505. while (type && type->tp_dealloc == current_tp_dealloc)
  34506. type = type->tp_base;
  34507. if (type)
  34508. type->tp_dealloc(obj);
  34509. }
  34510. /* PyObject_GenericGetAttrNoDict */
  34511. #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
  34512. static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
  34513. PyErr_Format(PyExc_AttributeError,
  34514. #if PY_MAJOR_VERSION >= 3
  34515. "'%.50s' object has no attribute '%U'",
  34516. tp->tp_name, attr_name);
  34517. #else
  34518. "'%.50s' object has no attribute '%.400s'",
  34519. tp->tp_name, PyString_AS_STRING(attr_name));
  34520. #endif
  34521. return NULL;
  34522. }
  34523. static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
  34524. PyObject *descr;
  34525. PyTypeObject *tp = Py_TYPE(obj);
  34526. if (unlikely(!PyString_Check(attr_name))) {
  34527. return PyObject_GenericGetAttr(obj, attr_name);
  34528. }
  34529. assert(!tp->tp_dictoffset);
  34530. descr = _PyType_Lookup(tp, attr_name);
  34531. if (unlikely(!descr)) {
  34532. return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
  34533. }
  34534. Py_INCREF(descr);
  34535. #if PY_MAJOR_VERSION < 3
  34536. if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
  34537. #endif
  34538. {
  34539. descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
  34540. if (unlikely(f)) {
  34541. PyObject *res = f(descr, obj, (PyObject *)tp);
  34542. Py_DECREF(descr);
  34543. return res;
  34544. }
  34545. }
  34546. return descr;
  34547. }
  34548. #endif
  34549. /* PyObject_GenericGetAttr */
  34550. #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
  34551. static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
  34552. if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
  34553. return PyObject_GenericGetAttr(obj, attr_name);
  34554. }
  34555. return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
  34556. }
  34557. #endif
  34558. /* SetVTable */
  34559. static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
  34560. #if PY_VERSION_HEX >= 0x02070000
  34561. PyObject *ob = PyCapsule_New(vtable, 0, 0);
  34562. #else
  34563. PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
  34564. #endif
  34565. if (!ob)
  34566. goto bad;
  34567. if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
  34568. goto bad;
  34569. Py_DECREF(ob);
  34570. return 0;
  34571. bad:
  34572. Py_XDECREF(ob);
  34573. return -1;
  34574. }
  34575. /* SetupReduce */
  34576. static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  34577. int ret;
  34578. PyObject *name_attr;
  34579. name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
  34580. if (likely(name_attr)) {
  34581. ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
  34582. } else {
  34583. ret = -1;
  34584. }
  34585. if (unlikely(ret < 0)) {
  34586. PyErr_Clear();
  34587. ret = 0;
  34588. }
  34589. Py_XDECREF(name_attr);
  34590. return ret;
  34591. }
  34592. static int __Pyx_setup_reduce(PyObject* type_obj) {
  34593. int ret = 0;
  34594. PyObject *object_reduce = NULL;
  34595. PyObject *object_reduce_ex = NULL;
  34596. PyObject *reduce = NULL;
  34597. PyObject *reduce_ex = NULL;
  34598. PyObject *reduce_cython = NULL;
  34599. PyObject *setstate = NULL;
  34600. PyObject *setstate_cython = NULL;
  34601. #if CYTHON_USE_PYTYPE_LOOKUP
  34602. if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto GOOD;
  34603. #else
  34604. if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto GOOD;
  34605. #endif
  34606. #if CYTHON_USE_PYTYPE_LOOKUP
  34607. object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
  34608. #else
  34609. object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
  34610. #endif
  34611. reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto BAD;
  34612. if (reduce_ex == object_reduce_ex) {
  34613. #if CYTHON_USE_PYTYPE_LOOKUP
  34614. object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
  34615. #else
  34616. object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
  34617. #endif
  34618. reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto BAD;
  34619. if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
  34620. reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto BAD;
  34621. ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto BAD;
  34622. ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto BAD;
  34623. setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
  34624. if (!setstate) PyErr_Clear();
  34625. if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
  34626. setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto BAD;
  34627. ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto BAD;
  34628. ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto BAD;
  34629. }
  34630. PyType_Modified((PyTypeObject*)type_obj);
  34631. }
  34632. }
  34633. goto GOOD;
  34634. BAD:
  34635. if (!PyErr_Occurred())
  34636. PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
  34637. ret = -1;
  34638. GOOD:
  34639. #if !CYTHON_USE_PYTYPE_LOOKUP
  34640. Py_XDECREF(object_reduce);
  34641. Py_XDECREF(object_reduce_ex);
  34642. #endif
  34643. Py_XDECREF(reduce);
  34644. Py_XDECREF(reduce_ex);
  34645. Py_XDECREF(reduce_cython);
  34646. Py_XDECREF(setstate);
  34647. Py_XDECREF(setstate_cython);
  34648. return ret;
  34649. }
  34650. /* GetVTable */
  34651. static void* __Pyx_GetVtable(PyObject *dict) {
  34652. void* ptr;
  34653. PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
  34654. if (!ob)
  34655. goto bad;
  34656. #if PY_VERSION_HEX >= 0x02070000
  34657. ptr = PyCapsule_GetPointer(ob, 0);
  34658. #else
  34659. ptr = PyCObject_AsVoidPtr(ob);
  34660. #endif
  34661. if (!ptr && !PyErr_Occurred())
  34662. PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
  34663. Py_DECREF(ob);
  34664. return ptr;
  34665. bad:
  34666. Py_XDECREF(ob);
  34667. return NULL;
  34668. }
  34669. /* GetNameInClass */
  34670. static PyObject *__Pyx_GetGlobalNameAfterAttributeLookup(PyObject *name) {
  34671. __Pyx_PyThreadState_declare
  34672. __Pyx_PyThreadState_assign
  34673. if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
  34674. return NULL;
  34675. __Pyx_PyErr_Clear();
  34676. return __Pyx_GetModuleGlobalName(name);
  34677. }
  34678. static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name) {
  34679. PyObject *result;
  34680. result = __Pyx_PyObject_GetAttrStr(nmspace, name);
  34681. if (!result) {
  34682. result = __Pyx_GetGlobalNameAfterAttributeLookup(name);
  34683. }
  34684. return result;
  34685. }
  34686. /* CLineInTraceback */
  34687. #ifndef CYTHON_CLINE_IN_TRACEBACK
  34688. static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) {
  34689. PyObject *use_cline;
  34690. PyObject *ptype, *pvalue, *ptraceback;
  34691. #if CYTHON_COMPILING_IN_CPYTHON
  34692. PyObject **cython_runtime_dict;
  34693. #endif
  34694. if (unlikely(!__pyx_cython_runtime)) {
  34695. return c_line;
  34696. }
  34697. __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
  34698. #if CYTHON_COMPILING_IN_CPYTHON
  34699. cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
  34700. if (likely(cython_runtime_dict)) {
  34701. use_cline = __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback);
  34702. } else
  34703. #endif
  34704. {
  34705. PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
  34706. if (use_cline_obj) {
  34707. use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
  34708. Py_DECREF(use_cline_obj);
  34709. } else {
  34710. PyErr_Clear();
  34711. use_cline = NULL;
  34712. }
  34713. }
  34714. if (!use_cline) {
  34715. c_line = 0;
  34716. PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
  34717. }
  34718. else if (PyObject_Not(use_cline) != 0) {
  34719. c_line = 0;
  34720. }
  34721. __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
  34722. return c_line;
  34723. }
  34724. #endif
  34725. /* CodeObjectCache */
  34726. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
  34727. int start = 0, mid = 0, end = count - 1;
  34728. if (end >= 0 && code_line > entries[end].code_line) {
  34729. return count;
  34730. }
  34731. while (start < end) {
  34732. mid = start + (end - start) / 2;
  34733. if (code_line < entries[mid].code_line) {
  34734. end = mid;
  34735. } else if (code_line > entries[mid].code_line) {
  34736. start = mid + 1;
  34737. } else {
  34738. return mid;
  34739. }
  34740. }
  34741. if (code_line <= entries[mid].code_line) {
  34742. return mid;
  34743. } else {
  34744. return mid + 1;
  34745. }
  34746. }
  34747. static PyCodeObject *__pyx_find_code_object(int code_line) {
  34748. PyCodeObject* code_object;
  34749. int pos;
  34750. if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
  34751. return NULL;
  34752. }
  34753. pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  34754. if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
  34755. return NULL;
  34756. }
  34757. code_object = __pyx_code_cache.entries[pos].code_object;
  34758. Py_INCREF(code_object);
  34759. return code_object;
  34760. }
  34761. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
  34762. int pos, i;
  34763. __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
  34764. if (unlikely(!code_line)) {
  34765. return;
  34766. }
  34767. if (unlikely(!entries)) {
  34768. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
  34769. if (likely(entries)) {
  34770. __pyx_code_cache.entries = entries;
  34771. __pyx_code_cache.max_count = 64;
  34772. __pyx_code_cache.count = 1;
  34773. entries[0].code_line = code_line;
  34774. entries[0].code_object = code_object;
  34775. Py_INCREF(code_object);
  34776. }
  34777. return;
  34778. }
  34779. pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  34780. if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
  34781. PyCodeObject* tmp = entries[pos].code_object;
  34782. entries[pos].code_object = code_object;
  34783. Py_DECREF(tmp);
  34784. return;
  34785. }
  34786. if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
  34787. int new_max = __pyx_code_cache.max_count + 64;
  34788. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
  34789. __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
  34790. if (unlikely(!entries)) {
  34791. return;
  34792. }
  34793. __pyx_code_cache.entries = entries;
  34794. __pyx_code_cache.max_count = new_max;
  34795. }
  34796. for (i=__pyx_code_cache.count; i>pos; i--) {
  34797. entries[i] = entries[i-1];
  34798. }
  34799. entries[pos].code_line = code_line;
  34800. entries[pos].code_object = code_object;
  34801. __pyx_code_cache.count++;
  34802. Py_INCREF(code_object);
  34803. }
  34804. /* AddTraceback */
  34805. #include "compile.h"
  34806. #include "frameobject.h"
  34807. #include "traceback.h"
  34808. static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
  34809. const char *funcname, int c_line,
  34810. int py_line, const char *filename) {
  34811. PyCodeObject *py_code = 0;
  34812. PyObject *py_srcfile = 0;
  34813. PyObject *py_funcname = 0;
  34814. #if PY_MAJOR_VERSION < 3
  34815. py_srcfile = PyString_FromString(filename);
  34816. #else
  34817. py_srcfile = PyUnicode_FromString(filename);
  34818. #endif
  34819. if (!py_srcfile) goto bad;
  34820. if (c_line) {
  34821. #if PY_MAJOR_VERSION < 3
  34822. py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  34823. #else
  34824. py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  34825. #endif
  34826. }
  34827. else {
  34828. #if PY_MAJOR_VERSION < 3
  34829. py_funcname = PyString_FromString(funcname);
  34830. #else
  34831. py_funcname = PyUnicode_FromString(funcname);
  34832. #endif
  34833. }
  34834. if (!py_funcname) goto bad;
  34835. py_code = __Pyx_PyCode_New(
  34836. 0,
  34837. 0,
  34838. 0,
  34839. 0,
  34840. 0,
  34841. __pyx_empty_bytes, /*PyObject *code,*/
  34842. __pyx_empty_tuple, /*PyObject *consts,*/
  34843. __pyx_empty_tuple, /*PyObject *names,*/
  34844. __pyx_empty_tuple, /*PyObject *varnames,*/
  34845. __pyx_empty_tuple, /*PyObject *freevars,*/
  34846. __pyx_empty_tuple, /*PyObject *cellvars,*/
  34847. py_srcfile, /*PyObject *filename,*/
  34848. py_funcname, /*PyObject *name,*/
  34849. py_line,
  34850. __pyx_empty_bytes /*PyObject *lnotab*/
  34851. );
  34852. Py_DECREF(py_srcfile);
  34853. Py_DECREF(py_funcname);
  34854. return py_code;
  34855. bad:
  34856. Py_XDECREF(py_srcfile);
  34857. Py_XDECREF(py_funcname);
  34858. return NULL;
  34859. }
  34860. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  34861. int py_line, const char *filename) {
  34862. PyCodeObject *py_code = 0;
  34863. PyFrameObject *py_frame = 0;
  34864. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  34865. if (c_line) {
  34866. c_line = __Pyx_CLineForTraceback(tstate, c_line);
  34867. }
  34868. py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
  34869. if (!py_code) {
  34870. py_code = __Pyx_CreateCodeObjectForTraceback(
  34871. funcname, c_line, py_line, filename);
  34872. if (!py_code) goto bad;
  34873. __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
  34874. }
  34875. py_frame = PyFrame_New(
  34876. tstate, /*PyThreadState *tstate,*/
  34877. py_code, /*PyCodeObject *code,*/
  34878. __pyx_d, /*PyObject *globals,*/
  34879. 0 /*PyObject *locals*/
  34880. );
  34881. if (!py_frame) goto bad;
  34882. __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
  34883. PyTraceBack_Here(py_frame);
  34884. bad:
  34885. Py_XDECREF(py_code);
  34886. Py_XDECREF(py_frame);
  34887. }
  34888. /* CIntFromPyVerify */
  34889. #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
  34890. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
  34891. #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
  34892. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
  34893. #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
  34894. {\
  34895. func_type value = func_value;\
  34896. if (sizeof(target_type) < sizeof(func_type)) {\
  34897. if (unlikely(value != (func_type) (target_type) value)) {\
  34898. func_type zero = 0;\
  34899. if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
  34900. return (target_type) -1;\
  34901. if (is_unsigned && unlikely(value < zero))\
  34902. goto raise_neg_overflow;\
  34903. else\
  34904. goto raise_overflow;\
  34905. }\
  34906. }\
  34907. return (target_type) value;\
  34908. }
  34909. /* CIntToPy */
  34910. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
  34911. const int neg_one = (int) -1, const_zero = (int) 0;
  34912. const int is_unsigned = neg_one > const_zero;
  34913. if (is_unsigned) {
  34914. if (sizeof(int) < sizeof(long)) {
  34915. return PyInt_FromLong((long) value);
  34916. } else if (sizeof(int) <= sizeof(unsigned long)) {
  34917. return PyLong_FromUnsignedLong((unsigned long) value);
  34918. #ifdef HAVE_LONG_LONG
  34919. } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
  34920. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  34921. #endif
  34922. }
  34923. } else {
  34924. if (sizeof(int) <= sizeof(long)) {
  34925. return PyInt_FromLong((long) value);
  34926. #ifdef HAVE_LONG_LONG
  34927. } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
  34928. return PyLong_FromLongLong((PY_LONG_LONG) value);
  34929. #endif
  34930. }
  34931. }
  34932. {
  34933. int one = 1; int little = (int)*(unsigned char *)&one;
  34934. unsigned char *bytes = (unsigned char *)&value;
  34935. return _PyLong_FromByteArray(bytes, sizeof(int),
  34936. little, !is_unsigned);
  34937. }
  34938. }
  34939. /* CIntToPy */
  34940. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value) {
  34941. const unsigned char neg_one = (unsigned char) -1, const_zero = (unsigned char) 0;
  34942. const int is_unsigned = neg_one > const_zero;
  34943. if (is_unsigned) {
  34944. if (sizeof(unsigned char) < sizeof(long)) {
  34945. return PyInt_FromLong((long) value);
  34946. } else if (sizeof(unsigned char) <= sizeof(unsigned long)) {
  34947. return PyLong_FromUnsignedLong((unsigned long) value);
  34948. #ifdef HAVE_LONG_LONG
  34949. } else if (sizeof(unsigned char) <= sizeof(unsigned PY_LONG_LONG)) {
  34950. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  34951. #endif
  34952. }
  34953. } else {
  34954. if (sizeof(unsigned char) <= sizeof(long)) {
  34955. return PyInt_FromLong((long) value);
  34956. #ifdef HAVE_LONG_LONG
  34957. } else if (sizeof(unsigned char) <= sizeof(PY_LONG_LONG)) {
  34958. return PyLong_FromLongLong((PY_LONG_LONG) value);
  34959. #endif
  34960. }
  34961. }
  34962. {
  34963. int one = 1; int little = (int)*(unsigned char *)&one;
  34964. unsigned char *bytes = (unsigned char *)&value;
  34965. return _PyLong_FromByteArray(bytes, sizeof(unsigned char),
  34966. little, !is_unsigned);
  34967. }
  34968. }
  34969. /* CIntToPy */
  34970. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
  34971. const long neg_one = (long) -1, const_zero = (long) 0;
  34972. const int is_unsigned = neg_one > const_zero;
  34973. if (is_unsigned) {
  34974. if (sizeof(long) < sizeof(long)) {
  34975. return PyInt_FromLong((long) value);
  34976. } else if (sizeof(long) <= sizeof(unsigned long)) {
  34977. return PyLong_FromUnsignedLong((unsigned long) value);
  34978. #ifdef HAVE_LONG_LONG
  34979. } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
  34980. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  34981. #endif
  34982. }
  34983. } else {
  34984. if (sizeof(long) <= sizeof(long)) {
  34985. return PyInt_FromLong((long) value);
  34986. #ifdef HAVE_LONG_LONG
  34987. } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
  34988. return PyLong_FromLongLong((PY_LONG_LONG) value);
  34989. #endif
  34990. }
  34991. }
  34992. {
  34993. int one = 1; int little = (int)*(unsigned char *)&one;
  34994. unsigned char *bytes = (unsigned char *)&value;
  34995. return _PyLong_FromByteArray(bytes, sizeof(long),
  34996. little, !is_unsigned);
  34997. }
  34998. }
  34999. /* CIntToPy */
  35000. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_MDB_dbi(MDB_dbi value) {
  35001. const MDB_dbi neg_one = (MDB_dbi) -1, const_zero = (MDB_dbi) 0;
  35002. const int is_unsigned = neg_one > const_zero;
  35003. if (is_unsigned) {
  35004. if (sizeof(MDB_dbi) < sizeof(long)) {
  35005. return PyInt_FromLong((long) value);
  35006. } else if (sizeof(MDB_dbi) <= sizeof(unsigned long)) {
  35007. return PyLong_FromUnsignedLong((unsigned long) value);
  35008. #ifdef HAVE_LONG_LONG
  35009. } else if (sizeof(MDB_dbi) <= sizeof(unsigned PY_LONG_LONG)) {
  35010. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  35011. #endif
  35012. }
  35013. } else {
  35014. if (sizeof(MDB_dbi) <= sizeof(long)) {
  35015. return PyInt_FromLong((long) value);
  35016. #ifdef HAVE_LONG_LONG
  35017. } else if (sizeof(MDB_dbi) <= sizeof(PY_LONG_LONG)) {
  35018. return PyLong_FromLongLong((PY_LONG_LONG) value);
  35019. #endif
  35020. }
  35021. }
  35022. {
  35023. int one = 1; int little = (int)*(unsigned char *)&one;
  35024. unsigned char *bytes = (unsigned char *)&value;
  35025. return _PyLong_FromByteArray(bytes, sizeof(MDB_dbi),
  35026. little, !is_unsigned);
  35027. }
  35028. }
  35029. /* CIntToPy */
  35030. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_char(char value) {
  35031. const char neg_one = (char) -1, const_zero = (char) 0;
  35032. const int is_unsigned = neg_one > const_zero;
  35033. if (is_unsigned) {
  35034. if (sizeof(char) < sizeof(long)) {
  35035. return PyInt_FromLong((long) value);
  35036. } else if (sizeof(char) <= sizeof(unsigned long)) {
  35037. return PyLong_FromUnsignedLong((unsigned long) value);
  35038. #ifdef HAVE_LONG_LONG
  35039. } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
  35040. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  35041. #endif
  35042. }
  35043. } else {
  35044. if (sizeof(char) <= sizeof(long)) {
  35045. return PyInt_FromLong((long) value);
  35046. #ifdef HAVE_LONG_LONG
  35047. } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
  35048. return PyLong_FromLongLong((PY_LONG_LONG) value);
  35049. #endif
  35050. }
  35051. }
  35052. {
  35053. int one = 1; int little = (int)*(unsigned char *)&one;
  35054. unsigned char *bytes = (unsigned char *)&value;
  35055. return _PyLong_FromByteArray(bytes, sizeof(char),
  35056. little, !is_unsigned);
  35057. }
  35058. }
  35059. /* CIntFromPy */
  35060. static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
  35061. const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
  35062. const int is_unsigned = neg_one > const_zero;
  35063. #if PY_MAJOR_VERSION < 3
  35064. if (likely(PyInt_Check(x))) {
  35065. if (sizeof(size_t) < sizeof(long)) {
  35066. __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
  35067. } else {
  35068. long val = PyInt_AS_LONG(x);
  35069. if (is_unsigned && unlikely(val < 0)) {
  35070. goto raise_neg_overflow;
  35071. }
  35072. return (size_t) val;
  35073. }
  35074. } else
  35075. #endif
  35076. if (likely(PyLong_Check(x))) {
  35077. if (is_unsigned) {
  35078. #if CYTHON_USE_PYLONG_INTERNALS
  35079. const digit* digits = ((PyLongObject*)x)->ob_digit;
  35080. switch (Py_SIZE(x)) {
  35081. case 0: return (size_t) 0;
  35082. case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
  35083. case 2:
  35084. if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
  35085. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  35086. __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35087. } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) {
  35088. return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  35089. }
  35090. }
  35091. break;
  35092. case 3:
  35093. if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
  35094. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  35095. __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35096. } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) {
  35097. return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  35098. }
  35099. }
  35100. break;
  35101. case 4:
  35102. if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
  35103. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  35104. __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35105. } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) {
  35106. return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  35107. }
  35108. }
  35109. break;
  35110. }
  35111. #endif
  35112. #if CYTHON_COMPILING_IN_CPYTHON
  35113. if (unlikely(Py_SIZE(x) < 0)) {
  35114. goto raise_neg_overflow;
  35115. }
  35116. #else
  35117. {
  35118. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  35119. if (unlikely(result < 0))
  35120. return (size_t) -1;
  35121. if (unlikely(result == 1))
  35122. goto raise_neg_overflow;
  35123. }
  35124. #endif
  35125. if (sizeof(size_t) <= sizeof(unsigned long)) {
  35126. __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
  35127. #ifdef HAVE_LONG_LONG
  35128. } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
  35129. __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  35130. #endif
  35131. }
  35132. } else {
  35133. #if CYTHON_USE_PYLONG_INTERNALS
  35134. const digit* digits = ((PyLongObject*)x)->ob_digit;
  35135. switch (Py_SIZE(x)) {
  35136. case 0: return (size_t) 0;
  35137. case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
  35138. case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +digits[0])
  35139. case -2:
  35140. if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) {
  35141. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  35142. __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35143. } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
  35144. return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
  35145. }
  35146. }
  35147. break;
  35148. case 2:
  35149. if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
  35150. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  35151. __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35152. } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
  35153. return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
  35154. }
  35155. }
  35156. break;
  35157. case -3:
  35158. if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
  35159. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  35160. __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35161. } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
  35162. return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
  35163. }
  35164. }
  35165. break;
  35166. case 3:
  35167. if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
  35168. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  35169. __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35170. } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
  35171. return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
  35172. }
  35173. }
  35174. break;
  35175. case -4:
  35176. if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
  35177. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  35178. __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35179. } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
  35180. return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
  35181. }
  35182. }
  35183. break;
  35184. case 4:
  35185. if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
  35186. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  35187. __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35188. } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
  35189. return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
  35190. }
  35191. }
  35192. break;
  35193. }
  35194. #endif
  35195. if (sizeof(size_t) <= sizeof(long)) {
  35196. __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
  35197. #ifdef HAVE_LONG_LONG
  35198. } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
  35199. __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
  35200. #endif
  35201. }
  35202. }
  35203. {
  35204. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  35205. PyErr_SetString(PyExc_RuntimeError,
  35206. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  35207. #else
  35208. size_t val;
  35209. PyObject *v = __Pyx_PyNumber_IntOrLong(x);
  35210. #if PY_MAJOR_VERSION < 3
  35211. if (likely(v) && !PyLong_Check(v)) {
  35212. PyObject *tmp = v;
  35213. v = PyNumber_Long(tmp);
  35214. Py_DECREF(tmp);
  35215. }
  35216. #endif
  35217. if (likely(v)) {
  35218. int one = 1; int is_little = (int)*(unsigned char *)&one;
  35219. unsigned char *bytes = (unsigned char *)&val;
  35220. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  35221. bytes, sizeof(val),
  35222. is_little, !is_unsigned);
  35223. Py_DECREF(v);
  35224. if (likely(!ret))
  35225. return val;
  35226. }
  35227. #endif
  35228. return (size_t) -1;
  35229. }
  35230. } else {
  35231. size_t val;
  35232. PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
  35233. if (!tmp) return (size_t) -1;
  35234. val = __Pyx_PyInt_As_size_t(tmp);
  35235. Py_DECREF(tmp);
  35236. return val;
  35237. }
  35238. raise_overflow:
  35239. PyErr_SetString(PyExc_OverflowError,
  35240. "value too large to convert to size_t");
  35241. return (size_t) -1;
  35242. raise_neg_overflow:
  35243. PyErr_SetString(PyExc_OverflowError,
  35244. "can't convert negative value to size_t");
  35245. return (size_t) -1;
  35246. }
  35247. /* CIntFromPy */
  35248. static CYTHON_INLINE unsigned char __Pyx_PyInt_As_unsigned_char(PyObject *x) {
  35249. const unsigned char neg_one = (unsigned char) -1, const_zero = (unsigned char) 0;
  35250. const int is_unsigned = neg_one > const_zero;
  35251. #if PY_MAJOR_VERSION < 3
  35252. if (likely(PyInt_Check(x))) {
  35253. if (sizeof(unsigned char) < sizeof(long)) {
  35254. __PYX_VERIFY_RETURN_INT(unsigned char, long, PyInt_AS_LONG(x))
  35255. } else {
  35256. long val = PyInt_AS_LONG(x);
  35257. if (is_unsigned && unlikely(val < 0)) {
  35258. goto raise_neg_overflow;
  35259. }
  35260. return (unsigned char) val;
  35261. }
  35262. } else
  35263. #endif
  35264. if (likely(PyLong_Check(x))) {
  35265. if (is_unsigned) {
  35266. #if CYTHON_USE_PYLONG_INTERNALS
  35267. const digit* digits = ((PyLongObject*)x)->ob_digit;
  35268. switch (Py_SIZE(x)) {
  35269. case 0: return (unsigned char) 0;
  35270. case 1: __PYX_VERIFY_RETURN_INT(unsigned char, digit, digits[0])
  35271. case 2:
  35272. if (8 * sizeof(unsigned char) > 1 * PyLong_SHIFT) {
  35273. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  35274. __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35275. } else if (8 * sizeof(unsigned char) >= 2 * PyLong_SHIFT) {
  35276. return (unsigned char) (((((unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]));
  35277. }
  35278. }
  35279. break;
  35280. case 3:
  35281. if (8 * sizeof(unsigned char) > 2 * PyLong_SHIFT) {
  35282. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  35283. __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35284. } else if (8 * sizeof(unsigned char) >= 3 * PyLong_SHIFT) {
  35285. return (unsigned char) (((((((unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]));
  35286. }
  35287. }
  35288. break;
  35289. case 4:
  35290. if (8 * sizeof(unsigned char) > 3 * PyLong_SHIFT) {
  35291. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  35292. __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35293. } else if (8 * sizeof(unsigned char) >= 4 * PyLong_SHIFT) {
  35294. return (unsigned char) (((((((((unsigned char)digits[3]) << PyLong_SHIFT) | (unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]));
  35295. }
  35296. }
  35297. break;
  35298. }
  35299. #endif
  35300. #if CYTHON_COMPILING_IN_CPYTHON
  35301. if (unlikely(Py_SIZE(x) < 0)) {
  35302. goto raise_neg_overflow;
  35303. }
  35304. #else
  35305. {
  35306. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  35307. if (unlikely(result < 0))
  35308. return (unsigned char) -1;
  35309. if (unlikely(result == 1))
  35310. goto raise_neg_overflow;
  35311. }
  35312. #endif
  35313. if (sizeof(unsigned char) <= sizeof(unsigned long)) {
  35314. __PYX_VERIFY_RETURN_INT_EXC(unsigned char, unsigned long, PyLong_AsUnsignedLong(x))
  35315. #ifdef HAVE_LONG_LONG
  35316. } else if (sizeof(unsigned char) <= sizeof(unsigned PY_LONG_LONG)) {
  35317. __PYX_VERIFY_RETURN_INT_EXC(unsigned char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  35318. #endif
  35319. }
  35320. } else {
  35321. #if CYTHON_USE_PYLONG_INTERNALS
  35322. const digit* digits = ((PyLongObject*)x)->ob_digit;
  35323. switch (Py_SIZE(x)) {
  35324. case 0: return (unsigned char) 0;
  35325. case -1: __PYX_VERIFY_RETURN_INT(unsigned char, sdigit, (sdigit) (-(sdigit)digits[0]))
  35326. case 1: __PYX_VERIFY_RETURN_INT(unsigned char, digit, +digits[0])
  35327. case -2:
  35328. if (8 * sizeof(unsigned char) - 1 > 1 * PyLong_SHIFT) {
  35329. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  35330. __PYX_VERIFY_RETURN_INT(unsigned char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35331. } else if (8 * sizeof(unsigned char) - 1 > 2 * PyLong_SHIFT) {
  35332. return (unsigned char) (((unsigned char)-1)*(((((unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])));
  35333. }
  35334. }
  35335. break;
  35336. case 2:
  35337. if (8 * sizeof(unsigned char) > 1 * PyLong_SHIFT) {
  35338. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  35339. __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35340. } else if (8 * sizeof(unsigned char) - 1 > 2 * PyLong_SHIFT) {
  35341. return (unsigned char) ((((((unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])));
  35342. }
  35343. }
  35344. break;
  35345. case -3:
  35346. if (8 * sizeof(unsigned char) - 1 > 2 * PyLong_SHIFT) {
  35347. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  35348. __PYX_VERIFY_RETURN_INT(unsigned char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35349. } else if (8 * sizeof(unsigned char) - 1 > 3 * PyLong_SHIFT) {
  35350. return (unsigned char) (((unsigned char)-1)*(((((((unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])));
  35351. }
  35352. }
  35353. break;
  35354. case 3:
  35355. if (8 * sizeof(unsigned char) > 2 * PyLong_SHIFT) {
  35356. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  35357. __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35358. } else if (8 * sizeof(unsigned char) - 1 > 3 * PyLong_SHIFT) {
  35359. return (unsigned char) ((((((((unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])));
  35360. }
  35361. }
  35362. break;
  35363. case -4:
  35364. if (8 * sizeof(unsigned char) - 1 > 3 * PyLong_SHIFT) {
  35365. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  35366. __PYX_VERIFY_RETURN_INT(unsigned char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35367. } else if (8 * sizeof(unsigned char) - 1 > 4 * PyLong_SHIFT) {
  35368. return (unsigned char) (((unsigned char)-1)*(((((((((unsigned char)digits[3]) << PyLong_SHIFT) | (unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])));
  35369. }
  35370. }
  35371. break;
  35372. case 4:
  35373. if (8 * sizeof(unsigned char) > 3 * PyLong_SHIFT) {
  35374. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  35375. __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35376. } else if (8 * sizeof(unsigned char) - 1 > 4 * PyLong_SHIFT) {
  35377. return (unsigned char) ((((((((((unsigned char)digits[3]) << PyLong_SHIFT) | (unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])));
  35378. }
  35379. }
  35380. break;
  35381. }
  35382. #endif
  35383. if (sizeof(unsigned char) <= sizeof(long)) {
  35384. __PYX_VERIFY_RETURN_INT_EXC(unsigned char, long, PyLong_AsLong(x))
  35385. #ifdef HAVE_LONG_LONG
  35386. } else if (sizeof(unsigned char) <= sizeof(PY_LONG_LONG)) {
  35387. __PYX_VERIFY_RETURN_INT_EXC(unsigned char, PY_LONG_LONG, PyLong_AsLongLong(x))
  35388. #endif
  35389. }
  35390. }
  35391. {
  35392. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  35393. PyErr_SetString(PyExc_RuntimeError,
  35394. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  35395. #else
  35396. unsigned char val;
  35397. PyObject *v = __Pyx_PyNumber_IntOrLong(x);
  35398. #if PY_MAJOR_VERSION < 3
  35399. if (likely(v) && !PyLong_Check(v)) {
  35400. PyObject *tmp = v;
  35401. v = PyNumber_Long(tmp);
  35402. Py_DECREF(tmp);
  35403. }
  35404. #endif
  35405. if (likely(v)) {
  35406. int one = 1; int is_little = (int)*(unsigned char *)&one;
  35407. unsigned char *bytes = (unsigned char *)&val;
  35408. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  35409. bytes, sizeof(val),
  35410. is_little, !is_unsigned);
  35411. Py_DECREF(v);
  35412. if (likely(!ret))
  35413. return val;
  35414. }
  35415. #endif
  35416. return (unsigned char) -1;
  35417. }
  35418. } else {
  35419. unsigned char val;
  35420. PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
  35421. if (!tmp) return (unsigned char) -1;
  35422. val = __Pyx_PyInt_As_unsigned_char(tmp);
  35423. Py_DECREF(tmp);
  35424. return val;
  35425. }
  35426. raise_overflow:
  35427. PyErr_SetString(PyExc_OverflowError,
  35428. "value too large to convert to unsigned char");
  35429. return (unsigned char) -1;
  35430. raise_neg_overflow:
  35431. PyErr_SetString(PyExc_OverflowError,
  35432. "can't convert negative value to unsigned char");
  35433. return (unsigned char) -1;
  35434. }
  35435. /* CIntFromPy */
  35436. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
  35437. const long neg_one = (long) -1, const_zero = (long) 0;
  35438. const int is_unsigned = neg_one > const_zero;
  35439. #if PY_MAJOR_VERSION < 3
  35440. if (likely(PyInt_Check(x))) {
  35441. if (sizeof(long) < sizeof(long)) {
  35442. __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
  35443. } else {
  35444. long val = PyInt_AS_LONG(x);
  35445. if (is_unsigned && unlikely(val < 0)) {
  35446. goto raise_neg_overflow;
  35447. }
  35448. return (long) val;
  35449. }
  35450. } else
  35451. #endif
  35452. if (likely(PyLong_Check(x))) {
  35453. if (is_unsigned) {
  35454. #if CYTHON_USE_PYLONG_INTERNALS
  35455. const digit* digits = ((PyLongObject*)x)->ob_digit;
  35456. switch (Py_SIZE(x)) {
  35457. case 0: return (long) 0;
  35458. case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
  35459. case 2:
  35460. if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
  35461. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  35462. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35463. } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
  35464. return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  35465. }
  35466. }
  35467. break;
  35468. case 3:
  35469. if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
  35470. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  35471. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35472. } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
  35473. return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  35474. }
  35475. }
  35476. break;
  35477. case 4:
  35478. if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
  35479. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  35480. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35481. } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
  35482. return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  35483. }
  35484. }
  35485. break;
  35486. }
  35487. #endif
  35488. #if CYTHON_COMPILING_IN_CPYTHON
  35489. if (unlikely(Py_SIZE(x) < 0)) {
  35490. goto raise_neg_overflow;
  35491. }
  35492. #else
  35493. {
  35494. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  35495. if (unlikely(result < 0))
  35496. return (long) -1;
  35497. if (unlikely(result == 1))
  35498. goto raise_neg_overflow;
  35499. }
  35500. #endif
  35501. if (sizeof(long) <= sizeof(unsigned long)) {
  35502. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
  35503. #ifdef HAVE_LONG_LONG
  35504. } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
  35505. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  35506. #endif
  35507. }
  35508. } else {
  35509. #if CYTHON_USE_PYLONG_INTERNALS
  35510. const digit* digits = ((PyLongObject*)x)->ob_digit;
  35511. switch (Py_SIZE(x)) {
  35512. case 0: return (long) 0;
  35513. case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
  35514. case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
  35515. case -2:
  35516. if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
  35517. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  35518. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35519. } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  35520. return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  35521. }
  35522. }
  35523. break;
  35524. case 2:
  35525. if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
  35526. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  35527. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35528. } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  35529. return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  35530. }
  35531. }
  35532. break;
  35533. case -3:
  35534. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  35535. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  35536. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35537. } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  35538. return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  35539. }
  35540. }
  35541. break;
  35542. case 3:
  35543. if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
  35544. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  35545. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35546. } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  35547. return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  35548. }
  35549. }
  35550. break;
  35551. case -4:
  35552. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  35553. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  35554. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35555. } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  35556. return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  35557. }
  35558. }
  35559. break;
  35560. case 4:
  35561. if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
  35562. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  35563. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35564. } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  35565. return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  35566. }
  35567. }
  35568. break;
  35569. }
  35570. #endif
  35571. if (sizeof(long) <= sizeof(long)) {
  35572. __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
  35573. #ifdef HAVE_LONG_LONG
  35574. } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
  35575. __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
  35576. #endif
  35577. }
  35578. }
  35579. {
  35580. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  35581. PyErr_SetString(PyExc_RuntimeError,
  35582. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  35583. #else
  35584. long val;
  35585. PyObject *v = __Pyx_PyNumber_IntOrLong(x);
  35586. #if PY_MAJOR_VERSION < 3
  35587. if (likely(v) && !PyLong_Check(v)) {
  35588. PyObject *tmp = v;
  35589. v = PyNumber_Long(tmp);
  35590. Py_DECREF(tmp);
  35591. }
  35592. #endif
  35593. if (likely(v)) {
  35594. int one = 1; int is_little = (int)*(unsigned char *)&one;
  35595. unsigned char *bytes = (unsigned char *)&val;
  35596. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  35597. bytes, sizeof(val),
  35598. is_little, !is_unsigned);
  35599. Py_DECREF(v);
  35600. if (likely(!ret))
  35601. return val;
  35602. }
  35603. #endif
  35604. return (long) -1;
  35605. }
  35606. } else {
  35607. long val;
  35608. PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
  35609. if (!tmp) return (long) -1;
  35610. val = __Pyx_PyInt_As_long(tmp);
  35611. Py_DECREF(tmp);
  35612. return val;
  35613. }
  35614. raise_overflow:
  35615. PyErr_SetString(PyExc_OverflowError,
  35616. "value too large to convert to long");
  35617. return (long) -1;
  35618. raise_neg_overflow:
  35619. PyErr_SetString(PyExc_OverflowError,
  35620. "can't convert negative value to long");
  35621. return (long) -1;
  35622. }
  35623. /* BytesContains */
  35624. static CYTHON_INLINE int __Pyx_BytesContains(PyObject* bytes, char character) {
  35625. const Py_ssize_t length = PyBytes_GET_SIZE(bytes);
  35626. char* char_start = PyBytes_AS_STRING(bytes);
  35627. return memchr(char_start, (unsigned char)character, (size_t)length) != NULL;
  35628. }
  35629. /* CIntFromPy */
  35630. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
  35631. const int neg_one = (int) -1, const_zero = (int) 0;
  35632. const int is_unsigned = neg_one > const_zero;
  35633. #if PY_MAJOR_VERSION < 3
  35634. if (likely(PyInt_Check(x))) {
  35635. if (sizeof(int) < sizeof(long)) {
  35636. __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
  35637. } else {
  35638. long val = PyInt_AS_LONG(x);
  35639. if (is_unsigned && unlikely(val < 0)) {
  35640. goto raise_neg_overflow;
  35641. }
  35642. return (int) val;
  35643. }
  35644. } else
  35645. #endif
  35646. if (likely(PyLong_Check(x))) {
  35647. if (is_unsigned) {
  35648. #if CYTHON_USE_PYLONG_INTERNALS
  35649. const digit* digits = ((PyLongObject*)x)->ob_digit;
  35650. switch (Py_SIZE(x)) {
  35651. case 0: return (int) 0;
  35652. case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
  35653. case 2:
  35654. if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
  35655. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  35656. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35657. } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
  35658. return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  35659. }
  35660. }
  35661. break;
  35662. case 3:
  35663. if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
  35664. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  35665. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35666. } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
  35667. return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  35668. }
  35669. }
  35670. break;
  35671. case 4:
  35672. if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
  35673. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  35674. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35675. } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
  35676. return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  35677. }
  35678. }
  35679. break;
  35680. }
  35681. #endif
  35682. #if CYTHON_COMPILING_IN_CPYTHON
  35683. if (unlikely(Py_SIZE(x) < 0)) {
  35684. goto raise_neg_overflow;
  35685. }
  35686. #else
  35687. {
  35688. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  35689. if (unlikely(result < 0))
  35690. return (int) -1;
  35691. if (unlikely(result == 1))
  35692. goto raise_neg_overflow;
  35693. }
  35694. #endif
  35695. if (sizeof(int) <= sizeof(unsigned long)) {
  35696. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
  35697. #ifdef HAVE_LONG_LONG
  35698. } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
  35699. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  35700. #endif
  35701. }
  35702. } else {
  35703. #if CYTHON_USE_PYLONG_INTERNALS
  35704. const digit* digits = ((PyLongObject*)x)->ob_digit;
  35705. switch (Py_SIZE(x)) {
  35706. case 0: return (int) 0;
  35707. case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
  35708. case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
  35709. case -2:
  35710. if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
  35711. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  35712. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35713. } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  35714. return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  35715. }
  35716. }
  35717. break;
  35718. case 2:
  35719. if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
  35720. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  35721. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35722. } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  35723. return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  35724. }
  35725. }
  35726. break;
  35727. case -3:
  35728. if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  35729. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  35730. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35731. } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  35732. return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  35733. }
  35734. }
  35735. break;
  35736. case 3:
  35737. if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
  35738. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  35739. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35740. } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  35741. return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  35742. }
  35743. }
  35744. break;
  35745. case -4:
  35746. if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  35747. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  35748. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35749. } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
  35750. return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  35751. }
  35752. }
  35753. break;
  35754. case 4:
  35755. if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
  35756. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  35757. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  35758. } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
  35759. return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  35760. }
  35761. }
  35762. break;
  35763. }
  35764. #endif
  35765. if (sizeof(int) <= sizeof(long)) {
  35766. __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
  35767. #ifdef HAVE_LONG_LONG
  35768. } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
  35769. __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
  35770. #endif
  35771. }
  35772. }
  35773. {
  35774. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  35775. PyErr_SetString(PyExc_RuntimeError,
  35776. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  35777. #else
  35778. int val;
  35779. PyObject *v = __Pyx_PyNumber_IntOrLong(x);
  35780. #if PY_MAJOR_VERSION < 3
  35781. if (likely(v) && !PyLong_Check(v)) {
  35782. PyObject *tmp = v;
  35783. v = PyNumber_Long(tmp);
  35784. Py_DECREF(tmp);
  35785. }
  35786. #endif
  35787. if (likely(v)) {
  35788. int one = 1; int is_little = (int)*(unsigned char *)&one;
  35789. unsigned char *bytes = (unsigned char *)&val;
  35790. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  35791. bytes, sizeof(val),
  35792. is_little, !is_unsigned);
  35793. Py_DECREF(v);
  35794. if (likely(!ret))
  35795. return val;
  35796. }
  35797. #endif
  35798. return (int) -1;
  35799. }
  35800. } else {
  35801. int val;
  35802. PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
  35803. if (!tmp) return (int) -1;
  35804. val = __Pyx_PyInt_As_int(tmp);
  35805. Py_DECREF(tmp);
  35806. return val;
  35807. }
  35808. raise_overflow:
  35809. PyErr_SetString(PyExc_OverflowError,
  35810. "value too large to convert to int");
  35811. return (int) -1;
  35812. raise_neg_overflow:
  35813. PyErr_SetString(PyExc_OverflowError,
  35814. "can't convert negative value to int");
  35815. return (int) -1;
  35816. }
  35817. /* PyObjectCallMethod1 */
  35818. static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
  35819. PyObject *result = NULL;
  35820. #if CYTHON_UNPACK_METHODS
  35821. if (likely(PyMethod_Check(method))) {
  35822. PyObject *self = PyMethod_GET_SELF(method);
  35823. if (likely(self)) {
  35824. PyObject *args;
  35825. PyObject *function = PyMethod_GET_FUNCTION(method);
  35826. #if CYTHON_FAST_PYCALL
  35827. if (PyFunction_Check(function)) {
  35828. PyObject *args[2] = {self, arg};
  35829. result = __Pyx_PyFunction_FastCall(function, args, 2);
  35830. goto done;
  35831. }
  35832. #endif
  35833. #if CYTHON_FAST_PYCCALL
  35834. if (__Pyx_PyFastCFunction_Check(function)) {
  35835. PyObject *args[2] = {self, arg};
  35836. result = __Pyx_PyCFunction_FastCall(function, args, 2);
  35837. goto done;
  35838. }
  35839. #endif
  35840. args = PyTuple_New(2);
  35841. if (unlikely(!args)) goto done;
  35842. Py_INCREF(self);
  35843. PyTuple_SET_ITEM(args, 0, self);
  35844. Py_INCREF(arg);
  35845. PyTuple_SET_ITEM(args, 1, arg);
  35846. Py_INCREF(function);
  35847. result = __Pyx_PyObject_Call(function, args, NULL);
  35848. Py_DECREF(args);
  35849. Py_DECREF(function);
  35850. return result;
  35851. }
  35852. }
  35853. #endif
  35854. result = __Pyx_PyObject_CallOneArg(method, arg);
  35855. goto done;
  35856. done:
  35857. return result;
  35858. }
  35859. static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
  35860. PyObject *method, *result;
  35861. method = __Pyx_PyObject_GetAttrStr(obj, method_name);
  35862. if (unlikely(!method)) return NULL;
  35863. result = __Pyx__PyObject_CallMethod1(method, arg);
  35864. Py_DECREF(method);
  35865. return result;
  35866. }
  35867. /* CoroutineBase */
  35868. #include <structmember.h>
  35869. #include <frameobject.h>
  35870. #define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
  35871. static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject **pvalue) {
  35872. PyObject *et, *ev, *tb;
  35873. PyObject *value = NULL;
  35874. __Pyx_ErrFetch(&et, &ev, &tb);
  35875. if (!et) {
  35876. Py_XDECREF(tb);
  35877. Py_XDECREF(ev);
  35878. Py_INCREF(Py_None);
  35879. *pvalue = Py_None;
  35880. return 0;
  35881. }
  35882. if (likely(et == PyExc_StopIteration)) {
  35883. if (!ev) {
  35884. Py_INCREF(Py_None);
  35885. value = Py_None;
  35886. }
  35887. #if PY_VERSION_HEX >= 0x030300A0
  35888. else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) {
  35889. value = ((PyStopIterationObject *)ev)->value;
  35890. Py_INCREF(value);
  35891. Py_DECREF(ev);
  35892. }
  35893. #endif
  35894. else if (unlikely(PyTuple_Check(ev))) {
  35895. if (PyTuple_GET_SIZE(ev) >= 1) {
  35896. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  35897. value = PyTuple_GET_ITEM(ev, 0);
  35898. Py_INCREF(value);
  35899. #else
  35900. value = PySequence_ITEM(ev, 0);
  35901. #endif
  35902. } else {
  35903. Py_INCREF(Py_None);
  35904. value = Py_None;
  35905. }
  35906. Py_DECREF(ev);
  35907. }
  35908. else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
  35909. value = ev;
  35910. }
  35911. if (likely(value)) {
  35912. Py_XDECREF(tb);
  35913. Py_DECREF(et);
  35914. *pvalue = value;
  35915. return 0;
  35916. }
  35917. } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
  35918. __Pyx_ErrRestore(et, ev, tb);
  35919. return -1;
  35920. }
  35921. PyErr_NormalizeException(&et, &ev, &tb);
  35922. if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
  35923. __Pyx_ErrRestore(et, ev, tb);
  35924. return -1;
  35925. }
  35926. Py_XDECREF(tb);
  35927. Py_DECREF(et);
  35928. #if PY_VERSION_HEX >= 0x030300A0
  35929. value = ((PyStopIterationObject *)ev)->value;
  35930. Py_INCREF(value);
  35931. Py_DECREF(ev);
  35932. #else
  35933. {
  35934. PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
  35935. Py_DECREF(ev);
  35936. if (likely(args)) {
  35937. value = PySequence_GetItem(args, 0);
  35938. Py_DECREF(args);
  35939. }
  35940. if (unlikely(!value)) {
  35941. __Pyx_ErrRestore(NULL, NULL, NULL);
  35942. Py_INCREF(Py_None);
  35943. value = Py_None;
  35944. }
  35945. }
  35946. #endif
  35947. *pvalue = value;
  35948. return 0;
  35949. }
  35950. static CYTHON_INLINE
  35951. void __Pyx_Coroutine_ExceptionClear(__pyx_CoroutineObject *self) {
  35952. PyObject *exc_type = self->exc_type;
  35953. PyObject *exc_value = self->exc_value;
  35954. PyObject *exc_traceback = self->exc_traceback;
  35955. self->exc_type = NULL;
  35956. self->exc_value = NULL;
  35957. self->exc_traceback = NULL;
  35958. Py_XDECREF(exc_type);
  35959. Py_XDECREF(exc_value);
  35960. Py_XDECREF(exc_traceback);
  35961. }
  35962. #define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
  35963. static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject *gen) {
  35964. const char *msg;
  35965. if (0) {
  35966. #ifdef __Pyx_Coroutine_USED
  35967. } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
  35968. msg = "coroutine already executing";
  35969. #endif
  35970. #ifdef __Pyx_AsyncGen_USED
  35971. } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
  35972. msg = "async generator already executing";
  35973. #endif
  35974. } else {
  35975. msg = "generator already executing";
  35976. }
  35977. PyErr_SetString(PyExc_ValueError, msg);
  35978. }
  35979. #define __Pyx_Coroutine_NotStartedError(gen) (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL)
  35980. static void __Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject *gen) {
  35981. const char *msg;
  35982. if (0) {
  35983. #ifdef __Pyx_Coroutine_USED
  35984. } else if (__Pyx_Coroutine_Check(gen)) {
  35985. msg = "can't send non-None value to a just-started coroutine";
  35986. #endif
  35987. #ifdef __Pyx_AsyncGen_USED
  35988. } else if (__Pyx_AsyncGen_CheckExact(gen)) {
  35989. msg = "can't send non-None value to a just-started async generator";
  35990. #endif
  35991. } else {
  35992. msg = "can't send non-None value to a just-started generator";
  35993. }
  35994. PyErr_SetString(PyExc_TypeError, msg);
  35995. }
  35996. #define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing) (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL)
  35997. static void __Pyx__Coroutine_AlreadyTerminatedError(CYTHON_UNUSED PyObject *gen, PyObject *value, CYTHON_UNUSED int closing) {
  35998. #ifdef __Pyx_Coroutine_USED
  35999. if (!closing && __Pyx_Coroutine_Check(gen)) {
  36000. PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
  36001. } else
  36002. #endif
  36003. if (value) {
  36004. #ifdef __Pyx_AsyncGen_USED
  36005. if (__Pyx_AsyncGen_CheckExact(gen))
  36006. PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration);
  36007. else
  36008. #endif
  36009. PyErr_SetNone(PyExc_StopIteration);
  36010. }
  36011. }
  36012. static
  36013. PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) {
  36014. __Pyx_PyThreadState_declare
  36015. PyThreadState *tstate;
  36016. PyObject *retval;
  36017. assert(!self->is_running);
  36018. if (unlikely(self->resume_label == 0)) {
  36019. if (unlikely(value && value != Py_None)) {
  36020. return __Pyx_Coroutine_NotStartedError((PyObject*)self);
  36021. }
  36022. }
  36023. if (unlikely(self->resume_label == -1)) {
  36024. return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
  36025. }
  36026. #if CYTHON_FAST_THREAD_STATE
  36027. __Pyx_PyThreadState_assign
  36028. tstate = __pyx_tstate;
  36029. #else
  36030. tstate = __Pyx_PyThreadState_Current;
  36031. #endif
  36032. if (self->exc_type) {
  36033. #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
  36034. #else
  36035. if (self->exc_traceback) {
  36036. PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
  36037. PyFrameObject *f = tb->tb_frame;
  36038. Py_XINCREF(tstate->frame);
  36039. assert(f->f_back == NULL);
  36040. f->f_back = tstate->frame;
  36041. }
  36042. #endif
  36043. __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
  36044. &self->exc_traceback);
  36045. } else {
  36046. __Pyx_Coroutine_ExceptionClear(self);
  36047. __Pyx_ExceptionSave(&self->exc_type, &self->exc_value, &self->exc_traceback);
  36048. }
  36049. self->is_running = 1;
  36050. retval = self->body((PyObject *) self, tstate, value);
  36051. self->is_running = 0;
  36052. return retval;
  36053. }
  36054. static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__pyx_CoroutineObject *self) {
  36055. if (likely(self->exc_traceback)) {
  36056. #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
  36057. #else
  36058. PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
  36059. PyFrameObject *f = tb->tb_frame;
  36060. Py_CLEAR(f->f_back);
  36061. #endif
  36062. }
  36063. }
  36064. static CYTHON_INLINE
  36065. PyObject *__Pyx_Coroutine_MethodReturn(CYTHON_UNUSED PyObject* gen, PyObject *retval) {
  36066. if (unlikely(!retval)) {
  36067. __Pyx_PyThreadState_declare
  36068. __Pyx_PyThreadState_assign
  36069. if (!__Pyx_PyErr_Occurred()) {
  36070. PyObject *exc = PyExc_StopIteration;
  36071. #ifdef __Pyx_AsyncGen_USED
  36072. if (__Pyx_AsyncGen_CheckExact(gen))
  36073. exc = __Pyx_PyExc_StopAsyncIteration;
  36074. #endif
  36075. __Pyx_PyErr_SetNone(exc);
  36076. }
  36077. }
  36078. return retval;
  36079. }
  36080. static CYTHON_INLINE
  36081. PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
  36082. PyObject *ret;
  36083. PyObject *val = NULL;
  36084. __Pyx_Coroutine_Undelegate(gen);
  36085. __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
  36086. ret = __Pyx_Coroutine_SendEx(gen, val, 0);
  36087. Py_XDECREF(val);
  36088. return ret;
  36089. }
  36090. static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
  36091. PyObject *retval;
  36092. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
  36093. PyObject *yf = gen->yieldfrom;
  36094. if (unlikely(gen->is_running))
  36095. return __Pyx_Coroutine_AlreadyRunningError(gen);
  36096. if (yf) {
  36097. PyObject *ret;
  36098. gen->is_running = 1;
  36099. #ifdef __Pyx_Generator_USED
  36100. if (__Pyx_Generator_CheckExact(yf)) {
  36101. ret = __Pyx_Coroutine_Send(yf, value);
  36102. } else
  36103. #endif
  36104. #ifdef __Pyx_Coroutine_USED
  36105. if (__Pyx_Coroutine_Check(yf)) {
  36106. ret = __Pyx_Coroutine_Send(yf, value);
  36107. } else
  36108. #endif
  36109. #ifdef __Pyx_AsyncGen_USED
  36110. if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
  36111. ret = __Pyx_async_gen_asend_send(yf, value);
  36112. } else
  36113. #endif
  36114. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
  36115. if (PyGen_CheckExact(yf)) {
  36116. ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
  36117. } else
  36118. #endif
  36119. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
  36120. if (PyCoro_CheckExact(yf)) {
  36121. ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
  36122. } else
  36123. #endif
  36124. {
  36125. if (value == Py_None)
  36126. ret = Py_TYPE(yf)->tp_iternext(yf);
  36127. else
  36128. ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
  36129. }
  36130. gen->is_running = 0;
  36131. if (likely(ret)) {
  36132. return ret;
  36133. }
  36134. retval = __Pyx_Coroutine_FinishDelegation(gen);
  36135. } else {
  36136. retval = __Pyx_Coroutine_SendEx(gen, value, 0);
  36137. }
  36138. return __Pyx_Coroutine_MethodReturn(self, retval);
  36139. }
  36140. static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
  36141. PyObject *retval = NULL;
  36142. int err = 0;
  36143. #ifdef __Pyx_Generator_USED
  36144. if (__Pyx_Generator_CheckExact(yf)) {
  36145. retval = __Pyx_Coroutine_Close(yf);
  36146. if (!retval)
  36147. return -1;
  36148. } else
  36149. #endif
  36150. #ifdef __Pyx_Coroutine_USED
  36151. if (__Pyx_Coroutine_Check(yf)) {
  36152. retval = __Pyx_Coroutine_Close(yf);
  36153. if (!retval)
  36154. return -1;
  36155. } else
  36156. if (__Pyx_CoroutineAwait_CheckExact(yf)) {
  36157. retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf);
  36158. if (!retval)
  36159. return -1;
  36160. } else
  36161. #endif
  36162. #ifdef __Pyx_AsyncGen_USED
  36163. if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
  36164. retval = __Pyx_async_gen_asend_close(yf, NULL);
  36165. } else
  36166. if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
  36167. retval = __Pyx_async_gen_athrow_close(yf, NULL);
  36168. } else
  36169. #endif
  36170. {
  36171. PyObject *meth;
  36172. gen->is_running = 1;
  36173. meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close);
  36174. if (unlikely(!meth)) {
  36175. if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
  36176. PyErr_WriteUnraisable(yf);
  36177. }
  36178. PyErr_Clear();
  36179. } else {
  36180. retval = PyObject_CallFunction(meth, NULL);
  36181. Py_DECREF(meth);
  36182. if (!retval)
  36183. err = -1;
  36184. }
  36185. gen->is_running = 0;
  36186. }
  36187. Py_XDECREF(retval);
  36188. return err;
  36189. }
  36190. static PyObject *__Pyx_Generator_Next(PyObject *self) {
  36191. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
  36192. PyObject *yf = gen->yieldfrom;
  36193. if (unlikely(gen->is_running))
  36194. return __Pyx_Coroutine_AlreadyRunningError(gen);
  36195. if (yf) {
  36196. PyObject *ret;
  36197. gen->is_running = 1;
  36198. #ifdef __Pyx_Generator_USED
  36199. if (__Pyx_Generator_CheckExact(yf)) {
  36200. ret = __Pyx_Generator_Next(yf);
  36201. } else
  36202. #endif
  36203. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
  36204. if (PyGen_CheckExact(yf)) {
  36205. ret = _PyGen_Send((PyGenObject*)yf, NULL);
  36206. } else
  36207. #endif
  36208. #ifdef __Pyx_Coroutine_USED
  36209. if (__Pyx_Coroutine_Check(yf)) {
  36210. ret = __Pyx_Coroutine_Send(yf, Py_None);
  36211. } else
  36212. #endif
  36213. ret = Py_TYPE(yf)->tp_iternext(yf);
  36214. gen->is_running = 0;
  36215. if (likely(ret)) {
  36216. return ret;
  36217. }
  36218. return __Pyx_Coroutine_FinishDelegation(gen);
  36219. }
  36220. return __Pyx_Coroutine_SendEx(gen, Py_None, 0);
  36221. }
  36222. static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
  36223. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  36224. PyObject *retval, *raised_exception;
  36225. PyObject *yf = gen->yieldfrom;
  36226. int err = 0;
  36227. if (unlikely(gen->is_running))
  36228. return __Pyx_Coroutine_AlreadyRunningError(gen);
  36229. if (yf) {
  36230. Py_INCREF(yf);
  36231. err = __Pyx_Coroutine_CloseIter(gen, yf);
  36232. __Pyx_Coroutine_Undelegate(gen);
  36233. Py_DECREF(yf);
  36234. }
  36235. if (err == 0)
  36236. PyErr_SetNone(PyExc_GeneratorExit);
  36237. retval = __Pyx_Coroutine_SendEx(gen, NULL, 1);
  36238. if (unlikely(retval)) {
  36239. const char *msg;
  36240. Py_DECREF(retval);
  36241. if ((0)) {
  36242. #ifdef __Pyx_Coroutine_USED
  36243. } else if (__Pyx_Coroutine_Check(self)) {
  36244. msg = "coroutine ignored GeneratorExit";
  36245. #endif
  36246. #ifdef __Pyx_AsyncGen_USED
  36247. } else if (__Pyx_AsyncGen_CheckExact(self)) {
  36248. #if PY_VERSION_HEX < 0x03060000
  36249. msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)";
  36250. #else
  36251. msg = "async generator ignored GeneratorExit";
  36252. #endif
  36253. #endif
  36254. } else {
  36255. msg = "generator ignored GeneratorExit";
  36256. }
  36257. PyErr_SetString(PyExc_RuntimeError, msg);
  36258. return NULL;
  36259. }
  36260. raised_exception = PyErr_Occurred();
  36261. if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) {
  36262. if (raised_exception) PyErr_Clear();
  36263. Py_INCREF(Py_None);
  36264. return Py_None;
  36265. }
  36266. return NULL;
  36267. }
  36268. static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
  36269. PyObject *args, int close_on_genexit) {
  36270. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  36271. PyObject *yf = gen->yieldfrom;
  36272. if (unlikely(gen->is_running))
  36273. return __Pyx_Coroutine_AlreadyRunningError(gen);
  36274. if (yf) {
  36275. PyObject *ret;
  36276. Py_INCREF(yf);
  36277. if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
  36278. int err = __Pyx_Coroutine_CloseIter(gen, yf);
  36279. Py_DECREF(yf);
  36280. __Pyx_Coroutine_Undelegate(gen);
  36281. if (err < 0)
  36282. return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
  36283. goto throw_here;
  36284. }
  36285. gen->is_running = 1;
  36286. if (0
  36287. #ifdef __Pyx_Generator_USED
  36288. || __Pyx_Generator_CheckExact(yf)
  36289. #endif
  36290. #ifdef __Pyx_Coroutine_USED
  36291. || __Pyx_Coroutine_Check(yf)
  36292. #endif
  36293. ) {
  36294. ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
  36295. #ifdef __Pyx_Coroutine_USED
  36296. } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
  36297. ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
  36298. #endif
  36299. } else {
  36300. PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw);
  36301. if (unlikely(!meth)) {
  36302. Py_DECREF(yf);
  36303. if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
  36304. gen->is_running = 0;
  36305. return NULL;
  36306. }
  36307. PyErr_Clear();
  36308. __Pyx_Coroutine_Undelegate(gen);
  36309. gen->is_running = 0;
  36310. goto throw_here;
  36311. }
  36312. if (likely(args)) {
  36313. ret = PyObject_CallObject(meth, args);
  36314. } else {
  36315. ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL);
  36316. }
  36317. Py_DECREF(meth);
  36318. }
  36319. gen->is_running = 0;
  36320. Py_DECREF(yf);
  36321. if (!ret) {
  36322. ret = __Pyx_Coroutine_FinishDelegation(gen);
  36323. }
  36324. return __Pyx_Coroutine_MethodReturn(self, ret);
  36325. }
  36326. throw_here:
  36327. __Pyx_Raise(typ, val, tb, NULL);
  36328. return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
  36329. }
  36330. static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
  36331. PyObject *typ;
  36332. PyObject *val = NULL;
  36333. PyObject *tb = NULL;
  36334. if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
  36335. return NULL;
  36336. return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
  36337. }
  36338. static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
  36339. Py_VISIT(gen->closure);
  36340. Py_VISIT(gen->classobj);
  36341. Py_VISIT(gen->yieldfrom);
  36342. Py_VISIT(gen->exc_type);
  36343. Py_VISIT(gen->exc_value);
  36344. Py_VISIT(gen->exc_traceback);
  36345. return 0;
  36346. }
  36347. static int __Pyx_Coroutine_clear(PyObject *self) {
  36348. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  36349. Py_CLEAR(gen->closure);
  36350. Py_CLEAR(gen->classobj);
  36351. Py_CLEAR(gen->yieldfrom);
  36352. Py_CLEAR(gen->exc_type);
  36353. Py_CLEAR(gen->exc_value);
  36354. Py_CLEAR(gen->exc_traceback);
  36355. #ifdef __Pyx_AsyncGen_USED
  36356. if (__Pyx_AsyncGen_CheckExact(self)) {
  36357. Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
  36358. }
  36359. #endif
  36360. Py_CLEAR(gen->gi_code);
  36361. Py_CLEAR(gen->gi_name);
  36362. Py_CLEAR(gen->gi_qualname);
  36363. Py_CLEAR(gen->gi_modulename);
  36364. return 0;
  36365. }
  36366. static void __Pyx_Coroutine_dealloc(PyObject *self) {
  36367. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  36368. PyObject_GC_UnTrack(gen);
  36369. if (gen->gi_weakreflist != NULL)
  36370. PyObject_ClearWeakRefs(self);
  36371. if (gen->resume_label >= 0) {
  36372. PyObject_GC_Track(self);
  36373. #if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE
  36374. if (PyObject_CallFinalizerFromDealloc(self))
  36375. #else
  36376. Py_TYPE(gen)->tp_del(self);
  36377. if (self->ob_refcnt > 0)
  36378. #endif
  36379. {
  36380. return;
  36381. }
  36382. PyObject_GC_UnTrack(self);
  36383. }
  36384. #ifdef __Pyx_AsyncGen_USED
  36385. if (__Pyx_AsyncGen_CheckExact(self)) {
  36386. /* We have to handle this case for asynchronous generators
  36387. right here, because this code has to be between UNTRACK
  36388. and GC_Del. */
  36389. Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
  36390. }
  36391. #endif
  36392. __Pyx_Coroutine_clear(self);
  36393. PyObject_GC_Del(gen);
  36394. }
  36395. static void __Pyx_Coroutine_del(PyObject *self) {
  36396. PyObject *error_type, *error_value, *error_traceback;
  36397. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  36398. __Pyx_PyThreadState_declare
  36399. if (gen->resume_label < 0) {
  36400. return;
  36401. }
  36402. #if !CYTHON_USE_TP_FINALIZE
  36403. assert(self->ob_refcnt == 0);
  36404. self->ob_refcnt = 1;
  36405. #endif
  36406. __Pyx_PyThreadState_assign
  36407. __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
  36408. #ifdef __Pyx_AsyncGen_USED
  36409. if (__Pyx_AsyncGen_CheckExact(self)) {
  36410. __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
  36411. PyObject *finalizer = agen->ag_finalizer;
  36412. if (finalizer && !agen->ag_closed) {
  36413. PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
  36414. if (unlikely(!res)) {
  36415. PyErr_WriteUnraisable(self);
  36416. } else {
  36417. Py_DECREF(res);
  36418. }
  36419. __Pyx_ErrRestore(error_type, error_value, error_traceback);
  36420. return;
  36421. }
  36422. }
  36423. #endif
  36424. if (unlikely(gen->resume_label == 0 && !error_value)) {
  36425. #ifdef __Pyx_Coroutine_USED
  36426. #ifdef __Pyx_Generator_USED
  36427. if (!__Pyx_Generator_CheckExact(self))
  36428. #endif
  36429. {
  36430. PyObject_GC_UnTrack(self);
  36431. #if PY_MAJOR_VERSION >= 3 || defined(PyErr_WarnFormat)
  36432. if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
  36433. PyErr_WriteUnraisable(self);
  36434. #else
  36435. {PyObject *msg;
  36436. char *cmsg;
  36437. #if CYTHON_COMPILING_IN_PYPY
  36438. msg = NULL;
  36439. cmsg = (char*) "coroutine was never awaited";
  36440. #else
  36441. char *cname;
  36442. PyObject *qualname;
  36443. qualname = gen->gi_qualname;
  36444. cname = PyString_AS_STRING(qualname);
  36445. msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname);
  36446. if (unlikely(!msg)) {
  36447. PyErr_Clear();
  36448. cmsg = (char*) "coroutine was never awaited";
  36449. } else {
  36450. cmsg = PyString_AS_STRING(msg);
  36451. }
  36452. #endif
  36453. if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
  36454. PyErr_WriteUnraisable(self);
  36455. Py_XDECREF(msg);}
  36456. #endif
  36457. PyObject_GC_Track(self);
  36458. }
  36459. #endif
  36460. } else {
  36461. PyObject *res = __Pyx_Coroutine_Close(self);
  36462. if (unlikely(!res)) {
  36463. if (PyErr_Occurred())
  36464. PyErr_WriteUnraisable(self);
  36465. } else {
  36466. Py_DECREF(res);
  36467. }
  36468. }
  36469. __Pyx_ErrRestore(error_type, error_value, error_traceback);
  36470. #if !CYTHON_USE_TP_FINALIZE
  36471. assert(self->ob_refcnt > 0);
  36472. if (--self->ob_refcnt == 0) {
  36473. return;
  36474. }
  36475. {
  36476. Py_ssize_t refcnt = self->ob_refcnt;
  36477. _Py_NewReference(self);
  36478. self->ob_refcnt = refcnt;
  36479. }
  36480. #if CYTHON_COMPILING_IN_CPYTHON
  36481. assert(PyType_IS_GC(self->ob_type) &&
  36482. _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
  36483. _Py_DEC_REFTOTAL;
  36484. #endif
  36485. #ifdef COUNT_ALLOCS
  36486. --Py_TYPE(self)->tp_frees;
  36487. --Py_TYPE(self)->tp_allocs;
  36488. #endif
  36489. #endif
  36490. }
  36491. static PyObject *
  36492. __Pyx_Coroutine_get_name(__pyx_CoroutineObject *self)
  36493. {
  36494. PyObject *name = self->gi_name;
  36495. if (unlikely(!name)) name = Py_None;
  36496. Py_INCREF(name);
  36497. return name;
  36498. }
  36499. static int
  36500. __Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value)
  36501. {
  36502. PyObject *tmp;
  36503. #if PY_MAJOR_VERSION >= 3
  36504. if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  36505. #else
  36506. if (unlikely(value == NULL || !PyString_Check(value))) {
  36507. #endif
  36508. PyErr_SetString(PyExc_TypeError,
  36509. "__name__ must be set to a string object");
  36510. return -1;
  36511. }
  36512. tmp = self->gi_name;
  36513. Py_INCREF(value);
  36514. self->gi_name = value;
  36515. Py_XDECREF(tmp);
  36516. return 0;
  36517. }
  36518. static PyObject *
  36519. __Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self)
  36520. {
  36521. PyObject *name = self->gi_qualname;
  36522. if (unlikely(!name)) name = Py_None;
  36523. Py_INCREF(name);
  36524. return name;
  36525. }
  36526. static int
  36527. __Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value)
  36528. {
  36529. PyObject *tmp;
  36530. #if PY_MAJOR_VERSION >= 3
  36531. if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  36532. #else
  36533. if (unlikely(value == NULL || !PyString_Check(value))) {
  36534. #endif
  36535. PyErr_SetString(PyExc_TypeError,
  36536. "__qualname__ must be set to a string object");
  36537. return -1;
  36538. }
  36539. tmp = self->gi_qualname;
  36540. Py_INCREF(value);
  36541. self->gi_qualname = value;
  36542. Py_XDECREF(tmp);
  36543. return 0;
  36544. }
  36545. static __pyx_CoroutineObject *__Pyx__Coroutine_New(
  36546. PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  36547. PyObject *name, PyObject *qualname, PyObject *module_name) {
  36548. __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
  36549. if (unlikely(!gen))
  36550. return NULL;
  36551. return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
  36552. }
  36553. static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
  36554. __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  36555. PyObject *name, PyObject *qualname, PyObject *module_name) {
  36556. gen->body = body;
  36557. gen->closure = closure;
  36558. Py_XINCREF(closure);
  36559. gen->is_running = 0;
  36560. gen->resume_label = 0;
  36561. gen->classobj = NULL;
  36562. gen->yieldfrom = NULL;
  36563. gen->exc_type = NULL;
  36564. gen->exc_value = NULL;
  36565. gen->exc_traceback = NULL;
  36566. gen->gi_weakreflist = NULL;
  36567. Py_XINCREF(qualname);
  36568. gen->gi_qualname = qualname;
  36569. Py_XINCREF(name);
  36570. gen->gi_name = name;
  36571. Py_XINCREF(module_name);
  36572. gen->gi_modulename = module_name;
  36573. Py_XINCREF(code);
  36574. gen->gi_code = code;
  36575. PyObject_GC_Track(gen);
  36576. return gen;
  36577. }
  36578. /* PatchModuleWithCoroutine */
  36579. static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
  36580. #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  36581. int result;
  36582. PyObject *globals, *result_obj;
  36583. globals = PyDict_New(); if (unlikely(!globals)) goto ignore;
  36584. result = PyDict_SetItemString(globals, "_cython_coroutine_type",
  36585. #ifdef __Pyx_Coroutine_USED
  36586. (PyObject*)__pyx_CoroutineType);
  36587. #else
  36588. Py_None);
  36589. #endif
  36590. if (unlikely(result < 0)) goto ignore;
  36591. result = PyDict_SetItemString(globals, "_cython_generator_type",
  36592. #ifdef __Pyx_Generator_USED
  36593. (PyObject*)__pyx_GeneratorType);
  36594. #else
  36595. Py_None);
  36596. #endif
  36597. if (unlikely(result < 0)) goto ignore;
  36598. if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
  36599. if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
  36600. result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
  36601. if (unlikely(!result_obj)) goto ignore;
  36602. Py_DECREF(result_obj);
  36603. Py_DECREF(globals);
  36604. return module;
  36605. ignore:
  36606. Py_XDECREF(globals);
  36607. PyErr_WriteUnraisable(module);
  36608. if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
  36609. Py_DECREF(module);
  36610. module = NULL;
  36611. }
  36612. #else
  36613. py_code++;
  36614. #endif
  36615. return module;
  36616. }
  36617. /* PatchGeneratorABC */
  36618. #ifndef CYTHON_REGISTER_ABCS
  36619. #define CYTHON_REGISTER_ABCS 1
  36620. #endif
  36621. #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  36622. static PyObject* __Pyx_patch_abc_module(PyObject *module);
  36623. static PyObject* __Pyx_patch_abc_module(PyObject *module) {
  36624. module = __Pyx_Coroutine_patch_module(
  36625. module, ""
  36626. "if _cython_generator_type is not None:\n"
  36627. " try: Generator = _module.Generator\n"
  36628. " except AttributeError: pass\n"
  36629. " else: Generator.register(_cython_generator_type)\n"
  36630. "if _cython_coroutine_type is not None:\n"
  36631. " try: Coroutine = _module.Coroutine\n"
  36632. " except AttributeError: pass\n"
  36633. " else: Coroutine.register(_cython_coroutine_type)\n"
  36634. );
  36635. return module;
  36636. }
  36637. #endif
  36638. static int __Pyx_patch_abc(void) {
  36639. #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  36640. static int abc_patched = 0;
  36641. if (CYTHON_REGISTER_ABCS && !abc_patched) {
  36642. PyObject *module;
  36643. module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections");
  36644. if (!module) {
  36645. PyErr_WriteUnraisable(NULL);
  36646. if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
  36647. ((PY_MAJOR_VERSION >= 3) ?
  36648. "Cython module failed to register with collections.abc module" :
  36649. "Cython module failed to register with collections module"), 1) < 0)) {
  36650. return -1;
  36651. }
  36652. } else {
  36653. module = __Pyx_patch_abc_module(module);
  36654. abc_patched = 1;
  36655. if (unlikely(!module))
  36656. return -1;
  36657. Py_DECREF(module);
  36658. }
  36659. module = PyImport_ImportModule("backports_abc");
  36660. if (module) {
  36661. module = __Pyx_patch_abc_module(module);
  36662. Py_XDECREF(module);
  36663. }
  36664. if (!module) {
  36665. PyErr_Clear();
  36666. }
  36667. }
  36668. #else
  36669. if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL);
  36670. #endif
  36671. return 0;
  36672. }
  36673. /* Generator */
  36674. static PyMethodDef __pyx_Generator_methods[] = {
  36675. {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
  36676. (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
  36677. {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
  36678. (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
  36679. {"close", (PyCFunction) __Pyx_Coroutine_Close, METH_NOARGS,
  36680. (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
  36681. {0, 0, 0, 0}
  36682. };
  36683. static PyMemberDef __pyx_Generator_memberlist[] = {
  36684. {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
  36685. {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
  36686. (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
  36687. {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
  36688. {0, 0, 0, 0, 0}
  36689. };
  36690. static PyGetSetDef __pyx_Generator_getsets[] = {
  36691. {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
  36692. (char*) PyDoc_STR("name of the generator"), 0},
  36693. {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
  36694. (char*) PyDoc_STR("qualified name of the generator"), 0},
  36695. {0, 0, 0, 0, 0}
  36696. };
  36697. static PyTypeObject __pyx_GeneratorType_type = {
  36698. PyVarObject_HEAD_INIT(0, 0)
  36699. "generator",
  36700. sizeof(__pyx_CoroutineObject),
  36701. 0,
  36702. (destructor) __Pyx_Coroutine_dealloc,
  36703. 0,
  36704. 0,
  36705. 0,
  36706. 0,
  36707. 0,
  36708. 0,
  36709. 0,
  36710. 0,
  36711. 0,
  36712. 0,
  36713. 0,
  36714. 0,
  36715. 0,
  36716. 0,
  36717. Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
  36718. 0,
  36719. (traverseproc) __Pyx_Coroutine_traverse,
  36720. 0,
  36721. 0,
  36722. offsetof(__pyx_CoroutineObject, gi_weakreflist),
  36723. 0,
  36724. (iternextfunc) __Pyx_Generator_Next,
  36725. __pyx_Generator_methods,
  36726. __pyx_Generator_memberlist,
  36727. __pyx_Generator_getsets,
  36728. 0,
  36729. 0,
  36730. 0,
  36731. 0,
  36732. 0,
  36733. 0,
  36734. 0,
  36735. 0,
  36736. 0,
  36737. 0,
  36738. 0,
  36739. 0,
  36740. 0,
  36741. 0,
  36742. 0,
  36743. #if CYTHON_USE_TP_FINALIZE
  36744. 0,
  36745. #else
  36746. __Pyx_Coroutine_del,
  36747. #endif
  36748. 0,
  36749. #if CYTHON_USE_TP_FINALIZE
  36750. __Pyx_Coroutine_del,
  36751. #elif PY_VERSION_HEX >= 0x030400a1
  36752. 0,
  36753. #endif
  36754. };
  36755. static int __pyx_Generator_init(void) {
  36756. __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  36757. __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
  36758. __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
  36759. if (unlikely(!__pyx_GeneratorType)) {
  36760. return -1;
  36761. }
  36762. return 0;
  36763. }
  36764. /* CheckBinaryVersion */
  36765. static int __Pyx_check_binary_version(void) {
  36766. char ctversion[4], rtversion[4];
  36767. PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
  36768. PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
  36769. if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
  36770. char message[200];
  36771. PyOS_snprintf(message, sizeof(message),
  36772. "compiletime version %s of module '%.100s' "
  36773. "does not match runtime version %s",
  36774. ctversion, __Pyx_MODULE_NAME, rtversion);
  36775. return PyErr_WarnEx(NULL, message, 1);
  36776. }
  36777. return 0;
  36778. }
  36779. /* ModuleImport */
  36780. #ifndef __PYX_HAVE_RT_ImportModule
  36781. #define __PYX_HAVE_RT_ImportModule
  36782. static PyObject *__Pyx_ImportModule(const char *name) {
  36783. PyObject *py_name = 0;
  36784. PyObject *py_module = 0;
  36785. py_name = __Pyx_PyIdentifier_FromString(name);
  36786. if (!py_name)
  36787. goto bad;
  36788. py_module = PyImport_Import(py_name);
  36789. Py_DECREF(py_name);
  36790. return py_module;
  36791. bad:
  36792. Py_XDECREF(py_name);
  36793. return 0;
  36794. }
  36795. #endif
  36796. /* TypeImport */
  36797. #ifndef __PYX_HAVE_RT_ImportType
  36798. #define __PYX_HAVE_RT_ImportType
  36799. static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
  36800. size_t size, int strict)
  36801. {
  36802. PyObject *py_module = 0;
  36803. PyObject *result = 0;
  36804. PyObject *py_name = 0;
  36805. char warning[200];
  36806. Py_ssize_t basicsize;
  36807. #ifdef Py_LIMITED_API
  36808. PyObject *py_basicsize;
  36809. #endif
  36810. py_module = __Pyx_ImportModule(module_name);
  36811. if (!py_module)
  36812. goto bad;
  36813. py_name = __Pyx_PyIdentifier_FromString(class_name);
  36814. if (!py_name)
  36815. goto bad;
  36816. result = PyObject_GetAttr(py_module, py_name);
  36817. Py_DECREF(py_name);
  36818. py_name = 0;
  36819. Py_DECREF(py_module);
  36820. py_module = 0;
  36821. if (!result)
  36822. goto bad;
  36823. if (!PyType_Check(result)) {
  36824. PyErr_Format(PyExc_TypeError,
  36825. "%.200s.%.200s is not a type object",
  36826. module_name, class_name);
  36827. goto bad;
  36828. }
  36829. #ifndef Py_LIMITED_API
  36830. basicsize = ((PyTypeObject *)result)->tp_basicsize;
  36831. #else
  36832. py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
  36833. if (!py_basicsize)
  36834. goto bad;
  36835. basicsize = PyLong_AsSsize_t(py_basicsize);
  36836. Py_DECREF(py_basicsize);
  36837. py_basicsize = 0;
  36838. if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
  36839. goto bad;
  36840. #endif
  36841. if (!strict && (size_t)basicsize > size) {
  36842. PyOS_snprintf(warning, sizeof(warning),
  36843. "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd",
  36844. module_name, class_name, basicsize, size);
  36845. if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
  36846. }
  36847. else if ((size_t)basicsize != size) {
  36848. PyErr_Format(PyExc_ValueError,
  36849. "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd",
  36850. module_name, class_name, basicsize, size);
  36851. goto bad;
  36852. }
  36853. return (PyTypeObject *)result;
  36854. bad:
  36855. Py_XDECREF(py_module);
  36856. Py_XDECREF(result);
  36857. return NULL;
  36858. }
  36859. #endif
  36860. /* VoidPtrImport */
  36861. #ifndef __PYX_HAVE_RT_ImportVoidPtr
  36862. #define __PYX_HAVE_RT_ImportVoidPtr
  36863. static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig) {
  36864. PyObject *d = 0;
  36865. PyObject *cobj = 0;
  36866. d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
  36867. if (!d)
  36868. goto bad;
  36869. cobj = PyDict_GetItemString(d, name);
  36870. if (!cobj) {
  36871. PyErr_Format(PyExc_ImportError,
  36872. "%.200s does not export expected C variable %.200s",
  36873. PyModule_GetName(module), name);
  36874. goto bad;
  36875. }
  36876. #if PY_VERSION_HEX >= 0x02070000
  36877. if (!PyCapsule_IsValid(cobj, sig)) {
  36878. PyErr_Format(PyExc_TypeError,
  36879. "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
  36880. PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj));
  36881. goto bad;
  36882. }
  36883. *p = PyCapsule_GetPointer(cobj, sig);
  36884. #else
  36885. {const char *desc, *s1, *s2;
  36886. desc = (const char *)PyCObject_GetDesc(cobj);
  36887. if (!desc)
  36888. goto bad;
  36889. s1 = desc; s2 = sig;
  36890. while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
  36891. if (*s1 != *s2) {
  36892. PyErr_Format(PyExc_TypeError,
  36893. "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
  36894. PyModule_GetName(module), name, sig, desc);
  36895. goto bad;
  36896. }
  36897. *p = PyCObject_AsVoidPtr(cobj);}
  36898. #endif
  36899. if (!(*p))
  36900. goto bad;
  36901. Py_DECREF(d);
  36902. return 0;
  36903. bad:
  36904. Py_XDECREF(d);
  36905. return -1;
  36906. }
  36907. #endif
  36908. /* FunctionImport */
  36909. #ifndef __PYX_HAVE_RT_ImportFunction
  36910. #define __PYX_HAVE_RT_ImportFunction
  36911. static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
  36912. PyObject *d = 0;
  36913. PyObject *cobj = 0;
  36914. union {
  36915. void (*fp)(void);
  36916. void *p;
  36917. } tmp;
  36918. d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
  36919. if (!d)
  36920. goto bad;
  36921. cobj = PyDict_GetItemString(d, funcname);
  36922. if (!cobj) {
  36923. PyErr_Format(PyExc_ImportError,
  36924. "%.200s does not export expected C function %.200s",
  36925. PyModule_GetName(module), funcname);
  36926. goto bad;
  36927. }
  36928. #if PY_VERSION_HEX >= 0x02070000
  36929. if (!PyCapsule_IsValid(cobj, sig)) {
  36930. PyErr_Format(PyExc_TypeError,
  36931. "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
  36932. PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
  36933. goto bad;
  36934. }
  36935. tmp.p = PyCapsule_GetPointer(cobj, sig);
  36936. #else
  36937. {const char *desc, *s1, *s2;
  36938. desc = (const char *)PyCObject_GetDesc(cobj);
  36939. if (!desc)
  36940. goto bad;
  36941. s1 = desc; s2 = sig;
  36942. while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
  36943. if (*s1 != *s2) {
  36944. PyErr_Format(PyExc_TypeError,
  36945. "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
  36946. PyModule_GetName(module), funcname, sig, desc);
  36947. goto bad;
  36948. }
  36949. tmp.p = PyCObject_AsVoidPtr(cobj);}
  36950. #endif
  36951. *f = tmp.fp;
  36952. if (!(*f))
  36953. goto bad;
  36954. Py_DECREF(d);
  36955. return 0;
  36956. bad:
  36957. Py_XDECREF(d);
  36958. return -1;
  36959. }
  36960. #endif
  36961. /* InitStrings */
  36962. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
  36963. while (t->p) {
  36964. #if PY_MAJOR_VERSION < 3
  36965. if (t->is_unicode) {
  36966. *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
  36967. } else if (t->intern) {
  36968. *t->p = PyString_InternFromString(t->s);
  36969. } else {
  36970. *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
  36971. }
  36972. #else
  36973. if (t->is_unicode | t->is_str) {
  36974. if (t->intern) {
  36975. *t->p = PyUnicode_InternFromString(t->s);
  36976. } else if (t->encoding) {
  36977. *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
  36978. } else {
  36979. *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
  36980. }
  36981. } else {
  36982. *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
  36983. }
  36984. #endif
  36985. if (!*t->p)
  36986. return -1;
  36987. if (PyObject_Hash(*t->p) == -1)
  36988. return -1;
  36989. ++t;
  36990. }
  36991. return 0;
  36992. }
  36993. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
  36994. return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
  36995. }
  36996. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
  36997. Py_ssize_t ignore;
  36998. return __Pyx_PyObject_AsStringAndSize(o, &ignore);
  36999. }
  37000. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  37001. #if !CYTHON_PEP393_ENABLED
  37002. static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  37003. char* defenc_c;
  37004. PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
  37005. if (!defenc) return NULL;
  37006. defenc_c = PyBytes_AS_STRING(defenc);
  37007. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  37008. {
  37009. char* end = defenc_c + PyBytes_GET_SIZE(defenc);
  37010. char* c;
  37011. for (c = defenc_c; c < end; c++) {
  37012. if ((unsigned char) (*c) >= 128) {
  37013. PyUnicode_AsASCIIString(o);
  37014. return NULL;
  37015. }
  37016. }
  37017. }
  37018. #endif
  37019. *length = PyBytes_GET_SIZE(defenc);
  37020. return defenc_c;
  37021. }
  37022. #else
  37023. static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  37024. if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
  37025. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  37026. if (likely(PyUnicode_IS_ASCII(o))) {
  37027. *length = PyUnicode_GET_LENGTH(o);
  37028. return PyUnicode_AsUTF8(o);
  37029. } else {
  37030. PyUnicode_AsASCIIString(o);
  37031. return NULL;
  37032. }
  37033. #else
  37034. return PyUnicode_AsUTF8AndSize(o, length);
  37035. #endif
  37036. }
  37037. #endif
  37038. #endif
  37039. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  37040. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  37041. if (
  37042. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  37043. __Pyx_sys_getdefaultencoding_not_ascii &&
  37044. #endif
  37045. PyUnicode_Check(o)) {
  37046. return __Pyx_PyUnicode_AsStringAndSize(o, length);
  37047. } else
  37048. #endif
  37049. #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
  37050. if (PyByteArray_Check(o)) {
  37051. *length = PyByteArray_GET_SIZE(o);
  37052. return PyByteArray_AS_STRING(o);
  37053. } else
  37054. #endif
  37055. {
  37056. char* result;
  37057. int r = PyBytes_AsStringAndSize(o, &result, length);
  37058. if (unlikely(r < 0)) {
  37059. return NULL;
  37060. } else {
  37061. return result;
  37062. }
  37063. }
  37064. }
  37065. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
  37066. int is_true = x == Py_True;
  37067. if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
  37068. else return PyObject_IsTrue(x);
  37069. }
  37070. static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
  37071. #if PY_MAJOR_VERSION >= 3
  37072. if (PyLong_Check(result)) {
  37073. if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
  37074. "__int__ returned non-int (type %.200s). "
  37075. "The ability to return an instance of a strict subclass of int "
  37076. "is deprecated, and may be removed in a future version of Python.",
  37077. Py_TYPE(result)->tp_name)) {
  37078. Py_DECREF(result);
  37079. return NULL;
  37080. }
  37081. return result;
  37082. }
  37083. #endif
  37084. PyErr_Format(PyExc_TypeError,
  37085. "__%.4s__ returned non-%.4s (type %.200s)",
  37086. type_name, type_name, Py_TYPE(result)->tp_name);
  37087. Py_DECREF(result);
  37088. return NULL;
  37089. }
  37090. static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
  37091. #if CYTHON_USE_TYPE_SLOTS
  37092. PyNumberMethods *m;
  37093. #endif
  37094. const char *name = NULL;
  37095. PyObject *res = NULL;
  37096. #if PY_MAJOR_VERSION < 3
  37097. if (likely(PyInt_Check(x) || PyLong_Check(x)))
  37098. #else
  37099. if (likely(PyLong_Check(x)))
  37100. #endif
  37101. return __Pyx_NewRef(x);
  37102. #if CYTHON_USE_TYPE_SLOTS
  37103. m = Py_TYPE(x)->tp_as_number;
  37104. #if PY_MAJOR_VERSION < 3
  37105. if (m && m->nb_int) {
  37106. name = "int";
  37107. res = m->nb_int(x);
  37108. }
  37109. else if (m && m->nb_long) {
  37110. name = "long";
  37111. res = m->nb_long(x);
  37112. }
  37113. #else
  37114. if (likely(m && m->nb_int)) {
  37115. name = "int";
  37116. res = m->nb_int(x);
  37117. }
  37118. #endif
  37119. #else
  37120. if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
  37121. res = PyNumber_Int(x);
  37122. }
  37123. #endif
  37124. if (likely(res)) {
  37125. #if PY_MAJOR_VERSION < 3
  37126. if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
  37127. #else
  37128. if (unlikely(!PyLong_CheckExact(res))) {
  37129. #endif
  37130. return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
  37131. }
  37132. }
  37133. else if (!PyErr_Occurred()) {
  37134. PyErr_SetString(PyExc_TypeError,
  37135. "an integer is required");
  37136. }
  37137. return res;
  37138. }
  37139. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  37140. Py_ssize_t ival;
  37141. PyObject *x;
  37142. #if PY_MAJOR_VERSION < 3
  37143. if (likely(PyInt_CheckExact(b))) {
  37144. if (sizeof(Py_ssize_t) >= sizeof(long))
  37145. return PyInt_AS_LONG(b);
  37146. else
  37147. return PyInt_AsSsize_t(x);
  37148. }
  37149. #endif
  37150. if (likely(PyLong_CheckExact(b))) {
  37151. #if CYTHON_USE_PYLONG_INTERNALS
  37152. const digit* digits = ((PyLongObject*)b)->ob_digit;
  37153. const Py_ssize_t size = Py_SIZE(b);
  37154. if (likely(__Pyx_sst_abs(size) <= 1)) {
  37155. ival = likely(size) ? digits[0] : 0;
  37156. if (size == -1) ival = -ival;
  37157. return ival;
  37158. } else {
  37159. switch (size) {
  37160. case 2:
  37161. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  37162. return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  37163. }
  37164. break;
  37165. case -2:
  37166. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  37167. return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  37168. }
  37169. break;
  37170. case 3:
  37171. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  37172. return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  37173. }
  37174. break;
  37175. case -3:
  37176. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  37177. return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  37178. }
  37179. break;
  37180. case 4:
  37181. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  37182. return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  37183. }
  37184. break;
  37185. case -4:
  37186. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  37187. return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  37188. }
  37189. break;
  37190. }
  37191. }
  37192. #endif
  37193. return PyLong_AsSsize_t(b);
  37194. }
  37195. x = PyNumber_Index(b);
  37196. if (!x) return -1;
  37197. ival = PyInt_AsSsize_t(x);
  37198. Py_DECREF(x);
  37199. return ival;
  37200. }
  37201. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  37202. return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
  37203. }
  37204. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
  37205. return PyInt_FromSize_t(ival);
  37206. }
  37207. #endif /* Py_PYTHON_H */