Overview

I created a library for registering RDF data to Dydra using Python.

https://github.com/nakamura196/dydra-py

It includes some incomplete implementations, but we hope it proves useful in some situations.

Implementation Details

The import is performed in the following file.

https://github.com/nakamura196/dydra-py/blob/main/dydra_py/api.py#L55

It uses the SPARQL INSERT DATA operation as follows.

defi"IA"h}fpfm"mr"eirop"pg"aliroosdenrr:ffge""stf#ggnieiriettiorrAC(irrtflfefl_slrasuo="lRaa_sssbemptnNeDppdgevpreyR_ah=htsuFhharqI{}":qIG}}"epoep:p_Dpt_oeemi.tauNn}"uNR}}"rrnsrrfFau{rnlbn=papeSt"eSA"bispiiit(ritfeahrE_rEPoneonnldhsiz-.rtrr=_yRdyRH{stntteataT_qdsuTaTne(=s(((t(r(tycodfegr=t=<t:qe"fsas)siphfml(riDaD{_ur.D"et:toeu(ifafA}fAgdeesaElfrrn"ncfbipi"T"Trarqttrfr)T,":khi.lhs"A"Aatyuaar,o:h:_ulGe.""pa)etomeo"rner,sN{{h}susrfTpfadksaeo{{_tsu:iahft"pfs)pfrnus_cleoiBp_::hoier.cc{efroelf(ra:ipoer_ipmnaii")ml}odseplaaarcl,ai>sessaettleaetztfpth)rt(l=e{(=uohio:ifef({s=ln,ntf{oinofelstoUsnl(rol2yefotRe/efmrf0.othIls_iam.0isrthefppltae:ntmheo.aae)tnsaaeRfarts=dettRDpqh)'pru,DDFtil,)#notsyFh_-tie_gdfekuf'ndcrrfiepo)t.oaailgydr,"dpler}am)ehsea"tad}_t(p,etauoteh"=t{rro.fariegwo=e=.i.hrqsNm,emupopraeono'etrnerx)ys,tmd,e.la.v'thte,aeeraxb'wdtonie}stlr"e'ls)=)=F.bhaeelasidene)sr:esr)ted.DefaultstoNone.

Key Design Decision

One notable design decision was handling large RDF files. When uploading large RDF files all at once, there were cases where the process would stop midway.

Therefore, I added a process to split RDF files and upload them in multiple requests.

def_iss"ggccccfpf#ircfee".uuhoirofehll"=prruulirtuoffRarrnnenlunuo..DGreektstsc#ciepfrktuo_Frsnn_(,oufnain_ptucaetti=="ur(tlruptlp(__nTpnrcchefdtupehicsd0[r,teo#tt#iusif_tua(nhie]inueefr=.l_d_tr)puzxp+tnmmraefid__unel=_tpptespsiridotk=eic__epfccneplriu_=n1h%ssmaiuhtleeirtf=1cueiptlru_fn(s=pi0otn1rz_hernc.ds=ulGuqk0iessekh_(eNtternd.0ai=.n_usploeo_,atma0l=zatineafnmudp:(diesp_nkrt,eptifhgd=zlepcd)ih:fpro(")(=ee>lehea)iiu(r),:(dn=fnux>lnltoms0(.dnipe_ual,:=tc_(k+0zu.dtteehsp=:etmip=npcmuea=__kruf(,upnrt1cfdtogr_kihGhit_r)rs_a)ruled"m)eeslanemi"anriipk,pr"ttizzh(())_aee(co)cl:_)uuhicrtuzhrpneu#eukdnnt.)kt_s(_decciruhriru=arnNlekoin,nztee_c,(chfhucounhrnkumk_na,iktn_=cdsfheiouxzrn,emk=a_f5tio0)nr0dm*ea1xt0,=2f4fo,orrmfmaoatrt)m=afto=r'mtautr)tle'):

Summary

We hope this serves as a useful reference for using RDF and Dydra.